diff options
author | Norbert Preining <norbert@preining.info> | 2021-10-03 03:01:24 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-10-03 03:01:24 +0000 |
commit | c7bf3f5a728fcb426d1aa38fbec211d4344a3725 (patch) | |
tree | 87fbde2d0e79f9e5fce12cbb71971717568fbf9d /graphics/circuit_macros/examples/svg | |
parent | ac5a96ddb02c62d71eb214ed35e3be9a154d991f (diff) |
CTAN sync 202110030301
Diffstat (limited to 'graphics/circuit_macros/examples/svg')
-rw-r--r-- | graphics/circuit_macros/examples/svg/ByteSVG.m4 | 2 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/CapacitorsSVG.m4 | 9 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/ChipsSVG.m4 | 2 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/EEPSVG.m4 | 56 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/GeometrySVG.m4 | 35 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/MoreTableSVG.m4 | 2 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/ResistorsSVG.m4 | 30 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/RotboxSVG.m4 | 5 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/SLD.m4 | 389 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/SchottkySVG.m4 | 2 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/ex01SVG.m4 | 8 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/examplesSVG.htmx | 67 | ||||
-rw-r--r-- | graphics/circuit_macros/examples/svg/tstSVG.htmx | 261 |
13 files changed, 707 insertions, 161 deletions
diff --git a/graphics/circuit_macros/examples/svg/ByteSVG.m4 b/graphics/circuit_macros/examples/svg/ByteSVG.m4 index fcd6bdce60..ca059487e7 100644 --- a/graphics/circuit_macros/examples/svg/ByteSVG.m4 +++ b/graphics/circuit_macros/examples/svg/ByteSVG.m4 @@ -1,5 +1,5 @@ -% Byte.m4 .PS +# Byte.m4 gen_init(svg_font(sans-serif,11bp__)) boxht = 0.2 boxwid = 3.5 diff --git a/graphics/circuit_macros/examples/svg/CapacitorsSVG.m4 b/graphics/circuit_macros/examples/svg/CapacitorsSVG.m4 index 1942860d37..be6a8edd47 100644 --- a/graphics/circuit_macros/examples/svg/CapacitorsSVG.m4 +++ b/graphics/circuit_macros/examples/svg/CapacitorsSVG.m4 @@ -1,5 +1,5 @@ .PS -# `Capacitors.m4' +# `CapacitorsSVG.m4' cct_init(svg_font(sans-serif,11pt__)) textwid = 1.5 movewid = 2 pt__ @@ -26,12 +26,17 @@ vm = 0.28 move right_ hm {capacitor(,N); move ; "`capacitor(,N) '" ljust} move right_ hm - {xtal ; move ; "`xtal '" ljust} + {capacitor(,CP); move ; "`capacitor(,CP) '" ljust} +# {xtal ; move ; "`xtal '" ljust} } move down 0.25; right_ { {capacitor(,dC); move ;"`capacitor(,dC) '" ljust} move right_ hm {capacitor(,dF); move ;"`capacitor(,dF) '" ljust} + move right_ hm + {variable(`capacitor',NN,-30,dimen_/3) + move ;"`variable('svg_grave`capacitor'svg_prime`,'" wid 97bp__ ljust \ + "` NN,-30,dimen_/3)'" ljust } } command "</g>" # end font diff --git a/graphics/circuit_macros/examples/svg/ChipsSVG.m4 b/graphics/circuit_macros/examples/svg/ChipsSVG.m4 index 3d9ccb1edc..b85ce8d970 100644 --- a/graphics/circuit_macros/examples/svg/ChipsSVG.m4 +++ b/graphics/circuit_macros/examples/svg/ChipsSVG.m4 @@ -30,7 +30,7 @@ DIPs: [ { arrow <- from DIP0.Pin8 up 0.25 right 0.2 ; "svg_it(`Pin8')" above ljust } { "svg_tt(`DIP(32,direct=R;bodywid=0.5*scale)')" ljust \ - at DIP32.sw - (0,10bp__) } + at DIP32.sw - (20bp__,10bp__) } { arrow <- right 0.2 from DIP32.Pin1; "svg_it(`Pin1')" ljust } { spline <- right 0.2 then right 0.1 up 0.1 from DIP32.Pin32 "svg_it(`Pin32')" ljust } diff --git a/graphics/circuit_macros/examples/svg/EEPSVG.m4 b/graphics/circuit_macros/examples/svg/EEPSVG.m4 index 4f928f927d..277b704cd8 100644 --- a/graphics/circuit_macros/examples/svg/EEPSVG.m4 +++ b/graphics/circuit_macros/examples/svg/EEPSVG.m4 @@ -10,36 +10,38 @@ divert(-1) # already in libcct.m4. The contributions and suggestions of Benjamin # Vilmann are acknowledged with thanks. -# 1-terminal SLD elements: +# Notes for 1-terminal SLD elements: # Argument 1 is normally the linespec of the stem to set the element direction -# and length. See also: PtoL defined below. +# and length. See also: PtoL defined in libgen.m4. # For a 0-length stem (which has undefined direction): # arg1 can also be U, D, L, R (for up, down, left, right), # or a number to set the direction in degrees, optionally followed by # `at position' to set the position (Here by default). # Zero-length stem examples: sl_box(U), sl_box(45 at Here+(1,0)) # Argument 2 contains semicolon (;)-separated key-value attributes -# of the element head as applicable: e.g., name=Name; text="text"; lgth=expr -# A non-blank argument 3 is C for a default closed breaker in the stem, O for -# an open breaker, or key-value pairs to specify breaker details. -# The element body (head) can be named. It is overlaid with or contained in -# a [] block. - -# 2-terminal SLD elements: +# of the element head as applicable: e.g., name=Carol; text="Stop"; lgth=expr +# If argument 3 is blank then no breaker is drawn. A non-blank argument 3 +# is C for a default closed breaker in the stem, O for an open breaker, +# or key-value pairs to specify breaker details. +# The element body (head) can be named with name=. It is overlaid with +# or contained in a [] block. + +# Notes for 2-terminal SLD elements: # These obey the normal Circuit_macro two-terminal conventions. # They can be labelled using rlabel() or llabel() as well as directly. # Argument 2 contains key-value pairs to customize the element body, # e.g., name=Name; text="text"; wdth=expr; ... # Nonblank arguments 3 and 4 put a breaker in the input and output respectively. -# Attached breakers: +# Notes for attached breakers: # Nonblank arguments 3 and 4 of the two-terminal elements and argument 3 of # the 1-terminal elements specify a breaker in the input, output, and stem # respectivlely. An O creates a default-size open breaker, and C a closed # breaker, otherwise the argument contains key-value pairs to specify the # details of the box; e.g., box=dotted 2bp__ shaded "green" -# The SLD current transformer macro sl_ct is composite, within a [] block. +# Notes for composite elements within a [ ] block: +# The SLD current transformer macro sl_ct is composite. # Internal labels L (for inductor) and terminals Ts, Tc, and Te are defined. define(`sldlib_') @@ -195,24 +197,31 @@ define(`sl_eleminit_', input breaker keys, output breaker keys) keys: type=I|S - (type=I) scale=expr; (default 1.5) + (type=I) loopwid=expr; (default dimen_*3/10) cycles=n; (default 4) + core= A[ir]|M[n]|P[n]|K[n] + n=integer (default 2 lines) (type=S) body=shaded "color"; name=Body name; (breaker default names BrI, BrO)' define(`sl_transformer', - `setkeys_(`$2',name::N; type:I:N; cycles:4:N; body::N; scale:1.5:; )dnl + `setkeys_(`$2',name::N; type:I:N; cycles:4:N; core::N; body::N; + loopwid:3/20*dimen_; )dnl ifelse(`$3'`$4',, `ifinstr(m4type,S, `source(`$1',G,,,m4body)', `eleminit_(`$1'); m4atmp = rp_ang; m4slen = rp_len - define(`m4swd',`dimen_*3/16*m4scale')dnl + ifelse(ifinstr(m4core,M,T,m4core,P,T,m4core,K,T),T, + `define(`m4nL',ifelse(len(m4core),1,2,substr(m4core,1)))dnl + define(`m4swd',(m4loopwid + dimen_/12+(m4nL-1)*dimen_/16))',dnl + `define(`m4swd',(m4loopwid*3/2))')dnl { line to rvec_((m4slen-m4swd)/2,0) - {ifelse(m4name,,SL_box,m4name): [ linewid = linewid*m4scale - {L1: inductor(to vec_(0,-m4cycles*dimen_/8),,m4cycles)} + {ifelse(m4name,,SL_box,m4name): [#linewid = linewid*m4scale + {L1: inductor(to vec_(0,-m4cycles*m4loopwid),,m4cycles,m4core, + m4loopwid)} {point_(m4atmp) - L2: inductor(from vec_(dimen_*3/16,-m4cycles*dimen_/8) \ - to vec_(dimen_*3/16,0),,m4cycles)} + L2: inductor(from vec_(m4swd,-m4cycles*m4loopwid) \ + to vec_(m4swd,0),,m4cycles,,m4loopwid)} C2: last line.c; point_(m4atmp) ] with .L1.c at Here} line from rvec_(m4swd,0) to rvec_((m4slen+m4swd)/2,0) } line invis to rvec_(rp_len,0)') ', @@ -389,6 +398,17 @@ define(`sl_ct', # ####################################################################### +# The following is defined in Circuit_macros 9.5.4 or later: + + `setkeys_(string,keysequence) + Invoke setkey_ on arg1 and each term in a + sequence of terms. + keysequence is a ;-separated sequence + of terms of the form + identifier:default value:N ' +define(`setkeys_',`Loopover_(`M4sk',`setkey_(`$1',patsubst(M4sk,:,`,')) dnl', + patsubst(`$2',;,`,'))') + divert(0)dnl diff --git a/graphics/circuit_macros/examples/svg/GeometrySVG.m4 b/graphics/circuit_macros/examples/svg/GeometrySVG.m4 index bb6ff0bd2a..5dc1284d08 100644 --- a/graphics/circuit_macros/examples/svg/GeometrySVG.m4 +++ b/graphics/circuit_macros/examples/svg/GeometrySVG.m4 @@ -1,9 +1,10 @@ .PS # Geometry.m4 gen_init + maxpswid = 10 scale = 5/4 -G: [ +Fig1: [ A: Here; "A" at A above B: A+(-1,-3.5); "B" at B below rjust @@ -12,7 +13,7 @@ G: [ BC: line from B to C CA: line from C to A - PerpTo(A,BC,L); "L" at L below + perpto(A,BC,L); "L" at L below AL: line from A to L; RightAngle(A,L,C) angleLAC = atan2(C.x-L.x,A.y-L.y) @@ -20,10 +21,10 @@ G: [ AW: line from A to Intersect_(S,BC) W: Here; "W" at W below rjust - PerpTo(C,AB,N); "N" at N above rjust + perpto(C,AB,N); "N" at N above rjust CN: line from C to N; RightAngle(C,N,B) - PerpTo(B,CA,M); "M" at M above + perpto(B,CA,M); "M" at M above CM: line from B to M; RightAngle(B,M,C) H: Intersect_(CN,AL); "H" at H +(4bp__,10bp__) @@ -45,7 +46,8 @@ G: [ line dashed from X to Y chop -linewid/2 RightAngle(A,Z,Y) ] scaled 0.8 -Lyap: [ + +Fig2: [ #.PS # Lyap.m4 threeD_init @@ -205,6 +207,27 @@ arrow from F[n/2] to Project(0,0,2) "svg_it(v(X) = c)" at (Project(vp(100*dtor_,c)))+(2bp__,0) above ljust #.PE - ] scaled 1.5 with .sw at last [].se+(0.5,0) + ] scaled 1.5 with .w at last [].e+(0.5,0) + +Fig3: [ +# https://tex.stackexchange.com/questions/609452/help-drawing-a-more-sophisticated-right-triangle-with-tikz-or-something-else +gen_init + + unit = 0.8 + C: Here; { "C" at C rjust below } + B: C+(4*unit,0); { "B" at B ljust below } + A: C+(0,3*unit); { "A" at A rjust above } + H: PerpTo(C,A,B); { "H" at H ljust above } + line from C to H then to B then to C shaded rgbstring(0.5,0.8,0.9) + line from C to H then to A then to C shaded rgbstring(0.8,0.9,0.7) + ArcAngle(C,A,B,unit*0.4) + ArcAngle(C,A,B,unit*0.5) + ArcAngle(A,B,C,unit*0.5,,"svg_theta" rjust) + ArcAngle(B,C,H,unit*0.5); {"svg_theta" at C+(unit*0.3,unit*0.17) } + ArcAngle(B,C,A,unit*0.6) + RightAngle(B,C,A,unit*0.17) + RightAngle(C,H,A,unit*0.17) + + ] with .sw at Fig2.se+(0.2,0) .PE diff --git a/graphics/circuit_macros/examples/svg/MoreTableSVG.m4 b/graphics/circuit_macros/examples/svg/MoreTableSVG.m4 index e06efb5d5e..5966216c59 100644 --- a/graphics/circuit_macros/examples/svg/MoreTableSVG.m4 +++ b/graphics/circuit_macros/examples/svg/MoreTableSVG.m4 @@ -35,6 +35,8 @@ vm = 0.28 {thermocouple ; move;"`thermocouple '" ljust } # move up 0.10 right_ hm # {arrester ; move ;"`arrester '" ljust} + move right_ hm + {xtal ; move ;"`xtal '" ljust} } command "</g>" # end font diff --git a/graphics/circuit_macros/examples/svg/ResistorsSVG.m4 b/graphics/circuit_macros/examples/svg/ResistorsSVG.m4 index 4fb0be47f0..4da2b4f344 100644 --- a/graphics/circuit_macros/examples/svg/ResistorsSVG.m4 +++ b/graphics/circuit_macros/examples/svg/ResistorsSVG.m4 @@ -8,26 +8,40 @@ vm = 0.28 hm = 2.05 vm = 0.28 -{ {resistor ; move ; svgLink(NportSVG.svg,"`resistor'" ljust)} +{ + {resistor ; move ; svgLink(NportSVG.svg,"`resistor'" ljust)} move right_ hm {resistor(,,Q) ; move ; "`resistor(,,Q) '" ljust} move right_ hm - {resistor(,,E) ; move - "`resistor(,,E)'" ljust " svg_equiv `ebox'" ljust} + {resistor(,,V) ; move ; "`resistor(,,V) '" ljust} } move down vm; right_ -{ {resistor(,,ES) ; move ; "`resistor(,,ES) '" ljust} +{ + {resistor(,,ES) ; move ; "`resistor(,,ES) '" ljust} move right_ hm {resistor(,,H) ; move ; "`resistor(,,H) '" ljust} move right_ hm - {ebox(,,,0.5) ; move ; "`ebox(,,,0.5) '" ljust} + {resistor(,,AC) ; move ; "`resistor(,,AC) '" ljust} } move down vm; right_ -{ {resistor(,,V) ; move ; "`resistor(,,V) '" ljust} +{ + {resistor(,,B) ; move ; "`resistor(,,B) '" ljust} + move right_ hm + {resistor(,,E) ; move + "`resistor(,,E)'" ljust " svg_equiv `ebox'" ljust} move right_ hm {ebox(,0.5,0.3) ; move ;"`ebox(,0.5,0.3) '" ljust} - move right_ hm+4bp__ - {resistor(,,B) ; move movewid-4bp__ ; "`resistor(,,B) '" ljust} +} + move down vm; right_ +{ + {ebox(,,,0.6) ; move ; "`ebox(,,,0.6) '" ljust} + move right_ hm + {ebox(,,,,shaded "green") ; move ;"`ebox(,,,,shaded \"green\") '" ljust} +} + move down vm; right_ +{ + {ebox(,wdth=0.2;box=dashed shaded "green";text="X") ; move + "`ebox(,wdth=0.2;box=dashed shaded \"green\";text=\"X\")'" ljust} } command "</g>" # end font diff --git a/graphics/circuit_macros/examples/svg/RotboxSVG.m4 b/graphics/circuit_macros/examples/svg/RotboxSVG.m4 index 3d4fbde82b..cb65d317fc 100644 --- a/graphics/circuit_macros/examples/svg/RotboxSVG.m4 +++ b/graphics/circuit_macros/examples/svg/RotboxSVG.m4 @@ -1,5 +1,5 @@ -% Rotbox.m4 .PS +# RotboxSVG.m4 gen_init #nclude(dpictools.pic) @@ -7,7 +7,8 @@ gen_init Point_(-10) rotbox(boxwid/2,,thick 2) Point_(30) - rotbox(,,shaded "green" outlined "blue",r=0.1) at last []+vec_(boxwid,0) + rotbox(,,shaded "yellow" outlined "blue" thick 3,r=0.1) \ + at last []+vec_(boxwid,0) "r=0.1" at last [] move to last [].ne Point_(0) diff --git a/graphics/circuit_macros/examples/svg/SLD.m4 b/graphics/circuit_macros/examples/svg/SLD.m4 new file mode 100644 index 0000000000..96f04f7235 --- /dev/null +++ b/graphics/circuit_macros/examples/svg/SLD.m4 @@ -0,0 +1,389 @@ +divert(-1) + +# This section defines *DRAFT* SLD elements with or without attached +# circuit breakers. Many other elements applicable to SLD drawings are +# already in libcct.m4. The contributions and suggestions of Benjamin +# Vilmann are acknowledged with thanks. + +# Notes for 1-terminal SLD elements: +# Argument 1 is normally the linespec of the stem to set the element direction +# and length. See also: PtoL defined in libgen.m4. +# For a 0-length stem (which has undefined direction): +# arg1 can also be U, D, L, R (for up, down, left, right), +# or a number to set the direction in degrees, optionally followed by +# `at position' to set the position (Here by default). +# Zero-length stem examples: sl_box(U), sl_box(45 at Here+(1,0)) +# Argument 2 contains semicolon (;)-separated key-value attributes +# of the element head as applicable: e.g., name=Carol; text="Stop"; lgth=expr +# If argument 3 is blank then no breaker is drawn. A non-blank argument 3 +# is C for a default closed breaker in the stem, O for an open breaker, +# or key-value pairs to specify breaker details. +# The element body (head) can be named with name=. It is overlaid with +# or contained in a [] block. + +# Notes for 2-terminal SLD elements: +# These obey the normal Circuit_macro two-terminal conventions. +# They can be labelled using rlabel() or llabel() as well as directly. +# Argument 2 contains key-value pairs to customize the element body, +# e.g., name=Name; text="text"; wdth=expr; ... +# Nonblank arguments 3 and 4 put a breaker in the input and output respectively. + +# Notes for attached breakers: +# Nonblank arguments 3 and 4 of the two-terminal elements and argument 3 of +# the 1-terminal elements specify a breaker in the input, output, and stem +# respectivlely. An O creates a default-size open breaker, and C a closed +# breaker, otherwise the argument contains key-value pairs to specify the +# details of the box; e.g., box=dotted 2bp__ shaded "green" + +# Notes for composite elements within a [ ] block: +# The SLD current transformer macro sl_ct is composite. +# Internal labels L (for inductor) and terminals Ts, Tc, and Te are defined. + +define(`sldlib_') +ifdef(`libcct_',,`include(libcct.m4)divert(-1)') + +# Default size parameters. These can be redefined in a diagram. + +define(`brksiz_',`dimen_*3/16') # Default inline box breaker size +define(`drosiz_',`dimen_/4') # Default sl_drawout (chevron) size + +# One-terminal elements ################################################### + + `sl_disk( stem linespec, keys, breaker ) + keys: name=Name; + text="text"; + diam=expr; + circle=circle attributes; eg diam expr' + `default breaker name Bd' +define(`sl_disk', + `sl_eleminit_(`$1') + setkeys_(`$2',`name::N; circle::N; text::N; diam:dimen_*2/3')dnl + ifelse(`$3',, + `ifelse(m4name,,,m4name:) circle diam m4diam \ + at last line.end + vec_(m4diam/2,0) m4circle m4text + [ box invis wid_ m4diam ht_ m4diam ] at last circle + line from last line.end to last line.start', + `m4br_one(`sl_disk',`$1',`$2',m4brk_(`$3',Bd))') ') + + `sl_box( stem linespec, keys, breaker ) + keys: name=Name; lgth=expr; wdth=expr; + text="text"; + box= box attributes; (e.g. shade "red")' + `default breaker name Bb' +define(`sl_box', + `sl_eleminit_(`$1') + setkeys_(`$2',`name::N; wdth:dimen_*2/3; lgth:dimen_*2/3; box::N; text::N')dnl + ifelse(`$3',, + `line from last line.end to last line.start + { ifelse(m4name,,,m4name:) [S:Here; lbox(m4lgth,m4wdth,m4box)] \ + with .S at last line.start } + ifelse(m4text,,,`{m4text at last []}')', + `m4br_one(`sl_box',`$1',`$2',m4brk_(`$3',Bb))') ') + + `sl_grid( stem linespec, keys, breaker ) + keys: name=Name; lgth=expr; wdth=expr;' + `default breaker name Bgr' +define(`sl_grid', + `sl_eleminit_(`$1') + setkeys_(`$2',`name::N; wdth:dimen_*4/5; lgth:dimen_*2/3; box::N; text::N')dnl + ifelse(`$3',, + `line from last line.end to last line.start + { ifelse(m4name,,,m4name:) [S:Here + { ifelse(m4name,,,m4name:) lbox(m4lgth,m4wdth) } + { line to rvec_(m4lgth/2, m4wdth/2) + line to rvec_(m4lgth/2,-m4wdth/2) + line to rvec_(-m4lgth/2,-m4wdth/2) + line to rvec_(-m4wdth/2, m4wdth/2) } + { line from rvec_(0,m4wdth/2) to rvec_(m4lgth,-m4wdth/2) } + line from rvec_(0,-m4wdth/2) to rvec_(m4lgth,m4wdth/2) + ] with .S at last line.start } ', + `m4br_one(`sl_grid',`$1',`$2',m4brk_(`$3',Bgr))') ') + + `sl_load( stem linespec, keys, breaker ) + keys: name=Name; lgth=expr; wdth=expr; + head= arrowhead attributes;' + `default breaker name Bl' +define(`sl_load', + `sl_eleminit_(`$1') + setkeys_(`$2',`name::N; wdth:dimen_*0.32; lgth:dimen_*0.45; head::N')dnl + ifelse(`$3',, + `line from last line.end to last line.start + { ifelse(m4name,,,m4name:) [S:Here; line to rvec_(0,m4wdth/2) \ + then to rvec_(m4lgth,0) then to rvec_(0,-m4wdth/2) \ + then to Here m4head ] with .S at last line.start } ', + `m4br_one(`sl_load',`$1',`$2',m4brk_(`$3',Bl))') ') + + `sl_meterbox( stem linespec, keys, breaker ) + keys: sl_box attributes' + `default breaker name Bm' +define(`sl_meterbox', + `sl_eleminit_(`$1') + setkeys_(`$2',`name::N; wdth:dimen_*2/3; lgth:dimen_*2/3; box::N; text::N')dnl + ifelse(`$3',, + `line from last line.end to last line.start + {ifelse(m4name,,,m4name:) [S:Here; + { B: rotbox( m4lgth, m4wdth, m4box ) with .W at S } + a = rp_ang*rtod_ + if (abs(a-90) < 45) || (abs(a-180) < 45) || (abs(a+180) < 45) then { + C: rvec_(m4lgth*2/5,0) + line from rvec_(m4lgth*4/5,m4wdth/2) to rvec_(m4lgth*4/5,-m4wdth/2) } \ + else { C: rvec_(m4lgth*3/5,0) + line from rvec_(m4lgth/5,m4wdth/2) to rvec_(m4lgth/5,-m4wdth/2) } + ifelse(m4text,,,`m4text at C') + ] with .S at last line.start}', + `m4br_one(`sl_meterbox',`$1',`$2',m4brk_(`$3',Bm))') ') + + `sl_generator( stem linespec, keys, breaker )' + `default breaker name Bd' +define(`sl_generator',`sl_disk($@) + { ACsymbol(at last circle,,,R) + m4lcd = last circle.diam + [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } ') + + `sl_syncmeter( stem linespec, keys, breaker )' + `default breaker name Bd' +define(`sl_syncmeter',`sl_disk($@) + { Syncsymb(at last circle) + m4lcd = last circle.diam + [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } ') + + `sl_lamp( stem linespec, keys, breaker )' + `default breaker name Bd' +define(`sl_lamp',`sl_disk($@) + { line from last circle.ne to last circle.sw + line from last circle.nw to last circle.se + m4lcd = last circle.diam + [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } ') + +# One-terminal utilities ################################################## + + `Syncsymb(at position, rad) + Symbol for sync meter' +define(`Syncsymb',`[ define(`m4ssrad',`ifelse(`$2',,(dimen_/4),`($2)')')dnl + Origin: Here + {arc <-> ht arrowht/2 wid arrowwid*2/3 \ + from Rect_(m4ssrad,30) to Rect_(m4ssrad,150) with .c at Here} + line from (0,m4ssrad) to (0,-m4ssrad/2) + `$3' ] with .Origin ifelse(`$1',,`at Here',`$1')') + + `m4br_one( `name', stem linespec, body keys, + breaker keys )' + `Draw the breaker in the stem then the element' +define(`m4br_one', + `M4_S: last line.start + setkey_(`$4',lgth,brksiz_)dnl + line from M4_S to last line.end+vec_(-(m4lgth)*5/2,0) + sl_breaker(to rvec_(m4lgth,0),`$4') + $1(to rvec_((m4lgth)*3/2,0),`$3') + move to M4_S ') + + `sl_eleminit_(linespec or (for zero length) + U|D|L|R|number [at location])' +define(`sl_eleminit_', + `ifelse(regexp(`$1',^ *[UDLR0123456789]),-1, + `eleminit_(`$1',dimen_)', + `pushdef(`M4pos',`ifinstr(`$1',` at ',`patsubst(`$1',^.* at *)')')dnl + ifelse(M4pos,,,`move to M4pos;') setdir_(patsubst(`$1',` at.*')) + line invis from Here to Here popdef(`M4pos')')') + +# Two-terminal elements ################################################### + + `sl_transformer(linespec,keys, + input breaker keys, output breaker keys) + keys: + type=I|S + (type=I) scale=expr; (default 1.5) + cycles=n; (default 4) + (type=S) body=shaded "color"; + name=Body name; + (breaker default names BrI, BrO)' +define(`sl_transformer', + `setkeys_(`$2',name::N; type:I:N; cycles:4:N; body::N; scale:1.5:; )dnl + ifelse(`$3'`$4',, + `ifinstr(m4type,S, + `source(`$1',G,,,m4body)', + `eleminit_(`$1'); m4atmp = rp_ang; m4slen = rp_len + define(`m4swd',`dimen_*3/16*m4scale')dnl + { line to rvec_((m4slen-m4swd)/2,0) + {ifelse(m4name,,SL_box,m4name): [ linewid = linewid*m4scale + {L1: inductor(to vec_(0,-m4cycles*dimen_/8),,m4cycles)} + {point_(m4atmp) + L2: inductor(from vec_(dimen_*3/16,-m4cycles*dimen_/8) \ + to vec_(dimen_*3/16,0),,m4cycles)} + C2: last line.c; point_(m4atmp) ] with .L1.c at Here} + line from rvec_(m4swd,0) to rvec_((m4slen+m4swd)/2,0) } + line invis to rvec_(rp_len,0)') ', + `m4br_two(`sl_transformer',`$1',`$2',m4brk_(`$3',BrI),m4brk_(`$4',BrO), + ifelse(`$3',,,I)`'ifelse(`$4',,,O))') ') + + `Two-terminal box' + `sl_ttbox(linespec,keys,breaker keys,breaker keys) + keys= lgth=expr; wdth=expr; box=attributes; + supp=additional rotbox commands; name=Body name; + text="text"; + (breaker default names BrI, BrO)' +define(`sl_ttbox', + `setkeys_(`$2',`lgth:dimen_*3/4; wdth:dimen_*3/4; + name::N; box::N; text::N; supp::N')dnl + ifelse(`$3'`$4',, + `eleminit_(`$1') + {line to rvec_((rp_len-m4lgth)/2,0) + {ifelse(m4name,,,m4name:)rotbox(m4lgth,m4wdth,m4box,,m4supp) \ + with .W at Here } + {ifelse(m4text,,,`{m4text at rvec_(m4lgth/2,0)}') } + line from rvec_(m4lgth,0) to rvec_((rp_len+m4lgth)/2,0)} + line invis to rvec_(rp_len,0) ', + `m4br_two(`sl_ttbox',`$1',`$2',m4brk_(`$3',BrI),m4brk_(`$4',BrO), + ifelse(`$3',,,I)`'ifelse(`$4',,,O))') ') + +define(`m4brk_',`ifelse(`$1',,, + `ifelse(`$1',C,,`$1',O,box=fill 0,`$1')`'ifelse(`$2',,,;name=`$2')')') + + `sl_rectifier(ttbox args)' +define(`sl_rectifier', + `sl_ttbox(`$@') + { line from last [].Line.ne to last [].Line.sw + AC: ACsymbol(at last [].C+(-m4lgth/6, m4wdth/4),,,R) + DC: DCsymbol(at 2nd last [].C+( m4lgth/6,-m4wdth/4),,,R) } ') + + `sl_inverter(ttbox args)' +define(`sl_inverter', + `sl_ttbox(`$@') + { line from last [].Line.ne to last [].Line.sw + DC: DCsymbol(at last [].C+(-m4lgth/6, m4wdth/4),,,R) + AC: ACsymbol(at 2nd last [].C+( m4lgth/6,-m4wdth/4),,,R) } ') + + `sl_breaker(linespec, type=[A|C][D]; ttbox keys) + C is for curved breaker + D is for sl_drawout' +define(`sl_breaker', + `setkeys_(`$2',`lgth:brksiz_; wdth:brksiz_; name::N; type::N')dnl + ifinstr(m4type,C, + `ifinstr(m4type,D, + `m4ch_two(`cbreaker',`$1')', + `ifelse(m4name,,,m4name:) cbreaker(`$1')')', + `ifinstr(m4type,D, + `m4ch_two(`sl_ttbox',`$1',lgth=m4lgth;wdth=m4wdth;`$2';name=Br)', + `sl_ttbox(`$1',lgth=m4lgth;wdth=m4wdth;`$2')') ') ') + + `sl_reactor(linespec,keys,breaker keys,breaker keys) + keys= + diam=expr, + (Default breaker names BrI and BrO)' +define(`sl_reactor', + `setkeys_(`$2',`diam:sourcerad_*4/3; type::N')dnl + ifelse(`$3'`$4',, + `eleminit_(`$1') + { line to rvec_(rp_len/2,0) then to rvec_(rp_len/2,-m4diam/2); round + arc rad m4diam/2 cw from Here to rvec_(m4diam/2,m4diam/2) \ + with .c at rvec_(0,m4diam/2); round + line to rvec_(rp_len/2-m4diam/2,0) } + {[ box invis ht m4diam wid m4diam ] at rvec_(rp_len/2,0)} + line invis to rvec_(rp_len,0) ', + `m4br_two(`sl_reactor', `$1', lgth=m4diam*2;`$2', + m4brk_(`$3',BrI),m4brk_(`$4',BrO),ifelse(`$3',,,I)`'ifelse(`$4',,,O))')') + + `sl_busbar( linespec, nports, keys ) + Labels P1, P2 ... Pnports are defined on the line. + keys: line=line attributes; + port=D; (dotted ports) + The bus extends beyond the first and last points + by dimen_/5 which can be redefined as + line=chop -(expr)' +define(`sl_busbar', + `define(`m4npoints',`ifelse(`$2',,2,`$2')')dnl + setkeys_(`$3',`line:thick 1.6 chop -dimen_/5:N; port::N')dnl + [ tmp_ang = rp_ang + eleminit_(`$1',(m4npoints-1)*dimen_) + Start: last line.start; End: last line.end + for_(1,m4npoints,1, + `P`'m4x: (m4x-1)/(m4npoints-1) between Start and End dnl + ifinstr(m4port,D,` ;dot(at P`'m4x)')') + Line: line from Start to End m4line + Start: last line.start; End: last line.end + point_(tmp_ang) ] ') + + `sl_drawout(linespec, keys, R) + Drawout (i.e. plugin) chevron element; + keys: type=T; (truncated leads) + lgth=expr; (body size) + wdth=expr; + name=Name; (body name) + line= line attributes (e.g. thick 2) + arg3=R reverse direction' +define(`sl_drawout', + `setkeys_(`$2',`lgth:drosiz_; wdth:drosiz_; type::N; name::N; line::N')dnl + eleminit_(`$1',ifelse(m4type,T,m4lgth)) + ifelse(`$3',R,`{M4ds: Here; move to last line.end; rp_ang = rp_ang+pi_') + {line to rvec_(rp_len/2,0) + ifelse(m4name,,,m4name:) [ + S: Here; {line from rvec_(-m4lgth/2,m4wdth/2) to Here then + to rvec_(-m4lgth/2,-m4wdth/2) m4line } + E: rvec_(m4lgth/2,0); line from rvec_(0,m4wdth/2) to E then + to rvec_(0,-m4wdth/2) m4line ] with .S at Here + ifelse(m4type,T,, + line from last [].E to last [].E+vec_((rp_len-m4lgth)/2,0))} + ifelse(`$3',R,`rp_ang = rp_ang-pi_; move to M4ds}') + line invis to rvec_(rp_len,0) ') + +# Two-terminal utilities ################################################## + + `Breakers in the input and output lines:' + `m4br_two(`2-term element macroname in quotes', + linespec, body keys, + input breaker keys, + output breaker keys, + I|O|IO)' + `(Default breaker names are BrI and BrO)' +define(`m4br_two', + `define(`m4il',`ifinstr(`$6',I,`setkey_(`$4',lgth,brksiz_) m4lgth',0)')dnl + define(`m4ol',`ifinstr(`$6',O,`setkey_(`$5',lgth,brksiz_) m4lgth',0)')dnl + define(`m4bl',`setkey_(`$3',lgth,dimen_*4/3) m4lgth')dnl + eleminit_(`$2',dimen_*3) + M4start: Here; M4end: last line.end + M4cc: last line.c+vec_(((m4il*3/2)-(m4ol*3/2)),0) + M4ii: M4cc+vec_(-min((m4bl/2+m4il/2),distance(M4start,M4cc)-m4il),0) + line from M4start to ifinstr(`$6',I, + `M4ii+vec_(-m4il,0); sl_breaker(to M4ii,`$4';name=BrI)',M4ii) + M4oi: M4cc+vec_(min((m4bl/2+m4ol/2),distance(M4end,M4cc)-m4ol),0) + $1(from M4ii to M4oi,`$3') + ifinstr(`$6',O,`sl_breaker(to M4oi+vec_(m4ol,0),`$5';name=BrO)') + line to M4end + line invis from M4start to M4end ') + + `Chevrons in the input and output lines:' + `m4ch_two(`2-term element macroname in quotes', + linespec, body keys, + input breaker keys, + output breaker keys, + I|O|IO)' +define(`m4ch_two', + `define(`m4bl',`setkey_(`$3',lgth,dimen_*3/8) m4lgth')dnl + eleminit_(`$2',dimen_*3) + M4start: Here; M4end: last line.end + M4elem: $1(to rvec_(m4bl+2*drosiz_,0) with .c at last line.c,`$3') + sl_drawout(from last line.start-vec_(drosiz_,0) to last line.start,type=T,R) + line from last line.start to M4start + sl_drawout(from M4elem.end to M4elem.end+vec_(drosiz_,0),type=T) + line to M4end + line invis from M4start to M4end') + +# Composite elements ################################################### + + `sl_ct( at position, stem length, U|D|L|R|expr, + scale=expr) (default scale is 1.5)' +define(`sl_ct', + `[ setdir_(`$3'); setkey_(`$4',scale,1.5); linewid = linewid*m4scale + L: inductor(to vec_(2*dimen_/8,0),,2) + stemlen = ifelse(`$2',,dimen_/5,`$2') + line from L.start to L.start+vec_(0,-stemlen) + Ts: Here + line from L.end to L.end+vec_(0,-stemlen) + Te: Here + line from L.c to L.c+vec_(0,-stemlen) + Tc: Here + resetdir_ ] with .L.c at ifelse(`$1',,Here,patsubst(`$1',^ *at *)) ') + +# ####################################################################### + +divert(0)dnl diff --git a/graphics/circuit_macros/examples/svg/SchottkySVG.m4 b/graphics/circuit_macros/examples/svg/SchottkySVG.m4 index 68a7037eb5..51e21bc291 100644 --- a/graphics/circuit_macros/examples/svg/SchottkySVG.m4 +++ b/graphics/circuit_macros/examples/svg/SchottkySVG.m4 @@ -1,5 +1,5 @@ -% SchottkySVG.m4 .PS +# SchottkySVG.m4 # 4-input positive NAND: the Schottky option for transistors (TI TTL data book) cct_init(svg_font(sans-serif,11bp__,1bp__)) diff --git a/graphics/circuit_macros/examples/svg/ex01SVG.m4 b/graphics/circuit_macros/examples/svg/ex01SVG.m4 index b8787d1539..dd22dd8494 100644 --- a/graphics/circuit_macros/examples/svg/ex01SVG.m4 +++ b/graphics/circuit_macros/examples/svg/ex01SVG.m4 @@ -16,13 +16,13 @@ Timer: [ 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)) + 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)) + 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 @@ -40,7 +40,7 @@ R: dot 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)) + 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 diff --git a/graphics/circuit_macros/examples/svg/examplesSVG.htmx b/graphics/circuit_macros/examples/svg/examplesSVG.htmx index 22ab9f9c42..ec9847b32e 100644 --- a/graphics/circuit_macros/examples/svg/examplesSVG.htmx +++ b/graphics/circuit_macros/examples/svg/examplesSVG.htmx @@ -51,9 +51,9 @@ ifinstr(`$3',y,,`<hr>')') --------------------------------------------------------------------- --> <BODY> -<table cellpadding="0" cellspacing="0" width="700px" border="0" align="center" > -<tr> -<td> +<table cellpadding="0" cellspacing="0" + width="700px" border="0" align="center" ><tr><td> + <H2>SVG Circuit_macros examples, Version XXX</H2> <hr> @@ -193,7 +193,6 @@ There are a number of other issues: and https://www.toptal.com/designers/htmlarrows/math/ --> -<hr width="100%" align="left"> <table cellpadding="2" cellspacing="0" width="75%" > <tr> <td width="10%"> m4tt svg_alpha</g> <td align="left"> changecom(,)&`#'945;changecom(`#') @@ -253,6 +252,7 @@ There are a number of other issues: <td width="10%"> m4tt svg_rparen</g> <td align="left"> changecom(,)&`#'41;changecom(`#') <td width="10%"> m4tt svg_circ</g> <td align="left"> changecom(,)&`#'710;changecom(`#') <td width="10%"> m4tt svg_deg</g> <td align="left"> changecom(,)&`#'176;changecom(`#') +<td width="10%"> m4tt svg_grave</g> <td align="left"> changecom(,)&`#'96;changecom(`#') </tr> </table> <table cellpadding="2" cellspacing="0" width="75%" > @@ -262,7 +262,6 @@ There are a number of other issues: <td width="8%"> m4tt svg_thinsp</g> <td width="50px" align="left"> |changecom(,)&`#'8201;changecom(`#')| </tr> </table> -<hr width="100%" align="left"> </ul> <li> Inkscape: It may be efficient to define elements by macro and to @@ -301,7 +300,7 @@ There are a number of other issues: <hr> cfig(ResistorsSVG, - Resistors, showing some variations) + Resistors, showing some variations and the ebox) cfig(CapacitorsSVG, Capacitors) @@ -309,9 +308,6 @@ cfig(CapacitorsSVG, cfig(InductorsSVG, Inductors) -cfig(MoreTableSVG, - Some other two-terminal elements) - cfig(DiodesSVG, Diodes: a m4tt`'K</g> in the second argument draws an open arrowhead) @@ -319,34 +315,37 @@ cfig(DiodesSVG, cfig(EmarrowsSVG, Radiation arrows) +cfig(VariableSVG, + Arrows and marks for showing variability) + cfig(SourcesSVG, Sources and source-like elements) -cfig(VariableSVG, - Arrows and marks indicating variability) - cfig(AmpTableSVG, Macros m4tt`'amp`,' delay</g>`,' and m4tt`'integrator</g>) cfig(FusesSVG, Macros m4tt`'fuse</g> and m4tt`'cbreaker</g>) -cfig(SwitchesSVG, - The switch macros; m4tt`'switch(`,'`,'`,'L|B|D)</g> is a wrapper - for m4tt`'lswitch</g>`,' m4tt`'bswitch</g>`,' and m4tt`'dswitch</g>) +cfig(MoreTableSVG, + Additional two-terminal elements) cfig(GroundsSVG, Ground symbols) +cfig(SwitchesSVG, + The switch macros; m4tt`'switch(`,'`,'`,'L|B|D)</g> is a wrapper + for m4tt`'lswitch</g>`,' m4tt`'bswitch</g>`,' and m4tt`'dswitch</g>) + cfig(AntennasSVG, Antenna symbols) -cfig(AudioSVG, - Audio elements) - cfig(OpampSVG, The opamp) +cfig(AudioSVG, + Audio elements) + cfig(XformSVG, The transformer element`,' drawing direction down) @@ -438,9 +437,6 @@ cfig(ex18SVG, (illustrating m4tt`'opamp`,' diode`,' resistor`,' ground`,'</g> and labels)) -cfig(MCSVG, - A three-phase switched AC-AC converter and a DC-DC converter) - cfig(ex10SVG, Non-planar graph and bistable circuit (illustrating the m4tt`'crossover</g> macro and colored elements)) @@ -448,6 +444,9 @@ cfig(ex10SVG, cfig(ThreeSVG, Three-phase oscillator) +cfig(MCSVG, + A three-phase switched AC-AC converter and a DC-DC converter) + cfig(ex17SVG, A repetitive network created by Pic looping and a skewed circuit used to test the macro m4tt`'parallel_</g>) @@ -506,18 +505,18 @@ cfig(lcctSVG, "An Approach to Drawing Circuit Diagrams for Text Books`,'" Tugboat (12)1`,' March 1991`,' pp. 66-69) -cfig(UNOSVG, - An Arduino UNO circuit adapted and redrawn) - <!-- - m4tt`'https://content.arduino.cc/assets/UNO-TH_Rev3e_sch.pdf</g> - --> - cfig(TubediagsSVG, Electron-tube diagrams: a few bottom-view base diagrams`,' a generic triode test circuit`,' and a 25-watt audio amplifier adapted from F. Langford-Smith`,' <i>Radiotron Designers Handbook</i>`,' fourth edition`,' Harrison`,' NJ: Radio Corporation of America`,' 1952) +cfig(UNOSVG, + An Arduino UNO circuit adapted and redrawn) + <!-- + m4tt`'https://content.arduino.cc/assets/UNO-TH_Rev3e_sch.pdf</g> + --> + cfig(sfgSVG, Signal-flow graphs) @@ -533,7 +532,7 @@ cfig(DecoderSVG, cfig(ex21SVG, Some flip-flops) -cfig(MultiplexerSVG, +cfig(MultiplexerSVGfor showing Multiplexer) cfig(DemultiplexerSVG, @@ -555,7 +554,7 @@ cfig(AlogixSVG, The function tree is drawn`,' then a row or column of inputs`,' then the connections. The default result is on the left`,' a custom element at the top`,' and a tree of gates only is shown - on the right. THe lower examples illustrate the L`,' R`,' and V options.) + on the right.) cfig(ABlogixSVG, The m4tt`'Autologix</g> macro can draw inputs on the left but @@ -617,21 +616,23 @@ cfig(ex09SVG, specifies the arc to be dimensioned and the second argument is the outward radial offset of the dimension arrow arc.) -cfig(PlateSVG, - Dimensioning with tolerances according to ASME Y14.5) +cfig(ex05SVG, Use of m4tt`'darrow</g> and m4tt`'Darc</g>) -cfig(ex05SVG, +cfig(PlateSVG, + Dimensioning with tolerances according to ASME Y14.5) Use of m4tt`'darrow</g> and m4tt`'Darc</g>) cfig(LoglogSVG, A graph drawn using the pic language) cfig(GeometrySVG, - A plane geometry example`,' and an illustration of a Lyapunov function) + Plane geometry examples and an illustration of a Lyapunov function) +<!-- #cfig(LyapSVG, # Illustrating a Lyapunov function) +--> cfig(randomSVG, Testing random numbers) diff --git a/graphics/circuit_macros/examples/svg/tstSVG.htmx b/graphics/circuit_macros/examples/svg/tstSVG.htmx index 65425998fc..ccb14e00b8 100644 --- a/graphics/circuit_macros/examples/svg/tstSVG.htmx +++ b/graphics/circuit_macros/examples/svg/tstSVG.htmx @@ -5,63 +5,131 @@ <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> +<meta name="keywords" content="HTML" +content='Circuit elements, basic circuits, logic circuits and other diagrams, +electric circuits, resistor, capacitor, inductor, diode, sources, amplifier, +integrator, fuse, switch, antenna, opamp, transformer, relay, contact, jack, +plug, FET, UJT, thyristor, bipolar transistor, nport, windings, timer, +optical isolator, rectifier, bistable, oscillator, CMOS, MOSFET, power supply, +NAND gate, controlled source, synchronous machine, digital circuit, signal-flow +graph, latch, decoder, flipflop, full adder, logic diagram, crossbar switch, +dimensioning, control system, graph, RGB colors, recursion, binary tree, +flowcharts, picture overlay, ASME Y14.5' > + <style type="text/css"> </style> +<link rel="shortcut icon" href="../Circuit_macros.ico" type="image/x-icon" /> </HEAD> -<BODY> -<H2>SVG Circuit_macros examples, Version XXX</H2> -<hr> +<!-- --------------------------------------------------------------------- +define(`ifinstr',`ifelse(`$2',,`$1',index(`$1',`$2'),-1, + `ifinstr(shift(shift(shift($@))))',`$3')') -<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(`m4tt',`<g style="font-family:monospace">') define(`cfig',` <p> -<!--[if lt IE 9]><embed src="$1.svg" sinclude($1.siz)><![endif]--> + +<!--[if lte IE 8]><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 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]--> + </object> <![endif]--> + +<br><br> +ifelse(`$2',,,` +<a href="$1.txt" TYPE="text/plain" TARGET="_blank" alt="$1">$1.m4:</a> +`$2' changecom(,)&`#'8194;changecom(`#')') -<br> -<a href="$1.txt" TYPE="text/plain" TARGET="_blank">$1.m4</a> </p> -<hr>') +ifinstr(`$3',y,,`<hr>')') -define(`m4tt',`<g style="font-family:monospace">') +--------------------------------------------------------------------- --> -<!-- -<embed pluginspage="http://www.adobe.com/svg/viewer/install/" /> ---> +<BODY> +<table cellpadding="0" cellspacing="0" + width="700px" border="0" align="center" ><tr><td> +<H2>SVG Circuit_macros examples, Version XXX</H2> +<hr> + +<p> + This file shows diagrams in .svg format; + <A HREF="examples.html">png</A> + versions are also available. + The PDF equivalent can be found in examples.pdf of the distribution. +</p> + +<p> +The diagrams shown below have been adapted from the Circuit_macros +examples in order to test the svg output of dpic. Generating svg line +art is straightforward, but TeX, LaTeX, and related word +processors do not produce svg. Either less-sophisticated text formatting +must be employed or an + <A HREF="https://en.wikibooks.org/wiki/LaTeX/Export_To_Other_Formats"> + intermediate format</A> +such as pdf can be +produced, followed by an additional processing step to convert to svg. +Two possibilities for the latter are + <A HREF="https://www.ctan.org/pkg/dvisvgm">dvisvgm</A> +and + <A HREF="https://github.com/dawbarton/pdf2svg">pdf2svg</A> although +there may be font-related issues for some diagrams. +<br> +Many circuit and similar diagrams intended for the web do not +require sophisticated labels, however; the examples shown below might +be representative. +</p> <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. + Click on the link to view the source of each diagram. </p> +<hr> <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. + <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 default font face is not specified in all of these diagrams but is + inherited from the enclosing document, so the appearance of labels can + differ depending on the browser. Some of these diagrams set the font at + the beginning of the diagram source. + <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 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 could be defined to exercise some of the media capabilties of svg. + They are subject to change: <ul> <li> m4tt`'svg_font(</g>font-face,nominal size[:dptextratio],textoffset, dpic commands`'m4tt)</g>: + Change font face, size, textratio and dpic textoffset parameters. Change font face and dpic m4tt`'textht</g>, m4tt`'dptextratio</g>, and m4tt`'textoffset</g> parameters. If arg4 is blank, the font is changed and @@ -95,10 +163,10 @@ more basic. 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_ul(</g>text`'m4tt)</g>: underlined text <li>m4tt svg_ol(</g>text`'m4tt)</g>: overlined text + <li>m4tt svg_sup(</g>text, size percent, y displ, x displ`'m4tt)</g>: + superscript <li>m4tt svg_hat(</g>character`'m4tt)</g>: circumflex-accented character <li>m4tt svg_frac(</g>numerator[:wid], denominator[:wid]`'m4tt)</g>: basic fraction, wid in drawing units @@ -119,81 +187,104 @@ more basic. <li>m4tt svgLinkString</g> as above but for strings attached to objects <li> Greek and other symbols: -<table cellpadding="0" cellspacing="0" width="100%" > +<!-- + Reference: + https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references + and + https://www.toptal.com/designers/htmlarrows/math/ + --> +<table cellpadding="2" cellspacing="0" width="75%" > <tr> -<td width="8%"> m4tt svg_alpha</g> <td align="left"> changecom(,)&`#'945;changecom(`#') -<td width="8%"> m4tt svg_beta</g> <td align="left"> changecom(,)&`#'946;changecom(`#') -<td width="8%"> m4tt svg_Gamma</g> <td align="left"> changecom(,)&`#'915;changecom(`#') -<td width="8%"> m4tt svg_gamma</g> <td align="left"> changecom(,)&`#'947;changecom(`#') -<td width="8%"> m4tt svg_Delta</g> <td align="left"> changecom(,)&`#'916;changecom(`#') -<td width="8%"> m4tt svg_delta</g> <td align="left"> changecom(,)&`#'948;changecom(`#') +<td width="10%"> m4tt svg_alpha</g> <td align="left"> changecom(,)&`#'945;changecom(`#') +<td width="10%"> m4tt svg_beta</g> <td align="left"> changecom(,)&`#'946;changecom(`#') +<td width="10%"> m4tt svg_Gamma</g> <td align="left"> changecom(,)&`#'915;changecom(`#') +<td width="10%"> m4tt svg_gamma</g> <td align="left"> changecom(,)&`#'947;changecom(`#') +<td width="10%"> m4tt svg_Delta</g> <td align="left"> changecom(,)&`#'916;changecom(`#') +<td width="10%"> m4tt svg_delta</g> <td align="left"> changecom(,)&`#'948;changecom(`#') <td width="10%"> m4tt svg_epsilon</g> <td align="left"> changecom(,)&`#'949;changecom(`#') -<td width="8%"> m4tt svg_zeta</g> <td align="left"> changecom(,)&`#'950;changecom(`#') +<td width="10%"> m4tt svg_zeta</g> <td align="left"> changecom(,)&`#'950;changecom(`#') +</tr> <tr> -<td width="8%"> m4tt svg_eta</g> <td align="left"> changecom(,)&`#'951;changecom(`#') -<td width="8%"> m4tt svg_Theta</g> <td align="left"> changecom(,)&`#'920;changecom(`#') -<td width="8%"> m4tt svg_theta</g> <td align="left"> changecom(,)&`#'952;changecom(`#') -<td width="8%"> m4tt svg_iota</g> <td align="left"> changecom(,)&`#'953;changecom(`#') -<td width="8%"> m4tt svg_kappa</g> <td align="left"> changecom(,)&`#'954;changecom(`#') -<td width="8%"> m4tt svg_Lambda</g> <td align="left"> changecom(,)&`#'923;changecom(`#') -<td width="8%"> m4tt svg_lambda</g> <td align="left"> changecom(,)&`#'955;changecom(`#') -<td width="8%"> m4tt svg_mu</g> <td align="left"> changecom(,)&`#'956;changecom(`#') +<td width="10%"> m4tt svg_eta</g> <td align="left"> changecom(,)&`#'951;changecom(`#') +<td width="10%"> m4tt svg_Theta</g> <td align="left"> changecom(,)&`#'920;changecom(`#') +<td width="10%"> m4tt svg_theta</g> <td align="left"> changecom(,)&`#'952;changecom(`#') +<td width="10%"> m4tt svg_iota</g> <td align="left"> changecom(,)&`#'953;changecom(`#') +<td width="10%"> m4tt svg_kappa</g> <td align="left"> changecom(,)&`#'954;changecom(`#') +<td width="10%"> m4tt svg_Lambda</g> <td align="left"> changecom(,)&`#'923;changecom(`#') +<td width="10%"> m4tt svg_lambda</g> <td align="left"> changecom(,)&`#'955;changecom(`#') +<td width="10%"> m4tt svg_mu</g> <td align="left"> changecom(,)&`#'956;changecom(`#') +</tr> <tr> -<td width="8%"> m4tt svg_nu</g> <td align="left"> changecom(,)&`#'957;changecom(`#') -<td width="8%"> m4tt svg_Xi</g> <td align="left"> changecom(,)&`#'926;changecom(`#') -<td width="8%"> m4tt svg_xi</g> <td align="left"> changecom(,)&`#'958;changecom(`#') -<td width="8%"> m4tt svg_Pi</g> <td align="left"> changecom(,)&`#'928;changecom(`#') -<td width="8%"> m4tt svg_pi</g> <td align="left"> changecom(,)&`#'960;changecom(`#') -<td width="8%"> m4tt svg_rho</g> <td align="left"> changecom(,)&`#'961;changecom(`#') -<td width="8%"> m4tt svg_Sigma</g> <td align="left"> changecom(,)&`#'931;changecom(`#') -<td width="8%"> m4tt svg_sigma</g> <td align="left"> changecom(,)&`#'963;changecom(`#') +<td width="10%"> m4tt svg_nu</g> <td align="left"> changecom(,)&`#'957;changecom(`#') +<td width="10%"> m4tt svg_Xi</g> <td align="left"> changecom(,)&`#'926;changecom(`#') +<td width="10%"> m4tt svg_xi</g> <td align="left"> changecom(,)&`#'958;changecom(`#') +<td width="10%"> m4tt svg_Pi</g> <td align="left"> changecom(,)&`#'928;changecom(`#') +<td width="10%"> m4tt svg_pi</g> <td align="left"> changecom(,)&`#'960;changecom(`#') +<td width="10%"> m4tt svg_rho</g> <td align="left"> changecom(,)&`#'961;changecom(`#') +<td width="10%"> m4tt svg_Sigma</g> <td align="left"> changecom(,)&`#'931;changecom(`#') +<td width="10%"> m4tt svg_sigma</g> <td align="left"> changecom(,)&`#'963;changecom(`#') +</tr> <tr> -<td width="8%"> m4tt svg_tau</g> <td align="left"> changecom(,)&`#'964;changecom(`#') +<td width="10%"> m4tt svg_tau</g> <td align="left"> changecom(,)&`#'964;changecom(`#') <td width="10%"> m4tt svg_upsilon</g> <td align="left"> changecom(,)&`#'965;changecom(`#') -<td width="8%"> m4tt svg_Phi</g> <td align="left"> changecom(,)&`#'934;changecom(`#') -<td width="8%"> m4tt svg_phi</g> <td align="left"> changecom(,)&`#'966;changecom(`#') -<td width="8%"> m4tt svg_chi</g> <td align="left"> changecom(,)&`#'967;changecom(`#') -<td width="8%"> m4tt svg_Psi</g> <td align="left"> changecom(,)&`#'936;changecom(`#') -<td width="8%"> m4tt svg_psi</g> <td align="left"> changecom(,)&`#'968;changecom(`#') -<td width="8%"> m4tt svg_Omega</g> <td align="left"> changecom(,)&`#'937;changecom(`#') +<td width="10%"> m4tt svg_Phi</g> <td align="left"> changecom(,)&`#'934;changecom(`#') +<td width="10%"> m4tt svg_phi</g> <td align="left"> changecom(,)&`#'966;changecom(`#') +<td width="10%"> m4tt svg_chi</g> <td align="left"> changecom(,)&`#'967;changecom(`#') +<td width="10%"> m4tt svg_Psi</g> <td align="left"> changecom(,)&`#'936;changecom(`#') +<td width="10%"> m4tt svg_psi</g> <td align="left"> changecom(,)&`#'968;changecom(`#') +<td width="10%"> m4tt svg_Omega</g> <td align="left"> changecom(,)&`#'937;changecom(`#') +</tr> <tr> -<td width="8%"> m4tt svg_omega</g> <td align="left"> changecom(,)&`#'969;changecom(`#') -<td width="8%"> m4tt svg_micro</g> <td align="left"> changecom(,)&`#'956;changecom(`#') -<td width="8%"> m4tt svg_ohm</g> <td align="left"> changecom(,)&`#'937;changecom(`#') -<td width="8%"> m4tt svg_lt</g> <td align="left"> changecom(,)&`#'60;changecom(`#') -<td width="8%"> m4tt svg_gt</g> <td align="left"> changecom(,)&`#'62;changecom(`#') -<td width="8%"> m4tt svg_leq</g> <td align="left"> changecom(,)&`#'8804;changecom(`#') -<td width="8%"> m4tt svg_geq</g> <td align="left"> changecom(,)&`#'8805;changecom(`#') -<td width="8%"> m4tt svg_prime</g> <td align="left"> changecom(,)&`#'8242;changecom(`#') +<td width="10%"> m4tt svg_omega</g> <td align="left"> changecom(,)&`#'969;changecom(`#') +<td width="10%"> m4tt svg_micro</g> <td align="left"> changecom(,)&`#'956;changecom(`#') +<td width="10%"> m4tt svg_ohm</g> <td align="left"> changecom(,)&`#'937;changecom(`#') +<td width="10%"> m4tt svg_lt</g> <td align="left"> changecom(,)&`#'60;changecom(`#') +<td width="10%"> m4tt svg_gt</g> <td align="left"> changecom(,)&`#'62;changecom(`#') +<td width="10%"> m4tt svg_leq</g> <td align="left"> changecom(,)&`#'8804;changecom(`#') +<td width="10%"> m4tt svg_geq</g> <td align="left"> changecom(,)&`#'8805;changecom(`#') +<td width="10%"> m4tt svg_prime</g> <td align="left"> changecom(,)&`#'8242;changecom(`#') +</tr> <tr> -<td width="8%"> m4tt svg_backsl</g> <td align="left"> changecom(,)&`#'92;changecom(`#') -<td width="8%"> m4tt svg_pound</g> <td align="left"> changecom(,)&`#'35;changecom(`#') -<td width="8%"> m4tt svg_comma</g> <td align="left"> changecom(,)&`#'44;changecom(`#') -<td width="8%"> m4tt svg_lparen</g> <td align="left"> changecom(,)&`#'40;changecom(`#') -<td width="8%"> m4tt svg_rparen</g> <td align="left"> changecom(,)&`#'41;changecom(`#') -<td width="8%"> m4tt svg_emsp</g> <td align="left"> |changecom(,)&`#'8195;changecom(`#')| -<td width="8%"> m4tt svg_ensp</g> <td align="left"> |changecom(,)&`#'8194;changecom(`#')| -<td width="8%"> m4tt svg_thinsp</g> <td align="left"> |changecom(,)&`#'8201;changecom(`#')| +<td width="10%"> m4tt svg_backsl</g> <td align="left"> changecom(,)&`#'92;changecom(`#') +<td width="10%"> m4tt svg_pound</g> <td align="left"> changecom(,)&`#'35;changecom(`#') +<td width="10%"> m4tt svg_comma</g> <td align="left"> changecom(,)&`#'44;changecom(`#') +<td width="10%"> m4tt svg_lparen</g> <td align="left"> changecom(,)&`#'40;changecom(`#') +<td width="10%"> m4tt svg_rparen</g> <td align="left"> changecom(,)&`#'41;changecom(`#') +<td width="10%"> m4tt svg_circ</g> <td align="left"> changecom(,)&`#'710;changecom(`#') +<td width="10%"> m4tt svg_deg</g> <td align="left"> changecom(,)&`#'176;changecom(`#') +<td width="10%"> m4tt svg_grave</g> <td align="left"> changecom(,)&`#'96;changecom(`#') +</tr> +</table> +<table cellpadding="2" cellspacing="0" width="75%" > <tr> -<td width="8%"> m4tt svg_circ</g> <td align="left"> |changecom(,)&`#'710;changecom(`#')| -<td width="8%"> m4tt svg_deg</g> <td align="left"> |changecom(,)&`#'176;changecom(`#')| +<td width="8%"> m4tt svg_emsp</g> <td width="50px" align="left"> |changecom(,)&`#'8195;changecom(`#')| +<td width="8%"> m4tt svg_ensp</g> <td width="50px" align="left"> |changecom(,)&`#'8194;changecom(`#')| +<td width="8%"> m4tt svg_thinsp</g> <td width="50px" align="left"> |changecom(,)&`#'8201;changecom(`#')| +</tr> </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 + 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. + but many more could be added and they should be customized for + particular applications. Adjustments may also have to be made to + obtain the proper snap-to actions. <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. + <li> Some of the assumptions used to create this draft may be + na&`#'239;ve. + Comments are welcome. </ul> + <hr> cfig(XXXXX) +</td> +</tr> +</table> </BODY> </HTML> |