diff options
author | Karl Berry <karl@freefriends.org> | 2019-09-05 22:33:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-09-05 22:33:48 +0000 |
commit | e25c6ee4ea5169bf31ab28ebddcc94c8b4992453 (patch) | |
tree | 855a21705c8e75ed71066d3e6215752d04dd43ba /Master/texmf-dist/doc/latex/circuit-macros/examples/svg | |
parent | 1047c66359c02d8f8852e0dbdd69f5cf1cd1a76b (diff) |
circuit-macros (all except boxdims.sty in doc due to generic file names)
git-svn-id: svn://tug.org/texlive/trunk@52035 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/circuit-macros/examples/svg')
112 files changed, 9191 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ABlogixSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ABlogixSVG.m4 new file mode 100644 index 00000000000..d457250cc36 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ABlogixSVG.m4 @@ -0,0 +1,53 @@ +.PS +# `ABlogixSVG.m4' + log_init(svg_font(sans-serif,10.5bp__)) + linewid = 0.4 + +# A more complex expression + F: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0), + And(x4,Or(x2,x1,~x0),Xor(x2,~x1))))) + + Loopover_(`v_', `"svg_it(v_)" wid 11bp__ at F.In`'v_ above', x0,x1,x2,x3,x4) + "svg_it(Out)" ljust at F.Out + "svg_tt(`Autologix(And(Or(x3,x1,~x0),')" \ + wid 201bp__ with .w at F.sw+(0,-0.25) + "svg_tt(`Nor(Or(x3,Not(x2),~x1,x0),And(x4,Or(x2,x1,~x0),')" \ + wid 343bp__ with .w at last "".w+(65bp__,-16bp__) + "svg_tt(`Xor(x2,~x1)))))')" \ + wid 105bp__ with .w at last "".w+(0,-16bp__) +# Inputs on the left with vert offset in L_units +define(`Doff',LV;offset=25) + G: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0), + And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))), + Doff*L_unit) \ + with .sw at F.Out+(0.2,-0.7) + + Loopover_(`v_', `"svg_it(v_)" wid 11pt__ at G.In`'v_ rjust ', x0,x1,x2,x3,x4) + "svg_it(Out)" wid 22bp__ ljust at G.Out + "svg_tt(`...,'Doff*L`'_unit))" at G.s+(0,-10pt__) + +# A more complex expression +define(`Eoff',R) + E: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0), + And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))), + Eoff) \ + with .nw at F.sw+(0,-1.5) + + Loopover_(`v_', `"svg_it(v_)" wid 11bp__ at E.In`'v_ above ', x0,x1,x2,x3,x4) + "svg_it(Out)" ljust at E.Out + "svg_tt(...`,'Eoff))" at E.s+(0,-10pt__) + +# Inputs on the left with vert offset in L_units +define(`Foff',LRV;offset=17) + D: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0), + And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))), + Foff*L_unit) \ + with .sw at E.Out1+(0.2,-0.5) + + Loopover_(`v_', `"svg_it(v_)" wid 11pt__ at D.In`'v_ rjust ', x0,x1,x2,x3,x4) + "svg_it(Out)" ljust at D.Out + "svg_tt(...`,'Foff*L`'_unit))" at D.s+(0,-10pt__) + + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AdderSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AdderSVG.m4 new file mode 100644 index 00000000000..cef4d07a8e5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AdderSVG.m4 @@ -0,0 +1,76 @@ +.PS +# AdderSVG.m4 +log_init(svg_font(sans-serif,11bp__)) + + del = linewid/4 +[ # full adder using gates + A: dot; {"A" rjust}; line right + Xor1: XOR_gate with .In1 at Here + dy = Xor1.In1.y-Xor1.In2.y + B: dot(at (A,Xor1.In2)); {"B" rjust}; line to Xor1.In2 + line from Xor1.Out right 2*del+dy + Xor2: XOR_gate with .In1 at Here + + Co: Autologix(Or(And(X1,X2),And(A,B)),N) with .nw at Xor2.sw+(-del,-del/2) + line from Co.In1 to (Co.In1,Xor2.In2) then to Xor2.In2 + dot(at (Xor1.Out+(del,0))); line to (Here,Co.In2) then to Co.In2 + dot(at (Xor1.In1-(del,0))); line to (Here,Co.In3) then to Co.In3 + dot(at (Xor1.In2-(del+dy,0))); line to (Here,Co.In4) then to Co.In4 + line right del from Co.Out1; dot; {"Co" ljust } + dot(at (Here,Xor2.Out)); {"S" ljust}; line to Xor2.Out + Ci: dot(at (B,(0.5 between Xor2.s and Co.n))); line to (Co.In1,Here); dot + "Ci" rjust at Ci + ] + +[ # truth table + griddim = linewid*0.4 + define(`row',`T: (0,-(`$1')*griddim*0.8) + Loopover_(`v',`"v" at T; T: T+(griddim,0)', shift($@))') + + [row(0,A,B,Ci,Co,S)] + line thick 2 color "gray" right 4.5*griddim \ + with .c at last [].c+(0,-griddim/2) + + [row(1,0,0,0,0,0) + row(2,0,0,1,0,1) + row(3,0,1,0,0,1) + row(4,0,1,1,1,0) + row(5,1,0,0,0,1) + row(6,0,1,1,0,0) + row(7,1,1,0,1,0) + row(8,1,1,1,1,1) ] with .n at last [].c+(0,-griddim) + + ] with .nw at 1st [].ne+(linewid,0) + +[ # cascade of n-bit adders +define(`smarrow',`arrow arrowht*4/5 wid arrowwid*5/4') +define(`nbitadder', +`FlipFlopX(wid 2*linewid fill_(0.9),n-bit adder, + :, I:;I:;;;I:;I:, I:, O:;;;O: ) `$3' + `"... "' at last [].Chip.n + (0,arrowht) + `"... "' at last [].Chip.s - (0,arrowht) + ifelse(`$1',,, + `"x`'svg_sub($1)" at last [].N6.end above + "s`'svg_sub($1)" at last [].S4.end below + "y`'svg_sub($1)" at last [].N5.end above') + ifelse(`$2',,, + `"x`'svg_sub($2)" ljust at 0.5 between last [].N2.end and last [].N1.end above + "y`'svg_sub($2)" rjust at 0.5 between last [].N2.end and last [].N1.end above + "s`'svg_sub($2)" at last [].S1.end below ') + ') + +P: nbitadder(0,n-1) + {"c`'svg_sub(o)" wid 0.15 at P.E1.end ljust } + {"c`'svg_sub(n)" at P.W1.end above } +Q: nbitadder(n,2n-1, with .E1.end at P.W1.end) + smarrow left arrowht from Q.W1.end + { "... " at Here+(-10pt__,0) } +R: nbitadder(,kn-1, with .E1.end at Here-(20bp__,0)) + smarrow left arrowht from R.W1.end + {"c`'svg_sub(kn)" wid 0.22 rjust } + + + ] with .nw at 1st [].sw+(0,-0.5) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AlogixSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AlogixSVG.m4 new file mode 100644 index 00000000000..58cac40f0cb --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AlogixSVG.m4 @@ -0,0 +1,116 @@ +.PS +# `AlogixSVG.m4' +log_init(svg_font(sans-serif,10.5bp__)) + +# A modest expression in default form +A: Autologix( + Nand(And(Or(A,C),Or(B,~C),Or(~A,B,C)),Ck); + Nand(~A,B)@with .n at last [].s+(0,-2bp__)) + "svg_it(Out1)" at A.Out1 ljust + "svg_it(Out2)" at A.Out2 ljust + Loopover_(`v_', `"svg_it(v_)" at A.In`'v_ above ', A,B,C,Ck) + move left 0.2 from A.w + "svg_tt(`Autologix(')" wid 68bp__ with .w at A.sw+(0,-0.15) + "svg_tt(`Nand(And(Or(A,C),Or(B,~C),Or(~A,B,C)),Ck);')" \ + wid 305bp__ with .w at last "".w+(0.2,-0.18) + "svg_tt(`Nand(~A,B)@with .n at last [].s+(0,-2bp__))')"\ + wid 313bp__ with .w at last "".w+(0,-0.18) + +# Draw a tree of gates only. The ~ has been +# replaced by NOT gates. +B: Autologix(Or(And(B,Not(C)),And(Not(A),B,C)),N) \ + with .sw at A.e+(1.3,-0.5) + "svg_it(Out)" at B.Out above ljust + "svg_tt(`Autologix(')" wid 68bp__ with .w at B.sw+(0,-0.15) + "svg_tt(`Or(And(B,Not(C)),And(Not(A),B,C)),N)')" \ + wid 262bp__ with .w at last "".w+(0.2,-0.18) + for_(1,4,1,`"svg_it(B.In`'m4x)" at B.In`'m4x rjust') + "svg_it(B.In5)" at B.In5+(0,-1.5bp__) rjust + +# Here is how to include an arbitrary circuit +# that is not one of the standard gates. +# First, define the circuit with a name ending +# in _gate. Make sure its inputs are on the left +# and named In1, In2, ... and the output Out +# is on the right. +define(`SR_gate',`[ + S: NOR_gate + R: NOR_gate at S+(0,-L_unit*(AND_ht+4)) + w = (S.Out.x-R.In1.x)/3 + v = 2*L_unit + line right_ dimen_/2 from S.Out + Out: Here + TR: R.In1-(v,0) + line from S.Out+(v,0) down w*3/2 then left S.Out.x-TR.x+v down w \ + then to TR then to R.In1 + TS: S.In2-(v,0); + line from R.Out right v then up w*3/2 then left R.Out.x-TS.x+v up w \ + then to TS then to S.In2 + In1: S.In1 + In2: R.In2 ]') +# Now define the function by which the circuit +# will be invoked: +define(`SRff',`_AutoGate(SR,$@)') + +# You are done. Here is an example: +G: [ + F: Autologix(SRff(And(x,y),Nand(x,y)),LRV) + + "svg_it(x)" at F.Inx rjust + "svg_it(y)" at F.Iny rjust + "svg_it(Out)" at F.Out ljust + ] with .sw at A.n+(0.5,-0.25) + "svg_tt(`Autologix(SRff(And(x,y),Nand(x,y)),LRV)')" wid 285pt__ \ + with .w at last [].sw+(0,-10pt__) + +undefine(`extras') +define(`extras') + +ifdef(`extras',` + Q1: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D))) \ + with .nw at A.sw+(0,-61bp__) + Loopover_(`x',`"x" wid 7bp__ at last [].In`'x above',A,B,C,D) + + "svg_tt(`Q1: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),options)')" \ + wid 363bp__ with .nw at Q1.sw+(0,-10bp__) + "svg_tt(`Loopover_(`x',`\"svg_it(x)\" at last [].In`'x above',A,B,C,D)')" \ + wid 431bp__ with .nw at last "".sw+(0,-5bp__) + + Q2: Autologix(Nor(Nor(A,And(B,~C)),Nand(Not(B),D)),V) \ + with .nw at last "".sw+(0,-16bp__) + Loopover_(`x',`"x" at last [].In`'x above',A,B,C,D) + "V" at last [].se above rjust + + Q3: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),R) \ + with .nw at last [].sw+(0,-0.2) + Loopover_(`x',`"x" at last [].In`'x above',A,B,C,D) + "R" at last [].se above rjust + + Q4: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),RV) \ + with .nw at last [].sw+(0,-0.2) + Loopover_(`x',`"x" at last [].In`'x above',A,B,C,D) + "RV" at last [].se above rjust + + Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),LRV) \ + with .Out at Q4.Out+(3.5,0) + Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D) + "LRV" at last [].se above rjust + + Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),LR;offset=-L_unit*1.5) \ + with .Out at Q3.Out+(3.5,0) + Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D) + "LR" at last [].se above rjust + + Autologix(Nor(Nor(A,And(B,~C)),Nand(Not(B),D)),LV;offset=L_unit*2) \ + with .Out at Q2.Out+(3.5,0) + Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D) + "LV" at last [].se above rjust + + Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),L) \ + with .Out at Q1.Out+(3.5,0) + Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D) + "L" at last [].se above rjust +') + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AmpTableSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AmpTableSVG.m4 new file mode 100644 index 00000000000..2850ff5ad70 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AmpTableSVG.m4 @@ -0,0 +1,25 @@ +.PS +# `Amptable.m4' +cct_init(svg_font(sans-serif,11bp__)) + + textwid = 0.7 + movewid = 2pt__ +{ + {amp ; move ; "`amp'" ljust} + move down 0.4; right_ + {amp(,0.3) ; move ; "`amp'(,0.3)" ljust} + } + move right_ 2.0 +{ {delay ; move ; "`delay'" ljust} + move down 0.4; right_ + {delay(,0.2) ; move ; "`delay'(,0.2)" ljust} + } + + move right_ 2.0 +{ {integrator ; move ; "`integrator'" ljust} + move down 0.5; right_ + {integrator(,0.3) ; move ; "`integrator'(,0.3)" wid 1.2 at Here ljust} + } + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AntennasSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AntennasSVG.m4 new file mode 100644 index 00000000000..ed098b39108 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AntennasSVG.m4 @@ -0,0 +1,40 @@ +.PS +# `Antennas.m4' +cct_init(svg_font(sans-serif,11bp__)) + textoffset = 3bp__ + + define(`elen_',elen_*0.9) + B: Here + A: antenna + "T" below at A.T + "`antenna'" wid 0.6 at A.n above + A: antenna(at A.T+(elen_,0),T) + "T" below at A.T + "`(,T)'" at A.n above + A: antenna(at A.T+(elen_,0),,L) + "T1" below rjust at A.T1 + "T2" below ljust at A.T2 + "`(,,L)'" at A.n above + A: antenna(at A.T+(elen_,0),T,L) + "T1" below rjust at A.T1 + "T2" below ljust at A.T2 + "`(,T,L)'" at A.n above + A: antenna(at A.T+(elen_,0),,T) + "T" below at A.T + "`(,,T)'" at A.n above + A: antenna(at A.T+(elen_,0),,S) + "T1" below rjust at A.T1 + "T2" below ljust at A.T2 + "`(,,S)'" at A.n above + A: antenna(at A.T+(elen_,0),,D) + "T1" below rjust at A.T1 + "T2" below ljust at A.T2 + "`(,,D)'" at A.n above + A: antenna(at A.T+(elen_,0),,P) + "T" below at A.T + "`(,,P)'" at A.n above + A: antenna(at A.T+(elen_,0),,F) + "T" below at A.T + "`(,,F)'" at A.n above + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AudioSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AudioSVG.m4 new file mode 100644 index 00000000000..116f155e589 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AudioSVG.m4 @@ -0,0 +1,93 @@ +.PS +# `Audio.m4' +cct_init(svg_font(sans-serif,11bp__,2bp__)) + +define(`In123',` +thinlines_ + arrow <- from `$1'.In1 up 0.05 left 0.15 + "svg_it(In1)" wid 0.25 rjust above + arrow <- left 0.15 from `$1'.In2 + "svg_it(In2)" rjust + arrow <- from `$1'.In3 down 0.05 left 0.15 + "svg_it(In3)" rjust below +thicklines_ ') + +L:[ + S: speaker + `"speaker"' at S.s+(0,-0.2) below + In123(S) + thinlines_ + arrow <- from S.In4 left 0.05 up 0.15 + "svg_it(In4)" above rjust + arrow <- from S.In5 right 0.05 up 0.15 + "svg_it(In5)" above ljust + arrow <- from S.In6 left 0.05 down 0.15 + "svg_it(In6)" below rjust + arrow <- from S.In7 right 0.05 down 0.15 + "svg_it(In7)" below ljust + spline <- from S.Box.e+(0,0.05) right 0.27 up 0.10 \ + then right 0.1 up 0.2 + "svg_it(Box)" above + thicklines_ + ] +[ + H: speaker(,,H) + `"...(,,H)"' at H.s+(0,-0.30) below + ] with .sw at last [].se +[ + B: bell + `"bell"' at B.s+(0,-0.2) below + In123(B) + thinlines_ + arrow <- from B.Box.n+(-0.1,0) up 0.15 left 0.1 ; "svg_it(Box)" above + arrow <- from B.Circle.n up 0.15 ; "svg_it(Circle)" above + thicklines_ + ] with .sw at last [].se+(0.35,0) +[ + M: microphone + `"microphone"' at M.s+(0,-0.2) below + In123(M) + thinlines_ + arrow <- from M.Circle.n up 0.15 ; "svg_it(Circle)" above + thicklines_ + ] with .sw at last [].se+(0.4,0) +[ + Z: buzzer + `"buzzer"' at Z.s+(0,-0.2) below + In123(Z) + thinlines_ + arrow <- from Z.Box.n up 0.15 ; "svg_it(Box)" above + thicklines_ + ] with .sw at last [].se+(0.4,0) +R:[ + Z: buzzer(,,C) + `"buzzer(,,C)"' at Z.s+(0,-0.2) below + In123(Z) + thinlines_ + spline <- from 0.8<Z.Face.s,Z.Face.n> right 2*arrowht up 0.5*arrowht \ + then up 0.15 right 0.05 + "svg_it(Face)" wid 0.5 at Here above + thicklines_ + ] with .sw at last [].se+(0.4,0) +[[ + E: earphone + `"earphone"' at E.s+(0,-0.2) below + In123(E) + thinlines_ + arrow <- from E.Box.n up 0.15 left 0.15 ; "svg_it(Box)" above + thicklines_ + ] + [ + E: earphone(,,C) + `"earphone(,,C)"' at E.s+(0,-0.2) below + thinlines_ + arrow <- from E.L up 0.15 left 0.15; "svg_it(L)" rjust + arrow <- from E.R up 0.15 right 0.15; "svg_it(R)" ljust + "svg_it(N)" at E.N above + "svg_it(C)" at E.C + thicklines_ + ] with .sw at last [].se+(0.4,0) +] with .n at (0.5 between L and R,L.s)+(0,-0.2) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.m4 new file mode 100644 index 00000000000..630326f867c --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.m4 @@ -0,0 +1,59 @@ +.PS +#Banking.m4 + +gen_init + + scale = 2.54 # use cm + svg_font(Arial Black,11 bp__,2 bp__) + boxwid = 6.8 + boxht = 4.5 + linethick_(1.5) + + define(`heading', + `<tspan font-style=\"bold\" font-size=\"120%\" fill=\"white\">`$1'</tspan>') + define(`subheading', + `<tspan fill=\"white\" font-size=\"75%\" font-style=\"bold\">[`$1']</tspan>') + define(`wtext',`<tspan fill=\"white\">`$1'</tspan>') + + C: circle diam 2.6 colored "mediumblue" + Person: box rad boxht/4 colored "mediumblue" with .n at C.s+(0,C.rad/8) \ + "heading(Personal Banking)" \ + "" \ + "heading(Customer)" \ + "subheading(Person)" \ + "" \ + "wtext(A customer of the bank`,' with)" \ + "wtext(personal bank accounts.)" + + A1: arrow thick 1.5 dashed down 3.5 from Person.s + svg_font(Arial,11 bp__,2 bp__) + { box invis fill 1 ht 0.4 wid 1.0 "Uses" at A1 } + command "</g>" + Internet: box colored "steelblue" \ + "heading(Internet Banking System)" \ + "subheading(Software system)" \ + "" \ + "wtext(Allows customers to view)" \ + "wtext(information about their bank)" \ + "wtext(accounts`,' and make payments.)" + + svg_font(Arial,11 bp__,2 bp__) + A2: arrow thick 1.5 dashed right 5.4 from Internet.e \ + "Sends e-mail" above "using" below + command "</g>" + Email: box colored "slategrey" \ + "heading(E-mail System)" \ + "subheading(Software system)" \ + "" \ + "wtext(Internal Microsoft Exchange)" \ + "wtext(e-mail system.)" + + A3:arrow thick 1.5 dashed from Email.nw+(0.4,0) to Person.se+(0.3,Person.ht/5) + svg_font(Arial,11 bp__,2 bp__) + { box invis fill 1 ht 0.4 wid 3.3 "Sends e-mails to" at A3 } + command "</g>" + +# etc + + command "</g>" # font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.txt b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.txt new file mode 100644 index 00000000000..122846d1c33 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.txt @@ -0,0 +1,54 @@ +.PS +#Banking.m4 + + command "<g style=\"font-family:Arial\">" + textht = 12*(scale/72)*dptextratio # 12 pt size + + scale = 2.54 # use cm + boxwid = 6.8 + boxht = 4.5 + arrowwid = 0.25 + arrowht = 0.5 + +define heading {"<tspan font-style=\"bold\" font-size=\"120%\" fill=\"white\" +>$1</tspan>"} +define subheading {"<tspan font-style=\"bold\" font-size=\"75%\" fill=\"white\" +>$1</tspan>"} +define wtext {<tspan fill="white">$1</tspan>} + + C: circle diam 2.6 colored "mediumblue" + Person: box rad boxht/4 colored "mediumblue" with .n at C.s+(0,C.rad/8) \ + heading(Personal Banking) \ + "" \ + heading(Customer) \ + subheading(Person) \ + "" \ + wtext(A customer of the bank, with) \ + "wtext(personal bank accounts.)" + +# arrow thick 1.5 dashed down 3.5 from Person.s +# { box invis fill 1 ht 0.4 wid 1.0 "Uses" at last arrow } +# Internet: box colored "steelblue" \ +# "heading(Internet Banking System)" \ +# "subheading(Software system)" \ +# "" \ +# "wtext(Allows customers to view)" \ +# "wtext(information about their bank)" \ +# "wtext(accounts`,' and make payments.)" +# +# arrow thick 1.5 dashed right 5.4 from Internet.e \ +# "Sends e-mail" above "using" below +# Email: box colored "slategrey" \ +# "heading(E-mail System)" \ +# "subheading(Software system)" \ +# "" \ +# "wtext(The internal Microsoft Exchange)" \ +# "wtext(e-mail system..)" +# +# arrow thick 1.5 dashed from Email.nw+(0.4,0) to Person.se+(0.3,Person.ht/5) +# { box invis fill 1 ht 0.4 wid 3.3 "Sends e-mails to" at last arrow } + +# etc + + command "</g>" # font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BipSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BipSVG.m4 new file mode 100644 index 00000000000..7dbf38c84a7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BipSVG.m4 @@ -0,0 +1,68 @@ +.PS +# `Bip.m4' +cct_init(svg_font(sans-serif,11bp__)) + + up_ +Q1: bi_tr(up_ dimen_) + thinlines_ + box dotted ht last [].ht wid last [].wid at last [] + thicklines_ + "E" at Q1.E-(0,0.05) below + "B" at Q1.B rjust + "C" at Q1.C above + "`bi_tr(up_ dimen_)'" wid 1.2 at Q1.s + (0,-0.35) below + +Q2: bi_tr(,R) with .E at Q1.E+(0.25,0) + thinlines_ + box dotted ht last [].ht wid last [].wid at last [] + thicklines_ + "E" at Q2.E-(0,0.05) below + "B" at Q2.B ljust + "C" at Q2.C above + "`bi_tr(,R)'" at Q2.s + (0,-0.2) below + +Q3: bi_tr(,,P) with .C at Q2.C+(1.15,0) + thinlines_ + box dotted ht last [].ht wid last [].wid at last [] + thicklines_ + "E" at Q3.E-(0,0.05) below + "B" at Q3.B rjust + "C" at Q3.C above + "`bi_tr(,,P)'" at Q3.s + (0,-0.2) below + +Q4: bi_tr(,,,E) with .C at Q3.C+(0.9,0) + thinlines_ + box dotted ht last [].ht wid last [].wid at last [] + thicklines_ + "E" at Q4.E-(0,0.05) below + "B" at Q4.B rjust + "C" at Q4.C above + "`bi_tr(,,,E)'" at (Q4.s,Q4.E) + (0,-0.2) below + +Q5: igbt(,,) with .E at Q4.E+(0.65,0) + thinlines_ + box dotted ht last [].ht wid last [].wid at last [] + thicklines_ + "E" at Q5.E-(0,0.05) below + "G" at Q5.G rjust + "C" at Q5.C above + "`igbt'" at Q5.s + (0,-0.2) below + +Q6: igbt(,,LD) with .E at Q5.E+(0.55,0) + thinlines_ + box dotted ht last [].ht wid last [].wid at last [] + thicklines_ + "E" at Q6.E-(0,0.05) below + "G" at Q6.G rjust + "C" at Q6.C above + "`igbt(,,LD)'" at (Q6.s,Q6.E) + (0,-0.2) below + +Q7: Darlington with .E at Q6.E+(1.2,0) + thicklines_ + "E" wid 0.15 at Q7.E-(0,0.05) below + "B" at Q7.B rjust + "C" at Q7.C above + "`Darlington'" at (Q7.s,Q7.E) + (0,-0.2) below + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BtreeSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BtreeSVG.m4 new file mode 100644 index 00000000000..df0a2726b22 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BtreeSVG.m4 @@ -0,0 +1,33 @@ +.PS +# Btree.m4 +# One way to draw a binary tree using pic macros +gen_init(svg_font(sans-serif,11bp__)) +circlerad = 0.35 + +define n { [C: circle fill_(0.9) $1 + if "$2" != "" then { + L: $2 with .ne at C.s-(circlerad/20, circlerad/2) + line from C to L.C chop } + if "$3" != "" then { + R: $3 with .nw at C.s+(circlerad/20,-circlerad/2) + line from C to R.C chop } + ] } + +# Redrawn from T. A. Standish, "Data Structure Techniques," Addison-Wesley 1980. +# Node data: +define Sirius { n("Sirius",Canopus,Vega) } +define Canopus { n("Canopus",AlphaCentauri,Capella) } +define AlphaCentauri { n("Alpha" "Centauri",Achernar,Arcturus) } +define Arcturus { n("Arcturus",Betelgeux) } +define Betelgeux { n("Betelgeux",BetaCentauri) } +define Capella { n("Capella",Rigel) } +define Rigel { n("Rigel",Procyon) } +define Achernar { n("Achernar") } +define BetaCentauri { n("Beta" "Centauri") } +define Procyon { n("Procyon") } +define Vega { n("Vega") } + +# Build the tree from the root +S: Sirius + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ButtonsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ButtonsSVG.m4 new file mode 100644 index 00000000000..b9e9c12e699 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ButtonsSVG.m4 @@ -0,0 +1,115 @@ +.PS +# ButtonsSVG.m4 +gen_init(svg_font(sans-serif,11bp__)) +copy "HOMELIB_/dpictools.pic" + +divert(-1) +################################################################# + + `RoundButton(diameter,hue,linedensity) + hue 0=red, 60=yellow, 120=green ...' +define(`RoundButton',`[ +# Colors and radius: + hue = ifelse(`$2',,60,`$2') + crad = ifelse(`$1',,circlerad,(`$1')/2) + linedensity = ifelse(`$3',,150/scale,`$3') # default 150 lines per inch + hsvtorgb(hue, 1, 1, r1,g1,b1) + hsvtorgb(hue-5, 1,0.9, r2,g2,b2) + hsvtorgb(hue-10,1,0.5, r3,g3,b3) +# Shaded main disk + define RBbackground { + circle rad crad*($`'1) thick lthk at C outlined rgbstring($`'2,$`'3,$`'4) + } + C: circle invis rad crad at (0,0) + nsteps = round_(crad*linedensity) + lthk = crad/nsteps/(1bp__) + ShadeObject(RBbackground,nsteps, + 0, r1,g1,b1, + 0.2, r1,g1,b1, + 0.8, r2,g2,b2, + 1, r3,g3,b3) at C +# Highlight disk with arc shading + rad1 = crad*3/4 + C1: C.n-(0,rad1+0.02*crad) + C2: C1+(0,2*rad1) + lthk = 2*rad1/nsteps/(1bp__) + define RBoverlay { + radx = rad1 + ($`'1)*2*rad1 + if $`'1 < 1 then { + arc cw rad radx thick lthk outlined rgbstring($`'2,$`'3,$`'4) \ + from Cintersect(C2,radx,C1,rad1) \ + to Cintersect(C2,radx,C1,rad1,R) \ + with .c at C2 + } } + nsteps = round_(rad1*2*linedensity) + ShadeObject(RBoverlay,nsteps, + 0, 1, 1, 1, + 0.1, 1, 1, 1, + 0.33,(r1+r2)/2,(g1+g2)/2,(b1+b2)/2, + 0.67,r1,g1,b1, + 1, (r1+r2)/2,(g1+g2)/2,(b1+b2)/2) with .c at C1 + `$4']') + +################################################################# + + `BoxButton(wid,height,hue,linedensity) + hue 0=red, 60=yellow, 120=green ...' +define(`BoxButton',`[ +# Size and Color + boxw = ifelse(`$1',,boxwid*4/3,`$1') + boxh = ifelse(`$2',,boxw/4,`$2') + hue = ifelse(`$3',,180,`$3') + hsvtorgb(hue, 1, 1, r1,g1,b1) + hsvtorgb(hue-5, 1,0.9, r2,g2,b2) + hsvtorgb(hue-10,1,0.5, r3,g3,b3) +# Peripheral shading + linedensity = ifelse(`$4',,150/scale,`$4') + nsteps=10 + define BxBshadow { + box ht boxh wid boxw rad boxh/2 \ + outlined rgbstring($`'2,$`'3,$`'4) at (0,($`'1)*4*linethick bp__) + } + Q: ShadeObject(BxBshadow,nsteps, + 0, 1,1,1, + 1, r3,g3,b3) +# Shaded body + lthk = boxh/nsteps/(1bp__) + define BxBshade { + v = boxh*(1-($`'1)) + h = (boxw-boxh)/2+sqrt((boxh/2)^2-(v-boxh/2)^2) + line from (-h,v) to (h,v) thick lthk outlined rgbstring($`'2,$`'3,$`'4) + } + nsteps = boxh*linedensity + C: ShadeObject(BxBshade,nsteps, + 0, r1, g1, b1, + 0.4, r2, g2, b2, + 1, r3, g3, b3) with .n at Q.n +# Shaded highlight + bh = boxh*0.4 + bw = boxw*4/4.5 + define BxBhighlight { + v = bh*(1-($`'1)); h = (bw-bh)/2+sqrt((bh/2)^2-(v-bh/2)^2) + line from (-h,v) to (h,v) thick lthk outlined rgbstring($`'2,$`'3,$`'4) + } + nsteps = bh*linedensity + ShadeObject(BxBhighlight,nsteps, + 0,1,1,1, + 8/nsteps,1,1,1, + 1, r2,g2,b2) with .n at Q.n+(0,-boxh/20) + `$5']') + +################################################################# +divert(0)dnl + +for x=0 to 5 do { + B: RoundButton(0.6,x*60) at (x,0) + "Button" sprintf("%g",x+1) at B } + +[ for i=0 to 2 do { + BoxButton(1.5,,180+120*i) at (i*2,0) + "Button" at last [].C + } + ] with .nw at 1st [].sw+(0,-0.5) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ByteSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ByteSVG.m4 new file mode 100644 index 00000000000..fcd6bdce60c --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ByteSVG.m4 @@ -0,0 +1,38 @@ +% Byte.m4 +.PS +gen_init(svg_font(sans-serif,11bp__)) +boxht = 0.2 +boxwid = 3.5 + +define leftlabel { {"$1" at last box.w ljust} } + +down_ +Lab[0]: box; leftlabel( B0STDISBL (reset pin is enabled) ) +Lab[1]: box; leftlabel( WDTON (WDT not always on) ) +Lab[2]: box; leftlabel( SPIEN (allow serial programming) ) +Lab[3]: box; leftlabel( CKOPT (full output swing) ) +Lab[4]: box; leftlabel( EESAVE (don't preserve EEPB0OM over chip erase) ) +Lab[5]: box; leftlabel( BOOTSZ1 ) +Lab[6]: box; leftlabel( BOOTSZ0 ) +Lab[7]: box; leftlabel( BOOTB0ST (boot reset vector at 0x0000) ) + +boxwid = boxht +left_ +B0:box "1" with .e at Lab[0].nw + (0.75,0.5) + box "0" + box "0" + box "1" + box "0" + box "0" + box "1" + box "1" + box wid 2*boxht "0xc9" + +for i=0 to 7 do { + spline -> ht arrowht*0.7 from B0.s-(i*boxht,0) down boxht/4 \ + then to Lab[0].nw-((i+1)*boxht/2,0) \ + then down Lab[0].nw.y-Lab[i].y then to Lab[i].w + } + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CanLogicSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CanLogicSVG.m4 new file mode 100644 index 00000000000..b6c1d02e2f2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CanLogicSVG.m4 @@ -0,0 +1,159 @@ +.PS +#CanLogic +ifdef(`L_unit',,`include(liblog.m4)') +log_init(svg_font(sans-serif,11bp__)) + +divert(-1) +########################################################################### + Macros for automatically drawing 2-layer + Boolean functions + + Style parameters +define(`dotrad_',(0.01*scale)) +define(`gatelineth',1) +define(`lineth',0.5) +define(`inputsep',`2*jog') +define(`jog',`(AND_ht/2)*L_unit') + + `CanLogic(layer gate type,[N], + output gate type,[N], + term,term,...) + This is the driver macro. Terms are + strings of variables or of variables + preceded by the ~ character. Each + variable is one letter e.g. + CanLogic(NAND,,OR,N,abcd,a~b,c,~ad)' +define(`CanLogic', + `define(`terms',`shift(shift(shift(shift($@))))') +# Determine required input variables and negated +# variables + Loopover_(`t_',`varloop(`v_',`define(X`'v_)',`define(XN`'v_)',t_)',terms) +# Draw the inputs with NOT gates as necessary + LastInput: Here-(inputsep,0) + Loopover_(`t_',`varloop(`v_', + `ifdef(D`'v_,,`ifdef(XN`'v_,`DrawInNotIn(v_)',`DrawIn(v_)')')', + `ifdef(D`'v_,,`ifdef(X`'v_,`DrawInNotIn(v_)',`DrawNotIn(v_)')')', t_)', + terms) +# Draw 2nd-layer gates + right_ + LastGateSE: LastInput+(5*jog,-(AND_wd*L_unit*1.5)) + Loopover_(`t_', + `define(`termcount',m4Lx)DrawLayerGate(G`'termcount,$1,$2,t_)', + terms) +# Draw output gate + linethick = gatelineth + OP: m4xpand(`$3'_gate(termcount,$4)) with .Out at \ + 0.5<G1.Out,G`'termcount.Out> + (jog/2*(termcount+3)+AND_wd*L_unit,0) + Out: Here + linethick = lineth +# Connect 2nd-layer gates to the output gate + VectorConnect(G,termcount,OP) +# Connect the inputs and negated inputs to +# 2nd-layer gates + Loopover_(`t_',`ConnectInputs(G`'m4Lx,t_)',terms) +# Clean up + Loopover_(`t_',`DeleteLogDefs(t_)',terms) + ') + `VectorConnect(number of 2nd layer gates, + common 2nd layer gate name, + output gate name) + Connect the 2nd-layer gate outputs to the + output gate inputs' +define(`VectorConnect', + `for_(1,`$2',1, + `line from `$1'm4x.Out right `$3'.In1.x-`$1'm4x.Out.x \ + - jog/2*(`$2'+1-abs(2*m4x-`$2'-1)) \ + then down `$1'm4x.Out.y - `$3'.In`'m4x.y then to `$3'.In`'m4x ')') + + Draw and label a non-inverted input +define(`DrawIn', + `LastInput: LastInput+(inputsep,0) + In`'$1: LastInput + "svg_it($1)" ljust at LastInput # Maybe labels should be done externally + Int`'$1: LastInput + define(D`'$1)') + + Draw and label an inverted input +define(`DrawNotIn', + `LastInput: LastInput+(inputsep,0) + InN`'$1: LastInput + "svg_it($1)" ljust at LastInput # Maybe labels should be done externally + line down_ 2*jog from LastInput + linethick = gatelineth + NOT_gate + InNt`'$1: Here + linethick = lineth + define(D`'$1)') + Draw and label an input that is required both + inverted and uninverted. +define(`DrawInNotIn', + `LastInput: LastInput+(inputsep,0) + In`'$1: LastInput + "svg_it($1)" ljust at LastInput # Maybe labels should be done externally + line from LastInput down jog + Int`'$1: dot + LastInput: LastInput+(inputsep,0) + line to (LastInput,Here) then down_ jog + linethick = gatelineth + NOT_gate + linethick = lineth + InNt`'$1: Here + define(D`'$1)') + `varloop(`var',ifnotnegated,ifnegated,term) + Loop over term variables performing actions' +define(`varloop',`ifelse(`$4',,,substr(`$4',0,1),~, + `define(`$1',substr($4,1,1)) $3 + varloop(`$1',`$2',`$3',substr($4,2))', + `define(`$1',substr($4,0,1)) $2 + varloop(`$1',`$2',`$3',substr($4,1))')')') + + Count gate inputs and mark last appearance +define(`Countinputs',`varloop(`v_', + `define(`incount',incr(incount)) define(Last`'v_,`$1')', + `define(`incount',incr(incount)) define(LastN`'v_,`$1')',$2)') + + Draw a 2nd layer gate +define(`DrawLayerGate', + `define(`incount',0) + Countinputs($1,$4) + ifelse(incount,1, + `LastGateSE: LastGateSE-(0,jog) + $1: [ In1:Here; line right AND_wd*L_unit; Out: Here] \ + with .Out at LastGateSE', + `LastGateSE: LastGateSE-(0,jog+AND_ht*L_unit) + linethick = gatelineth + $1: m4xpand(`$2'_gate(incount,$3)) with .se at LastGateSE + linethick = lineth ')') + + Connect this gate to its input lines +define(`ConnectInputs',`define(`innum',0) varloop(`v_', + `define(`innum',incr(innum)) + line from `$1'.In`'innum to (In`'v_,`$1'.In`'innum)dnl + ifelse(`$1',m4xpand(Last`'v_),`then to In`'v_',`; dot')', + `define(`innum',incr(innum)) + line from `$1'.In`'innum to (InNt`'v_,`$1'.In`'innum)dnl + ifelse(`$1',m4xpand(LastN`'v_), `then to InNt`'v_', `; dot')',$2)') + + Delete definitions to allow more than one + circuit per diagram +define(`DeleteLogDefs',`varloop(`v_', + `undefine(Last`'v_) undefine(D`'v_) undefine(X`'v_)', + `undefine(LastN`'v_) undefine(D`'v_) undefine(XN`'v_)',$1)') + + Thanks to Alexander Ray for suggesting the + need for something like these macros +########################################################################### +divert(0)dnl + + linethick = lineth + +[ CanLogic(AND,,OR,,abcd,a~b,c,~ad) #; line right jog from Out "svg_it(f)" above + ] +{`"CanLogic(AND,,OR,,abcd,a~b,c,~ad)"' at last [].s -(0,11bp__)} + +[ CanLogic(OR,N,NAND,,ab~c,a~bc,ac,~d) #; line right jog from Out "$f$" above + ] with .sw at last [].se+(0.5,0) +{`"CanLogic(OR,N,NAND,,ab~c,a~bc,ac,~d)"' at last [].s - (0,11bp__)} + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4 new file mode 100644 index 00000000000..3c79a32d6bc --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4 @@ -0,0 +1,79 @@ +.PS +# `CctTableSVG.m4' +cct_init(svg_font(sans-serif,11pt__)) +textwid = 1.5 +movewid = 2 pt__ +hm = 2.1 +vm = 0.28 +{ {resistor ; move ; svgLink(NportSVG.svg,"`resistor'" ljust)} + move right_ hm + {resistor(,,Q) ; move ; "`resistor(,,Q) '" ljust} + move right_ hm + {resistor(,,E) ; move ; "`resistor(,,E) = ebox'" ljust} +} + move down vm; right_ +{ {resistor(,,ES) ; move ;"`resistor(,,ES) '" ljust} + move right_ hm + {resistor(,4,QR) ; move ;"`resistor(,4,QR) '" ljust} + move right_ hm + {resistor(,,H) ; move ;"`resistor(,,H) '" ljust} +} + move down vm; right_ +{ {resistor(,,V) ; move ;"`resistor(,,V)'" ljust} + move right_ hm + {ebox(,,,0.5) ; move ;"`ebox(,,,0.5)'" ljust} + move right_ hm + {ebox(,0.5,0.3) ; move ;"`ebox(,0.5,0.3)'" ljust} +} + move down vm; right_ +{ {inductor ; move ;"`inductor'" ljust} + move right_ hm + {inductor(,W); move ;"`inductor(,W)'" ljust} + move right_ hm + {inductor(,L); move ;"`inductor(,L)'" ljust} +} + move down vm; right_ +{ {inductor(,,,M) ; move ;"`inductor(,,,M)'" ljust} + move right_ hm + {inductor(,W,6,P); move ;"`inductor(,W,6,P)'" ljust} + move right_ hm + {ttmotor(,G) ; move ;"`ttmotor(,G)'" ljust} +} + move down vm; right_ +{ {capacitor ; move ;"`capacitor'" ljust} + move right_ hm + {capacitor(,C); move ;"`capacitor(,C)'" ljust} + move right_ hm + {capacitor(,C+); move ;"`capacitor(,C+)'" ljust} +} + move down vm; right_ +{ {capacitor(,P); move ;"`capacitor(,P)'" ljust} + move right_ hm + {capacitor(,E); move ;"`capacitor(,E)'" ljust} + move right_ hm + {capacitor(,K); move ;"`capacitor(,K)'" ljust} +} + move down 0.25; right_ +{ {capacitor(,M); move ;"`capacitor(,M)'" ljust} + move right_ hm + {capacitor(,N); move ;"`capacitor(,N)'" ljust} + move right_ hm + {xtal ; move ;"`xtal'" ljust} +} + move down 0.25; right_ +{ {memristor ; move;"`memristor'" ljust} + move right_ hm + {heater; move;"`heater'" ljust} + move right_ hm + {tline ; move;"`tline'" ljust} +} + move down 0.25; right_ +{ {gap ; move ;"`gap'" ljust} + move right_ hm + {gap(,,A) ; move ;"`gap(,,A)'" ljust} + move right_ hm + {arrowline ; move;"`arrowline'" ljust} +} + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ConnSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ConnSVG.m4 new file mode 100644 index 00000000000..9d828ee48fd --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ConnSVG.m4 @@ -0,0 +1,67 @@ +.PS +# `ConnSVG.m4' +cct_init(svg_font(sans-serif,11.5bp__)) + +T:[ + S1: tstrip(U) + thinlines_ + arrow <- left 0.15 from S1.L1; "L1" rjust + arrow <- left 0.15 from S1.L4; "L4" wid 0.2 rjust + "..." at (0.5 between last "" and 2nd last "")+(-0.15,0.02) + arrow <- right 0.25 from S1.R1; "R1" ljust + arrow <- right 0.25 from S1.R4; "R4" ljust + "..." at (0.5 between last "" and 2nd last "")+(0.15,0.02) + arrow <- right 0.15 up 0.10 from S1.T1; "T1" ljust + arrow <- right 0.15 up 0.10 from S1.T4; "T4" ljust + "..." at (0.5 between last "" and 2nd last "")+(0.15,0.02) + thicklines_ + CS1: "`tstrip(U)'" at S1.s+(0,-0.15) + S2: tstrip(R,5,DO;wid=1.0;ht=0.25) with .sw at S1.se+(0.7,0.15) + thinlines_ + arrow <- up 0.2 right 0.1 from S2.T1; "T1" above + arrow <- up 0.2 right 0.1 from S2.T5; "T5" above + "..." at 0.5 between last "" and 2nd last "" above + CS2: `"tstrip(R,5,"' ljust \ + `" DO;wid=1.0;ht=0.25)"' ljust at S2.sw+(-0.1,-0.2) +] + +C: [ + C1: ccoax + `"ccoax "' at C1.s below + thinlines_ + arrow <- up 0.1 right 0.1 from C1.C.ne; "C" ljust + arrow <- down 0.05 right 0.1 from C1.S.e; "S" wid 0.1 ljust + thicklines_ + C2: ccoax(at C1+(0,0.3),F) + `"ccoax(,F)"' wid 0.65 at C2.ne ljust + ] with .C1.sw at T.S2.se+(0.6,0.0) + +Y: [ + tconn(,O) + {`"tconn(,O)"' at last line.c+(0,-0.2) wid 43 pt__ } + move to Here+(0.3,0) + P1: tconn(,>) + {`"(,>)"' at last line.c+(0,-0.2)} + move to P1.end+(0.3,0) + tconn(,>>) + {`"(,>>)"' at last line.c+(0,-0.2)} + move to P1.start+(0,linewid) + P3: tconn(,<) + {`"tconn(,<)"' at last line.c+(0,-0.2)} + move to P3.end+(0.3,0) + tconn(,<<) + {`"(,<<)"' at last line.c+(0,-0.2)} + +] with .sw at (C.e.x-0.3,T.s.y) + +B: [ + tbox(V`'svg_sub(2)) + `"tbox(V`'svg_sub(2))"' wid 105bp__ with .nw at last [].sw+(0,-4bp__) + [ left_; + tbox(V`'svg_sub(1)) ] with .nw at last [].sw+(0,-0.25) + `"left_"' at last [].sw +(0,-0.2) ljust `"tbox(V`'svg_sub(1))"' wid 100bp__ \ + ljust +] with .nw at Y.ne+(0.2,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CountingSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CountingSVG.m4 new file mode 100644 index 00000000000..a972ba663f6 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CountingSVG.m4 @@ -0,0 +1,32 @@ +.PS +# CountingSVG.m4 +gen_init(svg_font(sans-serif,11bp__)) + + g = 0.4 # grid size + define grid { (($2)*g,-($1)*g) } + circlerad = 0.1 + +for i=1 to 4 do { # 66% becomes 66%% in the sprintf string: + sprintf("svg_it(S`'svg_sub(%g,66%):)",i) ljust at grid(i,-0.5) + for j=1 to 4 do { if i+j < 8 then { + sprintf("svg_it(s`'svg_sub(%g%g,66%))",i,j) at grid(i,j) } } } + +"." at grid(4.6,0) +"." at grid(4.7,0) +"." at grid(4.8,0) +for i=1 to 3 do { `"..."' at grid(i,5) } +"..." at grid(4,4) + +P: grid(1,1) +for k=3 to 5 do { + for i=1 to k-1 do { if (k%2==1) then { m=i; n=k-i } else { m=k-i; n=i } + Q: grid(m,n) + arrow from P to Q chop + P: Q } + } + +move from grid(1,1)+(-0.5,0.1) \# Adjust bounding box + to grid(4,4)+(0.5,-0.45) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrossbarSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrossbarSVG.m4 new file mode 100644 index 00000000000..12bb2d72c31 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrossbarSVG.m4 @@ -0,0 +1,54 @@ +.PS +# Crossbar switch +gen_init(svg_font(sans-serif,11bp__)) + circlerad = 0.12 + boxwid = 0.18 + boxht = 0.18 + rathick = 1.5 + rawd = rathick*4 bp__ + raht = rawd*2 + boxdist = boxwid*1.8 + +`define bcoord {($2,-($1))*boxdist}' +`define redarrow { arrow ht raht wid rawd thick rathick color "red" }' + +`define cbx {' + thinlines_ + n = $+ - 1 + for i=0 to n do { + line color "blue" from bcoord(i,0) to bcoord(i,n) + line color "blue" from bcoord(0,i) to bcoord(n,i) + C[i]: circle invis at bcoord(i,-1.5) + } + for i=0 to n do { + exec sprintf("col = $%g",i+1) + redarrow from C[i].e right 1.25*boxwid + redarrow from C[i].w+(-boxwid,0) right raht + for j=0 to n do { + B: box color "blue" shaded "yellow" at bcoord(i,j) + if j==col then { + line color "blue" from B.s to B.e + line thick rathick color "red" from C[i].e to B.w \ + then to B.n then to (B.x,C[0].y+(2+j*2/3)*boxht) + continue to (C[j].x-(2+j*2/3)*boxht,Here.y) + continue to (Here,C[j]) then to C[j].w + } \ + else { + line color "blue" from B.n to B.s + line color "blue" from B.w to B.e + } + } + } + thicklines_ + for i=0 to n do { + circle thick 1.5 outlined "blue" shaded "yellow" at C[i] \ + sprintf("ifpostscript(,ifsvg(,\large))%g",i) + } + } + +[ + cbx(3,6,0,5,2,7,1,4) + ] at 4,4 + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrowSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrowSVG.m4 new file mode 100644 index 00000000000..6be09389477 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrowSVG.m4 @@ -0,0 +1,74 @@ +.PS +# CrowSVG.m4 +#`Illustrates shadebox and custom crowfoot line termination' +gen_init(svg_font(sans-serif,11bp__)) + +# Custom macros -------------------------- + +# `crowline(linespec,wid,ht)' +define(`crowline', + `line `$1' + M4_E: last line.end + crow_wd = ifelse(`$2',,`(arrowwid*8/5)',`$2') + crow_ht = ifelse(`$3',,`(1.5*crow_wd)',`$3') + M4_P: vperp(last line); M4_P: (M4_P.x*crow_wd,M4_P.y*crow_wd) + M4_X: crow_ht/lin_leng(last line) between M4_E and last line.start + ifdpic( + `spline 0.4 from M4_E+M4_P to M4_X+M4_P then to M4_X-M4_P then to M4_E-M4_P', + `spline from M4_E+(M4_P.x,M4_P.y) to M4_X+(M4_P.x,M4_P.y) \ + then to M4_X-(M4_P.x,M4_P.y) then to M4_E-(M4_P.x,M4_P.y)') ') + +define(`custombox', + ``$1': shadebox(box `$2',3) + "`$1'" at last box.n above + boxtext(shift(shift($@)))') + +define boxtext { + for i=1 to $+ do { move to last box.nw+(3pt__,-(2+i*11)pt__); + exec sprintf("\"$%g\" ljust",i) } + } + +# ---------------------------- + + boxwid = boxwid*1.15 + boxsep = boxwid/2 + + custombox(Class,ht boxht*2.2, + `classkey, class_type, class_desc') + + custombox(Product,ht Class.ht with .nw at Class.ne+(boxsep,0), + `classkey, prodkey, prod_name, pkg_type') + + custombox(Sales,ht boxht*3.3 with .nw at Product.ne+(boxsep*2,15pt__), + `perkey, classkey, prodkey, storekey, promokey, quantity, dollars') + + custombox(Period,ht Sales.ht with .nw at Sales.ne+(boxsep*2,0), + `perkey, date, day, week, month, qtr, year') + + custombox(Market,ht Sales.ht with .nw at Class.sw+(0,-boxsep*2), + `perkey, date, day, week, month, qtr, year') + + custombox(Store,ht boxht*3.6 with .sw at (Product.w,Market.s), + `storekey, mktkey, store_type, store_name, street, city, state, zip') + + custombox(Promotion,ht Market.ht with .sw at (Period.w,Market.s), + `promokey, promo_type, promo_desc, value, start_date, end_date') + + move to Class.ne+(0,-10pt__); crowline(to (Product.w,Here)) + + move to Product.ne+(0,-10pt__); crowline(to (Sales.w,Here)) + move to last line.start+(0,-crow_wd*2.5); crowline(to (Sales.w,Here)) +T: last line.c+(0,-crow_wd*2.5) + + move to Period.nw+(0,-10pt__); crowline(to (Sales.e,Here),,1.75*crow_wd) +Q: (last line.c,0.4 between Sales.se and Sales.ne) + + move to Market.ne+(0,-10pt__); crowline(to (Store.w,Here)) + move to Store.ne+(0,-10pt__); line to (T,Here) then to T + crowline(to (Sales.w,Here)) + + move to Promotion.nw+(0,-10pt__); line to (Q,Here) then to Q + crowline(to (Sales.e,Here),,1.75*crow_wd) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrullerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrullerSVG.m4 new file mode 100644 index 00000000000..f4630aff06e --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrullerSVG.m4 @@ -0,0 +1,67 @@ +.PS +# CrullerSVG.m4 +threeD_init +NeedDpicTools +scale = 2.54 + +define(`lobe',`(sind(6*(`$1'))+4)/5*2.25') + + viewazimuth = 20 # Set view angles in degrees + viewelevation = 30 + setview(viewazimuth,viewelevation,0) + + dt = 3 # major angle degrees per facet + ds = 10 # minor angle degrees per facet + + tradius = 6 +define(`cruller',`rot3Dz((`$1')*dtor_, + sum3D(0,tradius,0,0,Rect_(lobe(`$2'+2*(`$1')),`$2')))') + +define(`tvisible',`dot3D(View3D, + cross3D(diff3D(cruller(`$1'+dt/2,`$2'),cruller(`$1',`$2')), + diff3D(cruller(`$1',`$2'+ds/2),cruller(`$1',`$2'))))') + + # create the arrays and sort + n = 0 + for t = dt to 360+dt/2 by dt do { + for s=ds/2 to 360.1 by ds do { + if tvisible(t,s) > -0.01 then { + n +=1 + t[n] = t + s[n] = s + d[n] = dot3D(cruller(t,s),view3D1,view3D2,view3D3) # view distance + ix[n] = n + } + } } +# prval(n) + dpquicksort(d,1,n,ix) + + # Background +Bne: (9,6) +Bsw: (-9,-6) +B: 0.5 between Bne and Bsw +iflatex(`line fill_(0.75) \ + from (Bsw,Bne) to Bsw then to (Bne,Bsw) then to Bne then to (Bsw,Bne)', + `ShadedPolygon((Bsw,Bne):Bsw:(Bne,Bsw):Bne,,-30, + 0,1,1,1, + .5,.1,.4,0, + 1,0,0,0) at B') + # draw the facets +thinlines_ +[ + rgbtohsv(0.6,0.4,0,h,s,v) + for i = 1 to n do { + tc = t[ix[i]]; sc = s[ix[i]] + SE: (project(cruller(tc+dt/2,sc-ds/2))) + SW: (project(cruller(tc-dt/2,sc-ds/2))) + NW: (project(cruller(tc-dt/2,sc+ds/2))) + NE: (project(cruller(tc+dt/2,sc+ds/2))) + f = ((dcosine3D(3,cruller(tc,sc))/2.25+1)/2)^2 + hsvtorgb(h,(1-f)*s,1,r,g,b) + line outlined rgbstring(r,g,b) shaded rgbstring(r,g,b) ifpdf( invis ) \ + from SE to SW then to NW then to NE then to SE } + ] at B + +thicklines_ + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CsourceSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CsourceSVG.m4 new file mode 100644 index 00000000000..e194f01f8cb --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CsourceSVG.m4 @@ -0,0 +1,197 @@ +.PS +# Csource.m4 +cct_init(svg_font(sans-serif,11bp__,2bp__)) + +# The default line separation is a bit small if the top line contains +# subscripts, so we space stacked lines explicitly: +define(`stbelow',`at last ""-(0,textht*1.3)') + +define(`loffset',`+(textoffset,0)') +define(`roffset',`-(textoffset,0)') + +define(`npair',`[define(`m4lr',ifelse(`$1',,l,r)) + J: mosfet(down_ dimen_,ifelse(`$1',,R,L),uHSDF,E) + {["svg_it(Q`'svg_sub(`$2'))" ljust; "2N5464" ljust stbelow]\ + at J.nw+(ifelse(`$1',,-5bp__,5bp__),textht*0.75)} + G: J.G + line ifelse(`$1',,right,left) dimen_/4 from J.D + Q: bi_tr(up_ dimen_,ifelse(`$1',,L,R),,E) with .B at Here + {["svg_it(Q`'svg_sub(`$3'))" m4lr`'just; "2N4239" m4lr`'just stbelow] \ + at last [].ifelse(`$1',,e,w)} + E: Q.E + S: dot(at (Q.C,J.S)) + line from J.S to S then to Q.C ]') + +define(`ppair',`[define(`m4lr',ifelse(`$1',,l,r)) + J: mosfet(down_ dimen_,ifelse(`$1',,R,L),dHSDF,E) + {["svg_it(Q`'svg_sub(`$2'))" ljust; "2N3819" ljust stbelow] \ + at J.sw+(ifelse(`$1',,0,`4bp__'),-textht*0.6)} + G: J.G + line ifelse(`$1',,right,left) dimen_/4 from J.S + Q: bi_tr(down_ dimen_,ifelse(`$1',,R,L),P,E) with .B at Here + {["svg_it(Q`'svg_sub(`$3'))" m4lr`'just; "2N4236" m4lr`'just stbelow]} + E: Q.E + S: dot(at (Q.C,J.D)) + line from J.D to S then to Q.C ]') + + textht = textht*0.8 + R2: resistor(down_ dimen_) + {["svg_it(R`'svg_sub(2))" ljust; "150`'svg_ohm" ljust stbelow] \ + at last [].e loffset } + dot + Q13: bi_tr(down_ dimen_,,P,E) with .E at Here + {["svg_it(Q`'svg_sub(13))" rjust; "2N4236" rjust stbelow] at last [].w } + line down 3.1*elen_ from Q13.C + Q14: bi_tr(up_ dimen_,R,,E) with .C at Here + {["svg_it(Q`'svg_sub(14))" rjust; "2N4239" rjust stbelow] at last [].w } + dot(at Q14.E) + { line left_ dimen_*1.3 then up_ dimen_ + R1: potentiometer(up_ dimen_) with .Start at Here + {["svg_it(R`'svg_sub(1))" ljust; "20k`'svg_ohm" ljust stbelow] \ + at last [].e loffset } + { ground(at R1.T1) } + line from R1.End to (R1.End,Q13.E) then to Q13.E } + { dot(at Q13.C+(0,-elen_)) + line to (R1.R,Here)+(-dimen_/2,0) + { arrowline(right_ dimen_/2); llabel(,i`'svg_sub(1)) } + { move left 0.2} + V1: gap(down_ dimen_,1); rlabel(+,V`'svg_sub(1),-) + line down_ dimen_/4 chop dotrad_ chop 0; ground(,T) } + R3: resistor(down_ dimen_) + {["svg_it(R`'svg_sub(3))" ljust; "150svg_ohm" ljust stbelow] \ + at last [].e loffset} + dot(at Q13.C+(0,-2*elen_)) + line right_ dimen_/2 + A1: opamp with .In2 at Here; "svg_it(A`'svg_sub(1))" at A1.C + { "Nexus" rjust "SQ-10A" rjust at (A1.E,A1.s)+(0,-textht/2) } + line left_ dimen_/4 from A1.In1 then up_ dimen_/2 then right dimen_ + dot + { resistor(up_ elen_) + {["svg_it(R`'svg_sub(14))" rjust; "19k`'svg_ohm" rjust stbelow] \ + at last [].w roffset} + line to (Here,Q13.E) then to Q13.E } + line to (A1.Out,Here) + dot + { line to A1.Out + dot + resistor(down_ to (Here,Q14.E)) + {["svg_it(R`'svg_sub(13))" ljust; "91k`'svg_ohm" ljust stbelow] \ + at last [].e loffset} + line to Q14.E } + R6: resistor(right_ dimen_) + {["svg_it(R`'svg_sub(6))" ljust; "15k`'svg_ohm" ljust stbelow] \ + with .n at last [].sw+(0,-textoffset) } + dot + line to (Here,A1.In1) then right_ dimen_/4 + A2: opamp with .In1 at Here; {"svg_it(A`'svg_sub(2))" at A2.C } + { "Nexus" rjust "SQ-10A" rjust at (A2.E,A2.s)+(0,-textht/2) } + line left_ dimen_/4 from A2.In2 + ground + + dot(at A2.Out) + DP1: npair(,3,4) with .E at (A2.Out,Q14.B)+(elen_*1.25,0) +#if 2 < 1 then { + line from A2.Out to (A2.Out,DP1.G) then to DP1.G + line from DP1.E to (DP1.E,R3.bottom); dot + D4: reversed(`diode',up_ dimen_/2 from DP1.S) + D3: reversed(`diode',up_ dimen_/2 from Here+(0,-dimen_/6)) + { "OMC-V" rjust "svg_it(D`'svg_sub(4))" rjust \ + "svg_it(D`'svg_sub(3))" rjust at last [].w } + DP2: ppair(,1,2) with .E at (DP1.E,Q13.B) + D1: diode(down_ dimen_/2 from DP2.S) + D2: diode(down_ dimen_/2 from Here+(0,dimen_/6)) + {"svg_it(D`'svg_sub(1))" rjust "svg_it(D`'svg_sub(2))" rjust "OMC-V" rjust\ + at last [].w } + dot(at (Here,A2)) + line to D2.bottom + line from DP2.G to (A2.Out,DP2.G) then to A2.Out + line from DP2.E to (DP2.E,R2.top); dot + + T: dot(at (DP1.E,A2)+(dimen_,0)) + DP3: npair(,7,8) with .G at (Here,DP1.G)+(dimen_/4,0) + dot(at DP3.E) + line to Q14.B + DP4: ppair(,5,6) with .G at (DP3.G,DP2.G) + dot(at DP4.E) + line to Q13.B + line from DP3.G to (T,DP3.G) then to (T,DP4.G) then to DP4.G + R11: resistor(down_ dimen_ from DP4.S) + {["svg_it(R`'svg_sub(11))" rjust; "20`'svg_ohm" rjust stbelow] \ + at last [].w roffset} + D5: diode(up_ from DP3.S to (DP3.S,A2),Z) + {["svg_it(D`'svg_sub(5))" rjust; "1N4729" rjust stbelow] \ + at last [].w roffset} + line to R11.end + C4: capacitor(right_ dimen_*1.3 from DP3.S,C) + llabel(,svg_it(C`'svg_sub(4))); rlabel(,"0.68`'svg_micro(F)") + C3: capacitor(right_ dimen_*1.3 from DP4.S,C) + llabel(,svg_it(C`'svg_sub(3))); rlabel(,"0.68`'svg_micro(F)") + dot + dot(at (Here,R6)) + C2: reversed(`capacitor',left_ dimen_*1.3,C) + rlabel(,svg_it(C`'svg_sub(2))); llabel(,"0.1`'svg_micro(F)") + line to R6.end + + R5: resistor(up_ from R6.end to (R6.end,Q13.B)) + {["svg_it(R`'svg_sub(5))" ljust; "100k`'svg_ohm" ljust stbelow] \ + at last [].e loffset } + dot(at R5.top-(0,dimen_/2)) + line left_ dimen_/2 + capacitor(down_ dimen_,C) + {["svg_it(C`'svg_sub(1))" rjust; "1`'svg_micro(F)" rjust stbelow] \ + at last [].w roffset} + ground(,T) + + line from DP4.E to (DP4.E,R2.bottom) + resistor(up_ to (Here,R2.top)) + {["svg_it(R`'svg_sub(9))" ljust; "910`'svg_ohm" ljust stbelow] \ + at last [].e loffset} + dot + resistor(down_ from DP3.E to (DP3.E,R3.bottom)) + {["svg_it(R`'svg_sub(10))" ljust; "910`'svg_ohm" ljust stbelow] \ + at last [].e loffset} + dot + + line from R5.top to (R5,Q13.E) + resistor(right_ elen_) + {["svg_it(R`'svg_sub(4))" ljust; "100k`'svg_ohm" ljust stbelow] \ + with .s at last [].nw+(0,1bp__)} + line to (C4.end,Here) then to C4.end + + DP5: npair(L,11,10) with .E at (C4.end,DP1.E)+(elen_*0.8,0) + line from DP5.E to (DP5.E,R3.bottom); dot + line from R3.bottom to Here+(dimen_/2,0) + dot(,,1) + "svg_it(-E`'svg_sub(CC))" ljust at last [].e + D6: diode(up_ from DP5.S to (DP5.S,A2),Z) + {["svg_it(D`'svg_sub(6))" rjust; "1N4728" rjust stbelow] \ + at last [].w roffset} + DP6: ppair(L,12,9) with .E at (DP5.E,DP2.E) + line from DP6.E to (DP6.E,R2.top); dot + line from R2.top to Here+(dimen_/2,0) + dot(,,1) + { "svg_it(E`'svg_sub(CC))" ljust at last [].e } + resistor(down_ from DP6.S to (DP6.S,C2)) + {["svg_it(R`'svg_sub(12))" rjust; "20`'svg_ohm" rjust stbelow] \ + at last [].w roffset} + dot + { line to C2.e } + line to D6.end + + Vr: dot(at (DP6.G,V1.top)+(dimen_/4,0)) + line from DP6.G to (Vr,DP6.G) then to (Vr,DP5.G) then to DP5.G + reversed(`arrowline',right_ dimen_/2 from Vr); llabel(,i`'svg_sub(2)) + V2: gap(down_ dimen_,1); llabel(+,V`'svg_sub(2),-) + { move right 0.2} + line down_ dimen_/4 chop dotrad_ chop 0; ground(,T) + + dot(at (Vr,T)) + resistor(left_ to (DP6.E,Here)) + {["svg_it(R`'svg_sub(15))" ljust; "200`'svg_ohm" ljust stbelow] \ + with .s at last [].nw+(0,textoffset)} + line to (DP1.E,Here) + dot +#} + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DecoderSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DecoderSVG.m4 new file mode 100644 index 00000000000..2f9659ee42f --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DecoderSVG.m4 @@ -0,0 +1,25 @@ +.PS +# Decoder.m4 +log_init(svg_font(sans-serif,11bp__)) + + define(`nlines',3) # OK for nlines from 1 to approximately 4 + + define(`ndata',`eval(2**nlines-1)') + for_(0,nlines-1,1, + `{right_; A`'m4x: dot(at rsvec_(0,m4x*AND_ht)) + "svg_it(A`'svg_sub(m4x))" wid 0.2 at last [].w rjust}') + + for_(0,ndata,1, + `define(`m4y',m4x) down_ + G`'m4y: AND_gate(nlines) \ + at A0+svec_(AND_ht*3/2,(m4y+1/2)*AND_ht*3/2) + line down linewid/3; dot; "svg_it(D`'svg_sub(m4y))" at last [].s below + for_(0,nlines-1,1, + `ifelse(eval(m4y/2**m4x%2),0, + `up_; NOT_circle with .s at',`move to') G`'m4y.In`'eval(nlines-m4x) + line to (Here,A`'m4x) ifelse(m4y,ndata,`then to A`'m4x',`; dot') + ') + ') + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DemultiplexerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DemultiplexerSVG.m4 new file mode 100644 index 00000000000..37ff8e14311 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DemultiplexerSVG.m4 @@ -0,0 +1,37 @@ +.PS +# `DemultiplexerSVG.m4' +log_init(svg_font(sans-serif,11*0.8bp__)) + + right_ + + Demux(4,DM1) + "`Demux'(4,DM1)" at last [].s below + "svg_it(Out0)" at last [].Out0.end +(6bp__,6bp__) + "svg_it(Out3)" at last [].Out3.end +(6bp__,-6bp__) + "svg_it(In)" at last [].In.end rjust wid 11bp__ + "svg_it(Sel)" at last [].Sel.end ljust above + left_; Demux(4,,LOE) with .c at last [].c+(1.2,0) + "`left_; Demux'(4,,LOE)" at last [].s + (0,-20bp__) + "svg_it(Sel)" at last [].Sel.end rjust + "svg_it(Out0)" at last [].Out0.end +(-6bp__,6bp__) + "svg_it(OE)" at last [].OE.end ljust + "svg_it(In)" at last [].In.end+(0,5bp__) ljust + right_; Demux(4,,NOEBN2) with .c at last [].c+(1.2,0) + "(4,,NOEBN2)" at last [].s below + "svg_it(Sel0)" at last [].Sel0.end rjust + "svg_it(Sel1)" at last [].Sel1.end ljust + "svg_it(Out0)" at last [].Out0.end +(5bp__,6bp__) + "svg_it(Out3)" at last [].Out3.end +(5bp__,6bp__) + "svg_it(NOE)" at last [].NOE.end rjust + "svg_it(In)" at last [].In.end above + down_; Demux(8,,L3,,28*L_unit) with .c at last [].c+(1.8,0) + "`down_; Demux'(8,,L3,,28*L_unit)" at last [].s+(0,-15bp__) wid 170bp__ + "svg_it(Sel0)" at last [].Sel0.end rjust + "svg_it(Sel2)" at last [].Sel2.end rjust below + "svg_it(Out0)" at last [].Out0.end rjust + "svg_it(Out7)" at last [].Out7.end ljust + "svg_it(In)" at last [].In.end rjust + + command "</g>" # end font + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4 new file mode 100644 index 00000000000..eb1c6f5672f --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4 @@ -0,0 +1,50 @@ +.PS +# `Diodes.m4' +cct_init(svg_font(sans-serif,11bp__)) +movewid = 2pt__ +{ {diode ; move ; "`diode'" ljust} + move down 0.2; right_ + {diode(,S) ; move ; "`diode(,S)'" ljust} + move down 0.2; right_ + {diode(,V) ; move ; "`diode(,V)'" ljust} + move down 0.2; right_ + {diode(,v) ; move ; "`diode(,v)'" ljust} + move down 0.2; right_ + {diode(,w) ; move ; "`diode(,w)'" ljust} + move down 0.2; right_ + {diode(,B) ; move ; "`diode(,B)'" ljust} + move down 0.2; right_ + {diode(,G) ; move ; "`diode(,G)'" ljust} + } + + move right_ 2.0 +{ + {diode(,K) ; move ; "`diode(,K)'" ljust} + move down 0.2; right_ + {diode(,ZK) ; move ; "`diode(,ZK)'" ljust} + move down 0.2; right_ + {diode(,CR) ; move ; "`diode(,CR)'" ljust} + move down 0.2; right_ + {diode(,L) ; move ; "`diode(,L)'" ljust} + move down 0.2; right_ + {diode(,F) ; move ; "`diode(,F)'" ljust} + move down 0.2; right_ + {diode(,Sh) ; move ; "`diode(,Sh)'" ljust} + move down 0.2; right_ + {diode(,D) ; move ; "`diode(,D)'" ljust} + } + + move right_ 2.0 +{ {diode(,Z,RE) ; move ; "`diode(,Z,RE)'" ljust; move right 1.5} + move down 0.25; right_ + {diode(,T) ; move ; "`diode(,T)'" ljust} + move down 0.30; right_ + {diode(,P) ; move ; "`diode(,P)'" ljust} + move down 0.30; right_ + {diode(,LE) ; move ; "`diode(,LE)'" ljust} + move down 0.15; right_ + {diode(,LER) ; move ; "`diode(,LER)'" ljust} + } + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DriveSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DriveSVG.m4 new file mode 100644 index 00000000000..48a7165ff9f --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DriveSVG.m4 @@ -0,0 +1,74 @@ +.PS +# `Drive.m4' +cct_init + +define(`synchmachine',`[ r = ifelse(`$1',,`dimen_*3/4',(`$1')/2) + C: circle rad r + Point_(120) + line from C to C+vec_(r*2/9,0); reversed(`inductor',to rvec_(r*2/3,0)) + W2: Here + Point_(240) + line from C to C+vec_(r*2/9,0); reversed(`inductor',to rvec_(r*2/3,0)) + W3: Here + line from C right_ r*2/9; inductor(right_ r*2/3) + W1: Here ]') + + bht = sourcerad_*10 + dlen = dimen_*2/3 +define(`Diodepair',`[ diode(up_ dlen); line up bht-2*dlen; diode(up_ dlen) ]') + +define(`gbt',`bi_trans(`$1',`$2',CBUHdE`$3')') +define(`dotrad_',dotrad_*0.5/linewid) +define(`GBTpair',`[linewid = 0.5*3/4 + Q1: gbt(up_ bht/2,,D) + Q2: gbt(up_ bht/2,,D) with .C at Q1.E + ]') + +SW: ground + line up +W: Here + line right dimen_/3; dot + ssep = sourcerad_*2.5 + { line up ssep; S1: source(right_ dimen_,AC) } + { S2: source(right_ dimen_,AC) } + { line down ssep; S3: source(right_ dimen_,AC) } + + dsep = dimen_/2 +D1: Diodepair at S2.e +D2: Diodepair at D1+(dsep,0); dot(at D2.n); dot(at D2.s) +D3: Diodepair at D2+(dsep,0); dot(at D3.n); dot(at D3.s) + dot(at (D1,S1)) + dot(at (D2,S2)); line to S2.e + dot(at (D3,S3)); line to S3.e + + line from D1.n to D3.n + inductor(right_ dimen_) +T: dot + capacitor(to (Here,D1.s),C) + dot + + gsep = dimen_*1.25 +G1: GBTpair with .Q1.C at T+(dimen_,0) +G2: GBTpair at G1+(gsep,0) +G3: GBTpair at G2+(gsep,0) + + line from G3.Q1.C to T + dot(at (G1.Q1.C,T)) + dot(at (G2.Q1.C,T)) + line from G3.Q2.E to D1.s + dot(at (G1.Q1.E,D1.s)) + dot(at (G2.Q1.E,D1.s)) + +M: synchmachine with .C at G3.e+(dimen_*2,0) + sg = dimen_/8 +L: (0.5<G3.e,M.w>,D1.s)-(sg,0) + line from M.W1 to (M.W1,L) then to L \ + then up M.C.y-L.y-sg then to G3.Q2.C+(0,-sg); dot + line from M.W3 down M.W3.y-L.y-sg*2 then to L+(sg*2,sg*2)\ + then up M.C.y-L.y-sg*2 then to G2.Q2.C; dot + line from M.W2 to (L,M.W2) \ + then down M.W2.y-G1.Q2.C.y-sg then to G1.Q2.C+(0,sg); dot + + line right dimen_/3 from M.e then down M.e.y-SW.y + ground +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EmarrowsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EmarrowsSVG.m4 new file mode 100644 index 00000000000..33372ae290f --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EmarrowsSVG.m4 @@ -0,0 +1,31 @@ +.PS +# `Emarrows.m4' +cct_init(svg_font(sans-serif,11bp__)) + hskip = 0.6 +[ + { em_arrows(N) + box dotted wid last [].wid ht last [].ht at last [].c + thinlines_ + arrow <- up 0.12 from last [].Head;`"Head"' above + arrow <- down 0.12 from last [].Tail;`"Tail"' below + `"A1"' rjust below at last [].A1.c + `"A2"' ljust above at last [].A2.c + thicklines_ + move down 0.25 from last [].s + move up 0.2 from last [].n + `"em_arrows(N)"' wid 1.0 at last [].s+(0,-0.20) below } + { em_arrows(ND,45) with .sw at last [].se+(hskip*1.5,0) + `"em_arrows(ND,45)"' at last [].s below } + { em_arrows(I) with .sw at last [].se+(hskip,0) + `"...(I)"' at last [].s+(0,-9bp__) below } + { em_arrows(ID) with .sw at last [].se+(hskip,0) + `"...(ID)"' at last [].s+(0,-2bp__) below } + { em_arrows(E) with .sw at last [].se+(hskip,0) + `"...(E)"' at last [].s+(0,-2bp__) below } + { em_arrows(ED) with .sw at last [].se+(hskip,0) + `"...(ED)"' wid .75 at last [].s+(0,-2bp__) below } + ] +# box wid last [].wid ht last [].ht at last [] + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4 new file mode 100644 index 00000000000..d0ba1384930 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4 @@ -0,0 +1,254 @@ +divert(-1) + FlowchartDefs.m4 + `Some experimental flow-chart macros. + In the following, every subchart is in + [] brackets, with .N, .S, .E and .W + internally defined. Follow this convention + if you create compound constructs. + + Generally, the first argument is one + or more strings; the second adjusts + the size, and the third can be used + to add color, dashed lines, labels, + or other embellishements. Default is + grey fill if arg3 is blank. + + These macros have been renamed from earlier + versions because of slight differences of + arguments.' + +define(`FlowchartDefs_') + + `Default sizes:' +define(`fboxwid',linewid*2) +define(`fboxht',linewid*0.75) +define(`farrowht',linewid*0.5) + + `Fbox( "text", wid expr ht expr, + attributes ) The basic task box: arg1 may + be 1 or more label strings. Attributes + include box line and fill specs. + To adjust the box size to the size of + the typeset text, see the \boxdims macro + in the manual. Example: + Fbox("svg_it(x svg_symbol(&`#'60;) 1)",, + shaded rgbstring(0.46,0.53,0.63))' +define(`Fbox',`[ boxwid = fboxwid; boxht = fboxht + Box: box `$2' ifelse(`$3',,`fill_(fillval)',`$3') `$1' + N: Box.n; S:Box.s; E:Box.e; W: Box.w + `$4']') + + `If-then + Ftest( "text", wid expr ht expr, attributes )' +define(`Ftest',`[boxwid = fboxwid*0.8; boxht = fboxht*1.4 + Box: box ifelse(`$2',,,`$2') invis + N: Box.n; S: Box.s; E: Box.e; W: Box.w + line from 0.5 between last box.n and last box.e \ + to last box.e then to last box.s then to last box.w then to last box.n \ + then to 0.5 between last box.n and last box.e \ + ifelse(`$3',,`fill_(fillval)',`$3') + ifelse(`$1',,,`$1' at Box) + `$4']') + + `case statement + Fcase(wid expr ht expr, + "Test string 1",task, ..., + "Test string n",task)' + `arg1 adjusts the size of the tests + A task is a flow subchart with internal names .E and .S defined + The test blocks are labeled Test1, Test2, ... and the tasks are + labeled Task1, Task2, ... ' +define(`Fcase',`[ down; S: Here; sx = S.x + Fcaseloop_(1,$@) + ifelse(`$2',,`E:S; W:S; N:S', + `E:(sx+linewid/2,Task1.E.y); W:Test1.W; N:Test1.N') + Fcasearrow_(1,$@) + arrow from E to (E,S) then to S ]') + + define(`Fcaseloop_',`ifelse(`$3',,, + `Test`$1': Ftest(`$3',`$2') with .N at S + Task`$1': `$4' with .nw at Test`$1'.E+(linewid/2,min(Test`$1'.ht,fboxht)/2) + arrow right linewid/4 from Test`$1'.E \ + then down Test`$1'.E.y-Task`$1'.W.y then to Task`$1'.W + S: (Test`$1'.S.x,min(Test`$1'.S.y,Task`$1'.S.y)-linewid/3) + ifelse(`$5',,`line',`arrow') from Test`$1'.S to S + sx = max(sx,Task`$1'.E.x) + Fcaseloop_(incr($1),`$2',shift(shift(shift(shift($@)))))')') + define(`Fcasearrow_',`ifelse(`$3',,, + `arrow from Task`$1'.E to (E,Task`$1'.E) + Fcasearrow_(incr($1),`$2',shift(shift(shift(shift($@)))))')') + + `while statement with explicit test + Fwhiledo("test text", wid x ht y, attributes, task spec ) + The task structure is given label Task ' +define(`Fwhiledo',`[ down + Test: Ftest(`$1',`$2',`$3') + arrow right linewid/2 from Test.E + Task: `$4' with .W at Here + E: Task.E; W: Test.w; S: Test.S + arrow up max(linewid/4,Test.n.y-Task.n.y+arrowht*1.5) \ + from Task.N then left Task.x-Test.x + N: Here + arrow to Test.n + `$5']') + + `repeat statement with explicit test + Frepeatuntil("test",wid x ht y,attributes, task spec ) + The task structure is given label Task ' +define(`Frepeatuntil',`[ N: Here + Task: ifelse(`$4',,Here,`$4' with .N at N) + W: Task.W + arrow down linewid/3 + Test: Ftest(`$1',`$2',`$3') + E: Task.E+(linewid/2+max(0,Test.e.x-Task.e.x),0) + arrow from Test.e to (E,Test) then to E then to Task.E + S: Test.S + `$5']') + + `if-then-else + Fifthenelse( "test", wid x ht y, attributes, + left tasks, right tasks) + The left task structure is given label Ltask and the right + task structure is given label Rtask ' +define(`Fifthenelse',`[ Test: Ftest(`$1',`$2',`$3') + N: Test.N + Ltask: ifelse(`$4',,`Test.S; W:Test.W; LS:Ltask', + `$4 with .ne at ((Test.W.x+Test.x)/2,Test.S.y) + W: Ltask.W; LS:Ltask.S + arrow from Test.W to (Ltask.N,Test.W) then to Ltask.N') + Rtask: ifelse(`$5',,`Test.S; E:Test.E; RS:Rtask', + `$5 with .nw at ((Test.E.x+Test.x)/2,Test.S.y) + E: Rtask.E; RS: Rtask.S + arrow from Test.E to (Rtask.N,Test.E) then to Rtask.N') + S: (Test.x,min(LS.y,RS.y)-linewid/3) + arrow from LS to (LS,S) + arrow from RS to (RS,S) + line to (LS,Here) + `$6']') + +divert(0)dnl +.PS +# Here is a test file exercising the above definitions +gen_init(svg_font(sans-serif,11bp__,2.5bp__)) + +# Could use xcolor with option dvipsnames but define color here for portability +define(`Thistle',`rgbstring(0.85,0.75,0.85)')dnl +define(`RubineRed',`rgbstring(0.81,0,0.35)')dnl +define(`YellowGreen',`rgbstring(0.68,1,0.18)')dnl +define(`SeaGreen',`rgbstring(0.13,0.70,0.67)')dnl +define(`Goldenrod',`rgbstring(0.85,0.65,0.13)')dnl + +# Accented characters +define(`svg_ccedilla',`svg_symbol(&`#'231;)')dnl +define(`svg_atilde',`svg_symbol(&`#'227;)')dnl + + linethick_(1.0) + arrowwid = 0.05 + arrowht = 0.1 + fillval = 0.8 + down + +Case: Fcase(, + "Test 1",[Fbox("Task 1",, shaded Thistle); W:last [].W; N:last [].N + arrow down linewid/3 from last [].S + Fbox("Task 1.5",, shaded Thistle) with .N at Here + E:last [].E; S:last [].S], + "Test 2",Fbox("Task 2" "is bigger", wid fboxwid*1.2 ht fboxht*3/2, \ + shaded SeaGreen), + "Test 3",Fbox("Task 3",, shaded RubineRed)dnl + ) + + "svg_it(.N)" at Case.N rjust above + "svg_it(.S)" at Case.S rjust below + "svg_it(.E)" at Case.E ljust + "svg_it(.W)" at Case.W rjust + "svg_it(Case statement)" below at Case.s+(0,-0.2) + move to Case.nw+(-12bp__,10bp__) + +Whiledo: Fwhiledo("svg_it(i svg_lt n)",,,Fbox("Task"), + "T" above ljust at Test.E) \ + with .nw at Case.ne+(0.25,0) + + "svg_it(.N)" at Whiledo.N rjust + "svg_it(.S)" at Whiledo.S rjust below + "svg_it(.E)" at Whiledo.E ljust + "svg_it(.W)" at Whiledo.W rjust + "svg_it(While-do)" below at Whiledo.s+(0,-0.2) + +Repeatuntil: Frepeatuntil("svg_it(n svg_geq 5)",,,Fbox("Task"), + "T" at Test.E above ljust) with .nw at Whiledo.sw + (0.25,-1) + + "svg_it(.N)" at Repeatuntil.N rjust above + "svg_it(.S)" at Repeatuntil.S rjust below + "svg_it(.E)" at Repeatuntil.E ljust + "svg_it(.W)" at Repeatuntil.W rjust + "svg_it(Repeat-until)" below at Repeatuntil.s+(0,-0.2) + +Ifthenelse: Fifthenelse("svg_it(A`'svg_lt`'B)",,, + Fbox("False"), + Fbox("True",ht fboxht*1.2 wid fboxwid)dnl + ) with .nw at Repeatuntil.sw +(0.5,-0.5) + + "svg_it(.N)" at Ifthenelse.N rjust above; + "svg_it(.S)" at Ifthenelse.S below rjust + "svg_it(.E)" at Ifthenelse.E ljust + "svg_it(.W)" at Ifthenelse.W rjust + "svg_it(If-then-else)" at Ifthenelse.s+(0,-0.3) \ + "svg_it((the True and False tasks are optional))" + +# Compound statement: +[ right + ellipse shaded YellowGreen "Start" + arrow right linewid/2 + + Fbox("First task") with .W at Here + arrow down linewid/2 from last [].S + + Fifthenelse("Test 1",,, + Frepeatuntil("svg_it(i svg_geq 5)",,shaded Goldenrod,Fbox("Task")), + Fifthenelse("svg_it(A svg_lt B)",,shaded Goldenrod, + Fbox("Left"), + Fbox("Right"), + "T" at Test.E above ljust), + "T" at Test.E above ljust) with .N at Here + + A: arrow down 0.25 from last [].S ] with .nw at Case.sw + (-12bp__,-0.7) + + "svg_it(Compound statement)" below at last [].A.end + +Example: [ fillvalue = 0.8; awid = linewid/2; right_ + Start: ellipse wid boxwid/2 ht boxwid/3 shaded "green" + arrow right_ awid + B1: Fbox("Planejamento") + B2: Fbox("Execu`'svg_ccedilla`'svg_atilde`'o") \ + with .W at B1.E+(awid*3,0) + B3: Fbox("Sele`'svg_ccedilla`'svg_atilde`'o") \ + with .W at B2.E+(awid*3,0) + LT: Ftest("Avalia`'svg_ccedilla`'svg_atilde`'o do" "Planejamento", + wid fboxwid*1.5 ht fboxht*2.0, + shaded YellowGreen, + "Correto" at Box.e above ljust; + "Incompleto" at Box.w above rjust) with .S at 0.5 between B1.ne and B2.nw + arrow from B1.E to (LT.S,B1.E) then to LT.S + arrow from LT.W to (B1.N,LT.W) then to B1.N + arrow from LT.E to (B2.N,LT.E) then to B2.N + RT: Ftest("Avalia`'svg_ccedilla`'svg_atilde`'o da" \ + "Execu`'svg_ccedilla`'svg_atilde`'o", + wid fboxwid*1.5 ht fboxht*2.0, + shaded YellowGreen, + "Correto" at Box.e below ljust; + "Incompleto" at Box.w below rjust) with .N at 0.5 between B2.se and B3.sw + arrow from B2.E to (RT.N,B2.E) then to RT.N + arrow from RT.W to (B2.S,RT.W) then to B2.S + arrow from RT.E to (B3.S,RT.E) then to B3.S + B4: Fbox("Extra`'svg_ccedilla`'svg_atilde`'o") \ + with .S at B3.N+(0,awid) + arrow from B3.N to B4.S + arrow right_ awid from B4.E + B5: Fbox("Conclus`'svg_atilde`'o") + ellipse wid boxwid/2 ht boxwid/3 shaded "red" at (B5.S,Start) + arrow down_ awid from B5.S to last ellipse.n +] with .nw at last [].sw+(0,-fboxht) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FontsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FontsSVG.m4 new file mode 100644 index 00000000000..856014836b9 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FontsSVG.m4 @@ -0,0 +1,28 @@ +.PS +# FontsSVG.m4 +gen_init + textht = 0.2 + +define(`ft',`{ svg_font(`$1',`$2',`$3',"`$1'")}; move down 0.5; right_') + +B: box wid 4 ht 7 + move to B.nw+(2,-0.5) + + ft(Arial) + ft(Helvetica) + ft(Times) + ft(Courier) + ft(Cursive) + ft(Verdana) + ft(Georgia) + ft(Palatino) + ft(Garamond) + ft(Bookman) +# ft(Comic Sans MS) + ft(Trebuchet MS) + ft(Arial Black) + ft(Impact) + + textht = 0.1 + "These may be vewer-dependent" above ljust at B.sw +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FusesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FusesSVG.m4 new file mode 100644 index 00000000000..a4617e62212 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FusesSVG.m4 @@ -0,0 +1,33 @@ +.PS +# `FusesSVG.m4' +cct_init(svg_font(sans-serif,11bp__)) + +movewid = 0.25 + + {fuse ; {"`fuse'" at last line.c+(0,-0.2)} + move + fuse(,D) ; {"`fuse(,D)'" at last line.c+(0,-0.2)} + move + fuse(,B) ; {"`fuse(,B)'" at last line.c+(0,-0.2)} + move + fuse(,C) ; {"`fuse(,C)'" at last line.c+(0,-0.2)} + move + fuse(,S) ; {"`fuse(,S)'" at last line.c+(0,-0.2)} + move + fuse(,HB) ; {"`fuse(,HB)'" at last line.c+(0,-0.2)} + } + move down; right_ + fuse(,HC,0.5,0.3) ; {"`(,HC,0.5,0.3)'" ljust at last line.start+(0,-0.25)} + move + cbreaker; {"`cbreaker'" at last line.c+(0,-0.25)} + move + cbreaker(,R); {"`cbreaker(,R)'" at last line.c+(0,-0.25)} + move + cbreaker(,,D); {"`...(,,D)'" at last line.c+(0,-0.25)} + move + cbreaker(,,T); {"`...(,,T)'" at last line.c+(0,-0.25)} + move + cbreaker(,,TS); {"`...(,,TS)'" at last line.c+(0,-0.25)} + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GroundsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GroundsSVG.m4 new file mode 100644 index 00000000000..7c4d741d0ee --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GroundsSVG.m4 @@ -0,0 +1,40 @@ +.PS +# `GroundsSVG.m4' +cct_init(svg_font(sans-serif,11bp__)) + +sep = 0.65 +Ground: ground + move right sep +GT: ground(,T) + move right sep +GF: ground(,,F) + move right sep +GE: ground(,,E) + move right sep + +B: Here+(0,-0.5) ; { + "`ground'" wid 36bp__ at (Ground,B) + "`ground'(,T)" at (GT,B)+(0,12bp__) + "(,,F)" at (GF,B) + "(,,E)" at (GE,B)} + + +GS: ground(,,S) + move right sep +GS90: [ground(,,S,90) ] with .n at Here + move right sep from GS90.n +GQ: ground(,,Q) + move right sep +GL: ground(,,L) + move right sep +GP: ground(,,P) + +C: Here+(0,-0.5) + "(,,S)" at (GS,C) + "(,,S,90)" at (GS90,C) + "(,,Q)" at (GQ,C) + "(,,L)" at (GL,C) + "(,,P)" at (GP,C) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeadersSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeadersSVG.m4 new file mode 100644 index 00000000000..c222f186500 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeadersSVG.m4 @@ -0,0 +1,38 @@ +.PS +# HeadersSVG.m4 +log_init(svg_font(sans-serif,10bp__)) + + Header + {"svg_it(P1)" wid 15bp__ at last [].P1 rjust + `"Header"' wid 45bp__ at last [].s+(0,-10pt__) + "svg_it(P2)" at last [].P2 rjust} + + Header(2,3,8mm__,10mm__) with .nw at last [].ne+(0.75,-0.05) + {"svg_it(P1)" at last [].P1 rjust + "`Header(2,3,8mm__,10mm__)'" at last [].s+(0,-10pt__) + "svg_it(P2)" at last [].P2 ljust + "svg_it(P5)" at last [].P5 rjust + "svg_it(P6)" at last [].P6 ljust} + + left_ + Header(2,4,,,fill_(0.9)) with .sw at last [].se+(0.75,0) + {"svg_it(P1)" at last [].P1 rjust_ + "`left_; Header(2,4,,,fill_(0.9))'" at last [].s+(0,-23pt__) + "svg_it(P8)" at last [].P8 ljust_} + + down_ + Header(2,8) with .nw at last [].ne+(0.75,0) + {"svg_it(P1)" at last [].P1 ljust + "svg_it(P2)" at last [].P2 ljust + "`down_; Header'(2,8)" at last [].s+(0,-10pt__) + "svg_it(P15)" at last [].P15 rjust + "svg_it(P16)" at last [].P16 rjust} + {thinlines_ + arrow <- right 0.15 from last [].PinP1.e ; {move right 0.45} + "svg_it(PinP1)" ljust + arrow <- right 0.15 from last [].PinP2.e + "svg_it(PinP2)" ljust + thicklines_ } + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeathkitSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeathkitSVG.m4 new file mode 100644 index 00000000000..fc7ffd21588 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeathkitSVG.m4 @@ -0,0 +1,343 @@ +.PS +cct_init(svg_font(Helvetica,7pt__)) +# HeathkitSVG.m4 +# Landscape +maxpswid = 11 +maxpsht = 8.5 + +# llabel and rlabel without math mode +define(`Llabel',`llabel( + ifelse(`$1',,,`m4lstring(`$1',"`$1'")'), + ifelse(`$2',,,`m4lstring(`$2',"`$2'")'), + ifelse(`$3',,,`m4lstring(`$3',"`$3'")'))') +define(`Rlabel',`rlabel( + ifelse(`$1',,,`m4lstring(`$1',"`$1'")'), + ifelse(`$2',,,`m4lstring(`$2',"`$2'")'), + ifelse(`$3',,,`m4lstring(`$3',"`$3'")'))') + +# Grid parameters + picwid = 8.5 + picht = 6 + g = 1/12 + +# Element scaling + linewid = 8*g +define(`dimen_',dimen_*4/5) +# Default sizes + boxwid = 2*g + boxht = 2*g + arrowht = arrowht*2/3 + +# Grid + linethick_(0.4) + for i=0 to picwid/g do { line color "lightgray" up picht from (i*g,0) } + for i=0 to picwid/g by 10 do { sprintf("%g",i) at (i*g,0) below } + for i=0 to picht/g do { line color "lightgray" right picwid from (0,i*g) } + for i=0 to picht/g by 10 do { sprintf("%g",i) at (0, i*g) rjust } + move left 2*g from (0,0) + linethick_(0.8) + + spline outlined "white" shaded "white" \ + from (0,picht+g) down g then down picht/5 then right picwid/5 + for i=1 to 4 do { continue down picht/5 then right picwid/5 } + continue right 2*g then up 2*g + continue up picht-2*g then up g then left g + +# Place the bottom inductor on the grid + I1: inductor(down_ 13*g from (80,22)*g,,13,,g) + I2: inductor(down_ 10*g from I1.start+(0,21*g),,10,,g) + I3: inductor(down_ 10*g from I2.start+(0,12)*g,,10,M,g) + line from M4Core1.end to (M4Core1,I1.end) + line from M4Core2.end to (M4Core2,I1.end) + Scrn: 2 between M4Core1.start and M4Core2.start + line dashed from Scrn to (Scrn,I1.end) + ground + I4: inductor(up_ 5*g from (Scrn.x+M4Core1.x-I2.x,I2.start.y-2*g),,5,,g) + I5: inductor(up_ 5*g from (I4,I2.end+(0,g)),,5,,g) + +# Circuit board + Board: box dashed thick 2 wid 58*g ht 55*g with .se at I1.end+(-7,-2)*g + P: box invis wid 12*g ht 4*g with .s at Board.sw+(26*g,0) \ + "POWER SUPPLY" "CIRCUIT BOARD" + line dashed thick 2 from P.sw to P.nw; line dashed thick 2 to P.ne + line dashed thick 2 to P.se + +define Pad { P`$1': box fill_(1) "$1" } +# Board connections on the right + Pad(1) at (Board.e,I1.end) + line from P1.e to I1.end "RED" above + Pad(2) at (Board.e,I1.start) + line from P2.e to I1.start "RED" above + Pad(3) at (Board.e,I2.end) + GRN1: line left 4*g from I2.start "GRN" above ; ground + GRN2: line from P3.e to I2.end "GRN" above + spline <-> from GRN2.end+(-g,0) up 2.5*g right 0.5*g then up 5*g left g \ + then up 2.5*g right 0.5*g + box invis fill_(1) wid 3*g ht g "6 VAC" at I2-(2*g,0) + Pad(4) at P3-(0,3)*g + line right_ 3*g from P4.e "BRN" above + arrow down_ 2*g ht arrowht*2/3 + "TO DIAL" "LAMPS" at Here+(0,-g) + Pad(5) at (Board.e,I3.end) + line from P5.e to I3.end "BLU" above + Pad(7) at (Board.e,I3.start) + line from P7.e to I3.start "BLU" above + Pad(6) at 0.5 between P5 and P7 + line from P6.e to I3 "BLU-YEL" above + +# Power wiring, plug, switch +define(`socket',`[ + Outer: box wid dimen_*2/3 ht dimen_/2*3/4 + L: box wid dimen_/16 ht dimen_/4 at Outer-(dimen_/6,0) + R: box wid dimen_/16 ht dimen_/4 at Outer+(dimen_/6,0) + line from Outer.w to L.w + line from Outer.e to R.e + ] ') + + BLK: line from I4.end to (int(I4.end.x/g+8)*g,I4.end.y) "BLK" below ; dot + b = lin_leng(BLK) + BLKYEL: line from I4.start right_ b "BLK-YEL" above ; dot + BLKGRN: line from I5.end right_ b "BLK-GRN" below ; dot + BLKRED: line from I5.start right_ b "BLK-RED" above ; dot + line right_ g; PL: dot + line from BLKYEL.end right g then to Here+(0,-g) + fuse(down_ 3*g,D) + {"3 A FUSE" "SLOW BLOW" at last line+(-5*g,0) } + line to (Here.x,int(Here.y/g)*g-g); dot + Sckt1: socket at Here+(5,0)*g + line from Sckt1.w to (PL,Sckt1); A: dot; "A" rjust + line from Sckt1.e right_ lin_leng(last line); B: dot; "B" ljust + Sckt2: socket at (Sckt1,P1+(0,6)*g) + line from Sckt2.w to (A,Sckt2); dot + line from Sckt2.e to (B,Sckt2); dot + Sckt3: socket at (Sckt1,P1+(0,2)*g) + line from Sckt3.w to (A,Sckt3); dot + line from Sckt3.e to (B,Sckt3); dot + +define(`plug',`[ w = dimen_*2/3; q = 0.25*w + F: line right_ w + arc cw from F.start to F.end with .c at F + T1: F+(-q,w/2+g/2) + T2: F+( q,w/2+g/2) + line from T1 to (T1,F)-(0,2*g) + line from T2 to (T2,F)-(0,2*g) ]') + + PP: plug with .F at Sckt3+(0,-8)*g + {"120 VAC" ljust "50/60 Hz" ljust at PP.e } + +define(`pwrswitch',`[ right; circlerad = 1.75*g/2 + C1: circle "1" + C4: circle "4" + C2: circle "2" with .n at C1.s+(0,-C1.diam/2) + C5: circle "5" + C3: circle "3" with .n at C2.s+(0,-C1.diam/2) + C6: circle "6" + hatchbox(wid g ht C2.n.y-C3.s.y,0.05) with .w at 0.5 between C5.e and C6.e + ]') + + Psw: pwrswitch with .C4.e at Sckt1+(0,-4*g) + "POWER" at Psw.w+(-2*g,0) rjust + arrow up Psw.ht/2 at Psw.e+(1.5*g,0) + "ON" above; "OFF" at last arrow.start below + line from Psw.C1.w to (A,Psw.C1) then to A + line from Psw.C2.w to (A,Psw.C2); continue to (Here,PP.T1) then to PP.T1 + line from PP.T2 to (B,PP.T2) then to (B,I4.end) then to I4.end + line from BLKGRN.end to (B,BLKGRN); dot + +# Bottom connections + Pad(25) at Board.se+(-3,0)*g + R516: resistor(down_ 6*g from P25.s) + {"R516" "22" at last line+(-2*g,0)} ; ground(,T) + dot(at P25.s+(0,-g)); line right_ 5*g + reversed(`source',down_ 4*g,B) + {"#49" ljust "HI" ljust "TEMP" ljust at last line+(2*g,0) } + line to (P25,Here); dot + t = linethick; linethick_(0.4) + arrow <- from P25.s+(0,-g/2) right_ 2*g up_ g/4; "BRN" ljust; linethick_(t) + + Pad(24) at P25+(-4,0)*g + line from P24.s to (P24,R516.end); ground(,T) + Pad(23) at Board.sw+(12*g,0) + line from P23.s to (P23,R516.end); ground(,T) + + Pad(22) at Board.sw+(0,3)*g + R514: resistor(right_ 8*g from P22.e); Llabel(,R514); Rlabel(,680 K) + dot; { ground } + line to (P23,Here) then to P23.n + +# Diode bridge + BE: dot(at (P24,I1)) + d1h = lin_leng(I1)/2 + diode(left_ d1h up_ d1h); Rlabel(,,D508) + BN: dot + diode(left_ d1h down_ d1h); Rlabel(D506) + BW: dot + diode(from BE left_ d1h down_ d1h); Llabel(,,D509) + BS: dot + diode(left_ d1h up_ d1h); Llabel(D507) + capacitor(down_ from BN to BS,C); Llabel(C507,,.22) + line from BE to P24.n + line from BN to P2.w + line from BS to P1.w + spline <-> from (BE.x+2*g,BS.y) \ + up d1h/2 right g/2 then up d1h left g then up d1h/2 right g/2 + box invis fill_(1) ht 2*g wid 2*g "57" "VAC" at last spline + +# Left board connections + Pad(21) at (Board.w,BW); line from P21.e to BW + Pad(19) at P21+(0,-3*g) + Pad(20) at P21+(0, 3*g) + +# Transistor with circles +define(`hbi_tr',`[ linewid = linewid*4/4.16 + Q: bi_tr(`$1',`$2',`$3',E) + E: circle rad m4_xyU at 5/4 between Q.A1 and Q.E "E" + B: circle rad m4_xyU at 5/4 between Q.A1 and Q.B "B" + C: circle rad m4_xyU at 5/4 between Q.A1 and Q.C "C" + ]') + +# Interior circuits + line from P6.w left 2*g; ground + line from P5.w left 4*g; dot + { C504: capacitor(down_ 4*g,C); Llabel(C504,,.22); ground(,T) } + D504: diode(left_ 5*g); Rlabel(,D504); dot + { C505: capacitor(down_ to (Here,C504.end),C+L) + Rlabel(C505,100,75 V); ground(,T) } + line right_ to (Here,P7); dot + { D503: reversed(`diode',to (D504.start,Here)); Llabel(,D503); line to P7.w } + d3 = lin_leng(I3) + spline <-> from C504.start+(g/2,0) \ + up d3/4 right g/4 then up d3*2/4 left g/2 then up d3/4 right g/4 + box invis fill_(1) ht g wid 4*g "100 VAC" at last spline+(-g,0) + + down_ + Q503: hbi_tr(,R,P) with .E at (C505,P3) + line from Q503.C.e to (P25,Q503.C) then to P25.n + line from Q503.B.s to (Q503.B.x,Q503.E.y-4*g) + R513: resistor(down_ 5*g) + {"R513" ljust "1500" ljust at last [].e}; ground(,T) + line from P19.e to (BW-(2*g,0),P19) then up Q503.E.y-P19.y+2*g + R511: resistor(right_ 5*g); Llabel(,R511); Rlabel(,470); + line to (Q503.E,Here) then to Q503.E.n + line from P20.e to (BW,P20) then up R513.end.y-P20.y + resistor(up_ lin_leng(R513)) + {"R512" ljust "5600" ljust "1 W" ljust at last [].e} + line to (Here,Q503.B) then to Q503.B.w + "Q503" "S2091 HI TEMP" "CONTROL" at Q503.E+(1.5,4)*g + D505: reversed(`diode',right_ from Q503.E.e to (C504,Q503.E)); Llabel(,D505) + line to P3.w + + line from P4.w left_ 2*g then up P3.y-P4.y; dot + line from D503.end to (R513,D503); dot + { Pad(8) at (Here,Board.n) } + { line to P8.s } + R505: resistor(down_ to (Here,P6)); Llabel(,"R505" ljust "12 K"); dot + { C503: capacitor(down_ to (Here,C505.end),C+L) + Rlabel(C503,100,70 V); ground(,T) } + right_ + Q502: hbi_tr(,R) with .B at (R511.start,Here) + line from Q502.C.e to R505.start + line from Q502.B.e to R505.end + R504: resistor(down_ from Q502.B.s to (Q502.B,C505.end)) + {"R504" ljust "51 K" ljust at last [].e}; ground(,T) + "Q502" "TA7311" "REGULATOR" "CONTROL" at Q502.C+(-1,3)*g + + Pad(9) at (Q502.E,Board.n) + line from Q502.E.n to P9.s + Pad(10) at (Q502.B-(9,0)*g,Board.n) + R502: resistor(left_ from Q502.E.w to (P10,Q502.E)) + Rlabel(,R502); Llabel(,150); dot + + Pad(11) at (Board.w,Q502.E) + Pad(14) at P11+(0,2.5)*g + Pad(12) at P11+(0,-2.5)*g + Pad(13) at P12+(0,-2.5)*g + line right 2*g from P13.e then up P11.y-P13.y; dot + line from P12.e to (Here,P12); dot + Pad(15) at P13+(0,-3)*g + + right_ + Q501: hbi_tr(,R) with .B at P9.n+(0,2*g) + line from Q501.B.s to P9.n + line from Q501.C.e to (P8,Q501.C) then to P8.n + line from Q501.E.w to (P10,Q501.E) then to P10.n + "Q501" "2N3055" "REGULATOR" at Q501.n+(0,2)*g + line from P14.e to (P10,P14); dot + + Pad(17) at (Board.w,R511) + Pad(16) at P17+(0,3*g) + Pad(18) at P17+(0,-3*g) + line right 2*g from P18.e then up P17.y-P18.y; dot + + right_ + Q504: hbi_tr(,R) with .C at (P10,P17) + line from P17.e to Q504.E.w + line from Q504.B.s to (Q504.B,R513.start) + R508:resistor(down_ to (Here,R513.end)) + {"R508" ljust "680" ljust at last [].e}; ground(,T) + dot(at (P10,P15)) + { line to P10.s } + { resistor(down_ 5*g); {"225" ljust "10 W" ljust "5 %" ljust at last [].e} + line to Q504.C.n } + R503:resistor(left_ 10*g); Rlabel(,R503); Llabel(,290 10 W 5%); dot + line to (Here,Q504.B) + resistor(right_ to Q504.B.w); Llabel(,R507); Rlabel(,100) + line from P15.e to R503.end + "Q504" "40409" "REGULATOR" at Q504.C+(3.5,3)*g + resistor(left_ from R502.end to (R503.end,P11)) + Rlabel(,R501); Llabel(,390 5W 5%); line to P11.e + + resistor(right_ from P16.e to (R514.end,P16)); Llabel(,R506); Rlabel(,82) + line down P16.y-P17.y; dot + + dot(at (R514.end,P11)) + C501: capacitor(down_ 6*g,C+) + Llabel(C501); {"100" ljust "30 V" ljust at last [].s +(0,-g)} + ground(,T) + dot(at (Here.x+4*g,P11.y)) + ZD501: reversed(`diode',down_ lin_leng(C501),Z); Llabel(ZD501); ground(,T) + + dot(at (R514.end,P15)) + C502: capacitor(down_ 6*g,C+) + Llabel(C502); {"100" ljust "30 V" ljust at last [].s +(0,-g)} + ground(,T) + dot(at (Here.x+4*g,P15.y)) + ZD502: reversed(`diode',down_ lin_leng(C502),Z); Llabel(ZD502); ground(,T) + + line from (C502,P17) to (C502,R508.start+(0,g)) + C506: capacitor(down_ to (Here,R508.end),C+) + Llabel(C506); {"100" ljust "30 V" ljust at last [].s +(0,-g)} + ground(,T) + +# Left-side boxes + boxwid = 10*g + boxht = 5*g + line left 3*g from P22.w "GRY" above + line left 3*g from P19.w "VIOL" above + box with .e at (Here,0.5 between P19 and P22) "TO SIGNAL" "METER CIRCUIT" + + line left 8*g from P21.w "RED TO C508" above + line left 8*g from P20.w "VIOL" above + + line left 3*g from P17.w "RED" above + line left 3*g from P18.w; {"WHT-" ljust "RED" ljust at Here+(0,g) } + box with .e at (Here,0.5 between P17 and P18) "12.7 V SOURCE" "TO MULTIPLEX" + + line left 3*g from P16.w "WHT" above + box with .se at Here+(0,-g) "12 V SOURCE" "TO FM TUNER" "SOURCE SWITCH" + + line left 3*g from P15.w "ORG" above + box ht 3*g with .e at Here "15 V SOURCE" "TO FM TUNER" + + line left 3*g from P13.w "BLU" above + line left 3*g from P12.w; {"WHT-" ljust "RED" ljust at Here+(0,g) } + line left 3*g from P11.w "RED" above + box ht 6*g with .e at (Here,P12) "27 V SOURCE" "TO CONTROL" "PREAMP AND" \ + "PWR AMPLIFIER" + + line left 3*g from P14.w + {"WHT-" ljust "GRY-" ljust "GRN" ljust at Here+(0,1.5*g) } + box with .se at Here+(0,-g) "50 V SOURCE" "TO PHONO" "PREAMP" + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/I2LSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/I2LSVG.m4 new file mode 100644 index 00000000000..835ecaec535 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/I2LSVG.m4 @@ -0,0 +1,78 @@ +.PS +# I2L.m4 +log_init(svg_font(sans-serif,11bp__)) + +[ + down_ +T1: bi_trans(,R,BC2uEBU) + dy = T1.C0.y-T1.C1.y + dx = T1.C0.x-T1.Bulk.x + up_ +Q1: bi_trans(,,BC1dEBU) with .C1 at (T1.C2.x+dy+dx+dx,T1.C0.y-dy) +Q2: bi_trans(,,BC1dEBU) with .C1 at Q1.E+(0,-dy*2) +Q3: bi_tr(,,) with .B at Q2.C0+(2*dy,0) + down_ +T2: bi_trans(,R,BC1uEBU) with .C1 at (Q3.C.x+2*dx+2*dy,Q1.C0.y+dy) + up_ +X1: bi_tr(,,) with .B at (T2.C0.x+dy+dx,Q1.C0.y) +X2: bi_tr(,,) with .B at (X1.B,Q3.C) + + line down dx from Q2.E +G: dot + line from T1.B to (T1.B,G) then to (X1.E.x+dy,G.y) then to X1.E+(dy,0) \ + then to X1.E + line from X2.E right dy; dot + + line from Q1.E down dy then to (T1.B.x,Q1.E.y-dy); dot + line from T1.C0 to (Q3.B,T1.C0) then to Q3.B; dot; line to Q2.C0 + +A: dot(at (T1.B,Q1.B)-(dx,0)); { "svg_it(A)" wid 0.15 rjust } + line to Q1.B + line from T1.C2 to (T1.C2,Q1.B); dot + + line from Q2.B to (A,Q2.B); dot; { "svg_it(B)" rjust } + line right dy from T1.C1 then down T1.C1.y-Q2.B.y; dot + +VB: dot(at (T2.E.x+2*dx,T1.E.y+dy)); { "svg_it(V`'svg_sub(B))" ljust } + line to (T1.E,Here) then to T1.E + line from T2.E to (T2.E,VB); dot + + line from Q1.C1 to (Q3.C,Q1.C1) then to Q3.C; dot; line to X2.B + + line from Q1.C0 to X1.B + dot(at Q1.C0+(dy,0)); line to (Here,Q2.C1) then to Q2.C1 + + line from Q3.E to (Q3.E,G); dot; ground + + line from T2.B to (T2.B,G); dot + + line from T2.C1 to (T2.C1,X1.B); dot + "svg_it(~(A+B))" wid textht*1.5 below at Here+(0,-2pt__) + + line from T2.C0 to (X2.B,T2.C0) then to X2.B; dot + "svg_it(~(A+(~B)))" below at (T2.E,Here)+(0pt__,-2pt__) + +] + +[ +right_ + +jog = AND_ht/2*L_unit + + X1: NOR_gate + line right jog from X1.Out; "svg_it(~(A+B))" ljust + X2: NOR_gate at X1+svec_(0,-AND_ht*3/2) + line right jog from X2.Out; "svg_it(~(A+(~B)))" ljust + line left jog from X2.In2 + right_ + NOT: NOT_gate with .Out at Here + line left jog from NOT.In1 then up X1.In2.y-NOT.In1.y; dot + line from X1.In2 to Here chop 0 chop -jog + B: dot; "svg_it(B)" rjust + line from X1.In1 to (B,X1.In1); dot; "svg_it(A)" wid 0.15 rjust + line left jog from X2.In1 then up X1.In1.y-X2.In1.y; dot + +] with .e at last [].w-(1,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Incl.jpg b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Incl.jpg Binary files differnew file mode 100644 index 00000000000..80632b54e99 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Incl.jpg diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/InclepsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/InclepsSVG.m4 new file mode 100644 index 00000000000..501329f9d68 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/InclepsSVG.m4 @@ -0,0 +1,90 @@ +.PS +# InclepsSVG.m4 : Illustrating one way to import and overwrite jpg in svg +# A bit messy, but it works. This file has to be processed +# by m4 in the usual way and then twice by dpic, eg +# m4 svg.m4 SVGconfig.m4 InclepsSVG.m4 > InclepsSVG.pic +# dpic -v InclepsSVG.pic > InclepsSVG.svg +# dpic -v InclepsSVG.pic > InclepsSVG.svg + +# The double processing is needed because svg coordinates are to the right +# and down. We have to store the coordinates of the nw corner and use them +# on the second pass. + +divert(-1) +###################################################################### +# Macros to simplify inclusion and positioning of raster image files such +# as png or jpg or files with mime type of "image/svg+xml" + + `svg_init_include([Unique_name]) + Put this (once) before all drawing commands + in the diagram. It opens a [] block for the + total diagram and creates the file + Unique_name.dim (default SVGinsertTemp.dim).' +define(`svg_init_include', +`define(`M4IP_uniq',`ifelse(`$1',,SVGinsertTemp,`$1')')dnl + M4IP_NW: (0,0); m4IP_nw = 0; m4IP_lth = lthick + sh "touch M4IP_uniq.dim" + copy "M4IP_uniq.dim" + [ M4IP_NW: M4IP_NW; { move to M4IP_NW } ') + + `svg_include(filename, wid, ht, [position],[attrib]) + Insert bitmap at specified position; also create + an invis box of the same size and location. + arg1= path to image file + arg2= picture width in drawing units + arg3= picture height in drawing units + arg4= position attribute e.g. + Pic: svg_include(Incl.jpg,2,3, with .sw at (1,4)) + arg5= additional svg image attributes in the sprintf + string, e.g. + clip-path=\"polygon(5%% 0%%, 100%% 0%%, 100%% 100%%, 5%% 100%%)\" (distances + in percent to top-left, top-right, bottom-right, bottom-left clip corners, + or in pixels) ' +define(`svg_include',`box invis wid `$2' ht `$3' `$4' +define(`m4xpx',`(last box.w.x-M4IP_NW.x+m4IP_lth/2)/(1px__)')dnl +define(`m4ypx',`(M4IP_NW.y-last box.n.y+m4IP_lth/2)/(1px__)')dnl +define(`m4wdpx',`(`$2')/(1px__)')dnl +define(`m4htpx',`(`$3')/(1px__)')dnl +if m4IP_nw then { command sprintf(\ + "<image x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"dnl + xlink:href=\"`$1'\" `$5' />", m4xpx,m4ypx,m4wdpx,m4htpx) } ') + + `svg_end_include + Put this before .PE after all drawing commands. + It closes the [] block and writes to Unique_name.dim' +define(`svg_end_include',`] with .M4IP_NW at M4IP_NW + print sprintf("m4IP_nw=1; m4IP_lth=%g; M4IP_NW:(%g,%g)",lthick,\ + last [].w.x+3*m4IP_lth/2, last [].n.y+3*m4IP_lth/2) > "M4IP_uniq.dim" + undefine(`M4IP_uniq') ') + +###################################################################### +divert(0)dnl + +darrow_init +svg_init_include + + +# This jpg is 242 px x 321 px + Picture: svg_include(Incl.jpg, 242px__, 321px__, with .w at (1,0)) + + define(`backarrow',`darrow(`$1',,,2pt__,6pt__,6pt__,<-|)') + thinlines_ + backarrow( from boxcoord(Picture,0.4,0.95) up 0.4 right 0.7 ) + "Basket" wid 0.45 with .w at Here+(2bp__,0) + backarrow( from boxcoord(Picture,0.9,0.41) up 0.2 right 0.5 ) + "Ball" wid 0.3 with .w at Here+(2bp__,0) + backarrow( from boxcoord(Picture,0.85,0.32) up 0.2 right 0.5 ) + "Star" wid 0.3 with .w at Here+(2bp__,0) + "Player" wid 0.43 with .w at last "".w+(0,-0.15) + +#for i=3 to 1 by -1 do { +# Picture: svg_include(Incl.jpg, i/4*242px__, i/4*321px__, +# with .nw at last box.nw+(0.125,-0.25)) } + +# P2: svg_include(Incl.jpg, 242px__, 321px__, +# with .w at Picture.e+(1.25,0), +# clip-path=\"polygon(30 0, 100%% 0%%, 100%% 100%%, 30 321)\" ) + +svg_end_include + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/JackSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/JackSVG.m4 new file mode 100644 index 00000000000..ea14a04e597 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/JackSVG.m4 @@ -0,0 +1,75 @@ +.PS +# `Jack.m4' +cct_init(svg_font(sans-serif,11bp__)) + +P: [ + P1: plug + "A" wid 0.1 at P1.A rjust + "B" at P1.B rjust + "TB" at P1.TB ljust above + "TA" at P1.TA ljust below + P2: plug(,R) with .B at P1.A+(0.85,0) + "A" wid 0.1 at P2.A rjust + "B" at P2.B rjust + P3: plug(,3) with .A at P2.B+(0.85,0) + "A" at P3.A rjust + "B" at P3.B rjust + "C" at P3.C rjust + P4: plug(L,3R) with .A at P3.A+(1,0) + "A" wid 0.1 at P4.A ljust + "B" at P4.B ljust + "C" at P4.C ljust + `"plug"' below at P1.s+(0,-0.1) + `"plug(,R)"' below at P2.s+(0,-0.1) + `"plug(,3)"' below at P3.s+(-0.1,-0.1) + `"plug(L,3R)"' below at P4.s+(0.1,-0.1) +] + +L: [ + J1: jack + thinlines_ + "L" wid 0.1 rjust at J1.L + arrow <- right 0.1 from J1.F; "F" ljust + arrow <- down 0.1 from J1.G then left 0.1 ; "G" rjust + thicklines_ + J2: jack(,LMBS) with .F at J1.F+(1.2,0) + thinlines_ + "L" rjust at J2.L + arrow <- from J2.LM left 0.25; "LM" rjust + arrow <- from J2.LB left 0.25; "LB" rjust + "S" rjust at J2.S + thicklines_ + J3: jack(L,RLS) with .F at J2.F+(0.4,0) + thinlines_ + "L" ljust at J3.L + "S" ljust at J3.S + thicklines_ + J4: jack(L,RLBLMLMS) with .F at J3.F+(1,0) + thinlines_ + "L1" ljust at J4.L1 + arrow <- right 0.3 from J4.LM1; "LM1" ljust + "L2" ljust at J4.L2 +# arrow <- right 0.3 from J4.LM2; "LM2" ht 11pt__ ljust + arrow <- right 0.3 from J4.LM2; "LM2" ljust + "S" ljust at J4.S + "L" ljust at J4.L + arrow <- right 0.2 from J4.LB ; "LB" ljust + J5: jack(,RSBSMLB) with .F at J4.F+(1.95,0) + thinlines_ + "L" rjust at J5.L + "S" rjust at J5.S + "S1" rjust at J5.S1 + arrow <- left 0.3 from J5.SM1; "SM1" rjust + arrow <- left 0.25 then left 0.1 down 0.05 from J5.LB; "LB" rjust + arrow <- left 0.25 then left 0.1 up 0.05 from J5.SB; "SB" rjust + thicklines_ + + `"jack"' below at J1.s+(0,-0.15) + `"jack(,LMBS)"' at (J2,last "") + `"..(L,RLS)"' at (J3,last "") + `"..(L,RLBLMLMS)"' at (J4,last "") + `"..(,RSBSMLB)"' wid 72bp__ at (J5,last "") +] with .nw at P.sw + (0,0.1) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LgateSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LgateSVG.m4 new file mode 100644 index 00000000000..7a8cf06d221 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LgateSVG.m4 @@ -0,0 +1,153 @@ +divert(-1) +# LgateSVG.m4 +########################################################################### + +define(`And',`GenLogGate(AND,$@)') +define(`Nand',`GenLogGate(NAND,$@)') +define(`Or',`GenLogGate(OR,$@)') +define(`Nor',`GenLogGate(NOR,$@)') +define(`Xor',`GenLogGate(XOR,$@)') +define(`Nxor',`GenLogGate(NXOR,$@)') +define(`Not',`GenLogGate(NOT,$@)') + +define(`GenLogGate',`[ pushdef(`m4nargs',0)dnl + # Count the arguments and draw the gate + Loopover_(`a',`define(`m4nargs',incr(m4nargs))',shift($@))dnl + G: ifelse(`$1',NOT,`NOT_gate()',`$1_gate(m4nargs)') + Out: G.Out + T: (G.In1.x-2*L_unit,G.y) + # Sublayer gates with centre at the height of G + SubLayer: [ pushdef(`m4_nct',0) + pushdef(`m4glayer')dnl + Loopover_(`arg', + `define(`m4_nct',incr(m4_nct))dnl + # Stack the input label or draw a sublayer gate + pushdef(`m4InNames')dnl + Gate`'m4_nct: ifelse(patsubst(substr(arg,0,1),`[a-zA-Z]',`&'),&, + `[ In`'arg: ifdef(`MarkLogInputs',`"arg" above',Here) + pushdef(`m4InNames',In`'arg)dnl + Out: Here ] ht 2*L_unit', + `arg') ifelse(m4_nct,1,,`with .ne at last [].se+(0,-L_unit)') + ifdef(`MarkSubLayers', + `{ box wid last [].wid ht last [].ht at last [] }') + # Prepend gate name to labels + m4LogPromote(Gate`'m4_nct)', + shift($@)) dnl + # Promote gate labels to Sublayer block + pushdef(`m4InNames') m4LogLabel() + MidOut: 0.5 between Gate`'eval((m4_nct+1)/2).Out \ + and Gate`'eval((m4_nct+2)/2).Out + popdef(`m4_nct')dnl + ] with .MidOut at T+(-m4nargs*L_unit,0) # end SubLayer + ifdef(`MarkSubLayers', + `{ box wid last [].wid ht last [].ht at last [] }') + # Promote sublayer labels to outer block + pushdef(`m4glayer') m4LogPromote(SubLayer) dnl + pushdef(`m4InNames') m4LogLabel() dnl + # Draw the connecting lines + define(`m4hhv',`(m4nargs-1)/2')dnl + for_(1,m4nargs,1,` + line from G.In`'m4x \ + left G.In`'m4x.x-T.x+(m4hhv-abs(m4x-m4hhv-1))*L_unit \ + then up SubLayer.Gate`'m4x.Out.y-G.In`'m4x.y \ + then to SubLayer.Gate`'m4x.Out') + popdef(`m4nargs') dnl + ]') + +# Manage names of sublayer inputs +define(`m4LogPromote',`ifelse(m4InNames,,`popdef(`m4InNames')', + `pushdef(`m4glayer',m4InNames:$1) + popdef(`m4InNames') m4LogPromote($1)') ')dnl + +define(`m4LogLabel',`ifelse(m4glayer,,`popdef(`m4glayer')', + `define(`m4BaseIn',`substr(m4glayer,0,index(m4glayer,:))')dnl + m4glayer.m4BaseIn + pushdef(`m4InNames',m4BaseIn) popdef(`m4glayer') m4LogLabel()') ')dnl + +# Clear a name stack +define(`stack_del',`ifelse($1,`$1',,`popdef(`$1')$0($@)')') + +########################################################################### +divert(0)dnl +.PS +log_init(svg_font(sans-serif,11bp__)) +#define(`MarkLogInputs') + +define(`bbelow',`with .nw at last [].sw+(0,-0.2)') + + define(`MarkLogInputs') +Ex1:Or(x1,q,`Or(y1,z1)',`Or(z3,u,v,`Or(w,r)',x2,y2,z2,m)') + `"Or(x1,q,`Or(y1,z1)',`Or(z3,u,v,`Or(w,r)',x2,y2,z2,m)')"' \ + at Ex1.se+(-0.4,-0.2) + undefine(`MarkLogInputs') + + line from Ex1.Inx1 to (Ex1.w,Ex1.Inx1)-(L_unit,0) + line from Ex1.Inx2 to (Here,Ex1.Inx2) then to Here; dot + line to Here-(2*L_unit,0); Inx: "x" above + + line from Ex1.Iny1 to (Ex1.w,Ex1.Iny1)-(2*L_unit,0) + line from Ex1.Iny2 to (Here,Ex1.Iny2) then to Here; dot + line to Here-(2*L_unit,0); Iny: "y" above + + line from Ex1.Inz1 to (Ex1.w,Ex1.Inz1)-(3*L_unit,0) + {line from Ex1.Inz3 to (Ex1.Inz3,Ex1.Inz1); dot} + line from Ex1.Inz2 to (Here,Ex1.Inz2) then to Here; dot + line to Here-(2*L_unit,0); Inz: "z" above + +Ex2: And(`Not(A)',B,C,`Nor(A2,D)') with .nw at Ex1.Out+(0.75,0.2) + line right 3*L_unit from Ex2.Out + "svg_it(ABC(A+D))" above ljust at Ex2.G.nw + line right 0.1 at last ""+(0.1,0.16) + line right 0.35 at last ""+(0.55,0.16) + line from Ex2.InA2 to (Ex2.InA2,Ex2.InA); dot + line to Ex2.InA chop -3*L_unit chop 0 + "svg_it(A)" rjust at last line.start + "svg_it(B)" rjust at Ex2.InB + "svg_it(C)" rjust at Ex2.InC + "svg_it(D)" rjust at Ex2.InD + `"And(`Not(A)',B,C,`Nor(A2,D)')"' wid 2.1 with .w at Ex2.sw-(0,0.2) + `"line from Ex2.InA2 to (Ex2.InA2,Ex2.InA); dot"' wid 3.2 \ + with .w at last "".w+(0,-0.2) + `"line to Ex2.InA chop -3*L_unit chop 0"' wid 2.60 \ + with .w at last "".w+(0,-0.2) + `"\"A\" rjust at last line.start"' wid 1.6 with .w at last "".w+(0,-0.2) + `"\"B\" rjust at Ex2.InB; \"C\" rjust at Ex2.InC"' wid 2.7 with .w \ + at last "".w+(0,-0.2) + +Ex3: Or(`And(A1,C1)',`And(B1,`Not(C2)')',`And(`Not(A2)',B2,C3)') \ + with .nw at Ex1.sw+(0,-0.4) + line right 3*L_unit from Ex3.Out + line from Ex3.InB2 to (Ex3.InA2,Ex3.InB2)+(-2*L_unit,0) \ + then up Ex3.InB1.y-Ex3.InB2.y; dot + line from Ex3.InB1 to Here chop 0 chop -2*L_unit; B: "svg_it(B)" rjust + line from Ex3.InA2 to (Ex3.InA2,Ex3.InA1); dot + line from Ex3.InA1 to (B,Here) ; "svg_it(A)" rjust + line from Ex3.InC2 to (Ex3.InC2,Ex3.InC1) then to Ex3.InC1 + dot(at Ex3.InC2); line to (B,Here); "svg_it(C)" rjust + dot(at ((Ex3.InC2)+(-2*L_unit,0),Ex3.InC2)) + line to (Here,Ex3.InC3) then to Ex3.InC3 + "svg_it(AC+BC+ABC)" above ljust at Ex3.G.nw + line right 0.1 at last ""+(0.5,0.16) + line right 0.1 at last ""+(0.73,0.16) + `"Or(`And(A1,C1)',`And(B1,`Not(C2)')',`And(`Not(A2)',B2,C3)')"' \ + at (B,Ex3.s)+(0,-0.2) ljust + +# define(`MarkSubLayers') +Ex4: And(`Or(`Nand(`Or(A,B)',C)',D)',E) with .w at Ex3.e+(1.25,0) + "svg_it(A)" rjust at Ex4.InA + "svg_it(B)" rjust at Ex4.InB + line from Ex4.InC to (Ex4.InA,Ex4.InC); "svg_it(C)" rjust + line from Ex4.InD to (Ex4.InA,Ex4.InD); "svg_it(D)" rjust + line from Ex4.InE to (Ex4.InA,Ex4.InE); "svg_it(E)" rjust + line right 3*L_unit from Ex4.Out + "svg_it((D+(A+B)C)E)" above ljust at Ex4.G.nw + line right 0.5 at last ""+(0.6,0.16) + `"And(`Or(`Nand(`Or(A,B)',C)',D)',E)"' at Ex4.sw+(0,-0.2) ljust +# undefine(`MarkSubLayers') + +stack_del(`m4InNames') # clear the name stack in case other diagrams need it +# extend the bounding box +move from Ex1.nw+(-0.35,0.1) to Ex4.Out+(1,-0.65) + +command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LogicSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LogicSVG.m4 new file mode 100644 index 00000000000..ec89a62bb02 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LogicSVG.m4 @@ -0,0 +1,59 @@ +.PS +# Logic.m4 +log_init(svg_font(sans-serif,11bp__)) +xgap = 0.5 +[ dmov = 0.4 +{ {AND_gate ; "`AND_gate'" ljust at last [].w + (xgap,0)} + move down dmov; right_ + {OR_gate ; "`OR_gate'" ljust at last [].w + (xgap,0)} + move down dmov; right_ + {BUFFER_gate ; "`BUFFER_gate'" ljust at last [].w + (xgap,0)} + move down dmov; right_ + {XOR_gate ; "`XOR_gate'" ljust at last [].w + (xgap,0)} + } + +xgap = 0.65 + move right_ 2 +{ { NAND_gate ; "`NAND_gate'" ljust at last [].w + (xgap,0) } + move down dmov; right_ + { Gate: NOR_gate(3) + "`NOR_gate(3)'" ljust at last [].w + (xgap,0) + thinlines_ + spline <- from Gate.Out right arrowht*2.0 \ + then up 0.15 then right 0.05 + "`Out'" ljust + spline <- from Gate.N_Out down arrowht*2.0 \ + then right 0.1+arrowht*1.5+NOT_rad down 0.15-arrowht*2.0 + "`N_Out'" ljust + for_(1,3,1, + `arrow <- left 0.2 down 0.05 from Gate.In`'m4x + "In`'m4x" rjust at Here+(0,(2-m4x)*0.02)') + } + thicklines_ + move down dmov; right_ + { NOT_gate ; "`NOT_gate'" ljust at last [].w + (xgap,0) } + move down dmov; right_ + { NXOR_gate ; "`NXOR_gate'" ljust at last [].w + (xgap,0) } +} + move right_ 2 +{ {B: NAND_gate(,B) ; "`NAND_gate(,B)'" ljust at B.w + (xgap,0)} + { line invis right 1.8 from last [].se then down 1} + move down dmov; right_ + move left N_diam*L_unit; right_ + {NOR_gate(3,NB) ; "`NOR_gate(3,NB)'" ljust at (B.w,last []) + (xgap,0) } + move down dmov; right_ + {BOX_gate(PN,N,,,=1) + "`BOX_gate(PN,N,,,=1)'" ljust at (B.w,last []) + (xgap,0) + line left 0.15 from last [].In1 + line left 0.15-NOT_rad*2 from last [].In2 + line right 0.15 from last [].Out } + move down dmov; move right_ N_diam*L_unit + {BOX_gate(PP,N,,,=) + "`BOX_gate(PP,N,,,=)'" ljust at (B.w,last []) + (xgap,0) + line left 0.15 from last [].In1 + line left 0.15 from last [].In2 + line right 0.15 from last [].Out } +} +] + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4 new file mode 100644 index 00000000000..d6b29d0fa02 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4 @@ -0,0 +1,81 @@ +.PS +# LoglogSVG.m4 +gen_init(svg_font(sans-serif,11bp__)) + +define(`rint',`sign(`$1')*int(abs(`$1')+.5)') +S:[ + horiz = 4 + vert = horiz*2/3 + tmax = 10 + tmin = 1 + vmax = 100 + vmin = 0.1 + tic = 0.08 + denv = log(vmax) - log(vmin) + denh = log(tmax) - log(tmin) + + Origin: Here + define(`coord', + `Origin+((log(`$1')-log(tmin))/denh*horiz,(log(`$2')-log(vmin))/denv*vert)') + +thinlines_ +# Left axes and labels + psset_(linecolor=gray) + for i = rint(log(vmin)) to rint(log(vmax)) do { + move to coord(tmin,exp(i)) + line right horiz + sprintf("%g",exp(i)) wid 0.2 rjust at last line.start + if i < rint(log(vmax)) then { + for j = 2 to 9 do { move to coord(tmin,j*exp(i)) + line right horiz + if (j==2) || (j==5) then { + sprintf("%g",j*exp(i)) rjust at last line.start } + } } } + +#Horizontal axis and labels + for t = rint(log(tmin)) to rint(log(tmax)) do { + move to coord(exp(t),vmin) + line up vert + sprintf("%g",exp(t)) wid 0.15 below at last line.start + if t < rint(log(tmax)) then { + for j = 2 to 9 do { move to coord(j*exp(t),vmin) + line up vert + if (j==2) || (j==5) then { + sprintf("%g",j*exp(t)) below at last line.start } + } } } + psset_(linecolor=black) + +# arrow from Origin up vert chop 0 chop -0.1 + line from Origin up vert + "svg_it(y(t))" wid 0.3 at Origin+(-0.1,0.5*vert) rjust + +# arrow from Origin right horiz chop 0 chop -0.1 + line from Origin right horiz + "svg_it(t)" at Origin+(.5*horiz,-0.1) below + +thicklines_ + alpha = 2.5 + beta = 3.0 + tm = max(tmin,(vmin/alpha)^(1/beta)) + tM = min(tmax,(vmax/alpha)^(1/beta)) + line from coord(tm,alpha*tm^beta) to coord(tM,alpha*tM^beta) +P: box invis fill_(1) wid 0.75 ht 0.18 \ + "svg_it(y(t) = 1.5 t)" with .w at coord(2.005,14) + "svg_it(svg_small(3))" with .w at P.ne #ljust + + alpha = 0.05 + beta = 2.0 + tm = max(tmin,(vmin/alpha)^(1/beta)) + tM = min(tmax,(vmax/alpha)^(1/beta)) + line from coord(tm,alpha*tm^beta) to coord(tM,alpha*tM^beta) +Q: box invis fill_(1) wid 0.80 ht 0.18 \ + "svg_it(y(t) = 0.05 t)" with .e at coord(4.6,1.4) + "svg_it(svg_small(2))" with .w at Q.ne #ljust + +] + +# box wid S.wid ht S.ht at S +# print (S.wid,S.ht)/(1 pc__) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MCSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MCSVG.m4 new file mode 100644 index 00000000000..ef1d2158091 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MCSVG.m4 @@ -0,0 +1,44 @@ +.PS +#MC.m4 +cct_init(svg_font(Times,11bp__)) +textoffset = 3bp__ + + dv = dimen_*0.6 + dh = dimen_*0.4 + backup = dimen_/6 + + for i=1 to 3 do {{ + if i==2 then { Input: dot } else { line up (2-i)*dv } + source(right_ dimen_,AC) +# The pound sign has to be protected from m4 + llabel(,,sprintf("svg_it(v`'svg_sub(&``#''%g;,66%))",96+i)) + resistor(right_ dimen_ from Here-(backup/2,0)) + if i==1 then { llabel(,R`'svg_sub(i))} + inductor(right_ dimen_ from Here-(backup,0),W) + if i==1 then { llabel(,L`'svg_sub(i))} + line right_ i*dh + b_current(sprintf("svg_it(i`'svg_sub(&``#''%g;,66%))",96+i)); dot + { line down (3-i)*dv; capacitor(down_ dimen_) + if i==1 then { rlabel(,C`'svg_it(i)) } + if i==2 then { dot } else { line right (2-i)*dh }} + line right 3*dh; dot + E: Here+((3-i)*dh+dimen_*2,(4-2*i)*dv) + for j=1 to 3 do {{ + line up (6-j*3)*dv then right (3-i)*dh + switch(right_ E.x-Here.x) + llabel(,,sprintf("svg_it(S`'svg_sub(&``#''%g;&``#''%g;,66%))",96+i,64+j)) + if i==2 then { dot } else { line down (2-i)*dv } + }} + line from E right dh then down E.y-Here.y + arrow right dimen_/2 + { sprintf("svg_it(i`'svg_sub(&`#'%g;,66%))",64+i) above } + resistor(right_ dimen_ from Here-(arrowht/2,0)) + if i==1 then {llabel(,R`'svg_sub(o))} + inductor(right_ dimen_ from Here-(backup,0),W) + if i==1 then {llabel(,L`'svg_sub(o))} + source(right_ dimen_,AC) + llabel(sprintf("svg_it(v`'svg_sub(&``#''%g;,66%))",64+i)) + if i==2 then { Output: dot } else { line down (2-i)*dv } + }} + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile new file mode 100644 index 00000000000..eba342fa226 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile @@ -0,0 +1,91 @@ +LIBDIR = $$HOME/lib +M4LIBS = svg.m4 SVGconfig.m4 + +# To process a single file, copy it to test.m4 and type "make tst" +# to produce tstSVG.html + +DPIC = dpic +#DPIC = $$HOME/dpic/bu*/p2c/ftp/dpic +#DPIC = $$HOME/dpic/bu*/test/dpic + +.SUFFIXES: .pic .svg .m4 +.pic.svg: + $(DPIC) -v $*.pic > $*.svg + grep '<\!-- width' $*.svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' > $*.siz +.m4.svg: + m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic + $(DPIC) -v $*.pic > $*.svg + grep '<\!-- width' $*.svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' > $*.siz + +CCTSVG = \ + AdderSVG.svg AlogixSVG.svg ABlogixSVG.svg AmpTableSVG.svg AntennasSVG.svg \ + AudioSVG.svg \ + BipSVG.svg BtreeSVG.svg ByteSVG.svg ButtonsSVG.svg \ + CanLogicSVG.svg CctTableSVG.svg ConnSVG.svg CountingSVG.svg CrossbarSVG.svg \ + CrowSVG.svg CrullerSVG.svg CsourceSVG.svg \ + DecoderSVG.svg DemultiplexerSVG.svg DiodesSVG.svg DriveSVG.svg \ + EmarrowsSVG.svg \ + FlowSVG.svg FontsSVG.svg FusesSVG.svg GroundsSVG.svg \ + HeadersSVG.svg HeathkitSVG.svg InclepsSVG.svg I2LSVG.svg JackSVG.svg \ + LogicSVG.svg LoglogSVG.svg \ + MCSVG.svg MixerSVG.svg MotorControlSVG.svg MultiplexerSVG.svg \ + NLGSVG.svg NPDTSVG.svg NportSVG.svg OpampSVG.svg OptoisoSVG.svg \ + PconnSVG.svg PushPullSVG.svg QuantumSVG.svg \ + RectifiersSVG.svg RelaySVG.svg RotboxSVG.svg\ + SchottkySVG.svg ShiftRSVG.svg SierpinskiSVG.svg \ + SixpoleSVG.svg SourcesSVG.svg SQUIDSVG.svg SwitchesSVG.svg \ + TTLnandSVG.svg TgateSVG.svg TtreeSVG.svg \ + ThreeSVG.svg TimerSVG.svg VariableSVG.svg WindingsSVG.svg XformSVG.svg \ + controlSVG.svg cscSVG.svg diamondSVG.svg ex00SVG.svg \ + 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 \ + pwrsupplySVG.svg quickSVG.svg randomSVG.svg recycleSVG.svg roseSVG.svg \ + sfgSVG.svg shapesSVG.svg paletteSVG.svg \ + thyristorSVG.svg ujtSVG.svg wormSVG.svg XORSVG.svg Np.svg + +examplesSVG.html: examplesSVG.htmx + make $(CCTSVG) + Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \ + sed -e 's/Version XXX/Version '$$Version'/' examplesSVG.htmx \ + | m4 > examplesSVG.html + +SED = sed -e '/^\%/d' +TEST = test +tst: $(TEST).pic + $(DPIC) -v $(TEST).pic > $(TEST).svg + m4 $(M4LIBS) $(TEST).m4 | $(SED) > $(TEST).pic + $(DPIC) -v $(TEST).pic > $(TEST).svg + grep '<\!-- width' $(TEST).svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' \ + > $(TEST).siz + make tstSVG.html + +test.pic: + m4 $(M4LIBS) test.m4 | $(SED) > test.pic + +tstSVG.html: tstSVG.htmx $(TEST).svg + Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \ + sed -e 's/Version XXX/Version '$$Version'/' \ + -e 's/XXXXX/'$(TEST)'/g' \ + tstSVG.htmx | m4 > tstSVG.html +# cp tstSVG.html $(TEST) $$HOME/public_html/svg + +xst: Incleps.png + +InclepsSVG.svg: InclepsSVG.m4 + m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic + $(DPIC) -v $*.pic > $*.svg + $(DPIC) -v $*.pic > $*.svg + +Incleps.png: + (cd ..; make Incleps.png); cp ../Incleps.png . + +clean: + @printf "\n svg clean:\n" + rm -f *.svg *.dim *.ps *log *.siz *.pic examplesSVG.html Incleps.png + rm -f tstSVG.html + @printf "\n" + +clobber: clean + rm -f test.m4 diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MixerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MixerSVG.m4 new file mode 100644 index 00000000000..aa778337b33 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MixerSVG.m4 @@ -0,0 +1,98 @@ +.PS +#`MixerSVG.m4 +# Showing VMOS mosfet and custom transformer' +cct_init(svg_font(sans-serif,11bp__,1bp__)) + +define(`dimen_',0.6) +define(`elen_',0.75) + +define(`Xform21', + `[ L1: inductor(to rvec_(dimen_*0.5,0),L,,M) + Core1E: M4Core1.end; Core2E: M4Core2.end + D: (0.5 between M4Core1 and M4Core2) - L1 + T: line to rvec_(dimen_/3,0); { dot(at T.c) } + L2: inductor(to rvec_(L1.len,0),L,,M) + line from M4Core1.start to Core1E + line from M4Core2.start to Core2E + L3: inductor(to rvec_(-L1.len,0) with .c at T+(D.x*2,D.y*2),L) ]') + + del = dimen_/3 + setdir_(U) +T1: Xform21; "T1" at T1.n above rjust + dot(at T1.L3.start+(0,4bp__)) + dot(at T1.L1.end+(4bp__,0)) + dot(at T1.L2.end+(4bp__,0)) + line from T1.L3.start left_ dimen_*2/3 +RF: dot(,,1); "RF" at RF.w rjust + line from T1.L3.end left_ del; corner; ground(,,F) + + line down_ del/2 from T1.L1.start then right_ del + reversed(`capacitor',right_ dimen_,C); llabel(,0.1 svg_micro`'F) +BT: dot(at Here) + line up_ del/2 from T1.L2.end then right del + reversed(`capacitor',right_ dimen_,C); llabel(,0.1 svg_micro`'F) + t = dimen_*7/8 + line to (BT.x+4*t,Here.y) +TT: dot + line right_ dimen_+del/2; setdir_(U) +Q1: mosfet(,,dMESDQuB,E) with .G at Here + { "Q1" at Q1.Env.ne above ljust } + ground(at Q1.S,,F) + line right_ del*3/2 from Q1.D then down_ Q1.D.y-T1.L2.end.y +T2: Xform21 with .L1.start at (Here,T1.L2.end); "T2" at T2.n above ljust + dot(at T2.L1.start+(-4bp__,0)) + dot(at T2.L3.end+(0,4bp__)) + line from T2.L3.end right_ dimen_*2/3 +IF: dot(,,1); "IF" wid 12bp__ at IF.e ljust + setdir_(U) +Q2: mosfet(,,dMESDQuB,E) at (Q1,T2.s-(0,elen_-del)) + { "Q2" at Q2.Env.ne above ljust } + line from Q2.D to (T2.L2.end,Q2.D) then to T2.L2.end + line from Q2.G left_ del/2 then up_ BT.y-Q2.G.y then to BT + + line right_ del from T1.T then down_ T1.T.y-BT.y+del*3/2 + corner; left_ + capacitor(to (T1.L3.end-(del,0),Here),C) + rlabel(,0.1 svg_micro`'F ) +LOD: dot + { line to (RF,Here) + dot(,,1); move left_ 4bp__; "local" rjust "oscillator" rjust; + move left 50bp__ } + line from T2.T left_ to (Q1.S,T2.T) +T2T: dot + { capacitor(down_ to (Here,BT),C); rlabel(,0.1 svg_micro`'F) + ground(,T,F) } + { line from T2.L3.start right_ del; corner; ground(,,F) } +Vt: dot(at (0.5 between BT and TT,Q1.Env.nw),,1) + { "+V`'svg_sub(CC)" at last [].e ljust } + line to (Here,T2T); dot + { line to (Here,BT); Cv: capacitor(down_ 3/2*dimen_,C) + llabel(10 svg_micro`'F); G: dot; ground(,,F) } + + for s=-1 to 1 by 2 do {{ + line right s*t; corner + resistor(down_ to (Here,BT)) + if s<0 then { llabel(,5 k`'svg_ohm) } \ + else { rlabel(,5 k`'svg_ohm) + { dot(at last line.start); line to (TT,Here) + resistor(right_ to (T2T,Here)) + llabel(,10 svg_ohm) } } + P: potentiometer(down_ Cv.len,,0.5,s*t ) with .Start at Here + if s<0 then { "1 k`'svg_ohm" at P. 1st [].ne ljust } \ + else { "1 k`'svg_ohm" at P. 1st [].sw rjust } + dot(at P.End) + dot(at P.T1) + { L: inductor(up_ to (Here,BT),L); + if s<0 then { "100 svg_micro`'H" at last [].sw rjust } \ + else { line to TT + "100 svg_micro`'H" at last [].ne ljust below } } + capacitor(down_ to (Here,G),C) + if s<0 then { rlabel(,0.1 svg_micro`'F) } \ + else { llabel(,0.1 svg_micro`'F) } + dot }} + + resistor(down_ from LOD to (LOD,G)); llabel(,51 svg_ohm); corner + line to (Q2.S,Here) then to Q2.S + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MotorControlSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MotorControlSVG.m4 new file mode 100644 index 00000000000..7a27d4b4d32 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MotorControlSVG.m4 @@ -0,0 +1,58 @@ +.PS +# MotorControl.m4 +cct_init(svg_font(sans-serif,11bp__)) + + trad = 2.5*dotrad_ +define(`bigterminal',`circle rad trad') + + mrad = linewid*2/3 +Motor: circle rad mrad "Motor" + + linethick = 2 + T2: Motor.n+(0,dimen_/2) + + for i=1 to 3 do { + if i==2 then { line from Motor.n to T2 } \ + else { line from Motor right (i-2)*Motor.diam chop Motor.rad chop 0 \ + then up T2.y-Motor.y } + bigterminal + cbreaker(up_ dimen_*3/4,,T) + bigterminal + line up_ dimen_ + bigterminal + capacitor(up_ dimen_*1.2,,,dimen_/3,dimen_/6) + { circle fill_(1) rad dotrad_*3/2 thick 0.8 \ + at 0.25 between last line.end and last line.start } + if i==1 then { L1: last circle } \ + else { if i==2 then { L2: last circle }} + bigterminal + line up_ dimen_/4 + } + linethick_(0.8) + C2: circle rad mrad/3 at Motor.n+ (0,dimen_*2) + line from C2.e right_ dimen_/3 then up C2.rad*1.5 + line to (L1.x-dimen_/2,Here.y) + {S23: capacitor(up_ dimen_*2/3 from (L1.x-dimen_/2,Here.y),,, + dimen_/3,dimen_/6); dot(,,1) } + dot(,,1) + line to (L1.x-dimen_*2,Here.y) chop dotrad_ chop 0 then up dimen_/3 + S1: [ bswitch(right_ dimen_/2) ] with .Bsw_T1.s at Here + S2: [ bswitch(right_ dimen_/2,,C) ] at S1+(0,-dimen_) + line right dimen_/6 down dimen_/6 from S1.Bsw_T2.se \ + then down S1.Bsw_T2.se.y-S2.Bsw_T2.ne.y-dimen_/3 \ + then to S2.Bsw_T2.ne + box wid S1.wid+dimen_/2 ht S1.n.y-S2.s.y+dimen_/3 \ + at 0.5 between S1.s and S2.n + line left dimen_/2 from S23.end chop dotrad_ chop 0; corner + line to (Here,S1.Bsw_T2) then to S1.Bsw_T2.e + line from S2.Bsw_T1.w left dimen_/2; corner + line to (Here,L1) then to L1 chop 0 chop dotrad_ + + dot(at 0.5 between L1 and L2,,1) + { line to L2 chop dotrad_ } + S45: variable(`capacitor(down_ dimen_*2/3 chop dotrad_ chop 0,,, + dimen_/3,dimen_/6)',L,,dimen_/2); dot(,,1) + line to (Here,C2) then to C2.w chop dotrad_ chop 0 + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MultiplexerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MultiplexerSVG.m4 new file mode 100644 index 00000000000..aba528b33bf --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MultiplexerSVG.m4 @@ -0,0 +1,43 @@ +.PS +# MultiplexerSVG.m4 +log_init + +# Font + textht = textht*0.8 + command "<g font-size=\"50%\" font-family=\"Helvetica\">" + right_ + + Mux(4,M1) + "`Mux'(4,M1)" at last [].s below + "svg_it(In0)" at last [].In0.end rjust wid 14bp__ + "svg_it(In1)" at last [].In1.end rjust + "svg_it(In2)" at last [].In2.end rjust + "svg_it(In3)" at last [].In3.end rjust + "svg_it(Out)" at last [].Out.end above + "svg_it(Sel)" at last [].Sel.end ljust above + + left_; Mux(4,,LNOE) with .c at last [].c+(0.9,0) + { line right 8bp__ at last [] . 1nd last ""+(-10bp__,4bp__) } + "`left_; Mux'(4,,LNOE)" at last [].s +(0,-20bp__) + "svg_it(In0)" at last [].In0.end above + "svg_it(NOE)" at last [].NOE.end +(4bp__,0) below + "svg_it(Out)" at last [].Out.end below + "svg_it(Sel)" at last [].Sel.end rjust below + + right_; Mux(4,,OEBN2) with .c at last [].c+(1.4,0) + "`Mux'(4,,OEBN2)" at last [].s below + "svg_it(Sel0)" at last [].Sel0.end rjust + "svg_it(Sel1)" at last [].Sel1.end ljust + "svg_it(In0)" at last [].In0.end rjust + "svg_it(In3)" at last [].In3.end rjust + "svg_it(OE)" at last [].OE.end rjust + + down_; Mux(8,,L3,,28*L_unit) with .c at last [].c+(1.7,0) + "`down_; Mux'(8,,L3,,28*L_unit)" at last [].s below wid 162bp__ + "svg_it(Sel0)" at last [].Sel0.end rjust + "svg_it(Sel2)" at last [].Sel2.end rjust below + "svg_it(In0)" at last [].In0.end rjust + "svg_it(In7)" at last [].In7.end ljust wid 14bp__ + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NLGSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NLGSVG.m4 new file mode 100644 index 00000000000..987e2911fb1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NLGSVG.m4 @@ -0,0 +1,21 @@ +.PS +# NLG.m4 +cct_init(svg_font(sans-serif,11bp__)) + + define(`nullor',`nport(`$1' + {`"0"' at Box.w ljust + `"oo"' at Box.e rjust},shift($@))') + +N: nullor +`"nullor"' at last [].s+(0,-3pt__) below +G: gyrator with .sw at N.se+(0.5,0) +`"gyrator"' at G.s+(0,-3pt__) below +I: gyrator(invis,,0,N) with .w at G.e+(0.5,0) +`"gyrator(invis,,0,N)"' at I.s +V: gyrator(invis wid boxht,,0,NV) with .w at I.e+(1,0) +`"gyrator(invis wid boxht,,0,NV)"' wid 2 at V.s+(0,-3pt__) below + + move right 0.9 + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NPDTSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NPDTSVG.m4 new file mode 100644 index 00000000000..3702d025501 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NPDTSVG.m4 @@ -0,0 +1,41 @@ +.PS +# `NPDT.m4' +cct_init(svg_font(sans-serif,11bp__)) + + movewid = 1.0 + + NPDT + {move left 0.1 from last [].w} + { "svg_it(R)" at last [].R.s below + "svg_it(T)" at last [].T.s below + "svg_it(L)" at last [].L.s below } + { `"NPDT"' at last [].s +(0,-0.22) } + + up_; NPDT with .sw at last[].se+(0.5,0) + { "svg_it(R)" wid 8pt__ at last [].R.e ljust + "svg_it(T)" at last [].T.e ljust + "svg_it(L)" at last [].L.e ljust } + { `"up_; NPDT"' at last [].s +(0.1,-0.15) } + right_ + + NPDT(2) with .w at last [].e+(0.75,0) + { for_(1,2,1, + `"svg_it(R`'m4x)" at last [].R`'m4x.e ljust + "svg_it(L`'m4x)" wid 11pt__ at last [].L`'m4x.w rjust') } + { `"NPDT(2)"' at last [].s +(0,-0.15) } + move + + NPDT(3,R) + { for_(1,3,1, + `"svg_it(R`'m4x)" at last [].R`'m4x.e ljust + "svg_it(L`'m4x)" wid 11pt__ at last [].L`'m4x.w rjust') } + { `"NPDT(3,R)"' at last [].s below } + + left_; NPDT(2,R) with .w at last [].e+(1.0,0) + { for_(1,2,1, + `"svg_it(R`'m4x)" at last [].R`'m4x.w rjust + "svg_it(L`'m4x)" wid 11pt__ at last [].L`'m4x.e ljust') } + { `"left_; NPDT(2,R)"' wid 90bp__ at last [].s +(0,-0.15) } + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Np.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Np.m4 new file mode 100644 index 00000000000..e0ae4fb6bbf --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Np.m4 @@ -0,0 +1,20 @@ +.PS +svg_font(sans-serif,9bp__) + +B: box invis wid 6 ht 2 +"`nport(box specs; other commands,nw,nn,ne,ns,space ratio,pin lgth,style,other commands)" \ + ljust at B.w \ +"" ljust \ +"Default is a twoport the size of a normal box." ljust \ +"Args 2 to 5 are the number of ports to be drawn on w, n, e, s sides." ljust \ +"" ljust \ +"The port pins are named by side, number, and by a or b pin," ljust \ +"e.g. W1a, W1b, W2a, ... . Arg 6 specifies the ratio of" ljust \ +"port width to interport space, and arg 7 is the pin length." ljust \ +"" ljust \ +"Set arg 8 to N to omit the dots on the port pins" ljust \ +"Arguments 1 and 9 allow customizations'" ljust + +svgLink(NportSVG.svg,"<- back" ljust at last box.sw above ljust,B) +command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NportSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NportSVG.m4 new file mode 100644 index 00000000000..be0aab19c0c --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NportSVG.m4 @@ -0,0 +1,47 @@ +.PS +# `NportSVG.m4' +cct_init(svg_font(sans-serif,11bp__)) + +textoffset = 2bp__ +Twoport: nport + + "W1a" wid 0.35 above rjust at Twoport.W1a + "W1b" below rjust at Twoport.W1b + "E1a" above ljust at Twoport.E1a + "E1b" below ljust at Twoport.E1b + +#Nport: nport(wid 1 ht 1.5 fill_(0.9) svgLinkString(Np.svg,n-port,B),1,2,3,4) \ +# with .Box.w at Twoport.Box.e+(1.0,0) +Nport: nport(wid 1.75 ht 1 fill_(0.9),1,2,3,4) \ + with .Box.w at Twoport.Box.e+(1.25,0) + svgLink(Np.svg,"n-port" at Nport,B) + + "W1a" rjust at Nport.W1a + "W1b" rjust at Nport.W1b + + "E1a" ljust at Nport.E1a + "E3b" ljust at Nport.E3b + + "N1a" above at Nport.N1a.n + "N1b " above at Nport.N1b.n + " N2a" above at Nport.N2a.n + "N2b" above at Nport.N2b.n + + "S1a" below at Nport.S1a.s + "S4b" below at Nport.S4b.s + + "..." at 0.5<Nport.S1a,Nport.S4b>+(0,-0.10) + "..." at 0.5<Nport.E1a,Nport.E3b>+(0.15,0.05) + +Nterm: nterm with .Box.w at Nport.Box.e+(1.0,0) + "W1" rjust at Nterm.W1 + "E1" wid 0.2 ljust at Nterm.E1 + "S1" below at Nterm.S1.s + + `"nport"' at Twoport.s+(0,-0.3) + `"nport(wid 1.5 ht 1.75 fill_(0.9),1,2,3,4)"' ljust at Nport.sw+(0,-0.3) + `"svgLink(Np.svg,\"n-port\" at Nport,B)"' ljust at Nport.sw+(0,-0.5) + `"nterm"' at Nterm.s+(0,-0.3) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OpampSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OpampSVG.m4 new file mode 100644 index 00000000000..65ea9233b07 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OpampSVG.m4 @@ -0,0 +1,35 @@ +.PS +# Opamp.m4 +cct_init(svg_font(sans-serif,11bp__)) + + A: opamp + thinlines_ + "`opamp'" at A.s-(0,0.25) + "Out" below at A.Out + spline <- from A.In1 left 0.1 then up 0.1 left 0.1 + "In1" wid 0.25 rjust above + spline <- from A.In2 left 0.1 then down 0.1 left 0.1 + "In2" rjust below + arrow <- up 0.1 right 0.1 from A.E1 + "E1" ljust above + arrow <- down 0.1 right 0.1 from A.E2 + "E2" ljust below + thicklines_ + Point_(15) + B: opamp(,,,,PR) with .sw at A.se+(0.65,0) + thinlines_ + "`Point_(15); opamp(,,,,PR)'" at B.s-(0,0.25) + spline <- right arrowht up arrowht from B.V1 then right 0.1 + "V1" ljust + spline <- right arrowht down arrowht from B.V2 then right 0.1 + "V2" ljust + thicklines_ + Point_(90) + C: opamp with .sw at B.se+(1.05,0) + "`Point_(90); opamp'" at C.s-(0,0.25) + right_ + D: opamp(,,,,T) with .sw at C.se+(0.65,0) + "`opamp(,,,,T)'" wid 0.75 at D.s-(0,0.25) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OptoisoSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OptoisoSVG.m4 new file mode 100644 index 00000000000..b99e096c5a7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OptoisoSVG.m4 @@ -0,0 +1,64 @@ +.PS +# OptoisoSVG.m4 +cct_init(svg_font(sans-serif,11bp__,3bp__)) +movewid = 0.25 + +# `optoiso([L|R][A|B|C])' +define(`optoiso',`ifinstr(`$1',C, +`[{ u = dimen_ + hd = u/5 + Q: bi_tr(up hd*4,ifinstr(`$1',R,R)) + line from Q.E ifinstr(`$1',R,left,right)(hd+u/3); Pin4: dot(,,1) + line from Q.C to (Pin4,Q.C); Pin5: dot(,,1) + T: (Q.B,Pin5)+(0,4*hd) + line from Q.B to T then to (Pin5,T); Pin6: dot(,,1) + D: diode(from Pin6 +(ifinstr(`$1',R,+,-)(u/3+hd*8),0) down hd*4) + line from D.start ifinstr(`$1',R,right,left) (hd*2+u/3); Pin1: dot(,,1) + line from D.end to (Pin1,D.end); Pin2: dot(,,1) + line from (D.end,Pin4) to (Pin1,Pin4) chop hd chop 0; Pin3: dot(,,1) + B: box wid hd*10 ht hd*10 with .c at 0.5 between Pin4 and Pin1 + arrow from B.c+(ifinstr(`$1',R,,-)hd*1.5,hd*1.5) to B.c chop 0 chop -0.7*hd + F: (ifinstr(`$1',R,,-)hd*0.5,-hd*0.5) + arrow from last arrow.start+(F.x,F.y) to last arrow.end+(F.x,F.y) + `$2' }]', +`[{u = dimen_/2 + Q: bi_trans(up u*2,ifinstr(`$1',R,R),ifinstr(`$1',B,B)CBUdE) + E: Q.E; C: Q.C; A:ifinstr(`$1',R,Q.e+(u*3/2,u),Q.w+(-u*3/2,u)); K: A-(0,u*2) + ifinstr(`$1',B,line from Q.B to (Q.B,E); B: Here) + D: diode(from A to K) + arrow from D.c+(0,u/6) to Q.ifinstr(`$1',R,e,w)+(0,u/6) chop u/3 chop u/4 + arrow from last arrow.start-(0,u/3) to last arrow.end-(0,u/3) + Enc: box rad u wid abs(C.x-A.x)+u*2 ht u*2 with .c at 0.5 between C and K + `$2' }]')') + +define(`optlabels', + `{"svg_it(C)" ht 0.1 at last [].C above + "svg_it(E)" at last [].E below + ifinstr(`$1',B,`"svg_it(B)" at last [].B below') + "svg_it(A)" at last [].A above + "svg_it(K)" at last [].K below}') + +Q: optoiso; optlabels; move + {`"optoiso"' at last [].s+(0,-0.22)} + optoiso(Rightorientation); optlabels; move + {`"optoiso(R)"' at last [].s+(0,-0.22)} + optoiso(B); optlabels(B); move + {`"optoiso(B)"' at last [].s+(0,-0.22)} + optoiso(RB); optlabels(B) + {`"optoiso(RB)"' at last [].s+(0,-0.22)} + +R: optoiso(C) with .nw at Q.sw+(0.33,-0.75); move 1 +{"svg_it(1)" at R.Pin1 rjust; "svg_it(2)" at R.Pin2 rjust + "svg_it(3)" wid 0.3 at R.Pin3 rjust} +{"svg_it(4)" at R.Pin4 ljust; "svg_it(5)" at R.Pin5 ljust + "svg_it(6)" at R.Pin6 ljust } +{`"optoiso(C)"' at R.s below } +S: optoiso(RC) +{"svg_it(1)" at S.Pin1 ljust; "svg_it(2)" at S.Pin2 ljust + "svg_it(3)" at S.Pin3 ljust } +{"svg_it(4)" at S.Pin4 rjust; "svg_it(5)" at S.Pin5 rjust + "svg_it(6)" wid 0.3 at S.Pin6 rjust } +{`"optoiso(RC)"' at S.s below } + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PconnSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PconnSVG.m4 new file mode 100644 index 00000000000..066d397ca25 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PconnSVG.m4 @@ -0,0 +1,51 @@ +.PS +# `PconnSVG.m4' +cct_init(svg_font(sans-serif,11bp__)) + +P1: [ + C1: pconnex(,A) + thinlines_ + arrow <- left 0.2 from C1.H.w; "svg_it(H)" wid 10bp__ rjust + thicklines_ + `"pconnex(,A)"' at last [].s below + C2: pconnex(,AF) with .w at C1.e+(0.3,0) + thinlines_ + arrow <- right 0.2 up 0.1 from C2.H.e; "svg_it(H)" ljust + N: box invis wid (C2.w.x-C1.e.x)/2 ht C1.N.ht \ + with .n at 0.5 between C1.ne and C2.nw "svg_it(N)" + arrow from N.w to C1.N.e + arrow from N.e to C2.N.w + G: box invis wid N.wid ht N.ht with .n at (N,C1.N.s) "svg_it(G)" + arrow from G.w to C1.G.e + arrow from G.e to C2.G.w + `"(,AF)"' at last [].s below + C03: pconnex(,AC) with .w at C2.e+(0.2,0) + `"(,AC)"' at last [].s below + C3: pconnex(,ACF) with .w at last [].e+(0.2,0) + `"(,ACF)"' at last [].s below + + C4: pconnex(,P) with .w at last [].e+(0.2,0) + `"(,P)"' at (C4,last "") below + C5: pconnex(U,D) with .w at last [].e+(0.2,0) + `"(U,D)"' at last [].s below + C6: pconnex(U,DF) with .w at last [].e+(0.2,0) + `"(U,DF)"' at last [].s below + C7: pconnex(U,J) with .w at last [].e+(0.2,0) + `"(U,J)"' at last [].s below + C8: pconnex(U,JF) with .w at last [].e+(0.2,0) + `"(U,JF)"' wid 21bp__ at last [].s below + ] + +P2: [ + C9: pconnex(,G) + `"(,G)"' at last [].s below + C91: pconnex(,GF) with .w at last [].e+(0.2,0) + `"(,GF)"' at last [].s below + C92: pconnex(L,GF) with .w at last [].e+(0.2,0) + `"(L,GF)"' at last [].s below + C10: pconnex(,GC) with .w at last [].e + (0.2,0) + `"(,GC)"' at last [].s below +] with .nw at P1.C1.sw + (0,-0.25) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PushPullSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PushPullSVG.m4 new file mode 100644 index 00000000000..775b9de966c --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PushPullSVG.m4 @@ -0,0 +1,108 @@ +.PS +# `PushPullSVG.m4' +cct_init(svg_font(sans-serif,10bp__,1bp__)) + +linewid = 1.2*linewid + +# Transformer as for Mixer.m4 +define(`Xform21', + `[ L1: inductor(to rvec_(dimen_*0.5,0),,,M) + Core1E: M4Core1.end; Core2E: M4Core2.end + D: (0.5 between M4Core1 and M4Core2) - L1 + T: line to rvec_(dimen_/3,0); { dot(at T.c) } + L2: inductor(to rvec_(L1.len,0),,,M) + line from M4Core1.start to Core1E + line from M4Core2.start to Core2E + L3: inductor(to rvec_(-L1.len,0) with .c at T+(D.x*2,D.y*2),) ]') + + del = dimen_/3 + up_ + T1: Xform21 + line left_ del from T1.L3.end; corner; ground(,,F) + line left_ 2*del from T1.L3.start + In: dot(,,1); { "RF" wid 12bp__ at In.n above } + up_ + Q1: mosfet(,,dBSDFQM1,E) with .G0 at T1.T+(2*dimen_+del/2,dimen_) + { "3N200" at last [].n above } + line from T1.L2.end to (T1.L2.end,Q1.G0) then to Q1.G0 + Q2: mosfet(,,dBSDFQM1,E) with .G0 at (Q1.G0.x,T1.T.y-dimen_) + { "3N200" at last [].n above } + line from T1.L1.start to (T1.L1.start,Q2.G0) then to Q2.G0 + + resistor(right_ dimen_ from T1.T); llabel(,330`'svg_ohm); Tx:dot + { line right_ del*3/2; corner; ground(,,F) } + dot(at (Tx,Q1.G0)) + capacitor(down_ to Tx,C); llabel(5.6pF) + dot(at (Tx,Q2.G0)) + capacitor(up_ to Tx,C); rlabel(5.6pF) + + for_(1,2,1, + `dot(at Q`'m4x.S+(dimen_+del/2,0)) + { resistor(down_ dimen_); G1:Here; + { "120" at last [].w rjust "svg_ohm" rjust } + dot; ground(,,F) } + line from Q`'m4x.S to (Here.x+dimen_*3/4,Q`'m4x.S.y); corner + capacitor(down_ to (Here,G1),C) + { "1000" at last [].w rjust "pF" rjust } + corner + line left_ 2*dimen_*3/4; corner + TG: dot(at (Here,Q`'m4x.S)) + capacitor(down_ to (Here,G1),C); rlabel(,0.01 svg_micro(F)) + ') + + R: dot(at (Here.x+dimen_*2,(Q1.D.y+Q2.D.y)/2)) + dot(at (R,Q1.D)); capacitor(down_ to R,C); llabel(20pF) + dot(at (R,Q2.D)); capacitor(up_ to R,C); llabel(20pF) + line right_ del*3/2 from R then down_ R.y-(Q1.S.y-dimen_); ground(,,F) + + Vc: dot(at (R+(dimen_,0),Q1.ne),,1); { "+Vc" rjust at Vc.w } + dot(at (Vc,R)) + inductor(right_ dimen_,); llabel(,1 svg_micro(H)) + down_ + T2: Xform21 with .T at Here + arrow from T2.L2 to T2.L3 chop -dimen_/4 + line right_ del from T2.L3.start; corner + capacitor(down_ dimen_,C); llabel(1000 pF); ground(,T,F) + line right_ 2*del from T2.L3.end + Out: dot(,,1); { "IF" wid 12bp__ at Out.n above }; move right_ 0.3 + + line from T2.L1.start to (T2.L1,Q1.D) then to Q1.D + line from T2.L2.end to (T2.L2.end,Q2.D) then to Q2.D + + line from Vc to (Vc,Q2.S) chop dotrad_/2 chop 0; dot + { line right_ del*2; corner + capacitor(down_ dimen_,C); llabel(,1000 pF); ground(,,F) } + reversed(`inductor',down_ dimen_,); rlabel(,1 svg_micro(H)) + line down_ dimen_/2 + + TL: dot(at (Q1.G1.x-del/2,Here.y)) + up_ + Q3: bi_tr(,R,,E) with .C at (TG.x,TL.y-dimen_*2/3) + resistor(right_ from TL to (Q3.C,TL)); llabel(,82 k`'svg_ohm) + line to (Vc,Here); dot + resistor(down_ to (Here,Q3.B)); rlabel(,8.2 k`'svg_ohm); dot + dot(at Q3.B+(del,0)) + line up_ (TL.y+Q3.C.y)/2 - Here.y+del/4 then left_ Here.x-TL.x + reversed(`capacitor',left_ dimen_,C); llabel(,1500 pF) + Osc: dot(,,1); { "Osc" above at Osc.n } + + line from Q3.B to (Vc,Q3.B) + line from Q3.C to (Q3.C,TL); dot + dot(at Q3.C+(0,del/2)) + capacitor(left_ to (TL,Here),C); llabel(,1500 pF); dot + line down_ del/2 from Q3.E; dot + { resistor(down_ dimen_*3/4); rlabel(,820`'svg_ohm) + G: Here; ground(,T,F) } + line right_ dimen_; corner + capacitor(down_ to (Here,G),C); llabel(,1000 pF) + ground(,T,F) + ground(at (TL,G),T,F) + resistor(up_ dimen_); llabel(,12 k`'svg_ohm) + line to (Here,Q1.G1) then to Q1.G1 + line from Q2.G1 to (TL,Q2.G1); dot + + ground(at (Vc,G),T,F) + resistor(up_ dimen_); rlabel(,5.6 k`'svg_ohm); line to (Here,Q3.B) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/QuantumSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/QuantumSVG.m4 new file mode 100644 index 00000000000..863c3ac857a --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/QuantumSVG.m4 @@ -0,0 +1,31 @@ +.PS +# QuantumSVG.m4 +gen_init + + boxht = 0.35 + boxwid = boxht + define(`dotrad_',boxht/5) + +define(`Bus',`line right_ 10*boxwid `$1' + circle diam boxht `$2' at last line.start + box fill_(1) "H" at last line.start+(boxwid*3/2,0) + box fill_(1) "H" at last line.end-(boxwid*2.5,0) ') + +define(`Meter',`[ Box: box wid boxwid*3/2 fill_(1) + r = Box.wid/3 + C: 0.3 between Box.s and Box.n + arc cw from C+(-r,0) to C+(r,0) with .c at C + arrow from C+(-r/4,0) to C+(0.9*r,0.9*r) ]') + +X: Bus(,shaded rgbstring(0.5,0.5,1) "X") +A1: Bus(from X.start+(0,-boxht*3/2), shaded "red" "A") +A2: Bus(from 2 between X.start and A1.start, shaded "red" "A") + dot(at X.start+(3*boxwid,0)) + line to (Here,A2); dot + circle rad dotrad_ at A1.start+(4*boxwid,0) + line from last circle.s to (last circle,X); dot + Meter with .e at X.end + box wid boxwid*1.2 ht boxht*1.2 fill_(1) at A2.end-(4.5*boxwid,0) \ + "svg_it(R)svg_sub(svg_psi)svg_sup(svg_pi/2,,,-1.2ex)" + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RectifiersSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RectifiersSVG.m4 new file mode 100644 index 00000000000..3329094082c --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RectifiersSVG.m4 @@ -0,0 +1,189 @@ +.PS +# RectifiersSVG.m4 +cct_init(svg_font(Times,11bp__)) + + tmax = 3.5 + period = tmax/1.75 + eamp = 0.5 + omega = twopi_/period + ed = eamp/6 + r = 0.95 + +# For DC voltages + ted = asin(ed/eamp)/twopi_*period + npts = 40; sum = 0 + for i=0 to npts do { + t = ted+(period/2-2*ted)*i/npts + sum += (eamp*cos(omega*t-pi_/2) - ed)*r } + +define(`Sine',`Cosine(eamp,omega,`$1',-pi_/2)') +define(`axis',`line thick 0.4 right tmax chop -tmax*0.04 chop 0') + +Threephase: [ linethick_(1) + Ai: axis ; "N`'svg_sub(o)" ljust + move right 0.3 from Ai.end + EOrig: Ai.start+(tmax*0.04,0) + E1: sinusoid(eamp,omega,-pi_/2,-ted,tmax) with .Origin at EOrig + E2: sinusoid(eamp,omega,-pi_/2-twopi_/3,-ted,tmax) with .Origin at EOrig + E3: sinusoid(eamp,omega,-pi_/2+twopi_/3,-ted,tmax) with .Origin at EOrig + "e`'svg_sub(1)" at EOrig+(period/3,eamp*0.8) ljust above + "e`'svg_sub(2)" at EOrig+(2*period/3,eamp*0.8) ljust above + "e`'svg_sub(3)" at EOrig+(period,eamp*0.8) ljust above + + Ad: axis with .end at Ai.end+(0,-eamp*2.1); "N`'svg_sub(o)" ljust + DOrig: Ad.start+(tmax*0.04,0) + Id: axis with .end at Ad.end+(0,-eamp*1.2); "0" ljust + IOrig: Id.start+(tmax*0.04,0) + + for i=1 to 11 by 2 do { + tl = max(0,period/2-i*period/6) + tr = min(period/2,tmax-(i*period/6-period/2)) + sinusoid(eamp,omega,-pi_/2,tl,tr,thick 0.4 dashed) \ + with .Origin at DOrig+(i*period/6-period/2,0) + tl = max(period/12,-(i*period/6-period/2+period/12) ) + tr = period/2-period/12 + S1: sinusoid(eamp*r,omega,-pi_/2,tl,tr) \ + with .Origin at DOrig+(i*period/6-period/2,0)+(0,-ed*r); round(at S1.End) + S2: sinusoid(eamp*r,omega,-pi_/2,tl,tr) \ + with .Origin at IOrig+(i*period/6-period/2,0)+(0,-ed*r); round(at S2.End) + } + "e`'svg_sub(1)" at DOrig+(period/3,eamp*0.8) ljust above + "e`'svg_sub(2)" at DOrig+(2*period/3,eamp*0.8) ljust above + "e`'svg_sub(3)" at DOrig+(period,eamp*0.8) ljust above + + "e`'svg_sub(L)" at DOrig+(period/4,eamp*0.8) below + "i`'svg_sub(L)" at IOrig+(period/6,eamp*0.6) rjust above + + vEd = r*eamp*cos(pi_/12)/(5*pi_/12) - r*ed + VEd: axis with .end at Ad.end+(0,vEd); "E`'svg_sub(D)" ljust + IEd: axis with .end at Id.end+(0,vEd); "I`'svg_sub(D)" ljust + ] + +Cct3:[ + No: dot; {"N`'svg_sub(o)" below rjust } + { inductor(to Here+(Rect_(dimen_,60)),W); E2: "e`'svg_sub(2)" ljust } + { inductor(to Here+(Rect_(dimen_,-60)),W); E3: "e`'svg_sub(3)" ljust } + { inductor(from No-(dimen_,0) to No,W) + E1: "e`'svg_sub(1)" above at last line.start } + D3: diode(down_ from E3); b_current(i`'svg_sub(3),rjust) + llabel(,,D`'svg_sub(3)) + line from E1 to (E1,D3.start) + D1: diode(down_); b_current(i`'svg_sub(1),rjust); llabel(,,D`'svg_sub(1)) + line from E2 left E2.x-E1.x+dimen_/3 then down E2.y-E3.y \ + then to 0.5 between D1.start and D3.start + D2: diode(down_); b_current(i`'svg_sub(2),rjust); llabel(,,D`'svg_sub(2)) + { line from D1.end to D3.end } + dot + arrowline(down elen_/2); rlabel(,i`'svg_sub(L)) + resistor(right_ elen_); rlabel(+,e`'svg_sub(L),-); llabel(,R) + line to (Here,No) then to No + ] with .e at Threephase.w-(0.5,0) + move left 0.2 from Cct3.w + +Fullwave: [ + linethick_(1) + Ai: axis ; "N`'svg_sub(o)" ljust + EOrig: Ai.start+(tmax*0.05,0) + E1: sinusoid(eamp,omega,-pi_/2,-ted,tmax) with .Origin at EOrig + "e`'svg_sub(1)" at EOrig+(period/3,eamp*0.8) ljust above + E2: sinusoid(eamp,omega, pi_/2,-ted,tmax) with .Origin at EOrig + "e`'svg_sub(2)" at EOrig+(period*5/6,eamp*0.8) ljust above + + Ad: axis with .end at Ai.end+(0,-eamp*2.1); "N`'svg_sub(o)" ljust + DOrig: Ad.start+(tmax*0.05,0) + Id: axis with .end at Ad.end+(0,-eamp*1.2); "0" ljust + IOrig: Id.start+(tmax*0.05,0) + + for i=0 to 3 do { + if i<3 then { tf = period/2 } else { tf = Ad.end.x-(DOrig.x+3*period/2) } + sinusoid(eamp,omega,-pi_/2,0,tf,thick 0.4 dashed) \ + with .Origin at DOrig+(i*period/2,0) + line from DOrig+(i*period/2-ted,0) right 2*ted + line from IOrig+(i*period/2-ted,0) right 2*ted + if i<3 then {tf = period/2-ted } else {tf = Ad.end.x-(DOrig.x+3*period/2) } + Ed: sinusoid(eamp*r,omega,-pi_/2,ted,tf) \ + with .Origin at DOrig+(i*period/2,-ed*r) + Ed: sinusoid(eamp*r,omega,-pi_/2,ted,tf) \ + with .Origin at IOrig+(i*period/2,-ed*r) + } + "e`'svg_sub(1)" at DOrig+(period/6,eamp*0.9) rjust above + "e`'svg_sub(2)" at DOrig+(period/6+period/2,eamp*0.9) rjust above + "e`'svg_sub(L)" at DOrig+(period/4,eamp*0.8) below + "i`'svg_sub(L)" at IOrig+(period/6,eamp*0.6) rjust above + + vEd = sum/(period/2/(period/2-2*ted)*npts) + VEd: axis with .end at Ad.end+(0,vEd); "E`'svg_sub(D)" ljust + IEd: axis with .end at Id.end+(0,vEd); "I`'svg_sub(D)" ljust + ] with .sw at Threephase.nw+(0,0.5) + +Cct2:[ + T: transformer(right_ elen_,R,8,AW,8) + line up elen_/2 from T.P1 + gap(right_ elen_) + { sinusoid(0.08,omega*8,-pi_/2,0,twopi_/(omega*8)) with .c at last [] } + line to T.P2 + line from T.S1 to (T.P1,T.S1) then down elen_/2 + D1: diode(down_ elen_*3/4); rlabel(,D`'svg_sub(1)) + line from T.S2 to (T.P2,T.S2) then to (T.P2,D1.start) + D2: diode(down_ elen_*3/4); rlabel(,D`'svg_sub(2)) + corner; line to D1.end; corner + dot(at 0.5 between D1.end and D2.end) + arrowline(down elen_/2); rlabel(,i`'svg_sub(L)) + resistor(right_ elen_); rlabel(+,e`'svg_sub(L),-); llabel(,R) + line to (Here,T.TS)-(0,elen_/2) then left Here.x-T.TS.x then to T.TS + {"N`'svg_sub(o)" at T.TS-(0,elen_/2) below } + thinlines_ + move to T.TS-(0,0.1) + { arrow to (T.P1,Here) chop 0.05 "e`'svg_sub(1)" below } + { arrow to (T.P2,Here) chop 0.05 "e`'svg_sub(2)" below } + linethick_(1) + ] at (Cct3,Fullwave) + +Halfwave: [ + linethick = 1 + Ai: axis ; "N`'svg_sub(o)" ljust + EOrig: Ai.start+(tmax*0.05,0) + Ei: sinusoid(eamp,omega,-pi_/2,0,tmax) with .Origin at EOrig + "e`'svg_sub(i)" at EOrig+(period/3,eamp*0.8) ljust above + + Ad: axis with .end at Ai.end+(0,-eamp*1.75); "N`'svg_sub(o)" ljust + DOrig: Ad.start+(tmax*0.05,0) + sinusoid(eamp,omega,-pi_/2,0,period/2,thick 0.4 dashed) with .Origin at DOrig + sinusoid(eamp,omega,-pi_/2,0,period/2,thick 0.4 dashed) \ + with .Origin at DOrig+(period,0) + "e`'svg_sub(i)" at DOrig+(period/5,eamp*0.9) rjust above + + line from Ad.start to DOrig+(ted,0) + Ed: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \ + with .Origin at DOrig+(0,-ed*r) + "e`'svg_sub(L)" at DOrig+(period/3,eamp*0.6) below + line from Ed.End right period/2+2*ted + Ed2: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \ + with .Origin at DOrig+(period,-ed*r) + line from Ed2.End to Ad.end + + vEd = sum/(period/(period/2-2*ted)*npts) + VEd: axis with .end at Ad.end+(0,vEd); "E`'svg_sub(D)" ljust above + + Id: axis with .end at Ad.end+(0,-eamp*1.0); "0" ljust + IOrig: Id.start+(tmax*0.05,0) + line from Id.start to IOrig+(ted,0) + Sd: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \ + with .Origin at IOrig+(0,-ed*r) + "i`'svg_sub(L)" at IOrig+(period/3,eamp*0.7) above + line from Sd.End right period/2+2*ted + Sd2: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \ + with .Origin at IOrig+(period,-ed*r) + line from Sd2.End to Id.end + IEd: axis with .end at Id.end+(0,vEd); "I`'svg_sub(D)" ljust above + ] with .sw at Fullwave.nw+(0,0.5) + +Cct1:[ diode(down_ elen_); b_current(i`'svg_sub(L),rjust,O,E); rlabel(D) + resistor(right_ elen_); rlabel(+,e`'svg_sub(L),-); llabel(,R) + line up elen_ + { "N`'svg_sub(o)" ljust below } + gap(left_ elen_); rlabel(-,e`'svg_sub(i),+) + ] at (Cct3,Halfwave) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RelaySVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RelaySVG.m4 new file mode 100644 index 00000000000..df633176b01 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RelaySVG.m4 @@ -0,0 +1,80 @@ +.PS +# `Relay.m4' +cct_init(svg_font(sans-serif,11bp__)) + +{contact + {`"contact"' wid 0.8 at last [].s+(0,-0.2) + "svg_it(P)" rjust at last [].P.w + "svg_it(O)" ljust at last [].O + "svg_it(C)" ljust at last [].C } + move right_ 1.0; contact(R,) + {`"contact(,R)"' at last [].s+(0,-0.2) + "svg_it(P)" rjust at last [].P.w + "svg_it(O)" ljust at last [].O + "svg_it(C)" ljust at last [].C } + move right_ 1.0; contact(P) + {`"contact(P)"' at last [].s+(0,-0.2) + "svg_it(P)" rjust at last [].P.w + "svg_it(O)" ljust at last [].O + "svg_it(C)" ljust at last [].C } + move right_ 1.0; contact(O,); {`"contact(O,)"' at last [].s+(0,-0.2)} + move right_ 1.0; contact(C,); {`"contact(C,)"' at last [].s+(0,-0.2)} +} +move down 0.8 +right_ +{contact(I) + {`"contact(I)"' at last [].s+(0,-0.2) + "svg_it(P)" rjust at last [].P.w + "svg_it(O)" ljust at last [].O.e + "svg_it(C)" ljust at last [].C.e } + move right_ 1.0; contact(RI) + {`"contact(RI)"' at last [].s+(0,-0.2) + "svg_it(P)" rjust at last [].P.w + "svg_it(O)" ljust at last [].O.e + "svg_it(C)" ljust at last [].C.e } + move right_ 1.0; contact(PI) + {`"contact(PI)"' at last [].s+(0,-0.2) + "svg_it(P)" rjust at last [].P.w + "svg_it(O)" ljust at last [].O.e + "svg_it(C)" ljust at last [].C.e } + move right_ 1.0; contact(OI); {`"contact(OI)"' at last [].s+(0,-0.2)} + move right_ 1.0; contact(CI); {`"contact(CI)"' at last [].s+(0,-0.2) wid 1} +} +move down 1.3 +right_ +{ +relay + {"svg_it(V1)" rjust at last [].V1 + "svg_it(V2)" ljust at last [].V2 + "svg_it(P1)" rjust at last [].P1.w + "svg_it(O1)" ljust at last [].O1 + "svg_it(C1)" ljust at last [].C1 } +`"relay"' at last [].s+(0,-0.2) +relay(2) with .sw at last [].sw+(1.2,0) + {"svg_it(V1)" rjust at last [].V1 + "svg_it(V2)" ljust at last [].V2 + "svg_it(P1)" rjust at last [].P1.w + "svg_it(O1)" ljust at last [].O1 + "svg_it(C1)" ljust below at last [].C1 + "svg_it(P2)" rjust at last [].P2.w + "svg_it(O2)" ljust at last [].O2 + "svg_it(C2)" ljust at last [].C2 } +`"relay(2)"' at last [].s+(0,-0.2) +relay(2,RPI) with .sw at last [].sw+(1.2,0) + {"svg_it(V1)" rjust at last [].V1 + "svg_it(V2)" ljust at last [].V2 + "svg_it(P1)" rjust at last [].P1.w + "svg_it(O1)" wid 0.2 ljust at last [].O1.e + "svg_it(C1)" wid 0.2 ljust at last [].C1.e+(0,2pt__) + "svg_it(P2)" rjust at last [].P2.w + "svg_it(O2)" wid 0.2 ljust at last [].O2.e+(0,-2pt__) + "svg_it(C2)" wid 0.2 ljust at last [].C2.e } +`"relay(2,RIP)"' at last [].s+(0,-0.2) +relay(2,O) with .sw at last [].sw+(1.2,0) +`"relay(2,O)"' at last [].s+(0,-0.2) +relay(2,CT) with .sw at last [].sw+(1.2,0) +`"relay(2,CT)"' at last [].s+(0,-0.2) +} + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RotboxSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RotboxSVG.m4 new file mode 100644 index 00000000000..a5686ba3939 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RotboxSVG.m4 @@ -0,0 +1,20 @@ +% Rotbox.m4 +.PS +gen_init +#nclude(dpictools.pic) + +[ + Point_(-10) + rotbox(boxwid/2,,thick 2) + Point_(30) + rotbox(,,shaded "green" outlined "blue",r=0.1) at last []+vec_(boxwid,0) + "r=0.1" at last [] + move to last [].ne + Point_(0) + [ for_(2,8,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) + sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].ne+(0.1,0) + [ for_(10,16,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0) + sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].sw+(0,-0.1) +] + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SQUIDSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SQUIDSVG.m4 new file mode 100644 index 00000000000..391587e177b --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SQUIDSVG.m4 @@ -0,0 +1,19 @@ +.PS +# SQUIDSVG.m4 +cct_init(svg_font(sans-serif,11bp__)) + +down_ +S1: SQUID + "J1" at S1.J1 above rjust wid 15bp__ + "J2" at S1.J2 above ljust + +S2: SQUID(3,dimen_*1.5,-120) at S1.e+(elen_,0) + "J1" at S2.J1 above rjust + "J2" at S2.J2 below ljust + "J3" at S2.J3 above ljust + arcrad = S2.C.rad*0.7 + arc from S2.c+(Rect_(arcrad,-135)) to S2.c+(Rect_(arcrad,-45)) \ + with .c at S2.C -> + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SVGconfig.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SVGconfig.m4 new file mode 100644 index 00000000000..372a93937bb --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SVGconfig.m4 @@ -0,0 +1,70 @@ +divert(-1) +#nclude(svg.m4)dnl +#ivert(-1) + +#Adjust scale and default lengths +define(`scaledefaults',` + scale = 1/($1) + arcrad = arcrad*($1) + arrowht = arrowht*($1) + arrowwid = arrowwid*($1) + boxht = boxht*($1) + boxrad = boxrad*($1) + boxwid = boxwid*($1) + circlerad = circlerad*($1) + dashwid = dashwid*($1) + ellipseht = ellipseht*($1) + ellipsewid = ellipsewid*($1) + lineht = lineht*($1) + linewid = linewid*($1) + moveht = moveht*($1) + movewid = movewid*($1) + textht = textht*($1) + textoffset = textoffset*($1) + textwid = textwid*($1) + linethick = linethick*($1) + maxpsht = maxpsht*($1) + maxpswid = maxpswid*($1) +') + +# Possible defaults for diagrams in mm +define(`SIdefaults',` + scale = scale*25.4 + arcrad = 5 + arrowht = 2.5 + arrowwid = arrowht/2 + boxht = 12 + boxrad = 0 + boxwid = 18 + circlerad = 5 + dashwid = 1.5 + ellipseht = 12 + ellipsewid = 18 + lineht = 12 + linewid = 12 + moveht = 12 + movewid = 12 + textht = ifsvg(4,0) + textoffset = 3 + textwid = 0 +') + +define(`local_init',` + scaledefaults(1.1) +') + +# If the variable dptextratio is not found you don't have +# dpic version 2018.05.15 or later. In that case, change +# dptextratio to 1 in the following (or delete *dptextrario ). +define(`svg_font',` +command "<g patsubst(ifelse(`$1',,, +index(`$1',font),0,`$1', +index(`$1',style),0,`$1', +style="font-family:`$1'") +,",\\")>" + ifelse(`$2',,,`textht=(`$2')*dptextratio') + ifelse(`$3',,,`textoffset=`$3'') + `$4' + ifelse(`$4',,,`command "</g>"')') + +divert(0)dnl diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SchottkySVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SchottkySVG.m4 new file mode 100644 index 00000000000..68a7037eb5f --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SchottkySVG.m4 @@ -0,0 +1,54 @@ +% SchottkySVG.m4 +.PS +# 4-input positive NAND: the Schottky option for transistors (TI TTL data book) +cct_init(svg_font(sans-serif,11bp__,1bp__)) + + tic = dimen_/4 + rlen = dimen_*3/4 + +E1: dot; line up_ tic +Q1: bi_trans(,,dEBCBUS) with .E at Here; line left tic from Q1.B; B1: Here + resistor(up_ rlen from Q1.C); llabel(,3 k`'svg_ohm); B2: dot; line right_ tic +Q2: bi_trans(up_ dimen_,,dEBCBUS) with .B at Here + line from Q2.E to (Q2.E,E1); dot +Gnd: "GND" ljust at Here+(dimen_/2,0) + dot(at Q2.C) + { line to (Gnd,Here); "Y" wid 0.3 ljust } + line to (Q1.C,Here); dot + resistor(up_ rlen); llabel(,4 k`'svg_ohm); B4: dot; line right_ tic; up_ +Q4: bi_tr with .B at Here + line from Q4.E to Q2.C + line up_ tic from B4 +Q5: bi_trans(,,dEBCBUS) with .E at Here; line left_ tic from Q5.B; B5: dot + line from Q5.C to (Q4.C,Q5.C); dot + { line to Q4.C } + resistor(up_ rlen); llabel(,120 svg_ohm); dot +Vcc: "Vcc" ljust at (Gnd,Here) + dot(at (B5,Vcc)) + resistor(to (Here,Q5.C)); llabel(,8 k`'svg_ohm) + diode(from (B4,Q2.C) to (B5,Q2.C),Z) + line to (Here,Q5.C) + diode(from B4 to (Here,B4),Z); dot + line left_ tic; up_ +Q3: bi_trans(,,dEBCBUS) with .C at Here; line left_ tic from Q3.B; B3: Here + line from Q3.E to (Q3.E,B2); dot + dot(at (B1,Here)); resistor(down_ to (Here,Q1.C)); rlabel(,1.5 k`'svg_ohm) + line to B1 + resistor(down_ from B3 to (B3,B2)); rlabel(,12 k`'svg_ohm); line to B2 + line from Vcc to (B3,Vcc); resistor(down_ to (Here,Q5.C)) + rlabel(,20 k`'svg_ohm) + line to B3 + ground(at (Q3.C,Gnd),,F); dot + + for_(0,3,1, + `dot(at (B3+(0,tic*m4x))) + line left_ tic*m4x; diode(left_ dimen_,Z); dot + {line down_ dimen_; reversed(`diode',down_ dimen_,Z); line to (Here,Gnd) \ + ifelse(m4x,3,`then to Gnd',`; dot') } + line left_ tic*eval(4-m4x) + "ifelse(m4x,3,D,m4x,2,C,m4x,1,B,m4x,0,A)" wid 0.15 rjust + ') + + command "</g>" # end font +.PE + diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ShiftRSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ShiftRSVG.m4 new file mode 100644 index 00000000000..9c8aa65a1c3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ShiftRSVG.m4 @@ -0,0 +1,51 @@ +.PS +# ShiftR.m4 +log_init(svg_font(sans-serif,11*0.9bp__)) + +define(`lg_plen',3) + +define(`customFF', + `FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,, + : S;NE:CK;: R, N:PR, :Q;;ifelse(`$1',1,:Q), N:CLR, + ifelse(`$1',1,line right 5bp__ at 2nd last ""+(-7bp__,4bp__)))') + + F0: customFF(1) + + BUFFER_gate(,N) with .Out at F0.W1.end + line left 2*L_unit from last [].In1 + T: dot + reversed(`NOT_gate',left 10*L_unit) + {move left textht*8} + Serial: "SERIAL" rjust "INPUT" rjust + line from T to (T,F0.W3) then to F0.W3.end + + NCLR: NOT_gate(right T.x-Serial.x from (Serial,F0.S1.end),N) + "CLEAR" at NCLR.start rjust + line left textht*2.3 from last ""+(-0.3,0.6)*textht + + CLK: NOT_gate(right T.x-Serial.x from NCLR.start+(0,-BUF_ht*3/2*L_unit)) + "CLOCK" at CLK.start rjust + +for_(1,4,1,` + F`'m4x: customFF(eval(m4x!=4)) with .W3.end at F`'eval(m4x-1).E3.end + ') + + "OUTPUT" wid 0.7 at F4.E1.end ljust + line from NCLR.end to F4.S1.end + + down_ +for_(0,4,1,` + line from F`'m4x.W2.end down F0.W2.y-CLK.y + ifelse(eval(m4x!=4),1,`dot',`line to CLK.end') + N`'m4x: NAND_gate with .Out at F`'m4x.N1.end + line up 2*L_unit from N`'m4x.In2 + { line up 6*L_unit from N`'m4x.In1 + "PR`'eval(4-m4x)" rjust } + ifelse(eval(m4x!=4),1, + `dot; dot(at F`'m4x.S1.end)', + `line to (Serial,Here) + "PRESET" rjust "ENABLE" rjust ') + ') + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SierpinskiSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SierpinskiSVG.m4 new file mode 100644 index 00000000000..3a014b8a0f5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SierpinskiSVG.m4 @@ -0,0 +1,26 @@ +.PS +# Sierpinski.m4 +gen_init + define Sierpinski { + if $1 > 0.04 then { + d = $1/2-lh + shade(1,line from $2+(d/2,d/2*s3+lw*2) right d/2 up d/2*s3 then left d*2 \ + then right d down d*s3 then right d/2 up d/2*s3 ) + Sierpinski($1/2,$2-($1/2,0)) + Sierpinski($1/2,$2+($1/2,0)) + Sierpinski($1/2,$2+(0,$1*s3/2)) + } + } + + r = 4 + linethick = 0.2 + lw = linethick pt__ /2 + s3 = sqrt(3) + lh = lw*s3 + A: 3,3 + d = r/2-lh + shade(0,line from A+(0,lw) right d then up d*s3 left d then down d*s3 left d\ + then right d ) +# psset_(linecolor=white) + Sierpinski(r/2,A) +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SixpoleSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SixpoleSVG.m4 new file mode 100644 index 00000000000..430c0450697 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SixpoleSVG.m4 @@ -0,0 +1,25 @@ +.PS +# sixpole.m4 +define(`biquad',`[ +In: Here + resistor(right_) +E: dot + resistor + dot + {capacitor(down_,C); ground(,T)} + line right_ elen_/3 + { dot + line up_ elen_ + amp(to (E,Here),elen_/2) + capacitor(from E to Here,C) } + amp(right_,elen_/2) + Out: Here + ]') + +cct_init +define(`elen_',linewid) + + biquad + biquad with .In at last [].Out+(-linewid/4,0) + biquad with .In at last [].Out+(-linewid/4,0) +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SourcesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SourcesSVG.m4 new file mode 100644 index 00000000000..8096317a5d4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SourcesSVG.m4 @@ -0,0 +1,47 @@ +.PS +# `SourcesSVG.m4' +cct_init(svg_font(sans-serif,11bp__)) +textwid = 0.7 +movewid = 2pt__ +moveht = 0.275 +define(`NL',`; move down $1; right_') +{ + {source ; move ; "`source'" ljust} NL + {source(,I) ; move ; "`source(,I)'" ljust} NL + {source(,i) ; move ; "`source(,i)'" ljust} NL + {source(,V) ; move ; "`source(,V)'" ljust} NL + {source(,v) ; move ; "`source(,v)'" ljust} NL + {source(,AC); move ; "`source(,AC)'" ljust} NL + {source(,X) ; move ; "`source(,X)'" ljust} NL + {source(,F) ; move ; "`source(,F)'" ljust} NL + {source(,G) ; move ; "`source(,G)'" ljust} NL + {source(,Q) ; move ; "`source(,Q)'" ljust} +} + move right_ 2.0 +{ + {source(,,0.4) ; move ; "`source(,,0.4)'" ljust} NL(0.35) + {source(,P) ; move ; "`source(,P)'" ljust} NL + {source(,U) ; move ; "`source(,U)'" ljust} NL + {source(,H) ; move ; "`source(,H)'" ljust} NL + {source(,R) ; move ; "`source(,R)'" ljust} NL + {source(,S) ; move ; "`source(,S)'" ljust} NL + {source(,T) ; move ; "`source(,T)'" ljust} NL + {source(,L) ; move ; "`source(,L)'" ljust} NL + {source(,B) ; move ; "`source(,B)'" ljust} NL(moveht*0.8) + {nullator ; move ; "`nullator'" ljust} NL(moveht*0.6) + {norator ; move ; "`norator'" ljust} +} + move right_ 2.0 + {source(,N) ; move ; "`source(,N)'" ljust} NL + {source(,"svg_micro(A)"); move; "`source(,\"svg_micro(A)\")'" \ + wid 1.7 at Here ljust}NL(0.31) + {consource ; move ; "`consource'" ljust } NL(0.32) + {consource(,I) ; move ; "`consource(,I)'" ljust} NL(0.32) + {consource(,i) ; move ; "`consource(,i)'" ljust} NL(0.32) + {consource(,V) ; move ; "`consource(,V)'" ljust} NL(0.32) + {consource(,v) ; move ; "`consource(,v)'" ljust} NL(0.3) + {battery ; move ; "`battery'" ljust} NL + {battery(,3,R) ; move ; "`battery(,3,R)'" ljust} + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4 new file mode 100644 index 00000000000..8808e5be277 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4 @@ -0,0 +1,103 @@ +.PS +# SwitchesSVG.m4 +cct_init(svg_font(sans-serif,11bp__,2bp__)) +textoffset = 3bp__ + +movewid = 0.25 +moveht = moveht*1.25 + right_; { + lswitch; rlabel(,"``lswitch''") + move right_ + lswitch(,,O); rlabel(,"`(,,O)'") + move right_ + lswitch(,,C); rlabel(,"`(,,C)'") + move right_ + lswitch(,,DA); rlabel(,"`(,,DA)'") + move right_ + lswitch(,,DO); rlabel(,"`(,,DO)'") + move right_ + lswitch(,,DC); rlabel(,"`(,,DC)'") + } + move down; right_; { + lswitch(,,K); rlabel(,"`(,,K)'") + move right_ + lswitch(,,KD); rlabel(,"`(,,KD)'") + move right_ + lswitch(,,KOD); rlabel(,"`(,,KOD)'") + move right_ + lswitch(,,KCD); rlabel(,"`(,,KCD)'") + move right_ + bswitch; rlabel(,"``bswitch''") + move right_ + bswitch(,,C); rlabel(,"`(,,C)'") + } + move down; right_; { + S: dswitch(,,) + ifgpic(`{[line invis] at S.c+(0,-0.2)}') + rlabel(,"``dswitch=''") + { "`switch(,,,D)'" at last [].s + (0,-0.23) } + thinlines_ + { spline <- from 0.25 along_(S) up 0.1 then up 0.05 left 0.1 + "W" wid 8bp__ at Here+(-5bp__,0) + spline <- from S.c+(0,m4sc*2) up 0.1 then up 0.05 left 0.1 + "B" wid 5bp__ at Here+(-5bp__,0) } + thicklines_ + move right_ + S: dswitch(,,WdBK); rlabel(,"`(,,WdBK)'") + thinlines_ + { spline <- from tr_xy(0,-2) up 0.1 then up 0.10 left 0.1 + "dB" rjust + spline <- from tr_xy(4,-2) right 0.1 then right 0.05 up 0.15 + "K" above } + thicklines_ + move right_ + dswitch(,,WBuD); rlabel(,"`(,,WBuD)'") + move right_ + dswitch(,,WdBKF); rlabel(,"`(,,WdBKF)'") + move right_ + dswitch(,,WBL); rlabel(,"`(,,WBL)'") + move right_ + dswitch(,,WdBKL); rlabel(,"`(,,WdBKL)'") + } + move down; right_; { + dswitch(,,WBT); rlabel(,"`(,,WBT)'") + move right_ + dswitch(,,WdBKC); rlabel(,"`(,,WdBKC)'") + move right_ + dswitch(,,WBM); rlabel(,"`(,,WBM)'") + move right_ + dswitch(,,WBCO); rlabel(,"`(,,WBCO)'") + move right_ + dswitch(,,WBMP); rlabel(,"`(,,WBMP)'") + move right_ + dswitch(,,WBoKCP); rlabel(,"`(,,WBoKCP)'") + } + move down; right_; { + dswitch(,,WBCY); rlabel(,"`(,,WBCY)'") + move right_ + dswitch(,,WBCZ); rlabel(,"`(,,WBCZ)'") + move right_ + dswitch(,,WBCE); rlabel(,"`(,,WBCE)'") + move right_ + dswitch(,,WBRH); rlabel(,"`(,,WBRH)'") + move right_ + dswitch(,,WBRdH); rlabel(,"`(,,WBRdH)'") + move right_ + dswitch(,,WBRHH); rlabel(,"`(,,WBRHH)'") + } + move down; right_; { + dswitch(,,WBMMR); rlabel(,"`(,,WBMMR)'") + move right_ + dswitch(,,WBMM); rlabel(,"`(,,WBMM)'") + move right_ + dswitch(,,WBMR); rlabel(,"`(,,WBMR)'") + move right_ + dswitch(,,WBEL); rlabel(,"`(,,WBEL)'") + move right_ + dswitch(,,WBLE); rlabel(,"`(,,WBLE)'") + move right_ + dswitch(,,WdBKEL); rlabel(,"`(,,WdBKEL)'") + } + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TTLnandSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TTLnandSVG.m4 new file mode 100644 index 00000000000..e1d7d4dae14 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TTLnandSVG.m4 @@ -0,0 +1,55 @@ +.PS +# TTLnand.m4 +cct_init(svg_font(sans-serif,11bp__,1bp__)) + + up_ +Q3: bi_tr + "Q3" at Q3.E above ljust + dot(at Q3.C); reversed(`diode',up_ dimen_/2) +Q4: bi_tr with .E at Here + "Q4" at Q4.E above ljust + resistor(up_ dimen_ from Q4.C); rlabel(,`svg_norm(130 svg_ohm)') +V: dot + line left_ dimen_*0.75 from Q4.B; dot + line left_ dimen_*0.75 from Q3.B; dot +Q2: bi_tr(up_ Q4.B.y-Q3.B.y) with .E at Here + "Q2" at 1/2 between Q2.E and Q2.C ljust + resistor(from Q2.C to (Q2.C,V)); rlabel(,`svg_norm(1.6 k`'svg_ohm)'); dot + resistor(from Q2.E down_ dimen_); llabel(,`svg_norm(1 k`'svg_ohm)') + line to (Q4.E,Here) +G: dot + line to Q3.E + line left_ dimen_/4 from Q2.B + right_ +Q1: bi_trans(,,BCdE2BU) with .C at Here + "Q1" at Q1.Bulk above rjust + resistor(up_ from Q1.B to (Q1.B,V)); rlabel(,svg_norm(4 k`'svg_ohm)) + line to V + + line left dimen_ from Q1.E2 +X1: dot; "X1" wid 0.2 rjust above at last [].w +X2: dot(at (X1,Q3.C)); "X2" rjust at last [].w + AA: line invis right dimen_ from X2 + line from X2 to Intersect_(AA,Q1.Em1) then to Q1.E1 +X3: dot(at 2 between X1 and X2); "X3" rjust below at last [].w + AA: line invis right dimen_ from X3 + line from X3 to Intersect_(AA,Q1.Em0) then to Q1.E0 + +W: X2+(dimen_/2,0) +N: V+(0,dimen_/4) +S: (N.x,N.y-2*(N.y-W.y)) + line from V to 2 between V and N +Vcc:dot; "+5 svg_norm(V)" ljust at last [].e + line from G to (G,S) + ground + line from N to (W,N) then to (W,S) then to S + arc rad N.y-W.y ccw to N with .c at 1/2 between N and S + + line right (N.y-S.y)/2+dimen_/2 from Q3.C +Z: dot + lw = 1.05 + "svg_it(Z = X1 . X2 . X3)" wid lw ljust + line left lw*0.73 from last "".ne+(0,2*textoffset) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TgateSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TgateSVG.m4 new file mode 100644 index 00000000000..35054606391 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TgateSVG.m4 @@ -0,0 +1,53 @@ +.PS +# Tgate.m4 +cct_init(svg_font(sans-serif,11bp__)) + +right_ + +[ { Q: tgate + "A" at Q.A rjust + "B" at Q.B ljust + "G" at Q.G ljust below + "Gb" at Q.Gb ljust above + `"tgate"' wid 0.5 at Q.A-(0.25,0) rjust + } + + move down_ linewid; right_ + { Q: tgate(,L) + "A" at Q.A rjust + "B" at Q.B ljust + "G" at Q.G rjust above + "Gb" at Q.Gb ljust below + `"tgate(,L)"' at Q.A-(0.25,0) rjust + move left 0.75; right + } + ] + +[ { Q: tgate(,B) + "A" at Q.A rjust + "B" at Q.B ljust + "G" at Q.G ljust + `"tgate(,B)"' at Q.G-(0,10bp__) below + } + ] with .Q.A at last [].Q.B+(0.5,linewid/2) + +[ { Q: ptrans + "A" at Q.A rjust + "B" at Q.B ljust + "G" at Q.G rjust below + "Gb" at Q.Gb rjust + `"ptrans"' at Q.B+(0.25,0) ljust + } + + move down_ linewid; right_ + { Q: ptrans(,L) + "A" at Q.A rjust + "B" at Q.B ljust + "G" at Q.G ljust above + "Gb" at Q.Gb ljust below + `"ptrans(,L)"' wid 0.75 at Q.B+(0.25,0) ljust + } + ] with .Q.Gb at (last [].e.x+elen_/2+0.5,1st [].Q.Gb.y) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ThreeSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ThreeSVG.m4 new file mode 100644 index 00000000000..29a784eead2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ThreeSVG.m4 @@ -0,0 +1,47 @@ +.PS +# ThreeSVG.m4: three-phase oscillator +cct_init(svg_font(sans-serif,11bp__)) + +define(`section',`[ I: Here + resistor(right elen_*0.75); llabel(,R/2) +T: dot + line down dimen_/2 then right_ dimen_/4 + Amp: opamp(,,,,,{ + rgbfill(0.9*255,0.6*255,0.1*255,line to N then to E then to S then to Here) + "-" at In1 ljust + "+" at In2 ljust } + ) with .In1 at Here + line left dimen_/4 from Amp.In2 then down dimen_/4; G: ground(,,) + resistor(from T to (Amp.Out,T)); llabel(,R) +O: dot + { arrow up dimen_*0.5 then right dimen_/4 up dimen_/4 + "`$1'" above } + line to Amp.Out + dot(at T+(dimen_/4,0)); line up dimen_*0.6 + capacitor(right_ Amp.Out.x-Here.x-dimen_/4,C); llabel(,2C) + line to (Here,T); dot + ]') + +A: section(svg_symbol(0&`#'176;)) +B: section(svg_symbol(120&`#'176;)) with .I at A.O +C: section(svg_symbol(-120&`#'176;)) with .I at B.O + move right 22pt__ from C.O + + ground(at (A.I,A.G)+(dimen_/3,0),,) +P:potentiometer(down_ dimen_/2,,0.75,dimen_/2) with .End at Here + line from P.Start to (A.I,P.Start); dot + resistor(up_ dimen_*0.75 from P.T1) + line to A.T + + dot(at B.Amp.Out+(dimen_/3,0)); { "svg_it(V`'svg_sub(c))" at last [].n above } + resistor(down_ dimen_*0.75) + { dot; line right (C.T.x-Here.x)/2 + reversed(`diode',up_ dimen_) + line to C.T } + resistor(down_ dimen_*0.75) + dot + line from C.O right dimen_/4 then down C.O.y-Here.y then to (A.I,Here) \ + then to A.I + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TimerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TimerSVG.m4 new file mode 100644 index 00000000000..dcdb2cc4774 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TimerSVG.m4 @@ -0,0 +1,51 @@ +.PS +# TimerSVG.m4 +cct_init(svg_font(sans-serif,11bp__,1bp__)) + +define(`ic555',`[Chip: box ht boxwid wid boxwid "555" + P7: "7" ljust at 1/6<Chip.sw,Chip.nw> + P6: "6" ljust at 1/2<Chip.sw,Chip.nw> + P2: "2" ljust at 5/6<Chip.sw,Chip.nw> + P4: "4" below at 1/3<Chip.nw,Chip.ne> + P8: "8" below at 2/3<Chip.nw,Chip.ne> + P3: "3" rjust at Chip.e + P1: "1" above at Chip.s + ]') + + define(`elen_',`linewid') +Vs: dot + down_ + variable(`resistor(,E); llabel(,svg_norm(1 M`'svg_ohm))'); + resistor(,E); llabel(,svg_norm(100 k`'svg_ohm)) + capacitor(,E); llabel(svg_norm(220 svg_micro`'F)) +Zero: dot + + dot(at Vs+(elen_*4/3,0)) + resistor(,E); llabel(,svg_norm(33 k`'svg_ohm)) + line to (Here,Zero) chop 0 chop elen_ +C2: capacitor; llabel(svg_norm(0.1 svg_micro`'F)) + dot + +IC1: ic555 with .P7 at C2.start + (elen_,0) + line from IC1.P4 to (IC1.P4,Vs); dot + line from IC1.P8 to (IC1.P8,Vs); dot + line from IC1.P1 to (IC1.P1,Zero); dot + line from IC1.P2 to (C2,IC1.P2); dot + crossover(from IC1.P7 to (Zero,IC1.P7),R,C2); dot + line from IC1.P6 left elen_/2 then down IC1.P6.y-IC1.P7.y; dot + line from IC1.P3 right elen_*2/3 +R: dot + line right_ elen_/3 +B: buzzer(,,C) with .In3 at Here + line from B.In1 to (R,B.In1) + reversed(`diode',to (Here,Vs),LE); "red" at last line.c+(elen_/2,0) + resistor(down_ elen_ from R,E); llabel(,svg_norm(470 svg_ohm)) + diode(to (Here,Zero),LE); {"green" wid 0.4 at last line.c+(elen_*2/3,0)} + line to Zero chop 0 chop -elen_ + line up_ (Vs.y-Here.y)/3 + battery(up_ (Vs.y-Here.y)/3); rlabel(,,svg_norm(9 V)) + switch(to (Here,Vs),,D) + line to (R,Vs) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TtreeSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TtreeSVG.m4 new file mode 100644 index 00000000000..2b779191b72 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TtreeSVG.m4 @@ -0,0 +1,70 @@ +.PS +# Ttree.m4 +# A binary tree using m4 +gen_init +sinclude(tst.dim) +s_init(Ttree) + +# `Node(no in row, head [location], +# displacement of top of body (.n) wrt head, +# body Node 1, body Node 2, ...) ' +define(`Node',` + Head`$1': `$2' + ifelse(`$3',,,` Body`$1': [ + Loopover_(`v',`v; define(`m4ct',m4Lx)',shift(shift(shift($@)))) + ] with .n at Head`$1' + `$3' + connect(`$1',m4ct)')') + +define(`connect',`Bot: move from Head$1.sw-(0,5bp__) to Head$1.se-(0,5bp__) +for_(1,`$2',1, + `Top: move from Body$1.Head`'m4x.nw+(0,2bp__) \ + to Body$1.Head`'m4x.ne+(0,2bp__) + Mov: move from Head$1 to Body$1.Head`'m4x + if Bot.len*Top.len*Mov.len > 0 then { + line from Intersect_(Mov,Top) to Intersect_(Mov,Bot)}')') + + vsep = 0.75 +define(`txw',`wid `$1'mm__')dnl scaled by 14/12 for 14 pt type + + Node(1,"svg_it(h(h(h(x`'svg_sub(1),x`'svg_sub(2))," \ + + "h(x`'svg_sub(3),x`'svg_sub(4))),h(h(x`'svg_sub(5),x`'svg_sub(6))," \ + + "h(x`'svg_sub(7),x`'svg_sub(8)))))" txw(70) , + (0,-vsep), + Node(1,"svg_it(h(h(x`'svg_sub(1),x`'svg_sub(2)),h(x`'svg_sub(3)," \ + + "x`'svg_sub(4))))" txw(32) , + (0,-vsep), + Node(1,"svg_it(h(x`'svg_sub(1),x`'svg_sub(2)))" txw(14) , + (0,-vsep), + Node(1,"svg_it(x`'svg_sub(1):=((A,pk`'svg_sub(A)),h`'svg_sub(1)))" \ + txw(29) ), + Node(2,"svg_it(x`'svg_sub(2):=((B,pk`'svg_sub(B)),h`'svg_sub(2)))" \ + txw(29) with .n at last "".ne+(0.2,-vsep*2/3))), + Node(2,"svg_it(h(x`'svg_sub(3),x`'svg_sub(4)))" txw(14) \ + with .nw at Head1.ne+(Body1.wid/2+0.1,0), + (0,-vsep), + Node(1,"svg_it(x`'svg_sub(3):=" \ + + "((A,pk`'svg_prime`'svg_sub(A,,,-0.5ex)),h`'svg_sub(3)))" \ + txw(29)), + Node(2,"svg_it(x`'svg_sub(4):=((D,pk`'svg_sub(D)),h`'svg_sub(4)))" \ + txw(29) with .n at last "".ne+(0.2,-vsep*2/3)))), + Node(2,"svg_it(h(h(x`'svg_sub(5),x`'svg_sub(6)),h(x`'svg_sub(7)," \ + + "x`'svg_sub(8))))" txw(29) with .nw at Head1.ne+(Body1.wid/2,0), + (0,-vsep), + Node(1, "svg_it(h(x`'svg_sub(5),x`'svg_sub(6)))" txw(14) , + (0,-vsep*5/4), + Node(1,"svg_it(x`'svg_sub(5):=((E,pk`'svg_sub(E)),h`'svg_sub(5)))" \ + txw(29) ), + Node(2,"svg_it(x`'svg_sub(6):=((H,pk`'svg_sub(H)),h`'svg_sub(6)))" \ + txw(29) with .n at last "".ne+(0.2,-vsep*2/3))), + Node(2,"svg_it(h(x`'svg_sub(7),x`'svg_sub(8)))" txw(14) \ + with .nw at Head1.ne+(Body1.wid/2+0.1,0), + (0,-vsep*5/4), + Node(1,"svg_it(x`'svg_sub(7):=" \ + + "((D,pk`'svg_prime`'svg_sub(D,,,-0.5ex)),h`'svg_sub(7)))" \ + txw(29) ), + Node(2,"svg_it(x`'svg_sub(8):=((K,pk`'svg_sub(K)),h`'svg_sub(8)))" \ + txw(29) with .n at last "".ne+(0.2,-vsep*2/3))), + Node(3,"svg_it(h(x`'svg_sub(9)))" txw(8) \ + at 0.5 between Head1 and Head2))) + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/VariableSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/VariableSVG.m4 new file mode 100644 index 00000000000..642b81466ac --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/VariableSVG.m4 @@ -0,0 +1,36 @@ +.PS +# `Variable.m4' +cct_init(svg_font(sans-serif,11bp__)) + +define(`elen_',dimen_) +down_ +[ { variable(`capacitor') } + move right; down_ + { variable(`resistor',uN) } + move right; down_ + { variable(`capacitor(,C)') } + move right; down_ + { variable(`inductor') } + move right; down_ + { variable(`inductor(,W)') } + ] +[ + skp = 0.4 + hskip = linewid*0.5 + cskip = hskip +Orig: Here + { move right cskip + move right elen_; move up 0.15 then down 0.15 then right_ hskip + line invis right_ elen_ "C"; move right_ hskip + line invis right_ elen_ "S" } + Loopover_(`char', + `move down skp ifelse(char,A,*0.5) + { line invis right_ cskip "char" + variable(`capacitor(,C)',char); move right_ hskip + variable(`capacitor(,C)',char`'C); move right_ hskip + variable(`capacitor(,C)',char`'S) }', + A,P,L,N) + ] with .w at last [].e+(0.4,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/WindingsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/WindingsSVG.m4 new file mode 100644 index 00000000000..0ead17d87f0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/WindingsSVG.m4 @@ -0,0 +1,102 @@ +.PS +# Windings.m4 +cct_init(svg_font(sans-serif,11bp__)) +textoffset = 3bp__ + +define(`vlight',`rgbstring(0.9,0.9,0.9)') +define(`lightgray',`rgbstring(0.7,0.7,0.7)') + +[ winding ] + `"winding"' at last [].s below + +[ winding(R) ] with .n at last "".s+(0,-0.1) + `"winding(R)"' wid 1 at last [].s below + +[ sk = 0.75 + d = 1.5*sk + p = 0.4*sk + w = 1*sk + +W: winding(L,d,p,4,w,vlight) + +thinlines_ + dimension_(from W.nw+(p/4,0) right p,0.1,"pitch" above,0.3) + dimension_(from W.sw to W.nw,0.2,diam,0.3) + dimension_(from W.e+(-p/2,-w/2) up w,-0.3,,0.2) + "core wid" wid 0.75 at W.e ljust + arrow <- up d-w+0.1 left d/10 from W.ne+(-p/2,-(d-w)) + "core color" at Here+(-0.2,0) ljust above +thicklines_ +] with .sw at last [].se+(0.25,0) + "T1" at last [].W.T1 below + "T2" at last [].W.T2 below + +[ +#`winding(L|R, diam, pitch, nturns, core wid, core color )' +boxwid = 0.3 +boxht = 0.4 + down_ +B1: box + winding(,boxwid*1.3,boxht/5,3,boxwid) at B1 + "Left pins" "cw" at B1.s+(0,-0.15) + for_(1,2,1,`"svg_small(T`'m4x)" at last [].T`'m4x rjust') +B2: box at B1.e + (0.5,0) + winding(R,boxwid*1.3,boxht/5,3,boxwid) at B2 + "Left pins" "ccw" at B2.s+(0,-0.15) + for_(1,2,1,`"svg_small(T`'m4x)" at last [].T`'m4x rjust') + up_ +B3: box at B1.s + (0,-0.55) + winding(,boxwid*1.3,boxht/5,3,boxwid) at B3 + "Right pins" "cw" at B3.s+(0,-0.15) + for_(1,2,1,`"svg_small(T`'m4x)" at last [].T`'m4x ljust') +B4: box at (B2,B3) + winding(R,boxwid*1.3,boxht/5,3,boxwid) at B4 + "Right pins" "ccw" at B4.s+(0.07,-0.15) + for_(1,2,1,`"svg_small(T`'m4x)" at last [].T`'m4x ljust') +] with .sw at last [].se+(0,-0.15) + +[ + Q: box invis ht 1 wid 5/4 + g = Q.wid/12 + ironwid = Q.wid/4.5 + + line thick ironwid/(1bp__)+linethick from Q.n+(g/2-linethick/2 bp__,0) \ + to Q.ne then to Q.se then to Q.sw then to Q.nw \ + then to Q.n+(-g/2+linethick/2 bp__,0) + line thick ironwid/(1bp__)-linethick outlined lightgray \ + from Q.n+(g/2+linethick/2 bp__,0) \ + to Q.ne then to Q.se then to Q.sw then to Q.nw \ + then to Q.n+(-g/2-linethick/2 bp__,0) + +thinlines_ + dimension_(from Q.n+(-g/2,-ironwid/2) right g,-ironwid/4, + "svg_it(g)" below,1,2pt__) +thicklines_ + + down_ + P: winding(R,ironwid*5/4,ironwid/2,4,ironwid,lightgray) at Q.w + line left ironwid*2/3 from P.T1 + arrow right to P.T1 "svg_it(i`'svg_sub(1))" above + line left ironwid*2/3 from P.T2 + gap(up_ to 2nd last line.end) + llabel(-,svg_it(v`'svg_sub(1)),+) + "svg_it(N`'svg_sub(1))" at P.e ljust + + up_ + S: winding(L,ironwid*5/4,ironwid/2,4,ironwid,lightgray) at Q.e + line right ironwid*2/3 from S.T2 + arrow left to S.T2 "svg_it(i`'svg_sub(2))" above + line right ironwid*2/3 from S.T1 + gap(up_ to 2nd last line.end) + rlabel(-,"svg_it(v`'svg_sub(2))" wid 0.2,+) + "svg_it(N`'svg_sub(2))" at S.w rjust + + box dashed rad ironwid/4 wid Q.wid ht Q.ht at Q + arrow right arrowht from 0.5 between Q.n and Q.ne + + move up ironwid/2 from Q.n + move down ironwid/2 from Q.s +] with .sw at last [].se+(0.25,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XORSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XORSVG.m4 new file mode 100644 index 00000000000..c0f5613dbdb --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XORSVG.m4 @@ -0,0 +1,67 @@ +.PS +# `XORSVG.m4' +# Realizations of the XOR function +log_init +scale = 2.54 + +define(`gatelineth',1.6) # gate line thickness +define(`lineth',0.8) # connection thickness + +define(`labels',` + "svg_it(A)" at last [].InA above wid 0.25 + "svg_it(B)" at last [].InB above wid 0.25 + "svg_it(A) O`'svg_sup(+,100,0,-1.4ex) svg_it(B)" at last [].Out ljust wid 1.2 +#"svg_it(A) svg_font(Latin,,,"O")`'svg_sup(+,100,0,-1.4ex) svg_it(B)" at last [].Out ljust +') + +# single gate + XOR: Autologix(Xor(A,B)) + labels + +# canonical form + Autologix(Or(And(A,Not(B)),And(Not(A),B))) \ + with .nw at last [].sw+(0,-1) + labels + +# mixed gates + Autologix(And(Nand(A,B),Or(A,B))) \ + with .nw at last [].nw+(8,0) + labels + +# nand realization + Autologix(Nand(Nand(Nand(A,A),B),Nand(Nand(B,B),A))) \ + with .nw at 2nd last [].sw+(0,-1) + labels + +# nor realization + Autologix(Nor(Nor(Nor(A,A),Nor(B,B)),Nor(A,B))) \ + with .nw at last [].nw+(8,0) + labels + +# These functions contain topologies in common so write a macro +define(`customAB', + `S: Autologix(N`$1'(N`$1'(A,B1),N`$1'(B1,B)),N) with .Out at Here + line thick lineth from S.In2 to S.In3; InAB: dot(at last line.c) + line thick lineth from InAB left 2*L_unit + TN: Autologix(N`$1'(A,B)) with .Out at Here + line thick lineth from TN.InA up 3*L_unit; InA: Here + line thick lineth from TN.InB up 3*L_unit; InB: Here + line thick lineth from S.In4 to (InB,S.In4) then to (InB,TN.In2); dot + line thick lineth from S.In1 to (InA,S.In1); dot') + + [ customAB(and) + Out: S.Out + ] with .nw at 2nd last [].sw+(0,-1) + labels + + [ linethick = gatelineth + H: NOR_gate(2); linethick = lineth + L:dot(at H.w-(2*L_unit,0)) + line from H.In1 to (L,H.In1) then to (L,H.In2) then to H.In2 + line from L left 2*L_unit + customAB(or) + Out: H.Out + ] with .nw at last [].nw+(8,0) + labels + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XformSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XformSVG.m4 new file mode 100644 index 00000000000..8d8805f59b7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XformSVG.m4 @@ -0,0 +1,41 @@ +divert(-1) +# `XformSVG.m4' +define(`trlabels', + `{ thinlines_ + ifelse(`$1',R, + `arrow from `$3'.P1 <- right 0.12 up 0.072 chop 1pt__ ; "P1" ljust + arrow from `$3'.P2 <- right 0.12 down 0.072 chop 1pt__ ; "P2" ljust + arrow from `$3'.TP <- right 0.12 chop 1pt__ ; "TP" ljust + arrow from `$3'.S1 <- left 0.12 up 0.072 chop 1pt__ ; "S1" rjust + arrow from `$3'.S2 <- left 0.12 down 0.072 chop 1pt__ ; "S2" rjust + arrow from `$3'.TS <- left 0.12 chop 1pt__ ; "TS" rjust + ',` + arrow from `$3'.P1 <- left 0.12 up 0.072 chop 1pt__ ; "P1" rjust + arrow from `$3'.P2 <- left 0.12 down 0.072 chop 1pt__ ; "P2" rjust + arrow from `$3'.TP <- left 0.12 chop 1pt__ ; "TP" rjust + arrow from `$3'.S1 <- right 0.12 up 0.072 chop 1pt__ ; "S1" ljust + arrow from `$3'.S2 <- right 0.12 down 0.072 chop 1pt__ ; "S2" ljust + arrow from `$3'.TS <- right 0.12 chop 1pt__ ; "TS" ljust + ') + `"'`$2'`"' at `$3'.s+(0,-(`$4')) + thicklines_ } ') +divert(0)dnl +.PS +cct_init(svg_font(sans-serif,11bp__)) + +move right 0.5 + down_ + T1: transformer + trlabels(,`transformer',T1,0.3) + T2: transformer(down_ 0.6,,2,P,8) with .w at T1.e+(1,0) + trlabels(,`...(down_ 0.6,,2,P,8)',T2,0.3) + T3: transformer(,,8,WD12,4) with .w at T2.e+(1,0) + trlabels(,`...(,,8,WD12,4)',T3,0.23) + T4: transformer(,,9,AL) with .sw at T3.se+(1,0) + trlabels(,`...(,,9,AL)',T4,0.3) + T5: transformer(,R,8,AW) with .sw at T4.se+(1,0) + trlabels(R,`...(,R,8,AW)',T5,0.3) +move right 0.4 from last [].e + +command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4 new file mode 100644 index 00000000000..53db5c6312a --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4 @@ -0,0 +1,97 @@ +.PS +# control.m4 +#.PS 5i +cct_init(svg_font(sans-serif,11bp__)) + linewid = linewid*0.8 + circlerad = 0.35/2 + bw = boxwid/2 + bh = boxht/2 +PID: [ + {"svg_it(r(s))" above ljust} + arrow +S1: circle + line right "svg_it(e(s))" above + { arrow right ; box ht bh wid bw "svg_it(K`'svg_sub(p))" + arrow right linewid-circlerad ; S2: circle } + { line up linewid ; arrow right ; box ht bh wid bw "svg_it(K`'svg_sub(D) s)" + line to (S2,Here) ; arrow to S2.n } + { line down linewid ; arrow right + box ht bh wid bw "svg_it(K`'svg_sub(I) /s)" + line to (S2,Here) ; arrow to S2.s } + arrow right from S2.e "svg_it(u(s))" above + box "svg_it(G(s))" + arrow right ; "svg_it(y(s))" above rjust at Here+(0,2pt__) + line down boxht*3/2 from last arrow.c then left last arrow.c.x-S1.x + arrow to S1.s + "-" below rjust + ] + "(a) PID control" below ljust at PID.sw+(0,-5pt__) + +Obs: [ {"svg_it(r)" above ljust} + arrow +S: circle + "-" below rjust at S.s + arrow <- down linewid/2 from S.s + box ht bh wid bw "svg_it(K)" + arrow <- down linewid/2 + line right linewid "svg_it(z)" above +Obs:box wid linewid*5.5 ht boxht*5/4 "svg_it(dz/dt = (A - LC) z + B u + L y)" + "Observer" above ljust at Obs.sw + arrow <- right linewid/2 from 3/4<Obs.se,Obs.ne> + line to (Here,S) + {"svg_it(u)" above at Here+(linewid/2,0)} + arrow from S.e to Here+(linewid,0) +Plant: box wid boxwid*1.7 ht boxht*5/4 \ + "svg_it(dx/dt = Ax + Bu)" "svg_it(y = Cx)" + "Plant" above ljust at Plant.sw + arrow right from Plant.e + "svg_it(y)" above rjust at Here+(0,2pt__) + move to last arrow.c + line to (Here, 1/4<Obs.se,Obs.ne>) + arrow to (Obs.e,Here) + ] with .nw at PID.sw+(0,-0.5) + "(b) Output feedback with a full-order observer" below ljust \ + at Obs.sw+(0,-5pt__) + +NL: [boxwid = boxwid*1.8 + boxht = boxht*3/2 + thicklines_ + scale = scale*0.8 + circlerad = 0.3/2 +R: box wid boxwid*5/4 "reference" "svg_it(R)" + arrow right linewid*4/3 "svg_it(y`'svg_sub(c ref))" above +Gh: box wid boxwid*5/4 "\"inverse\"" "of svg_it(G)" + arrow from Gh.s down "svg_it(y`'svg_sub(m ref))" ljust +E: circle + arrow from E.e right "svg_it(e)" above + box wid boxwid*5/4 "stabilizer" "svg_it(K)" + arrow "svg_it(du)" above +D: circle + line from Gh.e to (D,Gh.e) "svg_it(u`'svg_sub(ref))" above + arrow to D.n + arrow from D.e right "svg_it(u)" above +G: box "plant" "svg_it(G)" + arrow <- from G.n up boxht/2 + "disturbance svg_it(z)" above + arrow right from G.e + (0,boxht/4) + "svg_it(y`'svg_sub(c))" ljust + arrow right from G.e + (0,-boxht/4) + "svg_it(y`'svg_sub(m))" ljust + move to last arrow.c + arrow down Here.y-G.s.y+boxht*2/3 then left Here.x-E.x then to E.s + "svg_it(-)" at Here + (-0.15,-0.1) + arrow <- down from R.s + "svg_it(W) control input" at Here - (0,0.1) + +UL:R.nw +(-boxht/2,boxht/2) +UR:(D.e,UL) + (0.1,0) + line dashed from UL to UR then to (UR,G.s+(0,-boxht*3/2)) + line dashed to (Gh.w,Here) "Controller" above + line dashed to (Here,Gh.s+(0,-boxht/2)) + line dashed to (UL,Here) then to UL + ] with .nw at Obs.sw + (0,-0.5) + "(c) Nonlinear feedforward (for performance) and small-signal feedback + (for stability)" wid Obs.wid+0.4 below ljust at NL.sw+(0,-5pt__) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4 new file mode 100644 index 00000000000..375881b4711 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4 @@ -0,0 +1,79 @@ +.PS 3.5 +# csc.m4 +gen_init + +circlerad=1.91*scale +hubrad=0.10 +s=0.5 + +define(`midnight',`26,26,112') +define(`white',`255,255,255') +define(`spokethick',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)}') +define(`lwid',1) +define(`coord',`(s*(`$1'),s*(`$2'))') + +# Circle and spokes +# [ +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__) + for angle = 0 to 330 by 30 do { + Point_(angle) + {spoke} + } + ) + +# Whiten where the hull will be + linethick=`0.'eval(lwid*20)/(1pt__) + rgbdraw(white, + Point_(-60){line to rvec_(circlerad*0.72,0)} + Point_(-90){line to rvec_(circlerad*0.72,0)} + Point_(-120){line to rvec_(circlerad*0.72,0)} + + linethick=`0.'eval(lwid*15)/(1pt__) + {move to coord(1.8,-2.3)+(0,0.025) + spline to Here+coord(-0.8,-0.3) then to Here+coord(-1.8,-0.3) \ + then to Here+coord(-2.18,-0.27) \ + then to Here+coord(-3.93,-0.1)} + ) + +# Sail + thinlines_ + setrgb(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) \ + then to coord(0.62,-1.4) \ + then to coord(0.55,-1.6) \ + then to coord(-2.2,-1.6) \ + then to coord(-2.35,-1.5) + spline to coord(-2.14,-0.78) \ + then to coord(-1.74,0.22) \ + then to coord(-1.42,0.89) \ + then to coord(-0.92,1.73) \ + then to coord(0,2.9) \ + then to coord(0.44,3.38) + +# Hull + 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__) + +# ] with .sw at 1,1 + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/diamondSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/diamondSVG.m4 new file mode 100644 index 00000000000..3c5e0f5bfea --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/diamondSVG.m4 @@ -0,0 +1,34 @@ +.PS +# diamond.m4 +# See LaTeX Graphics Companion pp 57-58 +gen_init +dimen = 1.5*scale +ratio = 0.9 +n = 30 + +North: (0,dimen) +East: (dimen,0) +South: (0,-dimen) +West: (-dimen,0) + +define(`square', + `shade(`$1', + line from North to East then to South then to West then to North) + ') + +define(`diamond',`[ +for i = 2 to n do { + square(`$1') + Tmp: North + North: ratio between East and North + East: ratio between South and East + South: ratio between West and South + West: ratio between Tmp and West + }]') + +linethick = 0 +diamond( i % 2 ) +linethick = 0.4 +diamond( (n-i)/(n-2) ) with .w at last [].e+(0.25,0) + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex00SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex00SVG.m4 new file mode 100644 index 00000000000..97c52687257 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex00SVG.m4 @@ -0,0 +1,94 @@ +.PS +# ex00.m4 +gen_init(svg_font(sans-serif,11bp__)) + +[ +thicklines_ +ewid = 2 +eht = 0.5 +E: ellipse wid ewid ht eht + + [ narrows = 5 + de = ewid/narrows + for i=0 to narrows do { + arrow down from i*de,0 } + ] with .s at E.n+(0,0.25) + + "svg_bf(B)svg_it((t))" at last [].c + +thinlines_ + arrow from E.c to E.ne + box invis fill_(1) ht 0.12 wid 0.12 with .c at last arrow.c "svg_it(r)" + + command "</g>" # end font +] +[ +# ex07.m4 +#gen_init + +Barrel: box invis ht 0.4 wid 1.5 + up +Face: arc rad 2.6 from Barrel.e+(2.4,-1.7/2) to Barrel.e+(2.4,1.7/2) + + eps = 0.03 + arc ccw rad 2.6 from Face.start-(eps,0) to Face.end-(eps,0) \ + with .c at Face.c-(eps,0) + line from Barrel.nw to Barrel.ne then to Face.end + line from Barrel.sw to Barrel.se then to Face.start + arc cw from Barrel.sw to Barrel.nw rad Barrel.ht*1.2 + +Cathode: Barrel.w+(0.3,0) +Term: Barrel.w+(-0.25,0) + dcath = 0.13 + dan = 0.12 + + line from Cathode up dcath/2 left dcath/2 then to Term.x,Cathode.y+dcath/2 + dot + line from Cathode down dcath/2 left dcath/2 then to Term.x,Cathode.y-dcath/2 + dot + + hole = 0.06 +Hole: line invis up hole from Cathode+(0.5,-hole/2) + line from Hole.end up dan-hole/2 then to Term.x,Cathode.y+dan; dot + line from Hole.start down dan-hole/2 then to Term.x,Cathode.y-dan; dot + + platewid = 0.25 + platesep = 0.15 +Plates: box invis wid platewid ht platesep at Barrel.e+(-platewid/2,0) + line right platewid from Plates.nw + line right platewid from Plates.sw + line up 0.3 from Plates.n + line down 0.3 from Plates.s + +linethick_(1.4) + + move to Cathode+(0.03,0) +Spot: 0.9<Face.start,Face.end> + arcto(Plates.c,Spot,(Plates.c.x-Cathode.x)*0.90,outlined "lightgrey" thick 2) + line to Spot chop 0 chop -0.02 outlined "lightgrey" thick 2 + +thinlines_ + + arrow <- from Cathode+(0.2,0.06) up 0.5 left 0.3 + "electron" above "gun" above + + arrow <- from Plates.nw+(0,0.06) up 0.5 left 0.3 + "deflection" above "plates" above + + arrow <- from 0.5<Plates.e,Spot>+(0,0.06) up 0.5 left 0.3 + "electron beam" at Here+(-0.3,0) above + + spline <- from 1.015<Plates.e,Spot> right 0.1 up 0.1 then up 0.1 \ + then up 0.1 left 0.1 + "spot of light" rjust + + "vacuum" at 0.5<Face.start,Face.end>+(-0.4,0) rjust + + arrow <- from Face.start+(0.1,0.5) left 0.6*1.4 down 0.3*1.4 + "phosphor coating" rjust + + arrow <- from 0.2<Barrel.se,Face.start> left 0.6 down 0.3 + "glass enclosure (tube)" rjust + +] with .sw at last [].se+(0.5,0) +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex01SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex01SVG.m4 new file mode 100644 index 00000000000..535bdec7955 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex01SVG.m4 @@ -0,0 +1,28 @@ +.PS +# ex01.m4 +cct_init(svg_font(sans-serif,11bp__)) + +linewid = linewid*1.5 # let's make the circuit elements bigger than usual +define(`elen_',linewid) # but not longer + + del = elen_/4 # a spacing parameter + move right 0.4 +Vin: source(up_ elen_ + 2*del, V); llabel(,v`'svg_sub(s),) + + switch(right_ elen_,,C); rlabel(,t = svg_norm(0),) + resistor; llabel(,svg_norm(47 ohm),); b_current(i`'svg_sub(R),above rjust) + + line right_ elen_/2 then down_ del + parallel_(`inductor(,W); llabel(,"L" wid 0.15,); b_current(i`'svg_sub(L))', + `capacitor(,C); rlabel(+,v`'svg_sub(C),-); llabel(,,C)') + line to (Here,Vin.start) then to Vin.start + + define(`meshcurrent',`[arc -> cw with .c at (0,0) \ + from (Rect_(`$1',-30)) to (Rect_(`$1',30)) "svg_it(`$2')"]') + + right_ + meshcurrent(del,i`'svg_sub(2)) at last[].C + meshcurrent(2*del,i`'svg_sub(1)) at Vin.start + (4*del,3*del) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex02SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex02SVG.m4 new file mode 100644 index 00000000000..9ec72d8e2ae --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex02SVG.m4 @@ -0,0 +1,51 @@ +.PS +# ex02.m4 +cct_init + +[ + [ for angle = 0 to 315 by 45 do { Point_(angle) + opamp(to rvec_(linewid*3/2,0)) with .Out at 0,0 } ] + resistor(down_ dimen_ from last [].s) + diode(down_ dimen_*2/3,LE) + diode(down_ dimen_*2/3,LER) + ground(,T) +] + +[ + define(`elen_',`dimen_*3/2') # restore defaults + define(`sourcerad_',`dimen_*0.25') + leng = elen_ + define(`fromcentre',`move to C+(-elen_/2,-elen_*cosd(15)/(2*sind(15)))') + C: dot + { fromcentre() + for i = 0 to 359 by 30 do { + Point_(i); inductor + } + } + define(`elen_',leng*0.8) + { fromcentre() + for i=0 to 359 by 30 do { + Point_(i); inductor(,W) + } + } + define(`elen_',leng*0.6) + { fromcentre() + for i=0 to 359 by 30 do { + Point_(i); resistor + } + } + define(`elen_',leng*0.4) + { fromcentre() + for i=0 to 359 by 30 do { + Point_(i); capacitor(,C) + } + } + define(`elen_',leng*0.2) + { fromcentre() + for i=0 to 359 by 30 do { + Point_(i); diode + } + } + ] with .sw at last [].se+(linewid,0) + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex03SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex03SVG.m4 new file mode 100644 index 00000000000..ef1e6126d2b --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex03SVG.m4 @@ -0,0 +1,37 @@ +.PS +# ex03.m4 +cct_init(svg_font(sans-serif,11bp__)) + +circlerad = 0.35/2 +define(`elen_',`dimen_') +del = linewid*0.6 + + "svg_it(u`'svg_sub(k))" wid 0.15 above + line +{ + arrow right_ del +B0: circle "svg_it(b`'svg_sub(0))" + arrow right linewid/2 +S: circle + line right 2*circlerad + del + S.w.x-B0.e.x + {arrow ; "svg_it(y`'svg_sub(k))" wid 0.2 above } + down_ + delay + {line left_ del + circle "svg_it(-a`'svg_sub(1))" ; arrow from last circle to S chop} + line dashed down_ del + delay + {line left_ del + circle "svg_it(-a`'svg_sub(n))" ; arrow from last circle to S chop} +} + down_ + delay + {line right_ del + circle "svg_it(b`'svg_sub(1))" ; arrow from last circle to S chop} + line dashed down_ del + delay + {line right_ del + circle "svg_it(b`'svg_sub(n))" ; arrow from last circle to S chop} + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex04SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex04SVG.m4 new file mode 100644 index 00000000000..366cf24c05e --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex04SVG.m4 @@ -0,0 +1,61 @@ +.PS +# ex04.m4 +cct_init(svg_font(sans-serif,10bp__)) + +[ +pushdef(`elen_',`dimen_') # short elements +pushdef(`sourcerad_',`dimen_*0.2') +#linewid = 0.85 +linewid = 0.6 + +Ct:dot + Point_(-60); capacitor(,C); dlabel(0.14,0.14,,,C`'svg_sub(3)) +Cr:dot + left_; capacitor(,C); dlabel(0.14,0.14,C`'svg_sub(2),,) +Cl:dot + down_; capacitor(from Ct to Cl,C); dlabel(0.14,-0.10,C`'svg_sub(1),,) + +T:dot(at Ct+(0,elen_)) + inductor(from T to Ct); dlabel(0.12,-0.1,,,L`'svg_sub(1)) + + Point_(-30); inductor(from Cr to Cr+vec_(elen_,0)) + dlabel(0,-0.07,,L`'svg_sub(3),) +R:dot +L:dot( at (Cl-(Cos(30)*(elen_),0),R) ) + + inductor(from L to Cl); dlabel(-0.1,-0.1,L`'svg_sub(2),,,X) + + right_; resistor(from L to R); rlabel(,R`'svg_sub(2),) + move down 0.3 + + resistor(from T to R); dlabel(0,0.15,,R`'svg_sub(3),) + b_current(y,ljust above) + + line from L to 0.2<L,T> + source(to 0.5 between L and T); dlabel(sourcerad_+0.07,0.1,-,,+) + dlabel(0,sourcerad_+0.07,,u,) + resistor(to 0.8 between L and T); dlabel(0,0.15,,R`'svg_sub(1),) + line to T + ] +popdef(`elen_') +popdef(`sourcerad_') + +[ + Point_(225) +{B1: ebox ; b_current; dlabel(dimen_*0.4,-0.1,i`'svg_sub(1)) + dot + B4: ebox(to rvec_(rp_len,0)); b_current(,,,E); dlabel(dimen_*0.4,-0.1,,,i`'svg_sub(4)) } + Point_(-45) + B2: ebox ; b_current; dlabel(dimen_*0.4, 0.1,i`'svg_sub(2)) + dot + B7: ebox ; b_current; dlabel(dimen_*0.4, 0.1,i`'svg_sub(7)) + B3: ebox(from B1.end to B2.end); b_current; dlabel(dimen_*0.4,0.1,i`'svg_sub(3)) + dot(at (B1.start,B7.end)) +{B5: ebox(to B1.end); b_current; dlabel(dimen_*0.4,-0.09,i`'svg_sub(5))} +{B6: ebox(to B2.end); b_current; dlabel(dimen_*0.4, 0.09,i`'svg_sub(6))} +{B8: ebox(right_ to B4.end); b_current; dlabel(dimen_*0.4, 0.1,i`'svg_sub(8))} + B9: ebox(left_ to B7.end); b_current; dlabel(dimen_*0.4,-0.1,i`'svg_sub(9)) + ] with .w at last [].e+(0.5,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex05SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex05SVG.m4 new file mode 100644 index 00000000000..0ca39bf4f54 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex05SVG.m4 @@ -0,0 +1,69 @@ +.PS +# ex05.m4 +darrow_init + + fillval = 0.8 # environmental variable + + dx = boxht/5 # diagram parameters wrt scaled env variables + circlerad = boxht*3/8 + extlen=4*dx + indel = boxht/3 + +COb: box fill_ "CO" + { line right textht*0.5 from COb+(0,textht*0.5) } +CO:box fill_ with .nw at last box.se+(dx,-dx) "CO" +CbOb: box fill_ with .nw at last box.se+(dx,-dx) "CO" + { line right textht*1.0 with .c at CbOb+(-textht*0.1,textht*0.5) } +CbO: box fill_ with .nw at last box.se+(dx,-dx) "CO" + { line left textht*0.5 from CbO+(-textht*0.2,textht*0.5) } + + dline(from CbO.s down_ dx,,t,,!-) + dright +{Sum: circle invis at (CO,Here)} + darrow(to Sum.e) + +SW: (COb.w,Sum.s)+(-3*dx-extlen/2,-dx) +NE: (CbO.e,COb.n)+(dx,dx) + right_; +SB: shadebox(box wid NE.x-SW.x ht NE.y-SW.y with .sw at SW) + +U: COb.w-(3*dx+extlen,0) + {"svg_bf(u)" wid 0.1 rjust at U} + dline(from U right_ extlen+dx,,t,,|-) +TU: dtee(R) + {darrow(to COb.w,t)} + dline(to (Here,CO),t,t) +{Dum: circle invis at (Here,Sum)} + dtee(L) + {darrow(to CO.w,t)} +{D: box "D" wid boxwid/2 ht boxwid/2 at 0.5<Here,Dum.n>} + darrow(to D.n,t) + darrow(from D.s to Dum.n,,,,,,!-) + + dline(up_ from CO.n to (CO,COb)-(0,indel),,t,,!-) + dleft; darrow(to (COb.e,Here)) + + dline(up_ from CbOb.n to (CbOb,COb),,t,,!-) + dleft; darrow(to COb.e) + + dline(from CbO.n-(indel,0) up_ CbOb.y-CbO.n.y,,t,,!-) + dleft; darrow(to CbOb.e) + + dline(up_ from CbO.n to (CbO,CO),,t,,!-) + dleft + dline(to (CbOb.w,Here)); darrow(to CO.e) + + dline(up_ from CbO.n+(indel,0) to (CbO,COb)+(indel,indel),,t,,!-) + dleft; darrow(to (COb.e,Here)) + + darrow(from CO.s to Sum.n,,,,,,!-) + + darrow(left_ from Sum.w to Dum.e) + dline(from Dum.w to (SB.w-(0.1,0),Dum)); darrow(to (U,Here)) + {"svg_bf(y)" rjust} + move left 0.23 + + circle at Sum + circle at Dum + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex06SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex06SVG.m4 new file mode 100644 index 00000000000..9d3df657452 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex06SVG.m4 @@ -0,0 +1,64 @@ +.PS +# ex06SVG.m4 +gen_init(svg_font(font-family="Times" font-style="italic",11bp__)) + +F: box invis wid 1.6i ht 1.8i +E: box invis wid F.wid ht F.ht +G: box invis wid 1i ht F.ht + + ell = F.ht-0.6i + r = 0.3i + offset = 8bp__ + hatch = 0.1i + dhs = hatch * sqrt(2) + qmell = F.ht - ell + kwid = F.wid-qmell-r + + box wid G.e.x-F.w.x ht F.ht with .sw at F.sw thick linethick*3/2 + Loopover_(`B', + `line from B.ne to B.se thick linethick*3/2 + B`'T: B.se + (-qmell,qmell) + line from (B.w,B`'T) to B`'T chop 0 chop -offset + line from B`'T up ell chop -offset chop 0 + line from B`'T + (-r,0) up ell + line dashed from B`'T to B.se + "svg_fsize(0,110)" at B`'T + (-r/2,ell/2) + "svg_fsize(0,110)" at B`'T + (qmell/2,ell/2) + "t" at (B`'T,B.n) + (-offset/2,offset) + thinlines_ + arrow <-> from B.nw+(0,offset*2/3) right B.wid-qmell-r "k" above + for x = hatch to B`'T.x-B.w.x-r by hatch do {line down ell from B.nw+(x,0)} + for y = dhs to qmell by dhs do {line up y right y from (B.w,B`'T)+(0,-y)} + for x = y-qmell to B.wid-qmell*2 by dhs do { + line up qmell right qmell from B.sw+(x,0) } + for x = last line.start.x-B.w.x+dhs to B.wid by dhs do { + line up (B.wid-x)/2 right (B.wid-x)/2 from B.sw+(x,0) } + thicklines_ + ',F,E) + + line from (G.w,ET) right G.wid + line from ET + (0,r) left ET.x-E.w.x + + thinlines_ + for y = hatch to r by hatch do { line left r from ET+(0,r-y) } + for x = dhs to G.wid by dhs do { + line left x down x from G.nw+(x,0) } + for y=x-G.wid to G.ht-G.wid by dhs do { + line left G.wid down G.wid from G.ne+(0,-y) } + for x = y-(G.ht-G.wid) to G.wid by dhs do { + line right G.wid-x up G.wid-x from G.sw+(x,0) } + arrow <-> up r with .c at ET+(offset*2/3,r/2) "r" ljust + thicklines_ + + "q" at F.sw + (-offset,offset/3) + "l" at (F.w,FT) + (-offset,offset/3) + + "n+p+m" at G.ne + (0,offset) + + Loopover_(`B',`"B" ht 0.12 below at B.s+(0,-2bp__)',F,E,G) + +# Adjust the bounding box without using s_box: + move from F.nw+(-12bp__,21bp__) to G.se+(20bp__,-15bp__) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex08SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex08SVG.m4 new file mode 100644 index 00000000000..aca3f41069a --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex08SVG.m4 @@ -0,0 +1,83 @@ +.PS +# ex08.m4 +log_init(svg_font(sans-serif,11bp__)) + +define(`del',`L_unit*5/2') + +# Input labels +C: "C" rjust at grid_(0,0) +DE: grid_(0,AND_ht*7/4) +A0: DE+grid_(0,BUF_ht*3/2); "A0" rjust at A0 +A1: A0+grid_(0,BUF_ht*3/2); "A1" rjust at A1 +A2: A1+grid_(0,BUF_ht*3/2); "A2" wid 0.2 rjust at A2 + move to (-0.2,0) # Lettering within the global object + +# Buffer strings +for_(1,3,1, + `line right 3*del from A`'eval(3-m4x) + B`'eval(2*m4x-1): NOT_gate; line right 2*del + T`'m4x: last line.c + B`'eval(2*m4x): BUFFER_gate(,N) ') + +B7: BUFFER_gate at (B1,C) + +G1: NOR_gate with .Out at (B1.Out,DE) +G2: NOR_gate at (B2+grid_(N_rad,0),G1-grid_(0,AND_ht)) +G3: AND_gate(4) with .In1 at (G2.Out+(9*del,0),A2) +G5: AND_gate(4) with .In4 at (G3.In1,G2.Out) +G6: AND_gate at G5+grid_(AND_wd,AND_ht*3/4)+(del*2,0) +G4: NOR_gate with .In1 at (G6.Out,G3)+(2*del,0) +G7: NOR_gate with .In2 at (G4.In2,G5.Out) + +# Output to other latches +TOL: (G2.Out,C)+(4*del,-4*L_unit) + move to TOL+(3*del,-del/3) ; {move down 0.15} + "To other latches" below + +# Remaining input lines + line from G1.In1 to (DE,G1.In1); "D" rjust + line from G1.In2 to (DE,G1.In2); "E" rjust + dot(at G1.In2-(del,0)); line to (Here,G2.In2) then to G2.In2 + line from C to B7.In1 + +# Connect Bi, and connect to output bus +for_(1,3,1, + `dot(at T`'m4x.c) ; line down (A2.y-A1.y)/2 + line to (TOL-(m4x*del,0),Here) ; arrow to (Here,TOL) ') + +# G1 to G2 + dot(at (T1.c,G1)); line to (Here,G2.In1) then to G2.In1 + +# Upper And inputs to output bus +for_(1,4,1, + `line left eval(5-m4x)*del from G3.In`'m4x + arrow to (Here,TOL) ') + + line from B2.Out to (G3.In1,B2)-(4*del,0) ; dot + line from B4.Out to (G3.In2,B4)-(3*del,0) ; dot + line from B6.Out to (G3.In3,B6)-(2*del,0) ; dot + line from G1.Out to (G3.In4,G1)-(del,0) ; dot + +# Lower And inputs + line left 4*del from G5.In1 ; dot + line left 3*del from G5.In2 ; dot + line left 2*del from G5.In3 ; dot + line from G2.Out to G5.In4 ; dot(at (TOL,Here)) ; arrow to (Here,TOL) + +# Fix up G4, G6, G7 + line from G3.Out to G4.In1 + line right del from G4.Out + {dot; line right del + "Q7" wid 0.2 ljust; move right 0.2 } # letters in object + line down 2*del then to G6.In1+(-del,del) + line to (Here,G6.In1) then to G6.In1 + line from G4.In2 to (G6.In1+(-del,0),G4.In2) + line down del then to G7.Out+(del,2*del) + line to (Here,G7) then to G7.Out + line from G6.Out right del ; line to (Here,G7.In1) then to G7.In1 + line from G5.Out to G7.In2 + line left del from G6.In2 ; arrow to (Here,TOL) + dot(at (Here,C)) ; line to B7.Out + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex09SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex09SVG.m4 new file mode 100644 index 00000000000..507245235e6 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex09SVG.m4 @@ -0,0 +1,129 @@ +.PS +# ex09.m4 +# Illustrating the arguments of the `dimension_' and `arcdimension_' macros. +gen_init(svg_font(sans-serif,10bp__,3bp__)) +scale = 25 + +define(`spacer',` +[ +linethick_(1.0) + + WC: circle diameter 4.22 at 0,0 + EC: circle same at 30.15,0 + NC: circle diameter 2.36 at 13.28, 10.92/2 + SC: circle same at 13.28,-10.92/2 + + C: 0.5<WC,EC> # spacer centre + h = 27.26 # spacer height + s = 4.22/2 # small arc radius + r = h/2*0.80 # large arc radius + Cr: C+(0,h/2-r) # upper arc centre + e = s # small arc centre offset from small circle + Cs: EC+(e,0) # right arc centre + +# Tangent points Tr and Ts to circles at Cr and Cs + dx = Cr.x-Cs.x; dy = Cr.y-Cs.y; dsq = dx*dx+dy*dy + Tr: (r*(r-s)/dsq)<Cr,Cs> + (vscal_(r*sqrt(dsq-(r-s)^2)/dsq,dy,-dx)) + Ts: (s/r)<Cr,Tr>-(dx,dy) + + line from Tr to Ts + arc cw to (Ts.x,-Ts.y) with .c at Cs +E: last arc.e + line to (Tr.x,-Tr.y) + arc cw to (C.x-(Here.x-C.x),Here.y) with .c at (Cr.x,-Cr.y) +S: last arc.s + line to (Cs.x-Ts.x-s,Cs.y-Ts.y) + arc cw to (Here.x,-Here.y) with .c at (-e,0) +W: last arc.w + line to (C.x-(Tr.x-C.x),Tr.y) + arc cw to Tr with .c at Cr +N: last arc.n + +thinlines_ + dimension_(from S+(2,0) to N+(2,0),-(E.x-C.x+4),27.76, 5) + dimension_(from SC.n+(0,2) left SC.x-WC.x, (SC.n.y-S.y+3), 13.28, 10) + dimension_(from WC.n+(0,2) right EC.x-WC.x,-(WC.n.y-S.y+7), 30.15, 10) + dimension_(from W+(0,-1.5) to E+(0,-1.5), -(C.y-S.y+8), 41.28, 10) + dimension_(from SC.e+(2,0) up NC.y-SC.y, (SC.e.x-W.x+8),"10.92" wid 10, 5) + + arrow <- from EC left 6 up 16 chop EC.rad chop 0 + line left 4 "4.22 (2) PL" above + arrow <- from NC up last line.y-NC.y+7/8 left 8 chop NC.rad chop 0 + {"2.36" above} + arrow to SC chop 0 chop SC.rad + +] ') + +define(`sk',`scale*0.7') + +define(`bdot', + `dot(`$1',,0.5) + "svg_it($2)" $1 $3 ') + + thinlines_ + + move right 0.8 + +# Upper left diagram + spacer + +# Lower left diagram +[ define(`lwid',`29bp__') +A: bdot(at (0,0),A,below) +B: bdot(at (2*sk,0),B,below) +Ctr: 0.5 between A and B + move up 1*sk from A +L: move left 0.85*sk from A + + linethick_(1) + dimension_(from A to B,0.5*sk,label,lwid,0.1*sk) + "`dimension_(from A to B,0.5,label,29bp__,0.1)'" wid 90 \ + with .w at (L.end,A +(0,-9)) + + thinlines_ + arrow from A to B chop 0.05*sk "linespec" below + dimension_(up_ 0.5*sk from A,0.2*sk,"offset" rjust,,,->) + dimension_(up_ 0.1*sk from B,-0.2*sk," tic offset" ljust) + dimension_(up_ 0.1*sk from B+(0,0.5*sk),-0.2*sk," tic offset" ljust) + dimension_(from Ctr+(-lwid/2,0.5*sk) right lwid,0.2*sk, + "blank width" above) +] with .nw at last [].sw+(0,-0.7*sk) + +# Upper right diagram +[ A: bdot(at (0,0),A, above rjust) + B: bdot(at (2*sk,0),B, above ljust) + C: bdot(at (0,-1.5*sk),C, above rjust) + D: bdot(at (2*sk,-1.5*sk),D, above ljust) + +T: C+(-1*sk,-0.5*sk) +T: C+(-0.45*sk,-0.5*sk) + dimension_(from A to B,0.3*sk,svg_it(AB),20bp__) + dimension_(from C to B chop dotrad_,,svg_it(X),16bp__) + dimension_(from C to A,0.3*sk,svg_it(CA),14bp__,,->) + dimension_(from D to B,-0.3*sk,"svg_it(DB)" ljust) + dimension_(from C to D chop dotrad_,,svg_it(T`'svg_sub(15)),15bp__) + arcdimension_(from C to D with .c at 0.5 between A and B,12bp__, + svg_it(C) to svg_it(D),34bp__) +Q: C+(-9,-9) + +`define' leftparagraph { [ baselineskip = textht*1.5; { move right $1 } + for i = 2 to $+ do { + move to Here+(0,-baselineskip) + exec sprintf("{ `\"$%g \"' ljust }; ",i) } ] } + +define(`svg_comma',`svg_symbol(&`#'44;)') +leftparagraph(5.7*scale; baselineskip = 1.5*textht, + `dimension_(from A to B,0.3,svg_it(AB),20bp__)', + `dimension_(from C to B,,svg_it(X),16bp__)', + `dimension_(from C to A,0.3,svg_it(CA),14bp__,,->)', + `dimension_(from D to B,-0.3,"svg_it(DB)" ljust)', + `dimension_(from C to D chop dotrad_,,svg_it(T`'svg_sub(15)),15bp__)', + `arcdimension_'svg_symbol(&`#'40;)`from C to D with .c at 0.5 \ + between A and B'svg_comma`12bp__'svg_comma, + svg_ensp `svg_it(C) to svg_it(D)'svg_comma`34bp__'svg_symbol(&`#'41;) + ) with .nw at Q + +] with .nw at 1st [].ne+(1.7*sk,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex10SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex10SVG.m4 new file mode 100644 index 00000000000..0c707781b35 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex10SVG.m4 @@ -0,0 +1,62 @@ +.PS +# ex10.m4 +cct_init(svg_font(sans-serif,11bp__)) + +[ + dt = 360/5 + r = 0.75 + + N0: dot(at (Rect_(r,90))) + N1: dot(at (Rect_(r,(90-dt)))) + N2: dot(at (Rect_(r,(90-2*dt)))) + N3: dot(at (Rect_(r,(90-3*dt)))) + N4: dot(at (Rect_(r,(90-4*dt)))) + + line from N0 to N1 then to N2 then to N3 then to N4 then to N0 + L14: line from N1 to N4 + L24: line from N2 to N4 + C02: crossover(from N0 to N2,,L14) + C13: crossover(from N1 to N3,,C02,L24) + C03: crossover(from N0 to N3,,L14,L24) + ] + +[ +move right 0.5 + up_ +setrgb(255,0,0) +Q1: bi_tr(,R) # Q1 upward with base to the right + llabel(,Q`'svg_sub(1)) + resetrgb # Label to left of last [] +setrgb(0,0,255) +Q2: bi_tr with .C at Q1.C+(elen_*7/4,0) # Q2 with base to left + rlabel(,Q`'svg_sub(2)) + resetrgb + move right 0.5 + + ground(at Q1.E) + ground(at Q2.E) + + line right_ dimen_/3 from Q1.B # Extend the base conductors +B1: Here + line left_ dimen_/3 from Q2.B +B2: Here + + resistor(up_ elen_*0.75 from Q1.C); llabel(,R`'svg_sub(L)) # Load resistors + line to (Q2.C,Here) "svg_it(V`'svg_sub(svg_norm(cc)))" below + resistor(down_ to Q2.C); llabel(,R`'svg_sub(L)) + + move to Q1.C+(0,dimen_/5) + { resistor(right_ to (B1,Here)); llabel(,R`'svg_sub(1)) +X: line to B2 } # Label the line to be jumped + resistor(from (Q2.C,Here) left_ to (B2,Here)); rlabel(,R`'svg_sub(1)) + crossover(to B1,R,X) + + resistor(down_ elen_*0.75); rlabel(,R`'svg_sub(2)) # Bias resistors + {"svg_it(-V`'svg_sub(svg_norm(cc)))" rjust} + line to (B2,Here) + resistor(up_ to B2); rlabel(,R`'svg_sub(2)) + ] with .sw at last [].se+(0.75,0) + + command "</g>" # end font + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex11SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex11SVG.m4 new file mode 100644 index 00000000000..cca63ef176c --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex11SVG.m4 @@ -0,0 +1,75 @@ +.PS +# ex11.m4 +cct_init(svg_font(sans-serif,11bp__,1bp__)) + + "audio" ljust + { arrow down_ elen_/4} + resistor(down_ 2*elen_) ; llabel(R`'svg_sub(17)) +G: ground + capacitor(right_ dimen_ from last [].c) ; rlabel(,C`'svg_sub(19)) + {arrow <- right_ arrowht from last line.start} + { resistor(down_ to (Here,G)); rlabel(,R`'svg_sub(19)) } +{R18: resistor(up_ elen_*1.2); llabel(,R`'svg_sub(18)) } + + line right_ elen_/4 ; up_ +Q4: bi_tr(,,,E) with .B at Here; llabel(,,Q`'svg_sub(4)) + resistor(down_ from Q4.E to (Q4.E,G)); rlabel(,R`'svg_sub(21)) + resistor(up_ from Q4.C to (Q4.C,R18.end)); llabel(,R`'svg_sub(20)) + line up_ elen_/4; dot; "svg_it(V`'svg_sub(CC))" ljust + +T1: Q4.C+(0,elen_/8) + + capacitor(right_ dimen_ from T1); llabel(,C`'svg_sub(20)) + { capacitor(down_ 0.5*(Here.y-G.y)); rlabel(,C`'svg_sub(21)) + resistor(right_ elen_); llabel(,R`'svg_sub(23)) + arrow <- from last [] to (last [],G) + } + resistor(right_ elen_); llabel(,R`'svg_sub(22)) + { resistor(down_ 0.5*(Here.y-G.y)); llabel(,R`'svg_sub(24)) + capacitor(down_ to (Here,G)); llabel(,C`'svg_sub(22)) } + + capacitor(right_ dimen_); llabel(,C`'svg_sub(23)) + { capacitor(down_ to (Here,G)); rlabel(,C`'svg_sub(24)) } + line right_ elen_/2 +Q5I: Here + line right_ elen_/4 ; up_ +Q5: bi_tr(,,,E) with .B at Here; rlabel(,Q`'svg_sub(5)) +R27: resistor(down_ dimen_ from Q5.E); rlabel(,R`'svg_sub(27)) + line to (Here,G) + resistor(from Q5I down_ Q5I.y-R27.end.y-elen_/12); rlabel(,R`'svg_sub(25)) + { capacitor(to (Here,G)); llabel(,C`'svg_sub(25)) } + + crossover(to (R27,Here)+(hoprad_,0),,R27) +R28: resistor(right_ elen_-hoprad_); llabel(,R`'svg_sub(28)) + resistor(down_ to (Here,G)); rlabel(,R`'svg_sub(30)) + line to G + + resistor(up_ from Q5.C to (Q5.C,R18.end)); llabel(,R`'svg_sub(26)) + line to R18.end + + up_ +Q6: bi_tr(,,,E) with .E at (R28.end.x,Q5.E.y+(T1.y-Q4.B.y)); llabel(,,Q`'svg_sub(6)) + + line from Q6.B to (Q5.C,Q6.B) + resistor(down_ from Q6.E to R28.end); rlabel(,R`'svg_sub(29)) + + line right_ dimen_*3/4 from Q6.C + + { R31: resistor(down_ elen_); circle diam dimen_*0.8 with .c at last line.c + "svg_it(R`'svg_sub(31))" below at last circle.sw + "svg_it(V)" below at last line.c+(dimen_/4,0) } + line right_ dimen_ + { capacitor(down_ elen_); rlabel(,,C`'svg_sub(26)) + line down_ elen_/4; dot; "svg_it(V`'svg_sub(SS))" ljust } + line right_ dimen_/2 +T6: transformer(down_ elen_) with .P1 at Here + line from T6.P2 to R31.end + {"svg_it(T`'svg_sub(6))" at T6.n above } + line right_ elen_/3 from T6.S1 + inductor(down_ elen_,W) + line to T6.S2 + + speaker(R) with .Box.w at last [].e+(dimen_/8,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex12SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex12SVG.m4 new file mode 100644 index 00000000000..1dfa749b7a4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex12SVG.m4 @@ -0,0 +1,136 @@ +.PS +# ex12.m4 +cct_init(svg_font(sans-serif,11bp__)) + +[ + fetht = dimen_*0.9 + +G: ground +Q4: e_fet(up_ fetht) with .S at G +Q3: e_fet(up_ fetht) with .S at Q4.D + +Q2: e_fet(down_ fetht,R,P) with .G at Q3.Channel+( dimen_*0.25,dimen_*1.8) +Q1: e_fet(down_ fetht,R,P) with .G at Q2.G + (-dimen_*1.25,0) + + line left_ dimen_ from Q3.G +A: dot; "svg_it(A)" wid 0.15 rjust + line left_ dimen_ from Q4.G +B: dot; "svg_it(B)" rjust + + line from Q1.G to (Q1.G,Q3.D) then to (Q1.Channel,Q3.D) \ + then to (Q1.Channel,B);dot + line from Q2.G to (Q3.Channel,Q2.G) then to (Q3.Channel,Q3.D) \ + then to (Q3.G,Q3.D) then to Q3.G;dot + line from Q1.D to Q2.D + line from Q1.S to Q2.S + dot(at (G,Q1.S)) ; line up dimen_/3 ; "+5 V" rjust + line from Q3.D to (Q3.D,Q2.D);dot + dot(at Q3.D) + line right_ dimen_ ; dot ; "svg_it(~(AB))" above +] + +[ + del = dimen_/3 + +define(`pair',`[ +Q1: c_fet(up_ dimen_,,P) + line right dimen_*2/3 from Q1.D + {dot(at last line.c); reversed(`source',up_ dimen_,I); Rail: Here + line right dimen_/2 with .c at Here} +Q2: c_fet(up_ dimen_,R,P) with .D at Here + line down del*2 from Q2.S + resistor(down_ dimen_) +Gnd: ground(,T,S) + ]') + +P1: pair +Rail: P1.Rail +Vc: dot(at P1.Q2.S+(0,-del)); "svg_it(V`'svg_sub(c))" rjust + line from P1.Q1.G to (P1.Q1.G,Rail)+(0,del/2); "svg_it(S+)" ljust + + line right_ del from P1.Q2.G + {dot(at last line.c); line up del; "svg_it(V`'svg_sub(ref))" above} + pht = P1.Rail.y-P1.Gnd.y + +P2: pair with .Q1.G at Here +Vcp: dot(at P2.Q2.S+(0,-del*2)); {"svg_it(V`'svg_sub(c'))" above rjust} + {line to (P1.Q1.S,Here) then to P1.Q1.S} + line from P2.Q2.G to (P2.Q2.G,Rail)+(0,del/2); "svg_it(S-)" rjust + + line from Vc to (P2.Q1.S,Vc) then to P2.Q1.S + +define(`cpair',`[ +Rail: line right dimen_/2 +Q1: c_fet(up_ dimen_,,P) with .D at last line.c +Q2: c_fet(up_ dimen_) with .S at Rail+(0,-pht) + ground(at Q2.S,T,S) + line from Q1.G to Q2.G + line from Q1.S to Q2.D + ]') + +S1: cpair with .Rail at P2.Rail+(P2.Q2.G.x-P2.Rail.x+P2.Q2.G.x-P2.Q2.D.x+del,0) +S2: cpair with .Q1.G at (S1.Q1.D.x+del,S1.Q1.G.y) +S3: cpair with .Rail at 2 between S1.Rail and S2.Rail + + line from Vcp to (S2.Q2.G,Vcp); dot + dot(at (S2.Q2.D,Here)); line to (S3.Q2.G,Here); dot + dot(at (S3.Q2.D,Here)); arrow right del + "svg_it(e`'svg_sub(2))" ljust + dot(at P2.Q1.S); line to (S1.Q1.G,Here); dot + dot(at (S1.Q2.D,Here)); arrow to (last arrow.end,Here) + "svg_it(e`'svg_sub(1))" ljust + + +] with .sw at last [].se+(0.25,0) + +[ + elen=0.2 + +VDD: dot; llabel(,V`'svg_sub(DD),) + line down_ elen/2 +P1: mosfet(up_,,ZSDFdTX,) with .D at Here + +MIDDLE: line from P1.S down_ elen/2 + +N1: mosfet(up_,,ZSDFTX,) with .D at Here +N2: mosfet(up_,,ZSDFTX,) with .D at N1.S + ground(at N2.S) + +ING: P1.G+(-elen/2,0) + + line from P1.B right_ elen * 2/5 then down_ elen * 4/5 + line to (ING, Here) + dot + + line from N1.B right_ elen * 2/5 then up_ elen * 4/5 + line to (ING, Here) + dot + + line from N1.G to (ING,N1.G) + dot + + line from N2.G to (ING,N2.G) then to ING then to P1.G + + dot(at (ING,MIDDLE)) + line left_ elen*2 + "svg_it(V`'svg_sub(in))" above + + dot(at MIDDLE) + line right_ elen*2 + { "svg_it(V`'svg_sub(out))" wid 0.25 above } + + line from N2.B to (Here,N2.B) + "svg_it(V`'svg_sub(BB))" above + +PUNT:dot(at 0.5 between N1.S and N2.D) + + "svg_it(V`'svg_sub(x))" ljust + + "svg_it(P`'svg_sub(1))" at P1.Channel.end above rjust + "svg_it(N`'svg_sub(1))" at N1.Channel.start below rjust + "svg_it(N`'svg_sub(2))" at N2.Channel.start below rjust + +] with .sw at last [].se + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex15SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex15SVG.m4 new file mode 100644 index 00000000000..055986740bb --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex15SVG.m4 @@ -0,0 +1,40 @@ +.PS +# ex15.m4 +gen_init + +[ +n = 10; r = 1 +for i = 1 to n-1 do { + for j = i+1 to n do { + line from rect_(r,i*twopi_/n) to rect_(r,j*twopi_/n) + } + } + ] +[ + linethick = 2.5 + lt = linethick bp__ + crad = 1.0 + C: circle rad crad + g = 0.65 + D: C+(Rect_(crad*g,110)) + rm = crad+distance(C,D) + for r=lt to rm by 2*lt do { + if r < (1-g)*crad then { circle rad r at D thick r/rm*linethick } \ + else { arc cw from Cintersect(D,r,C,crad) \ + to Cintersect(D,r,C,crad,R) with .c at D thick r/rm*linethick } + } + linethick = 1.5 + lt = linethick bp__ + C: circle invis rad crad with .w at C.e+(0.1,0) + D: C+(Rect_(crad*g,110)) + rm = crad+distance(C,D) + for r=lt to rm by lt do { + u = (1-r/rm)*255 + 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) } + } + circle rad C.rad at C + ] with .w at last [].e+(0.1,0) + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex16SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex16SVG.m4 new file mode 100644 index 00000000000..70a7d00e28a --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex16SVG.m4 @@ -0,0 +1,70 @@ +.PS +# ex16.m4 +cct_init(svg_font(sans-serif,11bp__)) + +[ +define(`elen_',linewid*1.2) + circlerad = delay_rad_ + {"input" above ljust} + line right_ +J: Here + delay +K: Here + delay +L: Here +S1: circle "+" at (K.x,K.y+linewid) +S2: circle "+" at (L,S1) + arrow up_ S1.y-J.y from J then to S1.w + arrow from K to S1.s + arrow from S1.e to S2.w + arrow from L to S2.s +S3: circle "+" at (L.x,L.y-linewid) + arrow down_ J.y-S3.y from J then to S3.w + arrow from L to S3.n + arrow from S2.e right_ linewid/2 then down_ (S2.y-S3.y)/2-circlerad \ + then right_ linewid/2 + arrow from S3.e right_ linewid/2 then up_ (S2.y-S3.y)/2-circlerad \ + then right_ linewid/2 + "output" at 0.5<last arrow.end, 2nd last arrow.end> + ] +[ + circlerad = 0.35/2 + d = linewid*1.75 + S00: circle "00" + S10: circle "10" at S00+(d,d) + S01: circle "01" at S00+(d,-d) + S11: circle "11" at S01+(d,d) + dx = circlerad*cosd(60) + dy = circlerad*sind(60) + brad = circlerad*1.3 + qrad = circlerad*6 + + arc -> cw from S00+(-dx,-dy) to S00+(-dx,dy) rad brad \ + with .c at S00-(dx+sqrt(brad^2-dy^2),0) + "0/00" at last arc.w rjust + right + arc -> cw from S00+(dx,dy) to S10+(-dy,-dx) rad qrad + "1/11" at last arc.nw rjust above + right + arc -> cw from S10+(dy,-dx) to S11+(-dx,dy) rad qrad + "1/01" at last arc.ne ljust above + up_ + arc -> cw from S11+(dx,dy) to S11+(dx,-dy) rad brad \ + with .c at S11+(dx+sqrt(brad^2-dy^2),0) + "1/10" wid 0.3 at last arc.e ljust + down_ + arc -> cw from S11+(-dx,-dy) to S01+(dy,dx) rad qrad + "0/01" at last arc.se ljust below + left_ + arc -> cw from S01+(-dy,dx) to S00+(dx,-dy) rad qrad + "0/11" at last arc.sw rjust below + up_ + arc -> cw from S01+(-dx,dy) to S10+(-dx,-dy) rad qrad*2 + "1/00" at last arc.w rjust + down_ + arc -> cw from S10+(dx,-dy) to S01+(dx,dy) rad qrad*2 + "0/10" at last arc.e ljust + ] with .sw at last [].se+(0.4,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex17SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex17SVG.m4 new file mode 100644 index 00000000000..fbe892f1477 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex17SVG.m4 @@ -0,0 +1,44 @@ +.PS +# ex17SVG.m4 +cct_init(svg_font(sans-serif,11bp__,0bp__)) + +[ +nrows = 4 +ncols = 9 +linewid = linewid*0.6 # everything smaller +define(`elen_',linewid) # shorter default length + + for j = 1 to nrows do { + { for i = 1 to ncols do { + Point_(-120) resistor + Point_( 0) inductor + Point_( 120) capacitor + if i < ncols then {Point_(0) diode} } + } + Point_(-120) move to rvec_(elen_,0) + { for i = 1 to ncols do { + Point_(-60) capacitor + Point_( 60) resistor } + } + Point_(-60) move to rvec_(elen_,0) + } + Point_(0) for i = 1 to ncols-1 do { inductor } +] + +[ + down_ + Point_(-80) + + parallel_(Sep=1.75*dimen_; + parallel_(`capacitor(,C); rlabel(,,C`'svg_sub(2))', + `resistor; llabel(,R`'svg_sub(2))' ), + parallel_(`resistor; rlabel(,R`'svg_sub(1)); move to rvec_(-dimen_/5,0) + inductor(,W); rlabel(,L`'svg_sub(1))', + `reversed(`source',to rvec_(elen_,0),V,sourcerad_*2.5) + rlabel(,v`'svg_sub(s))' ) + ) + move left 0.2 from last [].w +] with .sw at last [].se+(elen_,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex18SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex18SVG.m4 new file mode 100644 index 00000000000..c14e7c46163 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex18SVG.m4 @@ -0,0 +1,40 @@ +.PS +# ex18.m4 +cct_init(svg_font(Times,11bp__)) + +[ + "svg_it(v`'svg_sub(i))" wid 0.1 rjust; dot + resistor(right_ dimen_) ; llabel(,svg_it(R`'svg_sub(i))) +T: dot + line right_ linewid/4 +A: opamp with .In1 at Here + + line from A.In2 to (T,A.In2) + resistor(down_ dimen_) ; rlabel(,svg_it(R`'svg_sub(g))) + ground(,T) + + line right_ dimen_ from A.Out + diode(up_ dimen_); dot + {line right_ linewid/2; dot; "svg_it(v`'svg_sub(o))" wid 0.2 ljust } + resistor(left_ to (A.Out,Here)) ; rlabel(,svg_it(R`'svg_sub(o))); dot + { diode(down_ to A.Out); dot } + line to (T,Here) then to T + ] +[ +# ex19.m4 +define(`dimen_',dimen_*1.25) + +B: battery(up_ dimen_*2/3); rlabel(,V) + move down dimen_/4 + resistor(up_ dimen_); rlabel(,R,) + {move up textht*1.5 } + inductor(right_ elen_); b_current(i); rlabel(,L) + { capacitor(down_ to (Here,B.start)); rlabel(,C); llabel(+,v,-) } + line right_ dimen_ + diode(down_ to (Here,B.start),T); b_current(h(v)) + { move right 0.3} + line to B.start + ] with .nw at last [].ne+(20bp__,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex21SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex21SVG.m4 new file mode 100644 index 00000000000..785c13361e7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex21SVG.m4 @@ -0,0 +1,71 @@ +.PS +# ex21SVG.m4 +log_init(svg_font(sans-serif,11bp__)) + +dy = 0.2 +ddy = 1.8*dy +textht = textht*0.9 + +D: FlipFlop(D) + line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__) +T: FlipFlop(T) with .Chip.sw at last [].se + (0.4,0) + line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__) +RS: FlipFlop(RS) with .Chip.sw at last [].se + (0.4,0) + line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__) +JK: FlipFlop(JK) with .Chip.sw at last [].se + (0.4,0) + line right 5bp__ at last [] . 2nd last ""+(-7bp__,4bp__) + `"FlipFlop(JK)"' at JK.s below + `"FlipFlop(RS)"' at (RS.s,JK.s) below + `"FlipFlop(T)"' at (T.s,JK.s) below + `"FlipFlop(D)"' at (D.s,JK.s) below + +# Test 3: synchronous 3-bit counter +define(`counterFF',``$1':FlipFlop(JK) `$2' + line right 5bp__ at last [] . 2nd last ""+(-7bp__,4bp__) + "`$1'" at `$1'.Chip.sw-(3bp__,0) below ljust + "1" at `$1'.PinCLR.end above + "1" at `$1'.PinPR.end below') + +[ +right_ + counterFF(FF0) + counterFF(FF1,with .Chip at FF0.Chip+(-28*L_unit,0)) + counterFF(FF2,with .Chip at FF1.Chip+(-28*L_unit,0)) + "1" at FF0.PinJ.end rjust + "1" at FF0.PinK.end rjust +Dc: FF2.Chip.sw+(-9*L_unit,-7.5*L_unit) +Bot: Dc+(0,-3*L_unit) + +left_ +GAnd: AND_gate at FF1.Chip.nw+(4*L_unit,12*L_unit) +right_ + + line from FF2.PinCK.end left 3*L_unit + line to (Here,Dc); dot + line from FF1.PinCK.end left 3*L_unit + line to (Here,Dc); dot + line from FF0.PinCK.end left 3*L_unit + line to (Here,Dc) then to Dc + "svg_it(D`'svg_sub(C))" rjust + + line from FF2.PinK.end to FF2.PinJ.end; dot + line to (Here,GAnd.Out) then to GAnd.Out + + line from FF1.PinK.end to FF1.PinJ.end; dot + line to (Here,FF1.PinCLR.end+(0,3*L_unit)) + line to (GAnd.In2+(6*L_unit,0),Here) then to GAnd.In2+(6*L_unit,0); dot + + line from FF0.PinQ.end right 0.1; dot + line from GAnd.In2 to (Here,GAnd.In2) then to (Here,Bot) + "svg_it(D`'svg_sub(00))" below + + line right 0.1 from FF1.PinQ.end; dot + line from GAnd.In1 to (Here,GAnd.In1) then to (Here,Bot) + "svg_it(D`'svg_sub(01))" below + + line right 0.1 from FF2.PinQ.end + line to (Here,Bot); "svg_it(D`'svg_sub(02))" below + ] with .n at 0.5<2nd[].s,3rd[].s> - (0,0.4) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx new file mode 100644 index 00000000000..0a5fd2eca99 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx @@ -0,0 +1,358 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<HTML> +<HEAD> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<meta http-equiv="Content-Style-Type" content="text/css"> +<!--meta http-equiv="Content-Script-Type" content="text/javascript"--> +<TITLE>SVG Examples: Circuit_macros Version XXX</TITLE> +<style type="text/css"> +.svg{display:none} +*>.svg{display:inline} +</style> +<link rel="shortcut icon" href="../Circuit_macros.ico" type="image/x-icon" /> +</HEAD> + +<BODY> +<H2>SVG Circuit_macros examples, Version XXX</H2> +<hr> + +<p> + These diagrams are in .svg format. + <A HREF="examples.pdf">Pdf</A> + and + <A HREF="examples.html">png</A> + versions are also available. + The PDF equivalent can be found in examples.pdf of the distribution. +</p> + <p> + Click on the link to view the source of each diagram. +</p> +<hr> + +define(`cfig',` +<p> + +<!--[if lte IE 8]><embed src="$1.svg" sinclude($1.siz)><![endif]--> + +<!--[if gte IE 9]> +<object dx="4" data="$1.svg" sinclude($1.siz) type="image/svg+xml" class="img"> + </object> <![endif]--> + +<!--[if !IE]><!--> +<object data="$1.svg" sinclude($1.siz) type="image/svg+xml" class="img"> + </object> <!--<![endif]--> + +<br> +<a href="$1.txt" TYPE="text/plain" TARGET="_blank" alt="$1">$1.m4</a> +</p> +<hr>') + +define(`m4tt',`<g style="font-family:monospace">') + +<!-- +<embed pluginspage="http://www.adobe.com/svg/viewer/install/" /> +--> + +<p> +These diagrams have been adapted from the Circuit_macros examples in +order to test the <em>experimental</em> svg output of dpic. +Generating the line art is relatively straightforward, but +the labeling is not created by a text processor and therefore must be +more basic. Some of these diagrams might benefit from a little more +tweaking of fonts and labels. +</p> +<p> +These examples conform to the latest dpic, which has changed the +treatment of text sizing. That is, "Text" ht y sets the true height +of SVG text to y rather than the nominal height as previously. +</p> +<p> +There are a number of other issues: +<ul> + <li> Embedding .svg files in html documents with the <embed> or + <object> tag seems to be a perennial issue. + <li> This file has been tested mainly by using Firefox. + Chrome also seems to work well with two issues detected to date: + a difference handling color fills and text links in svg. + <li> The Adobe reader apparently requires a line of the form + <br> <embed src="figure.svg" width="x" height="y" type="image/svg+xml" + /> + This means that the html file has to contain dimension + information for each figure, whereas Firefox can + determine the figure size + from the <svg ... object. Currently, dpic includes a comment line + giving reasonable dimensions in pixels but this has to be insterted into + the <embed or <object line. A makefile does it easily but + otherwise this could be tedious. + <li> The font face is not specified by default in these diagrams but is + inherited from the enclosing document. The default appearance of labels can + differ according to the browser. + <li> The <svg tag may require modification + from the default used for this test. Dpic might be modified to + allow the generation of custom headers but that has not yet been done. + <li> Diagrams such as these contain text labels + that have to be treated differently from the LaTeX-compatible versions. + Apparently there is no direct way to know the bounding box of arbitrary svg + text. + <!-- text, as discussed + <a href="http://www.aditus.nu/jpgraph/jpg_svg.php" TARGET="_blank">here,</a> + for example. --> + Consequently, text placement is approximate and may require + manual adjustment. + Rather than patch the original source files for svg production, edited copies + have been used. The configuration file svg.m4 read by m4 + prior to libcct.m4 contains the following macros defined for svg. + Others should be defined to exercise some of the media capabilties of svg. + They are subject to change: + <ul> + <li> + m4tt`'svg_font(</g>font-face,height,textoffset,dpic commands`'m4tt)</g>: + Change font face, size, and dpic textoffset parameter. + If arg4 is blank, the font is changed and + requires m4tt`'command "</g>"</g> to cancel the font change. + Examples: <br> + m4tt`'svg_font(Times)</g><br> + m4tt`'svg_font(Times,11bp__,1bp__,"text" at A)</g><br> + m4tt`'svg_font(font-family="Times")</g><br> + m4tt`'svg_font(font-family="Times" font-style="italic")</g><br> + m4tt`'svg_font(style="font-family:Times; font-style:italic")</g> + <li>m4tt svg_tspan(</g>text attributes`'m4tt)</g>; + e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%")</g> + <li>m4tt svg_it(</g>text`'m4tt)</g>: for italics + <li>m4tt svg_tt(</g>text`'m4tt)</g>: for monospace (courier) + <li>m4tt svg_norm(</g>text`'m4tt)</g>: for normal text + <li>m4tt svg_bf(</g>text`'m4tt)</g>: for bold face + <li>m4tt svg_small(</g>text, percent`'m4tt)</g>: + to set a smaller text size, default 66 + <li>m4tt svg_fsize(</g>text, percent`'m4tt)</g>: + for setting larger or smaller text size, default 100 + <li>m4tt svg_sub(</g>text, size percent, y displ, x displ`'m4tt)</g>: + subscript + <li>m4tt svg_sup(</g>text, size percent, y displ, x displ`'m4tt)</g>: + superscript + <li>m4tt svg_symbol(</g>text`'m4tt)</g>: allow quoted pound sign in text, + e.g., m4tt`'svg_symbol(10&`#'176;)</g> produces 10° + <li>m4tt svgLink(</g>URL, drawing object, m4tt[B])</g>: + link to external file using + <a xlink:href=...>...</a> (default is + m4tt`'target="_blank"</g> unless + arg 3 = B) + <li>m4tt svgLinkString</g> as above but for strings attached to objects + <li> Greek and other symbols: +<table cellpadding="0" cellspacing="0" width="100%" > +<tr> +<td width="7%"> m4tt svg_alpha</g> + <td align="left"> changecom(,)&`#'945;changecom(`#') +<td width="7%"> m4tt svg_beta</g> + <td align="left"> changecom(,)&`#'946;changecom(`#') +<td width="7%"> m4tt svg_chi</g> + <td align="left"> changecom(,)&`#'967;changecom(`#') +<td width="7%"> m4tt svg_comma</g> + <td align="left"> changecom(,)&`#'44;changecom(`#') +<td width="7%"> m4tt svg_Delta</g> + <td align="left"> changecom(,)&`#'916;changecom(`#') +<td width="7%"> m4tt svg_delta</g> + <td align="left"> changecom(,)&`#'948;changecom(`#') +<td width="7%"> m4tt svg_epsilon</g> + <td align="left"> changecom(,)&`#'949;changecom(`#') +<td width="7%"> m4tt svg_eta</g> + <td align="left"> changecom(,)&`#'951;changecom(`#') +<tr> +<td width="7%"> m4tt svg_Gamma</g> + <td align="left"> changecom(,)&`#'915;changecom(`#') +<td width="7%"> m4tt svg_gamma</g> + <td align="left"> changecom(,)&`#'947;changecom(`#') +<td width="7%"> m4tt svg_iota</g> + <td align="left"> changecom(,)&`#'953;changecom(`#') +<td width="7%"> m4tt svg_kappa</g> + <td align="left"> changecom(,)&`#'954;changecom(`#') +<td width="7%"> m4tt svg_Lambda</g> + <td align="left"> changecom(,)&`#'923;changecom(`#') +<td width="7%"> m4tt svg_lambda</g> + <td align="left"> changecom(,)&`#'955;changecom(`#') +<td width="7%"> m4tt svg_micro</g> + <td align="left"> changecom(,)&`#'956;changecom(`#') +<td width="7%"> m4tt svg_mu</g> + <td align="left"> changecom(,)&`#'956;changecom(`#') +<tr> +<td width="7%"> m4tt svg_nu</g> + <td align="left"> changecom(,)&`#'957;changecom(`#') +<td width="7%"> m4tt svg_ohm</g> + <td align="left"> changecom(,)&`#'937;changecom(`#') +<td width="7%"> m4tt svg_Omega</g> + <td align="left"> changecom(,)&`#'937;changecom(`#') +<td width="7%"> m4tt svg_omega</g> + <td align="left"> changecom(,)&`#'969;changecom(`#') +<td width="7%"> m4tt svg_Phi</g> + <td align="left"> changecom(,)&`#'934;changecom(`#') +<td width="7%"> m4tt svg_phi</g> + <td align="left"> changecom(,)&`#'966;changecom(`#') +<td width="7%"> m4tt svg_Pi</g> + <td align="left"> changecom(,)&`#'928;changecom(`#') +<td width="7%"> m4tt svg_pi</g> + <td align="left"> changecom(,)&`#'960;changecom(`#') +<tr> +<td width="7%"> m4tt svg_Psi</g> + <td align="left"> changecom(,)&`#'936;changecom(`#') +<td width="7%"> m4tt svg_psi</g> + <td align="left"> changecom(,)&`#'968;changecom(`#') +<td width="7%"> m4tt svg_rho</g> + <td align="left"> changecom(,)&`#'961;changecom(`#') +<td width="7%"> m4tt svg_Sigma</g> + <td align="left"> changecom(,)&`#'931;changecom(`#') +<td width="7%"> m4tt svg_sigma</g> + <td align="left"> changecom(,)&`#'963;changecom(`#') +<td width="7%"> m4tt svg_tau</g> + <td align="left"> changecom(,)&`#'964;changecom(`#') +<td width="7%"> m4tt svg_Theta</g> + <td align="left"> changecom(,)&`#'920;changecom(`#') +<td width="7%"> m4tt svg_theta</g> + <td align="left"> changecom(,)&`#'952;changecom(`#') +<tr> +<td width="7%"> m4tt svg_upsilon</g> + <td align="left"> changecom(,)&`#'965;changecom(`#') +<td width="7%"> m4tt svg_Xi</g> + <td align="left"> changecom(,)&`#'926;changecom(`#') +<td width="7%"> m4tt svg_xi</g> + <td align="left"> changecom(,)&`#'958;changecom(`#') +<td width="7%"> m4tt svg_zeta</g> + <td align="left"> changecom(,)&`#'950;changecom(`#') +<td width="7%"> m4tt svg_lt</g> + <td align="left"> changecom(,)&`#'60;changecom(`#') +<td width="7%"> m4tt svg_gt</g> + <td align="left"> changecom(,)&`#'62;changecom(`#') +<td width="7%"> m4tt svg_leq</g> + <td align="left"> changecom(,)&`#'8804;changecom(`#') +<td width="7%"> m4tt svg_geq</g> + <td align="left"> changecom(,)&`#'8805;changecom(`#') +<tr> +<td width="7%"> m4tt svg_prime</g> + <td align="left"> changecom(,)&`#'8242;changecom(`#') +<td width="7%"> m4tt svg_ensp</g> + <td align="left"> |changecom(,)&`#'8194;changecom(`#')| +<td width="7%"> m4tt svg_emsp</g> + <td align="left"> |changecom(,)&`#'8195;changecom(`#')| +<td width="7%"> m4tt svg_thinsp</g> + <td align="left"> |changecom(,)&`#'8201;changecom(`#')| +<td width="7%"> m4tt svg_backsl</g> + <td align="left"> changecom(,)&`#'92;changecom(`#') +</table> + + </ul> + <li> Inkscape: It may be efficient to define elements by macro and to + place them using a WYSIWYG graphics editor. A draft page intended + for Inkscape is included. A reasonable variety of elements is defined + but many more could be added and they should be customized for + particular applications. + <li> Link experiments: Click on the resistor or source of quickSVG + to go to external + files in new windows. Click on "n-port" in NportSVG to replace the diagram + and then "back" to return. + <li> Some of the assumptions used to create this draft may be naive. Comments + are welcome. +</ul> +<hr> + +cfig(quickSVG) +cfig(CctTableSVG) +cfig(DiodesSVG) +cfig(EmarrowsSVG) +cfig(SourcesSVG) +cfig(VariableSVG) +cfig(AmpTableSVG) +cfig(FusesSVG) +cfig(SwitchesSVG) +cfig(GroundsSVG) +cfig(AntennasSVG) +cfig(AudioSVG) +cfig(OpampSVG) +cfig(XformSVG) +cfig(RelaySVG) +cfig(NPDTSVG) +cfig(JackSVG) +cfig(ConnSVG) +cfig(PconnSVG) +cfig(HeadersSVG) +cfig(fetSVG) +cfig(ujtSVG) +cfig(thyristorSVG) +cfig(BipSVG) +cfig(TgateSVG) +cfig(NportSVG) +cfig(NLGSVG) +cfig(WindingsSVG) +cfig(ex01SVG) +cfig(TimerSVG) +cfig(OptoisoSVG) +cfig(MixerSVG) +cfig(PushPullSVG) +cfig(QuantumSVG) +cfig(SQUIDSVG) +cfig(SixpoleSVG) +cfig(ex18SVG) +cfig(MCSVG) +cfig(ex10SVG) +cfig(ThreeSVG) +cfig(ex17SVG) +cfig(ex12SVG) +cfig(pwrsupplySVG) +cfig(TTLnandSVG) +cfig(I2LSVG) +cfig(SchottkySVG) +cfig(ex11SVG) +cfig(ex04SVG) +cfig(CsourceSVG) +cfig(DriveSVG) +cfig(ex16SVG) +cfig(ex03SVG) +cfig(MotorControlSVG) +cfig(ex02SVG) +cfig(RectifiersSVG) +cfig(HeathkitSVG) +cfig(lcctSVG) +cfig(sfgSVG) +cfig(LogicSVG) +cfig(ex08SVG) +cfig(DecoderSVG) +cfig(ex21SVG) +cfig(MultiplexerSVG) +cfig(DemultiplexerSVG) +cfig(ShiftRSVG) +cfig(AdderSVG) +cfig(CanLogicSVG) +cfig(AlogixSVG) +cfig(ABlogixSVG) +cfig(XORSVG) +cfig(ex00SVG) +cfig(CrossbarSVG) +cfig(ByteSVG) +cfig(RotboxSVG) +cfig(paletteSVG) +cfig(randomSVG) +cfig(expSVG) +cfig(graysurfSVG) +cfig(CrullerSVG) +cfig(shapesSVG) +cfig(ex09SVG) +cfig(ex05SVG) +cfig(controlSVG) +cfig(ex06SVG) +cfig(LoglogSVG) +cfig(cscSVG) +cfig(roseSVG) +cfig(diamondSVG) +cfig(wormSVG) +cfig(ButtonsSVG) +cfig(SierpinskiSVG) +cfig(recycleSVG) +cfig(ex15SVG) +cfig(CountingSVG) +cfig(CrowSVG) +cfig(FlowSVG) +cfig(BtreeSVG) +cfig(TtreeSVG) +cfig(InclepsSVG) +cfig(FontsSVG) + +</BODY> +</HTML> diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4 new file mode 100644 index 00000000000..deff7bae074 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4 @@ -0,0 +1,303 @@ +.PS +# expSVG.m4 +threeD_init +NeedDpicTools + +# Graduated shading is probably best done using the built-in functions +# of PSTricks or the somewhat equivalent tikz capabilities. Other +# postprocessors do not have the same functionality so the following +# demonstrates how it can be done in the pic language with m4 macros. + +# `shadedpolygon(shadedpvertseq,line attributes, +# sweep angle (degrees),colorseq) +# arg1 is a colon (:) separated sequence of +# positions or position names, the vertices in +# order (cw or ccw) of the polygon. Colored +# shade lines are drawn perpendicular to the +# sweep angle. A colorseq is of the form +# 0,r0,g0,b0, +# frac1,r1,g1,b1, +# frac2,r2,g2,b2, +# ... +# 1,rn,gn,bn' +#`e.g. shadedpolygon((0,0):(0,1):(2,1):(2,0),,0,0,1,1,1,1,0,0,0)' +define(`shadedpolygon',`[ Origin: Here + shadedpverts(V,1,patsubst(patsubst(`$1',`,',|),:,`,')) + nverts = m4vx + T: (Rect_(1,`$3')) + p0 = 1; d[1] = T.x*V[1].x + T.y*V[1].y + pm = 1 + for i=2 to nverts do { d[i] = T.x*V[i].x + T.y*V[i].y + if d[i] < d[p0] then { p0 = i } + if d[i] > d[pm] then { pm = i } } + d0 = d[p0]; dmx = d[pm]-d0 + for i=1 to nverts do { d[i] = (d[i]-d0)/dmx } + qL = p0; pL = qL + 1; if pL > nverts then { pL = 1 } + qR = p0; pR = qR - 1; if pR < 1 then { pR = nverts } + nlines = int(1.5*dmx/lthick) + ShadeObject(ShadedPline,nlines,shift(shift(shift($@)))) \ + with .Origin at Origin + Midpt: 0.5 between V[1] and V[nverts] + line `$2' \ + from Midpt to for_(1,m4vx,1,`V[m4x] then to\') Midpt + Start: V[p0]; End: V[pm] + ]') +define(`shadedpverts',` +ifelse($3,,,`$1[$2]: patsubst(`$3',|,`,') define(`m4vx',$2) +shadedpverts(`$1',incr(`$2'),shift(shift(shift($@))))')') +define ShadedPline { + if $1 > d[pL] then { qL = pL; pL = qL + 1; if pL > nverts then {pL = 1} } + if $1 > d[pR] then { qR = pR; pR = qR - 1; if pR < 1 then {pR = nverts} } + M4L: ($1-d[qL])/(d[pL]-d[qL]) between V[qL] and V[pL] + M4R: ($1-d[qR])/(d[pR]-d[qR]) between V[qR] and V[pR] + line outlined rgbstring($2,$3,$4) \ + from M4L to M4R } + +# Projected box object: +[ +g = 1.2 +define(`axlen',1.2*g) +define(`O3',`0,0,0') +define(`X0',`axlen,0,0') +define(`Y0',`0,axlen,0') +define(`Z0',`0,0,axlen') + +# diagram viewing angle +dazim = 54 +delev = 15 +setview(dazim,delev) + +# projection azimuth, elevation +pazim = 20*dtor_ +pelev = 35*dtor_ +arad = 0.6*g + +# object displacement +define(`D3',`0.3*g,0.6*g,0.9*g') + +# fixed coordinate frame +O: project(O3) +X: project(X0) +Y: project(Y0) + Fector(X0,Z0) with .Origin at O ; "svg_it(x`'svg_sub(0))" at X rjust + Fector(Y0,Z0) with .Origin at O ; "svg_it(y`'svg_sub(0))" at Y ljust below + Fector(Z0,Y0) with .Origin at O ; "svg_it(z`'svg_sub(0))" at project(Z0) above + +define(`R01',`rot3Dz(pazim,rot3Dy(-pelev,$1,$2,$3))') +define(`R10',`rot3Dy(pelev,rot3Dz(-pazim,$1,$2,$3))') + +thinlines_ ; psset_(linecolor=gray) + line from O to project(rot3Dz(pazim,axlen,0,0)) +psset_(linecolor=black) + arc -> ccw from project(arad,0,0) to project(rot3Dz(pazim,arad,0,0)) rad arad + "svg_theta" below + up_ + arc -> cw from project(rot3Dz(pazim,arad,0,0)) \ + to project(R01(arad,0,0)) rad arad + "svg_phi" rjust at project(rot3Dz(pazim,rot3Dy(-pelev/2,arad,0,0))) + arc -> from project(0,arad,0) to project(R01(0,arad,0)) rad arad + "svg_theta" above + right_ + arc -> cw from project(0,0,arad/2) to project(R01(0,0,arad/2)) rad arad/2 + "svg_phi" ljust at Here+(-1pt__,-3pt__) + + Fector(R01(X0),R01(Z0)) with .Origin at O ; + "svg_it(x`'svg_sub(1))" above rjust at project(R01(X0)) + Fector(R01(Y0),R01(Z0)) with .Origin at O ; + "svg_it(y`'svg_sub(1))" ljust at project(R01(Y0)) + Fector(R01(Z0),R01(Y0)) with .Origin at O ; + "svg_it(z`'svg_sub(1))" above at project(R01(Z0)) +thicklines_ + +# box object dimension +b = 0.6*g +d = 0.4*g +h = 0.20*g + +# box object corners +define(`B0',`D3') +define(`B1',`sum3D(D3,d,0,0)') PB1: project(B1) +define(`B2',`sum3D(D3,d,b,0)') PB2: project(B2) +define(`B3',`sum3D(D3,0,b,0)') PB3: project(B3) +define(`B4',`sum3D(D3,0,0,h)') PB4: project(B4) +define(`B5',`sum3D(D3,d,0,h)') PB5: project(B5) +define(`B6',`sum3D(D3,d,b,h)') PB6: project(B6) +define(`B7',`sum3D(D3,0,b,h)') PB7: project(B7) + +# projected corners +P0:project(R01(0,dcosine3D(2,R10(B0)),dcosine3D(3,R10(B0)))) +P1:project(R01(0,dcosine3D(2,R10(B1)),dcosine3D(3,R10(B1)))) +P2:project(R01(0,dcosine3D(2,R10(B2)),dcosine3D(3,R10(B2)))) +P3:project(R01(0,dcosine3D(2,R10(B3)),dcosine3D(3,R10(B3)))) +P4:project(R01(0,dcosine3D(2,R10(B4)),dcosine3D(3,R10(B4)))) +P5:project(R01(0,dcosine3D(2,R10(B5)),dcosine3D(3,R10(B5)))) +P6:project(R01(0,dcosine3D(2,R10(B6)),dcosine3D(3,R10(B6)))) +P7:project(R01(0,dcosine3D(2,R10(B7)),dcosine3D(3,R10(B7)))) +thinlines_ + line from PB1 to P1 + line from PB2 to P2 + line from PB7 to P7 + line from PB4 to P4 +thicklines_ + +# draw the object + ifdpic(`line invis fill_(1) from PB4 to PB7 to PB6 to PB5 + line from PB4 to PB7; line to PB6; line to PB5 ; line to PB4 + line invis fill_(0.5) from PB5 to PB6 to PB2 to PB1 + line from PB5 to PB6; line to PB2; line to PB1 ; line to PB5 + line invis fill_(0.85) from PB6 to PB7 to PB3 to PB2 + line from PB6 to PB7; line to PB3; line to PB2 ; line to PB6', + `gshade(1,PB4,PB7,PB6,PB5,PB4,PB7) + gshade(0.5,PB5,PB6,PB2,PB1,PB5,PB6) + gshade(0.85,PB6,PB7,PB3,PB2,PB6,PB7)') + line from PB4 to PB5 to PB1 to PB2 to PB3 to PB7 to PB4 + line from PB5 to PB6 to PB7 + line from PB6 to PB2 + + arrow from O to PB1 chop linethick pt__; "svg_it(X)" rjust + + line from P4 to P5 to P1 to P2 to P3 to P7 to P4 + line from P5 to P6 to P7 + line from P6 to P2 + line dashed from P4 to P0 to P3 + line dashed from P0 to P1 + ] + +# Globe: +[ + # Set small text size + iflatex(`textoffset = 1bp__; ifpsfrag(`textht = 9.5bp__', + `latexcommand({\small)') ') + + azimuth = 15 # View angles in degrees + elevation = 35 + setview(azimuth,elevation) + + rectwid = 3.5 # Basic dimensions + rectht = 2.4 + alpha = rectht/3 + +# # Rectangle + NW: project(-rectht/2,-rectwid*0.25,0) + SW: project( rectht/2,-rectwid*0.25,0) + SE: project( rectht/2, rectwid*0.75,0) + NE: project(-rectht/2, rectwid*0.75,0) + + shadedpolygon(NW:NE:SE:SW,,-90, + 0,0.25,0.25,0.25, + 1,1,1,1) with .Start at NW + + define(`C3D',`0,0,alpha') # Centre of the sphere + C: project(C3D) + +# # Shaded sphere using PSTricks or tikz: +# # this is black magic but PSTricks +# # seems to give more control +# ifpstricks( +# `Highlight: \ +# project(sum3D(C3D,rot3Dz(-15*dtor_,rot3Dy(-60*dtor_,alpha,0,0)))) +# command "\pscustom[fillstyle=gradient,gradmidpoint=0.0,%" +# command sprintf("gradbegin=gray,gradend=white,gradlines=%g,%%",alpha*200) +# command "GradientCircle=true,GradientScale=1.5,%" +# command sprintf("GradientPos={(%g,%g)}]{",Highlight.x,Highlight.y) +# circle rad alpha at C +# command "}%"', +# +# `ifpgf( # A little too dark with tikz-pgf, maybe: +# `command sprintf(\ +# "\dpicdraw[ball color=white](%g,%g) circle (%gin)\dpicstop",\ +# C.x,C.y,alpha/2.54)', +# +# `circle rad alpha at C fill_(1) ')') + + # Shaded sphere with pic shading: + shadedball(alpha) at C + + S: 0,0 # The sphere bottom touch point + "svg_it(S)" at S+(0,-2pt__) rjust + "svg_alpha" at 0.5<S,C> ljust + + define(`N3D',`0,0,2*alpha') # North pole + N: project(N3D) + "svg_it(N)" at N+(0,3pt__) ljust + + phi = 65*dtor_ + define(`Phat3D',`rot3Dz(phi,alpha*3,0,0)') + Phat: "svg_it(P)" at project(Phat3D) ljust + "svg_symbol(&`#'94;)" at last "".n ljust + + X: project(rectht/2*0.8,0,0) + Y: project(0,rectwid/2*0.8,0) + +`define' linevis { # ratio # Visibility function for lines fom S to Tmp + Tlv: $1 between S and Tmp + $2 = distance(Tlv,C)-alpha } + +`define' invisline { # name # Draw dashed invisible part of line in + Tmp: $1 # the plane + findroot(linevis, 0, 1, 1e-8, x) + line dashed from S to x between S and Tmp chop 0 chop 0.05 } + +thinlines_ # axes + invisline(X) + arrow to X chop 0.05 chop 0; "svg_it(x)" below + invisline(Y) + arrow to Y chop 0.05 chop 0; "svg_it(y)" ljust + line dashed from S to N chop 0 chop 0.05 + arrow up alpha*0.5 chop 0.05 chop 0 ; "svg_it(z)" above + invisline(Phat) + line to Phat chop 0.05 chop 0 + arc ccw -> rad alpha from project(alpha/2,0,0) to \ + project(rot3Dz(phi,alpha/2,0,0)) + "svg_phi" below at 0.5 between last arc.start and last arc.end + + # vector (ratio along (N to Phat)) +define(`ray',`sum3D(N3D,sprod3D($1,diff3D(Phat3D,N3D)))') +`define' rayvis { # ratio + $2 = length3D(diff3D(ray($1),C3D))-alpha } + + findroot(rayvis, 1e-3, 1, 1e-8, p) # Find P + P: "svg_it(P)" at project(ray(p)) ljust above + +thicklines_ + line dashed from N to P chop 0 chop 0.05 + line to Phat chop 0.05 chop 0 + +define(`meridian',`rot3Dz(phi,rot3Dy(-($1),alpha,0,0))') +`define' meridianvis { # angle # Visibility function on the meridian + $2 = dot3D(meridian($1),View3D) } + +thinlines_ # Draw the meridian + findroot(meridianvis, 0, pi_, 1e-8, y) + n = 0 + for ang = y-pi_ to y by pi_/20 do { + Q[n]: project(sum3D(C3D,meridian(ang))); n+=1 } + fitcurve(Q,n-1) + n = 0 + for ang = y to y+pi_ by pi_/20 do { + Q[n]: project(sum3D(C3D,meridian(ang))); n+=1 } + fitcurve(Q,n-1,dashed) + +define(`equator',`rot3Dz($1,alpha,0,0)') +`define' equatorvis { # angle # Visibility function on the equator + $2 = dot3D(View3D,equator($1)) } + + findroot(equatorvis, 0, pi_, 1e-8, y) + n = 0 + for ang = y-pi_ to y by pi_/20 do { + Q[n]: project(sum3D(C3D,equator(ang))); n+=1 } + fitcurve(Q,n-1) + n = 0 + for ang = y to y+pi_ by pi_/20 do { + Q[n]: project(sum3D(C3D,equator(ang))); n+=1 } + fitcurve(Q,n-1,dashed) + + line dashed from C to P # beta + line dashed from C to project(sum3D(C3D,equator(phi))) + arc ccw -> from 0.6 along_(last line) to 0.6 between C and P + "svg_beta" ljust at last arc.e+(0,2pt__) + + iflatex(ifpsfrag(,`latexcommand(})')) + ] with .w at last [].e+(0.5,0) + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/fetSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/fetSVG.m4 new file mode 100644 index 00000000000..2393513219a --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/fetSVG.m4 @@ -0,0 +1,152 @@ +.PS +# `fetSVG.m4' +cct_init(svg_font(Times,11bp__)) +dwn = 0.8 +rgt = 0.9 + +dnl `IRF4905(linespec,R)' +define(`IRF4905', + `[ ifelse(`$1',,,`eleminit_(`$1')') + Q: mosfet(,`$2',LdPzEDSQdB,) ifelse(`$1',,` + S: Q.tr_xy(-4,-2); line from Q.tr_xy(-2,-2) to S + D: Q.tr_xy( 4,-2); line from Q.tr_xy(2,-2) to D', + `with .Diode.c at last line.c + S: last line.start; D: last line.end; line from S to D ') + G: Q.G + circle rad 5*dimen_/10 at Q.tr_xy(0,1) ]') + +define(`rmove',0.75) +define(`dir_',`right_') + +dir_ + {j_fet(right_ dimen_,,,E) + `"j_fet(right_ dimen_,,,E)"' wid 1.5 at last [].s+(0.0,-0.05) below + "G" at last [].G rjust above + "S" at last [].S rjust + "D" at last [].D ljust + } + + {move down_ dwn; dir_ + j_fet(,,P,) + `"j_fet(,,P,)"' at last [].s+(0,-0.05) below + "G" at last [].G rjust + "S" at last [].S rjust + "D" at last [].D ljust + } + + move right_ 1.35; dir_ + {e_fet(,R,,) + `"e_fet(,R,,)"' at last [].s+(0,-0.2) below + "G" at last [].G rjust + "S" at last [].S rjust + "D" at last [].D ljust + } + + {move down_ dwn; dir_ + e_fet(,,P,) + `"e_fet(,,P,)"' at last [].s+(0,-0.05) below} + + move right_ 1; dir_ + {d_fet(,,,) + `"d_fet(,,,)"' at last [].s+(0,-0.05) below} + + {move down_ dwn; dir_ + d_fet(,,P,) + `"d_fet(,,P,)"' at last [].s+(0,-0.05) below} + + move right_ 1; dir_ + {e_fet(,,,S) + `"e_fet(,,,S)"' at last [].s+(0,-0.05) below} + + {move down_ dwn; dir_ + e_fet(,,P,S) + `"e_fet(,,P,S)"' at last [].s+(0,-0.05) below} + + move right_ 1; dir_ + {d_fet(,,,S) + `"d_fet(,,,S)"' at last [].s+(0,-0.05) below} + + {move down_ dwn; dir_ + d_fet(,,P,S) + `"d_fet(,,P,S)"' at last [].s+(0,-0.05) below} +right_ +{ [ + c_fet(,,,) + `"c_fet(,,,)"' at last [].s+(0,-0.05) below + move right rgt from last [].e + c_fet(,,P) + `"c_fet(,,P)"' at last [].s+(0,-0.05) below + ] with .n at 5th last [].s+(0,-0.3) + } +move down 1; right_ +[ + linewid = linewid*1.2 + + Q1: mosfet(,,dGSDF,) + { "`mosfet'(,,dGSDF,)" at last [].s+(0,-0.1) below wid 1.3 + thinlines_ + arrow <- down .05 left .15 from (Q1.G.x,Q1.G.y-0.05) + "dG" rjust + arrow <- down .10 left .30 from Q1.Channel.start+(.15,0) + "F" rjust + arrow <- down .05 left .15 from (Q1.S.x,Q1.S.y+0.05) + "S" rjust + arrow <- down .05 right .15 from (Q1.D.x,Q1.D.y+0.05) + "D" ljust + thicklines_ } + + move right_ rmove + Q2: mosfet(,,uHSDF,) + {"`...'(,,uHSDF,)" at last [].s+(0,-0.15) below + thinlines_ + arrow <- down .05 left .15 from (Q2.G.x,Q2.G.y-0.05) + "uH" rjust + thicklines_ } + + move right_ rmove + Q3: mosfet(,,LEDSQuB,) + {"`...'(,,LEDSQuB,)" at last [].s+(0,-0.15) below + thinlines_ + arrow <- down .05 left .15 from (Q3.G.x,Q3.G.y-0.05) + "L" rjust + arrow <- down .13 left .30 from Q3.Channel.start+(.12,0) + "E" rjust + arrow <- down .05 left .10 from Q3.S+(.06,0) + "Q" rjust + arrow <- down .08 right .24 from (Q3.B.x,Q3.B.y+0.175) + "uB" ljust + thicklines_ } + + move right_ rmove + Q4: mosfet(,,LEDSuB) + {`"...(,,LEDSuB)"' at last [].s+(0,-0.15) below + "G" at last [].G rjust + "S" at last [].S rjust + "D" at last [].D ljust + "B" at last [].B below + } + + move right_ rmove + Q5: mosfet(,,ZSDFdT,) + {"`...'(,,ZSDFdT,)" at last [].s+(0,-0.05) below + thinlines_ + arrow <- down .08 left .08 from (Q5.S.x,Q5.S.y+0.12) + "Z" rjust + arrow from last arrow.end to Q5.Channel.c+(0.05,0) + arrow from last arrow.start to (Q5.D.x,Q5.D.y+.05) + arrow <- down .08 right .24 from (Q5.G.x,Q5.G.y-0.02) + "dT" ljust + thicklines_ } + + move right_ rmove + up_ + Q6: IRF4905 with .c at Here + {`"IRF4905"' at Q6.s+(0,-0.15) below + "G" at Q6.G rjust + "D" wid 0.1 at Q6.D ljust above + "S" at Q6.S ljust below + } + ] with .n at last [].s+(0,-.2) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/graysurfSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/graysurfSVG.m4 new file mode 100644 index 00000000000..9ea55807039 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/graysurfSVG.m4 @@ -0,0 +1,190 @@ +.PS +# graysurfSVG.m4 +threeD_init +copy "HOMELIB_/dpictools.pic" + +Overall: [ + +Surface:[ +# This just draws the facets back to front + + setview(20,30) + dimen = 1.5 + + xmax = 2*dimen + ymax = 1.5*dimen + zmax = 1*dimen + + define(`fn', + `expe(-(`$1')/tt)*cos((`$2')/xmax*1.75*twopi_)*cos((`$1')/ymax*twopi_)') + + nx = 24; dx = xmax/nx + ny = 30; dy = ymax/ny + tt = 1.5 + fnmax = fn(0,0,0) + + Orig: (0,0) + linethick_(1.2) + arrow from Orig to 1.2 <Orig,(project(xmax,0,0))> ; "svg_it(x)" wid 0.08 below + arrow from Orig to 1.2 <Orig,(project(0,ymax,0))> ; "svg_it(y)" ljust + arrow from Orig to 1.2 <Orig,(project(0,0,zmax))> ; "svg_it(z)" rjust + + linethick_(0) + for i = 0 to nx-1 do { + x = xmax*i/nx + for j = 0 to ny-1 do { + y = ymax*j/ny + fnxy = fn(x,y) + shade((fnmax+fnxy)/fnmax/2, + line from (project(x,y,fnxy)) to (project(x,(y+dy),`fn(x,(y+dy))'))\ + then to (project((x+dx),(y+dy),`fn((x+dx),(y+dy))'))\ + then to (project((x+dx),y,`fn((x+dx),y)'))\ + then to (project(x,y,fnxy)) + ) } } +] with .w at last [].e+(-0.2,0) + +Torus: [ +# Calculate all the facet centres but draw +# only a subset of them after sorting + + viewazimuth = 20 # Set view angles in degrees + viewelevation = 30 + + setview(viewazimuth,viewelevation,0) + + sfactor = 0.7 + tradius = 2*sfactor + sradius = 0.75*sfactor + +define(`torus',`rot3Dz((`$1')*dtor_, + sum3D(tradius,0,0,rot3Dy((`$2')*dtor_,sradius,0,0)))') + +define(`tvisible',`dot3D(view3D1,view3D2,view3D3, + rot3Dz((`$1')*dtor_,rot3Dy((`$2')*dtor_,1,0,0)))') + +Orig: (0,0) +X: arrow from Orig to (project(tradius+sradius*4,0,0)); "x" rjust +Y: arrow from Orig to (project(0,tradius+sradius*2,0)); "y" below wid 4bp__ + + dt = 10 # major angle degrees per facet + ds = 10 # minor angle degrees per facet + + # create the arrays and sort + n = 0 + for t = dt to 360+dt/2 by dt do { + for s=ds/2 to 360.1 by ds do { + if tvisible(t,s) >= 0 then { + n +=1 + t[n] = t + s[n] = s + d[n] = dot3D(torus(t,s),view3D1,view3D2,view3D3) # view distance + ix[n] = n + } } } +#prval(n) + dpquicksort(d,1,n,ix) + + # draw the facets +thinlines_ + for i = 1 to n do { + tc = t[ix[i]]; sc = s[ix[i]] + SE: (project(torus(tc+dt/2,sc-ds/2))) + SW: (project(torus(tc-dt/2,sc-ds/2))) + NW: (project(torus(tc-dt/2,sc+ds/2))) + NE: (project(torus(tc+dt/2,sc+ds/2))) + f = ((dcosine3D(3,torus(tc,sc))/sradius+1)/2)^2 + g = min(f,0.9) + setrgb(g,g,g) +# line fill f ifpdf( invis ) \ +# from SE to SW then to NW then to NE then to SE + shade(f, + line invis fill f from SE to SW then to NW then to NE then to SE ) + + resetrgb + } + +thicklines_ + arrow from Orig to (project(0,0,tradius*1.4)); "z" above + dashline(from Orig to (project(torus(0,0))),,,,G) + arrow to X.end + dashline(from Orig to (project(torus(90,0))),,,,G) + arrow to Y.end + +] with .sw at last [].se+(0.2,0) + +Hat: [ +# Sort as for the torus but draw edges too + + azimuth = 25 # View angles in degrees + elevation = 20 + setview(azimuth,elevation) + # the 3D object: `hat(t,y)' + define(`hat',`cosd($1)*($2),sind($1)*($2),(($2)^2-1)^2') + define(`gradient',`(-4*($2)*(($2)^2-1)*cosd(`$1')), + (-4*($2)*(($2)^2-1)*sind(`$1')),1') + define edge {$2=dot3D(View3D,gradient($1,y))} + define(`hatvis', + `(($2 > 0.6) || (dot3D(View3D,gradient($1,$2)) > 0))') + + # grid parameters + dang = 09 + maxy = 1.25 + dy = 0.05 + +Orig: (0,0) +X: arrow from Orig to (project(maxy*1.2,0,0)); "x" rjust +Y: arrow from Orig to (project(0,maxy*1.2,0)); "y" ljust +Xv: (project(1,0,0)) +Yv: (project(0,1,0)) +Zv: (project(0,0,1)) + # create the arrays and sort + n = 0 + for t = dang/2 to 360.1 by dang do { + for y=dy/2 to maxy by dy do { + if hatvis(t,y) then { + n +=1 + t[n] = t + y[n] = y + d[n] = dot3D(hat(t,y),View3D) #distance toward the front + ix[n] = n + } } } +#prval(n) + dpquicksort(d,1,n,ix) + # draw the facets + ellipse wid maxy*2 ht maxy*2*sind(elevation) \ + with .c at (project(0,0,(maxy^2-1)^2)+linethick bp__/2) +thinlines_ + for i = 1 to n do { + tc = t[ix[i]]; yc = y[ix[i]] + SE: (project(hat(tc+dang/2,yc-dy/2))) + SW: (project(hat(tc-dang/2,yc-dy/2))) + NW: (project(hat(tc-dang/2,yc+dy/2))) + NE: (project(hat(tc+dang/2,yc+dy/2))) + f = abs(yc^2-1) + line invis fill f from SE to SW then to NW then to NE then to SE + } + + # Outline where the surface goes invisible +mm = int(maxy/dy) +nr = -1 +for i=1 to mm do { y = i/(mm+3) + findroot(edge,(azimuth+2),(azimuth+180-2),1e-8,t) + nr +=1 + R[mm+nr]: (project(hat(t,y))) + R[mm-1-nr]: (-R[mm+nr].x,R[mm+nr].y) + } +fitcurve(R,mm*2-1) + + # Z axis +thicklines_ +Z: arrow from Zv to (project(0,0,1.2)); "z" ljust + line dashed from Orig to Zv chop 0 chop dashwid/2 + line dashed from Orig to Xv + line dashed from Orig to Yv + + # Partial rim +ellipsearc(maxy*2,maxy*2*sind(elevation),-pi_*1.4,pi_/3) \ + with .C at (project(0,0,(maxy^2-1)^2)+linethick bp__/2) +] scaled 1.25 with .s at 1st [].ne+(0,-0.75) +] scaled 0.85 + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4 new file mode 100644 index 00000000000..88ea5b65a04 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4 @@ -0,0 +1,122 @@ +divert(-1) + + Macros defining some integrated circuits + +define(`lg_pinsep',3*L_unit) logic pin separation in logic units +define(`lg_chipwd',18*L_unit) default chip width + + `A sequence of pins along the east or west side of a chip: + lg_pinseq(initial pin no,final pin no, + e|w,initial offset,pinnum_root,Labelroot,[not])' +define(`lg_pinseq',`for_($1,$2,1, + `lg_pin( Chip.s`$3'+(0,eval($4+m4x)*lg_pinsep), + $6`'m4x,Pin`'eval($5`'m4x),`$3'`$7',eval($5`'m4x))') ') + +define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep + "6116" at Chip.sw+(0,-2bp__) below ljust + lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin12,w,12) + lg_pin(Chip.sw_+(0,2*lg_pinsep),,Pin18,wN,18) + "svg_small(CS,75)" wid textht*1.5 at (Chip.w,last line) ljust + { line right last "".wid from last "".nw+(1,0)*textoffset } + + lg_pinseq(0,2,w,4,9+,D) + lg_pinseq(3,7,w,4,10+,D) + lg_pin(Chip.sw_+(0,13*lg_pinsep),,Pin21,w,21) + "svg_small(R/W,75)" wid textht*2.0 at (Chip.w,last line) ljust + { line right last "".wid/2 from last "".n+(2,0)*textoffset } + + lg_pin(Chip.sw_+(0,14*lg_pinsep),V`'svg_small(CC,75),Pin24,w,24) + lg_pin(Chip.se_+(0,lg_pinsep),,Pin20,eN,20) + "svg_small(OE,75)" wid textht*1.5 at (Chip.e,last line) rjust + { line left last "".wid from last "".ne+(-1,0)*textoffset } + + lg_pinseq(0,7,e,3,8-,A) + lg_pinseq(8,9,e,3,31-,A) + lg_pin(Chip.se_+(0,13*lg_pinsep),A10,Pin19,e,19) + ]') + +define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep + "6502" at Chip.sw_+(0,-2bp__) below_ ljust_ + lg_pin(Chip.sw_+(0,lg_pinsep),V`'svg_small(SS,75),Pin21,w,21) + lg_pin(Chip.sw_+(0,2*lg_pinsep),V`'svg_small(SS,75),Pin1,w,1) + lg_pin(Chip.sw_+(0,4*lg_pinsep),,Pin34,w,34) + "svg_small(R/W,75)" wid textht*2.0 at (Chip.w,last line) ljust + { line right last "".wid/2 from last "".n+(2,0)*textoffset } + + lg_pinseq(0,7,w,6,33-,D) + lg_pin(Chip.sw_+(0,15*lg_pinsep),,Pin40,wN,40) + "svg_small(RESET,75)" wid textht*3.8 at (Chip.w,last line) ljust + { line right last "".wid from last "".nw+(1,0)*textoffset } + + lg_pin(Chip.sw_+(0,17*lg_pinsep),SYNC,Pin7,w,7) + lg_pin(Chip.sw_+(0,19*lg_pinsep),,Pin6,wN,6) + "svg_small(NMI,75)" wid textht*2.1 at (Chip.w,last line) ljust + { line right last "".wid from last "".nw+(1,0)*textoffset } + + lg_pin(Chip.sw_+(0,21*lg_pinsep),RDY,Pin2,w,2) + lg_pin(Chip.sw_+(0,22*lg_pinsep),SO,Pin38,w,38) + lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'svg_small(CC,75),Pin8,w,8) + lg_pin(Chip.se_+(0,lg_pinsep),CK`'svg_small(1,75)(in),Pin39,e,39) + lg_pin(Chip.se_+(0,4*lg_pinsep),CK`'svg_small(2,75)(out),Pin37,e,37) + lg_pinseq(0,11,e,6,9+,A) + lg_pinseq(12,15,e,6,10+,A) + lg_pin(Chip.se+(0,23*lg_pinsep),,Pin4,eN,4) + "svg_small(IRQ,75)" wid textht*2.0 at (Chip.e,last line) rjust + { line left last "".wid from last "".ne+(-1,0)*textoffset } + + ]') + +define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep + "6522" at Chip.sw+(0,-2bp__) below ljust + lg_pin(Chip.sw_+(0,lg_pinsep),V`'svg_small(SS,75),Pin1,w,1) + lg_pin(Chip.sw_+(0,3*lg_pinsep),CS1,Pin24,w,24) + lg_pin(Chip.sw_+(0,4*lg_pinsep),CK,Pin25,w,25) + lg_pin(Chip.sw_+(0,5*lg_pinsep),,Pin23,wN,23) + "svg_small(CS2,75)" wid textht*2.2 at (Chip.w,last line) ljust + { line right last "".wid from last "".nw+(1,0)*textoffset } + + lg_pin(Chip.sw_+(0,7*lg_pinsep),RS0(A0),Pin38,w,38) + lg_pin(Chip.sw_+(0,8*lg_pinsep),RS1(A1),Pin37,w,37) + lg_pin(Chip.sw_+(0,9*lg_pinsep),RS2(A2),Pin36,w,36) + lg_pin(Chip.sw_+(0,10*lg_pinsep),RS3(A3),Pin35,w,35) + lg_pinseq(0,7,w,12,33-,D) + lg_pin(Chip.sw_+(0,21*lg_pinsep),,Pin22,w,22) + "svg_small(R/W,75)" wid textht*2.0 at (Chip.w,last line) ljust + { line right last "".wid/2 from last "".n+(2,0)*textoffset } + + lg_pin(Chip.sw_+(0,22*lg_pinsep),,Pin21,wN,21) + "svg_small(IRQ,75)" wid textht*2.0 at (Chip.w,last line) ljust + { line right last "".wid from last "".nw+(1,0)*textoffset } + + lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'svg_small(CC,75),Pin20,w,20) + lg_pinseq(0,7,e,1,10+,PB) + lg_pinseq(1,2,e,8,17+,CB) + lg_pinseq(0,7,e,12,2+,PA) + lg_pinseq(1,2,e,19,41-,CA) + lg_pin(Chip.se_+(0,23*lg_pinsep),,Pin34,eN,34) + "svg_small(RESET,75)" wid textht*3.8 at (Chip.e,last line) rjust + { line left last "".wid from last "".ne+(-1,0)*textoffset } + + ]') + +define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep + "74LS138" at Chip.sw+(0,-2bp__) below ljust + lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin8,w,8) + lg_pin(Chip.sw_+(0,2*lg_pinsep),,Pin4,wN,4) + "svg_small(G2a,75)" wid textht*2.0 at (Chip.w,last line) ljust + { line right last "".wid from last "".nw+(1,0)*textoffset } + + lg_pin(Chip.sw_+(0,3*lg_pinsep),,Pin5,wN,5) + "svg_small(G2b,75)" wid textht*2.0 at (Chip.w,last line) ljust + { line right last "".wid from last "".nw+(1,0)*textoffset } + + lg_pin(Chip.sw_+(0,5*lg_pinsep),A,Pin1,w,1) + lg_pin(Chip.sw_+(0,6*lg_pinsep),B,Pin2,w,2) + lg_pin(Chip.sw_+(0,7*lg_pinsep),C,Pin3,w,3) + lg_pin(Chip.sw_+(0,9*lg_pinsep),G1,Pin6,w,6) + lg_pin(Chip.sw_+(0,10*lg_pinsep),V`'svg_small(CC,75),Pin16,w,16) + lg_pinseq(0,6,e,2,15-,Y,n) + lg_pin(Chip.se_+(0,9*lg_pinsep),Y7,Pin7,eN,7) + ]') + +divert(0)dnl diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/lcctSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/lcctSVG.m4 new file mode 100644 index 00000000000..0a91b823ccc --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/lcctSVG.m4 @@ -0,0 +1,195 @@ +.PS +# lcctSVG.m4 +maxpswid = 10 +log_init(svg_font(sans-serif,11bp__,1bp__)) +include(icsSVG.m4) + + textht = textht * 0.9 + +define(`dimen_',0.5) +define(`elen_',dimen_) +define(`Groundtype',`') + +define(`breakout',` for i = 1 to `$1' do { + {line `$2' ifelse(`$4',,del,`$4')-jog/2 then `$2' jog/2 `$3' jog \ + then `$3' lg_pinsep} + move `$3' lg_pinsep } + move `$2' ifelse(`$4',,del,`$4')-jog/2 then `$2' jog/2 `$3' jog ') + +del = lg_pinsep +jog = del*2/3 + + right_ +IC1: ic6502 + +Vcc: IC1.Pin8.end.x-del-elen_,IC1.Pin4.y+lg_pinsep+3*del +Reset: IC1.Pin8.end.x-del,Vcc.y+del + + resistor(up_ Vcc.y-IC1.Pin4.y from IC1.Pin4.end) + + line left 2*del from IC1.Pin6.end + line up_ to (Here,Vcc) chop 0 chop elen_ + resistor + + line left del from IC1.Pin40.end + {line to (Here,Reset)} + move left elen_ + {NOT_gate(right_ elen_)} + {reversed(`capacitor',to (Here,Vcc),C)} + down_; resistor; ground(,T,Groundtype) + + line from IC1.Pin2.end to (IC1.Pin2.end,Vcc) + + move to IC1.Pin26.end; breakout(8,left,down) + line to (Here,IC1.sw+(0,-del)) + line down jog right jog/2 +Data: Here + + line from IC1.Pin1.end down_ 2*lg_pinsep; ground(,T,Groundtype) + + line left 2*del from IC1.Pin34.end + line to (Here,Data+(0,-del)) +RWB: Here + + move to IC1.Pin25.end; breakout(16,right,down) + line to (Here,RWB)+(0,-del+jog) then down jog left jog/2 +Addr: Here + + right_ +IC5: ic74LS138 with .Chip.nw at (IC1.Chip.w.x,Addr.y-2*del) + line from IC5.Pin5.end down_ 3*lg_pinsep ; ground(,T,Groundtype) + line from IC5.Pin16.end down_ 1.5*lg_pinsep ; ground(,T,Groundtype) + move to IC5.Pin1.end; breakout(3,left,up) + line to Here.x,Addr.y-jog then up jog right jog/2 then to Addr + + line right_ 2*del from IC1.Pin39.end + { NOT_gate(right_ 3*del) +C1: Here } + capacitor(up_ elen_*0.6) + {resistor(right_ 3*del)} + line up 2*(IC1.Pin37.y-Here.y) + {line from IC1.Pin37.end to (Here,IC1.Pin37)} + right_; xtal(right_ 3*del) + +IC2: ic6116 with .Chip.nw at Here.x+2*del+lg_plen*L_unit,IC1.Chip.n.y + line from IC2.Pin24.end up to (IC2.Pin24.end,Vcc) + right_ +Or1: OR_gate with .Out at IC2.Pin21.end + line from Or1.In2 left del then down del + line to (C1,Here) then to C1 + line from Or1.In1 left del + line to (Here,IC2.Chip.nw+(0,del)) +RW: Here + move to IC2.Pin17.end; breakout(8,left,down) + line to (Here,Data)+(0,jog) then down jog left jog/2 + line down_ lg_pinsep from IC2.Pin12.end ; ground(,T,Groundtype) + move to IC2.Pin19.end; breakout(11,right,down) + line to (Here,Addr) chop 0 chop jog + line down jog left jog/2 + line down_ lg_pinsep from IC2.Pin20.end ; ground(,T,Groundtype) + + right_ +IC3: ic6116 with .Chip.nw at IC2.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) +IC4: ic6522 with .Chip.nw at IC3.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0) +IC6: ic74LS138 with .Chip.nw at (IC3.Chip.nw,IC5.Chip.nw) + + line from Vcc to (IC4.Pin34.end.x+del,Vcc.y) + line from Reset to (IC4.Pin34.end,Reset) then to IC4.Pin34.end + + line right_ 2*del from (C1,IC4.Pin25); NOT_gate; line to IC4.Pin25.end + line right del from IC1.Pin4.end; line to Here.x,Vcc.y-del + line to (IC4.Pin21.end,Here)-(del,0) then to IC4.Pin21.end-(del,0) \ + then to IC4.Pin21.end + + line from IC3.Pin21.end to (IC3.Pin21.end,Vcc) + move to IC3.Pin17.end + breakout(8,left,down); line to (Here,Data)+(0,jog) then down jog left jog/2 + move to IC3.Pin19.end + breakout(11,right,down); line to (Here,Addr)+(0,jog) then down jog left jog/2 + move to IC4.Pin26.end + breakout(8,left,down,2*del); + line to (Here,Data)+(0,jog) then down jog left jog/2 then to Data + move to IC4.Pin35.end + breakout(4,left,down); line to (Here,Addr)+(0,jog) then down jog left jog/2 \ + then to Addr + line from IC4.Pin20.end to (IC4.Pin20.end,Vcc) + line down_ lg_pinsep from IC4.Pin1.end; ground(,T,Groundtype) + line left 3*del from IC4.Pin23.end + line to (Here,IC6.Pin7) then to IC6.Pin7.end + line down_ 2*lg_pinsep from IC3.Pin18.end; ground(,T,Groundtype) + + line down_ lg_pinsep from IC6.Pin8.end; ground(,T,Groundtype) + line up_ 2.5*lg_pinsep from IC6.Pin16.end \ + then right_ lg_pinsep then down_ lg_pinsep/2; ground(,T,Groundtype) + move to IC6.Pin5.end; breakout(1,left,up); line up_ lg_pinsep + move to IC6.Pin1.end; breakout(3,left,up) + line to (Here,Addr)-(0,jog) then up jog left jog/2 + + line from RW to (IC3.Pin19.end+(2*del,0),RW) +RWE: Here + line to (RWE,RWB) then to RWB + line from IC4.Pin22.end to (RWE,IC4.Pin22.end) + + right_ +Or3: OR_gate with .Out at IC3.Pin20.end.x-del,IC1.Pin9.y + line from Or3.Out to (IC3.Pin20.end,Or3.Out) then to IC3.Pin20.end + left_ +Or2: OR_gate with .In2 at (IC2.Chip.se,Or3.In1) + line from Or2.Out to (IC2.Pin18.end-(3*del,0),Or2.Out) + line to (Here,IC2.Pin18) then to IC2.Pin18.end + line from Or2.In1 right del; line to (Here,IC1.Pin37) + + line from Or3.In2 left del; line to (Here,IC1.Pin37) + +define(`addrlabel',`dnl + line invis right 4*del from IC5.Pin`$1'.end "svg_small(`$2')" above ') + + addrlabel( 7,E000 - FFFF) + addrlabel( 9,C000 - DFFF) + addrlabel(10,A000 - BFFF) + addrlabel(11,8000 - 9FFF) + addrlabel(12,6000 - 7FFF) + addrlabel(13,4000 - 5FFF) + addrlabel(14,2000 - 3FFF) + addrlabel(15,0000 - 1FFF) + + line from IC5.Pin7.end right 4*del +K: Here; line to (K,IC5.Pin13) + line to (IC6.Pin4.end-(3*del,0),Here) + line to (Here,IC6.Pin4.end) then to IC6.Pin4.end + +Ands: [ right_ + And1: AND_gate; line right del/2 then down del*3/2 \ + then left And1.Out.x-And1.In1.x+del then down del then right_ del/2 + And2: AND_gate with .In1 at Here + line from And2.Out right del/2 then down del then right_ del/2 + And3: AND_gate with .In1 at Here + line right_ del/2 from And3.Out + NOT_gate + line right_ del/2 + And4: AND_gate with .In1 at Here + ] with .And2.In1 at (K.x+2*del,IC5.Pin9.y) + +# line from Ands.And4.Out right del*3; line to (Here,Or3.In1) then to Or3.In1 + line from Ands.And4.Out right IC6.Pin5.end.x-3*del-Ands.And4.Out.x + line to (Here,Or3.In1) then to Or3.In1 + line from Ands.And4.In2 left del + line to (Here,IC5.Pin14) then to IC5.Pin14.end + line from IC5.Pin15.end to (IC2.Pin20.end.x+2*del,IC5.Pin15.y) + line to (Here,Or2.In2) then to Or2.In2 + NOT_gate(right_ from (K,Ands.And3.In2) to Ands.And3.In2) + line from Ands.And2.In2 to (K+(del+jog/2,0),Ands.And2.In2) + line left jog/2 up jog; line to (Here.x,Addr.y-jog) then up jog left jog/2 + line from Ands.And1.In1 to (K.x+del+jog/2,Ands.And1.In1.y) \ + then left jog/2 up jog + line from Ands.And1.In2 to (K.x+del+jog/2,Ands.And1.In2.y) \ + then left jog/2 up jog + + line from IC6.Pin6.end left 2*del; line to (Here,IC4.Pin24) + line from IC4.Pin24.end to (IC2.Chip.se,IC4.Pin24) + move left dimen_; {NOT_gate(right_ dimen_)} + line left jog/2 down jog; line to (Here,Data) chop 0 chop jog + line down jog left jog/2 + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/local_init.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/local_init.m4 new file mode 100644 index 00000000000..bf2dbda5976 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/local_init.m4 @@ -0,0 +1,2 @@ +command "<!-- local_init has been read -->" +define(`Inkscape') diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/paletteSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/paletteSVG.m4 new file mode 100644 index 00000000000..2a26afdb991 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/paletteSVG.m4 @@ -0,0 +1,340 @@ +.PS +# This is the source for a prototype svg library of electric circuit +# elements. Each element is a compound svg object with corners on grid points. +# +# Processing svg.m4 and this file thought dpic -v gives +# output that can be read into Inkscape. +# +define(`SIdefaults',` + scale = 25.4 + arcrad = 5 + arrowht = 2.5 + arrowwid = arrowht/2 + boxht = 12 + boxrad = 0 + boxwid = 20 + circlerad = 5 + dashwid = 1.5 + ellipseht = 12 + ellipsewid = 16 + lineht = 12 + linewid = 12 + moveht = 12 + movewid = 12 + textht = ifsvg(3,0) + textoffset = 1 + textwid = 0 +') + +log_init(svg_font(sans-serif,11bp__)) +SIdefaults + + # Assume dpic scale is in mm +gunit = 1 # Inkscape grid dimension +divert(-1) +define(`elen_',`(10*gunit)') # default 2-terminal element length +define(`dimen_',`(10*gunit)')# reference dimension for element bodies +define(`L_unit',`(2*gunit)') # logic gate grid size +define(`N_diam',1) # L_unit size of `not' circles + + # grid round and chop +define(`g_round',`(int((`$1')/gunit+100000.5 )-100000)*gunit') +define(`g_chop', `(int((`$1')/gunit+100000.9999)-100000)*gunit') + # snap to grid +define(`g_snap',`(g_round((`$1').x),g_round((`$1').y))') + +# Box containing an element. The element must be in a box that is +# intersected by a horizontal or vertical line from entry to exit. +define(`Gridbox',`[ command "<g>" + S: Here; `$1'; F: Here + if S.y == F.y then { + move from (max(S.x,F.x),F.y+g_chop(last[].n.y-F.y)) \ + to (min(S.x,F.x),F.y-g_chop(F.y-last[].s.y)) } \ + else { + move from (F.x+g_chop(last[].e.x-F.x),max(S.y,F.y)) \ + to (F.x-g_chop(F.x-last[].w.x),min(S.y,F.y)) } + command "</g>" ] ') + +# Place compound object corners at grid intersections +define(`Below', + `with .n at g_snap(ifelse(`$1',,`last []',`$1').s)-(0,2*gunit)') +define(`Right', + `with .w at g_snap(ifelse(`$1',,`last []',`$1').e)+(2*gunit,0)') + +# for debug +define(`prpos',`print (`$1').x/gunit,(`$1').y/gunit') +divert(0)dnl + +[ + +rpoint_(down_ elen_) +A:Gridbox( resistor ) + Gridbox( resistor(down_ dimen_*1/2) ) Right + Gridbox( resistor(,,E) ) Right + Gridbox( resistor(,,Q) ) Right + Gridbox( resistor(,,H) ) Right + Gridbox( resistor(,,N) ) Right + Gridbox( inductor(,W) ) Right + Gridbox( inductor(,W,,M) ) Right + Gridbox( inductor(,L) ) Right + Gridbox( inductor ) Right + Gridbox( inductor(,,,M) ) Right + Gridbox( capacitor ) Right + Gridbox( capacitor(,C) ) Right + Gridbox( capacitor(,P) ) Right + Gridbox( capacitor(,E) ) Right + Gridbox( capacitor(,K) ) Right + Gridbox( diode ) Right + Gridbox( diode(,K) ) Right + Gridbox( diode(,Z) ) Right + Gridbox( diode(,S) ) Right + Gridbox( diode(,L) ) Right + Gridbox( diode(,V) ) Right + Gridbox( diode(,v) ) Right + Gridbox( diode(,T) ) Right + Gridbox( diode(,CR) ) Right + Gridbox( diode(,D) ) Right + Gridbox( diode(,B) ) Right + Gridbox( diode(,LE) ) Right + Gridbox( [circle diam dimen_*0.7] ) Right + Gridbox( xtal ) Right + dot(at g_snap(last [].e+(2*gunit,0))) + +A:Gridbox( source ) Below(A) + Gridbox( source(,I) ) Right + Gridbox( source(,i) ) Right + Gridbox( source(,V) ) Right + Gridbox( source(,v) ) Right + Gridbox( source(,AC) ) Right + Gridbox( source(,S) ) Right + Gridbox( source(,X) ) Right + Gridbox( source(,F) ) Right + Gridbox( source(,P) ) Right + Gridbox( source(,U) ) Right + Gridbox( source(,R) ) Right + Gridbox( source(,T) ) Right + Gridbox( source(,L) ) Right + Gridbox( nullator ) Right + Gridbox( norator ) Right + Gridbox( consource ) Right + Gridbox( consource(,I) ) Right + Gridbox( consource(,i) ) Right + Gridbox( consource(,V) ) Right + Gridbox( consource(,v) ) Right + Gridbox( source(,Q) ) Right + Gridbox( source(,G) ) Right + +A:Gridbox( battery(up_ elen_) ) Below(A) + Gridbox( battery(up_ elen_,3) ) Right + Gridbox( ttmotor ) Right + Gridbox( memristor ) Right + Gridbox( tline ) Right + Gridbox( fuse ) Right + Gridbox( fuse(,D) ) Right + Gridbox( fuse(,B) ) Right + Gridbox( fuse(,C) ) Right + Gridbox( fuse(,S) ) Right + Gridbox( fuse(,HB) ) Right + Gridbox( fuse(,HC) ) Right + Gridbox( cbreaker ) Right + Gridbox( cbreaker(,,D) ) Right + Gridbox([variable(`[]',A)]) Right + Gridbox([variable(`[]',P)]) Right + Gridbox([variable(`[]',L)]) Right + Gridbox([variable(`[]',N)]) Right + Gridbox([variable(`[]',uN)]) Right + Gridbox([line to Here+(Rect_(dimen_/6,45))]) Right + Gridbox([line up dimen_*0.06 then right dimen_*0.12 \ + then up dimen_*0.06]) Right + Gridbox([em_arrows]) Right + Gridbox([em_arrows(N)]) Right + Gridbox([em_arrows(ND)]) Right + Gridbox([em_arrows(I)]) Right + Gridbox([em_arrows(ID)]) Right + Gridbox([em_arrows(E)]) Right + Gridbox([em_arrows(ED)]) Right + +A:Gridbox( [right_; ground] ) Below(A) + Gridbox( [right_; ground(,T)] ) Right + Gridbox( [right_; ground(,,F)] ) Right + Gridbox( [right_; ground(,,E)] ) Right + Gridbox( [right_; ground(,,S)] ) Right + Gridbox( [right_; ground(,,L)] ) Right + Gridbox( [right_; ground(,,P)] ) Right + Gridbox( transformer(right_ 6*gunit,L) ) Right + Gridbox( transformer(right_ 8*gunit,,2,8) ) Right + Gridbox( transformer(,,8,W,4) ) Right + Gridbox( transformer(,,9,AL) ) Right + Gridbox( transformer(,R,8,AW) ) Right + + rpoint_(right_) +A:Gridbox( switch ) Below(A) + Gridbox( switch(,,O) ) Right + Gridbox( switch(,,D) ) Right + Gridbox( switch(,,OD) ) Right + Gridbox( switch(,,C) ) Right + Gridbox( switch(,,B) ) Right + Gridbox( switch(,C,B) ) Right + Gridbox( dswitch ) Right + Gridbox( dswitch(,,WBK) ) Right + Gridbox( dswitch(,,WBuD) ) Right + Gridbox( dswitch(,,WBF) ) Right + Gridbox( dswitch(,,WBKF) ) Right + Gridbox( dswitch(,,WBL) ) Right + Gridbox( dswitch(,,WBKL) ) Right + +A:Gridbox( dswitch(,,WBT) ) Below(A) + Gridbox( dswitch(,,WdBKC) ) Right + Gridbox( dswitch(,,WBM) ) Right + Gridbox( dswitch(,,WBCO) ) Right + Gridbox( dswitch(,,WBCMP) ) Right + Gridbox( dswitch(,,WBCY) ) Right + Gridbox( dswitch(,,WBCZ) ) Right + Gridbox( dswitch(,,WBCE) ) Right + Gridbox( dswitch(,,WBRH) ) Right + Gridbox( dswitch(,,WBRdH) ) Right + Gridbox( dswitch(,,WBRHH) ) Right + +A:Gridbox( dswitch(,,WBMMR) ) Below(A) + Gridbox( dswitch(,,WBMM) ) Right + Gridbox( dswitch(,,WBMR) ) Right + Gridbox( dswitch(,,WBEL) ) Right + Gridbox( dswitch(,,WBLE) ) Right + Gridbox( dswitch(,,WBKEL) ) Right + Gridbox( antenna ) Right + Gridbox( antenna(,,L) ) Right + Gridbox( antenna(,,T) ) Right + Gridbox( antenna(,,S) ) Right + Gridbox( antenna(,,D) ) Right + Gridbox( antenna(,,P) ) Right + Gridbox( antenna(,,F) ) Right + +A:Gridbox( amp(right_ elen_*10/8) ) Below(A) +D1:Gridbox( integrator ) Right + Gridbox( delay ) Right + Gridbox( opamp ) Right + Gridbox( opamp(,,,,T) ) Right + Gridbox( amp(,dimen_/2) ) Right + Gridbox( integrator(,dimen_/2) ) Right + Gridbox( delay(,delay_rad_) ) Right + Gridbox( opamp(,,,dimen_*2/3) ) Right + Gridbox( opamp(,,,dimen_*2/3,T) ) Right + +right_ +A:Gridbox( relay(2) ) Below(A) + Gridbox( relay(2,O) ) Right + Gridbox( relay(2,C) ) Right + Gridbox( relay ) Right + Gridbox( contact ) Right + Gridbox( contact(O) ) Right + Gridbox( contact(C) ) Right + +up_ +A:Gridbox( [circle rad 29/10*gunit] ) Below(A) + Gridbox( bi_tr ) Right + Gridbox( bi_tr(,R) ) Right + Gridbox( bi_tr(,,P) ) Right + Gridbox( bi_tr(,R,P) ) Right + + Gridbox( j_fet ) Right + Gridbox( j_fet(,R) ) Right + Gridbox( j_fet(,,P,) ) Right + Gridbox( j_fet(,R,P,) ) Right + Gridbox( e_fet(,,,) ) Right + Gridbox( e_fet(,R,,) ) Right + + Gridbox( e_fet(,,P,) ) Right + Gridbox( e_fet(,R,P,) ) Right + Gridbox( d_fet(,,,) ) Right + Gridbox( d_fet(,R,,) ) Right + Gridbox( d_fet(,,P,) ) Right + Gridbox( d_fet(,R,P,) ) Right + +A:Gridbox( igbt ) Below(A) + Gridbox( ujt ) Right + Gridbox( ujt(,,P) ) Right +rpoint_(down_) + Gridbox( thyristor ) Right + Gridbox( thyristor(,B) ) Right + Gridbox( thyristor(,BG) ) Right + Gridbox( thyristor(,A) ) Right + Gridbox( thyristor(,C) ) Right +rpoint_(up_) + Gridbox( j_fet ) Right + Gridbox( e_fet ) Right + Gridbox( e_fet(,,,S) ) Right + Gridbox( e_fet(,,P) ) Right + Gridbox( e_fet(,,P,S) ) Right + Gridbox( d_fet ) Right + Gridbox( d_fet(,,,S) ) Right + Gridbox( d_fet(,,P,) ) Right + Gridbox( d_fet(,,P,S) ) Right + Gridbox( j_fet ) Right + Gridbox( j_fet(,,P) ) Right + Gridbox( mosfet(,,uHSDF) ) Right + +rpoint_(right_) +A:Gridbox( tgate ) Below(A) + Gridbox( tgate(,B) ) Right + Gridbox( ptrans ) Right + +A:Gridbox( AND_gate ) Below(A) + Gridbox( OR_gate ) Right + Gridbox( NAND_gate ) Right + Gridbox( NOR_gate ) Right + Gridbox( XOR_gate ) Right + Gridbox( NXOR_gate ) Right + Gridbox( BUFFER_gate ) Right + Gridbox( NOT_gate ) Right + +# input lines for OR-like gates. +define(`OR_inlgth',`(-sqrt(OR_rad^2-G_hht^2)+sqrt(OR_rad^2-`$1'^2))*L_unit') + + Gridbox( [ {move right_ gunit} + {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)} + {line right_ OR_inlgth(0)} + {line right_ OR_inlgth(2) from Here+svec_(0,2)} + {line same from Here-svec_(0,2)} + {line right_ OR_inlgth(1) from Here+svec_(0,1)} + {line same from Here-svec_(0,1)}] ) Right + Gridbox( [ {move right_ gunit} + {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)} + {line right_ OR_inlgth(0)} + {line right_ OR_inlgth(2) from Here+svec_(0,2)} + {line same from Here-svec_(0,2)}] ) Right + Gridbox( [ {move right_ gunit} + {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)} + {line right_ OR_inlgth(2) from Here+svec_(0,2)} + {line same from Here-svec_(0,2)}] ) Right + Gridbox( [ {move right_ gunit} + {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)} + {line right_ OR_inlgth(0)}] ) Right + +right_ +A:Gridbox( speaker ) Below(A) + Gridbox( speaker(,,H) ) Right + Gridbox( bell ) Right + Gridbox( microphone ) Right + Gridbox( buzzer ) Right + Gridbox( buzzer(,,C) ) Right + Gridbox( earphone ) Right + Gridbox( earphone(,,C) ) Right + Gridbox( nport ) Right + Gridbox( nterm ) Right + +A:Gridbox( FlipFlop(D) + { line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__) } ) Below(A) + Gridbox( FlipFlop(T) + { line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__) } ) Right + Gridbox( FlipFlop(RS) + { line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__) } ) Right + Gridbox( FlipFlop(JK) + { line right 5bp__ at last [] . 2nd last ""+(-7bp__,4bp__) } ) Right + + ] with .nw at (0,0) + +"A draft palette of elements for Inkscape using a 1 mm grid" \ + ljust below at last [].sw + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/pwrsupplySVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/pwrsupplySVG.m4 new file mode 100644 index 00000000000..843c6660b5e --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/pwrsupplySVG.m4 @@ -0,0 +1,42 @@ +.PS +# Pwrsupply.m4 +cct_init +ifdef(`m4pco',`resetrgb') + linewid = linewid*1.2 + + down_ +T:transformer + line left_ elen_/4 from T.P1 + rgbdraw(0,0,255,fuse(left_ elen_/3,D)) + reversed(`switch') + gap(down_ to (Here,T.P2)) + { fuse(right_ 2*dimen_/5 at last []) } + line to T.P2 + blen = dimen_/2 +W: T.TS+(dimen_,0) +N: W+(blen,blen) +S: W+(blen,-blen) +E: S+(blen,blen) + diode(from W to N) + diode(from S to E) +G:gap(from E+(dimen_*4/3,0) down_ (E.y-S.y)*5/4); llabel("+" wid 0.1*scale,,-) +C:capacitor(down_ G.start.y-G.end.y from 0.5 between E and G.start,C) + +setrgb(255,0,0) + line from T.S1 to (T.S1,N); line to N + dot + diode(to E); dot + line from E to G.start; dot + dot(at C.start) +resetrgb + +setrgb(0,255,0,,D) + dot(at C.end) + dot(at G.end) + ground + line to (W,Here); line to W; dot + diode(to S); dot + line to (T.S2,Here); line to T.S2 +resetrgb + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4 new file mode 100644 index 00000000000..7b63ec6db75 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4 @@ -0,0 +1,20 @@ +.PS # Pic input begins with .PS +cct_init # Set defaults + +elen = 0.75 # Variables are allowed; default units are inches +move right 0.4 +Origin: Here # Position names are capitalized + svgLink(SourcesSVG.svg,source(up_ elen)) + llabel(-,v`'svg_sub(s),+) + svgLink(CctTableSVG.svg,resistor(right_ elen)); rlabel(,R,) + dot + { # Save current position and direction + capacitor(down_ to (Here,Origin)) #(Here,Origin) = (Here.x,Origin.y) + rlabel(+,v,-); llabel(,,C) + dot + } # Restore position and direction + line right_ elen*2/3 + {move right 0.2} + inductor(down_ Here.y-Origin.y); rlabel(,L,); b_current("i") + line to Origin +.PE # Pic input ends diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/randomSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/randomSVG.m4 new file mode 100644 index 00000000000..e482d9f1e47 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/randomSVG.m4 @@ -0,0 +1,98 @@ +.PS +# randomSVG.m4 +gen_init(svg_font(sans-serif,9bp__)) +NeedDpicTools + +################################################################ +# hscale(right length,nlabels, +# minlabel,maxlabel,[T][N]) + define(`hscale',`[ define(`hs_nl',`ifelse(`$2',,5,`$2')') + A: line `$1' ; Start: A.start; End: A.end + td = 1/(hs_nl-1)*A.len/5 + define(`hs_ud',`ifinstr(`$5',T,down,up)') +# Major tics + for i=1 to hs_nl-2 do { line hs_ud graphsize/20 thick 0.4 \ + from i/(hs_nl-1) between A.start and A.end } +# Minor tics + for i=0 to hs_nl-2 do { Ts: i/(hs_nl-1) between A.start and A.end + for j=1 to 4 do { line thick 0.4 hs_ud graphsize/20/2 from Ts+(j*td,0) } } +# Labels + ifinstr(`$5',N,,`for_(0,eval(hs_nl-1),1, + `Ts: m4x/(hs_nl-1) between A.start and A.end + s_box("%g",`$3'+m4x/(hs_nl-1)*(`$4'-(`$3'))) \ + at Ts ifelse(`$5',T,above,below)') ') + ]') +# vscale(up length,nlabels, +# minlabel,maxlabel,[R][N] ) + define(`vscale',`[ define(`vs_nl',`ifelse(`$2',,5,`$2')') + A: line `$1' ; Start: A.start; End: A.end + td = 1/(vs_nl-1)*A.len/5 + define(`vs_lr',`ifinstr(`$5',R,left,right)') +# Major tics + for i=1 to vs_nl-2 do { line vs_lr graphsize/20 thick 0.4 \ + from i/(vs_nl-1) between A.start and A.end } +# Minor tics + for i=0 to vs_nl-2 do { Ts: i/(vs_nl-1) between A.start and A.end + for j=1 to 4 do { line thick 0.4 vs_lr graphsize/20/2 from Ts+(0,j*td) } } +# Labels + ifinstr(`$5',N,,`for_(0,eval(vs_nl-1),1, + `Ts: m4x/(vs_nl-1) between A.start and A.end + s_box("%g",`$3'+m4x/(vs_nl-1)*(`$4'-(`$3'))) \ + at Ts ifelse(`$5',R,ljust,rjust)')') + ]') +# f_gauss(x,mean,stddev) + define f_gauss`{ std_gauss(($1-($2))/($3))/($3) }' + define std_gauss`{ expe(-($1)^2/2)/sqrt(twopi_) }' +################################################################ + +[ + n = 2000 + stddev = 0.25 + graphsize = 2 + + B: box wid graphsize ht graphsize ; { move left 0.4 from B.w } +# Gemerate n Gaussian random numbers + randn(z,n,0,stddev) + m = 0 + for i=1 to n-1 by 2 do { m +=1; x[m] = z[i]; y[m] = z[i+1] + dot(at B+(x[m],y[m])) + } + + hscale(right B.wid,5,-1,1) with .Start at B.sw + hscale(right B.wid,5,-1,1,TN) with .Start at B.nw + vscale(up B.ht,5,-1,1) with .Start at B.sw + vscale(up B.ht,5,-1,1,RN) with .Start at B.se + + N: box invis wid B.wid ht B.ht with .sw at B.nw+(0,graphsize/10) + nb = 20 + binmax = n/5*0.5 + dx = N.wid/nb + histbins(x,m,-1,1,nb,hbin) + for i=0 to nb-1 do { line up hbin[i]/binmax * N.ht \ + from N.sw+((0.5+i)*dx,0) thick dx/(1bp__) outlined "gray" } + box wid N.wid ht N.ht at N +# vscale(up N.ht,5,0,1) with .Start at N.sw + + E: box invis wid B.wid ht B.ht with .sw at B.se+(graphsize/10,0) + nb = 20 + binmax = n/5*0.5 + dy = E.ht/nb + histbins(y,m,-1,1,nb,vbin) + for i=0 to nb-1 do { line right vbin[i]/binmax * E.wid \ + from E.sw+(0,(0.5+i)*dy) thick dy/(1bp__) outlined "gray" } + box wid E.wid ht E.ht at E +# hscale(right E.wid,5,0,1) with .Start at E.sw + +ng = 16 +for i=0 to ng do { x = i/ng*N.wid + U: x,(f_gauss(x,N.wid/2,stddev)*m*dx)/binmax*N.ht + X[i]: N.sw+U + Y[i]: E.nw+(U.y,-U.x) } + fitcurve(X,ng) + fitcurve(Y,ng) + +] +#showbox_ + +command "</g>" +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/recycleSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/recycleSVG.m4 new file mode 100644 index 00000000000..d6246cc9ab2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/recycleSVG.m4 @@ -0,0 +1,128 @@ +.PS +# recycle.m4 +gen_init +copy "HOMELIB_`'dpictools.pic" +[ +# Gradient fill and clipping are simply +# done with PStricks or Tikz but the other +# postprocessors don't all have this +# facility so the following calculates +# shading boundaries and lines. + +define ShadePoint { testexpr(i, $1<f1, $1<f2, $1<f3 ) + Px: $1 between P0 and Pz + S: move from Px to Px+Up + case(i+1, + M4L: LCintersect(S,T1,stripwd/2) + M4R: ($1-f2)/(1-f2) between P9 and P8 + , + M4L: $1/f1 between P0 and P4 + M4R: $1/f1 between P0 and P3 + , + M4L: Intersect_(S,M57) + M4R: LCintersect(S,P1,stripwd/2) + , + M4L: Intersect_(S,M57) + M4R: ($1-f2)/(1-f2) between P9 and P8 + ) + line outlined rgbstring($2,$3,$4) from M4L to M4R + } + +define ShadeTail { testexpr(i, $1<g1, $1<g2, $1<g3 ) + Px: $1 between T4 and Qz + S: move from Px to Px+AcrossTail + case(i+1, + M4L: LCintersect(S,T1,stripwd/2,R) + M4R: LCintersect(S,T1,stripwd/2) + , + M4L: $1/g1 between T5 and T6 + M4R: $1/g1 between T3 and T2 + , + M4L: LCintersect(S,T1,stripwd/2,R) + M4R: $1/g2 between T3 and P6 + , + M4L: LCintersect(S,T1,stripwd/2,R) + M4R: ($1-g2)/(g3-g2) between P6 and P7 + ) + line outlined rgbstring($2,$3,$4) from M4L to M4R + } + +# `recycle(width)' +define(`recycle',`[ Origin: Here + space = 2*linethick pt__ + stripwd = ($1-space)/3.765544 + for angle=0 to 240 by 120 do { + Right: (dprot(angle*dtor_,stripwd,0)) + Up: (dprot(angle*dtor_,0,stripwd/2)) + P0: Here+Right*space/stripwd + Axis: move from P0 to P0+Right*3/4; P1: Here + P2: P1-Up + P3: 1.5 between P1 and P2 + P4: P1 + (P1-P3) + P5: P1 + Up + P6: P5+Right/sqrt(3)/2 + P7: P6+(P6-P5) + T1: 2 between P1 and P6 + P8: T1+(dprot((angle-30)*dtor_,stripwd/2,0)) + P9: P1+(P8-T1) + T2: T1+(dprot((angle+210)*dtor_,stripwd/2,0)) + AcrossTail: T1-T2 + T3: P6+(dprot((angle+120)*dtor_,stripwd,0)) + T4: T3+AcrossTail + T5: 2 between T3 and T4 + T6: 2 between T2 and T1 + V: move from P8 to P8-Up; Pz: Intersect_(Axis,V) + t = distance(P0,Pz) + f1 = distance(P1,P0) / t + V: move from P9 to P9+Up; R: Intersect_(Axis,V); f2 = distance(P0,R) / t + V: move from P7 to P7-Up; R: Intersect_(Axis,V); f3 = distance(P0,R) / t + n = int(t/lthick*1.5) + M57: move from P5 to P7 + ShadeObject( ShadePoint,n, + 0,1,1,1, + 1,0.5,0.5,0.5) with .Origin at Origin + point + J: move from T4 to T1; Qz: LCintersect(J,T1,stripwd/2,R) + u=distance(T4,Qz) + g1 = distance(T1,T4) / u + g2 = stripwd / u + V: move from P7 to P7+AcrossTail; R: Intersect_(V,J) + g3 = distance(R,T4) / u + m = int(u/lthick*1.5) + ShadeObject(ShadeTail,m, + 0,1,1,1, + 1,0.5,0.5,0.5) with .Origin at Origin + tail +# { for i=0 to 9 do { exec sprintf("{\"P%g\" at P%g}",i,i) } } +# { for i=1 to 6 do { exec sprintf("{\"T%g\" at T%g}",i,i) } } + move to T4 + } + ]') +define(`tail',`line from P7 to P6 then to T3 then to T5 then to T6 + arc cw to P7 with .c at T1') + +define(`point',`line from P2 to P3 then to P0 then to P4 then to P5 then to P7 + arc ccw to P8 with .c at T1 + line to P9 + arc cw to P2 with .c at P1') + +recycle(2) +] +[ +# yinyang.m4 +ifdpic(` +circlerad = 0.5 +shade(0, +A: arc ccw rad circlerad*2 to Here+(4*circlerad,0) + ) +B: circle colored "white" with .c at 1/4<A.w,A.e> + arc cw rad circlerad from B.e to B.w with .c at B.c + circle colored "black" with .c at 3/4<A.w,A.e> + circle rad circlerad*2 with .c at A.c + circle rad circlerad/3 fill_(0) at 0.5<A.w,A.c> + circle rad circlerad/3 fill_(1) at 0.5<A.c,A.e> +',` +box wid 1 ht 0.75 "Yinyang.m4" "requires" "dpic" +') +] with .w at last [].e+(0.2,0) +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/roseSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/roseSVG.m4 new file mode 100644 index 00000000000..b386d9aea57 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/roseSVG.m4 @@ -0,0 +1,131 @@ +.PS +# rose.m4 +gen_init +ifelse( +ifpstricks(T)`'ifmpost(T)`'ifpostscript(T)`'ifpdf(T)`'ifpgf(T)`'ifsvg(T),, +`This diagram is for PSTricks, postscript, PDF, MetaPost, or SVG', +` + +scale = 1.2 +define(`gold_',`1,0.84,0') + +define(`rose',`point_(`$2'); CC: (vec_(`$1',0)); rrad = `$3' + move to CC + tmp = rrad-stripwid + {circle shaded rgbstring(gold_) rad rrad-sthick at CC} + {circle shaded rgbstring(gold_) rad tmp-sthick at CC} + {line to rvec_(rrad,0) chop tmp chop 0 } + {line to rvec_(-rrad,0) chop tmp chop 0 } + {line to rvec_(0,rrad) chop tmp chop 0 } + {line to rvec_(0,-rrad) chop tmp chop 0 } + {line from rvec_(-tmp/sqrt(2),-tmp/sqrt(2)) to rvec_(tmp/sqrt(2),tmp/sqrt(2))} + {line from rvec_(-tmp/sqrt(2),tmp/sqrt(2)) to rvec_(tmp/sqrt(2),-tmp/sqrt(2))} + {circle shaded rgbstring(gold_) rad tmp-stripwid-sthick at CC} + tmp = last circle.rad/sqrt(2) + line thick stripthick from rvec_(-tmp,0) to rvec_(0,-tmp) \ + then to rvec_(tmp,0) then to rvec_(0,tmp) then to rvec_(-tmp,0) \ + shaded rgbstring(gold_) + ') + +define(`spt_',`/72.27') + +[ lsk = 1.2 + sector = 360*dtor_/16 + exterior = 2.49 + outer_circle = exterior-0.55 + inner_circle = 1.1 + spoke_tail = 0.41 + spokethick = 0.09/(1spt_) # points + stripwid = 0.05 + stripthick = 1.6/1.2 + midroserad = inner_circle*sin(sector/2)-stripwid/2 + outerroserad = outer_circle*sin(sector/4)-stripwid/2 + del = 0.05 + +C: (0,0) + circle rad exterior fill_(0) at C + circle shaded rgbstring(gold_) rad outer_circle at C + circle rad spoke_tail fill_(0) at C + linethick = stripthick + sthick = linethick/2 spt_ + for i=0 to 15 do { + move to rect_(spoke_tail+1.5*stripwid,sector*i); + for j=-1 to 1 by 2 do { + {point_(sector*(i+j*0.5)) + line to rvec_(outer_circle-spoke_tail,0) } + { point_(sector*i) + move to rvec_(0,j*spokethick spt_) + line to rvec_(outer_circle-spoke_tail,0) \ + chop outer_circle-inner_circle chop 0 + } + } + crad = 0.25 +1.5*stripwid + cthick = 1.5*stripwid/(1spt_) + X: rect_(inner_circle+midroserad,sector*i) + circle outlined rgbstring(gold_) rad crad-(cthick/2 spt_) thick cthick at X + circle rad crad - sthick at X + } + for i=0 to 15 do { + X: rect_(inner_circle+midroserad,sector*i) + circle fill_(0) rad crad-1.5*stripwid-sthick at X + + for j = -1 to 1 by 2 do { move to X+vec_(0.20,j*0.14) + point_(sector*(i+j*0.25)) + line to rvec_(1.5*stripwid,0) } + + circle shaded rgbstring(gold_) rad midroserad*2/3-sthick at X + circle rad midroserad*2/3-stripwid-sthick at X + line from X to -(midroserad*2/3/(inner_circle+midroserad))<X,C> + } + + crad = spoke_tail+7*stripwid + cthick = 2*stripwid/(1spt_) + circle outlined rgbstring(gold_) rad crad-cthick/2 spt_ thick cthick at C + circle rad spoke_tail+1.5*stripwid-sthick at C + for i=5 to 7 do { circle rad spoke_tail+i*stripwid-sthick at C } + # Spokes and roses + for i=0 to 15 do { + rose(inner_circle,sector*i,midroserad) + line thick spokethick/lsk from C to rect_(outer_circle,sector*(i-0.5)) + line thick spokethick/lsk from C to rect_(outer_circle,sector*i) \ + chop inner_circle+midroserad*2 chop 0 + for j=-1 to 1 by 2 do { + X: rect_(outer_circle+outerroserad-linethick spt_,sector*(i+j*0.25)) + linethick = 1/lsk + circle colored rgbstring(gold_) rad outerroserad*1/2-1/lsk/2 spt_ at X + linethick = stripthick + circle fill_(0) rad outerroserad*1/3-sthick at X + point_(sector*(i+j*0.25)) + line from X to X + vec_(outerroserad,0) + rose(outer_circle,sector*(i+j*0.25),outerroserad) + } + } + # Outer decorations + for i=0 to 31 do { + move to rect_(exterior-0.25,sector*i/2); point_(sector*i/2) + { line thick stripthick from rvec_(del,3.5*del) to rvec_(-del,0) \ + then to rvec_(del,-3.5*del) then to rvec_(del,3.5*del) \ + shaded rgbstring(gold_) } + circle rad stripwid-sthick at Here + } + smrad = 0.08 + for i=0 to 7 do { + point_(sector*2*i) + move to C + vec_(midroserad+smrad/4,0) + { circle shaded rgbstring(gold_) rad smrad-sthick at Here} + { circle shaded rgbstring(gold_) rad smrad/2-sthick at Here} + line from rvec_(smrad/2,0) to rvec_(smrad,0) + } + + tmp = midroserad-stripwid + circle shaded rgbstring(gold_) rad midroserad-sthick at C + circle shaded rgbstring(gold_) rad tmp-sthick at C + CQ: circle invis rad tmp-linethick*4/2 spt_ at C + line from CQ.e to CQ.n to CQ.w to CQ.s to CQ.e to CQ.n + CQ: 0.5<CQ.e,CQ.n> + tmp = (distance(CQ,C) - linethick*3/2 spt_)*sqrt(2) + box wid tmp ht tmp at C + ] with .sw at 1,1 + +') +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sfgSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sfgSVG.m4 new file mode 100644 index 00000000000..793db01ae86 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sfgSVG.m4 @@ -0,0 +1,102 @@ +.PS +# sfgSVG.m4 +gen_init(svg_font(Times,11bp__)) +sfg_init( 1.2 ) # scale default size by 1.2 + +textht = textht*0.9 + +# Graph 1 +move right 0.15 +T:[ + Ft: sfgnode(,f(t),sfgbelow) + sfgline(,1/K) + Y1: sfgnode(,y`'svg_sub(1),sfgbelow rjust) + sfgline(,K/M) + DDY2: sfgnode(,y`'svg_sub(2),sfgbelow rjust) + {".." at DDY2 +(-3,-1)*textoffset} + sfgline(,1/s) + DY2: sfgnode(,y`'svg_sub(2) = x`'svg_sub(2),sfgbelow ljust) + {"." at DY2 +(2,-1)*textoffset} + sfgline(,1/s) + Y2: sfgnode(,y`'svg_sub(2) = x`'svg_sub(1),sfgbelow ljust) + + sf = 1 + sfgarc(from DY2 to DDY2,-B/M,below,,sf) + sfgarc(from Y2 to DDY2,-K/M,above,ccw,sf) + sfgarc(from Y2 to Y1,1,sfgabove,,sf) + ] + +# Graph 2 +B: [ + R1: sfgnode(,r`'svg_sub(1),sfgabove) + sfgline(,1) + X1: sfgnode(,x`'svg_sub(1),ljust) + R2: sfgnode(at R1+(0,-1),r`'svg_sub(2),sfgabove) + sfgline(,1) + X2: sfgnode(,x`'svg_sub(2),ljust) + sfgarc(from X1 to X2,a`'svg_sub(21),rjust,ccw) + sfgarc(from X2 to X1,a`'svg_sub(12),ljust,ccw) + + sfgself(at X1,,q`'svg_sub(11)) + sfgself(at X1,R,a`'svg_sub(11),ljust,cw,1.5) + sfgself(at X2,-90,a`'svg_sub(22),sfgbelow) + ] with .w at T.e + (linewid/2,-linewid/4) + +# Graph 3 +G3: [ + # change node spacing and increase node size + sfg_wid = 0.85; sfg_rad = 0.35/2 + for_(1,4,1,`N`'m4x: sfgnode(,m4x,,fill_(0.9)) + sfgself(at N`'m4x,-90,P`'svg_sub(m4x),,cw) + ifelse(m4x,4,,`sfgline(,G`'svg_sub(m4x),sfgbelow)') ') + sfgarc(from N2 to N1,F`'svg_sub(2),sfgabove,ccw,) + sfgarc(from N3 to N1,F`'svg_sub(3),sfgbelow,ccw,1.4) +] with .nw at T.sw + +A: [ sfg_wid = 0.75; sfg_rad = 0.15 + arrow right linewid*2/3 + P: sfgnode(,p) + sfgself(,90,a,below,cw) + arrow from P.e "b" below + Q: sfgnode(,q) + R: sfgnode(at Q+(Q-P),r) # for dpic + sfgarc(from Q to R,c,above,cw) + sfgarc(from R to Q,d,below,cw) + sfgself(at R,-90,e,above,cw) + arrow right linewid*2/3 from R.e + ] with .w at G3.e+(linewid/2,0) + +define(`svg_choose',`[ P:"svg_fsize(( ),150)" + "svg_small(`$1')" at P+(0,7bp__) + "svg_small(`$2')" at P-(0,3bp__) + ]') + +G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size + s1 = 0.9 + s2 = 1.2 + N0: sfgnode(,svg_fsize(0,120),,invis) + sfgline(right_ sfg_wid,`svg_nu',below,->) + N1: sfgnode(,svg_fsize(1,120),,invis) + { sfgarc(to N0 ->,(1-p)`svg_gamma'+`svg_nu',above,ccw,s1) } + sfgline(right_ sfg_wid,`svg_nu'+`svg_lambda',below,->) + 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__) } + { 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__) } + { 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__) } + { 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) + + move from (T.w,G4.s)-(7bp__,6bp__) to B.ne+(15bp__,6bp__) + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/shapesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/shapesSVG.m4 new file mode 100644 index 00000000000..08962e9f856 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/shapesSVG.m4 @@ -0,0 +1,202 @@ +.PS +# shapes.m4 +threeD_init + +divert(-1) +# shapes.m4 +# 3D structures with complex surfaces and hidden lines are the domain of more +# sophisticated software packages, but basic shapes can be drawn with pic. +#threeD_init + +##################################################### + + `cylinder3D(xdispl,ydispl,zdispl,diameter, + [colored "color"])' +define(`cylinder3D',`[ Start: (0,0) + xdispl = `$1'; ydispl = `$2'; zdispl = `$3' + diamc = ifelse(`$4',,(lenc/2),`$4') ; radc = diamc/2 + define(`M4CL',`xdispl,ydispl,zdispl')dnl + lenc = length3D(M4CL) + cs = dot3D(View3D,M4CL)/lenc + End: (project(M4CL)) + az = atan2(ydispl,xdispl) + ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2)) + CL: line invis from Start to End; C: CL.c + nls = int(twopi_*radc/lthick) + define(`M4PP',`rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,0,0,radc)))')dnl + for i=0 to nls-1 do { if dot3D(View3D,M4PP) > 0 then { + P: (project(M4PP)) + ql = sqrta(dot3D(Light3D,M4PP)/radc) + line from P to End+P outlined rgbstring(ql,ql,ql) `$5' } } + Perp: (vperp(CL,radc)) + if cs > 0 then { T: End; B: Start } else { T: Start; B: End } + rpoint_(from Start to Perp) + css = sqrta(cs) + Top: rotellipse(diamc,diamc*cs, + thick linethick/3 shaded rgbstring(css,css,css)) with .c at T + W: line thick linethick/3 from T+Perp to B+Perp + Bot: ellipsearc(diamc,diamc*cs,pi_,twopi_,rp_ang,cw, + thick linethick/3) with .C at B + E: line thick linethick/3 from B-Perp to T-Perp + rpoint_(from Start to End) +`$6']') + + `cone3D(xdispl,ydispl,zdispl,diameter, + [colored "color"])' +define(`cone3D',`[ Start: (0,0) + xdispl = `$1'; ydispl = `$2'; zdispl = `$3' + define(`M4CL',`xdispl,ydispl,zdispl')dnl + lenc = length3D(M4CL) + diamc = ifelse(`$4',,(lenc/2),`$4') ; radc = diamc/2 + End: (project(M4CL)) + cs = dot3D(View3D,M4CL)/lenc + az = atan2(ydispl,xdispl) + ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2)) + CL: line invis from Start to End; C: CL.c + nls = int(twopi_*radc/lthick) + lt = sqrt(radc^2+lenc^2) + b = 0 + for i=0 to nls-1 do { if dot3D(View3D, + rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,radc,0,lenc)))) > 0 then { + ql = sqrta(dot3D(Light3D, + rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,radc,0,lenc))))/lt) + P: (project(rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,0,0,radc))))) + line from P to End outlined rgbstring(ql,ql,ql) `$5' + if !b then { WB: P; b = 1 } + } else { if b then { BW: P; b = 0 } } } + if vlength(CL.x,CL.y) != 0 then { Perp: (vperp(CL,radc,R)) } else { Perp: (radc,0) } + if cs >= 0 then { T: End; B: Start } else {T: Start; B: End } + rpoint_(from Start to Perp) + pout = (vlength(End.x,End.y) > abs(radc*cs)) + if cs < 0 then { css = sqrta(cs) + if pout then { line thick linethick/3 from BW to End then to WB } + Bot: rotellipse(diamc,diamc*cs,thick linethick/3 \ + ifelse(`$5',,`shaded rgbstring(css,css,css)',`$5')) with .c at T } \ + else { if pout then { + line thick linethick/3 from BW to End then to WB + a = acos((WB.x*Perp.x+WB.y*Perp.y)/radc^2) + Bot: ellipsearc(diamc,diamc*cs,a,pi_-a,rp_ang,cw, thick linethick/3) \ + with .C at B } \ + else { + Bot: rotellipse(diamc,diamc*cs,thick linethick/3) with .c at B } } + rpoint_(from Start to End) +`$6']') + `Arrow3D(xdispl,ydispl,zdispl, + diam,arrowwid,arrowht)' +define(`Arrow3D',`[ diam_Ar = ifelse(`$4',,linewid/10,`$4') + wid_Ar = ifelse(`$5',,diam_Ar*2,`$5') + ht_Ar = ifelse(`$6',,wid_Ar*2,`$6') + x_Ar = ifelse(`$1',,1,`$1') + y_Ar = ifelse(`$2',,1,`$2') + z_Ar = ifelse(`$3',,1,`$3') + define(`M4Arrow3D',`x_Ar,y_Ar,z_Ar')dnl + len_Ar = length3D(M4Arrow3D) + len_Shaft = len_Ar - ht_Ar + cs_Ar = dot3D(View3D,M4Arrow3D) + if cs_Ar >= 0 then { + Shaft: cylinder3D(sprod3D(len_Shaft/len_Ar,M4Arrow3D),diam_Ar) + Head: cone3D(sprod3D(ht_Ar/len_Ar,M4Arrow3D),wid_Ar) \ + with .Start at Shaft.End } \ + else { + Head: cone3D(sprod3D(ht_Ar/len_Ar,M4Arrow3D),wid_Ar) + Shaft: cylinder3D(sprod3D(len_Shaft/len_Ar,M4Arrow3D),diam_Ar) \ + with .End at Head.Start } + Start: Shaft.Start; End: Head.End + `$7']') + +define(`f2xyz3D',``$1'x = `$2' +`$1'y = `$3' +`$1'z = `$4' ') + + `prism3D(xdispl,ydispl,zdispl,wid,ht,rotation (rad))' +define(`prism3D',`[ Start: (0,0) + xdispl = ifelse(`$1',,linewid,`$1') + ydispl = ifelse(`$2',,linewid,`$2') + zdispl = ifelse(`$3',,linewid,`$3') + widp = ifelse(`$4',,(linewid/5),`$4') + htp = ifelse(`$5',,(linewid/10),`$5') + rotp = ifelse(`$6',,0,`$6') + End: (project(xdispl,ydispl,zdispl)); C: 0.5 between Start and End + lenp = length3D(xdispl,ydispl,zdispl) + az = atan2(ydispl,xdispl); ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2)) + wp2 = widp/2; hp2 = htp/2 +# corners + f2xyz3D(nwB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0,-wp2, hp2)))) + f2xyz3D(swB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0,-wp2,-hp2)))) + f2xyz3D(seB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0, wp2,-hp2)))) + f2xyz3D(neB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0, wp2, hp2)))) + f2xyz3D(nwF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp,-wp2, hp2)))) + f2xyz3D(swF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp,-wp2,-hp2)))) + f2xyz3D(seF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp, wp2,-hp2)))) + f2xyz3D(neF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp, wp2, hp2)))) +# facets + M4Facet3D(neF,nwF,swF,seF) + M4Facet3D(neB,seB,swB,nwB) + M4Facet3D(neF,seF,seB,neB) + M4Facet3D(neF,neB,nwB,nwF) + M4Facet3D(seF,swF,swB,seB) + M4Facet3D(nwF,nwB,swB,swF) +`$7']') + +define(`M4Facet3D',` +define(`PFacet',`cross3D(diff3D(`$2'x,`$2'y,`$2'z,`$1'x,`$1'y,`$1'z), + diff3D(`$3'x,`$3'y,`$3'z,`$2'x,`$2'y,`$2'z))') + if dot3D(View3D,PFacet) > 0 then { + fFacet = sqrta(dot3D(Light3D,PFacet)/length3D(PFacet)) + P1: (project(`$1'x,`$1'y,`$1'z)) + P2: (project(`$2'x,`$2'y,`$2'z)) + P3: (project(`$3'x,`$3'y,`$3'z)) + P4: (project(`$4'x,`$4'y,`$4'z)) + line fill_(fFacet) invis from P1 to P2 then to P3 then to P4 then to P1 + line from P1 to P2; round + line to P3; round + line to P4; round + line to P1; round } ') + +##################################################### +divert(0)dnl + +azimuth = 60 +elev = 10 +setview(azimuth,elev) +[ Orig: (0,0) + setlight + Arrow3D(1,0,0) with .Start at Orig; move left 12bp__ from last [].End "x" + Arrow3D(0,1,0) with .Start at Orig; "y" ljust at last [].End + Arrow3D(0,0,1.2) with .Start at Orig; "z" above at last [].End + setlight(0,0,0) + cylinder3D(1,1,1,0.6) with .Start at (project(0.5,0.5,0.5)) +] + Ball: shadedball(0.5) with .nw at last [].ne+(-0.25,0) +[ + setview(45,10) + setlight(40,70) + n = 9; len = 1.5; thmin = m4azim+pi_/2*0.8; thmax = thmin+twopi_ + for i=0 to n do { + r = i/n*(thmax-thmin)+thmin + prism3D(rot3Dz(r,rot3Dy(pi_/4,len,0,0)),0.2,0.1) \ + with .Start at (project(rot3Dz(r,rot3Dy(pi_/4,len*0.5,0,0)))) } +] with .nw at last [].ne +[ + setlight(0,0) + movewid = 0.1 + len = 1.5; ni = 5; nj = 5 + for i=1 to ni-1 do { + {for j = 0 to nj by 2 do { + setview(0,i/ni*180-90,j/nj*90) + cylinder3D(0,0,len*(j+1)/(nj+1),0.4) + if j < nj then {move right} } } + if i < ni then {move down 0.85; right_} } #else { move down movewid } } +] with .nw at 1st [].sw+(0,-0.1) +[ + setlight(0,0) + len = 1.5; ni = 4; nj = 6 + for i=1 to ni do { + {for j = 0 to nj by 2 do { + setview(0,i/ni*180-90,j/nj*90) + cone3D(0,0,len*(j+1)/(nj+1),0.4) + if i==2 && j==(nj-2) then { move up_ 0.2 right_ -0.4 } \ + else { if j < nj then {move right_ 0.1}} } } + if i < ni then {move down_ 0.75; right_} } +] with .nw at last [].ne+(0.2,0) +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/thyristorSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/thyristorSVG.m4 new file mode 100644 index 00000000000..1301786a4c4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/thyristorSVG.m4 @@ -0,0 +1,119 @@ +.PS +# `thyristorSVG.m4' +cct_init(svg_font(sans-serif,11bp__,1.5bp__)) + +define labels { { + "$1" $2 at last[].$1 + "$3" $4 at last[].$3 + "$5" $6 at last[].$5 + "$7" $9 at (last[].s+(0,$8)) } } + +down_ +Row1: [ + {thyristor + labels(A,above,K,below,G,ljust,`thyristor',-0.25,wid 0.75) } + + move right 0.50 ; down_ + {thyristor(,B) + labels(T1,above,T2,below,G,below ljust,`...(,B)',-0.35) } + + move right 0.50 ; down_ + {thyristor(down_ dimen_*0.8,BR) + labels(T1,above,T2,below,G,below rjust,`...(,BR)',-0.22) } + + move right 0.60 ; down_ + {thyristor(,BE) + labels(T1,above,T2,below,G,below ljust,`...(,BE)',-0.35) } + + move right 0.50 ; down_ + {thyristor(,A) at (Here,last []) + labels(A,above,K,below,G,ljust,`...(,A)',-0.35) } + + move right 0.50 ; down_ + {thyristor(,F) at (Here,last []) + labels(A,above,K,below,G,ljust,`...(,F)',-0.22) } + + move right 0.65 ; down_ + {thyristor(,BRE) + labels(T1,above,T2,below,G,below rjust,`...(,BRE)',-0.35) } + + move right 0.75 ; down_ + {thyristor(,UARE) at (Here,last []) + labels(A,above,K,below,G,rjust below,`...(,UARE)',-0.22) } + + move right 0.50 ; down_ + {thyristor(,AV,G: G+(0.1,0.1)) at (Here,last []) + thinlines_ + spline -> from last[].G left 0.05 then left 0.05 down 0.1 + thicklines_ + labels(A,above,K,below,G,ljust,`...(,AV)',-0.35) } + + move right 0.50 ; down_ + {thyristor(,IEC) + labels(A,above ljust,K,below ljust,G,ljust,`...(,IEC)',-0.22) } + ] +Row2: [ + down_ + {thyristor(,UAH) + labels(A,rjust above,K,rjust below,G,ljust,`...(,UAH)',-0.35,wid 0.65) } + + move right 0.55 ; down_ + {thyristor(,N) at (Here,last []) + labels(A,above,K,below,Ga,rjust,`...(,N)',-0.22) } + + move right 0.55 ; down_ + {thyristor(,UANRE) at (Here,last []) + labels(A,above,K,below,Ga,ljust above,`...(,UANRE)',-0.35) } + move right 0.55 ; down_ + {thyristor(,SCR) at (Here,last []) + labels(A,above,K,below rjust,G,below ljust,`...(,SCR)',-0.22) } + + move right 0.55 ; down_ + {thyristor(,SCRE) at (Here,last []) + labels(A,above,K,below,G,ljust below,`...(SCRE)',-0.35) } + + move right 0.65 ; down_ + {thyristor(,SCRRE) at (Here,last []) + labels(A,above,K,below,G,rjust below,`...(SCRRE)',-0.22) } + + move right 0.55 ; down_ + {thyristor(,SCS) at (Here,last []) + labels(A,above,K,below,G,ljust,`...(SCS)',-0.35) } + { "Ga" rjust above at last[].Ga } + + move right 0.55 ; down_ + {thyristor(,SCSE) at (Here,last []) + labels(A,above,K,below,G,ljust below,`...(SCSE)',-0.22) } + { "Ga" rjust above at last[].Ga } + + move right 0.65 ; down_ + {thyristor(,SUSE) at (Here,last []) + labels(A,above,K,below,G,rjust,`...(SUSE)',-0.35) } + + move right 0.65 ; down_ + {thyristor(,SBSE) at (Here,last []) + labels(T1,above,T2,below,G,rjust,`...(SBSE)',-0.22,wid 50bp__) } + + ] with .nw at Row1.sw + (0,-0.20) + +Twoterms: [ right_ + { scr(,,Q) ; `"scr(,,Q)"' at last [].e ljust} + { "Q.G" at Q.G above } + + move down 0.4; right_ + { scs(,,Q2) ; `"scs(,,Q2)"' at last [].e ljust } + { "Q2.G" at Q2.G above } + { "Q2.Ga" at Q2.Ga below } + ] with .nw at Row2.sw+(0,-0.2) + + [ right_ + { sus(,RE,Q3) ; `"sus(,RE,Q3)"' at last [].e ljust} + { "Q3.G" at Q3.G above } + + move right_ 1.2 from last line.end + { sbs(,E,Q4) ; `"sbs(,E,Q4)"' at last [].e ljust} + { "Q4.G" at Q4.G below } + ] with .w at last [].e+(1.0,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/tstSVG.htmx b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/tstSVG.htmx new file mode 100644 index 00000000000..1dd990c82a5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/tstSVG.htmx @@ -0,0 +1,212 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<HTML> +<HEAD> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<meta http-equiv="Content-Style-Type" content="text/css"> +<!--meta http-equiv="Content-Script-Type" content="text/javascript"--> +<TITLE>SVG Examples: Circuit_macros Version XXX</TITLE> +<style type="text/css"> +</style> +</HEAD> + +<BODY> +<H2>SVG Circuit_macros examples, Version XXX</H2> +<hr> + +<p> + These diagrams are in .svg format. + <A HREF="examples.pdf">Pdf</A> + and + <A HREF="examples.html">png</A> + versions are also available. + The PDF equivalent can be found in examples.pdf of the distribution. +</p> + <p> + Click on the link to view the source of each diagram. +</p> +<hr> + +define(`cfig',` +<p> +<!--[if lt IE 9]><embed src="$1.svg" sinclude($1.siz)><![endif]--> + +<!--[if gte IE 9]> +<object data="$1.svg" sinclude($1.siz) type="image/svg+xml" class="img"> + </object> <![endif]--> + +<!--[if !IE]><!--> +<object data="$1.svg" sinclude($1.siz) type="image/svg+xml" class="img"> + </object> <!--<![endif]--> + +<br> +<a href="$1.txt" TYPE="text/plain" TARGET="_blank">$1.m4</a> +</p> +<hr>') + +define(`m4tt',`<g style="font-family:monospace">') + +<!-- +<embed pluginspage="http://www.adobe.com/svg/viewer/install/" /> +--> + +<p> +These diagrams have been adapted from the Circuit_macros examples in +order to test the <em>experimental</em> svg output of dpic. +Generating the line art is relatively straightforward, but +the labeling is not created by a text processor and must, therefore, be +more basic. +</p> +<p> +<ul> + <ul> + <li> + m4tt`'svg_font(</g>font-face,height,textoffset,dpic commands`'m4tt)</g>: + Change font face, size, and dpic textoffset parameter. + If arg4 is blank, the font is changed and + requires m4tt`'command "</g>"</g> to cancel the font change. + Examples: <br> + m4tt`'svg_font(Times)</g><br> + m4tt`'svg_font(Times,11bp__,1bp__,"text" at A)</g><br> + m4tt`'svg_font(font-family="Times")</g><br> + m4tt`'svg_font(font-family="Times" font-style="italic")</g><br> + m4tt`'svg_font(style="font-family:Times; font-style:italic")</g> + <li>m4tt svg_tspan(</g>text attributes`'m4tt)</g>; + e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%")</g> + <li>m4tt svg_it(</g>text`'m4tt)</g>: for italics + <li>m4tt svg_tt(</g>text`'m4tt)</g>: for monospace (courier) + <li>m4tt svg_norm(</g>text`'m4tt)</g>: for normal text + <li>m4tt svg_bf(</g>text`'m4tt)</g>: for bold face + <li>m4tt svg_small(</g>text, percent`'m4tt)</g>: + to set a smaller text size, default 66 + <li>m4tt svg_fsize(</g>text, percent`'m4tt)</g>: + for setting larger or smaller text size, default 100 + <li>m4tt svg_sub(</g>text, size percent, y displ, x displ`'m4tt)</g>: + subscript + <li>m4tt svg_sup(</g>text, size percent, y displ, x displ`'m4tt)</g>: + superscript + <li>m4tt svg_symbol(</g>text`'m4tt)</g>: allow quoted pound sign in text, + e.g., m4tt`'svg_symbol(10&`#'176;)</g> produces 10° + <li>m4tt svgLink(</g>URL, drawing object, m4tt[B])</g>: + link to external file using + <a xlink:href=...>...</a> (default is + m4tt`'target="_blank"</g> unless + arg 3 = B) + <li>m4tt svgLinkString</g> as above but for strings attached to objects + <li> Greek and other symbols: + +<table cellpadding="0" cellspacing="0" width="100%" > +<tr> +<td width="7%"> m4tt svg_alpha</g> + <td align="left"> changecom(,)&`#'945;changecom(`#') +<td width="7%"> m4tt svg_beta</g> + <td align="left"> changecom(,)&`#'946;changecom(`#') +<td width="7%"> m4tt svg_chi</g> + <td align="left"> changecom(,)&`#'967;changecom(`#') +<td width="7%"> m4tt svg_comma</g> + <td align="left"> changecom(,)&`#'44;changecom(`#') +<td width="7%"> m4tt svg_Delta</g> + <td align="left"> changecom(,)&`#'916;changecom(`#') +<td width="7%"> m4tt svg_delta</g> + <td align="left"> changecom(,)&`#'948;changecom(`#') +<td width="7%"> m4tt svg_epsilon</g> + <td align="left"> changecom(,)&`#'949;changecom(`#') +<td width="7%"> m4tt svg_eta</g> + <td align="left"> changecom(,)&`#'951;changecom(`#') +<tr> +<td width="7%"> m4tt svg_Gamma</g> + <td align="left"> changecom(,)&`#'915;changecom(`#') +<td width="7%"> m4tt svg_gamma</g> + <td align="left"> changecom(,)&`#'947;changecom(`#') +<td width="7%"> m4tt svg_iota</g> + <td align="left"> changecom(,)&`#'953;changecom(`#') +<td width="7%"> m4tt svg_kappa</g> + <td align="left"> changecom(,)&`#'954;changecom(`#') +<td width="7%"> m4tt svg_Lambda</g> + <td align="left"> changecom(,)&`#'923;changecom(`#') +<td width="7%"> m4tt svg_lambda</g> + <td align="left"> changecom(,)&`#'955;changecom(`#') +<td width="7%"> m4tt svg_micro</g> + <td align="left"> changecom(,)&`#'956;changecom(`#') +<td width="7%"> m4tt svg_mu</g> + <td align="left"> changecom(,)&`#'956;changecom(`#') +<tr> +<td width="7%"> m4tt svg_nu</g> + <td align="left"> changecom(,)&`#'957;changecom(`#') +<td width="7%"> m4tt svg_ohm</g> + <td align="left"> changecom(,)&`#'937;changecom(`#') +<td width="7%"> m4tt svg_Omega</g> + <td align="left"> changecom(,)&`#'937;changecom(`#') +<td width="7%"> m4tt svg_omega</g> + <td align="left"> changecom(,)&`#'969;changecom(`#') +<td width="7%"> m4tt svg_Phi</g> + <td align="left"> changecom(,)&`#'934;changecom(`#') +<td width="7%"> m4tt svg_phi</g> + <td align="left"> changecom(,)&`#'966;changecom(`#') +<td width="7%"> m4tt svg_Pi</g> + <td align="left"> changecom(,)&`#'928;changecom(`#') +<td width="7%"> m4tt svg_pi</g> + <td align="left"> changecom(,)&`#'960;changecom(`#') +<tr> +<td width="7%"> m4tt svg_Psi</g> + <td align="left"> changecom(,)&`#'936;changecom(`#') +<td width="7%"> m4tt svg_psi</g> + <td align="left"> changecom(,)&`#'968;changecom(`#') +<td width="7%"> m4tt svg_rho</g> + <td align="left"> changecom(,)&`#'961;changecom(`#') +<td width="7%"> m4tt svg_Sigma</g> + <td align="left"> changecom(,)&`#'931;changecom(`#') +<td width="7%"> m4tt svg_sigma</g> + <td align="left"> changecom(,)&`#'963;changecom(`#') +<td width="7%"> m4tt svg_tau</g> + <td align="left"> changecom(,)&`#'964;changecom(`#') +<td width="7%"> m4tt svg_Theta</g> + <td align="left"> changecom(,)&`#'920;changecom(`#') +<td width="7%"> m4tt svg_theta</g> + <td align="left"> changecom(,)&`#'952;changecom(`#') +<tr> +<td width="7%"> m4tt svg_upsilon</g> + <td align="left"> changecom(,)&`#'965;changecom(`#') +<td width="7%"> m4tt svg_Xi</g> + <td align="left"> changecom(,)&`#'926;changecom(`#') +<td width="7%"> m4tt svg_xi</g> + <td align="left"> changecom(,)&`#'958;changecom(`#') +<td width="7%"> m4tt svg_zeta</g> + <td align="left"> changecom(,)&`#'950;changecom(`#') +<td width="7%"> m4tt svg_lt</g> + <td align="left"> changecom(,)&`#'60;changecom(`#') +<td width="7%"> m4tt svg_gt</g> + <td align="left"> changecom(,)&`#'62;changecom(`#') +<td width="7%"> m4tt svg_leq</g> + <td align="left"> changecom(,)&`#'8804;changecom(`#') +<td width="7%"> m4tt svg_geq</g> + <td align="left"> changecom(,)&`#'8805;changecom(`#') +<tr> +<td width="7%"> m4tt svg_prime</g> + <td align="left"> changecom(,)&`#'8242;changecom(`#') +<td width="7%"> m4tt svg_ensp</g> + <td align="left"> |changecom(,)&`#'8194;changecom(`#')| +<td width="7%"> m4tt svg_emsp</g> + <td align="left"> |changecom(,)&`#'8195;changecom(`#')| +<td width="7%"> m4tt svg_thinsp</g> + <td align="left"> |changecom(,)&`#'8201;changecom(`#')| +<td width="7%"> m4tt svg_backsl</g> + <td align="left"> changecom(,)&`#'92;changecom(`#') +</table> + </ul> + <li> Inkscape: It may be efficient to define elements by macro and to + place them using a WYSIWYG graphics editor. A draft page intended + for Inkscape is included. A reasonable variety of elements is defined + but should be customized for particular applications. + <li> Link experiments: Click on the resistor or source of quickSVG + to go to external + files in new windows. Click on "n-port" in NportSVG to replace the diagram + and then "back" to return. + <li> Some of the assumptions used to create this draft may be naive. Comments + are welcome. +</ul> +<hr> + +cfig(XXXXX) + +</BODY> +</HTML> diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ujtSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ujtSVG.m4 new file mode 100644 index 00000000000..2672d38989a --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ujtSVG.m4 @@ -0,0 +1,31 @@ +.PS +# `ujt.m4' +cct_init(svg_font(sans-serif,11bp__)) + +dwn = 1.0 +dsep = 0.15 + +define(`demo_ujt',`up_ + ujt(`$1',`$2',`$3',`$4') + "B1" ifelse(`$5',,below,ljust) at last [].B1 + "E" at 1.5 between last [].Bulk.c and last [].E + "B2" ifelse(`$5',,above,ljust) at last [].B2 + ') + +[demo_ujt(up_ dimen_,,,E,A) +`"ujt(up_ dimen_,,,E)"' wid 1.3 at last [].s+(0,-0.2) below ] + +[demo_ujt(,,P,) +`"ujt(,,P,)"' at last [].s+(0,-dsep) below] \ +with .sw at last [].se+(0.8,0) + +[demo_ujt(,R,,) +`"ujt(,R,,)"' at last [].s+(0,-dsep) below] \ +with .sw at last [].se+(0.8,0) + +[demo_ujt(,R,P,) +`"ujt(,R,P,)"' at last [].s+(0,-dsep) below] \ +with .sw at last [].se+(0.8,0) + + command "</g>" # end font +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/wormSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/wormSVG.m4 new file mode 100644 index 00000000000..79ac53f772a --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/wormSVG.m4 @@ -0,0 +1,123 @@ +.PS +# worm.m4 + gen_init + +define(`svgcolor',`sprintf("rgb(%g,%g,%g)",`$1',`$2',`$3')') + +`define case { exec sprintf("$%g",floor($1+0.5)+1); }' + +`define hsvtorgb { + h_ = $1; s_ = $2; v_ = $3 + f_ = h_/60-floor(h_/60) + p_ = v_*(1-s_) + q_ = v_*(1-f_*s_) + t_ = v_*(1-(1-f_)*s_) + case(pmod(floor(h_/60),6)+1, + $4 = v_; $5 = t_; $6 = p_, + $4 = q_; $5 = v_; $6 = p_, + $4 = p_; $5 = v_; $6 = t_, + $4 = p_; $5 = q_; $6 = v_, + $4 = t_; $5 = p_; $6 = v_, + $4 = v_; $5 = p_; $6 = q_) + $4 = int(($4)*255+0.5) + $5 = int(($5)*255+0.5) + $6 = int(($6)*255+0.5) + }' + +Worm: [ + linethick_(0.1) + dimen = 1.25 # scale parameter; try dimen=2 for a larger picture + w = 0.15 * dimen # worm radius + nhues = 265 + S: dimen,0 + for inx = 1 to nhues +2 do { + theta = inx*360/nhues + R: dimen*cosd(3*theta), dimen*sind(2*theta) + D: R-(S.x,S.y) + t = sqrt(max(0,w^2/(D.x^2+D.y^2)-1/4)) + Ra: 0.5<S,R> + (t*D.y,-t*D.x) + Rb: 0.5<S,R> - (t*D.y,-t*D.x) + if inx <= nhues then { + hsvtorgb(theta+120,1,1,r,g,b) + rgbfill( r,g,b, + arc cw from Ra to Rb rad w with .c at S + arc ccw from Rb to Ra rad w with .c at R ) + } else { + arc cw from Ra to Rb rad w with .c at S + arc ccw from Rb to Ra rad w with .c at R } + S: R + } + ] + + "svg_fsize(R,120)" at 0.9<Worm.se,Worm.ne> ljust + "svg_fsize(G,120)" at Worm.e ljust + "svg_fsize(B,120)" at 0.1<Worm.se,Worm.ne> ljust + "svg_fsize(Y,120)" at 0.1<Worm.sw,Worm.nw> rjust + "svg_fsize(M,120)" wid 0.2 at Worm.w rjust + "svg_fsize(C,120)" at 0.9<Worm.sw,Worm.nw> rjust + box invis ht Worm.ht wid Worm.wid+0.4 at Worm + +[ thicklines_ + C: circle rad 1.5 at 0,0 + smallrad = C.rad/2 + for t=0 to 330 by 30 do { + line from Rect_(C.rad-0.05,90-t) to Rect_(C.rad+0.05,90-t) + sprintf("%g",t) at Rect_(C.rad+0.2,90-t) + } + "svg_fsize(R,120)" at Rect_(C.rad+0.45,90-0) + "svg_fsize(Y,120)" wid 0.2 at Rect_(C.rad+0.45,90-60) + "svg_fsize(G,120)" at Rect_(C.rad+0.45,90-120) + "svg_fsize(C,120)" at Rect_(C.rad+0.45,90-180) + "svg_fsize(B,120)" at Rect_(C.rad+0.45,90-240) + "svg_fsize(M,120)" at Rect_(C.rad+0.45,90-300) + linethick_(0) + + for t = 1 to 90 do { + hsvtorgb(t/90*360,1,1,r,g,b) + line shaded svgcolor(r,g,b) outlined svgcolor(r,g,b) \ + from C to Rect_(C.rad-0.05,90-(t-0.5)/90*360) \ + then to Rect_(C.rad-0.05,90-(t+0.5)/90*360) \ + then to C + } + + R: circle diam C.rad at Rect_(C.rad*3/8,90) color "rgb(255,0,0)" + G: circle diam C.rad at Rect_(C.rad*3/8,-30) color "rgb(0,255,0)" + B: circle diam C.rad at Rect_(C.rad*3/8,-150) color "rgb(0,0,255)" + + RG: cintersect(R,R.rad,G,G.rad) + GR: cintersect(R,R.rad,G,G.rad,R) + GB: cintersect(G,G.rad,B,B.rad) + BG: cintersect(G,G.rad,B,B.rad,R) + BR: cintersect(B,B.rad,R,R.rad) + RB: cintersect(B,B.rad,R,R.rad,R) + +# The following could be done other ways depending on the postprocessor +`define lozenge { + arc from $1$2 to $2$1 with .c at $2 + arc from $2$1 to $1$2 with .c at $1 }' + +# yellow +linethick = 0.1; rgbfill(255,255,0,lozenge(R,G)) +linethick = 0.4; rgbdraw(255,255,0,lozenge(R,G)) + +# cyan +linethick = 0.1; rgbfill(0,255,255,lozenge(G,B)) +linethick = 0.4; rgbdraw(0,255,255,lozenge(G,B)) + +# magenta +linethick = 0.1; rgbfill(255,0,255,lozenge(B,R)) +linethick = 0.4; rgbdraw(255,0,255,lozenge(B,R)) + +`define white { + arc cw from RB to GR with .c at R + arc cw from GR to BG with .c at G + arc cw from BG to RB with .c at B }' +linethick = 0.1; rgbfill(255,255,255,white) +linethick = 0.4; rgbdraw(255,255,255,white) +setrgb(255,255,255) + line from RB to GR then to BG then to RB +resetrgb + +] with .w at Worm.e+(0.5,0) + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/xx.html b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/xx.html new file mode 100644 index 00000000000..6b4881d450f --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/xx.html @@ -0,0 +1,11 @@ +<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> +<g> + <text x = "10" y = "25" font-size = "20"> + <tspan x = "10" y = "60"> + T<tspan dy="10">i+2</tspan> + <tspan dy="-10">= T</tspan><tspan dy="10">i</tspan> + <tspan dy="-10">+ T</tspan><tspan dy="10">i+1</tspan> + </tspan> + </text> + </g> +</svg> |