summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-07-29 03:01:04 +0000
committerNorbert Preining <norbert@preining.info>2022-07-29 03:01:04 +0000
commitda2dc471ec5bb2620f0ef5a4a700b236d1a8af06 (patch)
treed928b5b5abe4df9287ffda090d15e777c78bd783 /graphics/circuit_macros/examples
parent5937dac9360bdf40d1b0baf9d7384b109fb5b7a7 (diff)
CTAN sync 202207290301
Diffstat (limited to 'graphics/circuit_macros/examples')
-rw-r--r--graphics/circuit_macros/examples/Diodes.m46
-rw-r--r--graphics/circuit_macros/examples/ShadeSector.m414
-rw-r--r--graphics/circuit_macros/examples/Shaky.m4107
-rw-r--r--graphics/circuit_macros/examples/csc.m483
-rw-r--r--graphics/circuit_macros/examples/examples.pdfbin898616 -> 902995 bytes
-rw-r--r--graphics/circuit_macros/examples/files.tex6
-rw-r--r--graphics/circuit_macros/examples/ics.m416
-rw-r--r--graphics/circuit_macros/examples/mf/cct.mf2
-rw-r--r--graphics/circuit_macros/examples/sfg.m433
-rw-r--r--graphics/circuit_macros/examples/svg/DiodesSVG.m46
-rw-r--r--graphics/circuit_macros/examples/svg/GeometrySVG.m4183
-rw-r--r--graphics/circuit_macros/examples/svg/LoglogSVG.m412
-rw-r--r--graphics/circuit_macros/examples/svg/Makefile8
-rw-r--r--graphics/circuit_macros/examples/svg/PconnSVG.m47
-rw-r--r--graphics/circuit_macros/examples/svg/SmithchartSVG.m4222
-rw-r--r--graphics/circuit_macros/examples/svg/cscSVG.m4101
-rw-r--r--graphics/circuit_macros/examples/svg/ex15SVG.m42
-rw-r--r--graphics/circuit_macros/examples/svg/examplesSVG.htmx36
-rw-r--r--graphics/circuit_macros/examples/svg/icsSVG.m416
-rw-r--r--graphics/circuit_macros/examples/svg/keyboardSVG.m4269
-rw-r--r--graphics/circuit_macros/examples/svg/sfgSVG.m439
-rw-r--r--graphics/circuit_macros/examples/tubedefs.m46
22 files changed, 864 insertions, 310 deletions
diff --git a/graphics/circuit_macros/examples/Diodes.m4 b/graphics/circuit_macros/examples/Diodes.m4
index d08a032253..bb34913822 100644
--- a/graphics/circuit_macros/examples/Diodes.m4
+++ b/graphics/circuit_macros/examples/Diodes.m4
@@ -16,6 +16,8 @@ movewid = 2pt__
move down 0.2; right_
{diode(,B) ; move ; "`{\tt diode(,B)}'" ljust}
move down 0.2; right_
+ {diode(,b) ; move ; "`{\tt diode(,b)}'" ljust}
+ move down 0.2; right_
{diode(,G) ; move ; "`{\tt diode(,G)}'" ljust}
move down 0.2; right_
{diode(,D) ; move ; "`{\tt diode(,D)}'" ljust}
@@ -39,13 +41,13 @@ movewid = 2pt__
{diode(,MK) ; move ; "`{\tt diode(,MK)}'" ljust}
}
- move right_ 2.0
+ move down_ sourcerad_ right_ 2.0
{ {diode(,Z,RE) ; move ; "`{\tt diode(,Z,RE)}'" ljust}
move down 0.30; right_
{diode(,U) ; move ; "`{\tt diode(,U)}'" ljust}
move down 0.25; right_
{diode(,T) ; move ; "`{\tt diode(,T)}'" ljust}
- move down 0.30; right_
+ move down 0.20; right_
{diode(,P) ; move ; "`{\tt diode(,P)}'" ljust}
move down 0.30; right_
{diode(,LE) ; move ; "`{\tt diode(,LE)}'" ljust}
diff --git a/graphics/circuit_macros/examples/ShadeSector.m4 b/graphics/circuit_macros/examples/ShadeSector.m4
new file mode 100644
index 0000000000..0632fdb14f
--- /dev/null
+++ b/graphics/circuit_macros/examples/ShadeSector.m4
@@ -0,0 +1,14 @@
+.PS
+# ShadedSector.m4
+# https://tex.stackexchange.com/questions/635327/multi-color-circular-gradient-in-tikz
+
+gen_init
+NeedDpicTools
+
+ rx = 4
+ n = int(rx/lthick)
+ for i=1 to n do { left_
+ hsvtorgb((1-i/n)*180,1,1,r,g,b)
+ arc rad i/n*rx with .c at (0,0) outlined rgbstring(r,g,b) }
+
+.PE
diff --git a/graphics/circuit_macros/examples/Shaky.m4 b/graphics/circuit_macros/examples/Shaky.m4
index 7eff994d91..81364cf515 100644
--- a/graphics/circuit_macros/examples/Shaky.m4
+++ b/graphics/circuit_macros/examples/Shaky.m4
@@ -5,7 +5,7 @@ NeedDpicTools
divert(-1)
`An attempt to draw shaky hand-drawn lines'
- `shakyline(linespec,type,shake=expr,[shakevals])
+ `shakyline(linespec,type,shake=val,[shakevals])
Draw a line with a tremor
arg3: shake parameter (default 1)
arg4=normal(0,1) perturbations used if given'
@@ -17,17 +17,18 @@ define(`shakyline',
End: L_end_
llen = distance(Start,End)
npts = round_(llen/linewid*4)
- setkey_($3,shake,1)
- if "$4"=="" then { randn(d,npts-1,0,m4shake*(llen/npts/8)) }\
- else { for i=1 to npts-1 do { d[i] = $4[i]*m4shake*(llen/npts/8) }}
+ pushkey_(`$3',shake,1)dnl
+ sval = m4shake*llen/npts/8
+ if "$4"=="" then { randn(d,npts-1,0,sval) }\
+ else { for i=1 to npts-1 do { d[i] = $4[i]*sval) }}
P[0]: Start
- for i=1 to npts-1 do { P[i]: i/npts between Start and End + (vec_(0,d[i])) }
+ for i=1 to npts-1 do { P[i]: i/npts between Start and End + vec_(0,d[i]) }
P[npts]: End
- spline $2 from P[0] to P[1]
- for i=2 to npts do { continue to P[i] }
+ spline ifdpic(ifelse(`$2',,ctension_)) $2 from P[0] to P[1]
+ for i=2 to npts do { continue to P[i] } popdef(`m4shake')
] with .Start at L_start_; move to L_end_')
- `shakyarc(arcspec,type,s=shake,[shakevals])
+ `shakyarc(arcspec,type,shake=val,[shakevals])
Draw an arc with a tremor
arg3: s=shake parameter (default 1)
arg4=normal(0,1) perturbations used if given'
@@ -44,99 +45,71 @@ define(`shakyarc',
ar = distance(Start,C)
llen = abs(ar*(ae-as))
npts = round_(llen/linewid*4)
- setkey_($3,s,1)
- if "$4"=="" then { randn(d,npts-1,0,m4s*(llen/npts/8)) }\
- else { for i=1 to npts-1 do { d[i] = $4[i]*m4s*(llen/npts/8) }}
+ pushkey_($3,shake,1)dnl
+ sval = m4shake*llen/npts/8
+ if "$4"=="" then { randn(d,npts-1,0,sval) }\
+ else { for i=1 to npts-1 do { d[i] = $4[i]*sval }}
P[0]: Start
for i=1 to npts-1 do { P[i]: C + (rect_(ar+d[i],as+i/npts*(ae-as))) }
P[npts]: End
- spline $2 from P[0] to P[1]
- for i=2 to npts do { continue to P[i] }
+ spline ifdpic(ifelse(`$2',,ctension_)) $2 from P[0] to P[1]
+ for i=2 to npts do { continue to P[i] } popdef(`m4shake')
] with .Start at last arc.start; move to last arc.end')
- `shakyspline(points,type,s=shake,[shakevals])
- Draw a spline with a tremor
- arg3: s=shake parameter (default 1)
- arg4=normal(0,1) perturbations used if given'
-define(`shakyspline',
-`rpoint_(ifelse(`$1',,`to rvec_(linewid,0)',`$1'))
- SP_start_: last line.start
- SP_end: last line.end
- [ Start: SP_start_
- End: SP_end
- llen = distance(Start,End)
- npts = round_(llen/linewid*4)
- setkey_($3,s,1)
- if "$4"=="" then { randn(d,npts-1,0,m4s*(llen/npts/8)) }\
- else { for i=1 to npts-1 do { d[i] = $4[i]*m4s*(llen/npts/8) }}
- P[0]: Start
- for i=1 to npts-1 do { P[i]: i/npts between Start and End + (vec_(0,d[i])) }
- P[npts]: End
- spline $2 from P[0] to P[1]
- for i=2 to npts do { continue to P[i] }
- ] with .Start at last line.start; move to last line.end')
-
`shakyfitcurve(V,n,linetype,
- m (default 0),s=val,[shakevals])
+ m (default 0),shake=val,[shakevals])
Like fitcurve but the control points
are perturbed
arg5: s=shake parameter (default 1)
arg6=normal(0,1) perturbations used if given'
define(`shakyfitcurve',`
- {[ m4fn = `$2'; m4fm = ifelse(`$4',,0,`$4')
- M4P_[0]: `$1'[m4fm]
- setkey_($5,s,1)
-# if "$6"=="" then { !!!!
-# else { for i=1 to npts-1 do { d[i] = $5[i]*m4s*(llen/npts/8) }}
- for i=m4fm+1 to m4fn-1 do { M4P_[i-m4fm]: `$1'[i]*(4/3) }
- M4P_[m4fn-m4fm]: `$1'[m4fn]
- n = m4fn-m4fm
- # forward substitution
- M4P_[1]: M4P_[1]-M4P_[0]/6
- d[1] = 1
- for i = 2 to n-1 do {
- M4P_[i]: M4P_[i]-M4P_[i-1]/(d[i-1]*6)
- d[i] = 1-1/d[i-1]/36 }
- # backward substitution
- for i= n-1 to 1 by -1 do {
- M4P_[i]: (M4P_[i]-M4P_[i+1]/6)/d[i] }
- # draw using computed control points
- spline 0.55 `$3' from M4P_[0] to 11/32 between M4P_[0] and M4P_[1] \
- then to 5/32 between M4P_[1] and M4P_[2]
- for i=2 to n-2 do { continue to M4P_[i] }
- continue to 27/32 between M4P_[n-2] and M4P_[n-1] \
- then to 21/32 between M4P_[n-1] and M4P_[n] then to M4P_[n]
- ] with .M4P_[0] at `$1'[ifelse(`$4',,0,`$4')]} ')
+ [ m4fn = ifelse(`$2',,2,`$2'); m4fm = ifelse(`$4',,0,`$4')
+ pushkey_($5,shake,1)dnl
+ if "$6"=="" then { randn(d,2*(m4fn-m4fm-1),0,m4shake) }\
+ else { for i=1 to 2*(m4fn-m4fm-1) do { d[i] = $6[i]*m4shake }}
+ M4PP_[0]: `$1'[m4fm]
+ for i=m4fm+1 to m4fn-1 do { M4PP_[i-m4fm]: `$1'[i] dnl
+ +(d[2*(i-m4fm-1)+1],d[2*(i-m4fm-1)+2])\
+ *distance(M4PP_[i-m4fm-1],`$1'[i])/16 }
+ M4PP_[m4fn-m4fm]: `$1'[m4fn]; End: M4PP_[m4fn-m4fm]
+ fitcurve(M4PP_,m4fn-m4fm) popdef(`m4shake')
+ ] with .M4PP_[0] at `$1'[ifelse(`$4',,0,`$4')]; move to last [].End ')
divert(0)
-[
+P1: [
linethick = 2.5
round(,,colored "gray")
nl = 10
for i=0 to nl do {
- shakyline(right 6/nl up 2*(2*pmod(i,2)-1),colored "gray",shake=2-i/nl*2)
+ shakyline(right 6/nl up 2*(2*pmod(i,2)-1),,shake=2)
{sprintf("%g",2-i/nl*2) at 1/2 between L_start_ and L_end_ }
round(,,colored "gray") }
]
-[
+P2: [
linethick = 2.5
na = 3
arcrad = 1
for i=1 to na do {
- shakyarc(,colored "gray",s=1)
+ shakyarc(,colored "gray",shake=2)
}
] with .nw at last [].sw +(0,-1)
-[
+P3: [
linethick = 2.5
na = 3
arcrad = 2
for i=1 to na do {
- shakyarc(,colored "gray",s=1)
+ shakyarc(,colored "gray",shake=2)
}
- ] with .sw at last [].se +(1,0)
+ ] with .w at last [].e +(1,0)
+P4: [
+ n = 0
+ for a=0 to 359 by 30 do { V[n]: (Rect_(1,a)); n+=1 }
+ V[n]: V[0]
+ shakyfitcurve(V,n,,,shake=1)
+ ] with .nw at P2.sw + (0,-0.5)
.PE
diff --git a/graphics/circuit_macros/examples/csc.m4 b/graphics/circuit_macros/examples/csc.m4
index 69b8d20c3c..fdf4b4404f 100644
--- a/graphics/circuit_macros/examples/csc.m4
+++ b/graphics/circuit_macros/examples/csc.m4
@@ -1,12 +1,11 @@
.PS
#.PS 3.5
# csc.m4
+# This file includes AntiqueClock and works for PSTricks, Tikz, and SVG
gen_init
NeedDpicTools
-ifelse(ifpstricks(T)`'ifmpost(T)`'ifpostscript(T)`'ifpgf(T),,
- `PSTricks, MetaPost, PGF, or Postscript required for this diagram',`
-skale = 3.5/3.97*0.9955
+skale = 0.878
circlerad=1.91*skale
hubrad=0.10*skale
s=0.5*skale
@@ -49,7 +48,6 @@ rgbdraw(midnight,
# Sail
thinlines_
- setrgb(midnight)
rgbfill(midnight,
line from coord(0.44,3.38) to coord(0.44,2.6) \
then to coord(2.1,-1.75) \
@@ -76,16 +74,18 @@ rgbdraw(midnight,
spline to coord(-1,-2.08) then to coord(0.55,-1.77)
)
]
-')
-# PSTricks or tikz only:
-ifelse(ifpstricks(T)`'ifpgf(T),T,`
+
Clock: [
+# PSTricks, tikz, or svg only:
+ifelse(ifpstricks(T)`'ifpgf(T)`'ifsvg(T),T,`
#.PS
# AntiqueClock.m4
#gen_init
#NeedDpicTools
iflatex(`latexcommand({\sf)')
+ifsvg(svg_font(font-family="sans-serif" font-stretch="condensed")
+ svg_rot_init(test))
# https://tex.stackexchange.com/questions/236923/generate-analog-clock-with-numbered-face-add-seconds-roman-numerals
@@ -127,17 +127,27 @@ define(`AntiqueHourHand',`[ hhsf = (`$1')/2.2
move to C
v = 0.25*hhsf
{ line to rvec_(1.1*hhsf,0) thick 0.15/(1bp__)*hhsf }
- { C1: circle rad v at rvec_(1.25*hhsf,0) fill_(0) }
+ C1: rvec_(1.25*hhsf,0)
d = `$1'-1.25*hhsf
q = 1bp__*hhsf
r1 = (d^2 + q^2 - v^2)/(v-q)/2
- h = r1+v
- shade(0,
- arc ccw from C1+vec_(d/h*v,(r1+q)/h*v) to \
- C1+vec_(d,q) rad r1 with .c at C1+vec_(d,r1+q)
- arc ccw from C1+vec_(d,-q) to C1+vec_(d/h*v,-(r1+q)/h*v) rad r1 \
- with .c at C1+vec_(d,-r1-q))
- ]')
+ tang = atan2((r1+q),d)
+ for i=0 to 3 do {
+ X[i]: C1+vec_(rect_(v, pi_+i/3*( tang-pi_)))
+ Y[i]: C1+vec_(rect_(v,-pi_+i/3*(-tang+pi_)))
+ }
+ n = 3
+ for i=1 to 4 do { aa = -pi_+tang + i/4*(pi_/2-tang)
+ XX: (d,r1+q)+(rect_(r1,aa))
+ n+=1;
+ X[n]: C1+vec_(XX.x, XX.y)
+ Y[n]: C1+vec_(XX.x,-XX.y)
+ }
+ m = n
+ for i= 0 to m do { n+=1; X[n]: Y[m-i] }
+ fitcurve(X,n,shaded rgbstring(0,0,0))
+ ]')
+
define(`AntiqueClock',`[ # h,m,s,diam
# Clock size parameters:
@@ -183,27 +193,34 @@ Face: circle thick 0 fill_(1) rad r3 at C
circle rad r6 at C
circle rad r7 at C
-# Text rotation for PSTricks or TikZ
- define(`rottext',
- `ifpstricks(`\rput[c]{%g}(0,0)',`ifpgf(`\pgftext[rotate=%g]',%g)')')
+# Ad hoc shift of rotated SVG text
+ ifsvg(`define adj {+(-cosd($`'1)*textht*0.5*sign(180-($`'1)),\
+ (0.25+0.25*cosd(2*($`'1)))*textht) }',
+ `define adj {}')
+
# Outer numbers
- command sprintf("\font\outerfont=cmss12 at %4.2fin",r3-r4)
- for mn = -15 to 15 by 5 do { sprintf("rottext{\outerfont %g}",\
- -mn/60*360,pmod(mn,60)) at C+(Rect_((r3+r4)/2,90-mn/60*360)) }
- for mn = 20 to 40 by 5 do { sprintf("rottext{\outerfont %g}",\
- 180-mn/60*360,mn) at C+(Rect_((r3+r4)/2,90-mn/60*360)) }
+ iflatex(`command sprintf("\font\outerfont=cmss12 at %4.2fin",r3-r4)')
+ ifsvg(`textht = (r3-r4)*0.6')
+ for_(-15,15,5,`aa=90-(m4x)*6
+ r_text(eval(-(m4x)*6),eval((m4x+60)%60),
+ at C+(Rect_((r3+r4)/2,aa)) adj(aa))')
+ for_(20,40,5,`aa=450-(m4x)*6
+ r_text(eval(180-m4x*6),m4x,at C+(Rect_((r3+r4)/2,aa)) adj(aa))')
# Outer tics
for mn = 1 to 60 do { t = 90-mn/60*360
line from C+(Rect_(r5,t)) to C+(Rect_(r4,t)) }
# Inner numbers
- command sprintf("\font\innerfont=cmss12 at %4.2fin",r5-r6)
- Loopover_(`mx',`t = (m4Lx-4)/12*360;
- sprintf("rottext{\scalebox{0.7}[1.0]{\innerfont mx}}",-t) \
- at C+(Rect_((r5+r6)/2,90-t))', IX,X,XI,XII,I,II,III)
- Loopover_(`mx',`t = (m4Lx+3)/12*360;
- sprintf("rottext{\scalebox{0.7}[1.0]{\innerfont mx}}",-t+180) \
- at C+(Rect_((r5+r6)/2,90-t))', IV,V,VI,VII,VIII)
+ iflatex(`command sprintf("\font\innerfont=cmss12 at %4.2fin",r5-r6)')
+ ifsvg(`textht = (r5-r6)*0.6')
+ Loopover_(`mx',`aa=180-(m4Lx-1)*30
+ r_text(eval(120-m4Lx*30),iflatex({\innerfont mx},mx),
+ at C+(Rect_((r5+r6)/2,aa)) adj(aa))',
+ IX,X,XI,XII,I,II,III)
+ Loopover_(`mx',`aa=360-m4Lx*30
+ r_text(eval(90-m4Lx*30), iflatex({\innerfont mx},mx),
+ at C+(Rect_((r5+r6)/2,aa)) adj(aa))',
+ IV,V,VI,VII,VIII)
# Inner tics
for mn = 5 to 60 by 5 do { t = 90-mn/60*360
@@ -216,15 +233,15 @@ Face: circle thick 0 fill_(1) rad r3 at C
# Center
dot(at C,0.1/4*r1,1)
- ]')
+ ]') `# AntiqueClock'
Clock1: AntiqueClock(,,,3.5)
# Clock2: AntiqueClock(4,50,07,2) at Clock1.e+(1.5,0)
iflatex(`latexcommand(}%)')
-
+ ifsvg(`command "</g>"')
#.PE
+',` "AntiqueClock.m4 requires PSTricks, Tikz-pgf, or SVG" ')
] with .sw at last [].se+(0.25,0)
-',` "AntiqueClock.m4 requires pstricks or pgf" ')
.PE
diff --git a/graphics/circuit_macros/examples/examples.pdf b/graphics/circuit_macros/examples/examples.pdf
index 7b89aac55c..dafab3e6a7 100644
--- a/graphics/circuit_macros/examples/examples.pdf
+++ b/graphics/circuit_macros/examples/examples.pdf
Binary files differ
diff --git a/graphics/circuit_macros/examples/files.tex b/graphics/circuit_macros/examples/files.tex
index 03c9ffa090..5fbcf50af8 100644
--- a/graphics/circuit_macros/examples/files.tex
+++ b/graphics/circuit_macros/examples/files.tex
@@ -99,7 +99,7 @@
\bfig{
{\small\centerline{\getpic{Xform}} }
- \caption{The transformer element, drawing direction down
+ \caption{Some variations of the transformer element, drawing direction down
\src{Xform.m4}.}
}
@@ -129,7 +129,7 @@
\bfig{
\centerline{\getpic{Relay}}
- \caption{Some variants of the {\tt relay} macro
+ \caption{Some variants of {\tt relay}
\src{Relay.m4}.}
}
@@ -667,7 +667,7 @@
\bfig{
\centerline{\getpic{Escher}}
- \caption{Two Escher-like objects
+ \caption{Penrose stairs and an Escher-like object
\src{Escher.m4}.}
}
diff --git a/graphics/circuit_macros/examples/ics.m4 b/graphics/circuit_macros/examples/ics.m4
index 98789b73cd..42286d5a8f 100644
--- a/graphics/circuit_macros/examples/ics.m4
+++ b/graphics/circuit_macros/examples/ics.m4
@@ -243,17 +243,17 @@ define(`HDMI_micro',`[
D0`$+$', D0\_SH, D0`$-$', CLK`$+$', CLK\_SH, CLK`$-$',
CEC, GND, SCL, SDA,$+${5}V)
line from Base.nw+(m4bwid*2/3-lg_pinsep,0) up plen
- r_text(21) at last line.c+(-5bp__,0)
- r_text(SH2) at last line.start + (0,-10bp__)
+ r_text(,21,at last line.c+(-5bp__,0))
+ r_text(,SH2,at last line.start + (0,-10bp__))
line from Base.nw+(m4bwid*2/3-2*lg_pinsep,0) up plen
- r_text(20) at last line.c+(-5bp__,0)
- r_text(SH1) at last line.start + (0,-10bp__)
+ r_text(,20,at last line.c+(-5bp__,0))
+ r_text(,SH1,at last line.start + (0,-10bp__))
line from Base.sw+(m4bwid*2/3-lg_pinsep,0) down plen
- r_text(23) at last line.c+(-5bp__,0)
- r_text(SH4) at last line.start + (0, 10bp__)
+ r_text(,23,at last line.c+(-5bp__,0))
+ r_text(,SH4,at last line.start + (0, 10bp__))
line from Base.sw+(m4bwid*2/3-2*lg_pinsep,0) down plen
- r_text(22) at last line.c+(-5bp__,0)
- r_text(SH3) at last line.start + (0, 10bp__)
+ r_text(,22,at last line.c+(-5bp__,0))
+ r_text(,SH3,at last line.start + (0, 10bp__))
#
`$4']')
diff --git a/graphics/circuit_macros/examples/mf/cct.mf b/graphics/circuit_macros/examples/mf/cct.mf
index 85a84e5a7f..10b713bb50 100644
--- a/graphics/circuit_macros/examples/mf/cct.mf
+++ b/graphics/circuit_macros/examples/mf/cct.mf
@@ -1,5 +1,5 @@
% cct.mf, generated by Mfpic, v1.10 2012/12/03,
-% from TeX source "font" on 2022/02/11 at 17:20
+% from TeX source "font" on 2022/07/27 at 16:40
numeric mfpicversion; mfpicversion := 110;
if unknown mode: mode := localfont; fi
if unknown mag: mag := 1000/1000; fi
diff --git a/graphics/circuit_macros/examples/sfg.m4 b/graphics/circuit_macros/examples/sfg.m4
index 9a97d828d5..a2efdb2ec6 100644
--- a/graphics/circuit_macros/examples/sfg.m4
+++ b/graphics/circuit_macros/examples/sfg.m4
@@ -14,7 +14,7 @@ T:[
sfgline(,K/M)
DDY2: sfgnode(,\ddot{y}_2,sfgbelow rjust)
sfgline(,s^{-1})
- DY2: sfgnode(,`\dot{y}_2=x_2',sfgbelow ljust)
+ DY2: sfgnode(,\d`'ot{y}_2=x_2,sfgbelow ljust) dnl dot is an m4 macro
sfgline(,s^{-1})
Y2: sfgnode(,y_2=x_1,sfgbelow ljust)
@@ -23,6 +23,7 @@ T:[
sfgarc(from Y2 to DDY2,-K/M,above,ccw,sf)
sfgarc(from Y2 to Y1,1,sfgabove,,sf)
]
+#showbox_(,"T")
# Graph 2
B: [
@@ -39,6 +40,7 @@ B: [
sfgself(at X1,R,\;a_{11},ljust,cw,1.5)
sfgself(at X2,-90,a_{22},sfgbelow)
] with .w at T.e + (linewid/2,-linewid/4)
+#showbox_(,"B")
# Graph 3
G3: [#sfg_init( 0.85,0.35/2 ) # change node spacing and increase node size
@@ -50,6 +52,7 @@ G3: [#sfg_init( 0.85,0.35/2 ) # change node spacing and increase node size
sfgarc(from N2 to N1,F_2,sfgabove,ccw,)
sfgarc(from N3 to N1,F_3,sfgbelow,ccw,1.4)
] with .nw at T.sw
+#showbox_(,"G3")
A: [#sfg_init( 0.75,0.15 )
sfg_wid = 0.75
@@ -65,6 +68,7 @@ A: [#sfg_init( 0.75,0.15 )
sfgself(at R,-90,e,sfgabove,cw)
arrow right linewid*2/3 from R.e
] with .w at G3.e+(linewid/2,0)
+#showbox_(,"A")
G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size
s1 = 0.9
@@ -85,6 +89,33 @@ G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size
sfgline(right_ sfg_wid/2,\nu+3\lambda,below,->)
{"$\ldots$" wid 0.3 ljust}
] with .nw at G3.sw+(0,-0.15)
+#showbox_(,"G4")
+
+# https://tex.stackexchange.com/questions/637455/tikz-how-to-set-exact-position-of-node
+G5: [sfg_init( 1.75,0.25/2 ) # change node spacing and increase node size
+ Dstar: sfgnode(,*)
+ D0: sfgnode(at Dstar+(2,0),\diamond_0)
+ sfgline(,`1-r_{x{-}1,x}-q^i_{x{-}1,x}',,->)
+ Ddots: sfgnode(,\cdots)
+ sfgline(,`1-r_{x{-}4,x}-q^i_{x{-}4,x}',,->)
+ D5: sfgnode(,\diamond_5)
+ DD: sfgnode(at D0+(0,-1.0),\dagger)
+ sfgself(at Dstar,L,,,,0.5)
+ "$`1-i_x-q^a_x'$" wid 45bp__ at Dstar + (-0.3,0.25)
+ sfgself(at DD,D,1\mathstrut,above_,,0.5)
+ sfgself(at D5,R,,,,0.5)
+ "$`1-q^i_x-r_x'$" wid 47bp__ at D5 + (0.3,0.25)
+ sfgarc(from D0 to Dstar ->,`r_{x,x}\mathstrut',below_,ccw)
+ sfgarc(from Dstar to D0 ->,`i_x\mathstrut',above_,ccw)
+ sfgarc(from Dstar to DD ->,`q^a_x\mathstrut',above_ ljust_,ccw)
+ sfgline(from D0 to DD,`\;q^i_{x,x}',ljust,->)
+ sfgarc(from Ddots to Dstar,`r_{j,x}\mathstrut',below_,ccw,,->)
+ sfgarc(from Ddots to DD ->,`q^i_{x{-}j,x}\mathstrut',above_ rjust_,)
+ sfgarc(from D5 to Dstar ->,`r_x\mathstrut',below_,ccw)
+ sfgarc(from D5 to DD ->,`q^i_x\mathstrut',above_ rjust_,)
+ ] with .nw at G4.sw+(0,-0.15)
+#howbox_(,"G5")
+
move from (T.w,G4.s)-(7bp__,6bp__) to B.ne+(15bp__,6bp__)
]
#showbox_
diff --git a/graphics/circuit_macros/examples/svg/DiodesSVG.m4 b/graphics/circuit_macros/examples/svg/DiodesSVG.m4
index 543132fe33..8af6a2e298 100644
--- a/graphics/circuit_macros/examples/svg/DiodesSVG.m4
+++ b/graphics/circuit_macros/examples/svg/DiodesSVG.m4
@@ -15,6 +15,8 @@ movewid = 2pt__
move down 0.2; right_
{diode(,B) ; move ; "`diode(,B)'" ljust}
move down 0.2; right_
+ {diode(,b) ; move ; "`diode(,b)'" ljust}
+ move down 0.2; right_
{diode(,G) ; move ; "`diode(,G)'" ljust}
move down 0.2; right_
{diode(,D) ; move ; "`diode(,D)'" ljust}
@@ -38,8 +40,8 @@ movewid = 2pt__
{diode(,MK) ; move ; "`diode(,MK)'" ljust}
}
- move right_ 2.0
-{ {diode(,Z,RE) ; move ; "`diode(,Z,RE)'" ljust}
+ move down_ sourcerad_ right_ 2.0
+{ {diode(,Z,RE) ; move ; "`diode(,Z,RE)'" wid 70bp__ ljust}
move down 0.25; right_
{diode(,T) ; move ; "`diode(,T)'" ljust}
move down 0.30; right_
diff --git a/graphics/circuit_macros/examples/svg/GeometrySVG.m4 b/graphics/circuit_macros/examples/svg/GeometrySVG.m4
index de5fc62523..576315d285 100644
--- a/graphics/circuit_macros/examples/svg/GeometrySVG.m4
+++ b/graphics/circuit_macros/examples/svg/GeometrySVG.m4
@@ -2,98 +2,9 @@
# Geometry.m4
# Some constructions from https://tex.stackexchange.com/
gen_init
+maxpswid = 9
-Fig1: [ ls = 2/3 # local scale
- A: Here; "A" at A above
- B: A+(-1*ls,-3.5*ls); "B" at B below rjust
- C: B+(4.6*ls,0); "C" at C below ljust
- AB: line from A to B
- BC: line from B to C
- CA: line from C to A
-
- perpto(A,BC,L); "L" at L below
- AL: line from A to L; RightAngle(A,L,C)
-
- angleLAC = atan2(C.x-L.x,A.y-L.y)
- S: move from A to (sin(angleLAC/2),-cos(angleLAC/2))
- AW: line from A to Intersect_(S,BC)
- W: Here; "W" at W below rjust
-
- perpto(C,AB,N); "N" at N above rjust
- CN: line from C to N; RightAngle(C,N,B)
-
- perpto(B,CA,M); "M" at M above
- CM: line from B to M; RightAngle(B,M,C)
-
- H: Intersect_(CN,AL); "H" at H +(4bp__,10bp__)
-
- thinlines_
- Equidist3(B,L,N,CC1,c1rad); C1: circle rad c1rad at CC1
- Equidist3(B,W,N,CC2,c2rad); C2: circle rad c2rad at CC2
- Equidist3(B,C,N,CC3,c3rad); C3: circle rad c3rad at CC3
- Equidist3(W,C,M,CC4,c4rad); C4: circle rad c4rad at CC4
- thicklines_
-
- Z: LCintersect(AW,CC2,C2.rad); "Z" at Z+(-5bp__,-5bp__)
- HZ: move from H to Z
- Y: LCintersect(HZ,CC4,C4.rad,R); "Y" at Y above
- X: LCintersect(HZ,CC2,C2.rad); "X" at X above rjust
-
- Loopover_(`P',`dot(at P)',X,Y,Z)
-
- line dashed from X to Y chop -linewid/2
- RightAngle(A,Z,Y)
- ]
-
-Fig2: [ ls = 3/4 # local scale
-# https://tex.stackexchange.com/questions/593272/drawing-complex-geometry
- P: dot(at Here); "P" at P.s below
- N: dot(at P+(3.5*ls,1.5*ls)); "N" at N.se ljust below
- O: dot(at (N,P)); "O" at O.s below
- R: dot(at 1/3 between O and P);"R" at R.s below
- M: dot(at (R,N)); "M" at M.se ljust below
- Q: dot(at (M.x,M.y+distance(M,N)/distance(N,O)*distance(P,O)));"Q" at Q.e ljust
- line from P to Q then to N then to O
- B: line to P chop -0.3
- line from M to N
- Pu: line from R to Q chop 0 chop -0.3
- H: line from P to N chop 0 chop -0.3
- X: dot(at Intersect_(Pu,H)); "X" at X.se ljust below
- thinlines_
- RightAngle(Q,M,N)
- RightAngle(Q,N,H.end)
- RightAngle(N,O,B.start)
- ArcAngle(N,P,Q,0.4); "svg_beta" at last arc.ne above ljust
- ArcAngle(O,P,N,0.5); "svg_alpha" at last arc.start+(5bp__,8bp__)
- ArcAngle(R,Q,N,0.5); "svg_alpha" at last arc.start+(8bp__,-5bp__)
- ] with .w at Fig1.e+(-0.4,0)
-
-Fig3: [
-# FourbarSVG.m4
-# https://tex.stackexchange.com/questions/609452/help-drawing-a-more-sophisticated-right-triangle-with-tikz-or-something-else
-
- textkht = 12/72
- unit = 0.6
- C: Here; { "C" at C rjust below }
- B: C+(4*unit,0); { "B" at B ljust below }
- A: C+(0,3*unit); { "A" at A rjust above }
- H: PerpTo(C,A,B); { "H" at H ljust above }
- line from C to H then to B then to C shaded rgbstring(0.5,0.8,0.9)
-# line from C to H then to B then to C shaded "CornflowerBlue"
- line from C to H then to A then to C shaded rgbstring(0.8,0.9,0.7)
-# line from C to H then to A then to C shaded "SpringGreen"
- ArcAngle(C,A,B,unit*0.4)
- ArcAngle(C,A,B,unit*0.5)
- ArcAngle(A,B,C,unit*0.5,,"svg_theta" rjust)
- ArcAngle(B,C,H,unit*0.5); {"svg_theta" at C+(unit*0.3,unit*0.17) }
- ArcAngle(B,C,A,unit*0.6)
- RightAngle(B,C,A,unit*0.17)
- RightAngle(C,H,A,unit*0.17)
-
- ] with .nw at Fig1.sw+(0.2,-0.3)
-
-Fig4: [
-
+Fig1: [
# FourbarSVG.m4
# https://tex.stackexchange.com/questions/563831/how-to-draw-four-bar-linkage-with-center-of-mass
ls = 1/25.4 # local scale
@@ -149,7 +60,95 @@ define(`pivot',`[
line from A0+(3*ls,0) right 8*ls
ArcAngle(Here,A0,B1,9*ls) ->; "svg_theta`'svg_sub(0)" \
at last arc.start+(2,2)*ls
+ ]
+
+Fig2: [
+# FourbarSVG.m4
+# https://tex.stackexchange.com/questions/609452/help-drawing-a-more-sophisticated-right-triangle-with-tikz-or-something-else
+
+ textkht = 12/72
+ unit = 0.6
+ C: Here; { "C" at C rjust below }
+ B: C+(4*unit,0); { "B" at B ljust below }
+ A: C+(0,3*unit); { "A" at A rjust above }
+ H: PerpTo(C,A,B); { "H" at H ljust above }
+ line from C to H then to B then to C shaded rgbstring(0.5,0.8,0.9)
+# line from C to H then to B then to C shaded "CornflowerBlue"
+ line from C to H then to A then to C shaded rgbstring(0.8,0.9,0.7)
+# line from C to H then to A then to C shaded "SpringGreen"
+ ArcAngle(C,A,B,unit*0.4)
+ ArcAngle(C,A,B,unit*0.5)
+ ArcAngle(A,B,C,unit*0.5,,"svg_theta" rjust)
+ ArcAngle(B,C,H,unit*0.5); {"svg_theta" at C+(unit*0.3,unit*0.17) }
+ ArcAngle(B,C,A,unit*0.6)
+ RightAngle(B,C,A,unit*0.17)
+ RightAngle(C,H,A,unit*0.17)
+ ] with .nw at Fig1.sw+(0.2,0)
+
+
+Fig3: [ ls = 3/4 # local scale
+# https://tex.stackexchange.com/questions/593272/drawing-complex-geometry
+ P: dot(at Here); "P" at P.s below
+ N: dot(at P+(3.5*ls,1.5*ls)); "N" at N.se ljust below
+ O: dot(at (N,P)); "O" at O.s below
+ R: dot(at 1/3 between O and P);"R" at R.s below
+ M: dot(at (R,N)); "M" at M.se ljust below
+ Q: dot(at (M.x,M.y+distance(M,N)/distance(N,O)*distance(P,O)));"Q" at Q.e ljust
+ line from P to Q then to N then to O
+ B: line to P chop -0.3
+ line from M to N
+ Pu: line from R to Q chop 0 chop -0.3
+ H: line from P to N chop 0 chop -0.3
+ X: dot(at Intersect_(Pu,H)); "X" at X.se ljust below
+ thinlines_
+ RightAngle(Q,M,N)
+ RightAngle(Q,N,H.end)
+ RightAngle(N,O,B.start)
+ ArcAngle(N,P,Q,0.4); "svg_beta" at last arc.ne above ljust
+ ArcAngle(O,P,N,0.5); "svg_alpha" at last arc.start+(5bp__,8bp__)
+ ArcAngle(R,Q,N,0.5); "svg_alpha" at last arc.start+(8bp__,-5bp__)
+ ] with .sw at Fig2.e+(-0.4,-0.7)
+
+Fig4: [ ls = 2/3 # local scale
+ A: Here; "A" at A above
+ B: A+(-1*ls,-3.5*ls); "B" at B below rjust
+ C: B+(4.6*ls,0); "C" at C below ljust
+ AB: line from A to B
+ BC: line from B to C
+ CA: line from C to A
+
+ perpto(A,BC,L); "L" at L below
+ AL: line from A to L; RightAngle(A,L,C)
+
+ angleLAC = atan2(C.x-L.x,A.y-L.y)
+ S: move from A to (sin(angleLAC/2),-cos(angleLAC/2))
+ AW: line from A to Intersect_(S,BC)
+ W: Here; "W" at W below rjust
+
+ perpto(C,AB,N); "N" at N above rjust
+ CN: line from C to N; RightAngle(C,N,B)
- ] with .nw at Fig3.ne+(0.2,0.2)
+ perpto(B,CA,M); "M" at M above
+ CM: line from B to M; RightAngle(B,M,C)
+
+ H: Intersect_(CN,AL); "H" at H +(4bp__,10bp__)
+
+ thinlines_
+ Equidist3(B,L,N,CC1,c1rad); C1: circle rad c1rad at CC1
+ Equidist3(B,W,N,CC2,c2rad); C2: circle rad c2rad at CC2
+ Equidist3(B,C,N,CC3,c3rad); C3: circle rad c3rad at CC3
+ Equidist3(W,C,M,CC4,c4rad); C4: circle rad c4rad at CC4
+ thicklines_
+
+ Z: LCintersect(AW,CC2,C2.rad); "Z" at Z+(-5bp__,-5bp__)
+ HZ: move from H to Z
+ Y: LCintersect(HZ,CC4,C4.rad,R); "Y" at Y above
+ X: LCintersect(HZ,CC2,C2.rad); "X" at X above rjust
+
+ Loopover_(`P',`dot(at P)',X,Y,Z)
+
+ line dashed from X to Y chop -linewid/2
+ RightAngle(A,Z,Y)
+ ] with .w at Fig3.e+(-0.4,0.8)
.PE
diff --git a/graphics/circuit_macros/examples/svg/LoglogSVG.m4 b/graphics/circuit_macros/examples/svg/LoglogSVG.m4
index 37e6d746c6..b010b7bd41 100644
--- a/graphics/circuit_macros/examples/svg/LoglogSVG.m4
+++ b/graphics/circuit_macros/examples/svg/LoglogSVG.m4
@@ -88,7 +88,7 @@ Cons: [
#gen_init
svg_font(Helvetica,10pt__)
-#svg_rot_init(test)
+#vg_rot_init(test)
svg_rot_init(LoglogSVG)
divert(-1)
@@ -519,7 +519,7 @@ Left: line from dtop(yearmin,tonsmin) to dtop(yearmin,tonsmax)
move to dtop(yearmin,y)
if y<2 then {{ line right htic }}
sprintf("%g",y) wid 5bp__ rjust }
- svg_rot(90,"Tonnes of oil equivalent per capita" at Left-(0.3,0))
+ svg_rot(90,"Tonnes of oil equivalent per capita",at Left-(0.3,0))
Right: line from dtop(yearmax,tonsmin) to dtop(yearmax,tonsmax)
for p=0 to popmax do {
@@ -585,16 +585,16 @@ Cl: "Coal" wid 20bp__ at dtop(2000,0.36+3pt__)
"Oil" wid 15bp__ at dtop(2000,0.9)
"Gas" wid 20bp__ at dtop(2000,1.41)
"Wood" wid 20bp__ at dtop(1889,0.15)
- svg_rot(50,"Population" at dtop(1975,0.9))
+ svg_rot(50,"Population",at dtop(1975,0.9))
brpos = 2017
Q: brace(down_ 2.96 with .c at dtop(brpos,1.03))
- svg_rot(90,"90 %" at Q.c+(15bp__,2bp__))
- svg_rot(90,"nonrenewable" at Q.c+(26bp__,2bp__))
+ svg_rot(90,"90 %",at Q.c+(15bp__,2bp__))
+ svg_rot(90,"nonrenewable",at Q.c+(26bp__,2bp__))
R: brace(down_ 0.28 with .c at dtop(brpos,.09))
[svg_rot(90,"10 %")] ht 15bp__ wid 10bp__ at R.c+(15bp__,4bp__)
- svg_rot(90,"renewable" at R.c+(26bp__,17bp__))
+ svg_rot(90,"renewable",at R.c+(26bp__,17bp__))
linethick_(0.6)
arrow <- from dtop(1998,1.55) left 0.15 up 0.2
diff --git a/graphics/circuit_macros/examples/svg/Makefile b/graphics/circuit_macros/examples/svg/Makefile
index 0b01e8bc61..c3144811dc 100644
--- a/graphics/circuit_macros/examples/svg/Makefile
+++ b/graphics/circuit_macros/examples/svg/Makefile
@@ -75,9 +75,9 @@ CCTSVG = \
ex01SVG.svg ex02SVG.svg ex03SVG.svg ex04SVG.svg ex05SVG.svg ex06SVG.svg \
ex08SVG.svg ex09SVG.svg ex10SVG.svg ex11SVG.svg ex12SVG.svg \
ex15SVG.svg ex16SVG.svg ex17SVG.svg ex18SVG.svg ex21SVG.svg \
- expSVG.svg fetSVG.svg graysurfSVG.svg lcctSVG.svg \
+ expSVG.svg fetSVG.svg graysurfSVG.svg keyboardSVG.svg lcctSVG.svg \
pwrsupplySVG.svg quickSVG.svg randomSVG.svg recycleSVG.svg relaycoilSVG.svg \
- roseSVG.svg sfgSVG.svg shapesSVG.svg paletteSVG.svg \
+ roseSVG.svg sfgSVG.svg shapesSVG.svg SmithchartSVG.svg paletteSVG.svg \
thyristorSVG.svg ujtSVG.svg UNOSVG.svg wormSVG.svg XORSVG.svg Np.svg
examplesSVG.html: examplesSVG.htmx
@@ -114,14 +114,14 @@ tstSVG.html: tstSVG.htmx $(TEST).svg
xst: Incleps.png
# necessary because of rotated text:
-LoglogSVG.svg test.svg:
+LoglogSVG.svg:
m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic
$(DPIC) -v $*.pic > $*.svg
m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic
$(DPIC) -v $*.pic > $*.svg
grep '<\!-- width' $*.svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' > $*.siz
-ConnectorsSVG.svg cscSVG.svg test.svg:
+ConnectorsSVG.svg cscSVG.svg SmithchartSVG.svg test.svg:
m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic
$(DPIC) -v $*.pic > $*.svg
m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic
diff --git a/graphics/circuit_macros/examples/svg/PconnSVG.m4 b/graphics/circuit_macros/examples/svg/PconnSVG.m4
index 43fb2d20eb..7cef1f5619 100644
--- a/graphics/circuit_macros/examples/svg/PconnSVG.m4
+++ b/graphics/circuit_macros/examples/svg/PconnSVG.m4
@@ -45,14 +45,11 @@ P2: [
`"(,GC)"' at last [].s below
C12: pconnex(,GCF) with .w at last [].e + (0.2,0)
`"(,GCF)"' at last [].s below
-] with .nw at P1.C1.sw + (0,-0.35)
-
-P3:[
- C4: pconnex(,P)
+ C4: pconnex(,P) with .w at last [].e + (0.2,0)
`"(,P)"' at last [].s below
C11: pconnex(,PF) with .w at last [].e+(0.2,0)
`"(,PF)"' at C11.s below
-] with .nw at P2.C9.sw + (0,-0.35)
+] with .nw at P1.C1.sw + (0,-0.35)
command "</g>" # end font
diff --git a/graphics/circuit_macros/examples/svg/SmithchartSVG.m4 b/graphics/circuit_macros/examples/svg/SmithchartSVG.m4
new file mode 100644
index 0000000000..eb47e6585e
--- /dev/null
+++ b/graphics/circuit_macros/examples/svg/SmithchartSVG.m4
@@ -0,0 +1,222 @@
+.PS
+# Smithchart.m4
+gen_init
+#https://utah.instructure.com/courses/684846
+#https://www.youtube.com/watch?v=RptPsP8hS4g
+#https://www.youtube.com/watch?v=UUk1R01uEoE
+##https://www.youtube.com/watch?v=TsXd6GktlYQ
+
+scalefactor = 6.5/2 # to vary the final chart diameter
+scalefactor = 6.5/2*3/4 # 3/4 scale for svg examples
+# Basic definitions
+define Rac {($1/($1+1),0)*scalefactor} # centre of const ra circle
+define rar {1/abs($1+1)*scalefactor} # radius
+define Xac {(1,1/($1))*scalefactor} # centre of const xa circle
+define xar {1/abs($1)*scalefactor} # radius
+define Rc {CRc[$1*100]} # Rc circle indexed by value
+define Xc {CXc[$1*100]} # Xc circle indexed by value
+define grayline {outlined graystring($1)}
+define arct {arc thick $1}
+
+# `SGamma(ra,xa) chart location of complex value'
+define(`SGamma',`(ifelse(`$2',0,`Rc($1).w',
+ `Cintersect(Rac(`$1'),rar(`$1'),Xac(`$2'),xar(`$2'), dnl
+ ifelse(substr(`$2',0,1),-,R))'))')
+# 1-piece Ra arc
+define(`RaArc1',`ifinstr(`$1',to,for ix=`$1' do,ix=`$1';) {
+ Rc(ix): arct(`$2') grayline(`$2'g) dnl
+ from SGamma(ix,`$3') to SGamma(ix,-(`$3')) with .c at Rac(ix)}')
+# 2-piece Ra arc
+define(`RaArc2',`ifinstr(`$1',to,for ix=`$1' do,ix=`$1';) {
+ Rc(ix): arct(`$2') grayline(`$2'g) dnl
+ from SGamma(ix,`$3') to SGamma(ix,`$4') with .c at Rac(ix)
+ arct(`$2') grayline(`$2'g) dnl
+ from SGamma(ix,-(`$4')) to SGamma(ix,-(`$3')) with .c at Rac(ix)}')
+# Positive and negative Xa arcs
+define(`XaArc2',`ifinstr(`$1',to,for ix=`$1' do,ix=`$1';) {
+ Xc(ix): arct(`$2') grayline(`$2'g) dnl
+ from SGamma(`$3',ix) to SGamma(`$4',ix) with .c at Xac(ix)
+ Xc(-ix): arct(`$2') grayline(`$2'g) dnl
+ cw from SGamma(`$3',-ix) to SGamma(`$4',-ix) with .c at Xac(-ix)}')
+
+define(`Smithchart',`[
+iflatex(s_init(tst)
+ command "{\tiny")
+ifsvg(svg_font(sans-serif,10bp__)
+ svg_rot_init(SmithchartSVG))
+
+ thk = 1.2 # wicth of thick lines (pt)
+ thn = 0.4 # thin lines
+ thkg = 0.33 # weight of thick lines
+ thkg =0.5
+ thng = 0.4 # weight of thin lines
+ thng = 0.6
+
+C: circle thick thk rad rar(0) at (0,0)
+ line thick thk grayline(thkg) from C.w to C.e
+
+Rc(50): circle thick thk grayline(thkg) rad rar(50) at Rac(50)
+Loopover_(`term',`RaArc1(patsubst(term,:,`,'))',
+ 20:thn:50,
+ 30 to 40 by 10:thn:50,
+ 20:thk:20,
+ 12 to 18 by 2:thn:20,
+ 10:thn:50,
+ 10:thk:20,
+ 6 to 9:thn:10,
+ 5:thk:10,
+ 2.2 to 4.81 by 0.2:thn:5,
+ 4:thn:20,
+ 4:thk:5,
+ 3:thn:10,
+ 3:thk:5,
+ 2:thn:20,
+ 2:thk:5,
+ 1.1 to 1.91 by 0.2:thn:2,
+ 1.2 to 2.01 by 0.2:thk:2,
+ 1:thn:10,
+ 1:thk:5,
+ 0.2 to 1.81 by 0.2:thn:5,
+ 0.2 to 0.81 by 0.2:thk:2,
+ 0.6 to 0.91 by 0.1:thk:1,
+ 0.55 to 0.951 by 0.1:thn:1,
+ 0.1 to 0.91 by 0.2:thn:2,
+ 0.1 to 0.91 by 0.2:thk:1,
+ 0.22 to 0.481 by 0.02:thn:0.5,
+ 0.01 to 0.191 by 0.01:thn:0.2,
+ 0.05 to 0.151 by 0.1:thk:0.2)
+
+Loopover_(`term',`RaArc2(patsubst(term,:,`,'))',
+ 0.05 to 0.451 by 0.1:thn:1:0.5,
+ 0.02 to 0.181 by 0.02:thn:0.5:0.1)
+
+Xc(50): arct(thk) cw grayline(thkg) from C.e \
+ to SGamma(0,50) with .c at Xac(50)
+Xc(-50): arct(thk) grayline(thkg) from C.e \
+ to SGamma(0,-50) with .c at Xac(-50)
+
+Loopover_(`term',`XaArc2(patsubst(term,:,`,'))',
+ 10 to 20 by 10:thn:0:50,
+ 7 to 9 by 2:thn:0:10,
+ 2 to 18 by 2:thn:0:20,
+ 0.2 to 4.81 by 0.2:thn:0:5,
+ 1.1 to 1.91 by 0.2:thn:0:2,
+ 1 to 4:thn:0:10,
+ 0.1 to 0.91 by 0.2:thn:0:2,
+ 0.22 to 0.481 by 0.02:thn:0:0.5,
+ 0.55 to 0.951 by 0.1:thn:0:1,
+ 10 to 20 by 10:thk:0:20,
+ 5:thk:0:10,
+ 1.2 to 1.81 by 0.2:thk:0:2,
+ 1 to 4:thk:0:5,
+ 0.2 to 0.81 by 0.2:thk:0:2,
+ 0.1 to 0.91 by 0.2:thk:0:1)
+
+Loopover_(`term',`XaArc2(patsubst(term,:,`,'))',
+ 0.05 to 0.451 by 0.1:thn:0.5:1,
+ 0.02 to 0.181 by 0.02:thn:0:0.5,
+ 0.02 to 0.191 by 0.01:thn:0:0.2, dnl 0.02 should be 0.01
+ 0.05 to 0.151 by 0.1:thk:0:0.2)
+dnl these avoid TeX arithmetic overflow:
+ line thick thn grayline(thng) from SGamma(0,0.01) to SGamma(0.2,0.01)
+ line thick thn grayline(thng) from SGamma(0,-0.01) to SGamma(0.2,-0.01)
+ dot(at C,,1,grayline(thkg))
+
+dnl Internal labels start here
+ textht = C.wid/120
+# Horizontal axis
+Loopover_(`t',`box wid textht ht textht*1.5 colored "white" \
+ with .se at Rc(t).w+(-2bp__,2bp__)
+ r_text(90,"t",at Rc(t).w+(-textht/3,textht*1.5))',
+ 0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9, 1,1.2,1.4,1.6,1.8, 2,3,4,5,10,20,50)
+# Xc=1 labels
+Loopover_(`tt',
+ `define(`m4ta',patsubst(tt,:.*))define(`m4vl',patsubst(tt,.*:))dnl
+ X: SGamma(m4vl,1)
+ M: move from Rc(m4vl) to X; ax = lin_ang(M)*rtod_-90 #; print ax
+ r_text(m4ta,m4vl,at X+(Rect_(textht*2,ax+30)))
+ Y: X-Rc(m4vl); X: Rc(m4vl)+(Y.x,-Y.y)
+ r_text(-m4ta,m4vl,at X+(Rect_(textht*1.7,-(ax+30)))) ',
+ 10:0.2, 19:0.4, 26:0.6, 32:0.8, 37:1)
+# right-side circumference
+Loopover_(`tt',
+ `define(`m4ta',patsubst(tt,:.*))define(`m4vl',patsubst(tt,.*:))dnl
+ X: Xc(m4vl).start; ax = atan2(X.y,X.x)*rtod_ ; # print round_(ax)
+ r_text(m4ta,m4vl,at X+(Rect_(textht*2,ax-120)))
+ if m4vl>=2 then {
+ r_text(-m4ta,m4vl,at (X.x,-X.y)+(Rect_(textht*1.5,-ax+135))) }\
+ else { r_text(-m4ta,m4vl,at (X.x,-X.y)+(Rect_(textht*2,-ax+150))) } ',
+ 6:20, 11:10, 23:5, 28:4, 37:3, 53:2, 58:1.8, 64:1.6, 71:1.4, 80:1.2, 90:1)
+# left-side circumference
+Loopover_(`tt',
+ `X: Xc(m4Lx*0.1).start; # print round_(atan2(X.y,X.x)*rtod_-180)
+ r_text(-patsubst(tt,:,`,'),at X+(Rect_(textht*1.7,-m4Lx*11+40)))
+ r_text( patsubst(tt,:,`,'),at (X.x,-X.y)+(Rect_(textht*2.1,m4Lx*11-30))) ',
+ 11:0.1, 23:0.2, 33:0.3, 44:0.4, 53:0.5, 62:0.6, 70:0.7, 77:0.8, 84:0.9)
+# Ra=1 labels
+Loopover_(`tt',`X: SGamma(1,m4Lx*0.2)
+ M: move from Rac(1) to X; # print round_(lin_ang(M)*rtod_-180)
+ r_text(-eval(m4Lx*11),ifelse(m4Lx,5,1,0.eval(m4Lx*2)),
+ at X+(Rect_(textht*1.5,-m4Lx*11+40)))
+ r_text( eval(m4Lx*11),ifelse(m4Lx,5,1,0.eval(m4Lx*2)),
+ at (X.x,-X.y)+(Rect_(textht*2,m4Lx*11-30))) ',
+ 11:0.2, 23:0.4, 33:0.6, 44:0.8, 53:1)
+
+ textht *=0.9
+# Wavelength circle and tics
+ wvsep = textht*3/2
+ wltic = C.wid/120
+ circle thick thn grayline(thkg) diam C.diam+wltic/2+wvsep*11 at C
+W: circle thick thn grayline(thkg) diam C.diam+wvsep*8 at C
+ for tc=0 to 249 do {ax = 180-tc/250*360; line thick thn grayline(thkg) \
+ from W+(Rect_(W.rad+wltic/2,ax)) to W+(Rect_(W.rad-wltic/2,ax)) }
+# Wavelength circle labels
+for_(0,49,1,
+ `ifelse(eval(m4x<5),1,,
+ `r_text(eval(90-m4x*180/25),ifelse(m4x,0,0,eval(m4x<10),1,0.0`'m4x,0.`'m4x),
+ at W+(Rect_(W.rad+wltic/2+textht*0.5,180-m4x*180/25)))')
+ ifelse(eval(m4x<47),1,
+ `r_text(eval(90-m4x*180/25),ifelse(m4x,0,0,eval(m4x>40),1,0.0`'eval(50-m4x),
+ 0.`'eval(50-m4x)), at W+(Rect_(W.rad-wltic/2-textht*1.0,180-m4x*180/25)))')')
+
+ circle thick thn grayline(thkg) diam C.diam+wvsep*5 at C
+A: circle thick thn grayline(thkg) diam C.diam+wvsep*2.5 at C
+ for tc=0 to 359 by 2 do {line thick thn grayline(thkg) \
+ from A+(Rect_(A.rad+wltic/2,tc)) to A+(Rect_(A.rad,tc)) }
+for_(20,170,10,
+ `r_text(eval(-90+m4x),m4x,at A+(Rect_(A.rad+textht*0.5,m4x)))
+ r_text(eval( 90-m4x),-m4x,at A+(Rect_(A.rad+textht*1.2,-m4x)))
+ ')
+ r_text(90,180,at A-(A.rad+textht/2,0))
+Loopover_(`rca',
+ `r_text(eval(90-(180-rca/10)),eval(m4Lx*5+5),
+ at A+(Rect_(A.rad-textht*0.7,rca/10)))
+ r_text(eval(-90+(180-rca/10)),eval(-m4Lx*5-5),
+ at A+(Rect_(A.rad-textht*0.7,-rca/10))) ',
+ 195,295,392,490,588,685,782,880,967,1072,
+ 1165,1260,1352,1438,1518,1598,1645)
+
+# Internal labels
+ setrgb(thng,thng,thkg)
+ "RESISTANCE R/Zo OR CONDUCTANCE G/Yo" at C+SGamma(0.5,0)-(0,C.rad/40)
+ Loopover_(`Lttr',`ifelse(Lttr,*,,`r_text(eval(87-m4Lx*86/100),Lttr,
+ at W+(Rect_(W.rad+wltic/2+textht*0.5, 177-m4Lx*0.86))) ')',
+ W,A,V,E,L,E,N,G,T,H,S,*,T,O,W,A,R,D,*,G,E,N,E,R,A,T,O,R)
+ Loopover_(`Lttr',`ifelse(Lttr,*,,`r_text(eval(115-m4Lx*86/100),Lttr,
+ at W+(Rect_(W.rad-wltic/2-textht*1.0, 204-m4Lx*0.86))) ')',
+ W,A,V,E,L,E,N,G,T,H,S,*,T,O,W,A,R,D,*,L,O,A,D)
+ Loopover_(`Lttr',`ifelse(Lttr,*,,`define(`xa','13-m4Lx*86/100`)
+ r_text(eval(xa-90),Lttr,at A+(Rect_(A.rad+textht*0.7, xa))) ')',
+ R,E,F,L,E,C,T,I,O,N,*,C,O,E,F,F,I,C,I,E,N,T,*,A,N,G,L,E)
+ Loopover_(`Lttr',`ifelse(Lttr,*,,`define(`xa','14-m4Lx*86/100`)
+ r_text(eval(xa-90),Lttr,at A+(Rect_(A.rad-textht*0.7, xa))) ')',
+ T,R,A,N,S,M,I,S,S,I,O,N,*,C,O,E,F,F,I,C,I,E,N,T,*,A,N,G,L,E)
+ resetrgb
+
+iflatex(command "}%",
+ifsvg(command "</g>"))
+] at (0,0)')
+
+Smithchart
+
+.PE
diff --git a/graphics/circuit_macros/examples/svg/cscSVG.m4 b/graphics/circuit_macros/examples/svg/cscSVG.m4
index 8f1b954669..05cf0c70d4 100644
--- a/graphics/circuit_macros/examples/svg/cscSVG.m4
+++ b/graphics/circuit_macros/examples/svg/cscSVG.m4
@@ -1,19 +1,21 @@
.PS
#.PS 3.5
# csc.m4
+# This file includes AntiqueClock and works for PSTricks, Tikz, and SVG
gen_init
+NeedDpicTools
-skale = 3.5/3.97*0.9955
+skale = 0.878
circlerad=1.91*skale
hubrad=0.10*skale
s=0.5*skale
-define(`midnight',`26,26,112')
-define(`white',`255,255,255')
-define(`spokethick',0.1)
+define(`midnight',`0.1, 0.1, 0.44')
+define(`white',`1, 1, 1')
+define(`spokewidth',0.1)
define(`spoke',`dnl
- {line from rvec_(0,hubrad-spokethick/2) to rvec_(circlerad-0.05,0)}
- {line from rvec_(0,-(hubrad-spokethick/2)) to rvec_(circlerad-0.05,0)}')
+ {line from rvec_(0,hubrad-spokewidth/2) to rvec_(circlerad-0.05,0)}
+ {line from rvec_(0,-(hubrad-spokewidth/2)) to rvec_(circlerad-0.05,0)}')
define(`lwid',1)
define(`coord',`(s*(`$1'),s*(`$2'))')
@@ -23,7 +25,7 @@ rgbdraw(midnight,
linethick=`0.'eval(lwid*15)/(1pt__)
{circle with .c at Here
circle invis diam last circle.diam + linethick pt__ at last circle }
- linethick=spokethick/(1pt__)
+ linethick=spokewidth/(1pt__)
for angle = 0 to 330 by 30 do {
Point_(angle)
{spoke}
@@ -46,7 +48,7 @@ rgbdraw(midnight,
# Sail
thinlines_
- setrgb(midnight)
+ rgbfill(midnight,
line from coord(0.44,3.38) to coord(0.44,2.6) \
then to coord(2.1,-1.75) \
then to coord(1.22,-1.53) \
@@ -60,34 +62,33 @@ rgbdraw(midnight,
then to coord(-0.92,1.73) \
then to coord(0,2.9) \
then to coord(0.44,3.38)
+ )
# Hull
+ rgbfill(midnight,
spline from coord(2.1,-1.75) to coord(1.9,-2.2) \
then to coord(1.85,-2.3) then to coord(1.8,-2.33) \
then to coord(1,-2.5) then to coord(0,-2.6) then to coord(-0.38,-2.57) \
then to coord(-2.13,-2.4)
line to coord(-2.2,-2.05) then to coord(2.1,-1.75)
-# spline to coord(-1,-2.08) then to coord(0.55,-1.77)
- line to coord(2.1,-1.75)
- resetrgb
- setrgb(white)
- spline from coord(-2.2,-2.05) to coord(-1,-2.08) then to coord(0.55,-1.77)
- line to coord(-2.2,-2.05)
- resetrgb
- linethick=`0.'eval(lwid*15)/(1pt__)
-
+ spline to coord(-1,-2.08) then to coord(0.55,-1.77)
+ )
]
+
Clock: [
+# PSTricks, tikz, or svg only:
+ifelse(ifpstricks(T)`'ifpgf(T)`'ifsvg(T),T,`
#.PS
-# AntiqueClockSVG.m4
+# AntiqueClock.m4
#gen_init
-svg_font(font-family="sans-serif" font-stretch="condensed")
+#NeedDpicTools
-# https://tex.stackexchange.com/questions/236923/generate-analog-clock-with-numbered-face-add-seconds-roman-numerals
+iflatex(`latexcommand({\sf)')
+ifsvg(svg_font(font-family="sans-serif" font-stretch="condensed")
+# svg_rot_init(test))
+ svg_rot_init(cscSVG))
-#svg_rot_init(AntiqueClockSVG)
-#svg_rot_init(test)
-svg_rot_init(cscSVG)
+# https://tex.stackexchange.com/questions/236923/generate-analog-clock-with-numbered-face-add-seconds-roman-numerals
# `hms2deg(hr,min,sec) hr:min:sec to degrees
# blank arg1: degrees for minute hand
@@ -148,6 +149,7 @@ define(`AntiqueHourHand',`[ hhsf = (`$1')/2.2
fitcurve(X,n,shaded rgbstring(0,0,0))
]')
+
define(`AntiqueClock',`[ # h,m,s,diam
# Clock size parameters:
hour = ifelse(`$1',,3,`$1')
@@ -155,8 +157,8 @@ define(`AntiqueClock',`[ # h,m,s,diam
second = ifelse(`$3',,51,`$3')
# outer radius
ifelse(`$4',,`skale=0.5; r1=2',`r1=(`$4')/2; skale=r1/4')
- r2 = r1 - 0.5*skale
- r3 = r2 - 0.14*skale
+ r2 = r1-0.5*skale
+ r3 = r2-0.14*skale
r4 = r3 - 0.35*skale
r5 = r4 - 0.17*skale
r6 = r5 - 0.63*skale
@@ -191,32 +193,35 @@ Face: circle thick 0 fill_(1) rad r3 at C
circle rad r5 at C
circle rad r6 at C
circle rad r7 at C
+
# Ad hoc shift of rotated SVG text
- define adj { (-cosd($`'1)*textht*0.5*sign(180-($`'1)),\
- (0.25+0.25*cosd(2*($`'1)))*textht) }
+ ifsvg(`define adj {+(-cosd($`'1)*textht*0.5*sign(180-($`'1)),\
+ (0.25+0.25*cosd(2*($`'1)))*textht) }',
+ `define adj {}')
+ define adj {}
+
# Outer numbers
- textht = (r3-r4)*0.6
- for mn = -15 to 15 by 5 do { t = 90-mn/60*360
- R:(Rect_((r3+r4)/2,t))
- svg_rot(-mn/60*360,sprintf("%g",pmod(mn,60)) at C+R+adj(t))
- }
- for mn = 20 to 40 by 5 do { t = 450-mn/60*360
- R: (Rect_((r3+r4)/2,t))
- svg_rot(180-mn/60*360, sprintf("%g",pmod(mn,60)) at C+R+adj(t))
- }
+ iflatex(`command sprintf("\font\outerfont=cmss12 at %4.2fin",r3-r4)')
+ ifsvg(`textht = (r3-r4)*0.6')
+ for_(-15,15,5,`aa=90-(m4x)*6
+ r_text(eval(-(m4x)*6),eval((m4x+60)%60),
+ at C+(Rect_((r3+r4)/2,aa)) adj(aa))')
+ for_(20,40,5,`aa=450-(m4x)*6
+ r_text(eval(180-m4x*6),m4x,at C+(Rect_((r3+r4)/2,aa)) adj(aa))')
# Outer tics
for mn = 1 to 60 do { t = 90-mn/60*360
line from C+(Rect_(r5,t)) to C+(Rect_(r4,t)) }
# Inner numbers
- textht = (r5-r6)*0.6
- Loopover_(`mx',`tt = 90-(m4Lx-4)/12*360
- R: (Rect_((r5+r6)/2,tt))
- svg_rot(tt-90, "mx" at C+R+adj(tt)) ',
+ iflatex(`command sprintf("\font\innerfont=cmss12 at %4.2fin",r5-r6)')
+ ifsvg(`textht = (r5-r6)*0.6')
+ Loopover_(`mx',`aa=180-(m4Lx-1)*30
+ r_text(eval(120-m4Lx*30),iflatex({\innerfont mx},mx),
+ at C+(Rect_((r5+r6)/2,aa)) adj(aa))',
IX,X,XI,XII,I,II,III)
- Loopover_(`mx',`tt = 360-m4Lx*30
- R: (Rect_((r5+r6)/2,tt))
- svg_rot(tt-270, "mx" at C+R+adj(tt)) ',
+ Loopover_(`mx',`aa=360-m4Lx*30
+ r_text(eval(90-m4Lx*30), iflatex({\innerfont mx},mx),
+ at C+(Rect_((r5+r6)/2,aa)) adj(aa))',
IV,V,VI,VII,VIII)
# Inner tics
@@ -230,13 +235,15 @@ Face: circle thick 0 fill_(1) rad r3 at C
# Center
dot(at C,0.1/4*r1,1)
- ]')
+ ]') `# AntiqueClock'
Clock1: AntiqueClock(,,,3.5)
-# Clock2: AntiqueClock(4,48,07,2) at Clock1.e+(1.5,0)
+# Clock2: AntiqueClock(4,50,07,2) at Clock1.e+(1.5,0)
+
+ iflatex(`latexcommand(}%)')
+ ifsvg(`command "</g>"')
- command "</g>" # end font
#.PE
+',` "AntiqueClock.m4 requires PSTricks, Tikz-pgf, or SVG" ')
] with .sw at last [].se+(0.25,0)
-
.PE
diff --git a/graphics/circuit_macros/examples/svg/ex15SVG.m4 b/graphics/circuit_macros/examples/svg/ex15SVG.m4
index 055986740b..ca15109fa9 100644
--- a/graphics/circuit_macros/examples/svg/ex15SVG.m4
+++ b/graphics/circuit_macros/examples/svg/ex15SVG.m4
@@ -29,7 +29,7 @@ for i = 1 to n-1 do {
D: C+(Rect_(crad*g,110))
rm = crad+distance(C,D)
for r=lt to rm by lt do {
- u = (1-r/rm)*255
+ u = (1-r/rm)
if r < (1-g)*crad then { rgbdraw(u,u,u,circle rad r at D) } \
else { rgbdraw(u,u,u,arc cw from Cintersect(D,r,C,crad) \
to Cintersect(D,r,C,crad,R) with .c at D) }
diff --git a/graphics/circuit_macros/examples/svg/examplesSVG.htmx b/graphics/circuit_macros/examples/svg/examplesSVG.htmx
index a7c830ed54..f2ea0d8bc5 100644
--- a/graphics/circuit_macros/examples/svg/examplesSVG.htmx
+++ b/graphics/circuit_macros/examples/svg/examplesSVG.htmx
@@ -355,7 +355,7 @@ cfig(AudioSVG,
Audio elements)
cfig(XformSVG,
- The transformer element`,' drawing direction down)
+ Some variations of the transformer element`,' drawing direction down)
cfig(NPDTSVG,
Double throw with the m4tt`'NPDT</g> macro)
@@ -370,7 +370,7 @@ cfig(relaycoilSVG,
The m4tt`'relaycoil</g> macro)
cfig(RelaySVG,
- Some variants of the m4tt`'relay</g> macro)
+ Some variants of m4tt`'relay</g>)
cfig(JackSVG,
The m4tt`'jack</g> and m4tt`'plug</g> macros)
@@ -521,9 +521,6 @@ cfig(TubediagsSVG,
cfig(UNOSVG,
An Arduino UNO circuit adapted and redrawn)
- <!--
- m4tt`'https://content.arduino.cc/assets/UNO-TH_Rev3e_sch.pdf</g>
- -->
cfig(sfgSVG,
Signal-flow graphs)
@@ -540,7 +537,7 @@ cfig(DecoderSVG,
cfig(ex21SVG,
Some flip-flops)
-cfig(MultiplexerSVGfor showing
+cfig(MultiplexerSVG,
Multiplexer)
cfig(DemultiplexerSVG,
@@ -593,11 +590,6 @@ cfig(GrayCodeSVG,
Gray code 10-bit encoder disk pattern`,'
and a crossbar switch)
-<!--
-#cfig(CrossbarSVG,
-# A crossbar switch)
--->
-
cfig(ByteSVG,
Elementary splines)
@@ -639,11 +631,6 @@ cfig(LoglogSVG,
cfig(GeometrySVG,
Plane geometry examples)
-<!--
-#cfig(LyapSVG,
-# Illustrating a Lyapunov function)
--->
-
cfig(randomSVG,
Testing random numbers)
@@ -658,10 +645,8 @@ cfig(graysurfSVG,
cfig(shapesSVG,
Basic shapes)
-<!--
-#fig(AntiqueClockSVG,
-# An antique clock face)
--->
+cfig(keyboardSVG,
+ More objects drawn in relief)
cfig(cscSVG,
Conestoga Sailing Club (illustrating the filling of arbitrary shapes)`,'
@@ -696,7 +681,7 @@ cfig(SierpinskiSVG,
tests of pic macro recursion)
cfig(EscherSVG,
- Two Escher-like objects)
+ Penrose stairs and an Escher-like object)
cfig(recycleSVG,
Modest repetition and partial fill)
@@ -704,9 +689,12 @@ cfig(recycleSVG,
cfig(ex15SVG,
Simple diagrams that are easily drawn by looping)
+cfig(SmithchartSVG,
+ A Smith chart at 3/4 scale)
+
<!--
-cfig(CountingSVG,
- An example of enumeration)
+#fig(CountingSVG,
+# An example of enumeration)
-->
cfig(CrowSVG,
@@ -722,7 +710,7 @@ cfig(FlowSVG,
</p> -->
cfig(BtreeSVG,
- Binary trees)
+ Trees)
cfig(InclepsSVG,
Overlaying a figure with line graphics)
diff --git a/graphics/circuit_macros/examples/svg/icsSVG.m4 b/graphics/circuit_macros/examples/svg/icsSVG.m4
index f1eb9ae9ab..896e1008eb 100644
--- a/graphics/circuit_macros/examples/svg/icsSVG.m4
+++ b/graphics/circuit_macros/examples/svg/icsSVG.m4
@@ -246,17 +246,17 @@ define(`HDMI_micro',`[
D0`'svg_it(-), CLK`'svg_it(+), CLK_SH, CLK`'svg_it(-),
CEC, GND, SCL, SDA,svg_it(+)5V)
L1: line from Base.nw+(m4bwid*2/3-lg_pinsep,0) up plen
- svg_rot(90,"21" at last line.c +(-2bp__,0))
- svg_rot(90,"SH2" at last line.start + (4bp__,-8bp__))
+ svg_rot(90,"21",at last line.c +(-2bp__,0))
+ svg_rot(90,"SH2",at last line.start + (4bp__,-8bp__))
line from Base.nw+(m4bwid*2/3-2*lg_pinsep,0) up plen
- svg_rot(90,"20" at last line.c+(-2bp__,0))
- svg_rot(90,"SH1" at last line.start + (4bp__,-8bp__))
+ svg_rot(90,"20",at last line.c+(-2bp__,0))
+ svg_rot(90,"SH1",at last line.start + (4bp__,-8bp__))
line from Base.sw+(m4bwid*2/3-lg_pinsep,0) down plen
- svg_rot(90,"23" at last line.c+(-2bp__,0))
- svg_rot(90,"SH4" at last line.start + (4bp__,14bp__))
+ svg_rot(90,"23",at last line.c+(-2bp__,0))
+ svg_rot(90,"SH4",at last line.start + (4bp__,14bp__))
line from Base.sw+(m4bwid*2/3-2*lg_pinsep,0) down plen
- svg_rot(90,"22" at last line.c+(-2bp__,0))
- svg_rot(90,"SH3" at last line.start + (4bp__,14bp__))
+ svg_rot(90,"22",at last line.c+(-2bp__,0))
+ svg_rot(90,"SH3",at last line.start + (4bp__,14bp__))
#
`$4']')
diff --git a/graphics/circuit_macros/examples/svg/keyboardSVG.m4 b/graphics/circuit_macros/examples/svg/keyboardSVG.m4
new file mode 100644
index 0000000000..7966a7aa3b
--- /dev/null
+++ b/graphics/circuit_macros/examples/svg/keyboardSVG.m4
@@ -0,0 +1,269 @@
+.PS
+# keyboardSVG.m4
+ gen_init
+ scale=25.4 # unit is mm
+
+divert(-1)
+
+define(`kbd_u',(11mm__))
+define(`kbdrowsep',`movewid')
+define(`kbdshadewid',`(kbd_u/9)')
+
+ `kbdkey(name|text=chars,keys)
+ chars: string or string string
+ keys: wdth=expr; # base wid
+ hght=expr; # base ht
+ rad=expr; # base rad
+ shadewid=expr; # base shade wid
+ base=attribs; # base attributes
+ top=attribs; # top attributes '
+define(`kbdkey',
+ `pushkeys_(`$2',
+ wdth:kbd_u; hght:kbd_u*14/13+lthick; rad:kbd_u/10;
+ shadewid:kbdshadewid; base:fill_(0.3):N; top:fill_(0.9):N)dnl
+ [ Base: box wid m4wdth ht m4hght rad m4rad m4base
+ Top: box wid m4wdth-2*m4shadewid ht m4hght-m4shadewid-lthick \
+ rad m4rad*(kbd_u-2*m4shadewid)/(kbd_u) with .n \
+ at Base.n-(0,lthick) m4top
+ move to Top.w
+ ifelse(`$1',,,`pushkey_(`$1',text,,N)ifelse(m4text,,
+ `"iflatex(\sf) `$1'" above ljust',
+ `m4text');') `$3'
+ popdef(`m4wdth', `m4hght', `m4shadewid', `m4rad', `m4base', `m4top') dnl
+ popdef(`m4text') ] ')
+
+define(`tsmall',
+ `iflatex(`"{\sf\scriptsize `$1'}"',
+ ifelse(`$3',,")svg_fsize(`$1',ifelse(`$2',,75,`$2'))ifelse(`$3',,"))')
+
+define(`stkbdkey',
+ `iflatex(`command "{\sf\scriptsize"',`m4tmp=textht
+ textht = ifelse(`$1',,0.66*textht,`$1') ')
+ kbdkey(shift($*))
+ iflatex(`command "}%"',`textht = m4tmp')')
+
+ `enterkey(name|text=chars,keys)
+ chars: string or string string
+ keys: wdth=expr; # base wid
+ hght=expr; # base ht
+ bhght=expr; # ht of bottom part
+ rad=expr; # base rad
+ shadewid=expr; # base shade wid
+ base=attribs; # base attributes
+ top=attribs; # top attributes '
+define(`enterkey',
+ `pushkeys_(`$2',
+ wdth:kbd_u*2.26;
+ hght:kbd_u*14/13*2+kbdrowsep+linethick bp__;
+ bhght: kbd_u*14/13;
+ twdth: kbd_u*3/2;
+ rad:kbd_u/10;
+ shadewid:kbdshadewid;
+ base:fill_(0.3):N;
+ top:fill_(0.9):N)dnl
+ [ ltx = lthick; r = m4rad*(kbd_u-2*m4shadewid)/(kbd_u)
+# thick outer
+ linethick = (m4shadewid+r)/(1bp__); lth2 = lthick/2
+ NEx: Here; NE: NEx-(lth2,lth2); SE: NE-(0,m4hght-lth2*3-ltx*3/2)
+ SW: SE-(m4wdth-lthick,0)
+ W: SW+(0,m4bhght-lthick+ltx*3/2); NW: NE-(m4twdth-lthick,0); X: (NW,W)
+ d = 0.3; ro = m4rad-lth2
+ move to W; arcto(X,NW,m4rad+lth2,outlined graystring(d)); Tx:NW
+ Loopover_(`PK',`arcto(Tx,PK,ro,outlined graystring(d));Tx:PK',NE,SE,SW,W,X)
+ linethick = ltx
+# outer outline
+ NE: NEx; SE: NE-(0,m4hght+ltx); SW: SE-(m4wdth,0)
+ W: SW+(0,m4bhght); NW: NE-(m4twdth,0); X: (NW,W)
+ m4enteroutline(m4rad,,m4rad)
+# thick inner
+ linethick = m4shadewid/(1bp__)+linethick; lth2 = lthick/2
+ NE: NEx-(m4shadewid+lth2,lth2+ltx); SE: (NE,SE)+(0,m4shadewid*3/2)
+ SW: SE-(m4wdth-m4shadewid*3,0); W: SW+(0,m4bhght-m4shadewid*2-ltx*3/2);
+ NW: NE-(m4twdth-m4shadewid*3,0); X: (NW,W)
+ c = 0.9; ri = r-lth2
+ move to W; arcto(X,NW,ri+lth2*2,outlined graystring(c)); Tx:NW
+ Loopover_(`PK',`arcto(Tx,PK,ri,outlined graystring(c));Tx:PK',NE,SE,SW,W,X)
+ N: 1/2 between NW and NE
+ line from N to (N,SE) thick (NE.x-NW.x)/(1bp__) outlined graystring(c)
+ SSW: 1/2 between SW and W
+ line from SSW to (SE,SSW) thick (W.y-SW.y)/(1bp__) outlined graystring(c)
+# inner outline
+ NE: NE+(lth2,lth2); SE: SE+(lth2,-lth2); SW: SW-(lth2,lth2)
+ W: W+(-lth2,lth2); NW: NW+(-lth2,lth2); X: (NW,W)
+ linethick = ltx
+ m4enteroutline(ri,,ri+lth2*2)
+ move to (X,(1/2 between SW and W));
+ ifelse(`$1',,,`pushkey_(`$1',text,,N)dnl
+ ifelse(m4text,,`"iflatex(\sf) `$1'" above ljust',`m4text')')
+ popdef(`m4wdth', `m4hght', `m4bhght', `m4twdth', `m4shadewid', `m4rad',
+ `m4base', `m4top', `m4bhght' ) popdef(`m4text')dnl
+ `$3' ] ')
+define(`m4enteroutline',`move to W+(`$1',0); arcto(X,NW,`$3',`$2'); Tx: NW
+ Loopover_(`PP',`arcto(Tx,PP,`$1',`$2'); Tx: PP',NE,SE,SW,W,X)')
+define(`m4enterup',`[ u = ifelse(`$1',,kbd_u*0.3)
+ line right u/4 then up u/2 then right u/6 then up u/2 left u/4+u/6 \
+ then down u/2 left u/4+u/6 then right u/6 then down u/2 then right u/4
+ ]')
+
+define(`kbdsymb',`iflatex("\tt\char`$1'",`dsvg_symb(`$1')')')
+define(`m4kbdarrow',`arrow thick 1.5 ht kbd_u/5 wid kbd_u/5')
+
+divert(0)dnl
+
+define dsvg_symb {"&#$1;"}
+
+maxpswid = 25*kbd_u
+movewid = kbd_u/11
+
+define(`rshift',` at Here+(ifelse(`$1',,`kbd_u/8',`$1'),0) ')
+
+iflatex(`command "{\small\sf"',
+ `ifsvg(svg_font(Arial,kbd_u*16/13/4,0bp__))
+ textht=kbd_u/4 ')
+
+Row2: [
+ textoffset = kbd_u/8
+ Loopover_(`KK',`kbdkey(text=KK); move',
+ kbdsymb(126) ljust kbdsymb(96) ljust,
+ Loopover_(`NN',`kbdsymb(NN) ljust "m4Lx" ljust,',33,64,35,36,37,94,38,42,40)
+ kbdsymb(41) ljust "0" ljust,
+ kbdsymb(95) ljust "-" ljust,
+ kbdsymb(43) ljust "=" ljust,
+ kbdsymb(124) ljust kbdsymb(92) ljust,
+ "" )
+ m4kbdarrow left kbd_u*0.5 at last [].Top
+ ]
+Row1: [
+ kbdkey(tsmall(Esc,,N)); move right_ last [].wid+movewid*2
+ Loopover_(`KK',`kbdkey(KK); move',F1,F2,F3,F4)
+ move right_ last [].wid/2
+ Loopover_(`KK',`kbdkey(KK); move',F5,F6,F7,F8)
+ move right_ Row2.wid-Here.x-4*last [].wid-4*movewid
+ Loopover_(`KK',`kbdkey(KK); move',F9,F10,F11,F12)
+ ] with .sw at Row2.nw+(0,2*kbdrowsep)
+Row3: [
+# Uparrow: kbdkey(,,m4kbdarrow up kbd_u/2 at Top)
+ Tab: kbdkey(text=tsmall(Tab) rshift ljust,wdth=kbd_u*1.6,
+ [ A: m4kbdarrow left kbd_u/2; line thick A.thick up A.wid at A.end
+ A: m4kbdarrow right A.len at A-(0,kbd_u/2)
+ line thick A.thick up A.wid at A.end ] with .w at Top ); move
+ Loopover_(`KK',`KK: kbdkey(KK); move',Q,W,E,R,T,Y,U,I,O,P)
+ textoffset = kbd_u/8
+ kbdkey(text=kbdsymb(123) ljust kbdsymb(91) ljust); move
+ kbdkey(text=kbdsymb(125) ljust kbdsymb(93) ljust); move
+ w = Row2.wid-Here.x
+ R: box invis wid w-movewid ht last [].Base.ht
+ ] with .nw at Row2.sw-(0,kbdrowsep)
+Row4: [
+ Capslock: kbdkey(text=tsmall(Caps Lock) rshift ljust,
+ wdth=Row3.Tab.wid+Row3.Q.wid/3;); move
+ Loopover_(`KK',`KK: kbdkey(KK); move',A,S,D,F,G,H,J,K,L)
+ textoffset = kbd_u/8
+ kbdkey(text=kbdsymb(58) ljust kbdsymb(59) ljust); move
+ kbdkey(text=kbdsymb(34) ljust kbdsymb(39) ljust); move
+ ] with .nw at Row3.sw-(0,kbdrowsep)
+ Enter: enterkey(text=tsmall(Enter),,
+ m4kbdarrow <- from last ""+(kbd_u/2,0) \
+ right kbd_u/2 then up kbd_u/5 ) \
+ with .ne at (Row2.e,Row3.n)-(movewid,0)
+Row5: [
+ ShiftL: kbdkey(text=tsmall(Shift) at 0.4 between Top.w and Top.e,
+ wdth=kbd_u*2.4, m4enterup at 0.15 between Top.w and Top.e); move
+ Loopover_(`KK',`KK: kbdkey(KK); move',Z,X,C,V,B,N,M)
+ textoffset = kbd_u/8
+ kbdkey(text=kbdsymb(60) ljust kbdsymb(44) ljust); move
+ kbdkey(text=kbdsymb(62) ljust kbdsymb(46) ljust); move
+ kbdkey(text=kbdsymb(63) ljust kbdsymb(47) ljust); move
+ v = Row2.wid-Here.x-kbd_u-movewid*2
+ ShiftR: kbdkey(text=tsmall(Shift) at 1/2 between Top.w and Top.e,wdth=v,
+ m4enterup at 0.15 between Top.w and Top.e); move
+ kbdkey(); move
+ ] with .nw at Row4.sw+(0,-kbdrowsep)
+Row6: [
+ w = 22/18*kbd_u
+ CtrlL: kbdkey(text=tsmall(Ctrl) rshift ljust,wdth=w); move
+ kbdkey(,wdth=w); move
+ kbdkey(text=tsmall(Alt) rshift ljust,wdth=w); move
+ s = Row2.wid-(7*w+8*movewid)
+ kbdkey(,wdth=s); move
+ kbdkey(text=tsmall(Alt) rshift ljust,wdth=w); move
+ kbdkey(,wdth=w); move
+ kbdkey(,wdth=w); move
+ CtrlR: kbdkey(text=tsmall(Ctrl) rshift ljust,wdth=w); move
+ ] with .nw at Row5.sw+(0,-kbdrowsep)
+Arrowkeys: [ iflatex(`command "{\sf\scriptsize"',`textht *=0.66')
+Row1:[ textoffset = kbd_u/20
+ kbdkey(text=`"Print" ljust "Screen" ljust "SysRQ" ljust'); move
+ textoffset = kbd_u/12
+ kbdkey(text="Scroll" ljust "Lock" ljust); move
+ kbdkey(text="Pause" ljust "Break" ljust); move
+ ]
+Row2: [ textoffset = kbd_u/12
+ kbdkey(text="Insert" ljust); move
+ kbdkey(text=tsmall(Home) ljust); move
+ kbdkey(text="Page" ljust "Up" ljust); move
+ ] with .nw at Row1.sw-(0,2*kbdrowsep)
+Row3: [ textoffset = kbd_u/12
+ Delete: kbdkey(text="Delete" ljust); move
+ End: kbdkey(text="End" ljust); move
+ kbdkey(text="Page" ljust "Down" ljust); move
+ ] with .nw at Row2.sw+(0,-kbdrowsep)
+Row5: [
+ move right Row3.End.w.x + movewid
+ Uparrow: kbdkey(,,m4kbdarrow up kbd_u/2 at Top)
+ ] with .nw at Row3.sw-(0,Row3.Delete.ht+2*kbdrowsep)
+Row6: [
+ kbdkey(,,m4kbdarrow left kbd_u/2 at Top); move
+ kbdkey(,,m4kbdarrow down kbd_u/2 at Top); move
+ kbdkey(,,m4kbdarrow right kbd_u/2 at Top); move
+ ] with .nw at Row5.sw-(0,kbdrowsep)
+
+ iflatex(`command "}%"',`textht *=(1/0.66)')
+ ] with .nw at Row1.ne+(movewid,0)
+Keypad: [ move down_ Arrowkeys.n.y-Arrowkeys.Row2.e.y; right_
+ textoffset = kbd_u/8
+Row2:[
+ kbdkey(text=tsmall(Num) ljust tsmall(Lock) ljust); move
+ iflatex(`command "{\large"',`textht *=1.5')
+ kbdkey(text=kbdsymb(47) ljust); move
+ kbdkey(text=kbdsymb(42) ljust); move
+ kbdkey(text=kbdsymb(45) ljust); move
+ iflatex(`command "}"')
+ ]
+Row3:[ textoffset = kbd_u/12
+ kbdkey(text="7" ljust tsmall(Home) ljust); move
+ kbdkey(text="8" ljust "" ljust,,m4kbdarrow up_ kbd_u/3 \
+ at 3/4 between Top.ne and Top.sw); move
+ kbdkey(text="9" ljust tsmall(PgUp) ljust); move
+ ] with .nw at Row2.sw+(0,-kbdrowsep)
+Row4:[ textoffset = kbd_u/12
+ kbdkey(text="4" ljust "" ljust,,m4kbdarrow left kbd_u/3 \
+ at 0.7 between Top.ne and Top.sw); move
+ kbdkey(text="5" ljust "" ljust); move
+ Six: kbdkey(text="6" ljust "" ljust,,m4kbdarrow right kbd_u/3 \
+ at 0.7 between Top.ne and Top.sw); move
+ ] with .nw at Row3.sw+(0,-kbdrowsep)
+Row5:[ textoffset = kbd_u/12
+ kbdkey(text="1" ljust tsmall(End) ljust); move
+ kbdkey(text="2" ljust "" ljust,,m4kbdarrow down kbd_u/3 \
+ at 0.7 between Top.ne and Top.sw); move
+ kbdkey(text="3" ljust tsmall(PgDn) ljust); move
+ ] with .nw at Row4.sw+(0,-kbdrowsep)
+Row6:[ textoffset = kbd_u/12
+ kbdkey(text="0" ljust tsmall(Ins) ljust,
+ wdth=Row4.wid-Row4.Six.wid-2*movewid); move
+ kbdkey(text=kbdsymb(46) ljust tsmall(Del) ljust); move
+ ] with .nw at Row5.sw+(0,-kbdrowsep)
+Col4: [ textoffset = kbd_u/12
+ iflatex(`command "{\large"',`textht *=1.5')
+ kbdkey(text="+" ljust,hght=Row3.n.y-Row4.s.y); move
+ iflatex(`command "}"',`textht /=1.5')
+ kbdkey(text=tsmall(Enter) ljust,hght=Row5.n.y-Row6.s.y) \
+ with .nw at last [].sw - (0,kbdrowsep)
+ ] with .ne at (Row2.e,Row3.n)
+
+ ] with .nw at Arrowkeys.ne+(movewid,0)
+
+iflatex(`command "}%"',
+ifsvg(`command "</g>"'))
+.PE
diff --git a/graphics/circuit_macros/examples/svg/sfgSVG.m4 b/graphics/circuit_macros/examples/svg/sfgSVG.m4
index 793db01ae8..666f311ca4 100644
--- a/graphics/circuit_macros/examples/svg/sfgSVG.m4
+++ b/graphics/circuit_macros/examples/svg/sfgSVG.m4
@@ -82,21 +82,54 @@ G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size
N2: sfgnode(,svg_fsize(2,120),,invis)
{ sfgarc(to N1 ->,,,ccw,s1) }
{ "p(1-p)svg_gamma+2`'svg_nu" at last [].M+(11bp__,0) above }
- { svg_choose(2,1) at last [].M+(-29bp__,8bp__) }
+ { svg_choose(2,1) at last [].M+(-19bp__,8bp__) }
{ sfgarc(to N0 ->,(1-p)svg_sup(2)`svg_gamma',above,ccw,s2) }
sfgline(right_ sfg_wid,`svg_nu'+2`svg_lambda',below,->)
N3: sfgnode(,svg_fsize(3,120),,invis)
{ sfgarc(to N2 ->,,,ccw,s1) }
{ "p`'svg_sup(2)(1-p)svg_gamma+3`'svg_nu" at last [].M+(0bp__,0) above }
- { svg_choose(3,2) at last [].M+(-43bp__,8bp__) }
+ { svg_choose(3,2) at last [].M+(-33bp__,8bp__) }
{ sfgarc(to N1 ->,,,ccw,s2) }
{ "p(1-p)`'svg_sup(2)`'svg_gamma" at last [].M+(8bp__,0) above }
- { svg_choose(3,1) at last [].M+(-26bp__,8bp__) }
+ { svg_choose(3,1) at last [].M+(-16bp__,8bp__) }
{ sfgarc(to N0 ->,(1-p)svg_sup(3)`svg_gamma',above,ccw,s2) }
sfgline(right_ sfg_wid*2/3,`svg_nu'+3`svg_lambda',below,->)
{"..." wid 0.3 ljust}
] with .nw at G3.sw+(0,-0.1)
+# https://tex.stackexchange.com/questions/637455/tikz-how-to-set-exact-position-of-node
+G5: [sfg_init( 1.75,0.25/2 ) # change node spacing and increase node size
+ Dstar: sfgnode(,* )
+ D0: sfgnode(at Dstar+(2,0),svg_small(&lt;&gt;)svg_sub(0) )
+ sfgline(,
+ svg_it(1-r`'svg_sub(`x-1,x')-q`'svg_sup(i)svg_sub(x-1`,'x,,,-0.8ex)),,->)
+ Ddots: sfgnode(,... )
+ sfgline(,svg_it(1-r`'svg_sub(x-4`,'x)-q`'svg_sup(i)svg_sub(x-4`,'x,,,-0.8ex)),
+ ,->)
+ D5: sfgnode(,svg_small(&lt;&gt;)svg_sub(5) )
+ DD: sfgnode(at D0+(0,-1.0),svg_symbol(&``#''8224;) )
+ sfgself(at Dstar,L,,,,0.5)
+ "svg_it(1-i`'svg_sub(x)-q`'svg_sub(x)svg_sup(a,,,-0.8ex))" wid 45bp__ \
+ at Dstar + (-0.3,0.25)
+ sfgself(at DD,D,1,above_,,0.5)
+ sfgself(at D5,R,,,,0.5)
+ "svg_it(1-q`'svg_sub(x)svg_sup(i,,,-0.8ex)-r`'svg_sub(x))" wid 47bp__ \
+ at D5 + (0.3,0.25)
+ sfgarc(from D0 to Dstar ->,svg_it(r`'svg_sub(x`,'x)),below_,ccw)
+ sfgarc(from Dstar to D0 ->,svg_it(i`'svg_sub(x)),above_,ccw)
+ sfgarc(from Dstar to DD ->,svg_it(q`'svg_sub(x)svg_sup(a,,,-0.8ex)),
+ above_ ljust_,ccw)
+ sfgline(from D0 to DD,svg_it(q`'svg_sup(i)svg_sub(x`,'x,,,-0.8ex)),ljust,->)
+ sfgarc(from Ddots to Dstar,svg_it(r`'svg_sub(j`,'x)),below_,ccw,,->)
+ sfgarc(from Ddots to DD ->,svg_it(q`'svg_sup(i)svg_sub(x-j`,'x)),
+ above_ rjust_,)
+ sfgarc(from D5 to Dstar ->,svg_it(r`'svg_sub(x)),below_,ccw)
+ sfgarc(from D5 to DD ->,svg_it(q`'svg_sup(i)svg_sub(x,,,-0.8ex)),
+ above_ rjust_,)
+ ] with .nw at G4.sw+(0,-0.15)
+#howbox_(,"G5")
+
+
move from (T.w,G4.s)-(7bp__,6bp__) to B.ne+(15bp__,6bp__)
command "</g>" # end font
.PE
diff --git a/graphics/circuit_macros/examples/tubedefs.m4 b/graphics/circuit_macros/examples/tubedefs.m4
index af47e307b7..fa79c05904 100644
--- a/graphics/circuit_macros/examples/tubedefs.m4
+++ b/graphics/circuit_macros/examples/tubedefs.m4
@@ -4,11 +4,11 @@ divert(-1)
# Size parameters
define(`tubediam',`dimen_')
-define(`tubethick',`2')
+define(`tubethick',`2') # thick line thickness
define(`tubepindiam',`tubediam*3/8')
define(`tubeplatelen',`tubediam/2')
define(`tubegridlen',`tubediam*7/12')
-define(`tubcathlen',`tubeplatelen-tubethick bp__')
+define(`tubecathlen',`tubeplatelen-tubethick bp__')
define(`tubedotthick',`1.2')
define(`tubedotdiam',`tubediam/6')
define(`tgap',`tubediam*3/20')
@@ -125,7 +125,7 @@ define(`tubegrid',`dashline(ifelse(`$1',,`right tubegridlen',`$1'),
`tubecathode(length,R)'
define(`tubecathode',`[
- box invis wid ifelse(`$1',,tubcathlen,`$1') ht tubeplatelen/6
+ box invis wid ifelse(`$1',,tubecathlen,`$1') ht tubeplatelen/6
ifinstr(`$2',R,
`line thick tubethick from last box.nw to last box.sw \
then to last box.se then to last box.ne',