diff options
Diffstat (limited to 'graphics/circuit_macros')
126 files changed, 5744 insertions, 4179 deletions
diff --git a/graphics/circuit_macros/CHANGES b/graphics/circuit_macros/CHANGES index 3d78630bf7..e76300499c 100644 --- a/graphics/circuit_macros/CHANGES +++ b/graphics/circuit_macros/CHANGES @@ -1,5 +1,10 @@ CHANGES +Version 9.6: Tweaked svg examples; macros lg_bartxt, opamp, beginshade, + endshade, relaycoil, inductor, source, rotbox; files lib3D, libgen. New + macros DIP, g_fet, Fe_fet, shielded, setkeys_, Deltasymbol, Ysymbol, + PtoL, ToPos. New options for resistor, capacitor, inductor, + transformer, ArcAngle, variable. Version 9.5: Distribution cleaned and a non utf-8 character removed. Version 9.4: Changes to examples and additional SVG examples. New macros RightAngle, PerpTo, langle, ArcAngle, DCsymbol. Rewritten diff --git a/graphics/circuit_macros/Copying b/graphics/circuit_macros/Copying index 26840bdaef..04e7385ab8 100644 --- a/graphics/circuit_macros/Copying +++ b/graphics/circuit_macros/Copying @@ -1,4 +1,4 @@ -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * diff --git a/graphics/circuit_macros/README b/graphics/circuit_macros/README index 1da33f0aa0..b70b3232dc 100644 --- a/graphics/circuit_macros/README +++ b/graphics/circuit_macros/README @@ -1,5 +1,5 @@ -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * @@ -197,11 +197,11 @@ INTEGRATION WITH OTHER TOOLS: at https://pypi.org/project/pycirkuit/ and https://github.com/orestesmas/pycirkuit. For an introduction, look at the FOSDEM video by Orestes Mas: - https://ftp.osuosl.org/pub/fosdem/2020/H.2215/pycirkuit.webm + https://archive.fosdem.org/2020/schedule/event/pycirkuit/ A python build-automation tool, m4cm, by Peter Jan Randewijk is at - https://m4cmpy.wordpress.com/ - with very clear instructions about getting started with Circuit_macros at + https://m4cmpy.wordpress.com/ and very clear instructions about getting + started with Circuit_macros are at https://m4cmpy.wordpress.com/2020/02/23/getting-started-with-m4-circuit-macros/ Fabrice Salvaire has a blog and a useful bash script at @@ -231,13 +231,16 @@ INTEGRATION WITH OTHER TOOLS: LaTeX automation tools are discussed at, for example, http://tex.stackexchange.com/questions/64/tools-for-automating-document-compilation + A Windows batch file for Circuit_macros is found at + http://someonehasdonethis.blogspot.ca/2012/12/a-solution-for-drawing-circuit-diagrams.html + Mac users: + A nice description of a Mac installation is at + https://www.hamish.science/2020/06/24/circuitmacros + A previewer app for Mac OS X written by Collin J. Delker is available at http://www.collindelker.com/wp/2013/04/circuit_macros_previewer/ - A Windows batch file for Circuit_macros is found at - http://someonehasdonethis.blogspot.ca/2012/12/a-solution-for-drawing-circuit-diagrams.html - VARIATIONS Macros such as these inevitably will be modified to suit individual needs and taste. They continue to evolve in my own library as I use diff --git a/graphics/circuit_macros/darrow.m4 b/graphics/circuit_macros/darrow.m4 index c3183ccd2c..859cd7f4ff 100644 --- a/graphics/circuit_macros/darrow.m4 +++ b/graphics/circuit_macros/darrow.m4 @@ -1,7 +1,7 @@ divert(-1) darrow.m4 Macros for double lines and arrows -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * diff --git a/graphics/circuit_macros/doc/CapacitorsMan.m4 b/graphics/circuit_macros/doc/CapacitorsMan.m4 new file mode 100644 index 0000000000..7234cea453 --- /dev/null +++ b/graphics/circuit_macros/doc/CapacitorsMan.m4 @@ -0,0 +1,41 @@ +.PS +# `CapacitorsMan.m4' +cct_init +divert(-1) + +divert(0)dnl + +movewid = 2 pt__ +hm = 2.05 +vm = 0.28 +{ {capacitor ; move ;"`{\tt capacitor}'" ljust} + move right_ hm + {capacitor(,C); move ;"`{\tt capacitor(,C)}'" ljust} + move right_ hm + {capacitor(,C+); move ;"`{\tt capacitor(,C+)}'" ljust} +} + move down vm; right_ +{ {capacitor(,P); move ;"`{\tt capacitor(,P)}'" ljust} + move right_ hm + {capacitor(,E); move ;"`{\tt capacitor(,E)}'" ljust} + move right_ hm + {capacitor(,K); move ;"`{\tt capacitor(,K)}'" ljust} +} + move down 0.25; right_ +{ {capacitor(,M); move ;"`{\tt capacitor(,M)}'" ljust} + move right_ hm + {capacitor(,N); move ;"`{\tt capacitor(,N)}'" ljust} + move right_ hm + {xtal ; move ;"`{\tt xtal}'" ljust} +} + move down 0.25; right_ +{ {capacitor(,dC); move ;"`{\tt capacitor(,dC)}'" ljust} + move right_ hm + {capacitor(,dF); move ;"`{\tt capacitor(,dF)}'" ljust} + move right_ hm + {variable(`capacitor',NN,-30,dimen_/3) + move ;`"{\tt variable(}`{\tt capacitor',}"' ljust \ + `"{\enskip\tt NN,-30,dimen\_/3)}"' ljust + } +} +.PE diff --git a/graphics/circuit_macros/doc/Capture.JPG b/graphics/circuit_macros/doc/Capture.JPG Binary files differdeleted file mode 100644 index 8819dece9c..0000000000 --- a/graphics/circuit_macros/doc/Capture.JPG +++ /dev/null diff --git a/graphics/circuit_macros/doc/CctTable.tex b/graphics/circuit_macros/doc/CctTable.tex deleted file mode 100644 index ee442a4f3b..0000000000 --- a/graphics/circuit_macros/doc/CctTable.tex +++ /dev/null @@ -1,858 +0,0 @@ -\begin{tikzpicture}[scale=2.54] -% dpic version 2020.03.01 option -g for TikZ and PGF 1.01 -\ifx\dpiclw\undefined\newdimen\dpiclw\fi -\global\def\dpicdraw{\draw[line width=\dpiclw]} -\global\def\dpicstop{;} -\dpiclw=0.8bp -\dpiclw=0.8bp -\dpicdraw (0,0) - --(0.25,0) - --(0.270833,0.041667) - --(0.3125,-0.041667) - --(0.354167,0.041667) - --(0.395833,-0.041667) - --(0.4375,0.041667) - --(0.479167,-0.041667) - --(0.5,0) - --(0.75,0)\dpicstop -\draw (0.777674,0) node[right=-2bp]{{\tt resistor}}; -\dpicdraw (2.05,0) - --(2.3,0) - --(2.341667,0.083333) - --(2.383333,0) - --(2.425,0.083333) - --(2.466667,0) - --(2.508333,0.083333) - --(2.55,0) - --(2.55,0) - --(2.8,0)\dpicstop -\draw (2.827674,0) node[right=-2bp]{\tt resistor(,{,}Q) }; -\dpicdraw (4.1,0) - --(4.35,0)\dpicstop -\dpicdraw (4.6,0) - --(4.6,0.05) - --(4.35,0.05) - --(4.35,-0.05) - --(4.6,-0.05) - --(4.6,0)\dpicstop -\dpicdraw (4.6,0) - --(4.85,0)\dpicstop -\draw (4.877674,0) node[right=-2bp]{\shortstack[l]{\tt resistor(,{,}E)\\ {\tt $\equiv$ ebox}}}; -\dpicdraw (0,-0.28) - --(0.25,-0.28)\dpicstop -\dpicdraw (0.5,-0.28) - --(0.5,-0.23) - --(0.25,-0.23) - --(0.25,-0.33) - --(0.5,-0.33) - --(0.5,-0.28)\dpicstop -\dpicdraw (0.5,-0.28) - --(0.75,-0.28)\dpicstop -\dpicdraw (0.45,-0.23) - --(0.3,-0.33)\dpicstop -\draw (0.777674,-0.28) node[right=-2bp]{\tt resistor(,{,}ES) }; -\dpicdraw (2.05,-0.28) - --(2.3,-0.28) - --(2.3,-0.221667) - --(2.35,-0.221667) - --(2.35,-0.28) - --(2.4,-0.28) - --(2.4,-0.221667) - --(2.45,-0.221667) - --(2.45,-0.28) - --(2.5,-0.28) - --(2.5,-0.221667) - --(2.55,-0.221667) - --(2.55,-0.28) - --(2.55,-0.28) - --(2.8,-0.28)\dpicstop -\draw (2.827674,-0.28) node[right=-2bp]{\tt resistor(,{,}H) }; -\dpicdraw (4.1,-0.28) - --(4.35,-0.28)\dpicstop -\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{} -\global\def\dpicstop{--} -\dpicshdraw[fill=white!50!black] -\dpicdraw (4.6,-0.28) - --(4.6,-0.23) - --(4.35,-0.23) - --(4.35,-0.33) - --(4.6,-0.33) - --(4.6,-0.28)\dpicstop -cycle; \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;} -\dpicdraw (4.6,-0.28) - --(4.85,-0.28)\dpicstop -\draw (4.877674,-0.28) node[right=-2bp]{{\tt ebox(,{,},0.5)}}; -\dpicdraw (0,-0.56) - --(0.25,-0.56)\dpicstop -\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{} -\global\def\dpicstop{--} -\dpicshdraw[fill=white!0!black] -\dpicdraw (0.25,-0.56) - --(0.25,-0.6225) - --(0.375,-0.56) - --(0.25,-0.56)\dpicstop -cycle; \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;} -\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{} -\global\def\dpicstop{--} -\dpicshdraw[fill=white!0!black] -\dpicdraw (0.5,-0.56) - --(0.5,-0.4975) - --(0.375,-0.56) - --(0.5,-0.56)\dpicstop -cycle; \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;} -\dpicdraw (0.5,-0.56) - --(0.75,-0.56)\dpicstop -\draw (0.777674,-0.56) node[right=-2bp]{{\tt resistor(,{,}V)}}; -\dpicdraw (2.05,-0.61) - --(2.375,-0.61) - --(2.375,-0.41) - --(2.425,-0.36) - --(2.475,-0.41) - --(2.475,-0.61) - --(2.8,-0.61)\dpicstop -\dpicdraw[fill=black](2.425,-0.36) circle (0.007874in)\dpicstop -\draw (2.827674,-0.61) node[right=-2bp]{{\tt thermocouple}}; -\dpicdraw (4.1,-0.56) - --(4.225,-0.56)\dpicstop -\dpicdraw (4.725,-0.56) - --(4.725,-0.41) - --(4.225,-0.41) - --(4.225,-0.71) - --(4.725,-0.71) - --(4.725,-0.56)\dpicstop -\dpicdraw (4.725,-0.56) - --(4.85,-0.56)\dpicstop -\draw (4.877674,-0.56) node[right=-2bp]{{\tt ebox(,0.5,0.3)}}; -\dpicdraw (0,-0.84) - --(0.25,-0.84)\dpicstop -\dpicdraw (0.25,-0.84) - --(0.25,-0.845556)\dpicstop -\dpicdraw (0.25,-0.84) - ..controls (0.25,-0.822741) and (0.263991,-0.80875) - ..(0.28125,-0.80875) - ..controls (0.298509,-0.80875) and (0.3125,-0.822741) - ..(0.3125,-0.84)\dpicstop -\dpicdraw (0.3125,-0.84) - --(0.3125,-0.845556)\dpicstop -\dpicdraw (0.3125,-0.84) - ..controls (0.3125,-0.822741) and (0.326491,-0.80875) - ..(0.34375,-0.80875) - ..controls (0.361009,-0.80875) and (0.375,-0.822741) - ..(0.375,-0.84)\dpicstop -\dpicdraw (0.375,-0.84) - --(0.375,-0.845556)\dpicstop -\dpicdraw (0.375,-0.84) - ..controls (0.375,-0.822741) and (0.388991,-0.80875) - ..(0.40625,-0.80875) - ..controls (0.423509,-0.80875) and (0.4375,-0.822741) - ..(0.4375,-0.84)\dpicstop -\dpicdraw (0.4375,-0.84) - --(0.4375,-0.845556)\dpicstop -\dpicdraw (0.4375,-0.84) - ..controls (0.4375,-0.822741) and (0.451491,-0.80875) - ..(0.46875,-0.80875) - ..controls (0.486009,-0.80875) and (0.5,-0.822741) - ..(0.5,-0.84)\dpicstop -\dpicdraw (0.5,-0.84) - --(0.5,-0.845556)\dpicstop -\dpicdraw (0.5,-0.84) - --(0.75,-0.84)\dpicstop -\draw (0.777674,-0.84) node[right=-2bp]{{\tt inductor}}; -\dpicdraw (2.05,-0.84) - --(2.283266,-0.84)\dpicstop -\dpicdraw[line width=0.4bp](2.283266,-0.84) circle (0.00109in)\dpicstop -\dpicdraw (2.283266,-0.84) - ..controls (2.265746,-0.802428) and (2.298931,-0.761082) - ..(2.339404,-0.770054) - ..controls (2.379877,-0.779027) and (2.392478,-0.830524) - ..(2.360721,-0.857171)\dpicstop -\dpicdraw[line width=0.4bp](2.360721,-0.857171) circle (0.00109in)\dpicstop -\dpicdraw (2.360721,-0.857171) - ..controls (2.324962,-0.827166) and (2.34618,-0.768869) - ..(2.392861,-0.768869) - ..controls (2.439541,-0.768869) and (2.460759,-0.827166) - ..(2.425,-0.857171)\dpicstop -\dpicdraw[line width=0.4bp](2.425,-0.857171) circle (0.00109in)\dpicstop -\dpicdraw (2.425,-0.857171) - ..controls (2.389241,-0.827166) and (2.410459,-0.768869) - ..(2.457139,-0.768869) - ..controls (2.50382,-0.768869) and (2.525038,-0.827166) - ..(2.489279,-0.857171)\dpicstop -\dpicdraw[line width=0.4bp](2.489279,-0.857171) circle (0.00109in)\dpicstop -\dpicdraw (2.489279,-0.857171) - ..controls (2.457522,-0.830524) and (2.470123,-0.779027) - ..(2.510596,-0.770054) - ..controls (2.551069,-0.761082) and (2.584254,-0.802428) - ..(2.566734,-0.84)\dpicstop -\dpicdraw[line width=0.4bp](2.566734,-0.84) circle (0.00109in)\dpicstop -\dpicdraw (2.566734,-0.84) - --(2.8,-0.84)\dpicstop -\draw (2.827674,-0.84) node[right=-2bp]{{\tt inductor(,W)}}; -\dpicdraw (4.1,-0.84) - --(4.35,-0.84)\dpicstop -\dpicdraw[line width=0.4bp](4.35,-0.84) circle (0.00109in)\dpicstop -\dpicdraw (4.35,-0.84) - ..controls (4.35,-0.805625) and (4.364625,-0.7775) - ..(4.3825,-0.7775) - ..controls (4.400375,-0.7775) and (4.415,-0.797188) - ..(4.415,-0.82125) - ..controls (4.415,-0.845313) and (4.40825,-0.865) - ..(4.4,-0.865) - ..controls (4.39175,-0.865) and (4.385,-0.845313) - ..(4.385,-0.82125) - ..controls (4.385,-0.797188) and (4.403,-0.7775) - ..(4.425,-0.7775) - ..controls (4.447,-0.7775) and (4.465,-0.797188) - ..(4.465,-0.82125) - ..controls (4.465,-0.845313) and (4.45825,-0.865) - ..(4.45,-0.865) - ..controls (4.44175,-0.865) and (4.435,-0.845313) - ..(4.435,-0.82125) - ..controls (4.435,-0.797188) and (4.453,-0.7775) - ..(4.475,-0.7775) - ..controls (4.497,-0.7775) and (4.515,-0.797188) - ..(4.515,-0.82125) - ..controls (4.515,-0.845313) and (4.50825,-0.865) - ..(4.5,-0.865) - ..controls (4.49175,-0.865) and (4.485,-0.845313) - ..(4.485,-0.82125) - ..controls (4.485,-0.797188) and (4.503,-0.7775) - ..(4.525,-0.7775) - ..controls (4.547,-0.7775) and (4.565,-0.797188) - ..(4.565,-0.82125) - ..controls (4.565,-0.845313) and (4.55825,-0.865) - ..(4.55,-0.865) - ..controls (4.54175,-0.865) and (4.535,-0.845313) - ..(4.535,-0.82125) - ..controls (4.535,-0.797188) and (4.549625,-0.7775) - ..(4.5675,-0.7775) - ..controls (4.585375,-0.7775) and (4.6,-0.805625) - ..(4.6,-0.84)\dpicstop -\dpicdraw[line width=0.4bp](4.6,-0.84) circle (0.00109in)\dpicstop -\dpicdraw (4.6,-0.84) - --(4.85,-0.84)\dpicstop -\draw (4.877674,-0.84) node[right=-2bp]{{\tt inductor(,L)}}; -\dpicdraw (0,-1.12) - --(0.25,-1.12)\dpicstop -\dpicdraw (0.25,-1.12) - --(0.25,-1.125556)\dpicstop -\dpicdraw (0.25,-1.12) - ..controls (0.25,-1.102741) and (0.263991,-1.08875) - ..(0.28125,-1.08875) - ..controls (0.298509,-1.08875) and (0.3125,-1.102741) - ..(0.3125,-1.12)\dpicstop -\dpicdraw (0.3125,-1.12) - --(0.3125,-1.125556)\dpicstop -\dpicdraw (0.3125,-1.12) - ..controls (0.3125,-1.102741) and (0.326491,-1.08875) - ..(0.34375,-1.08875) - ..controls (0.361009,-1.08875) and (0.375,-1.102741) - ..(0.375,-1.12)\dpicstop -\dpicdraw (0.375,-1.12) - --(0.375,-1.125556)\dpicstop -\dpicdraw (0.375,-1.12) - ..controls (0.375,-1.102741) and (0.388991,-1.08875) - ..(0.40625,-1.08875) - ..controls (0.423509,-1.08875) and (0.4375,-1.102741) - ..(0.4375,-1.12)\dpicstop -\dpicdraw (0.4375,-1.12) - --(0.4375,-1.125556)\dpicstop -\dpicdraw (0.4375,-1.12) - ..controls (0.4375,-1.102741) and (0.451491,-1.08875) - ..(0.46875,-1.08875) - ..controls (0.486009,-1.08875) and (0.5,-1.102741) - ..(0.5,-1.12)\dpicstop -\dpicdraw (0.5,-1.12) - --(0.5,-1.125556)\dpicstop -\dpicdraw (0.5,-1.12) - --(0.75,-1.12)\dpicstop -\dpicdraw (0.25,-1.067917) - --(0.5,-1.067917)\dpicstop -\dpicdraw (0.25,-1.036667) - --(0.5,-1.036667)\dpicstop -\draw (0.777674,-1.12) node[right=-2bp]{{\tt inductor(,{,},M)}}; -\dpicdraw (2.05,-1.12) - --(2.218988,-1.12)\dpicstop -\dpicdraw[line width=0.4bp](2.218988,-1.12) circle (0.00109in)\dpicstop -\dpicdraw (2.218988,-1.12) - ..controls (2.201468,-1.082428) and (2.234652,-1.041082) - ..(2.275125,-1.050054) - ..controls (2.315598,-1.059027) and (2.3282,-1.110524) - ..(2.296442,-1.137171)\dpicstop -\dpicdraw[line width=0.4bp](2.296442,-1.137171) circle (0.00109in)\dpicstop -\dpicdraw (2.296442,-1.137171) - ..controls (2.260683,-1.107166) and (2.281901,-1.048869) - ..(2.328582,-1.048869) - ..controls (2.375262,-1.048869) and (2.396481,-1.107166) - ..(2.360721,-1.137171)\dpicstop -\dpicdraw[line width=0.4bp](2.360721,-1.137171) circle (0.00109in)\dpicstop -\dpicdraw (2.360721,-1.137171) - ..controls (2.324962,-1.107166) and (2.34618,-1.048869) - ..(2.392861,-1.048869) - ..controls (2.439541,-1.048869) and (2.460759,-1.107166) - ..(2.425,-1.137171)\dpicstop -\dpicdraw[line width=0.4bp](2.425,-1.137171) circle (0.00109in)\dpicstop -\dpicdraw (2.425,-1.137171) - ..controls (2.389241,-1.107166) and (2.410459,-1.048869) - ..(2.457139,-1.048869) - ..controls (2.50382,-1.048869) and (2.525038,-1.107166) - ..(2.489279,-1.137171)\dpicstop -\dpicdraw[line width=0.4bp](2.489279,-1.137171) circle (0.00109in)\dpicstop -\dpicdraw (2.489279,-1.137171) - ..controls (2.453519,-1.107166) and (2.474738,-1.048869) - ..(2.521418,-1.048869) - ..controls (2.568099,-1.048869) and (2.589317,-1.107166) - ..(2.553558,-1.137171)\dpicstop -\dpicdraw[line width=0.4bp](2.553558,-1.137171) circle (0.00109in)\dpicstop -\dpicdraw (2.553558,-1.137171) - ..controls (2.5218,-1.110524) and (2.534402,-1.059027) - ..(2.574875,-1.050054) - ..controls (2.615348,-1.041082) and (2.648532,-1.082428) - ..(2.631012,-1.12)\dpicstop -\dpicdraw[line width=0.4bp](2.631012,-1.12) circle (0.00109in)\dpicstop -\dpicdraw (2.631012,-1.12) - --(2.8,-1.12)\dpicstop -\dpicdraw[dash pattern=on 0.032415in off 0.032415in](2.214303,-1.028036) - --(2.635697,-1.028036)\dpicstop -\dpicdraw[dash pattern=on 0.032415in off 0.032415in](2.214303,-0.996786) - --(2.635697,-0.996786)\dpicstop -\draw (2.827674,-1.12) node[right=-2bp]{{\tt inductor(,W,6,P)}}; -\dpicdraw (4.3,-1.12) - --(4.51875,-1.12)\dpicstop -\dpicdraw (4.553969,-1.08875) - --(4.51875,-1.08875) - --(4.51875,-1.15125) - --(4.553969,-1.15125)\dpicstop -\dpicdraw (4.675,-1.12) circle (0.049213in)\dpicstop -\draw (4.675,-1.12) node{G}; -\dpicdraw (4.796031,-1.08875) - --(4.83125,-1.08875) - --(4.83125,-1.15125) - --(4.796031,-1.15125)\dpicstop -\dpicdraw (4.83125,-1.12) - --(5.05,-1.12)\dpicstop -\draw (5.077674,-1.12) node[right=-2bp]{{\tt ttmotor(,G)}}; -\dpicdraw (0,-1.4) - --(0.35,-1.4)\dpicstop -\dpicdraw (0.35,-1.483333) - --(0.35,-1.316667)\dpicstop -\dpicdraw (0.4,-1.483333) - --(0.4,-1.316667)\dpicstop -\dpicdraw (0.4,-1.4) - --(0.75,-1.4)\dpicstop -\draw (0.777674,-1.4) node[right=-2bp]{{\tt capacitor}}; -\dpicdraw (2.05,-1.4) - --(2.4,-1.4)\dpicstop -\dpicdraw (2.4,-1.4625) - --(2.4,-1.3375)\dpicstop -\dpicdraw (2.45,-1.4625) - ..controls (2.427671,-1.423825) and (2.427671,-1.376175) - ..(2.45,-1.3375)\dpicstop -\dpicdraw (2.433253,-1.4) - --(2.8,-1.4)\dpicstop -\draw (2.827674,-1.4) node[right=-2bp]{{\tt capacitor(,C)}}; -\dpicdraw (4.1,-1.4) - --(4.45,-1.4)\dpicstop -\dpicdraw (4.45,-1.4625) - --(4.45,-1.3375)\dpicstop -\dpicdraw (4.5,-1.4625) - ..controls (4.477671,-1.423825) and (4.477671,-1.376175) - ..(4.5,-1.3375)\dpicstop -\dpicdraw (4.483253,-1.4) - --(4.85,-1.4)\dpicstop -\dpicdraw[line width=0.5bp](4.429167,-1.441667) - --(4.3875,-1.441667)\dpicstop -\dpicdraw[line width=0.5bp](4.408333,-1.420833) - --(4.408333,-1.4625)\dpicstop -\draw (4.877674,-1.4) node[right=-2bp]{{\tt capacitor(,C+)}}; -\dpicdraw (0,-1.68) - --(0.35,-1.68)\dpicstop -\dpicdraw (0.4,-1.7425) - --(0.35,-1.7425) - --(0.35,-1.6175) - --(0.4,-1.6175)\dpicstop -\dpicdraw (0.383333,-1.726875) - --(0.383333,-1.633125)\dpicstop -\dpicdraw (0.383333,-1.68) - --(0.75,-1.68)\dpicstop -\draw (0.777674,-1.68) node[right=-2bp]{{\tt capacitor(,P)}}; -\dpicdraw (2.05,-1.68) - --(2.375,-1.68)\dpicstop -\dpiclw=0.4bp -\dpicdraw (2.40625,-1.68) - --(2.40625,-1.63) - --(2.375,-1.63) - --(2.375,-1.73) - --(2.40625,-1.73) - --(2.40625,-1.68)\dpicstop -\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{} -\global\def\dpicstop{--} -\dpicshdraw[fill=white!0!black] -\dpicdraw (2.44375,-1.68) - --(2.44375,-1.63) - --(2.475,-1.63) - --(2.475,-1.73) - --(2.44375,-1.73) - --(2.44375,-1.68)\dpicstop -cycle; \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;} -\dpiclw=0.8bp -\dpicdraw (2.475,-1.68) - --(2.8,-1.68)\dpicstop -\draw (2.827674,-1.68) node[right=-2bp]{{\tt capacitor(,E)}}; -\dpicdraw (4.1,-1.68) - --(4.425,-1.68)\dpicstop -\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{} -\global\def\dpicstop{--} -\dpicshdraw[fill=white!0!black] -\dpicdraw (4.45625,-1.68) - --(4.45625,-1.63) - --(4.425,-1.63) - --(4.425,-1.73) - --(4.45625,-1.73) - --(4.45625,-1.68)\dpicstop -cycle; \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;} -\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{} -\global\def\dpicstop{--} -\dpicshdraw[fill=white!0!black] -\dpicdraw (4.49375,-1.68) - --(4.49375,-1.63) - --(4.525,-1.63) - --(4.525,-1.73) - --(4.49375,-1.73) - --(4.49375,-1.68)\dpicstop -cycle; \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;} -\dpicdraw (4.525,-1.68) - --(4.85,-1.68)\dpicstop -\draw (4.877674,-1.68) node[right=-2bp]{{\tt capacitor(,K)}}; -\dpicdraw (0,-1.93) - --(0.325,-1.93)\dpicstop -\dpiclw=0.4bp -\dpicdraw (0.35625,-1.93) - --(0.35625,-1.88) - --(0.325,-1.88) - --(0.325,-1.98) - --(0.35625,-1.98) - --(0.35625,-1.93)\dpicstop -\dpicdraw (0.39375,-1.93) - --(0.39375,-1.88) - --(0.425,-1.88) - --(0.425,-1.98) - --(0.39375,-1.98) - --(0.39375,-1.93)\dpicstop -\dpiclw=0.8bp -\dpicdraw (0.425,-1.93) - --(0.75,-1.93)\dpicstop -\draw (0.777674,-1.93) node[right=-2bp]{{\tt capacitor(,M)}}; -\dpicdraw (2.05,-1.93) - --(2.391667,-1.93)\dpicstop -\dpicdraw (2.422917,-1.93) - --(2.422917,-1.88) - --(2.391667,-1.88) - --(2.391667,-1.98) - --(2.422917,-1.98) - --(2.422917,-1.93)\dpicstop -\dpicdraw (2.458333,-1.88) - --(2.458333,-1.98)\dpicstop -\dpicdraw (2.458333,-1.93) - --(2.8,-1.93)\dpicstop -\draw (2.827674,-1.93) node[right=-2bp]{{\tt capacitor(,N)}}; -\dpicdraw (4.1,-1.93) - --(4.433333,-1.93)\dpicstop -\dpicdraw (4.433333,-1.971667) - --(4.433333,-1.888333)\dpicstop -\dpicdraw (4.454167,-1.93) - --(4.454167,-1.8675) - --(4.495833,-1.8675) - --(4.495833,-1.9925) - --(4.454167,-1.9925) - --(4.454167,-1.93)\dpicstop -\dpicdraw (4.516667,-1.971667) - --(4.516667,-1.888333)\dpicstop -\dpicdraw (4.516667,-1.93) - --(4.85,-1.93)\dpicstop -\draw (4.877674,-1.93) node[right=-2bp]{{\tt xtal}}; -\dpicdraw (0,-2.18) - --(0.25,-2.18)\dpicstop -\dpicdraw (0.5,-2.18) - --(0.5,-2.13) - --(0.25,-2.13) - --(0.25,-2.23) - --(0.5,-2.23) - --(0.5,-2.18)\dpicstop -\dpicdraw (0.25,-2.18) - --(0.29,-2.18) - --(0.29,-2.155) - --(0.33,-2.155) - --(0.33,-2.205) - --(0.37,-2.205) - --(0.37,-2.155) - --(0.41,-2.155) - --(0.41,-2.18) - --(0.45,-2.18)\dpicstop -\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{} -\global\def\dpicstop{--} -\dpicshdraw[fill=white!0!black] -\dpicdraw (0.5125,-2.18) - --(0.5125,-2.13) - --(0.45,-2.13) - --(0.45,-2.23) - --(0.5125,-2.23) - --(0.5125,-2.18)\dpicstop -cycle; \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;} -\dpicdraw (0.5125,-2.18) - --(0.7625,-2.18)\dpicstop -\draw (0.777674,-2.18) node[right=-2bp]{{\tt memristor}}; -\dpicdraw (2.05,-2.18) - --(2.3,-2.18)\dpicstop -\dpicdraw (2.55,-2.18) - --(2.55,-2.13) - --(2.3,-2.13) - --(2.3,-2.23) - --(2.55,-2.23) - --(2.55,-2.18)\dpicstop -\dpicdraw (2.3625,-2.13) - --(2.3625,-2.23)\dpicstop -\dpicdraw (2.425,-2.13) - --(2.425,-2.23)\dpicstop -\dpicdraw (2.4875,-2.13) - --(2.4875,-2.23)\dpicstop -\dpicdraw (2.55,-2.18) - --(2.8,-2.18)\dpicstop -\draw (2.827674,-2.18) node[right=-2bp]{{\tt heater}}; -\dpicdraw (4.6625,-2.18) - --(4.85,-2.18)\dpicstop -\dpicdraw (4.1,-2.18) - --(4.308333,-2.18)\dpicstop -\dpicdraw[line width=0.4bp](4.308333,-2.18) circle (0.00109in)\dpicstop -\dpicdraw (4.308333,-2.221667) - --(4.641667,-2.221667)\dpicstop -\dpicdraw (4.641667,-2.221667) - ..controls (4.653173,-2.221667) and (4.6625,-2.203012) - ..(4.6625,-2.18) - ..controls (4.6625,-2.156988) and (4.653173,-2.138333) - ..(4.641667,-2.138333)\dpicstop -\dpicdraw (4.641667,-2.138333) - --(4.308333,-2.138333)\dpicstop -\dpicdraw (4.308333,-2.138333) - ..controls (4.296827,-2.138333) and (4.2875,-2.156988) - ..(4.2875,-2.18) - ..controls (4.2875,-2.203012) and (4.296827,-2.221667) - ..(4.308333,-2.221667) - ..controls (4.31984,-2.221667) and (4.329167,-2.203012) - ..(4.329167,-2.18) - ..controls (4.329167,-2.156988) and (4.31984,-2.138333) - ..(4.308333,-2.138333)\dpicstop -\draw (4.877674,-2.18) node[right=-2bp]{{\tt tline}}; -\dpicdraw[fill=black](0,-2.38) circle (0.007874in)\dpicstop -\dpicdraw[fill=black](0.75,-2.38) circle (0.007874in)\dpicstop -\draw (0.777674,-2.38) node[right=-2bp]{{\tt gap}}; -\dpicdraw[fill=black](2.05,-2.43) circle (0.007874in)\dpicstop -\dpicdraw[fill=black](2.8,-2.43) circle (0.007874in)\dpicstop -\filldraw[line width=0bp](2.64,-2.455) - --(2.74,-2.43) - --(2.64,-2.405) --cycle\dpicstop -\dpicdraw (2.11,-2.43) - --(2.717094,-2.43)\dpicstop -\draw (2.827674,-2.43) node[right=-2bp]{{\tt gap(,{,}A)}}; -\dpicdraw (4.1,-2.43) - --(4.85,-2.43)\dpicstop -\filldraw[line width=0bp](4.425,-2.455) - --(4.525,-2.43) - --(4.425,-2.405) --cycle\dpicstop -\dpicdraw (4.425,-2.43) - --(4.502094,-2.43)\dpicstop -\draw (4.877674,-2.43) node[right=-2bp]{{\tt arrowline}}; -\dpicdraw (0,-2.68) - --(0.325,-2.68) - --(0.325,-2.52375)\dpicstop -\dpicdraw (0.325,-2.52375) - ..controls (0.325,-2.489264) and (0.339567,-2.46125) - ..(0.3575,-2.46125) - ..controls (0.375433,-2.46125) and (0.39,-2.480859) - ..(0.39,-2.505) - ..controls (0.39,-2.529141) and (0.383277,-2.54875) - ..(0.375,-2.54875) - ..controls (0.366723,-2.54875) and (0.36,-2.529141) - ..(0.36,-2.505) - ..controls (0.36,-2.480859) and (0.374567,-2.46125) - ..(0.3925,-2.46125) - ..controls (0.410433,-2.46125) and (0.425,-2.489264) - ..(0.425,-2.52375)\dpicstop -\dpicdraw (0.425,-2.52375) - --(0.425,-2.68) - --(0.75,-2.68)\dpicstop -\dpicdraw (0.375,-2.52375) circle (0.03937in)\dpicstop -\draw (0.777674,-2.68) node[right=-2bp]{{\tt lamp}}; -\dpicdraw (2.05,-2.68) - --(2.225,-2.68)\dpicstop -\dpicdraw (2.625,-2.68) - ..controls (2.624554,-2.672786) and (2.623417,-2.664086) - ..(2.622464,-2.660589) - ..controls (2.621511,-2.657091) and (2.619497,-2.651585) - ..(2.617969,-2.648304) - ..controls (2.616442,-2.645022) and (2.613514,-2.639948) - ..(2.611437,-2.636982) - ..controls (2.609359,-2.634016) and (2.605593,-2.629528) - ..(2.603033,-2.626967) - ..controls (2.600472,-2.624407) and (2.595984,-2.620641) - ..(2.593018,-2.618563) - ..controls (2.590052,-2.616486) and (2.584978,-2.613558) - ..(2.581696,-2.612031) - ..controls (2.578415,-2.610503) and (2.572909,-2.608489) - ..(2.569411,-2.607536) - ..controls (2.565914,-2.606583) and (2.560143,-2.605628) - ..(2.556537,-2.605404) - ..controls (2.55293,-2.605181) and (2.493973,-2.605) - ..(2.425,-2.605) - ..controls (2.356027,-2.605) and (2.29707,-2.605181) - ..(2.293463,-2.605404) - ..controls (2.289857,-2.605628) and (2.284086,-2.606583) - ..(2.280589,-2.607536) - ..controls (2.277091,-2.608489) and (2.271585,-2.610503) - ..(2.268304,-2.612031) - ..controls (2.265022,-2.613558) and (2.259948,-2.616486) - ..(2.256982,-2.618563) - ..controls (2.254016,-2.620641) and (2.249528,-2.624407) - ..(2.246967,-2.626967) - ..controls (2.244407,-2.629528) and (2.240641,-2.634016) - ..(2.238563,-2.636982) - ..controls (2.236486,-2.639948) and (2.233558,-2.645022) - ..(2.232031,-2.648304) - ..controls (2.230503,-2.651585) and (2.228489,-2.657091) - ..(2.227536,-2.660589) - ..controls (2.226583,-2.664086) and (2.225628,-2.669857) - ..(2.225404,-2.673463) - ..controls (2.225181,-2.67707) and (2.225,-2.68) - ..(2.225,-2.68) - ..controls (2.225,-2.68) and (2.225181,-2.68293) - ..(2.225404,-2.686537) - ..controls (2.225628,-2.690143) and (2.226583,-2.695914) - ..(2.227536,-2.699411) - ..controls (2.228489,-2.702909) and (2.230503,-2.708415) - ..(2.232031,-2.711696) - ..controls (2.233558,-2.714978) and (2.236486,-2.720052) - ..(2.238563,-2.723018) - ..controls (2.240641,-2.725984) and (2.244407,-2.730472) - ..(2.246967,-2.733033) - ..controls (2.249528,-2.735593) and (2.254016,-2.739359) - ..(2.256982,-2.741437) - ..controls (2.259948,-2.743514) and (2.265022,-2.746442) - ..(2.268304,-2.747969) - ..controls (2.271585,-2.749497) and (2.277091,-2.751511) - ..(2.280589,-2.752464) - ..controls (2.284086,-2.753417) and (2.289857,-2.754372) - ..(2.293463,-2.754596) - ..controls (2.29707,-2.754819) and (2.356027,-2.755) - ..(2.425,-2.755) - ..controls (2.493973,-2.755) and (2.55293,-2.754819) - ..(2.556537,-2.754596) - ..controls (2.560143,-2.754372) and (2.565914,-2.753417) - ..(2.569411,-2.752464) - ..controls (2.572909,-2.751511) and (2.578415,-2.749497) - ..(2.581696,-2.747969) - ..controls (2.584978,-2.746442) and (2.590052,-2.743514) - ..(2.593018,-2.741437) - ..controls (2.595984,-2.739359) and (2.600472,-2.735593) - ..(2.603033,-2.733033) - ..controls (2.605593,-2.730472) and (2.609359,-2.725984) - ..(2.611437,-2.723018) - ..controls (2.613514,-2.720052) and (2.616442,-2.714978) - ..(2.617969,-2.711696) - ..controls (2.619497,-2.708415) and (2.621511,-2.702909) - ..(2.622464,-2.699411) - ..controls (2.623417,-2.695914) and (2.624372,-2.690143) - ..(2.624596,-2.686537) - ..controls (2.624819,-2.68293) and (2.625,-2.68) - ..(2.625,-2.68)\dpicstop -\dpicdraw (2.225,-2.68) - --(2.305,-2.68) - --(2.465,-2.63)\dpicstop -\dpicdraw (2.425,-2.68) - --(2.625,-2.68)\dpicstop -\dpicdraw (2.625,-2.68) - --(2.8,-2.68)\dpicstop -\draw (2.827674,-2.68) node[right=-2bp]{{\tt reed}}; -\dpicdraw (4.1,-2.68) - --(4.275,-2.68)\dpicstop -\fill[fill=white!90!black,line width=0bp](4.675,-2.68) - ..controls (4.674554,-2.672786) and (4.673417,-2.664086) - ..(4.672464,-2.660589) - ..controls (4.671511,-2.657091) and (4.669497,-2.651585) - ..(4.667969,-2.648304) - ..controls (4.666442,-2.645022) and (4.663514,-2.639948) - ..(4.661437,-2.636982) - ..controls (4.659359,-2.634016) and (4.655593,-2.629528) - ..(4.653033,-2.626967) - ..controls (4.650472,-2.624407) and (4.645984,-2.620641) - ..(4.643018,-2.618563) - ..controls (4.640052,-2.616486) and (4.634978,-2.613558) - ..(4.631696,-2.612031) - ..controls (4.628415,-2.610503) and (4.622909,-2.608489) - ..(4.619411,-2.607536) - ..controls (4.615914,-2.606583) and (4.610143,-2.605628) - ..(4.606537,-2.605404) - ..controls (4.60293,-2.605181) and (4.543973,-2.605) - ..(4.475,-2.605) - ..controls (4.406027,-2.605) and (4.34707,-2.605181) - ..(4.343463,-2.605404) - ..controls (4.339857,-2.605628) and (4.334086,-2.606583) - ..(4.330589,-2.607536) - ..controls (4.327091,-2.608489) and (4.321585,-2.610503) - ..(4.318304,-2.612031) - ..controls (4.315022,-2.613558) and (4.309948,-2.616486) - ..(4.306982,-2.618563) - ..controls (4.304016,-2.620641) and (4.299528,-2.624407) - ..(4.296967,-2.626967) - ..controls (4.294407,-2.629528) and (4.290641,-2.634016) - ..(4.288563,-2.636982) - ..controls (4.286486,-2.639948) and (4.283558,-2.645022) - ..(4.282031,-2.648304) - ..controls (4.280503,-2.651585) and (4.278489,-2.657091) - ..(4.277536,-2.660589) - ..controls (4.276583,-2.664086) and (4.275628,-2.669857) - ..(4.275404,-2.673463) - ..controls (4.275181,-2.67707) and (4.275,-2.68) - ..(4.275,-2.68) - ..controls (4.275,-2.68) and (4.275181,-2.68293) - ..(4.275404,-2.686537) - ..controls (4.275628,-2.690143) and (4.276583,-2.695914) - ..(4.277536,-2.699411) - ..controls (4.278489,-2.702909) and (4.280503,-2.708415) - ..(4.282031,-2.711696) - ..controls (4.283558,-2.714978) and (4.286486,-2.720052) - ..(4.288563,-2.723018) - ..controls (4.290641,-2.725984) and (4.294407,-2.730472) - ..(4.296967,-2.733033) - ..controls (4.299528,-2.735593) and (4.304016,-2.739359) - ..(4.306982,-2.741437) - ..controls (4.309948,-2.743514) and (4.315022,-2.746442) - ..(4.318304,-2.747969) - ..controls (4.321585,-2.749497) and (4.327091,-2.751511) - ..(4.330589,-2.752464) - ..controls (4.334086,-2.753417) and (4.339857,-2.754372) - ..(4.343463,-2.754596) - ..controls (4.34707,-2.754819) and (4.406027,-2.755) - ..(4.475,-2.755) - ..controls (4.543973,-2.755) and (4.60293,-2.754819) - ..(4.606537,-2.754596) - ..controls (4.610143,-2.754372) and (4.615914,-2.753417) - ..(4.619411,-2.752464) - ..controls (4.622909,-2.751511) and (4.628415,-2.749497) - ..(4.631696,-2.747969) - ..controls (4.634978,-2.746442) and (4.640052,-2.743514) - ..(4.643018,-2.741437) - ..controls (4.645984,-2.739359) and (4.650472,-2.735593) - ..(4.653033,-2.733033) - ..controls (4.655593,-2.730472) and (4.659359,-2.725984) - ..(4.661437,-2.723018) - ..controls (4.663514,-2.720052) and (4.666442,-2.714978) - ..(4.667969,-2.711696) - ..controls (4.669497,-2.708415) and (4.671511,-2.702909) - ..(4.672464,-2.699411) - ..controls (4.673417,-2.695914) and (4.674372,-2.690143) - ..(4.674596,-2.686537) - ..controls (4.674819,-2.68293) and (4.675,-2.68) - ..(4.675,-2.68) --cycle\dpicstop -\dpicdraw (4.675,-2.68) - ..controls (4.674554,-2.672786) and (4.673417,-2.664086) - ..(4.672464,-2.660589) - ..controls (4.671511,-2.657091) and (4.669497,-2.651585) - ..(4.667969,-2.648304) - ..controls (4.666442,-2.645022) and (4.663514,-2.639948) - ..(4.661437,-2.636982) - ..controls (4.659359,-2.634016) and (4.655593,-2.629528) - ..(4.653033,-2.626967) - ..controls (4.650472,-2.624407) and (4.645984,-2.620641) - ..(4.643018,-2.618563) - ..controls (4.640052,-2.616486) and (4.634978,-2.613558) - ..(4.631696,-2.612031) - ..controls (4.628415,-2.610503) and (4.622909,-2.608489) - ..(4.619411,-2.607536) - ..controls (4.615914,-2.606583) and (4.610143,-2.605628) - ..(4.606537,-2.605404) - ..controls (4.60293,-2.605181) and (4.543973,-2.605) - ..(4.475,-2.605) - ..controls (4.406027,-2.605) and (4.34707,-2.605181) - ..(4.343463,-2.605404) - ..controls (4.339857,-2.605628) and (4.334086,-2.606583) - ..(4.330589,-2.607536) - ..controls (4.327091,-2.608489) and (4.321585,-2.610503) - ..(4.318304,-2.612031) - ..controls (4.315022,-2.613558) and (4.309948,-2.616486) - ..(4.306982,-2.618563) - ..controls (4.304016,-2.620641) and (4.299528,-2.624407) - ..(4.296967,-2.626967) - ..controls (4.294407,-2.629528) and (4.290641,-2.634016) - ..(4.288563,-2.636982) - ..controls (4.286486,-2.639948) and (4.283558,-2.645022) - ..(4.282031,-2.648304) - ..controls (4.280503,-2.651585) and (4.278489,-2.657091) - ..(4.277536,-2.660589) - ..controls (4.276583,-2.664086) and (4.275628,-2.669857) - ..(4.275404,-2.673463) - ..controls (4.275181,-2.67707) and (4.275,-2.68) - ..(4.275,-2.68) - ..controls (4.275,-2.68) and (4.275181,-2.68293) - ..(4.275404,-2.686537) - ..controls (4.275628,-2.690143) and (4.276583,-2.695914) - ..(4.277536,-2.699411) - ..controls (4.278489,-2.702909) and (4.280503,-2.708415) - ..(4.282031,-2.711696) - ..controls (4.283558,-2.714978) and (4.286486,-2.720052) - ..(4.288563,-2.723018) - ..controls (4.290641,-2.725984) and (4.294407,-2.730472) - ..(4.296967,-2.733033) - ..controls (4.299528,-2.735593) and (4.304016,-2.739359) - ..(4.306982,-2.741437) - ..controls (4.309948,-2.743514) and (4.315022,-2.746442) - ..(4.318304,-2.747969) - ..controls (4.321585,-2.749497) and (4.327091,-2.751511) - ..(4.330589,-2.752464) - ..controls (4.334086,-2.753417) and (4.339857,-2.754372) - ..(4.343463,-2.754596) - ..controls (4.34707,-2.754819) and (4.406027,-2.755) - ..(4.475,-2.755) - ..controls (4.543973,-2.755) and (4.60293,-2.754819) - ..(4.606537,-2.754596) - ..controls (4.610143,-2.754372) and (4.615914,-2.753417) - ..(4.619411,-2.752464) - ..controls (4.622909,-2.751511) and (4.628415,-2.749497) - ..(4.631696,-2.747969) - ..controls (4.634978,-2.746442) and (4.640052,-2.743514) - ..(4.643018,-2.741437) - ..controls (4.645984,-2.739359) and (4.650472,-2.735593) - ..(4.653033,-2.733033) - ..controls (4.655593,-2.730472) and (4.659359,-2.725984) - ..(4.661437,-2.723018) - ..controls (4.663514,-2.720052) and (4.666442,-2.714978) - ..(4.667969,-2.711696) - ..controls (4.669497,-2.708415) and (4.671511,-2.702909) - ..(4.672464,-2.699411) - ..controls (4.673417,-2.695914) and (4.674372,-2.690143) - ..(4.674596,-2.686537) - ..controls (4.674819,-2.68293) and (4.675,-2.68) - ..(4.675,-2.68)\dpicstop -\dpicdraw (4.275,-2.68) - --(4.355,-2.68) - --(4.515,-2.691111)\dpicstop -\dpicdraw (4.475,-2.68) - --(4.675,-2.68)\dpicstop -\dpicdraw (4.675,-2.68) - --(4.85,-2.68)\dpicstop -\draw (4.877674,-2.68) node[right=-2bp]{{\tt reed(,{,},fill\_(0.9),CR)}}; -\dpicdraw (0,-2.93) - --(0.25,-2.93)\dpicstop -\dpicdraw (0.5,-2.93) - --(0.5,-2.88) - --(0.25,-2.88) - --(0.25,-2.98) - --(0.5,-2.98) - --(0.5,-2.93)\dpicstop -\dpicdraw (0.25,-2.98) - --(0.333333,-2.93) - --(0.25,-2.88)\dpicstop -\dpicdraw (0.5,-2.93) - --(0.75,-2.93)\dpicstop -\draw (0.777674,-2.93) node[right=-2bp]{{\tt pvcell}}; -\end{tikzpicture} -\vspace*{-0.5\baselineskip} diff --git a/graphics/circuit_macros/doc/CctTableMan.m4 b/graphics/circuit_macros/doc/CctTableMan.m4 deleted file mode 100644 index 221c62b737..0000000000 --- a/graphics/circuit_macros/doc/CctTableMan.m4 +++ /dev/null @@ -1,92 +0,0 @@ -.PS -# `CctTable.m4' -cct_init - -movewid = 2 pt__ -hm = 2.05 -vm = 0.28 -{ {resistor ; move ;"`{\tt resistor}'" ljust} - move right_ hm - {resistor(,,Q) ; move ;"`\tt resistor(,{,}Q) '" ljust} - move right_ hm - {resistor(,,E) ; move - "`\shortstack[l]{\tt resistor(,{,}E)\\ {\tt $\equiv$ ebox}}'" ljust} -} - move down vm; right_ -{ {resistor(,,ES) ; move ;"`\tt resistor(,{,}ES) '" ljust} - move right_ hm - {resistor(,,H) ; move ;"`\tt resistor(,{,}H) '" ljust} - move right_ hm - {ebox(,,,0.5) ; move ;"`{\tt ebox(,{,},0.5)}'" ljust} -} - move down vm; right_ -{ {resistor(,,V) ; move ;"`{\tt resistor(,{,}V)}'" ljust} - move right_ hm - {move down_ 0.05; right_ - thermocouple ; move;"`{\tt thermocouple}'" ljust; move up_ 0.05} - move right_ hm - {ebox(,0.5,0.3) ; move ;"`{\tt ebox(,0.5,0.3)}'" ljust} -} - move down vm; right_ -{ {inductor ; move ;"`{\tt inductor}'" ljust} - move right_ hm - {inductor(,W); move ;"`{\tt inductor(,W)}'" ljust} - move right_ hm - {inductor(,L); move ;"`{\tt inductor(,L)}'" ljust} -} - move down vm; right_ -{ {inductor(,,,M) ; move ;"`{\tt inductor(,{,},M)}'" ljust} - move right_ hm - {inductor(,W,6,P); move ;"`{\tt inductor(,W,6,P)}'" ljust} - move right_ hm - {move right_ 0.2; ttmotor(,G) ; move ;"`{\tt ttmotor(,G)}'" ljust} -} - move down vm; right_ -{ {capacitor ; move ;"`{\tt capacitor}'" ljust} - move right_ hm - {capacitor(,C); move ;"`{\tt capacitor(,C)}'" ljust} - move right_ hm - {capacitor(,C+); move ;"`{\tt capacitor(,C+)}'" ljust} -} - move down vm; right_ -{ {capacitor(,P); move ;"`{\tt capacitor(,P)}'" ljust} - move right_ hm - {capacitor(,E); move ;"`{\tt capacitor(,E)}'" ljust} - move right_ hm - {capacitor(,K); move ;"`{\tt capacitor(,K)}'" ljust} -} - move down 0.25; right_ -{ {capacitor(,M); move ;"`{\tt capacitor(,M)}'" ljust} - move right_ hm - {capacitor(,N); move ;"`{\tt capacitor(,N)}'" ljust} - move right_ hm - {xtal ; move ;"`{\tt xtal}'" ljust} -} - move down 0.25; right_ -{ {memristor ; move;"`{\tt memristor}'" ljust} - move right_ hm - {heater; move;"`{\tt heater}'" ljust} - move right_ hm - {tline ; move;"`{\tt tline}'" ljust} -} - move down 0.25; right_ -{ {move up_ 0.05; right_; gap ; move ;"`{\tt gap}'" ljust} - move right_ hm - {gap(,,A) ; move ;"`{\tt gap(,{,}A)}'" ljust} - move right_ hm - {arrowline ; move;"`{\tt arrowline}'" ljust} -} - move down 0.25; right_ -{ {lamp ; move;"`{\tt lamp}'" ljust} - move right_ hm - {reed ; move ;"`{\tt reed}'" ljust} - move right_ hm - {reed(,,,fill_(0.9),CR) ; move ; "`{\tt reed(,{,},fill\_(0.9),CR)}'" ljust} -} - move down 0.25; right_ -{ {pvcell ; move;"`{\tt pvcell}'" ljust} - move right_ hm - {arrester ; move ;"`{\tt arrester}'" ljust} -} - -.PE diff --git a/graphics/circuit_macros/doc/Circuit_macros.bib b/graphics/circuit_macros/doc/Circuit_macros.bib index 977060a26f..696f361fa4 100644 --- a/graphics/circuit_macros/doc/Circuit_macros.bib +++ b/graphics/circuit_macros/doc/Circuit_macros.bib @@ -42,6 +42,15 @@ address={Reading, Massachusetts}, publisher={Addison-Wesley}, year={1997}} +@misc{IECstd, +author={IEC}, +title={International Standard Database Snapshot 2007-01, +Graphical Symbols for Diagrams}, +note={IEC-60617.}, +institution={International Electrotechnical Commission}, +address={Geneva, Switzerland}, +year={2007}} + @misc{IEEEstd, author={IEEE}, title={Graphic Symbols for Electrical and Electronic Diagrams}, diff --git a/graphics/circuit_macros/doc/Circuit_macros.pdf b/graphics/circuit_macros/doc/Circuit_macros.pdf Binary files differindex a9c34834ce..a6b0c06f86 100644 --- a/graphics/circuit_macros/doc/Circuit_macros.pdf +++ b/graphics/circuit_macros/doc/Circuit_macros.pdf diff --git a/graphics/circuit_macros/doc/Circuit_macros.tex b/graphics/circuit_macros/doc/Circuit_macros.tex index fcd9e09fa6..10f8d34107 100644 --- a/graphics/circuit_macros/doc/Circuit_macros.tex +++ b/graphics/circuit_macros/doc/Circuit_macros.tex @@ -70,20 +70,25 @@ citecolor=purple} \begin{document} +%\pagenumbering{roman} \title{M4 Macros for Electric Circuit Diagrams in \LaTeX\ Documents} \author{Dwight Aplevich} \enlargethispage{\baselineskip} \date{% -%\input Version +%\input Version% +%\footnote{This document is best displayed with a reader that shows bookmarks.} \vspace*{-\baselineskip} } \maketitle -% \pdfbookmark[section]{\contentsname}{toc} - \pdfbookmark[section]{Contents}{toc} + \pdfbookmark[section]{\contentsname}{toc} +% \pdfbookmark[section]{Contents}{toc} \begin{multicols}{2} \tableofcontents \end{multicols} +%\pagebreak +%\pagenumbering{arabic} + \input body %\pdfbookmark[section]{\refname}{refs} diff --git a/graphics/circuit_macros/doc/InductorsMan.m4 b/graphics/circuit_macros/doc/InductorsMan.m4 new file mode 100644 index 0000000000..f250a81135 --- /dev/null +++ b/graphics/circuit_macros/doc/InductorsMan.m4 @@ -0,0 +1,47 @@ +.PS +# inductors.m4 +cct_init +iflatex(command "{\tt") + +movewid = 2 pt__ +hm = 2.05 +vm = 0.4 +{ {I: 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(,,3,M) ; move ;"`{...(,,3,M)}'" ljust} + move right_ hm + {inductor(,W,6,P1); variable; move + "`...(,W,6,P1);'" ljust "`variable'" ljust} + move right_ hm + {inductor(,L,9,K); move ;"`{...(,L,9,K)}'" ljust} +} + + move down vm; right_ +{ {inductor(,,,M3); addtaps(-,1/2,-dimen_/6); move; `"...(,{,},M3)"' ljust + {`"addtaps(-,1/2,-dimen\_/6)"' ljust at (I.start,last ""+(0,-0.2)) } + } + move right_ hm + {ebox(,,,0) ; move ;"`{ebox(,{,},0)}'" ljust} + move right_ hm -10bp__ + {TI: tapped(`ebox(,,,0)',-,1/4,-dimen_/6,3/4,-dimen_/6) ; move ; + "`tapped(\char96{}ebox(,{,},0)\char39,'" ljust at Here+(10bp__,-5bp__) \ + "-,1/4,-dimen\_/6," ljust "3/4,-dimen\_/6)" ljust + "\sl Tap1" at TI.Tap1 rjust below + "\sl Tap2" at TI.Tap2 ljust below } +} + + move down vm*5/4; right_ +{ {shielded(`inductor(,,,M)') ; move + `"shielded("' ljust `"\char96inductor(,{,},M)\char39)"' ljust + move to (3rd last line.start,Here) + shielded(`ebox(,,,0)',R) ; move; `"shielded(`ebox(,{,},0)',R)"' ljust } +} + +iflatex(command "}") +.PE diff --git a/graphics/circuit_macros/doc/Makefile b/graphics/circuit_macros/doc/Makefile index 1abd51504e..3cdac7062e 100644 --- a/graphics/circuit_macros/doc/Makefile +++ b/graphics/circuit_macros/doc/Makefile @@ -8,19 +8,21 @@ PICTEX = \ ACsymbol.tex \ AmpTableMan.tex AntennasMan.tex ArrestersMan.tex AudioMan.tex Axes.tex \ Buffer.tex BigResistor.tex BipMan.tex \ - CctTableMan.tex Composite.tex ConfigA.tex ConfigB.tex ConfigC.tex \ - ConnMan.tex Corners.tex ContactMan.tex ContactsMan.tex \ + CapacitorsMan.tex Composite.tex ConfigA.tex ConfigB.tex \ + ConfigC.tex ConnMan.tex Corners.tex ContactMan.tex ContactsMan.tex \ Dac.tex Darlington.tex DCsymbol.tex DemultiplexerMan.tex DiodesMan.tex \ EmarrowsMan.tex FF.tex FlipFlop.tex Flowdiag.tex FusesMan.tex \ - GroundsMan.tex HeadersMan.tex HybridPi.tex JackMan.tex LogicMan.tex \ + GroundsMan.tex HeadersMan.tex HybridPi.tex InductorsMan.tex \ + JackMan.tex LogicMan.tex \ Loop.tex MultiplexerMan.tex NPDTMan.tex NLGMan.tex NportMan.tex \ Oblique.tex OpampMan.tex Opto.tex ParSeries.tex PconnMan.tex \ - Potentiometers.tex RelayMan.tex relaycoilMan.tex Series.tex ShiftRMan.tex \ - Sinus.tex SourcesMan.tex SwitchesMan.tex Taps.tex TgateMan.tex \ - Thermal.tex Tline.tex VariableMan.tex XformMan.tex \ - WindingsMan.tex Workflow.tex bitr.tex bi_trans.tex bistableMan.tex \ + Potentiometers.tex RelayMan.tex relaycoilMan.tex ResistorsMan.tex \ + Series.tex ShiftRMan.tex Sinus.tex SourcesMan.tex SwitchesMan.tex \ + Taps.tex TgateMan.tex Thermal.tex Tline.tex \ + VariableMan.tex WindingsMan.tex Workflow.tex XformMan.tex \ + bitr.tex bi_trans.tex bistableMan.tex \ currents.tex eboxdims.tex fbfilter.tex fetMan.tex lrarrows.tex \ - mplex.tex oax.tex quick.tex \ + MoreTableMan.tex mplex.tex opampex.tex quick.tex \ sampleIC.tex stringdims.tex thyristorMan.tex ujtMan.tex \ woodchips.tex @@ -39,7 +41,7 @@ M4 = m4 # For gpic MODE = gpic -PIC = gpic -t +PIC = pic -t PRE = POST = ;printf '\\centerline{\\box\\graph}\n' PST = @@ -122,7 +124,7 @@ heading.tex: printf '\\usepackage{multicol}\n' >> heading.tex printf '\\usepackage{amssymb,boxdims}\n' >> heading.tex $(PST) -oax.tex tran.tex bitr.tex: oax.m4 +opampex.tex tran.tex bitr.tex: opampex.m4 $(M4) $(M4LIBS) $*.m4 > $*.pic $(PIC) $*.pic > $*.tex diff --git a/graphics/circuit_macros/doc/MoreTableMan.m4 b/graphics/circuit_macros/doc/MoreTableMan.m4 new file mode 100644 index 0000000000..bfc41113c1 --- /dev/null +++ b/graphics/circuit_macros/doc/MoreTableMan.m4 @@ -0,0 +1,36 @@ +.PS +# MoreTable.m4 +cct_init + +movewid = 2 pt__ +hm = 2.05 +vm = 0.28 +{ {memristor ; move;"`{\tt memristor}'" ljust} + move right_ hm + {heater; move;"`{\tt heater}'" ljust} + move right_ hm + {tline ; move;"`{\tt tline}'" ljust} +} + move down 0.25; right_ +{ {pvcell ; move;"`{\tt pvcell}'" ljust} + move right_ hm + {reed ; move ;"`{\tt reed}'" ljust} + move right_ hm + {reed(,,,fill_(0.9),CR) ; move ; "`{\tt reed(,{,},fill\_(0.9),CR)}'" ljust} +} + move down 0.25; right_ +{ {gap ; move ;"`{\tt gap}'" ljust} + move right_ hm + {gap(,,A) ; move ;"`{\tt gap(,{,}A)}'" ljust} + move right_ hm + {arrowline ; move;"`{\tt arrowline}'" ljust} +} + move down 0.25; right_ +{ move down 0.10; right; {lamp ; move;"`{\tt lamp}'" ljust} + move right_ hm + {thermocouple ; move;"`{\tt thermocouple}'" ljust } +# move up 0.10 right_ hm +# {arrester ; move ;"`{\tt arrester}'" ljust} +} + +.PE diff --git a/graphics/circuit_macros/doc/Oblique.m4 b/graphics/circuit_macros/doc/Oblique.m4 index c8dfd5fa7a..08ec60c6cb 100644 --- a/graphics/circuit_macros/doc/Oblique.m4 +++ b/graphics/circuit_macros/doc/Oblique.m4 @@ -10,13 +10,13 @@ T:dot(at Ct+(0,elen_)) inductor(from T to Ct); dlabel(0.12,-0.1,,,L_1) Point_(-30); inductor(from Cr to Cr+vec_(elen_,0)) - dlabel(0,-0.07,,L_3,) + dlabel(0,-0.1,,L_3,) R:dot L:dot( at Cl-(R.x-Cr.x,Cr.y-R.y) ) inductor(from L to Cl); dlabel(0,-0.12,,L_2,) right_; resistor(from L to R); rlabel(,R_2,) - resistor(from T to R); dlabel(0,0.15,,R_3,) ; b_current(y,ljust) + resistor(from T to R); dlabel(0,0.15,,R_3,) ; b_current(\;y,ljust) 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,) diff --git a/graphics/circuit_macros/doc/ResistorsMan.m4 b/graphics/circuit_macros/doc/ResistorsMan.m4 new file mode 100644 index 0000000000..2b1d1515e8 --- /dev/null +++ b/graphics/circuit_macros/doc/ResistorsMan.m4 @@ -0,0 +1,30 @@ +.PS +# ResistorsMan.m4 +cct_init + +movewid = 2 pt__ +hm = 2.05 +vm = 0.28 +{ {resistor ; move ;"`{\tt resistor}'" ljust} + move right_ hm + {resistor(,,Q) ; move ;"`\tt resistor(,{,}Q) '" ljust} + move right_ hm + {resistor(,,E) ; move + "`\shortstack[l]{\tt resistor(,{,}E)\\ {\tt $\equiv$ ebox}}'" ljust} +} + move down vm; right_ +{ {resistor(,,ES) ; move ;"`\tt resistor(,{,}ES) '" ljust} + move right_ hm + {resistor(,,H) ; move ;"`\tt resistor(,{,}H) '" ljust} + move right_ hm + {ebox(,,,0.9) ; move ;"`{\tt ebox(,{,},0.9)}'" ljust} +} + move down vm; right_ +{ {resistor(,,V) ; move ;"`{\tt resistor(,{,}V)}'" ljust} + move right_ hm + {ebox(,0.5,0.3) ; move ;"`{\tt ebox(,0.5,0.3)}'" ljust} + move right_ hm+4bp__ + {resistor(,,B) ; move movewid-4bp__ ;"`{\tt resistor(,{,}B)}'" ljust} +} + +.PE diff --git a/graphics/circuit_macros/doc/SourcesMan.m4 b/graphics/circuit_macros/doc/SourcesMan.m4 index 8a4bab9bc6..8e82b3f832 100644 --- a/graphics/circuit_macros/doc/SourcesMan.m4 +++ b/graphics/circuit_macros/doc/SourcesMan.m4 @@ -16,7 +16,7 @@ define(`NL',`; move down $1; right_') {source(,i) ; move ; "`source(,i)'" ljust} NL {source(,V) ; move ; "`source(,V)'" ljust} NL {source(,v) ; move ; "`source(,v)'" ljust} NL - {source(,SC) ; move ; "`source(,SC)'" ljust} NL + {source(,S) ; move ; "`source(,S)'" ljust} NL {source(,AC); move ; "`source(,AC)'" ljust} NL {source(,X) ; move ; "`source(,X)'" ljust} NL {source(,F) ; move ; "`source(,F)'" ljust} NL @@ -31,7 +31,7 @@ define(`NL',`; move down $1; right_') {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(,SC) ; move ; "`source(,SC)'" ljust} NL {source(,SCr) ; move ; "`source(,SCr)'" ljust} NL {source(,T) ; move ; "`source(,T)'" ljust} NL {source(,L) ; move ; "`source(,L)'" ljust} NL @@ -51,7 +51,8 @@ define(`NL',`; move down $1; right_') {consource(,V) ; move ; "`consource(,V)'" ljust} NL(0.32) {consource(,v) ; move ; "`consource(,v)'" ljust} NL(0.3) {battery ; move ; "`battery'" ljust} NL(0.3) - {battery(,3,R) ; move ; "`battery(,3,R)'" ljust} + {battery(,3,R) ; move ; "`battery(,3,R)'" ljust} NL(0.35) + {ttmotor(,G) ; move ; "`ttmotor(,G)'" ljust} iflatex(`ifpsfrag(,`latexcommand(})')') .PE diff --git a/graphics/circuit_macros/doc/SwitchesMan.m4 b/graphics/circuit_macros/doc/SwitchesMan.m4 index 46b3f9240d..e7d82badab 100644 --- a/graphics/circuit_macros/doc/SwitchesMan.m4 +++ b/graphics/circuit_macros/doc/SwitchesMan.m4 @@ -20,7 +20,7 @@ movewid = 0.25 lswitch(,,uDC); {"\tt (,{,}uDC)" at (last [],S)} } # Row 2 - move down; right_; { + move down 0.4; right_; { lswitch(,,K); {S:"\tt (,{,}K)" Below} move right_ lswitch(,,KD); {"\tt (,{,}KD)" at (last [],S)} @@ -60,7 +60,7 @@ movewid = 0.25 dswitch(,,WBCo); {"\tt (,{,}WBCo)" at (last [],S)} } # Row 4 - move down; right_; { + move down 0.4; right_; { dswitch(,,WBKCo); {S: "\tt (,{,}WBKCo)" Below} move right_ dswitch(,,WBCb); {"\tt (,{,}WBCb)" at (last [],S)} @@ -74,7 +74,8 @@ movewid = 0.25 dswitch(,,WBFSd); {"\tt (,{,}WBFSd)" at (last [],S)} } # Row 5 - move down moveht*5/4; right_; { +# move down moveht*5/4; right_; { + move down moveht; right_; { dswitch(,,WBTh); {S: "\tt (,{,}WBTh)" Below} move right_ dswitch(,,WBKC); {"\tt (,{,}WBKC)" at (last [],S)} @@ -102,20 +103,7 @@ movewid = 0.25 dswitch(,,WBRHH); {"\tt (,{,}WBRHH)" at (last [],S)} } # Row 7 - move down moveht; right_; { - move down_ 2bp__; right_ - dswitch(,,WBPr); {S: "\tt (,{,}WBPr)" Below} - move right_ - dswitch(,,WBPrT); {S: "\tt (,{,}WBPrT)" Below} -# move right_ -# Proxim; {S: "\tt Pro{}xim" Below} -# move right_ -# Magn; {S: "\tt Mag{}n" Below} - move down_ 6bp__ then right_ - dswitch(,,WBPrM); {S: "\tt (,{,}WBPrM)" Below} - } -# Row 8 - move down; right_; { + move down 0.4; right_; { dswitch(,,WBMMR); {S: "\tt (,{,}WBMMR)" Below} move right_ dswitch(,,WBMM); {"\tt (,{,}WBMM)" at (last [],S)} @@ -128,4 +116,17 @@ movewid = 0.25 move right_ dswitch(,,WBoKEL); {"\tt (,{,}WBoKEL)" at (last [],S)} } +# Row 8 + move down moveht; right_; { + move down_ 2bp__; right_ + dswitch(,,WBPr); {S: "\tt (,{,}WBPr)" Below} + move right_ + dswitch(,,WBPrT); {S: "\tt (,{,}WBPrT)" Below} +# move right_ +# Proxim; {S: "\tt Pro{}xim" Below} +# move right_ +# Magn; {S: "\tt Mag{}n" Below} + move down_ 6bp__ then right_ + dswitch(,,WBPrM); {S: "\tt (,{,}WBPrM)" Below} + } .PE diff --git a/graphics/circuit_macros/doc/VariableMan.m4 b/graphics/circuit_macros/doc/VariableMan.m4 index e52e30913d..dfe43d8028 100644 --- a/graphics/circuit_macros/doc/VariableMan.m4 +++ b/graphics/circuit_macros/doc/VariableMan.m4 @@ -1,19 +1,19 @@ .PS -# `Variable.m4' +# `VariableMan.m4' cct_init -define(`elen_',dimen_); down_ -[ { variable(`resistor',A) }; {"A" at last line.end below}; move right - { variable(`resistor',N) }; {"N" at last line.end below}; move right - { variable(`resistor',uN) }; {"uN" at last line.end below}; move right - { variable(`resistor',NN) }; {"uN" at last line.end below}; move right - { variable(`resistor',uNN) }; {"uNN" at last line.end below}; #; move right +define(`elen_',dimen_); up_ +[ { variable(`resistor(up_ dimen_)',A) }; + {"A" at last line.start below}; move right + { variable(`resistor',N) }; {"N" at last line.start below}; move right + { variable(`resistor',uN) }; {"uN" at last line.start below}; move right + { variable(`resistor',NN) }; {"NN" at last line.start below}; move right + { variable(`resistor',uNN) }; {"uNN" at last line.start below}; #; move right ] [ skp = 0.4 hskip = linewid*0.5 cskip = hskip -Orig: Here { move right cskip+elen_+hskip line invis right_ elen_ "\tt C"; move right_ hskip line invis right_ elen_ "\tt S" } @@ -25,4 +25,5 @@ Orig: Here variable(`capacitor(,C)',char`'S) }', A,P,L,N) ] with .w at last [].e+(0.4,0) + .PE diff --git a/graphics/circuit_macros/doc/Version.tex b/graphics/circuit_macros/doc/Version.tex index ccce7cfa86..fb5fc7b97e 100644 --- a/graphics/circuit_macros/doc/Version.tex +++ b/graphics/circuit_macros/doc/Version.tex @@ -1 +1 @@ -Version 9.5 +Version 9.6 diff --git a/graphics/circuit_macros/doc/body.tex b/graphics/circuit_macros/doc/body.tex index 0afb23e5be..0fd36ecb5c 100644 --- a/graphics/circuit_macros/doc/body.tex +++ b/graphics/circuit_macros/doc/body.tex @@ -48,15 +48,13 @@ % \xection{Introduction\label{Introduction:}} \begin{quotation}\noindent -% Before every conference, I find Ph.D.s in on weekends running back -% and forth from their offices to the printer. It appears that people who are unable to execute pretty pictures with pen and paper find it gratifying to try with a computer~\cite{Landauer95}. \end{quotation} -This manual\footnote{% -This document is best displayed with a reader that shows bookmarks.} +This manual% +\footnote{This document is best displayed with a reader that shows bookmarks.} describes a method for drawing electric circuits and other diagrams in \latex and web documents. The diagrams are defined in the simple \pic drawing language~\cite{KRpic} @@ -69,8 +67,8 @@ with ordinary text input. The book from which the above quotation is taken correctly points out that the payoff can be in quality of diagrams at the price of the time spent in learning how to draw them. -A collection of basic components, most based on IEEE -standards~\cite{IEEEstd}, +A collection of basic components, most based on IEC and IEEE +standards~\cite{IECstd,IEEEstd}, and conventions for their internal structure are described. Macros such as these are only a starting point, since it is often convenient to customize elements or to package @@ -204,8 +202,6 @@ produce {\sl file}{\tt.ps}, which can be printed or viewed using {\tt gsview}, for example. For \TPGF, Invoking PDFlatex on the source produces {\tt .pdf} output directly. -%Whether or not the figure environment is used, -%the essential line in all cases is \verb|\input quick|. The essential line is \verb|\input quick| whether or not the figure environment is used. @@ -301,9 +297,34 @@ the commands for producing the {\tt .tex} file can be reduced \verb%m4 quick.m4 | dpic -p > quick.tex% +\enlargethispage{\baselineskip} +\item +You can put several diagrams into a single source file. +Make each diagram the body of a \latex macro, as shown: + +\par +\verb|\newcommand{\diaA}{%|\NVL +\verb|.PS|\NVL +{\sl drawing commands}\NVL +\verb|.PE|\NVL +\verb|\box\graph }% \box\graph not required for dpic|\NVL +\verb|\newcommand{\diaB}{%|\NVL +\verb|.PS|\NVL +{\sl drawing commands}\NVL +\verb|.PE|\NVL +\verb|\box\graph }% \box\graph not required for dpic|\NVL +Produce a {\tt .tex} file as usual, +insert the {\tt .tex} into the \latex source, and +invoke the macros \verb^\diaA^ and \verb^\diaB^ at the appropriate places. + \item -It may be desirable to invoke \Mfour and \dpic automatically from the -document file as shown: +%Whether this and the next item rightly belong under the heading +%``Simplifications'' might be debated. They appear most useful +%when a project-management tool is employed. +In some circumstances, +it may be desirable to invoke \Mfour and \dpic automatically from the +document. Define a macro \verb|\mtotex| as shown in the +following example: {\tt \verb^\documentclass{article}^ \brtt \verb^\usepackage{tikz}^ \brtt @@ -322,7 +343,7 @@ The first argument of \verb|\mtotex| is a {\tt p} for pstricks or Sources \verb|FileA.m4| and \verb|FileB.m4| must contain any required \verb|include| statements, and the main document should be processed using -the latex or pdflatex option \verb|-shell-escape|. +the latex or pdflatex option \verb|--shell-escape|. If the {\tt M4PATH} environment variable is not set then insert {\tt -I }{\sl installdir} after {\tt m4} in the command definition, where {\sl installdir} is the absolute path to the installation directory. @@ -333,24 +354,24 @@ A derivative of this method that allows the insertion of \pic code into a \Tikz picture is described in \SR{Tikzwithpic:}. \item -You can put several diagrams into a single source file. -Make each diagram the body of a \latex macro, as shown: +It might be convenient for the source of small diagrams to be part +of the document source text. The {\tt filecontents} environment of current +\LaTeX\ allows this; older versions can employ a now-obsolete package +{\tt filecontents.sty}. The following example +for processing by {\tt pdflatex} \verb|--shell-escape| +first writes the \Mfour\ source +to file {\tt sample.m4}, invokes \verb|\mtotex| on it, and reads in the result: \par -\verb|\newcommand{\diaA}{%|\NVL -\verb|.PS|\NVL -{\sl drawing commands}\NVL -\verb|.PE|\NVL -\verb|\box\graph }% \box\graph not required for dpic|\NVL -\verb|\newcommand{\diaB}{%|\NVL +\verb|\begin{filecontents}[overwrite,noheader,nosearch]{sample.m4}|\NVL +\verb|include(pgf.m4)|\NVL \verb|.PS|\NVL -{\sl drawing commands}\NVL +\verb|cct_init|\NVL +{\sl drawing commands} $\ldots$\NVL \verb|.PE|\NVL -\verb|\box\graph }% \box\graph not required for dpic|\NVL -Produce a {\tt .tex} file using \verb|\mtotex| -or \Mfour and \dpic or \gpic, -insert the {\tt .tex} into the \latex source, and -invoke the macros \verb^\diaA^ and \verb^\diaB^ at the appropriate places. +\verb|\end{filecontents}|\NVL +\verb|\mtotex{g}{sample}|\NVL +\verb|\input{sample.tex}|\NVL \end{enumerate} \subsection{Including the libraries\label{Libraries:}} @@ -394,7 +415,7 @@ begin with the characters {\tt m4}. \xection{\Pic essentials\label{Pic:}} -\Pic source is a sequence of lines in a file. +\Pic source is a sequence of lines in a text file. The first line of a diagram begins with {\tt .PS} with optional following arguments, and the last line is normally {\tt .PE}. Lines outside of these pass through the \pic processor unchanged. @@ -406,7 +427,9 @@ The visible objects can be divided conveniently into two classes, the The object {\tt move} is linear but draws nothing. A compound object, or {\tt block,} is planar and consists of a pair of square brackets enclosing other objects, as described in \SR{Compoundobjects:}. -Objects can be placed using absolute coordinates or relative to other objects. + +Objects can be placed using absolute coordinates or, +as is often better, relative to other objects. \Pic allows the definition of real-valued variables, which are alphameric names beginning with lower-case letters, and computations using them. @@ -829,18 +852,21 @@ were added after the previously shown source: \end{itemize} \subsection{The two-terminal elements\label{Twoterminal:}} -The two-terminal elements are shown in \FRS{CctTable} -% to~\REF{Diodes} and \FRS{Fuses} -%to~\REF{Switches}. -to~\REF{Arresters}. +The two-terminal elements are shown in +\FRS{Resistors} +to~\REF{Switches} and part of~\FR{Arresters}. Several elements are included more than once to illustrate -some of their arguments, which are listed in \SR{defines}. -\enlargethispage{\baselineskip} +some of their arguments, which are listed in detail in \SR{defines}. +\FR{Resistors} shows some resistors with typical variants. \begin{figure}[h!] - \input CctTableMan -% \ifpdf\vspace*{-\baselineskip}\fi% - \caption{Basic two-terminal elements, showing some variations.} - \label{CctTable} + \input ResistorsMan + \caption{Resistors dawn by the macro + {\tt resistor({\sl linespec, n}|E, {\sl chars}, {\sl cycle wid})}. + The second argument is either an integer to specify number of cycles, + the letter {\tt E}, or blank. The third argument specifies the desired + variant. + The default {\tt ebox} element designates a resistor.} + \label{Resistors} \end{figure} The first macro argument specifies @@ -849,13 +875,7 @@ If the argument is blank, the element is drawn from the current position in the current drawing direction along a default length. The other arguments produce variants of the default elements. -\begin{figure}[ht] - \input AmpTableMan - \caption{Amplifier, delay, and integrator.} - \label{AmpTable} - \end{figure} -\pagebreak Thus, for example, \par {\tt resistor(up\_ 1.25,7)} @@ -866,60 +886,82 @@ vertices per side. The macro {\tt up\_} evaluates to {\tt up} but also resets the current directional parameters to point up. -\begin{figure}[ht] +\pagebreak +Capacitors are illustrated in \FR{Capacitors}. +See \SR{Composite:} for the {\tt variable} macro. +\begin{figure}[h!t] + \input CapacitorsMan + \caption{The {\tt capacitor({\sl linespec, chars,} [R],{\sl height, width})} + macro, and an example application of the {\tt variable} macro.} + \label{Capacitors} + \end{figure} + +Basic inductors are illustrated in \FR{Inductors}. +\begin{figure}[h!] + \input InductorsMan + \caption{Basic inductors created with the + {\tt inductor({\sl linespec,} W|L, {\sl cycles,} M|P|K, {\sl loop wid})} + macro, the {\tt ebox} macro for European-style inductors, and some + modifications (see also \SR{Composite:}). + When an embellished element is repeated several times, + writing a wrapper macro may be desirable.} + \label{Inductors} + \end{figure} + +Some more basic elements are in \FR{MoreTable}, and amplifiers in \FR{AmpTable}. +\begin{figure}[h!t] + \input MoreTableMan + \caption{More two-terminal elements.} + \label{MoreTable} + \end{figure} +\begin{figure}[h!t] + \input AmpTableMan + \caption{Amplifier, delay, and integrator.} + \label{AmpTable} + \end{figure} + +\FR{Sources} shows sources, many of which contain internal symbols, +and of which the {\tt AC} and {\tt S} options illustrate the need +to draw a single cycle of a sinusoid or approximate sinusoid. +\begin{figure}[h!t] \input SourcesMan -% \ifpdf\vspace*{-0.5\baselineskip}\fi% \caption{Sources and source-like elements.} \label{Sources} \end{figure} - -The {\tt AC} and {\tt S} options of the {\tt source} macro in \FR{Sources} -illustrate the need -to draw a single cycle of a sinusoid or approximate sinusoid. As a convenience, the macro {\tt ACsymbol(at {\sl position, length, height,} [A]U|D|L|R|{\sl degrees})} is included as an interface to the {\tt sinusoid} macro. For example to add the sumbol -(\input{ACsymbol.tex}) to an ebox: +``\input{ACsymbol.tex}'' to an ebox: \par {\tt ebox; $\lbrace$\ ACsymbol(at last [],{,},dimen\_/8) $\rbrace$} \noindent For direct current (\input{DCsymbol.tex}), there is also -{\tt DCsymbol(at {\sl position, length, height,} U|D|L|R|{\sl degrees})}. +{\tt DCsymbol(at {\sl position, length, height,} U|D|L|R|{\sl degrees})}, +and for power-system diagrams, macros +{\tt Deltasymbol(at {\sl position, keys,} U|D|L|R|{\sl degrees})}, +and +{\tt Ysymbol(at {\sl position, keys,} U|D|L|R|{\sl degrees})}, -\begin{figure}[ht] +\pagebreak +Diodes and fuses are shown in \FRS{Diodes} and \REF{Fuses}. +\begin{figure}[h!] \input DiodesMan \caption{The macro {\tt diode(\linespec,B|CR|D|L|LE[R]|P[R]|S|T|V|v|w|Z|{\sl chars},[R][E])}. Appending {\tt K} to the second argument draws an open arrowhead.} \label{Diodes} \end{figure} - -\begin{figure}[t!] +\begin{figure}[h!] \input FusesMan \caption{Variations of the macros {\tt fuse(\linespec, A|dA|B|C|D|E|S|HB|HC|SB, {\sl wid}, {\sl ht})} and {\tt cbreaker(\linespec,L|R,D|T|TS)}.} \label{Fuses} \end{figure} -\begin{figure}[t!] - \input SwitchesMan - \caption{The - {\tt switch(\linespec,L|R,{\sl chars},L|B|D)} - macro is a wrapper for the macros - {\tt lswitch(\linespec,[L|R],[O|C][D][K][A])}, - {\tt bswitch(\linespec,[L|R],[O|C])}, - and the many-optioned - {\tt dswitch(\linespec,R,W[ud]B[K] {\sl chars})} shown. - The switch is drawn in the current drawing direction. - A second-argument {\tt R} produces a mirror - image with respect to the drawing direction. - The separately defined macros {\tt Proxim} and {\tt Magn} - embellish switches in the second-last row.} - \label{Switches} - \end{figure} +\enlargethispage{\baselineskip}% Most of the two-terminal elements are oriented; that is, they have a defined direction or polarity. Several element macros include an argument that reverses polarity, but there is also a more general @@ -931,10 +973,7 @@ The first argument of the macro \par \noindent is the name of a two-terminal element in quotes, followed by the -element arguments. The element is drawn with reversed direction. - -\pagebreak -Thus, +element arguments. The element is drawn with reversed direction; thus, \par {\tt diode(right\_ 0.4); reversed(`diode',right\_ 0.4)} \par @@ -955,31 +994,17 @@ by 1.8, for example {\tt resized(1.8,`diode',right\_ 0.4);} {\tt resized(1.8,`reversed',`diode',right\_ 0.4)} -\pagebreak -\FR{Arresters} shows a collection of surge-protection devices, or arresters, -of which the {\tt E} and {\tt S} types may be either 2-terminal or as -3-terminal (composite) elements described in \SR{Composite:}. -\begin{figure}[ht] - \input ArrestersMan - \caption{Variations of the {\tt arrester({\sl linespec, chars,} - {\sl wid}[{\tt :}{\sl arrowhead ht}], {\sl ht}[{\tt :}{\sl arrowhead wid})} - macro. Putting {\tt D} in argument 2 for the {\tt S} or {\tt E} - configuration creates a 3-terminal composite element - with terminals {\sl A, B}, and {\sl G.}} - \label{Arresters} - \end{figure} - \FR{Emarrows} contains radiation-effect arrows for embellishing two-terminal and other macros. -The arrow stems are named {\sl A1}, {\sl A2}, -and each pair is drawn in a \verb|[]| block, with -the names {\sl Head} and {\sl Tail} defined to -aid placement near another device. The second argument specifies -\begin{figure}[ht] +\begin{figure}[h!] \input EmarrowsMan \caption{Radiation arrows: {\tt em\_arrows({\sl type, angle, length})}} \label{Emarrows} \end{figure} +The arrow stems are named {\sl A1}, {\sl A2}, +and each pair is drawn in a \verb|[]| block, with +the names {\sl Head} and {\sl Tail} defined to +aid placement near another device. The second argument specifies absolute angle in degrees (default 135 degrees). The arrows are drawn relative to the diode direction by the {\tt LE} option in \FR{Diodes}. For absolute arrow directions, one can @@ -989,10 +1014,43 @@ at 45 degrees, for example: {\tt define(`myLED',`diode(`\$1'); em\_arrows(N,45) with .Tail at last [].ne')} +\enlargethispage{\baselineskip} +Switches with numerous controls are in \FR{Switches}. +\begin{figure}[h!] + \input SwitchesMan + \caption{The + {\tt switch(\linespec,L|R,{\sl chars},L|B|D)} + macro is a wrapper for the macros + {\tt lswitch(\linespec,[L|R],[O|C][D][K][A])}, + {\tt bswitch(\linespec,[L|R],[O|C])}, + and the many-optioned + {\tt dswitch(\linespec,R,W[ud]B[K] {\sl chars})} shown. + The switch is drawn in the current drawing direction. + A second-argument {\tt R} produces a mirror + image with respect to the drawing direction. + The separately defined macros {\tt Proxim} and {\tt Magn} + embellish switches in the second-last row.} + \label{Switches} + \end{figure} + +\FR{Arresters} shows a collection of surge-protection devices, or arresters, +of which the {\tt E} and {\tt S} types may be either 2-terminal or as +3-terminal (composite) elements described in \SR{Composite:}. +\begin{figure}[h!] + \input ArrestersMan + \caption{Variations of the {\tt arrester({\sl linespec, chars,} + {\sl wid}[{\tt :}{\sl arrowhead ht}], + {\sl ht}[{\tt :}{\sl arrowhead wid}])} + macro. Putting {\tt D} in argument 2 for the {\tt S} or {\tt E} + configuration creates a 3-terminal composite element + with terminals {\sl A, B}, and {\sl G.}} + \label{Arresters} + \end{figure} + \FR{Variable} shows some two-terminal elements with arrows or lines overlaid to indicate variability using the macro \par -{\tt variable(`}{\sl element}{\tt',{\sl type},{\sl angle},{\sl length})}, +{\tt variable(`}{\sl element}{\tt',{\sl type},[+|-]{\sl angle},{\sl length})}, \noindent where {\sl type} is one of {\tt A, P, L, N, NN} with {\tt C} or {\tt S} @@ -1000,21 +1058,23 @@ optionally appended to indicate continuous or stepwise variation. Alternatively, this macro can be invoked similarly to the label macros in \SR{Labels:} by specifying an empty first argument; -thus, the following line draws the resistor in \FR{Variable}: +thus, the following line draws the third resistor in \FR{Variable}: \par - {\tt resistor(down\_ dimen\_); variable(,uN)} + {\tt resistor(up\_ dimen\_); variable(,uN)} \begin{figure}[ht] \vspace*{-\baselineskip} \input VariableMan \caption{Illustrating {\tt variable(`{\sl element}',% -[A|P|L|[u]N]|[u]NN]][C|S],{\sl angle},{\sl length})}. - For example,\break {\tt variable(`resistor(down\_ dimen\_)',A)} draws - the leftmost resistor shown above, and {\tt variable(`resistor(down\_ - dimen\_)',uN)} draws the third resistor. The default angle is - 45${}^{\circ}$, regardless of the direction of the element. The array - on the right shows the effect of the second argument.} +[A|P|L|[u]N]|[u]NN]][C|S],[+|-]{\sl angle},{\sl length})}. + For example, {\tt variable(`resistor(up\_ dimen\_)',A)} draws + the leftmost resistor shown above. + The default angle is 45${}^{\circ}$, regardless of the direction of + the element, but the angle preceded by a sign ($+$ or $-$) is taken + to be relative to the drawing direction of the element as for the + lower right capacitor in \FR{Capacitors}, for example. The array on + the right shows the effect of the second argument.} \label{Variable} \end{figure} @@ -1026,8 +1086,16 @@ just been drawn. Many variations of this are possible: \verb|arrow right arrowht from last line.start+(alpha,0) "$i_1$" above| +\enlargethispage{\baselineskip}% Macros have been defined to simplify labelling two-terminal elements, as shown in \FR{currents}. +\begin{figure}[ht] +% \ifpdf\vspace*{-0.5\baselineskip}\fi% + \input currents + \caption{Illustrating {\tt b\_current, larrow,} and {\tt rarrow}. + The drawing direction is to the right.} + \label{currents} + \end{figure} The macro {\tt b\_current({\sl label,} above\_|below\_, In|O[ut], Start|E[nd], @@ -1036,13 +1104,6 @@ The macro \noindent draws an arrow from the start of the last-drawn two-terminal element {\sl frac} of the way toward the body. -\begin{figure}[ht] -% \ifpdf\vspace*{-0.5\baselineskip}\fi% - \input currents - \caption{Illustrating {\tt b\_current, larrow,} and {\tt rarrow}. - The drawing direction is to the right.} - \label{currents} - \end{figure} If the fourth argument is {\tt End}, the arrow is drawn from the end toward the body. @@ -1068,7 +1129,16 @@ quote, in which case the argument is copied literally. The third argument specifies the separation from the element. \subsection{Labels\label{Labels:}} - Special macros for labeling two-terminal elements are included: + Arbitrary labels + can be positioned by any \pic\ placement method including the + representative basic examples shown: + + {\tt "}{\sl text}{\tt" at {\sl position}}\NVL + {\tt "}{\sl text}{\tt" at {\sl position} above}\NVL + {\tt "}{\sl text}{\tt" wid {\sl width} ht {\sl height} + with .sw at {\sl position}}\NVL + + In addition, special macros for labeling two-terminal elements are available: \par {\tt llabel(} {\sl arg1,arg2,arg3} {\tt ) @@ -1085,6 +1155,14 @@ current direction:} {\tt up, down, left, right.} The second places the arguments along the centre, and the third along the right side. A simple circuit example with labels is shown in \FR{Loop}. +\begin{figure}[h!t] + \vspace*{-\baselineskip} + \parbox{4in}{\small \verbatiminput{Loop.m4}}% + \hfill\raise-0.5in\hbox{\input Loop } + \vspace*{-\baselineskip} + \caption{A loop containing labeled elements, with its source code.} + \label{Loop} + \end{figure} The macro {\tt dlabel} performs these functions for an obliquely drawn element, placing the three macro arguments at {\tt vec\_(-long,lat),} {\tt vec\_(0,lat),} and {\tt vec\_(long,lat)} @@ -1097,25 +1175,11 @@ Labels beginning with {\tt sprintf} or a double quote are copied literally rather than assumed to be in math mode. - Arbitrary \latex including {\bsl\tt includegraphics,} for example, - can also be placed on a diagram using - - {\tt "}{\sl \latex text}{\tt" wid {\sl width} ht {\sl height} - at {\sl position}} - -\begin{figure}[ht] - \vspace*{-\baselineskip} - \parbox{4in}{\small \verbatiminput{Loop.m4}}% - \hfill\raise-0.5in\hbox{\input Loop } - \vspace*{-\baselineskip} - \caption{A loop containing labeled elements, with its source code.} - \label{Loop} - \end{figure} - \xection{Placing two-terminal elements\label{Placing:}} The length and position of a two-terminal element -are defined by a straight-line segment and, possibly, a direction, so -four numbers are required to place the element as in the following example: +are defined by a straight-line segment, so +four numbers or equivalent +are required to place the element as in the following example: \par {\tt resistor(from (1,1) to (2,1))}. @@ -1143,8 +1207,8 @@ To draw a resistor up $d$ units from the current position, for example: {\tt resistor(up\_ d)} \Pic stores the current drawing direction, -the latter unfortunately limited to {\tt up, down, left, right,} -which is assumed when necessary. +which is unfortunately limited to {\tt up, down, left, right,} +for reference when necessary. The circuit macros need to know the current direction, so whenever {\tt up, down, left, right} are used they should be written respectively as the macros {\tt up\_, down\_, left\_, right\_} as in @@ -1152,8 +1216,9 @@ the above example. To allow drawing circuit objects in other than the standard four directions, a transformation matrix -is applied at the macro level to generate the required \pic code. -Potentially, the matrix can be used for other transformations. +is applied at the macro level to generate the required +(but sometimes very elaborate) \pic code. +Potentially, the matrix elements can be used for other transformations. The macro {\tt setdir\_({\sl direction, default direction})} @@ -1178,7 +1243,7 @@ The macro {\tt eleminit\_} in the two-terminal elements invokes to establish element length and direction. As shown in \FR{Oblique}, -\begin{figure}[ht] +\begin{figure}[h!t] \vspace{-\baselineskip} \parbox{4.5in}{\small \verbatiminput{Oblique.m4}}% \hfill\raise-0.7in\llap{\hbox{\input Oblique }}% @@ -1208,6 +1273,7 @@ as in {\tt `{`,'}',} as necessary. Commas also may be avoided by writing {\tt 0.5 between L and T} instead of {\tt 0.5<L,T>.} +\pagebreak \subsection{Series and parallel circuits\label{Seriesandparallel:}} To draw elements in series, each element can be placed by specifying @@ -1321,6 +1387,7 @@ to determine length and direction (but not position) of the block. Nearly all elements drawn within blocks can be customized by adding an extra argument, which is executed as the last item within the block. +\pagebreak The macro {\tt potentiometer(\linespec,{\sl cycles},{\sl fractional pos},{\sl length}, @@ -1363,7 +1430,7 @@ drawn elements. A few composite symbols derived from two-terminal elements are shown in \FR{Composite}. -\begin{figure}[h!b] +\begin{figure}[ht] \vspace*{-0.5ex} % \vspace*{-\baselineskip} \input Composite @@ -1373,7 +1440,7 @@ are shown in \FR{Composite}. \label{Composite} \end{figure} -\enlargethispage{\baselineskip} +%\enlargethispage{\baselineskip} The ground symbol is shown in \FR{Grounds}. The first argument specifies position; for example, the two lines shown have identical effect: @@ -1442,14 +1509,14 @@ The {\tt opamp} labels can be rotated if necessary by using postprocessor commands (for example \PSTricks \verb|\rput|) as second and third arguments. -The code in \FR{oax} places an opamp with three connections. +The code in \FR{opampex} places an opamp with three connections. \begin{figure}[h!b] - \parbox{4in}{\small \verbatiminput{oaxbody.m4}}% - \quad\raise-0.2in\hbox{\input oax }% + \parbox{4in}{\small \verbatiminput{opampexbody.m4}}% + \quad\raise-0.2in\hbox{\input opampex }% % \vspace{-\baselineskip} \caption{A code fragment invoking the {\tt opamp(\linespec,-,+,{\sl size},[R][P])} macro.} - \label{oax} + \label{opampex} \end{figure} \FR{Xform} shows variants of the transformer macro, @@ -1587,8 +1654,8 @@ For drawing relays, the macro {\tt relaycoil({\sl chars, wid, ht,} {\tt U|D|L|R|}{\sl degrees})} shown in \FR{relaycoil} provides a choice of connection points and actuator types. - \pagebreak + \begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi% \input relaycoilMan @@ -1611,7 +1678,7 @@ terminals {\sl P$_i$, C$_i$, O$_i$.} The {\tt jack} and {\tt plug} macros and their defined points are illustrated in \FR{Jack}. The first argument of both macros establishes the drawing direction. -\begin{figure}[h!] +\begin{figure}[!ht] \input JackMan \vspace{-1ex} \caption{The {\tt jack(U|D|L|R|{\sl degrees}, {\sl chars})} @@ -1635,27 +1702,22 @@ A macro for drawing headers is in \FR{Headers}, and some experimental connectors are shown in \FR{Conn} and \FR{Pconn}. The {\tt tstrip} macro allows ``{\sl key}{\tt =}{\sl value}{\tt ;}'' arguments for width and height. -\begin{figure}[ht] -% \ifpdf\vspace*{-0.5\baselineskip}\fi% +\begin{figure}[h!b] \input HeadersMan -% \ifpdf{\vspace*{-0.5ex}}\fi% \caption{Macro {\tt Header(1|2, {\sl rows, wid, ht, type})}.} \label{Headers} \end{figure} -\begin{figure}[ht] +\begin{figure}[h!b] \input ConnMan -% \ifpdf{\vspace*{-0.5ex}}\fi% \caption{Macros {\tt tstrip(R|L|U|D|{\sl degrees}, {\sl chars})}, {\tt ccoax(at} {\sl location}, {\tt M|F, {\sl diameter})}, {\tt tconn(\linespec, >|>>|<|<<|O[F], {\sl wid})}, and {\tt tbox({\sl text, wid, ht}, <|>|<>,{\sl type})}. } \label{Conn} -% \ifpdf{\vspace*{-1ex}}\fi% \end{figure} + \begin{figure}[ht] -% \ifpdf{\vspace*{-1ex}}\fi% \input PconnMan -% \ifpdf{\vspace*{-0.5ex}}\fi% \caption{A small set of power connectors drawn by {\tt pconnex(R|L|U|D|}{\sl degrees, chars}{\tt)}. Each connector has an internal {\tt H}, {\tt N}, and where applicable, a {\tt G} shape.} @@ -1665,7 +1727,7 @@ for width and height. The double-throw switches shown in \FR{NPDT} are drawn in the current drawing direction like the two-terminal elements, but are composite elements that must be placed accordingly. -\begin{figure}[h!b] +\begin{figure}[h!t] \ifpdf{\vspace*{-1ex}}\fi% \input NPDTMan \caption{Multipole double-throw switches drawn by @@ -1678,7 +1740,7 @@ is shown in \FR{Windings}. For simplicity, the complete spline is first drawn and then blanked in appropriate places using the background (core) color (\verb!lightgray! for example, default \verb!white!). -\begin{figure}[h!b] +\begin{figure}[h!t] \vspace*{-\baselineskip}% % \ifpdf\vspace*{-2\baselineskip}\else \vspace{-\baselineskip}\fi \input WindingsMan @@ -1690,6 +1752,7 @@ is first drawn and then blanked in appropriate places using the background \label{Windings} \end{figure} +\pagebreak \subsection{Semiconductors\label{Semiconductors:}}% \FR{Bip} shows the variants of bipolar transistor macro {\tt bi\_tr(\linespec,L|R,P,E)} @@ -1697,9 +1760,7 @@ which contains predefined internal locations {\sl E}, {\sl B}, {\sl C}. The first argument defines the distance and direction from {\sl E} \begin{figure}[ht] -% \ifpdf\vspace*{-0.5\baselineskip}\fi% \input BipMan -% \ifpdf\vspace*{-0.5\baselineskip}\fi% \caption{Variants of bipolar transistor {\tt bi\_tr(\linespec,L|R,P,E)} (current direction upward).} \label{Bip} @@ -1711,7 +1772,7 @@ current drawing direction according to the second argument. Setting the third argument to {\tt P} creates a PNP device instead of NPN, and setting the fourth to {\tt E} draws an envelope around the device. \FR{Darlington} shows a composite macro with several optional internal elements. -\begin{figure}[ht] +\begin{figure}[h!t] \input Darlington \caption{Macro {\tt Darlington(L|R,[E][P][B1][E1|R1][E2|R2][D][Z])}, drawing direction {\tt up\_}.} @@ -1720,8 +1781,7 @@ fourth to {\tt E} draws an envelope around the device. The code fragment example in \FR{bitr} places a bipolar transistor, connects a ground to the emitter, and connects a resistor to the collector. -\begin{figure}[ht] -%\vspace*{-\baselineskip} +\begin{figure}[h!t] \quad\quad\parbox{4in}{\small \verbatiminput{bitrbody.m4}}% \quad\raise-0.4in\hbox{\input bitr }% \vspace{-\baselineskip} @@ -1734,8 +1794,7 @@ the macro {\tt bi\_trans(\linespec, L|R, {\sl chars}, E)}, which draws the components of the transistor according to the characters in its third argument. For example, multiple emitters and collectors can be specified as shown in \FR{bitrans}. -\begin{figure}[ht] -%\vspace*{-0.5\baselineskip} +\begin{figure}[h!t] \input bi_trans \caption{The {\tt bi\_trans(\linespec,L|R,{\sl chars},E)} macro. The sub-elements are specified by the third argument. The substring @@ -1744,21 +1803,21 @@ specified as shown in \FR{bitrans}. \label{bitrans} \end{figure} -\pagebreak A UJT macro with predefined internal locations {\sl B1,} {\sl B2,} -and {\sl E} is shown in \FR{ujt}, -and a thyristor macro with predefined internal locations - {\sl G} and {\sl T1,} {\sl T2,} or - {\sl A,} {\sl K} is in \FR{thyristor}. -Except for the {\sl G} terminal, a thyristor (the {\tt IEC} variant excluded) -\begin{figure}[ht] +and {\sl E} is shown in \FR{ujt}. +\begin{figure}[h!t] % \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi% \input ujtMan % \ifpdf\vspace*{-0.5\baselineskip}\fi% \caption{UJT devices, with current drawing direction {\tt up\_}. } \label{ujt} \end{figure} -\begin{figure}[h!t] + +A thyristor macro with predefined internal locations + {\sl G} and {\sl T1,} {\sl T2,} or + {\sl A,} {\sl K} is in \FR{thyristor}. +Except for the {\sl G} terminal, a thyristor (the {\tt IEC} variant excluded) +\begin{figure}[h!b] % \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi% \input thyristorMan \vspace*{-1ex} @@ -1770,7 +1829,7 @@ Except for the {\sl G} terminal, a thyristor (the {\tt IEC} variant excluded) to the second argument to draw open arrowheads.} \label{thyristor} \end{figure} -is much like an two-terminal element. The wrapper macro +is much like a two-terminal element. The wrapper macro {\tt scr({\sl linespec, chars, label})} and similar macros {\tt scs, sus,} and {\tt sbs} place thyristors using {\sl linespec} as for a two-terminal element, @@ -1782,18 +1841,17 @@ but require a third argument for the label for the compound block; thus, draws the element from position {\sl A} to position {\sl B} with label {\sl Q3}, and draws a line from {\sl G}. +\enlargethispage{\baselineskip} Some FETs with predefined internal locations {\sl S,} {\sl D,} and {\sl G} are also included, with similar arguments to those of {\tt bi\_tr,} as shown in \FR{fet}. \begin{figure}[ht] -% \ifpdf\vspace*{-\baselineskip}\fi% \input fetMan -% \ifpdf\vspace*{-\baselineskip}\fi% \caption{JFET, insulated-gate enhancement and depletion MOSFETs, - and simplified versions. + simplified versions, graphene, and ferroelectric fets. These macros are wrappers that invoke the {\tt mosfet} macro as shown in the middle and bottom rows. - The two lower-right examples show custom devices, the first + The bottom-row examples show custom devices, the first defined by omitting the substrate connection, and the second defined using a wrapper macro.} \label{fet} @@ -1823,7 +1881,7 @@ the {\tt thyristor(\linespec, {\sl chars})} macro illustrated in \FR{thyristor} is derived from the diode and bipolar transistor macros. Another example is the {\tt tgate} macro shown in \FR{Tgate}, which also shows a pass transistor. -\begin{figure}[ht] +\begin{figure}[h!t] % \ifpdf\vspace*{-\baselineskip}\fi% \input TgateMan \caption{The {\tt tgate({\sl linespec,} [B][R|L])} element, derived from @@ -1835,13 +1893,12 @@ also shows a pass transistor. \label{Tgate} \end{figure} -\pagebreak Some other non-two-terminal macros are {\tt dot}, which has an optional argument ``{\tt at} {\sl location}'', the line-thickness macros, the {\tt fill\_} macro, and {\tt crossover}, which is a useful if archaic method to show non-touching conductor crossovers, as in \FR{bistable}. -\begin{figure}[ht] +\begin{figure}[h!t] \input bistableMan % \vspace{-1ex} \caption{Bipolar transistor circuit, illustrating {\tt crossover} @@ -1873,6 +1930,8 @@ A macro is also provided for colored fills: \noindent% These macros depend heavily on the postprocessor and are intended only for \PSTricks, \TPGF, \MetaPost, \SVG, and the Postscript or PDF output of \dpic. +Basic \Pic\ objects are probably best colored and filled as discussed +in \SR{Planarobjects:}. \xection{Corners\label{Corners:}}% If two straight lines meet at an angle then, depending on the postprocessor, @@ -1898,6 +1957,7 @@ by half the line thickness (macro {\tt hlth}) as shown on the upper row of the figure, or a two-segment line can be overlaid at the corner to produce the same effect. +\pagebreak \xection{Looping\label{Looping:}} Sequential actions can be performed using either the \dpic command @@ -1941,6 +2001,7 @@ which have one input {\tt In1} unless they are given a first argument, which is treated as the line specification of a two-terminal element. \begin{figure}[h!] + \vspace*{-0.5\baselineskip} \input LogicMan \caption{Basic logic gates. The input and output locations of a three-input NOR gate are shown. Inputs are negated by @@ -1961,13 +2022,15 @@ regardless of gate orientation, as in \FR{FF}. \caption{$SR$ flip-flop.} \label{FF} \end{figure} -\begin{figure}[ht] +Beyond a default number (6) of inputs, the +gates are given wings as in \FR{exVIII}. +\begin{figure}[h!t] \input mplex + \vspace*{-0.5\baselineskip} \caption{Eight-input multiplexer, showing a gate with wings.} \label{exVIII} \end{figure} -Beyond a default number (6) of inputs, the -gates are given wings as in \FR{exVIII}. + Negated inputs or outputs are marked by circles drawn using the \verb|NOT_circle| macro. The name marks the point at the outer edge of the circle and the circle itself has the same name prefixed by~{\tt N\_}. @@ -2035,7 +2098,8 @@ If the first argument is non-blank however, then the buffer is drawn along an invisible line like a two-terminal element, which is convenient sometimes but requires internal locations of the block to be referenced using {\tt last []}, as shown in \FR{Buffer}. -\begin{figure}[ht] +\begin{figure}[h!t] + \vspace*{-\baselineskip} \input Buffer \caption{The {\tt BUFFER\_gate} and {\tt BUFFER\_gen} macros. The bottom two examples show how the gate can be drawn as a two-terminal @@ -2071,7 +2135,6 @@ a label, use {\tt lg\_bartxt(}{\sl label}{\tt)}. The {\sl pinopts} are {\tt [L|M|I|O][N][E]} as for the \verb|lg_pin| macro. Optional argument 7 is the pin length in drawing units. -\pagebreak \FR{Multiplexer} shows a multiplexer block with variations, and \FR{Demultiplexer} shows the very similar demultiplexer. @@ -2087,6 +2150,7 @@ the very similar demultiplexer. [L][B|H|X][N[$n$]|S[$n$]][[N]OE],{\sl wid},{\sl ht})} macro.} \label{Demultiplexer} \end{figure} +\pagebreak Customized gates can be defined simply. For example, the following code defines the custom flipflops in \FR{ShiftR}. @@ -2104,7 +2168,6 @@ This definition makes use of macros \verb|L_unit| and There are three pins on the right; the centre pin is null and the bottom is null if the first macro argument is 1. -\pagebreak For hybrid applications, the \verb|dac| and \verb|adc| macros are illustrated in \FR{Dac}. The figure shows the default and predefined internal locations, the number @@ -2175,7 +2238,8 @@ to change the size of a complete diagram while keeping the relative proportions of objects within it. You may wish to change the sizes or proportions of individual elements within a diagram. You must take into account that line widths are scaled separately from drawn objects, -and that the size of typeset text is independent of the \pic language. +and that the size of typeset text is independent of the \pic language +except when svg is being produced. The scaling of circuit elements will be described first, then the \pic scaling facilities. @@ -2287,7 +2351,7 @@ If you develop a library of custom macros in the installation directory then the statement {\tt include(}{\sl mylibrary}{\tt.m4)} can bring its definitions into play. -\enlargethispage{\baselineskip} +%\enlargethispage{\baselineskip} It may not be necessary to define your own macro if all that is needed is a small addition to an existing element that is defined in an enclosing \verb|[ ]| block. After the element arguments are expanded, @@ -2326,7 +2390,7 @@ two macros are defined to simplify the repeated drawing of a series resistor and series inductor, and the macro {\tt tsection} defines a subcircuit that is replicated several times to generate \FR{Tline}. {\small \verbatiminput{Tline.m4}} -\begin{figure}[h!] +\begin{figure}[h!t] % \ifpdf\vspace*{-\baselineskip}\fi% \input Tline \caption{A lumped model of a transmission line, illustrating the @@ -2336,10 +2400,17 @@ a subcircuit that is replicated several times to generate \FR{Tline}. \Example{3} %\par\noindent {\bf Example 3:} -Composite elements containing several basic elements may be -required. \FR{HybridPi} shows a circuit that can be drawn in -any reference direction prespecified by {\tt Point\_({\sl degrees})}, -containing labels that always appear in their natural horizontal orientation. +\FR{HybridPi} shows an element that is composed of several basic +elements and that can be drawn in any direction prespecified by +{\tt Point\_({\sl degrees})}. The labels always appear in their natural +horizontal orientation. +\begin{figure}[h!t] + \vspace*{-0.5ex} + \input HybridPi + \vspace*{-0.5ex} + \caption{A composite element containing several basic elements} + \label{HybridPi} + \end{figure} Two flags in the argument determine the circuit orientation with respect to the current drawing direction and whether a mirrored circuit is drawn. The key to writing such a macro is to observe that the \pic language @@ -2379,15 +2450,7 @@ define(`hybrid_PI_BJT', `"$\mathrm{r_o}$"' at Ro.c+vec_(hunit/4,0) `$2' ] ') \end{verbatim} -\begin{figure}[ht] - \vspace*{-0.5ex} - \input HybridPi - \vspace*{-0.5ex} - \caption{A composite element containing several basic elements} - \label{HybridPi} - \end{figure} -%\enlargethispage{\baselineskip} \Example{4} A number of elements have arguments meant explicitly for customization. \FR{Sinus} customizes the {\tt source} macro to show a cycle of a horizontal sinusoid with adjustable phase given by argument 2 in degrees, @@ -2534,6 +2597,73 @@ placed by specifying the position of one of its defined points; by default it will be placed as if it were a box. \fi +\subsection{Macro arguments\label{Marcroarguments:}} +Macro parameters are defined +by entering them into specific arguments, and if an argument is blank then +a default parameter is used. +For the resistor macro, for example: + +{\tt resistor( {\sl linespec, cycles, chars, cycle wid} );} + +\noindent +an integer (3, say) in the second argument specifies the number of cycles. +Arguments could be entered in a key--value style (for example, +{\tt resistor(up\_ elen\_,style=N;cycles=8}) instead of by positional +parameters, but it was decided early on +to keep macro usage as close as possible to \pic\ conventions. + +More recently, a mixed style has been adopted by which some +parameters are entered using keys. Two macros assist this process, +of which the first is + +{\tt setkey\_({\sl string, key, default value, }[N])} + +The first argument +is taken to be a sequence of semicolon (;)-separated terms of the form +{\tt key={\sl value};}. +Then for example in a macro, the line + +{\tt setkey\_( `\$2', wdth, dimen\_*2 )} + +\noindent +checks argument 2 for a term {\tt wdth=}{\sl value} and defines +the macro {\tt m4wdth} to evaluate to +{\tt (dimen\_*2)} if not found, +otherwise to {\tt ({\sl value}).} +The enclosing parentheses are omitted if the +third argument of {\tt setkey\_} is {\tt N,} as may be required if {\tt m4wdth} +is non-numeric. + +In addition, the macro + +{\tt setkeys\_({\sl string, keysequence})} + +\noindent +applies {\tt setkey\_()} multiple times to its {\sl keysequence} +(second) argument. +Each term of the second argument consists of the three +arguments of {\tt setkey\_} separated by the colons (:) rather than commas. + +For example, consider the elementary example of a custom box macro: + +\begin{verbatim} +define(`custombox', +`setkeys_(`$1',wdth:boxwid:; hgt:boxht:; label::N; text::N) + ifelse(m4label,,,m4label:) box wid m4wdth ht m4hgt "m4text" ') +\end{verbatim} + +Then {\tt custombox(wdth=2; label=B1; text=Hello)} +first causes the macros {\tt m4wdth, m4hgt, m4label,} and {\tt m4text} +to be created, with values {\tt (2), (boxht), B1,} and {\tt Hello} +respectively, and {\tt custombox} evaluates to + +{\tt B1:\ box wid (2) ht (boxht) "Hello"}. + +The key prefix {\tt m4} of the automatically created parameter macros can be +redefined if necessary, since it is given in the distribution by the line +{\tt define(`key\_prefix',`m4')}. + + \xection{Interaction with \latex\label{Interaction:}} The sizes of typeset labels and other \tex boxes are generally unknown prior to processing the diagram by \latex. @@ -2553,12 +2683,13 @@ B: box The \pic interpreter cannot know the size of the text to the left and right of the box, and the diagram is generated using -default text values. One solution to this problem is to measure the +default text size values. One solution to this problem is to measure the text sizes by hand and include them literally, thus:\hfill\break \hbox{}\quad% \verb|"Left text" wid 38.47pt__ ht 7pt__ at B.w rjust|\hfill\break but this is tedious. +%\enlargethispage{\baselineskip} Often, a better solution is to process the diagram twice. The diagram source is processed as usual by \Mfour and a \pic processor, and the main document source is \latex{}ed to input the diagram and format the @@ -2579,7 +2710,7 @@ This hackery is summarized below, with an example in \FR{stringdim}. The argument of {\tt s\_box} need not be text exclusively; it can be anything that produces a \TeX\ box, for example, \verb|\includegraphics|. \end{itemize} -\begin{figure}[ht] +\begin{figure}[h!t] \parbox{3.5in}{\small\tt.PS\\ gen\_init\\ sinclude(Circuit\_macros.dim)\\ @@ -2589,10 +2720,10 @@ This hackery is summarized below, with an example in \FR{stringdim}. \hbox{}\quad s\_box(Right text: \$x\^{}{\%g}\$,2) at B.e ljust\\ .PE}% \hfill\llap{\raise-0.25in\hbox{\input stringdims }}% - \caption{The macro {\tt s\_box} sets string dimensions automatically + \caption{Macro {\tt s\_box} sets string dimensions automatically when processed twice. If two or more arguments are given to {\tt s\_box}, they - are passed through {\tt sprintf}. The dots show the figure bounding box.} + are passed through {\tt sprintf}. The bounding box is shown.} \label{stringdim} \end{figure} @@ -2669,7 +2800,6 @@ for the second time: Here is a second small example. Suppose that the file {\tt tsbox.m4} contains the following: -\pagebreak \begin{verbatim} \documentclass{article} \usepackage{boxdims,ifpstricks(pstricks,tikz)} @@ -2690,7 +2820,7 @@ The file is processed twice as follows: The first command line produces a file {\tt tsbox.pdf} with incorrect bounding box. The second command reads the data in {\tt tsbox.dim} to size the label correctly. The equivalent pstricks commands (note -the {\tt ifpstricks} macro in the second source line) are +the {\tt ifpstricks} macro in the second line of the diagram source) are {\tt m4 pstricks.m4 tsbox.m4 | dpic -p > tsbox.tex; latex tsbox} \par @@ -2889,7 +3019,7 @@ formats, as shown in \FR{Workflow}. One of the easiest methods for producing web documents is to generate postscript as usual and to convert the result to pdf format with Adobe Distiller or equivalent. -\begin{figure}[h!b] +\begin{figure}[h!t] % \ifpdf\vspace*{-\baselineskip}\fi% \input Workflow % \ifpdf\vspace*{-\baselineskip}\fi% @@ -2944,61 +3074,63 @@ that includes the diagram using \verb|\includegraphics{|{\sl filename}\verb|.mps}| as usual. -The \dpic processor is capable of other output formats, as illustrated in -\FR{Workflow} and in example files included with the distribution. -The \latex drawing commands alone or with {\tt eepic} or {\tt pict2e} -extensions are suitable only for simple diagrams. +The \dpic processor can generate other output formats, +as illustrated in \FR{Workflow} and in example files included with the +distribution. The \latex drawing commands alone or with {\tt eepic} +or {\tt pict2e} extensions are suitable only for simple diagrams. \xection{Developer's notes\label{Developersnotes:}} Years ago in the course of writing a book, I took a few days off to -write a \pic-like interpreter (\dpic) to automate the tedious -coordinate calculations required by \latex picture objects. The -macros in this distribution and the interpreter are the result of that -effort, drawings I have had to produce since, and suggestions received from -others. The interpreter has been upgraded over time to generate -\mfpic, \MetaPost~\cite{metapost}, raw \Postscript, \Postscript with -{\tt psfrag} tags, raw PDF, \PSTricks, and -Ti{\it k}Z PGF output, the latter two my preference -because of their quality and flexibility, including facilities for colour -and rotations, together with simple font selection. +write a \pic-like interpreter (\dpic) to automate the tedious coordinate +calculations required by \latex picture objects. The macros in this +distribution and the interpreter are the result of that effort, drawings +I have had to produce since, and suggestions received from others. +The interpreter has been upgraded over time to generate \mfpic, +\MetaPost~\cite{metapost}, raw \Postscript, \Postscript with {\tt +psfrag} tags, raw PDF, \PSTricks, and Ti{\it k}Z PGF output, the latter +two my preference because of their quality and flexibility, including +facilities for colour and rotations, together with simple font selection. \Xfig{}-compatible output was introduced early on to allow the creation of -diagrams both by programming and by interactive graphics. -\SVG output was added relatively recently, and seems suitable for -producing web diagrams directly and for further editing by the -Inkscape interactive graphics editor. The latest addition -is raw PDF output, which has very basic text capability and is most -suitable for creating diagrams without labels, but on which sophisticated -text can be overlaid. \Dpic can write the coordinates of selected -locations to an external file to be used in overlaying text or other -items on the diagram. - -Instead of using \pic macros, I preferred the equally simple -but more powerful \Mfour macro processor, and therefore \Mfour is -required here, although \dpic now supports \pic-like macros. Free -versions of \Mfour are available for Unix, Windows, and other -operating systems. +diagrams both by programming and by interactive graphics. \SVG output +was added relatively recently, and seems suitable for producing web +diagrams directly and for further editing by the Inkscape interactive +graphics editor. The latest addition is raw PDF output, which has very +basic text capability and is most suitable for creating diagrams without +labels, but on which sophisticated text can be overlaid if necessary. +\Dpic can write the coordinates of selected locations to an external +file to be used in overlaying text or other items on the diagram. + +The main value of this distribution is not intended to be in the use +of a specific language but in the element data encoded in the macros, +which have been developed with reference to standards and refined over +more than two decades, and which now total thousands of lines. Some of +the macros have become less readable as more options and flexibility +have been added, and if starting over today, perhaps I would change +some details. Compromises have been made in order to retain reasonable +compatibility with the variety of postprocessors. No choice of tool +is without compromise, and producing good graphics seems to be time +consuming, no matter how it is done, especially for circuits or other +diagrams that contain random detail. + +Instead of using \pic macros, I preferred the equally simple but more +powerful \Mfour macro processor, and therefore \Mfour is required here, +although \dpic now supports \pic-like macros. +% One way of viewing macro +% preprocessing is to suggest that \Mfour is to the \pic language as the C +% preprocessor is to the C language. +Free versions of \Mfour are available +for Unix and its descendents, Windows, and other operating systems. If starting over today would I not just use one of the other drawing -packages available these days? It would depend on the context, but -\pic remains a good choice for line drawings because it is easy to learn +packages available these days? It would depend on the context, but \pic +remains a good choice for line drawings because it is easy to learn and read but powerful enough for coding the geometrical calculations required for precise component sizing and placement. It would be nice if arbitrary rotations and scaling were simpler and if a general path -element with clipping were available as in \Postscript. However, all the -power of \Postscript or \TPGF, for example, remains available, +element with clipping were available as in \Postscript. However, +all the power of \Postscript or \TPGF, for example, remains available, as arbitrary postprocessor code can be included with \pic code. -The main value of this distribution is not in the use of a specific -language but in the element data encoded in the macros, which have been -developed with reference to standards and refined over two decades. -Some of them have become less readable as more options and flexibility -have been added, and if starting over today, perhaps I would change -some details. Compromises have been made in order to retain reasonable -compatibility with the variety of postprocessors. No choice of tool -is without compromise, and producing good graphics seems to be time -consuming, no matter how it is done, especially for circuits -or other diagrams that contain random detail. - The \dpic interpreter has several output-format options that may be useful. The {\tt eepicemu} and {\tt pict2e} extensions of the primitive \latex picture objects are supported. The \mfpic output @@ -3021,7 +3153,6 @@ With raw \Postscript, \PDF, and \SVG output, the user is responsible for ensuring that the correct fonts are provided and for formatting the text. -\pagebreak Many thanks to the people who continue to send comments, questions, and, occasionally, bug fixes. What began as a tool for my own use changed into a hobby that has persisted, thanks to your help and advice. @@ -3030,10 +3161,6 @@ into a hobby that has persisted, thanks to your help and advice. This section provides hints and a list of common errors. The distributed macros are not written for maximum robustness. -Arguments could be entered in a key--value style (for example, {\tt -resistor(up\_ elen\_,style=N;cycles=8}) instead of by positional -parameters, but it was decided early on -to keep macro usage as close as possible to \pic\ conventions. Macro arguments could be tested for correctness and explanatory error messages could be written as necessary, but that would make the macros more difficult to read and to write. You will @@ -3041,7 +3168,7 @@ have to read them when unexpected results are obtained or when you wish to modify them. Maintaining reasonable compatibility with both \gpic\ and \dpic -and, especially, for different postprocessors, has +and, especially, with different postprocessors, has resulted in some macros becoming more complicated than is preferable. Here are some hints, gleaned from experience and from comments I have @@ -3087,7 +3214,7 @@ received. \item \bflistitem{Initialization}{initialization} If the first element macro evaluated is not two-terminal or is within a -\Pic block, then later macros evaluated outside the block may produce +\Pic\ block, then later macros evaluated outside the block may produce the error message {\tt there is no variable `rp\_ang'} @@ -3157,8 +3284,8 @@ If information is omitted, default values are used. Writing {\tt source(up\_)} -\noindent draws a source up a distance equal to the current -{\tt lineht} value, which may cause confusion. +\noindent draws a source from the current position up a distance equal +to the current {\tt lineht} value, which may cause confusion. Writing {\tt source(0.5)} diff --git a/graphics/circuit_macros/doc/currents.m4 b/graphics/circuit_macros/doc/currents.m4 index 5b2e20fa54..74b5702654 100644 --- a/graphics/circuit_macros/doc/currents.m4 +++ b/graphics/circuit_macros/doc/currents.m4 @@ -17,7 +17,7 @@ cct_init {"\tt $\ldots$(i,below\_,O)" at last line + (0,-0.20)} } - move down_ 0.60 + move down_ 0.50 {right_ resistor; b_current(i,,,E) {"\tt b\_current(i,{,},E)" wid 1.2 at last line + (0,-0.20)} @@ -32,7 +32,7 @@ cct_init {"\tt $\ldots$(i,below\_,O,E)" at last line + (0,-0.20)} } - move down_ 0.60 + move down_ 0.55 {right_ del = 0.55 inductor; larrow(i) diff --git a/graphics/circuit_macros/doc/defines.tex b/graphics/circuit_macros/doc/defines.tex index fdc1f85c35..da19a5fcf0 100644 --- a/graphics/circuit_macros/doc/defines.tex +++ b/graphics/circuit_macros/doc/defines.tex @@ -38,7 +38,7 @@ \noindent \LR{A} \LR{B} \LR{C} \LR{D} \LR{E} \LR{F} \LR{G} \LR{H} \LR{I} \LR{J} \LR{K} \LR{L} \LR{M} \LR{N} \LR{O} \LR{P} -\LR{R} \LR{S} \LR{T} \LR{U} \LR{V} \LR{W} \LR{X} +\LR{R} \LR{S} \LR{T} \LR{U} \LR{V} \LR{W} \LR{X} \LR{Y} \\ \Letter{A}% @@ -122,11 +122,11 @@ {gen} {arc with acute angle (obtuse if radius is negative), drawn in a [ ] block} \macrodef{ArcAngle}{ArcAngle}{({\sl position, position, position, radius, - modifiers}) } + modifiers, label}) } {gen} {Arc angle symbol drawn ccw at arg2. Arg4 is the radius from arg2; - arg5 contains line attributes, e.g., {\tt thick linethick/2}} - + arg5 contains line attributes, e.g., {\tt thick linethick/2 ->}; + arg6 is an optional label at mid-arc} \macrodef{arcd}{arcd}{({\sl center}, {\sl radius},{\sl start degrees},{\sl end degrees}) } {gen} @@ -191,6 +191,9 @@ {Draw the tree for a gate as in the {\tt Autologix} macro. No inputs or external connections are drawn. The names of the internal gate inputs are stacked in {\tt `AutoInNames'}} +\macrodef{assign3}{assign3}{({\sl var name,var name,var name,arg4,arg5,arg6})} + {gen} + {Assigns \$1 = arg4 if \$1 is nonblank; similarly \$2 = arg5 and \$3 = arg6} \macrodef{Autologix}{Autologix}% {({\sl Boolean function sequence},% [N[oconnect]][L[eftinputs]][R][V][M][;offset={\sl value}]} @@ -321,22 +324,27 @@ {buzzer, {\sl In1} to {\sl In3} defined, C=curved \seesect{Composite:}} \Letter{C}% -\macrodef{c\_fet}{c_fet}{(\linespec,L|R,P)} +\macrodef{c\_fet}{c_fet}{(\linespec,R,P)} {cct} {left or right, plain or negated pin simplified MOSFET} -\macrodef{capacitor}{capacitor}{(\linespec,{\sl char}[+[L]],R, +\macrodef{capacitor}{capacitor}{(\linespec,{\sl chars},R, {\sl height}, {\sl wid})} {cct} - {capacitor, {\sl char}: F or none=flat plate, C=curved-plate, - E=polarized boxed plates, - K=filled boxed plates, - M=unfilled boxes, - M=one rectangular plate, - P=alternate polarized; + adds a polarity sign; + {capacitor, {\sl chars}: + F or blank=flat plate; + dF flat plate with hatched fill; + C=curved-plate; + dC=curved-plate with variability arrowhead; + E=polarized boxed plates; + K=filled boxed plates; + M=unfilled boxes; + M=one rectangular plate; + P=alternate polarized; + + adds a polarity sign; +L polarity sign to the left of drawing direction; - arg3: R=reversed polarity, + arg3: R=reversed polarity; arg4 = height (defaults F: {\tt dimen\_}$/3$, - C,P: {\tt dimen\_}$/4$, E,K: {\tt dimen\_}$/5$) + C,P: {\tt dimen\_}$/4$, E,K: {\tt dimen\_}$/5$); arg5 = wid (defaults F: {\sl height}*0.3, C,P: {\sl height}*0.4, E,K: {\sl height}) \seesect{Twoterminal:}} \macrodef{cbreaker}{cbreaker}{(\linespec,L|R,D|Th|TS)} @@ -358,9 +366,17 @@ {gen} {Upper (lower if arg5={\tt R}) intersection of circles at {\sl Pos1} and {\sl Pos2}, radius {\sl rad1} and {\sl rad2}} -\macrodef{clabel}{clabel}{({\sl label},{\sl label},{\sl label})} - {cct} - {centre triple label \seesect{Labels:}} +\macrodef{clabel}{clabel}{({\sl label},{\sl label},{\sl label},{\sl arg4},% + {\sl arg5})} + {cct} + {Triple label along the drawing axis of an element in the current + direction \seesect{Labels:}. Labels are placed at the beginning, + centre, or end of the last {\tt []} block (or a named {\tt []} + block). The labels are treated as math, but copied literally if + in double quotes or defined by sprintf. {\sl Arg4} can be {\tt + above,} {\tt below,} {\tt left,} or {\tt right} to supplement the + default position. {\sl Arg5} is the optional name of a {\tt []} + block to be labelled and is {\tt last []} by default} \macrodef{cm\_\_}{cm__}{} {gen} {absolute centiimetres} @@ -433,10 +449,9 @@ {cct} {controlled-source width} \Letter{D}% -\macrodef{d\_fet}{d_fet}{(\linespec,L|R,P,S,E|S)} +\macrodef{d\_fet}{d_fet}{(\linespec,R,P,E|S)} {cct} - {left or right, N or P depletion MOSFET, normal or simplified, - without or with envelope or thick channel + {left or right, N or P depletion MOSFET, envelope or simplified \seesect{Semiconductors:}} \macrodef{dabove}{dabove}{(at {\sl location})} {darrow} @@ -536,6 +551,11 @@ \macrodef{deleminit\_}{deleminit_}{} {darrow} {sets drawing direction for dlines} +\macrodef{Deltasymbol}{Deltasymbol}{(at {\sl position},keys, + U|D|L|R|{\sl degrees}) (default {\tt U} for up)} + {cct} + {Delta symbol for power-system diagrams. + {\sl keys:} {\tt size={\sl expression}}} \macrodef{Demux}{Demux}{({\sl n},{\sl label}, {\tt [L][B|H|X][N[{\sl n}]|S[{\sl n}]][[N]OE], {\sl wid},{\sl ht}})} @@ -591,6 +611,18 @@ B|CR|D|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars,% {\tt Z}=zener; appending {\tt K} to arg 2 draws open arrowheads; arg 3: {\tt R}=reversed polarity, {\tt E}=enclosure \seesect{Twoterminal:}} +%\macrodef{DIP}{DIP}{({\sl pin count, attributes})}% +% {log} +% {Dual in-line package diagram. Default pin count = 8. +% Arg2 ({\sl attributes})= semicolon-separated list of optional terms: +% {\tt bodywid=}{\sl expr} (default 0.25$\,$in${}={}$5{\tt *L\_unit}), +% {\tt bodylen=}{\sl expr} (default {\sl pin count} $\times$ {\sl pin pitch}), +% {\tt pinpitch=}{\sl expr} (default 0.1), +% {\tt pinwid=}{\sl expr} (default 0.06), +% {\tt pinlen=}{\sl expr} (default 0.05), +% {\tt direct=U|D|L|R} (default {\tt U} for up), +% {\tt type=I|Q} (default {\tt I}; Q=pins of alternating length) +% \seesect{Logicgates:}} \macrodef{dir\_}{dir_}{} {darrow} {used for temporary storage of direction by darrow macros} @@ -714,10 +746,10 @@ B|CR|D|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars,% \macrodef{e\_}{e_}{} {gen} {.e relative to current direction} -\macrodef{e\_fet}{e_fet}{(\linespec,L|R,P,S,E|S)} +\macrodef{e\_fet}{e_fet}{(\linespec,R,P,E|S)} {cct} {left or right, N or P enhancement MOSFET, normal - or simplified, without or with envelope or thick channel + or simplified, without or with envelope \seesect{Semiconductors:}} \macrodef{earphone}{earphone}{( U|D|L|R|{\sl degrees, size})} {cct} @@ -766,6 +798,11 @@ B|CR|D|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars,% {3D} {vector projected on current view plane with top face of 3-dimensonal arrowhead normal to x2,y2,z2 } +\macrodef{Fe\_fet}{Fe_fet}{(\linespec,R,{\sl chars})} + {cct} + {FET with superimposed ferroelectric symbol. Args 1 to 3 are as for + the {\tt mosfet} macro + \seesect{Semiconductors:}} \macrodef{FF\_ht}{FF_ht}{} {cct} {flipflop height parameter in {\tt L\_unit}s} @@ -841,6 +878,10 @@ B|CR|D|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars,% \macrodef{G\_hht}{G_hht}{} {log} {gate half-height in {\tt L\_unit}s} +\macrodef{g\_fet}{g_fet}{(\linespec,R,P,{\sl shade spec})} + {cct} + {left or right, N or P graphene FET, without or with shading + \seesect{Semiconductors:}} \macrodef{gap}{gap}{(\linespec,{\sl fill},A)} {cct} {gap with (filled) dots, A=chopped arrow between dots\seesect{Twoterminal:}} @@ -972,11 +1013,14 @@ n|e|s|w,{\sl length})} \macrodef{in\_\_}{in__}{} {gen} {absolute inches} -\macrodef{inductor}{inductor}{(\linespec,W|L,{\sl n},[M|P],{\sl loop wid})} +\macrodef{inductor}{inductor}{(\linespec, W|L, {\sl cycles}, M[n]|P[n]|K[n], + {\sl loop wid})} {cct} {inductor, arg2: narrow (default), W=wide, L=looped; - arg3: {\sl n} arcs (default 4); - arg4: M=magnetic core, P=powder (dashed) core, + arg3: number of arcs or cycles (default 4); + arg4: M=magnetic core, P=powder (dashed) core, K=long-dashed core, + n={\sl integer} (default 2) number of core lines named + {\sl M4Core1, M4Core2,} $\ldots$; arg5: loop width (default L,W: {\tt dimen\_}/5; other: {\tt dimen\_}/8) \seesect{Twoterminal:}} \macrodef{inner\_prod}{inner_prod}{({\sl linear obj},{\sl linear obj})} @@ -1092,9 +1136,17 @@ n|e|s|w,{\sl length})} \macrodef{ljust\_}{ljust_}{} {gen} {ljust with respect to current direction} -\macrodef{llabel}{llabel}{({\sl label},{\sl label},{\sl label})} - {cct} - {triple label on left side of the element \seesect{Labels:}} +\macrodef{llabel}{llabel}{({\sl label},{\sl label},{\sl label},{\sl arg4},% + {\sl arg5})} + {cct} + {Triple label on the left of an element with respect to the current + direction \seesect{Labels:}. Labels are placed at the beginning, + centre, or end of the last {\tt []} block (or a named {\tt []} + block). The labels are treated as math, but copied literally if + in double quotes or defined by sprintf. {\sl Arg4} can be {\tt + above,} {\tt below,} {\tt left,} or {\tt right} to supplement the + default position. {\sl Arg5} is the optional name of a {\tt []} + block to be labelled and is {\tt last []} by default} \macrodef{loc\_}{loc_}{({\sl x}, {\sl y})} {gen} {location adjusted for current direction} @@ -1108,24 +1160,26 @@ n|e|s|w,{\sl length})} \macrodef{loge}{loge}{} {gen} {logarithm, base $e$} -\macrodef{Loopover\_}{Loopover_}{(`{\sl variable}',{\sl actions},{\sl value1, +\macrodef{Loopover\_}{Loopover_}{(`{\sl variable}',{\sl actions},{\sl +value1, value2, $\ldots$})} {gen} {Repeat {\sl actions} with {\sl variable} set successively to - {\sl value1, value2, $\ldots$}, setting macro {\tt m4Lx} to 1, 2, $\ldots$, - terminating if {\sl variable} is nul} + {\sl value1, value2, $\ldots$}, setting macro {\tt m4Lx} to 1, 2, + $\ldots$, terminating if {\sl variable} is nul} \macrodef{lp\_xy}{lp_xy}{} {log} {coordinates used by {\tt lg\_pin}} -\macrodef{lpop}{lpop}{({\sl xcoord}, {\sl ycoord}, {\sl radius}, {\sl fill}, - {\sl zero ht})} - {gen} - {for lollipop graphs: filled circle with stem to (xcoord,zeroht)} +\macrodef{lpop}{lpop}{({\sl xcoord}, {\sl ycoord}, {\sl radius}, +{\sl fill}, + {\sl zero ht})} {gen} + {for lollipop graphs: filled circle with stem to + (xcoord,zeroht)} \macrodef{lswitch}{lswitch}{( \linespec, L|R, {\sl chars} )} {cct} {knife switch R=right orientation (default L=left); - {\sl chars}=[O{\tt|}C][D][K][A] O=opening arrow; C=closing arrow; D=dots; - K=closed switch; A=blade arrowhead \seesect{Twoterminal:}} + {\sl chars}=[O{\tt|}C][D][K][A] O=opening arrow; C=closing arrow; + D=dots; K=closed switch; A=blade arrowhead \seesect{Twoterminal:}} \macrodef{lt\_}{lt_}{} {gen} {left with respect to current direction} @@ -1141,7 +1195,8 @@ n|e|s|w,{\sl length})} {arrow with adjustable head, filled when possible} \macrodef{m4dupstr}{m4dupstr}{({\sl string},{\sl n},`{\sl name}')} {gen} - {Defines {\sl name} as {\sl n} concatenated copies of {\sl string}.} + {Defines {\sl name} as {\sl n} concatenated copies of {\sl + string}.} \macrodef{m4lstring}{m4lstring}{({\sl arg1},{\sl arg2})} {gen} {expand {\sl arg1} if it begins @@ -1163,9 +1218,9 @@ n|e|s|w,{\sl length})} {memristor element\seesect{Twoterminal:}} \macrodef{microphone}{microphone}{( A|U|D|L|R|{\sl degrees, size})} {cct} - {microphone; if arg1 = A: upright mic, otherwise arg1 sets direction - of standard microphone with - {\sl In1} to {\sl In3} defined + {microphone; if arg1 = A: upright mic, otherwise arg1 sets + direction + of standard microphone with {\sl In1} to {\sl In3} defined \seesect{Composite:}} \macrodef{Min}{Min}{({\sl arg, arg, $\ldots$})} {gen} @@ -1181,33 +1236,28 @@ n|e|s|w,{\sl length})} ({\sl Position1,Position2,Position3,length,line attributes})} {gen} {e.g., {\tt mitre\_(A,B,C)} draws angle ABC with legs - of length arg4 (default {\tt linethick bp\_\_/2}); - sets {\tt Here} to Position2 + of length arg4 (default {\tt linethick bp\_\_/2}); sets {\tt Here} + to Position2 \seesect{Corners:}} \macrodef{mm\_\_}{mm__}{} {gen} {absolute millimetres} \macrodef{mosfet}{mosfet}{(\linespec,L|R,{\sl chars},E)} {cct} - {MOSFET left or right, included components defined by characters, envelope. + {MOSFET left or right, included components defined by characters, + envelope. arg 3 chars: - {\tt [u][d]B:} center bulk connection pin; - {\tt D:} D pin and lead; - {\tt E:} dashed substrate; - {\tt F:} solid-line substrate; - {\tt [u][d]G:} G pin to substrate at source; - {\tt [u][d]H:} G pin to substrate at center; - {\tt L:} G pin to channel (obsolete); - {\tt [u][d]M:} G pin to channel; u: at drain end; d: at source end - {\tt [u][d]M{\sl n}:} multiple gates G0 to G{\sl n} - {\tt Py:} parallel diode; - {\tt Pz:} parallel zener diode; - {\tt Q:} connect B pin to S pin; - {\tt R:} thick channel; - {\tt [u][d]S:} S pin and lead u: arrow up; d: arrow down; - {\tt [d]T:} G pin to center of channel d: not circle; - {\tt X:} XMOSFET terminal; - {\tt Z:} simplified complementary MOS + {\tt [u][d]B:} center bulk connection pin; {\tt D:} D pin and lead; + {\tt E:} dashed substrate; {\tt F:} solid-line substrate; {\tt + [u][d]G:} G pin to substrate at source; {\tt [u][d]H:} G pin to + substrate at center; {\tt L:} G pin to channel (obsolete); {\tt + [u][d]M:} G pin to channel; u: at drain end; d: at source end {\tt + [u][d]M{\sl n}:} multiple gates G0 to G{\sl n} {\tt Py:} parallel + diode; {\tt Pz:} parallel zener diode; {\tt Q:} connect B pin to + S pin; {\tt R:} thick channel; {\tt [u][d]S:} S pin and lead u: + arrow up; d: arrow down; {\tt [d]T:} G pin to center of channel + d: not circle; {\tt X:} XMOSFET terminal; {\tt Z:} simplified + complementary MOS \seesect{Semiconductors:}} \macrodef{Mux\_ht}{Mux_ht}{} {cct} @@ -1216,19 +1266,15 @@ n|e|s|w,{\sl length})} {cct} {Mux width parameter in {\tt L\_unit}s} \macrodef{Mux}{Mux}{({\sl n},{\sl label}, - {\tt [L][B|H|X][N[{\sl n}]|S[{\sl n}]][[N]OE], - {\sl wid},{\sl ht}})} + {\tt [L][B|H|X][N[{\sl n}]|S[{\sl n}]][[N]OE], {\sl wid},{\sl ht}})} {log} {binary multiplexer, $n$ inputs, - {\tt L} reverses input pin numbers, - {\tt B} display binary pin numbers, - {\tt H} display hexadecimal pin numbers, - {\tt X} do not print pin numbers, - {\tt N[{\sl n}]} puts Sel or Sel$0$ .. Sel$n$ at the top - (i.e., to the left of the drawing direction), - {\tt S[{\sl n}]} puts the Sel inputs at the bottom (default) - {\tt OE} ({\tt N=}negated) {\tt OE} pin - \seesect{Logicgates:}} + {\tt L} reverses input pin numbers, {\tt B} display binary pin + numbers, {\tt H} display hexadecimal pin numbers, {\tt X} do not + print pin numbers, {\tt N[{\sl n}]} puts Sel or Sel$0$ .. Sel$n$ + at the top (i.e., to the left of the drawing direction), {\tt + S[{\sl n}]} puts the Sel inputs at the bottom (default) {\tt OE} + ({\tt N=}negated) {\tt OE} pin \seesect{Logicgates:}} \macrodef{Mx\_pins}{Mx_pins}{} {log} {max number of gate inputs without wings} @@ -1245,23 +1291,24 @@ n|e|s|w,{\sl length})} \macrodef{NAND\_gate}{NAND_gate}{({\sl n},N)} {log} {`nand' gate, 2 or {\sl n\/} inputs; N=negated input. - Otherwise, arg1 can be a sequence of letters {\tt P|N} - to define normal or negated inputs. + Otherwise, arg1 can be a sequence of letters {\tt P|N} to define + normal or negated inputs. \seesect{Logicgates:}} \macrodef{ne\_}{ne_}{} {gen} {.ne with respect to current direction} \macrodef{NeedDpicTools}{NeedDpicTools}{} {gen} - {executes {\tt copy "HOMELIB\_/dpictools.pic"} if the file has not been read} + {executes {\tt copy "HOMELIB\_/dpictools.pic"} if the file has + not been read} \macrodef{neg\_}{neg_}{} {gen} {unary negation} \macrodef{NOR\_gate}{NOR_gate}{({\sl n},N)} {log} {`nor' gate, 2 or {\sl n\/} inputs; N=negated input. - Otherwise, arg1 can be a sequence of letters {\tt P|N} - to define normal or negated inputs. + Otherwise, arg1 can be a sequence of letters {\tt P|N} to define + normal or negated inputs. \seesect{Logicgates:}} \macrodef{norator}{norator}{(\linespec,{\sl width},{\sl ht})} {cct} @@ -1269,13 +1316,14 @@ n|e|s|w,{\sl length})} \macrodef{NOT\_circle}{NOT_circle}{} {log} {`not' circle} -\macrodef{NOT\_gate}{NOT_gate}{(\linespec,[B][N|n],{\sl wid},{\sl height})} +\macrodef{NOT\_gate}{NOT_gate}{(\linespec,[B][N|n],{\sl wid},{\sl +height})} {log} {`not' gate. When {\sl linespec} is blank then the element is composite and In1, - Out, C, NE, and SE are defined; otherwise the element is drawn as - a two-terminal element. arg2: {\tt B}=box gate, {\tt N}=not circle at input - and output, {\tt n}=not circle at input only + Out, C, NE, and SE are defined; otherwise the element is drawn as a + two-terminal element. arg2: {\tt B}=box gate, {\tt N}=not circle at + input and output, {\tt n}=not circle at input only \seesect{Logicgates:}} \macrodef{NOT\_rad}{NOT_rad}{} {log} @@ -1289,21 +1337,20 @@ n|e|s|w,{\sl length})} nw,nn,ne,ns,space ratio,pin lgth,style, other commands})} {cct} { Default is a standard-box twoport. Args 2 to 5 are - the number of ports to be drawn on w, n, e, s sides. - The port pins are named by side, number, and by a or b pin, - e.g., W1a, W1b, W2a, $\ldots$ - Arg 6 specifies the ratio of port width to interport space (default 2), - and arg 7 is the pin length. Set arg 8 to N to omit the dots on - the port pins. Arguments 1 and 9 allow customizations + the number of ports to be drawn on w, n, e, s sides. The port pins + are named by side, number, and by a or b pin, e.g., W1a, W1b, W2a, + $\ldots$ Arg 6 specifies the ratio of port width to interport space + (default 2), and arg 7 is the pin length. Set arg 8 to N to omit + the dots on the port pins. Arguments 1 and 9 allow customizations \seesect{Composite:}} \macrodef{nterm}{nterm}{({\sl box spec{\tt ;}other commands, nw,nn,ne,ns,pin lgth,style, other commands})} {cct} {n-terminal box macro (default three pins). - Args 2 to 5 are the number of pins to be drawn on W, N, E, S sides. - The pins are named by side and number, e.g. W1, W2, N1, $\ldots$ - Arg 6 is the pin length. Set arg 7 to N to omit the dots - on the pins. Arguments 1 and 8 allow customizations, e.g. + Args 2 to 5 are the number of pins to be drawn on W, N, E, S + sides. The pins are named by side and number, e.g. W1, W2, N1, + $\ldots$ Arg 6 is the pin length. Set arg 7 to N to omit the + dots on the pins. Arguments 1 and 8 allow customizations, e.g. {\tt nterm(,{,},{,},{,}N,"\$a\$" at Box.w ljust,"\$b\$" at Box.e rjust, "\$c\$" at Box.s above)} } \macrodef{nullator}{nullator}{(\linespec,{\sl width},{\sl ht})} @@ -1315,18 +1362,20 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{NXOR\_gate}{NXOR_gate}{({\sl n},N)} {log} {`nxor' gate, 2 or {\sl n\/} inputs; N=negated input. - Otherwise, arg1 can be a sequence of letters {\tt P|N} - to define normal or negated inputs. + Otherwise, arg1 can be a sequence of letters {\tt P|N} to define + normal or negated inputs. \seesect{Logicgates:}} \Letter{O}% -\macrodef{opamp}{opamp}{(\linespec,{\sl label},{\sl label},{\sl size},{\sl +\macrodef{opamp}{opamp}{(\linespec,{\sl label},{\sl +label},{\sl size},{\sl chars}, other commands)} {cct} {operational amplifier with $-,$ $+$ or other internal labels, - specified size. {\sl chars:} {\tt P=} add power connections, - {\tt R=} swap In1, In2 labels, - {\tt T=} truncated point. - The first and last arguments allow added customizations + specified size. {\sl chars:} {\tt P=} add power connections, {\tt + R=} swap In1, In2 labels, {\tt T=} truncated point. The internally + defined positions are {\sl W, N, E, S, Out, NE, SE, In, In2}, and + the (obsolete) positions {\sl E1 = NE, E2 = SE}. The first and last + arguments allow added customizations \seesect{Composite:}} \macrodef{open\_arrow}{open_arrow}{(\linespec,{\sl ht},{\sl wid})} {gen} @@ -1334,40 +1383,39 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{OR\_gate}{OR_gate}{({\sl n},N)} {log} {`or' gate, 2 or {\sl n\/} inputs; N=negated input. - Otherwise, arg1 can be a sequence of letters {\tt P|N} - to define normal or negated inputs. + Otherwise, arg1 can be a sequence of letters {\tt P|N} to define + normal or negated inputs. \seesect{Logicgates:}} \macrodef{OR\_gen}{OR_gen}{($n$,{\sl chars},[{\sl wid},[{\sl ht}]])} {log} {general OR gate: $n$=number of inputs $(0\leq n\leq 16)$; {\sl chars:} B=base and straight sides; A=Arcs; - [N]NE,[N]SE,[N]I,[N]N,[N]S=inputs or circles; - [N]P=XOR arc; [N]O=output; C=center. - Otherwise, arg1 can be a sequence of letters {\tt P|N} - to define normal or negated inputs.} + [N]NE,[N]SE,[N]I,[N]N,[N]S=inputs or circles; [N]P=XOR arc; + [N]O=output; C=center. + Otherwise, arg1 can be a sequence of letters {\tt P|N} to define + normal or negated inputs.} \macrodef{OR\_rad}{OR_rad}{} {log} {radius of OR input face in {\tt L\_unit}s} \Letter{P}% -\macrodef{parallel\_}{parallel_}{(\char96{\sl elementspec}\char39,% +\macrodef{parallel\_}{parallel_}{(\char96{\sl +elementspec}\char39,% \char96{\sl elementspec}\char39 $\ldots$)} {cct} - { Parallel combination of two-terminal elements in a {\tt [ ]} block. - Each argument is a {\em quoted} elementspec of the form - {\tt[Sep={\sl val};][{\sl Label}:] {\sl element}; [{\sl attributes}]} - where an {\sl attribute} is of the form - {\tt[llabel($\ldots$);] | [rlabel($\ldots$);] | [b\_current($\ldots$);]}. - An argument may also be {\tt series\_($\ldots$)} or - {\tt parallel\_($\ldots$)} {\em without} attributes or quotes. - Sep={\sl val}; in the first branch sets the default - separation of all branches to {\sl val}; in a later - element Sep={\sl val}; applies only to that branch. - An element may have normal arguments but should - not change the drawing direction. + { Parallel combination of two-terminal elements in a {\tt [ + ]} block. + Each argument is a {\em quoted} elementspec of the form {\tt[Sep={\sl + val};][{\sl Label}:] {\sl element}; [{\sl attributes}]} where + an {\sl attribute} is of the form {\tt[llabel($\ldots$);] | + [rlabel($\ldots$);] | [b\_current($\ldots$);]}. An argument may + also be {\tt series\_($\ldots$)} or {\tt parallel\_($\ldots$)} {\em + without} attributes or quotes. Sep={\sl val}; in the first branch + sets the default separation of all branches to {\sl val}; in a later + element Sep={\sl val}; applies only to that branch. An element may + have normal arguments but should not change the drawing direction. \seesect{Seriesandparallel:}} %\macrodef{par\_}{par_}{({\sl element},{\sl element},{\sl separation})} -% {cct} -% {two same-direction, same-length elements in parallel} +% {cct} % {two same-direction, same-length elements in parallel} \macrodef{proximity}{proximity}{(\sl linespec)} {cct} {proximity detector (= {\tt consource(,P)})} @@ -1383,13 +1431,9 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{pconnex}{pconnex}{(R|L|U|D|{\sl degrees},{\sl chars})} {cct} {power connectors, arg 1: drawing direction; {\sl chars:} - {\tt R}=right orientation, - {\tt M|F}= male, female, - {\tt A|AC}=115V, 3 prong, B=box, C=circle, - {\tt P}= PC connector, - {\tt D}= 2-pin connector, - {\tt G|GC}= GB 3-pin, - {\tt J}= 110V 2-pin + {\tt R}=right orientation, {\tt M|F}= male, female, {\tt A|AC}=115V, + 3 prong, B=box, C=circle, {\tt P}= PC connector, {\tt D}= 2-pin + connector, {\tt G|GC}= GB 3-pin, {\tt J}= 110V 2-pin \seesect{Composite:}} \macrodef{pi\_}{pi_}{} {gen} @@ -1397,8 +1441,7 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{plug}{plug}{(U|D|L|R|{\sl degrees},[2|3][R])} {cct} {arg1: drawing direction; string arg2: {\tt R} right orientation, - {\tt 2|3} number of conductors - \seesect{Composite:}} + {\tt 2|3} number of conductors \seesect{Composite:}} \macrodef{pmod}{pmod}{({\sl integer}, {\sl integer})} {gen} {+ve $\hbox{mod}(M,N)$ e.g., $\hbox{\tt pmod}(-3,5)=2$} @@ -1407,7 +1450,8 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {(radians) set direction cosines} \macrodef{PerpTo}{PerpTo}{({\sl Pos1, Line, Point})} {gen} - {{\sl Point} is the label for the point on {\sl Line} of the perpendicular + {{\sl Point} is the label for the point on {\sl Line} of the + perpendicular from {\sl Point} to {\sl Line}.} \macrodef{Point\_}{Point_}{({\sl integer})} {gen} @@ -1417,22 +1461,21 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {rectangular-to polar conversion} \macrodef{langle}{langle}{({\sl Start, End})} {gen} - {Angle in radians from horizontal of the line from {\sl Start} to {\sl End}.} + {Angle in radians from horizontal of the line from {\sl Start} + to {\sl End}.} \macrodef{potentiometer}{potentiometer}{(\linespec,% - {\sl cycles},{\sl fractional pos},{\sl length},$\cdots$)} - {cct} + {\sl cycles},{\sl fractional pos},{\sl length},$\cdots$)} {cct} {resistor with taps T1, T2, $\ldots$ - with specified fractional positions and lengths (possibly neg) + with specified fractional positions and lengths (possibly neg) \seesect{Composite:}} \macrodef{print3D}{print3D}{(x,y,z)} - {3D} - {write out triple for debugging} + {3D} {write out triple for debugging} \macrodef{prod\_}{prod_}{({\sl a},{\sl b})} {gen} {binary multiplication} \macrodef{project}{project}{({\sl x},({\sl y},({\sl z})} - {3D} - {3D to 2D projection onto the plane perpendicular to the view vector with + {3D} {3D to 2D projection onto the plane perpendicular to the view + vector with angles defined by {\tt setview({\sl azim, elev})}} \macrodef{psset\_}{psset_}{({\sl PSTricks settings})} {gen} @@ -1440,6 +1483,11 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{pt\_\_}{pt__}{} {gen} {\TeX\ point-size factor, in scaled inches, ({\tt *scale/72.27})} +\macrodef{PtoL}{PtoL}{({\sl position}, U|D|L|R|{\sl degrees}, {\sl length}) } + {gen} + {Evaluates to {\tt from {\sl position} to + {\sl position} + Rect\_({\sl length, angle}) } + from the polar-coordinate data in the arguments } \macrodef{ptrans}{ptrans}{(\linespec, [R|L])} {cct} {pass transistor; {\tt L=} left orientation @@ -1458,40 +1506,31 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{rect\_}{rect_}{({\sl radius},{\sl angle})} {gen} {(radians) polar-rectangular conversion} -\macrodef{reed}{reed}{({\sl linespec, width, height, box attribues}, [R][C])} +\macrodef{reed}{reed}{({\sl linespec, width, height, box attribues}, +[R][C])} {cct} {Enclosed reed two-terminal contact; - {\tt R}=right orientation; {\tt C}=closed contact; - e.g., {\tt reed(,,dimen\_/5,shaded "lightgreen"} - \seesect{Composite:}} + {\tt R}=right orientation; {\tt C}=closed contact; e.g., {\tt + reed(,,dimen\_/5,shaded "lightgreen"} \seesect{Composite:}} \macrodef{relay}{relay}{({\sl number of poles, chars})} {cct} {relay: n poles (default 1), {\sl chars:} {\tt O}=normally open, - {\tt C}=normally closed, {\tt P}=three position, default double throw, - {\tt L}=drawn left (default), - {\tt R}=drawn right, {\tt Th}=thermal. - Argument 3={\tt [L|R]} is deprecated but works for + {\tt C}=normally closed, {\tt P}=three position, default double + throw, {\tt L}=drawn left (default), {\tt R}=drawn right, {\tt + Th}=thermal. Argument 3={\tt [L|R]} is deprecated but works for backward compatibility \seesect{Composite:}} -\macrodef{relaycoil}{relaycoil}{({\sl chars, wid, ht,} R|L|U|D|{\sl degrees})} - {cct} - {chars: - {\tt X}=or default: external lines from A2 and B2; - {\tt AX}=external lines at positions A1,A3; - {\tt BX}=external lines at positions B1,B3; - {\tt NX}=no lines at positions A1,A2,A3,B1,B2,B3; - {\tt SO}=slow operating; - {\tt SOR}=slow operating and release; - {\tt SR}=slow release; - {\tt HS}=hight speed; - {\tt HS}=hight speed; - {\tt NAC}=unaffected by AC current; - {\tt AC AC}=current; - {\tt ML}=mechanically latched; - {\tt PO}=polarized; - {\tt RM}=remanent; - {\tt RH}=remanent; - {\tt TH}=thermal; +\macrodef{relaycoil}{relaycoil}{({\sl chars, wid, ht,} R|L|U|D|{\sl +degrees})} + {cct} + {chars: + {\tt X}=or default: external lines from A2 and B2; {\tt AX}=external + lines at positions A1,A3; {\tt BX}=external lines at positions + B1,B3; {\tt NX}=no lines at positions A1,A2,A3,B1,B2,B3; {\tt + SO}=slow operating; {\tt SOR}=slow operating and release; {\tt + SR}=slow release; {\tt HS}=high speed; {\tt NAC}=unaffected by AC + current; {\tt AC AC}=current; {\tt ML}=mechanically latched; {\tt + PO}=polarized; {\tt RM}=remanent; {\tt RH}=remanent; {\tt TH}=thermal; {\tt EL}=electronic \seesect{Composite:}} \macrodef{resetdir\_}{resetdir_)}{} @@ -1504,14 +1543,10 @@ nw,nn,ne,ns,pin lgth,style, other commands})} cycle wid})} {cct} {resistor, n cycles (default 3), {\sl chars:} - {\tt E}={\tt ebox}, - {\tt ES}={\tt ebox} with slash, - {\tt Q}=offset, - {\tt H}=squared, - {\tt N}=IEEE, - {\tt V}=varistor variant, - {\tt R}=right-oriented, - {\sl cycle width} (default {\tt dimen\_}$/6$) \seesect{Twoterminal:}} + {\tt E}={\tt ebox}, {\tt ES}={\tt ebox} with slash, {\tt Q}=offset, + {\tt H}=squared, {\tt N}=IEEE, {\tt B}=not burnable, {\tt V}=varistor + variant, {\tt R}=right-oriented, {\sl cycle width} (default {\tt + dimen\_}$/6$) \seesect{Twoterminal:}} \macrodef{resized}{resized}{({\sl factor},`{\sl macro name}',args)} {cct} {scale the element body size by {\sl factor}} @@ -1526,47 +1561,51 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {gen} {color drawing for PSTricks, pgf, MetaPost, SVG postprocessors; (color entries are 0 to 1 except for SVG entries which are 0 to 255), - see {\tt setrgb} \seesect{Semiconductors:}. - Exceptionally, the color of - SVG arrows other than the default black has to be defined using - the {\tt outlined }{\sl string} and {\tt shaded }{\sl string} constructs.} + see {\tt setrgb} \seesect{Semiconductors:}. Exceptionally, the color + of SVG arrows other than the default black has to be defined using the + {\tt outlined }{\sl string} and {\tt shaded }{\sl string} constructs.} \macrodef{rgbfill}{rgbfill}{({\sl color triple}, {\sl closed path})} {gen} - {fill with arbitrary color (color entries are 0 to 1 except - SVG entries which are 0 to 255); see {\tt setrgb}\seesect{Semiconductors:}} + {fill with arbitrary color (color entries are 0 to 1 except + SVG entries which are 0 to 255); see {\tt + setrgb}\seesect{Semiconductors:}} \macrodef{rgbstring}{rgbstring}{({\sl color triple or color name})} {gen} {evaluates to a string compatible with the postprocessor in use to go with {\tt colored}, {\tt shaded}, or {\tt outlined} attributes. - (PSTricks, metapost, pgf-tikz, pdf, postscript, svg). - The arguments are fractions - in the range $[0,1]$; For example, - {\tt box outlined rgbstring(0.1,0.2,0.7) shaded rgbstring(0.75,0.5,0.25)}. - For those postprocessors that allow it, - there can be one argument which is the name of a defined color} + (PSTricks, metapost, pgf-tikz, pdf, postscript, svg). The arguments + are fractions in the range $[0,1]$; For example, {\tt box outlined + rgbstring(0.1,0.2,0.7) shaded rgbstring(0.75,0.5,0.25)}. For those + postprocessors that allow it, there can be one argument which is the + name of a defined color} \macrodef{right\_}{right_}{} {gen} {set current direction right \seesect{Placing:}} \macrodef{RightAngle}{RightAngle}{({\sl Pos1, Pos2, Pos3, line len, - attributes})} - {gen} - {Draw a right-angle symbol at {\sl Pos2}, of size given by arg4. Arg5 = + attributes})} {gen} + {Draw a right-angle symbol at {\sl Pos2}, of size + given by arg4. Arg5 = line attributes, e.g., {\tt outlined "gray"}} \macrodef{rjust\_}{rjust_}{} {gen} {right justify with respect to current direction} -\macrodef{rlabel}{rlabel}{({\sl label},{\sl label},{\sl label})} - {cct} - {triple label on right side of the element \seesect{Labels:}} +\macrodef{rlabel}{rlabel}{({\sl label},{\sl label},{\sl label},{\sl arg4},% + {\sl arg5})} + {cct} + {Triple label on the right of an element with respect to the current + direction \seesect{Labels:}. Labels are placed at the beginning, + centre, or end of the last {\tt []} block (or a named {\tt []} + block). The labels are treated as math, but copied literally if + in double quotes or defined by sprintf. {\sl Arg4} can be {\tt + above,} {\tt below,} {\tt left,} or {\tt right} to supplement the + default position. {\sl Arg5} is the optional name of a {\tt []} + block to be labelled and is {\tt last []} by default} \macrodef{rot3Dx}{rot3Dx}{({\sl radians,x,y,z})} - {3D} - {rotates x,y,z about x axis} + {3D} {rotates x,y,z about x axis} \macrodef{rot3Dy}{rot3Dy}{({\sl radians,x,y,z})} - {3D} - {rotates x,y,z about y axis} + {3D} {rotates x,y,z about y axis} \macrodef{rot3Dz}{rot3Dz}{({\sl radians,x,y,z})} - {3D} - {rotates x,y,z about z axis} + {3D} {rotates x,y,z about z axis} \macrodef{Rot\_}{Rot_}{({\sl position, degrees})} {gen} {rotate position by degrees} @@ -1576,20 +1615,20 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{rotbox}{rotbox}{({\sl wid,ht,type},[r|t={\sl val}])} {gen} {box oriented in current direction in {\tt [ ]} block; - {\sl type}= e.g. {\tt dotted shaded "green".} Defined - internal locations: N, E, S, W (and NE, SE, NW, SW if arg4 is blank). - If arg4 is {\tt r=}{\sl val} then corners have radius {\sl val}. - If arg4 is {\tt t=}{\sl val} then a spline with tension {\sl val} - is used to draw a ``superellipse,'' and the bounding box is then - only approximate. } + {\sl type}= e.g. {\tt dotted shaded "green".} Defined internal + locations: N, E, S, W (and NE, SE, NW, SW if arg4 is blank). If arg4 + is {\tt r=}{\sl val} then corners have radius {\sl val}. If arg4 is + {\tt t=}{\sl val} then a spline with tension {\sl val} is used to draw + a ``superellipse,'' and the bounding box is then only approximate. } \macrodef{rotellipse}{rotellipse}{({\sl wid,ht,type})} {gen} {ellipse oriented in current direction in {\tt [ ]} block; - e.g. {\tt Point\_(45); rotellipse(,{},dotted fill\_(0.9)).} Defined internal - locations: N, S, E, W.} + e.g. {\tt Point\_(45); rotellipse(,{},dotted fill\_(0.9)).} Defined + internal locations: N, S, E, W.} \macrodef{round}{round}{(at {\sl location,line thickness,attributes})} {gen} - {filled circle for rounded corners; attributes={\tt colored "gray"} + {filled circle for rounded corners; attributes={\tt colored + "gray"} for example; leaves {\tt Here} unchanged if arg1 is blank \seesect{Corners:}} \macrodef{rpoint\_}{rpoint_}{(\linespec)} @@ -1639,7 +1678,8 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \seesect{Interaction:}} \macrodef{s\_init}{s_init}{({\sl name})} {gen} - {initialize {\tt s\_box} string label to {\sl name} which should be unique + {initialize {\tt s\_box} string label to {\sl name} which should + be unique \seesect{Interaction:}} \macrodef{s\_name}{s_name}{} {gen} @@ -1674,43 +1714,50 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{se\_}{se_}{} {gen} {.se with respect to current direction} -\macrodef{series\_}{series_}{({\sl elementspec}, {\sl elementspec}, $\ldots$)} +\macrodef{series\_}{series_}{({\sl elementspec}, {\sl elementspec}, +$\ldots$)} {cct} { Series combination in a {\tt []} block of elements - with shortened default length. An {\sl elementspec} is of the form - {\tt [{\sl Label}:] {\sl element}; [{\sl attributes}]}, - where an {\sl attribute} is of the form - {\tt [llabel($\ldots$);] | [rlabel($\ldots$);] [b\_current($\ldots$);]}. - Internal points {\tt Start}, {\tt End}, and {\tt C} are defined + with shortened default length. An {\sl elementspec} is of the + form {\tt [{\sl Label}:] {\sl element}; [{\sl attributes}]}, + where an {\sl attribute} is of the form {\tt [llabel($\ldots$);] | + [rlabel($\ldots$);] [b\_current($\ldots$);]}. Internal points {\tt + Start}, {\tt End}, and {\tt C} are defined \seesect{Seriesandparallel:} } -\macrodef{setdir\_}{setdir_}{(R|L|U|D|{\sl degrees}, {\sl default} U|D|R|L|{\sl degrees})} +\macrodef{setdir\_}{setdir_}{(R|L|U|D|{\sl degrees}, {\sl default} +U|D|R|L|{\sl degrees})} {gen} {store drawing direction and set it to - up, down, left, right, or angle in degrees (reset by {\tt resetdir\_}). - The directions may be spelled out, i.e., Right, Left, $\ldots$ + up, down, left, right, or angle in degrees (reset by {\tt + resetdir\_}). The directions may be spelled out, i.e., Right, + Left, $\ldots$ \seesect{Seriesandparallel:}} \macrodef{setrgb}{setrgb}{({\sl red value, green value, blue value},[{\sl name}])} {gen} - {define colour for lines and text, optionally named (default {\tt lcspec}); + {define colour for lines and text, optionally named (default + {\tt lcspec}); svg values are integers from 0 to 255\seesect{Semiconductors:}} \macrodef{setkey\_}{setkey_}{({\sl string, key, default,}[N])} {gen} - {Key-value definition. The string contains semicolon-separated terms + {Key-value definition. The string contains semicolon-separated + terms of the form {\sl key}{\tt =}{\sl value}. Then macro {\tt m4{\sl key}} - is defined using {\tt pushdef} to be {\tt ({\sl value})} but if arg4 is - nonbland, the parentheses are omitted.} -\macrodef{setview}{setview}{({\sl azimuth degrees},{\sl elevation degrees})} - {3D} - {set projection viewpoint} -\macrodef{sfg\_init}{sfg_init}{({\sl default line len, node rad, arrowhd len, - arrowhd wid}), (reads {\tt libcct.m4})} - {cct} - {initialization of signal flow graph macros} + is defined using {\tt pushdef} to be {\tt ({\sl value})} but if arg4 + is nonbland, the parentheses are omitted.} +\macrodef{setview}{setview}{({\sl azimuth degrees},{\sl elevation +degrees})} + {3D} {set projection viewpoint} +\macrodef{sfg\_init}{sfg_init}{({\sl default line len, node rad, +arrowhd len, + arrowhd wid}), (reads {\tt libcct.m4})} {cct} + {initialization of signal + flow graph macros} \macrodef{sfgabove}{sfgabove}{} {cct} {like above but with extra space} -\macrodef{sfgarc}{sfgarc}{(\linespec,{\sl text},{\sl text justification},cw|ccw, +\macrodef{sfgarc}{sfgarc}{(\linespec,{\sl text},{\sl text +justification},cw|ccw, {\sl height scale factor})} {cct} {directed arc drawn between nodes, with text label @@ -1718,16 +1765,17 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{sfgbelow}{sfgbelow}{} {cct} {like below but with extra space} -\macrodef{sfgline}{sfgline}{(\linespec,{\sl text},{\sl text justification})} +\macrodef{sfgline}{sfgline}{(\linespec,{\sl text},{\sl text +justification})} {cct} {directed straight line chopped by node radius, with text label} \macrodef{sfgnode}{sfgnode}{(at {\sl location},{\sl text},above|below,{\sl circle options})} {cct} - {small circle default white interior, with text label. The default label - position is inside if the diameter is bigger than {\tt textht} and - {\tt textwid}; otherwise it is {\tt sfgabove.} Options such as fill or - line thickness can be given.} + {small circle default white interior, with text label. The default + label position is inside if the diameter is bigger than {\tt textht} + and {\tt textwid}; otherwise it is {\tt sfgabove.} Options such as + fill or line thickness can be given.} \macrodef{sfgself}{sfgself}{(at {\sl location}, U|D|L|R|{\sl degrees}, {\sl text}, {\sl text justification}, cw|ccw, {\sl scale factor})} {cct} @@ -1740,19 +1788,27 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {gen} {box with edge shading} \macrodef{ShadedPolygon}{ShadedPolygon}{({\sl vertexseq, line attributes, - degrees, colorseq})} - {gen} - {Draws the polygon specified in arg1 and shades the interior according - to arg4 by drawing lines perpendicular to the angle in arg3. - The {\sl vertexseq} is a colon ({\tt:}) separated sequence of vertex - positions (or names) of the polygon in cw or ccw order. A {\sl colorseq} - is of the form 0, r0,g0,b0, {\sl frac1},r1,g1,b1, {\sl frac2},r2,g2,b2, - \ldots 1,rn,gn,bn with $0 < \hbox{\sl frac1} < \hbox{\sl frac2} \ldots 1$ -} + degrees, colorseq})} {gen} + {Draws the polygon specified in arg1 and + shades the interior according + to arg4 by drawing lines perpendicular to the angle in arg3. The {\sl + vertexseq} is a colon ({\tt:}) separated sequence of vertex positions + (or names) of the polygon in cw or ccw order. A {\sl colorseq} is of + the form 0, r0,g0,b0, {\sl frac1},r1,g1,b1, {\sl frac2},r2,g2,b2, + \ldots 1,rn,gn,bn with $0 < \hbox{\sl frac1} < \hbox{\sl frac2} + \ldots 1$ +} \macrodef{shielded}{shielded}{(`{\sl two-terminal element}', + L|U, {\sl line attributes})} {cct} + {shielding in a {\tt [ ]} box for + two-terminal element. Arg2= blank + (default) to enclose the element body; L for the left side with + respect to drawing direction, R for right. Internal points {\tt + .Start, .End,} and {\tt .C} are defined} \macrodef{SIdefaults}{SIdefaults}{} {gen} {Sets {\tt scale = 25.4} for drawing units in mm, and sets - pic parameters {\tt lineht = 12, linewid = 12, moveht = 12, movewid = 12, + pic parameters {\tt lineht = 12, linewid = 12, moveht = 12, movewid + = 12, arcrad = 6, circlerad = 6, boxht = 12, boxwid = 18, ellipseht = 12, ellipsewid = 18, dashwid = 2, arrowht = 3, arrowwid = arrowht/2,}} \macrodef{sign\_}{sign_}{({\sl number})} @@ -1767,29 +1823,30 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{sind}{sind}{({\sl arg})} {gen} {sine of an expression in degrees} -\macrodef{sinusoid}{sinusoid}{({\sl amplitude, frequency, phase, tmin, tmax, +\macrodef{sinusoid}{sinusoid}{({\sl amplitude, frequency, phase, tmin, +tmax, linetype})} {gen} - {draws a sinusoid over the interval - $(t_{\hbox{\scriptsize min}}, t_{\hbox{\scriptsize max}})$; - e.g., to draw a dashed sine curve, amplitude {\sl a}, of {\sl n} cycles - of length {\sl x} from {\sl A}, - {\tt sinusoid(a,twopi\_*n/x,-pi\_/2,0,x,dashed) with .Start at A}} + {draws a sinusoid over the interval $(t_{\hbox{\scriptsize min}}, + t_{\hbox{\scriptsize max}})$; + e.g., to draw a dashed sine curve, amplitude {\sl a}, + of {\sl n} cycles of length {\sl x} from {\sl A}, {\tt + sinusoid(a,twopi\_*n/x,-pi\_/2,0,x,dashed) with .Start at A}} \macrodef{source}{source}{(\linespec, - V|v|I|i|AC|B|F|G|H|J|Q|L|N|P|S[C[r]]|E[r]]|T|X|U|{\sl other}, - {\sl diameter},R)} + V|v|I|i|AC|B|F|G|H|J|Q|L|N|P|S[C[r]]|E[r]]|T|X|U|{\sl other}, {\sl + diameter},R)} {cct} {source, blank or: - V = voltage source; v = alternate voltage source; - I = current source; i = alternate current source; - AC = AC source; B = bulb; F = fluorescent; G = - generator; H = step function; L = lamp; - N = neon; P = pulse; Q = charge; R = ramp; r = right - orientation; S = sinusoid; SC = quarter arc; SE = - arc; T = triangle; U = square-wave; X = interior X; - other = custom interior label or waveform; - arg 4: R = reversed polarity; - arg 5 modifies the circle with e.g., color or fill + V = voltage source; v = alternate voltage source; I = + current source; i = alternate current source; AC = + AC source; B = bulb; F = fluorescent; G = generator; + H = step function; L = lamp; N = neon; P = pulse; + Q = charge; R = ramp; r = right orientation; S = + sinusoid; SC = quarter arc; SE = arc; T = triangle; + U = square-wave; X = interior X; other = custom + interior label or waveform; arg 4: R = reversed + polarity; arg 5 modifies the circle with e.g., + color or fill \seesect{Twoterminal:}} \macrodef{sourcerad\_}{sourcerad_}{} {cct} @@ -1802,8 +1859,7 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {speaker, {\sl In1} to {\sl In7} defined; {\tt H}=horn \seesect{Composite:}} \macrodef{sprod3D}{sprod3D}{(a,x,y,z)} - {3D} - {scalar product of triple x,y,z by a} + {3D} {scalar product of triple x,y,z by a} \macrodef{sqrta}{sqrta}{({\sl arg})} {gen} {square root of the absolute value of {\sl arg}; i.e., @@ -1811,32 +1867,31 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{SQUID}{SQUID}{({\sl n, diameter, initial angle}, {\tt ccw|cw})} {cct} {Superconducting quantum interface device - with {\sl }n junctions labeled {\tt J1, ... J}{\sl n} - placed around a circle with initial - angle -90 deg (by default) with respect - to the current drawing direction. The - default diameter is {\tt dimen\_} } + with {\sl }n junctions labeled {\tt J1, ... J}{\sl n} placed around + a circle with initial angle -90 deg (by default) with respect to the + current drawing direction. The default diameter is {\tt dimen\_} } \macrodef{stackargs\_}{stackargs}{(`{\sl stackname}',{\sl args})} {gen} {Stack arg 2, arg 3, ... onto the named stack up to a blank arg} \macrodef{stackcopy\_}{stackcopy_}{(`{\sl name 1}',`{\sl name 2}')} {gen} - {Copy stack 1 into stack 2, preserving the order of pushed elements} + {Copy stack 1 into stack 2, preserving the order of pushed + elements} \macrodef{stackdo\_}{stackdo}{(`{\sl stackname}',{\sl commands})} {gen} {Empty the stack to the first blank entry, performing arg 2} \macrodef{stackexec\_}{stackexec_}{(`{\sl name 1}',`{\sl name 2}',% {\sl commands})} {gen} - {Copy stack 1 into stack 2, performing arg3 for each nonblank entry} + {Copy stack 1 into stack 2, performing arg3 for each nonblank + entry} \macrodef{stackprint\_}{stackprint_}{(`{\sl stack name}')} {gen} {Print the contents of the stack to the terminal} -%\macrodef{stackpromote\_}{stackpromote_}{({\sl prefix},% +%\macrodef{stackpromote\_}{stackpromote_}{({\sl prefix},% % `{\sl stack name}',{\sl In name})} % {gen} -% {Define locations {\tt In1} or {\sl In name }{\tt 1}, $\ldots$ corresponding -% to the locations in stack {\sl stack name}, as created by the +% {Define locations {\tt In1} or {\sl In name }{\tt 1}, $\ldots$ corresponding % to the locations in stack {\sl stack name}, as created by the % {\tt AutoGate} and {\tt Autologic} macros. Each location is prefixed % by argument 1 ``.''} \macrodef{stackreverse\_}{stackreverse_}{(`{\sl stack name}')} @@ -1845,14 +1900,15 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{stacksplit\_}{stacksplit_}{(`{\sl stack name}',{\sl string},{\sl separator})} {gen} - {Stack the fields of {\sl string} left to right separated by nonblank - {\sl separator} (default .). White space preceding the fields is ignored.} + {Stack the fields of {\sl string} left to right separated + by nonblank + {\sl separator} (default .). White space preceding the fields + is ignored.} \macrodef{sum\_}{sum_}{({\sl a},{\sl b})} {gen} {binary sum} \macrodef{sum3D}{sum3D}{({\sl x1,y1,z1,x2,y2,z2})} - {3D} - {sum of two triples} + {3D} {sum of two triples} \macrodef{sus}{sus}{({\sl linespec, chars, label})} {cct} {Wrapper to place an SUS thyristor as a two-terminal element with @@ -1881,29 +1937,29 @@ nw,nn,ne,ns,pin lgth,style, other commands})} [{\sl arrowhd} | type={\sl arrowhd};name={\sl Name}], {\sl fraction, length, fraction, length,} $\cdots$)} {cct} - {Draw the two-terminal element with taps in a [ ] block (see {\tt addtaps}). - {\sl arrowhd} = blank or one of {\tt . - <- -> <->}. - Each fraction determines the position along the element body of the tap. - A negative length draws the tap to the right of the current - direction; positive length to the left. - Tap names are Tap1, Tap2, $\cdots$ by default or - Name1, Name2, $\cdots$ if specified. - Internal block names are {\tt .Start, .End,} and {.C} corresponding to the - drawn element, and the tap names - \seesect{Composite:} } + {Draw the two-terminal element with taps in a [ ] block (see + {\tt addtaps}). + {\sl arrowhd} = blank or one of {\tt . - <- -> <->}. Each fraction + determines the position along the element body of the tap. A negative + length draws the tap to the right of the current direction; positive + length to the left. Tap names are Tap1, Tap2, $\cdots$ by default + or Name1, Name2, $\cdots$ if specified. Internal block names are + {\tt .Start, .End,} and {.C} corresponding to the drawn element, + and the tap names \seesect{Composite:} } \macrodef{tbox}{tbox}{({\sl text,wid,ht},<|>|<>,{\sl type})} {cct} - {Pointed terminal box. The {\sl text} is placed at the rectangular center - in math mode unless the text begins with {\tt "} or {\tt sprintf} in which - case the arument is used literally. Arg 4 determines whether the point is - forward, backward, or both with respect to the current drawing direction. + {Pointed terminal box. The {\sl text} is placed at the rectangular + center + in math mode unless the text begins with {\tt "} or {\tt sprintf} in + which case the arument is used literally. Arg 4 determines whether + the point is forward, backward, or both with respect to the current + drawing direction. \seesect{Composite:}} \macrodef{tconn}{tconn}{({\sl linespec,}>|>>|<|<<|O[F],{\sl wid})} {cct} {Terminal connector, {\tt O}=circle; {\tt OF}=filled circle; - {\tt > or >>} output connector - (default {\tt >}) ; - {\tt < or << input connector}; arg3 is arrowhead width or circle diameter + {\tt > or >>} output connector (default {\tt >}) ; {\tt < or << + input connector}; arg3 is arrowhead width or circle diameter \seesect{Composite:}} \macrodef{tgate}{tgate}{({\sl linespec,} [B][R|L])} {cct} @@ -1911,11 +1967,11 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \seesect{Semiconductors:}} \macrodef{thermocouple}{thermocouple}{({\sl linespec, wid, ht,} L|R)} {cct} - { Thermocouple drawn to the left (by default) of the {\sl linespec} - line. If the {\sl linespec} length equals {\sl wid} - (default {\tt dimen\_/5}), then only the two branches appear. - {\tt R=} right orientation. - \seesect{Twoterminal:}} + { Thermocouple drawn to the left (by default) of the {\sl + linespec} + line. If the {\sl linespec} length equals {\sl wid} (default + {\tt dimen\_/5}), then only the two branches appear. {\tt R=} + right orientation. \seesect{Twoterminal:}} \macrodef{thicklines\_}{thicklines_}{({\sl number})} {gen} {set line thickness in points} @@ -1923,40 +1979,40 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {gen} {set line thickness in points} \macrodef{threeD\_init}{threeD_init}{} - {3D} - {initialize 3D transformations (reads {\tt lib3D.m4})} + {3D} {initialize 3D transformations (reads {\tt lib3D.m4})} \macrodef{thyristor}{thyristor}{(\linespec,% {\tt [SCR|SCS|SUS|SBS|IEC][{\sl chars}]})} {cct} {Composite thyristor element in {\tt []}block: types - SCR: silicon controlled rectifier (default), - SCS: silicon controlled switch, - SUS: silicon unilateral switch, - SBS: silicon bilateral switch, - IEC: type IEC. + SCR: silicon controlled rectifier + (default), SCS: silicon controlled + switch, SUS: silicon unilateral switch, + SBS: silicon bilateral switch, IEC: + type IEC. {\sl Chars} to modify or define the element: - K: open arrowheads, - A: arrowhead, - F: half arrowhead, - B: bidirectional diode, - E: adds envelope, - H: perpendicular gate (endpoint G), - N: anode gate (endpoint Ga), - U: centre line in diodes - V: perpendicular gate across arrowhead centre, - R=right orientation, - E=envelope + K: open arrowheads, A: arrowhead, F: + half arrowhead, B: bidirectional diode, + E: adds envelope, H: perpendicular + gate (endpoint G), N: anode gate + (endpoint Ga), U: centre line in diodes + V: perpendicular gate across arrowhead + centre, + R=right orientation, E=envelope \seesect{Semiconductors:}} \macrodef{tikznode}{tikznode}{({\sl \Tikz node name, position}) } {pgf} {insert \Tikz code to define a zero-size \Tikz node at {\sl location} - (default {\tt Here}) to assist with inclusion of \pic code output in - \Tikz diagrams. This macro must be invoked in the outermost \pic scope. - \seesect{Tikzwithpic:}} + (default {\tt Here}) to assist with inclusion of \pic code output + in \Tikz diagrams. This macro must be invoked in the outermost + \pic scope. \seesect{Tikzwithpic:}} \macrodef{tline}{tline}{(\linespec,{\sl wid},{\sl ht}) } {cct} {transmission line, manhattan direction\seesect{Twoterminal:}} +\macrodef{ToPos}{ToPos}{({\sl position}, U|D|L|R|{\sl degrees}, {\sl length}) } + {gen} + {Evaluates to {\tt from {\sl position} - Rect\_({\sl length, angle}) to + {\sl position}} from the polar-coordinate data in the arguments } \macrodef{tr\_xy\_init}{tr_xy_init}{({\sl origin, unit size, sign })} {cct} {initialize {\tt tr\_xy}} @@ -1966,26 +2022,22 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{transformer}{transformer}{(\linespec,L|R,{\sl np},% [A|P][W|L][D1|D2|D12|D21],{\sl ns})} {cct} - {2-winding transformer or choke with terminals P1, P2, TP, S1, S2, TS: - arg2: L = left, R = right, - arg3: np primary arcs, - arg5: ns secondary arcs, - arg4: A = air core, P = powder (dashed) core, - W = wide windings, L = looped windings, - D1: phase dots at P1 and S1 end; D2 at P2 and S2 end; D12 at P1 and S2 end; - D21 at P2 and S1 end + {2-winding transformer or choke with terminals P1, P2, TP, S1, + S2, TS: + arg2: L = left, R = right, arg3: np primary arcs, arg5: ns secondary + arcs, arg4: A = air core, P = powder (dashed) core, W = wide windings, + L = looped windings, D1: phase dots at P1 and S1 end; D2 at P2 and + S2 end; D12 at P1 and S2 end; D21 at P2 and S1 end \seesect{Composite:}} \macrodef{tstrip}{tstrip}{(R|L|U|D|{\sl degrees, nterms, chars})} {cct} {terminal strip, chars: - I=invisible terminals, - C=circle terminals (default), - D=dot terminals, - O=omitted separator lines, - {\tt wid=}value{\tt ;} total strip width, + I=invisible terminals, C=circle terminals (default), D=dot terminals, + O=omitted separator lines, {\tt wid=}value{\tt ;} total strip width, {\tt ht=}value{\tt ;} strip height \seesect{Composite:}} -\macrodef{ttmotor}{ttmotor}{({\sl linespec, string, diameter, brushwid, brushht})} +\macrodef{ttmotor}{ttmotor}{({\sl linespec, string, diameter, brushwid, +brushht})} {cct} {motor with label\seesect{Twoterminal:}} \macrodef{twopi\_}{twopi_}{} @@ -1997,8 +2049,7 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {unijunction transistor, right, P-channel, envelope \seesect{Semiconductors:}} \macrodef{unit3D}{unit3D}{(x,y,z)} - {3D} - {unit triple in the direction of triple x,y,z} + {3D} {unit triple in the direction of triple x,y,z} \macrodef{up\_\_}{up__}{} {gen} {up with respect to current direction} @@ -2007,30 +2058,33 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {set current direction up \seesect{Placing:}} \Letter{V}% \macrodef{variable}{variable}{(`{\sl element}', - {\tt [A|P|L|[u]N|[u]NN][C|S]},{\sl angle},{\sl length})} + {\tt [A|P|L|[u]N|[u]NN][C|S]}, [+|-]{\sl angle}, + {\sl length}, at position)} {cct} {overlaid arrow or line to indicate variable 2-terminal element: - {\tt A}=arrow, {\tt P}=preset, - {\tt L}=linear, - {\tt N}= symmetric nonlinear, - {\tt C}=continuous, {\tt S}=setpwise; {\tt u} changes the - nonlinearity direction + {\tt A}=arrow, {\tt P}=preset, {\tt L}=linear, {\tt N}= symmetric + nonlinear, {\tt C}=continuous, {\tt S}=setpwise; {\tt u} changes + the nonlinearity direction. The angle is absolute but preceding + it with a sign makes the angle (often -30 or -45) relative to the + element drawing direction. If arg5 is blank the symbol is placed + over the last {\tt [ ]} block \seesect{Twoterminal:}} \macrodef{Vcoords\_}{Vcoords_}{({\sl position})} {gen} {The $x, y$ coordinate pair of the position} \macrodef{Vdiff\_}{Vdiff_}{({\sl position},{\sl position})} {gen} - {{\tt Vdiff\_(A,B)} evaluates to {\tt A-(B)} with dpic, {\tt A-(B.x,B.y)} + {{\tt Vdiff\_(A,B)} evaluates to {\tt A-(B)} with dpic, {\tt + A-(B.x,B.y)} with gpic} \macrodef{vec\_}{vec_}{({\sl x},{\sl y})} {gen} {position rotated with respect to current direction} \macrodef{View3D}{View3D}{} - {3D} - {The view vector (triple) defined by {\tt setview({\sl azim, elev})}. The - {\tt project} - macro projects onto the plane perpendicular to this vector} + {3D} {The view vector (triple) defined by {\tt setview({\sl azim, + elev})}. The + {\tt project} macro projects onto the plane perpendicular to this + vector} \macrodef{vlength}{vlength}{({\sl x},{\sl y})} {gen} {vector length $\sqrt{x^2+y^2}$} @@ -2039,7 +2093,8 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {unit-vector pair CCW-perpendicular to linear object} \macrodef{Vperp}{Vperp}{({\sl position name}, {\sl position name})} {gen} - {unit-vector pair CCW-perpendicular to line joining two named positions} + {unit-vector pair CCW-perpendicular to line joining two named + positions} \macrodef{vrot\_}{vrot_}{({\sl x},{\sl y},{\sl xcosine},{\sl ycosine})} {gen} {rotation operator} @@ -2051,7 +2106,8 @@ nw,nn,ne,ns,pin lgth,style, other commands})} {The vector in arg 1 multiplied by the scalar in arg 2} \macrodef{Vsum\_}{Vsum_}{({\sl position},{\sl position})} {gen} - {{\tt Vsum\_(A,B)} evaluates to {\tt A+B} with dpic, {\tt A+(B.x,B.y)} + {{\tt Vsum\_(A,B)} evaluates to {\tt A+B} with dpic, {\tt + A+(B.x,B.y)} with gpic} \Letter{W}% \macrodef{w\_}{w_}{} @@ -2071,8 +2127,8 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{XOR\_gate}{XOR_gate}{({\sl n},N)} {log} {`xor' gate, 2 or {\sl n\/} inputs; N=negated input. - Otherwise, arg1 can be a sequence of letters {\tt P|N} - to define normal or negated inputs. + Otherwise, arg1 can be a sequence of letters {\tt P|N} to define + normal or negated inputs. \seesect{Logicgates:}} \macrodef{XOR\_off}{XOR_off}{} {log} @@ -2084,4 +2140,10 @@ nw,nn,ne,ns,pin lgth,style, other commands})} \macrodef{xtract}{xtract}{({\sl string, substr1, substr2, $\ldots$})} {gen} {returns substrings if present} +\Letter{Y}% +\macrodef{Ysymbol}{Ysymbol}{(at {\sl position},keys, + U|D|L|R|{\sl degrees}) (default {\tt U} for up)} + {cct} + {Y symbol for power-system diagrams + {\sl keys:} {\tt size={\sl expression}; type=G}} % \end{tabbing} diff --git a/graphics/circuit_macros/doc/fetMan.m4 b/graphics/circuit_macros/doc/fetMan.m4 index 08498ef83d..9c39871378 100644 --- a/graphics/circuit_macros/doc/fetMan.m4 +++ b/graphics/circuit_macros/doc/fetMan.m4 @@ -1,11 +1,9 @@ .PS -# `fet.m4' +# `fetMan.m4' cct_init -dwn = 0.9 -dwn = 1.0 -rgt = 0.9 textht = 0.1 +define(`rmove',0.75) dnl `IRF4905(linespec,R)' define(`IRF4905', @@ -18,74 +16,84 @@ define(`IRF4905', G: Q.G circle rad 5*dimen_/10 at Q.tr_xy(0,1) ]') -define(`rmove',0.75) -define(`dir_',`right_') - -Orig: Here -dir_ - { move left 0.2 } - {J: j_fet(right_ dimen_,,,E) - "{\tt j\_fet(right\_ dimen\_,{,},E)}" wid 1.75 \ - with .nw at last [].sw+(0.0,-0.25) - "$G$" at last [].G rjust above - "$S$" at last [].S rjust - "$D$" at last [].D ljust - } - - move right_ 0.9; dir_ - {j_fet(,,P,) - "{\tt 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_ 0.9; dir_ - {e_fet(,R,,) - "{\tt e\_fet(,R,{,})}" at last [].s+(0,-0.05) below - "$G$" at last [].G rjust - "$S$" at last [].S rjust - "$D$" at last [].D ljust - } - - {move down_ dwn; dir_ - e_fet(,,P) - "{\tt e\_fet(,{,}P)}" at last [].s+(0.1,-0.2) below} - - move right_ 0.9; dir_ - {d_fet(,,,) - "{\tt d\_fet(,{,},)}" at last [].s+(0,-0.05) below} - - {move down_ dwn; dir_ - d_fet(,,P) - "{\tt d\_fet(,{,}P)}" at last [].s+(0,-0.05) below} - - move right_ 0.9; dir_ - {e_fet(,,,S) - "{\tt e\_fet(,{,},S)}" at last [].s+(0,-0.05) below} - - {move down_ dwn; dir_ - e_fet(,,P,S) - "{\tt e\_fet(,{,}P,S)}" at last [].s+(0,-0.2) below} - - move right_ 0.9; dir_ - {d_fet(,,,S) - "{\tt d\_fet(,{,},S)}" at last [].s+(0,-0.2) below} - - {move down_ dwn; dir_ - d_fet(,,P,S) - "{\tt d\_fet(,{,}P,S)}" at last [].s+(0,-0.05) below} - - move right_ 0.9; dir_ - {c_fet(,,,) - "{\tt `c\_fet'(,{,},)}" at last [].s+(0,-0.05) below} - - {move down_ dwn; dir_ - c_fet(,,P) - "{\tt `c\_fet'(,{,}P)}" at last [].s+(0,-0.2) below} +Row1: [ J: j_fet + { "{\tt j\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: j_fet(right_ dimen_,,P,E) with .w at J.e+(0.5,0) + { "{\tt j\_fet(right\_}" "{\tt dimen\_,{,}P,E)}" at J.s+(0,-13bp__) below + "$G$" at J.G rjust above + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: e_fet with .w at J.e+(0.5,0) + { "{\tt $\;$ e\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: e_fet(,,P) with .w at J.e+(0.6,0) + { "{\tt $\;$ e\_fet(,{,}P)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: e_fet(,,P,S) with .w at J.e+(0.7,0) + { "{\tt $\;$ e\_fet(,{,}P,S)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: c_fet with .w at J.e+(0.6,0) + { "{\tt $\;$ c\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: c_fet(,,P) with .w at J.e+(0.6,0) + { "{\tt $\;$ c\_fet(,{,}P)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + ] + +Row2: [ + J: d_fet + { "{\tt d\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: d_fet(,,P) with .w at J.e+(0.5,0) + { "{\tt d\_fet(,{,}P)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: d_fet(,,P,S) with .w at J.e+(0.7,0) + { "{\tt d\_fet(,{,}P,S)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: g_fet with .w at J.e+(0.6,0) + { "{\tt g\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: g_fet(up_ dimen_,,P) with .w at J.e+(0.6,0) + { "{\tt `g\_fet'(up\_$\;\;$}" at last [].s below + "{\tt dimen\_,{,}P)}" at last [].s + (0,-12bp__) below + "{\sl G}" at last [].G rjust + "{\sl S}" at last [].S + (0,2bp__) ljust + "{\sl D}" at last [].D + (0,2bp__) ljust below } + right_ + M1: mosfet(,,dBSDFQM1,E) with .w at J.e+(0.5,0) + "$G0$" at M1.G0 above rjust + "$G1$" at M1.G1 above ljust + {"\tt `mosfet'(,{,}dBSDFQM1,E)" wid 1.45 \ + with .nw at last [].sw+(0,-0.2) } + M2: mosfet(,,dBSDFQuM1) with .nw at M1.ne+(0.5,0) + "$G0$" at M2.G0 above ljust + "$G1$" at M2.G1 above rjust + {"\tt ...(,{,}dBSDFQuM1)" wid 1.25 \ + with .n at last [].s+(0,-0.05) } + ] with .nw at Row1.sw+(0,-0.1) -move down 1; right_ - [ +Row3: [ linewid = linewid*1.2 Q1: mosfet(,,dGSDF,) @@ -132,8 +140,22 @@ move down 1; right_ "$D$" at last [].D ljust "$B$" at last [].B below } - - move right_ rmove + move right_ + J: Fe_fet #(right_ dimen_) + {`"{\tt $\;$ Fe\_fet}"' at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + move right_ + J: Fe_fet(,,TEDQSuB) + {`"{\tt $\;$ Fe\_fet(,,TEDSQuB)}"' at J.s+(0,-0.15) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + ] with .nw at last [].sw + +Row4: [ + {move left 0.25} Q5: mosfet(,,ZSDFdT,) {"\tt `$\ldots$'(,{,}ZSDFdT,)" at last [].s+(0,-0.05) below thinlines_ @@ -144,8 +166,7 @@ move down 1; right_ arrow <- down .08 right .24 from (Q5.G.x,Q5.G.y-0.02) "\tt dT" ljust thicklines_ } - - move right_ rmove + move right_ 0.8 up_ Q6: IRF4905 with .c at Here {`"\tt IRF4905"' at Q6.s+(0,-0.15) below @@ -153,18 +174,6 @@ move down 1; right_ "$D$" at Q6.D ljust above "$S$" at Q6.S ljust below } - ] with .nw at J.sw+(0,-1.35) #Orig+(-0.26,-1.2) - - right_ - M1: mosfet(,,dBSDFQM1,E) with .nw at J.nw+(0,-dwn) - "$G0$" at M1.G0 above rjust - "$G1$" at M1.G1 above ljust - {"\tt `mosfet'(,{,}dBSDFQM1,E)" wid 1.45 \ - with .nw at last [].sw+(0,-0.23) } - M2: mosfet(,,dBSDFQuM1) with .nw at M1.ne+(0.5,0) - "$G0$" at M2.G0 above ljust - "$G1$" at M2.G1 above rjust - {"\tt ...(,{,}dBSDFQuM1)" wid 1.25 \ - with .n at last [].s+(0,-0.05) } + ] with .nw at last [].sw .PE diff --git a/graphics/circuit_macros/doc/oax.m4 b/graphics/circuit_macros/doc/oax.m4 deleted file mode 100644 index d2396d6ced..0000000000 --- a/graphics/circuit_macros/doc/oax.m4 +++ /dev/null @@ -1,5 +0,0 @@ -.PS -# `oax.m4' -cct_init -include(oaxbody.m4) -.PE diff --git a/graphics/circuit_macros/doc/opampex.m4 b/graphics/circuit_macros/doc/opampex.m4 new file mode 100644 index 0000000000..0edc3296c3 --- /dev/null +++ b/graphics/circuit_macros/doc/opampex.m4 @@ -0,0 +1,5 @@ +.PS +# `opampex.m4' +cct_init +include(opampexbody.m4) +.PE diff --git a/graphics/circuit_macros/doc/oaxbody.m4 b/graphics/circuit_macros/doc/opampexbody.m4 index 983b816cf5..983b816cf5 100644 --- a/graphics/circuit_macros/doc/oaxbody.m4 +++ b/graphics/circuit_macros/doc/opampexbody.m4 diff --git a/graphics/circuit_macros/doc/relaycoilMan.m4 b/graphics/circuit_macros/doc/relaycoilMan.m4 index b3273794cd..7966a32294 100644 --- a/graphics/circuit_macros/doc/relaycoilMan.m4 +++ b/graphics/circuit_macros/doc/relaycoilMan.m4 @@ -3,7 +3,7 @@ cct_init spc = dimen_/3 -{ relaycoil; S: "\tt re{}laycoil" at last [].s+(0,-20bp__) +{ relaycoil; S: `"\tt relaycoil"' at last [].s+(0,-16bp__) { "\sl V1" wid 10bp__ at last [].V1 rjust "\sl V2" at last [].V2 ljust } K: relaycoil(NX) with .nw at last [].ne+(spc*4,0); "\tt (NX)" at (last [],S) @@ -20,10 +20,12 @@ cct_init { "\sl V1" at last [].V1 rjust; "\sl V2" at last [].V2 rjust } relaycoil(BXSR) with .nw at last [].ne+(spc*2,0); "\tt (BXSR)" at (last [],S) { "\sl V1" at last [].V1 ljust; "\sl V2" at last [].V2 ljust } - relaycoil(SR) with .nw at last [].ne+(spc*4,0); "\tt (SR)" at (last [],S) + relaycoil(SR) with .nw at last [].ne+(spc*3,0); "\tt (SR)" at (last [],S) relaycoil(SO) with .nw at last [].ne+(spc,0); "\tt (SO)" at (last [],S) relaycoil(SOR) with .nw at last [].ne+(spc,0); "\tt (SOR)" at (last [],S) + relaycoil(PC) with .nw at last [].ne+(spc,0); "\tt (PC)" at (last [],S) } + spc = dimen_/4 { move down_ 3/4; right_ relaycoil(HS); S: "\tt (HS)" at last [].s+(0,-12bp__) @@ -35,6 +37,7 @@ cct_init relaycoil(RH) with .nw at last [].ne+(spc,0); "\tt (RH)" at (last [],S) relaycoil(TH) with .nw at last [].ne+(spc,0); "\tt (TH)" at (last [],S) relaycoil(EL) with .nw at last [].ne+(spc,0); "\tt (EL)" at (last [],S) + relaycoil(MR) with .sw at last [].se+(spc,0); "\tt (MR)" at (last [],S) } .PE diff --git a/graphics/circuit_macros/dpictools.pic b/graphics/circuit_macros/dpictools.pic index 0afd517ce7..6cbc945345 100644 --- a/graphics/circuit_macros/dpictools.pic +++ b/graphics/circuit_macros/dpictools.pic @@ -3,7 +3,7 @@ # m4 macro NeedDpicTools or the pic statement copy "HOMELIB_/dpictools.pic" # when HOMELIB_ is defined or, generically, copy "<path>dpictools.pic" -# Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under # +# Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under # # the LaTeX Project Public Licence in file Licence.txt. The files of # # this distribution may be redistributed or modified provided that this # # copyright notice is included and provided that modifications are clearly # @@ -66,8 +66,8 @@ define array { define array2 { for i_array=3 to $+ do { exec sprintf("$1[%g,%g]=$%g",$2,i_array-2,i_array);}} -# posarray(Var,position1,position2,...) -# Var[1]:position1; Var[2]:Position2,... +# posarray(Var,Position1,Position2,...) +# Var[1]:Position1; Var[2]:Position2,... define posarray { for i_array=2 to $+ do { exec sprintf("$1[%g] : $%g",i_array-1,i_array); }} diff --git a/graphics/circuit_macros/examples/AntiqueClock.m4 b/graphics/circuit_macros/examples/AntiqueClock.m4 deleted file mode 100644 index 814824bee7..0000000000 --- a/graphics/circuit_macros/examples/AntiqueClock.m4 +++ /dev/null @@ -1,149 +0,0 @@ -.PS -# AntiqueClock.m4 -gen_init -NeedDpicTools - -# PSTricks or tikz only: -ifelse(ifpstricks(T)`'ifpgf(T),T,` - -iflatex(`latexcommand({\sf)') - -# https://tex.stackexchange.com/questions/236923/generate-analog-clock-with-numbered-face-add-seconds-roman-numerals - -# `hms2deg(hr,min,sec) hr:min:sec to degrees -# blank arg1: degrees for minute hand -# blank arg1 and arg2: degrees for second hand' -define(`hms2deg',`ifelse(`$1',, - `ifelse(`$2',, - `(90-pmod(ifelse(`$3',,0,`$3'),60)/60*360)', - `(90-(pmod(`$2',60)/60 + pmod(ifelse(`$3',,0,`$3'),60)/60/60)*360)')', - `(90-(pmod(`$1',12) + pmod(ifelse(`$2',,0,`$2'),60)/60 + dnl - pmod(ifelse(`$3',,0,`$3'),60)/3600)/12*360)')') - -# `SecondHand(length,hr,min,sec)' -define(`SecondHand',`[ shsf = (`$1')/3.2 - C: Here - { L: rpoint_(to (Rect_(`$1',hms2deg(,,`$4')))) } - line thick 8*shsf to rvec_(`$1',0) - ]') - -# `AntiqueMinuteHand(length,hr,min,sec)' -define(`AntiqueMinuteHand',`[ mhsf = (`$1')/2.84 - L: rpoint_(to (Rect_(`$1',hms2deg(,`$3',`$4')))) - C: circle fill_(0) diam 0.47*mhsf at L.start - move to C - spline from rvec_(0,0.047*mhsf) \ - to rvec_(1.65*mhsf,0.11*mhsf) \ - then to rvec_(`$1',0.018*mhsf) \ - then to rvec_(`$1',-0.018*mhsf) \ - then to rvec_(1.65*mhsf,-0.11*mhsf) \ - then to rvec_(0,-0.047*mhsf) \ - shaded rgbstring(0,0,0) - ]') - -# `AntiqueHourHand(length,hr,min,sec)' -define(`AntiqueHourHand',`[ hhsf = (`$1')/2.2 - L: rpoint_(to (Rect_(`$1',hms2deg(`$2',`$3',`$4')))) - C: circle fill_(0) diam 0.6*hhsf at L.start - move to C - v = 0.25*hhsf - { line to rvec_(1.1*hhsf,0) thick 0.15/(1bp__)*hhsf } - { C1: circle rad v at rvec_(1.25*hhsf,0) fill_(0) } - d = `$1'-1.25*hhsf - q = 1bp__*hhsf - r1 = (d^2 + q^2 - v^2)/(v-q)/2 - h = r1+v - shade(0, - arc ccw from C1+vec_(d/h*v,(r1+q)/h*v) to \ - C1+vec_(d,q) rad r1 with .c at C1+vec_(d,r1+q) - arc ccw from C1+vec_(d,-q) to C1+vec_(d/h*v,-(r1+q)/h*v) rad r1 \ - with .c at C1+vec_(d,-r1-q)) - ]') - -define(`AntiqueClock',`[ # h,m,s,diam -# Clock size parameters: - hour = ifelse(`$1',,3,`$1') - minute = ifelse(`$2',,41,`$2') - second = ifelse(`$3',,51,`$3') - # outer radius - ifelse(`$4',,`skale=0.5; r1=2',`r1=(`$4')/2; skale=r1/4') - r2 = r1-0.5*skale - r3 = r2-0.14*skale - r4 = r3 - 0.35*skale - r5 = r4 - 0.17*skale - r6 = r5 - 0.63*skale - r7 = r6 - 0.17*skale - shadelinethick = 1.0 - -C: circle thick 0.2 rad r1 - -define shadeline { - s = 1-($`'1)*2 - v = r*s - h = sqrt(r^2-v^2) - t = 1-abs(s) - line from (vrot_(-h,v,cost,sint)) to (vrot_(h,v,cost,sint)) \ - thick shadelinethick outlined rgbstring(t,t,t) - } - - r = r1 # Bezel outer - nlines = int(2*r/(shadelinethick pt__)*1.1) - cost = cosd(10); sint = sind(10); - ShadeObject(shadeline,nlines, 0, 0,0,0, 0.5, 1,1,1, 1, 0,0,0 ) at C - - r = r2 # Bezel inner - nlines = int(2*r/(shadelinethick pt__)*1.1) - cost = cosd(-10); sint = sind(-10); - ShadeObject(shadeline,nlines, 0, 0,0,0, 0.25, 0.8,0.8,0.8, 0.5, 1,1,1, - 0.75, 0.8,0.8,0.8, 1, 0,0,0 ) at C - -# Clock face -Face: circle thick 0 fill_(1) rad r3 at C - circle rad r4 at C - circle rad r5 at C - circle rad r6 at C - circle rad r7 at C - -# Text rotation for PSTricks or TikZ - define(`rottext', - `ifpstricks(`\rput[c]{%g}(0,0)',`ifpgf(`\pgftext[rotate=%g]',%g)')') -# Outer numbers - command sprintf("\font\outerfont=cmss12 at %4.2fin",r3-r4) - for mn = -15 to 15 by 5 do { sprintf("rottext{\outerfont %g}",\ - -mn/60*360,pmod(mn,60)) at C+(Rect_((r3+r4)/2,90-mn/60*360)) } - for mn = 20 to 40 by 5 do { sprintf("rottext{\outerfont %g}",\ - 180-mn/60*360,mn) at C+(Rect_((r3+r4)/2,90-mn/60*360)) } -# Outer tics - for mn = 1 to 60 do { t = 90-mn/60*360 - line from C+(Rect_(r5,t)) to C+(Rect_(r4,t)) } - -# Inner numbers - command sprintf("\font\innerfont=cmss12 at %4.2fin",r5-r6) - Loopover_(`mx',`t = (m4Lx-4)/12*360; - sprintf("rottext{\scalebox{0.7}[1.0]{\innerfont mx}}",-t) \ - at C+(Rect_((r5+r6)/2,90-t))', IX,X,XI,XII,I,II,III) - Loopover_(`mx',`t = (m4Lx+3)/12*360; - sprintf("rottext{\scalebox{0.7}[1.0]{\innerfont mx}}",-t+180) \ - at C+(Rect_((r5+r6)/2,90-t))', IV,V,VI,VII,VIII) - -# Inner tics - for mn = 5 to 60 by 5 do { t = 90-mn/60*360 - line from C+(Rect_(r7,t)) to C+(Rect_(r6,t)) } - -# Hands - AntiqueHourHand(r6,hour,minute,second) with .C at C - AntiqueMinuteHand(r5,hour,minute,second) with .C at C - SecondHand((r3+r4)/2,hour,minute,second) with .C at C - -# Center - dot(at C,0.1/4*r1,1) - ]') - - Clock1: AntiqueClock(,,,3) -# Clock2: AntiqueClock(4,50,07,2) at Clock1.e+(1.5,0) - - iflatex(`latexcommand(})') - -',` "AntiqueClock.m4 requires pstricks or pgf" ') - -.PE diff --git a/graphics/circuit_macros/examples/ArrowFn.m4 b/graphics/circuit_macros/examples/ArrowFn.m4 new file mode 100644 index 0000000000..68c6d9724e --- /dev/null +++ b/graphics/circuit_macros/examples/ArrowFn.m4 @@ -0,0 +1,55 @@ +.PS +# ArrowFn.m4 +# https://tex.stackexchange.com/questions/581089/arrow-function-diagrams +gen_init + brad = 0.04 + bht = 0.4 + bwid = 0.25 +define(`rbox',`box rad brad outlined "Orange"') + +B1: [ + linethick = 1.2 + arrowwid = 0.08 + rbox wid 5*boxwid ht 3/2*boxwid + line from last box.w-(bht/4,0) "\Large $X$" above ljust +T: Here + arrow up bwid right bwid then right bwid +F: rbox ht bht "\Large $f$" + {"\Large $Y$" above ljust } + arrow down bwid right bwid from T then right boxwid + bwid*3/2 +G: rbox ht bht "\Large $g$" + {"\Large $Z$" above ljust } +S: circle diam bht "\Large $+$" at (G.e.x+boxwid,(F.y+G.y)/2) + d = F.y-S.nw.y + arrow from F.e to S.nw+(-d,d) then to S.nw + arrow from G.e to S.sw+(-d,-d) then to S.sw + arrow right from S.e + ] +[ + bht = bht/2 + sbwid = boxwid*3/4 + bbwid = sbwid*5/4 + dh = bht/2 +B1: rbox wid bbwid ht bbwid +B2: rbox wid sbwid*3/2 ht bbwid at B1+(3/2*bbwid,0) +B3: rbox wid bbwid ht bbwid at B2+(3/2*bbwid,0) +B4: rbox wid sbwid*3/2 ht bbwid at B3+(3/2*bbwid,0) +B5: rbox wid bbwid ht bbwid at B4+(3/2*bbwid,0) + F: rbox ht bht wid sbwid at B2.n-(0,bht*3/4) "$f$" +BR: B2.s+(0,B2.n.y-F.y) + G: rbox ht bht wid sbwid at (B4,F) "$g$" + S: circle diam bht*3/2 at B5+(bht/2,0) "$+$" + arrow right from S.e + T: B1.w+(dh,0) +B: rbox ht bbwid*5/4 wid boxwid*7.25 with .w at T-(sbwid*3/4,0) + { line from T left sbwid "$x$" above ljust } + arrow from T to (B1.e-(dh,0),F) then to F.w + arrow from F.e to (B3.w+(dh,0),F) then to (B3.e-(dh,0),BR) + continue to (B5.w+(dh,0),Here) then to S.sw + line thick 5 outlined "white" from B3.sw to B3.ne chop brad + arrow from T to (B1.e-(dh,0),BR) then to (B3.w+(dh,0),BR) \ + then to (B3.e-(dh,0),G) then to G.w + arrow from G.e to (B5.w+(dh,0),G) then to S.nw + ] with .nw at B1.sw+(0,-0.2) + +.PE diff --git a/graphics/circuit_macros/examples/Ball.m4 b/graphics/circuit_macros/examples/Ball.m4 index 8c022223ef..e551dff845 100644 --- a/graphics/circuit_macros/examples/Ball.m4 +++ b/graphics/circuit_macros/examples/Ball.m4 @@ -29,19 +29,19 @@ command "\small{" ifpstricks( `command "\pscustom[fillstyle=gradient,gradmidpoint=1.0,%" command sprintf("gradbegin=gray,gradend=white,gradlines=%g]{",rectwid*200)') - line from project(-rectht/2,-rectwid*1/3,0) \ - to project( rectht/2,-rectwid*1/3,0) \ - then to project( rectht/2, rectwid*2/3,0) \ - then to project(-rectht/2, rectwid*2/3,0) \ - then to project(-rectht/2,-rectwid*1/3,0) + line from Project(-rectht/2,-rectwid*1/3,0) \ + to Project( rectht/2,-rectwid*1/3,0) \ + then to Project( rectht/2, rectwid*2/3,0) \ + then to Project(-rectht/2, rectwid*2/3,0) \ + then to Project(-rectht/2,-rectwid*1/3,0) ifpstricks(command "}%") define(`C3D',`0,0,alpha') # Centre of the sphere - C: project(C3D) + C: Project(C3D) # Shaded sphere ifelse(m4postprocessor,pstricks, - `Highlight: project(sum3D(C3D,rot3Dz(-15*dtor_,rot3Dy(-60*dtor_,alpha,0,0)))) + `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,%" @@ -54,18 +54,18 @@ command "\small{" C.x,C.y,alpha/2.54)', `circle rad alpha at C fill_(1) ') - S: "$S$" at project(0,0,0) rjust # The sphere bottom touch point + S: "$S$" at Project(0,0,0) rjust # The sphere bottom touch point "$\alpha$" at 0.5<S,C> rjust define(`N3D',`0,0,2*alpha') # North pole - N: "N" at project(N3D) ljust above + N: "N" at Project(N3D) ljust above phi = 65*dtor_ define(`Phat3D',`rot3Dz(phi,alpha*2.7,0,0)') - Phat: "$\hat{P}$" at project(Phat3D) ljust + Phat: "$\hat{P}$" at Project(Phat3D) ljust - X: project(rectht/2*0.8,0,0) - Y: project(0,rectwid/2*0.8,0) + 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 Xb $2 = distance(($1 between S and Xb),C)-alpha } @@ -84,8 +84,8 @@ thinlines_ # axes arrow up alpha*0.5 chop 0.05 chop 0 ; "$z,\:\zeta$" above ljust 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)) + arc ccw -> rad alpha from Project(alpha/2,0,0) to \ + Project(rot3Dz(phi,alpha/2,0,0)) "$\phi$" below at 0.5 between last arc.start and last arc.end # vector (ratio along (N to Phat)) @@ -94,7 +94,7 @@ define(`ray',`sum3D(N3D,sprod3D($1,diff3D(Phat3D,N3D)))') $2 = length3D(diff3D(ray($1),C3D))-alpha } bisect( rayvis, 1e-3, 1, 1e-8, p ) # Find P - P: "$P$" at project(ray(p)) ljust above + P: "$P$" at Project(ray(p)) ljust above thicklines_ line dashed from N to P chop 0 chop 0.05 @@ -108,11 +108,11 @@ thinlines_ # Draw the meridian bisect( 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 } + 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 } + Q[n]: Project(sum3D(C3D,meridian(ang))); n+=1 } fitcurve(Q,n-1,dashed) define(`equator',`rot3Dz($1,alpha,0,0)') @@ -122,15 +122,15 @@ define(`equator',`rot3Dz($1,alpha,0,0)') bisect( 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 } + 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 } + 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))) + 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 "$\beta$" above diff --git a/graphics/circuit_macros/examples/Buttons.m4 b/graphics/circuit_macros/examples/Buttons.m4 index 1eab236249..e7e5b004dc 100644 --- a/graphics/circuit_macros/examples/Buttons.m4 +++ b/graphics/circuit_macros/examples/Buttons.m4 @@ -3,6 +3,7 @@ gen_init NeedDpicTools + divert(-1) ################################################################# diff --git a/graphics/circuit_macros/examples/Capacitors.m4 b/graphics/circuit_macros/examples/Capacitors.m4 new file mode 100644 index 0000000000..d2586f1b9b --- /dev/null +++ b/graphics/circuit_macros/examples/Capacitors.m4 @@ -0,0 +1,38 @@ +.PS +# `Capacitors.m4' +cct_init + +movewid = 2 pt__ +hm = 2.05 +vm = 0.28 +{ {capacitor ; move ;"`{\tt capacitor}'" ljust} + move right_ hm + {capacitor(,C); move ;"`{\tt capacitor(,C)}'" ljust} + move right_ hm + {capacitor(,C+); move ;"`{\tt capacitor(,C+)}'" ljust} +} + move down vm; right_ +{ {capacitor(,P); move ;"`{\tt capacitor(,P)}'" ljust} + move right_ hm + {capacitor(,E); move ;"`{\tt capacitor(,E)}'" ljust} + move right_ hm + {capacitor(,K); move ;"`{\tt capacitor(,K)}'" ljust} +} + move down 0.25; right_ +{ {capacitor(,M); move ;"`{\tt capacitor(,M)}'" ljust} + move right_ hm + {capacitor(,N); move ;"`{\tt capacitor(,N)}'" ljust} + move right_ hm + {xtal ; move ;"`{\tt xtal}'" ljust} +} + move down 0.25; right_ +{ {capacitor(,dC); move ;"`{\tt capacitor(,dC)}'" ljust} + move right_ hm + {capacitor(,dF); move ;"`{\tt capacitor(,dF)}'" ljust} + move right_ hm + {variable(`capacitor',NN,-30,dimen_/3) + move ;`"{\tt variable(}`{\tt capacitor',}"' ljust \ + `"{\enskip\tt NN,-30,dimen\_/3)}"' ljust + } +} +.PE diff --git a/graphics/circuit_macros/examples/CctTable.m4 b/graphics/circuit_macros/examples/CctTable.m4 deleted file mode 100644 index 443c398b46..0000000000 --- a/graphics/circuit_macros/examples/CctTable.m4 +++ /dev/null @@ -1,93 +0,0 @@ -.PS -# `CctTable.m4' -cct_init - -movewid = 2 pt__ -hm = 2.05 -vm = 0.28 -{ {resistor ; move ;"`{\tt resistor}'" ljust} - move right_ hm - {resistor(,,Q) ; move ;"`\tt resistor(,{,}Q) '" ljust} - move right_ hm - {resistor(,,E) ; move - "`\shortstack[l]{\tt resistor(,{,}E)\\ {\tt $\equiv$ ebox}}'" ljust} -} - move down vm; right_ -{ {resistor(,,ES) ; move ;"`\tt resistor(,{,}ES) '" ljust} - move right_ hm - {resistor(,,H) ; move ;"`\tt resistor(,{,}H) '" ljust} - move right_ hm - {ebox(,,,0.5) ; move ;"`{\tt ebox(,{,},0.5)}'" ljust} -} - move down vm; right_ -{ {resistor(,,V) ; move ;"`{\tt resistor(,{,}V)}'" ljust} - move right_ hm - {move down_ 0.05; right_ - thermocouple ; move;"`{\tt thermocouple}'" ljust; move up_ 0.05} - move right_ hm - {ebox(,0.5,0.3) ; move ;"`{\tt ebox(,0.5,0.3)}'" ljust} -} - move down vm; right_ -{ {inductor ; move ;"`{\tt inductor}'" ljust} - move right_ hm - {inductor(,W); move ;"`{\tt inductor(,W)}'" ljust} - move right_ hm - {inductor(,L); move ;"`{\tt inductor(,L)}'" ljust} -} - move down vm; right_ -{ {inductor(,,,M) ; move ;"`{\tt inductor(,{,},M)}'" ljust} - move right_ hm - {inductor(,W,6,P); move ;"`{\tt inductor(,W,6,P)}'" ljust} - move right_ hm - {move right_ 0.2; ttmotor(,G) ; move ;"`{\tt ttmotor(,G)}'" ljust} -} - move down vm; right_ -{ {capacitor ; move ;"`{\tt capacitor}'" ljust} - move right_ hm - {capacitor(,C); move ;"`{\tt capacitor(,C)}'" ljust} - move right_ hm - {capacitor(,C+); move ;"`{\tt capacitor(,C+)}'" ljust} -} - move down vm; right_ -{ {capacitor(,P); move ;"`{\tt capacitor(,P)}'" ljust} - move right_ hm - {capacitor(,E); move ;"`{\tt capacitor(,E)}'" ljust} - move right_ hm - {capacitor(,K); move ;"`{\tt capacitor(,K)}'" ljust} -} - move down 0.25; right_ -{ {capacitor(,M); move ;"`{\tt capacitor(,M)}'" ljust} - move right_ hm - {capacitor(,N); move ;"`{\tt capacitor(,N)}'" ljust} - move right_ hm - {xtal ; move ;"`{\tt xtal}'" ljust} -} - move down 0.25; right_ -{ {memristor ; move;"`{\tt memristor}'" ljust} - move right_ hm - {heater; move;"`{\tt heater}'" ljust} - move right_ hm - {tline ; move;"`{\tt tline}'" ljust} -} - move down 0.25; right_ -{ {move up_ 0.05; right_; gap ; move ;"`{\tt gap}'" ljust} - move right_ hm - {gap(,,A) ; move ;"`{\tt gap(,{,}A)}'" ljust} - move right_ hm - {arrowline ; move;"`{\tt arrowline}'" ljust} -} - move down 0.25; right_ -{ {lamp ; move;"`{\tt lamp}'" ljust} - move right_ hm - {reed ; move ;"`{\tt reed}'" ljust} - move right_ hm - {reed(,,,fill_(0.9),CR) ; move ; "`{\tt reed(,{,},fill\_(0.9),CR)}'" ljust} -} - move down 0.25; right_ -{ {pvcell ; move;"`{\tt pvcell}'" ljust} - move right_ hm - {arrester ; move ;"`{\tt arrester}'" ljust} -} - - -.PE diff --git a/graphics/circuit_macros/examples/Chips.m4 b/graphics/circuit_macros/examples/Chips.m4 new file mode 100644 index 0000000000..f9e98bc076 --- /dev/null +++ b/graphics/circuit_macros/examples/Chips.m4 @@ -0,0 +1,45 @@ +.PS +# Chips.m4 +log_init +include(ics.m4) + + command "{\sf" + +Chips: [ + ic4017 + {"\sf 4017" at last [].Chip.sw below ljust} + move + ic4510 + {"\sf 4510" at last [].Chip.sw below ljust} + move + icVS1053 + {"\sf VS1053" at last [].Chip.sw below ljust} + + DIP_chip_outline with .sw at last [].se+(0.5,0) + { `"DIP\_chip\_outline"' at last [].s below } + ] + +DIPs: [ + DIP0: DIP + DIP32: DIP(32,direct=R;bodywid=0.5*scale) with .sw at last [].se+(0.5,0) + DIP16: DIP(16,type=Q;pinwid=1bp__) with .sw at DIP32.se+(1.5,0) + + thinlines_ + { `"\tt DIP"' at DIP0.s - (0,10bp__) } + { arrow <- from DIP0.Pin1 up 0.2 ; `"\sl Pin1"' ljust at Here+(-0.05,0.1) } + { arrow <- from DIP0.c up 0.7 right 0.25; `"\sl Body"' ljust } + { arrow <- from DIP0.Pin8 up 0.25 right 0.2 ; `"\sl Pin8"' above ljust } + + { `"\tt DIP(32,direct=R;bodywid=0.5*scale)"' ljust \ + at DIP32.sw - (0,10bp__) } + { arrow <- right 0.2 from DIP32.Pin1; `"\sl Pin1"' ljust } + { spline <- right 0.2 then right 0.1 up 0.1 from DIP32.Pin32 + `"\sl Pin32"' ljust } + + { `"\tt DIP(16,type=Q;pinwid=1bp\_\_)"' at DIP16.sw - (0,10bp__) ljust } + thicklines_ + + ] with .nw at last [].sw+(0,-0.3) + + command "}%" +.PE diff --git a/graphics/circuit_macros/examples/Chuck.m4 b/graphics/circuit_macros/examples/Chuck.m4 index 2e36626c5b..2c5dfb76f3 100644 --- a/graphics/circuit_macros/examples/Chuck.m4 +++ b/graphics/circuit_macros/examples/Chuck.m4 @@ -1,6 +1,6 @@ .PS # Chuck.m4 -threeD_init s_init(Views) sinclude(tst.dim) +gen_init s_init(Views) sinclude(tst.dim) # ################################################################# divert(-1) diff --git a/graphics/circuit_macros/examples/Conn.m4 b/graphics/circuit_macros/examples/Conn.m4 index 1e5fd5781a..7229f0afee 100644 --- a/graphics/circuit_macros/examples/Conn.m4 +++ b/graphics/circuit_macros/examples/Conn.m4 @@ -65,5 +65,4 @@ B: [ { `"\tt tbox(V\_1,{,},<>)"' at last [].s below } ] with .nw at T.sw+(0,-0.2) - .PE diff --git a/graphics/circuit_macros/examples/Connectors.m4 b/graphics/circuit_macros/examples/Connectors.m4 index 64ed3e6854..c9f8cd9019 100644 --- a/graphics/circuit_macros/examples/Connectors.m4 +++ b/graphics/circuit_macros/examples/Connectors.m4 @@ -1,9 +1,10 @@ .PS -# Connectors +# Connectors.m4 log_init include(ics.m4) ifelse(ifpgf(T)`'ifpstricks(T)`'ifpsfrag(T),T,`command "{\small\sf"') + # ArduinoUno Ar: ArduinoLeonardo #with .sw at last [].se+(0.25,0) diff --git a/graphics/circuit_macros/examples/Cruller.m4 b/graphics/circuit_macros/examples/Cruller.m4 index dce4f3aa87..d2c215ae13 100644 --- a/graphics/circuit_macros/examples/Cruller.m4 +++ b/graphics/circuit_macros/examples/Cruller.m4 @@ -52,10 +52,10 @@ 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))) + 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 ) \ diff --git a/graphics/circuit_macros/examples/Dini.m4 b/graphics/circuit_macros/examples/Dini.m4 index 5631a4822f..1846917a4a 100644 --- a/graphics/circuit_macros/examples/Dini.m4 +++ b/graphics/circuit_macros/examples/Dini.m4 @@ -46,10 +46,10 @@ define(`Dini', du = ur/ugrid/2 dv = vr/vgrid/2 for i=0 to n do { - NE: project(Dini(ciu[ix[i]]+du,civ[ix[i]]+dv)) - SE: project(Dini(ciu[ix[i]]+du,civ[ix[i]]-dv)) - SW: project(Dini(ciu[ix[i]]-du,civ[ix[i]]-dv)) - NW: project(Dini(ciu[ix[i]]-du,civ[ix[i]]+dv)) + NE: Project(Dini(ciu[ix[i]]+du,civ[ix[i]]+dv)) + SE: Project(Dini(ciu[ix[i]]+du,civ[ix[i]]-dv)) + SW: Project(Dini(ciu[ix[i]]-du,civ[ix[i]]-dv)) + NW: Project(Dini(ciu[ix[i]]-du,civ[ix[i]]+dv)) f = (-cos(ciu[ix[i]])+1)/2 g = ( sin(ciu[ix[i]])+1)/2 line from NE to SE then to SW then to NW then to NE \ @@ -174,9 +174,9 @@ array2(h,m4inx,53,54,55,58,59,57) } for i=1 to n do { for j=1 to 6 do { x[j]=h[ih[i],j] } - line from project((v[x[1],1]),(v[x[1],2]),(v[x[1],3]))\ - for_(2,6,1,`to project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ - to project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0.95) + line from Project((v[x[1],1]),(v[x[1],2]),(v[x[1],3]))\ + for_(2,6,1,`to Project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ + to Project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0.95) } m = 0 for i=1 to 12 do { # Visible pentagons @@ -185,9 +185,9 @@ array2(h,m4inx,53,54,55,58,59,57) } for i=1 to m do { for j=1 to 5 do { x[j]=p[ip[i],j] } - line from project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) \ - for_(2,5,1,`to project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ - to project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0) + line from Project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) \ + for_(2,5,1,`to Project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ + to Project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0) } ] scaled 2.5 with .sw at last [].se+(1,0) .PE diff --git a/graphics/circuit_macros/examples/Escher.m4 b/graphics/circuit_macros/examples/Escher.m4 index 675fa2c00d..f8bae7f728 100644 --- a/graphics/circuit_macros/examples/Escher.m4 +++ b/graphics/circuit_macros/examples/Escher.m4 @@ -1,51 +1,161 @@ .PS +# Escher.m4 +# https://tex.stackexchange.com/questions/129274/showcase-of-optical-illusions-made-with-tex-latex-luatex-context threeD_init +[ + u=1/2.54 # unit size; could use scale for this + + define(`treadcolor',`0.8,0.75,0.7') + define(`darkgrn',`.1,.1,0') + define(`lightgrn',`.7,.7,.6') + + define(`northsteps',3) + define(`eaststeps',8) + define(`southsteps',7) + define(`weststeps',4) + define(`baselayers',10) + define(`eb',eval(baselayers+eaststeps)) + define(`ebs',eval(eb+southsteps)) + define(`under',7) + + azimuth = -45 # view angles + elevation = 25 + setview(azimuth,elevation,0) + # projected unit vectors + UX: Project(u,0,0) + UY: Project(0,-u,0) + UZ: Project(0,0,u) + # layer thickness in units of u + f= -(eaststeps*UX.y + southsteps*UY.y - weststeps*UX.y - northsteps*UY.y)/dnl + ((eaststeps+southsteps+weststeps+northsteps)*UZ.y) + # XY projection of 3D coords in units of u +define proj {UX*($1)+UY*($2)+UZ*($3)} + +define tread {line from UY/2 \ + to UY then to UY+UX then to UX then to (0,0) \ + then to UY/2 shaded rgbstring(treadcolor) \ + with .start at proj($1,$2,$3)+UY/2 } + +define wrect {line invis from (0,0) to UX*($4) \ + then to UX*($4)+UZ*($5) \ + then to UZ*($5) then to (0,0) with .start at proj($1,$2,$3) \ + shaded rgbstring(r,g,b)} + +define srect {line invis from (0,0) to UY*($4) then to UY*($4)+UZ*($5) \ + then to UZ*($5) then to (0,0) with .start at proj($1,$2,$3) \ + shaded rgbstring(r,g,b) } + # color blending +define(`blendwht',`between3D(`$1',`$2',`$3',`$4',1,1,1)') +define makergb { r = $1; g = $2; b = $3 } +define dorgb { gg = $2 + if $1==0 then { makergb(blendwht(gg,lightgrn)) } \ + else { makergb(blendwht(gg,darkgrn)) } } + +# East + for i=-under to baselayers do { + dorgb((i%2),0.2) + wrect(1,1,i*f,eaststeps-2,-f) } + for i=0 to eaststeps do { + dorgb((i%2),0.2) + wrect(i,1,(baselayers+i)*f,(eaststeps+1-i),-f) + tread(i,0,(baselayers+i)*f) + line from proj(i,1,(baselayers+i)*f) \ + to proj(i,1,(baselayers-1+i)*f) } +# South + for i=0 to eb do { + dorgb((i%2),0.4) + srect(eaststeps+1,0,i*f,southsteps+1,-f) } + for i=1 to southsteps do { + dorgb((i%2),0.4) + srect(eaststeps+1,i,(eb+i)*f,(southsteps+1-i),-f) + tread(eaststeps,i,(eb+i)*f) + line from proj(eaststeps+1,i,(eb+i)*f) \ + to proj(eaststeps+1,i,(eb+i-1)*f) } +# North + for i=-under to baselayers-northsteps-1 do { + dorgb((i%2),0.1) + srect(1,1,i*f,northsteps-1,-f) } + for i=1 to northsteps do { + dorgb((i%2),0.1) + srect(1,1,(baselayers-i)*f,i,-f) + wrect(0,1+i,(baselayers-i)*f,1,-f) + line from proj(0,1+i,(baselayers-i)*f) \ + to proj(0,1+i,(baselayers-i-1)*f) + line from proj(1,1+i,(baselayers-i)*f) \ + to proj(1,1+i,(baselayers-i-1)*f) + tread(0,i,(baselayers-i)*f) } +# West + for i=0 to ebs do { + dorgb((i%2),0.4) + wrect(eaststeps+1,southsteps+1,i*f,-(weststeps+1),-f) } + for i=0 to weststeps-1 do { + dorgb((i%2),0.4) + wrect(eaststeps-i,southsteps+1,(ebs+i+1)*f,-(weststeps-i),-f,) + srect(eaststeps-i,southsteps,(ebs+i+1)*f,1,-f) + if i!=weststeps-1 then { + line from proj(eaststeps-i,southsteps,(ebs+i+1)*f) \ + to proj(eaststeps-i,southsteps,(ebs+i)*f) } + line from proj(eaststeps-i,southsteps+1,(ebs+i+1)*f) \ + to proj(eaststeps-i,southsteps+1,(ebs+i)*f) + tread(eaststeps-(i+1),southsteps,(ebs+i+1)*f) } +# Corner lines + define(`dgreen',`outlined rgbstring(blendwht(0.2,darkgrn))') + line dgreen from proj(1,1,(baselayers-1)*f) to proj(1,1,-under*f) + line dgreen from proj(eaststeps+1,southsteps+1,ebs*f) \ + to proj(eaststeps+1,southsteps+1,-f) + line dgreen from proj(0,northsteps+1,(baselayers-northsteps)*f) \ + to last line.end-UX*(weststeps+1) then to last line.end \ + then to proj(eaststeps+1,0,-f) then to proj(eaststeps+1,0,eb*f) + ] + +ifelse(1,1,` +[ setview(-45,20) bwid = 2.8 bh = 1.5 bdp = 1.8 bth = 0.3 - A: project(0,0,0) - AA: A+(project(bth,bth,-bth)) - B: project(0,bwid,0) - BB: B+(project(bth,-bth,-bth)) - C: project(bdp,bwid,0) - D: project(bdp,0,0) - E: project(0,0,-bh) - F: project(bdp,0,-bh) - G: project(bdp,bwid,-bh) - H: B + (project(0,0,-bh)) + A: Project(0,0,0) + AA: A+Project(bth,bth,-bth) + B: Project(0,bwid,0) + BB: B+Project(bth,-bth,-bth) + C: Project(bdp,bwid,0) + D: Project(bdp,0,0) + E: Project(0,0,-bh) + F: Project(bdp,0,-bh) + G: Project(bdp,bwid,-bh) + H: B + Project(0,0,-bh) line from A to B then to C then to D then to A then to E then to F \ then to G then to H then to E line from C to G - line from A+(project(bth,bth,0)) to B+(project(bth,-bth,0)) \ - then to C+(project(-bth,-bth,0)) - L1: line to D+(project(-bth,bth,0)) - L2: line to A+(project(bth,bth,0)) - L4: line from E+(project(bth,bth,0)) to H+(project(bth,-bth,0)) - L3: line to C+(project(-bth,-bth,-bh)) - line to F+(project(-bth,bth,0)) then to A+(project(bth,bth,-bh)) - - L5: line from D+(project(-bth,0,-bth)) to A+(project(bth,0,-bth)) - line to E+(project(bth,0,bth)) - L6: line to Here+(project(0,bwid-2*bth,0)) - L7: line from D+(project(0,bth,-bth)) to C+(project(0,-bth,-bth)) - line to G+(project(0,-bth,bth)) - L8: line to Here+(project(-bdp+2*bth,0,0)) - Tmp: line invis from L8.start+(project(-bth,0,0)) up bh + line from A+Project(bth,bth,0) to B+Project(bth,-bth,0) \ + then to C+Project(-bth,-bth,0) + L1: line to D+Project(-bth,bth,0) + L2: line to A+Project(bth,bth,0) + L4: line from E+Project(bth,bth,0) to H+Project(bth,-bth,0) + L3: line to C+Project(-bth,-bth,-bh) + line to F+Project(-bth,bth,0) then to A+Project(bth,bth,-bh) + + L5: line from D+Project(-bth,0,-bth) to A+Project(bth,0,-bth) + line to E+Project(bth,0,bth) + L6: line to Here+Project(0,bwid-2*bth,0) + L7: line from D+Project(0,bth,-bth) to C+Project(0,-bth,-bth) + line to G+Project(0,-bth,bth) + L8: line to Here+Project(-bdp+2*bth,0,0) + Tmp: line invis from L8.start+Project(-bth,0,0) up bh line from Tmp.start to Intersect_(Tmp,L7) Tmp: line invis from L8.end up bh line from L8.end to Intersect_(Tmp,L7) - line from Intersect_(Tmp,L1) to BB+(project(bth,0,0)) - Tmp: line invis to Here+(project(bdp,0,0)) + line from Intersect_(Tmp,L1) to BB+Project(bth,0,0) + Tmp: line invis to Here+Project(bdp,0,0) line from Tmp.start to Intersect_(Tmp,L1) Tmp: line invis from H up bh line from H to Intersect_(Tmp,L7) - line from Intersect_(Tmp,L1) to B+(project(bth,-bth,0)) + line from Intersect_(Tmp,L1) to B+Project(bth,-bth,0) - Tmp: line invis from AA to AA+(project(0,bwid,0)) + Tmp: line invis from AA to AA+Project(0,bwid,0) Tmp2: line invis up bh from L6.end line from Intersect_(Tmp,L2) to Intersect_(Tmp2,Tmp) \ then to Intersect_(Tmp2,L1) @@ -56,22 +166,23 @@ threeD_init Tmp: line invis down bh from D line from D to Intersect_(Tmp,L6) - line from Intersect_(Tmp,L4) to F+(project(-bth,bth,0)) + line from Intersect_(Tmp,L4) to F+Project(-bth,bth,0) - Tmp: line invis from L5.start to L5.start+(project(0,0,-bh)) - move to E+(project(0,2*bth,0)) - Tmp2: line invis to Here+(project(bdp,0,0)) + Tmp: line invis from L5.start to L5.start+Project(0,0,-bh) + move to E+Project(0,2*bth,0) + Tmp2: line invis to Here+Project(bdp,0,0) line from L5.start to Intersect_(Tmp,L6) line from Intersect_(Tmp,L4) to Intersect_(Tmp,Tmp2) \ then to Intersect_(Tmp2,L4) - Tmp: line invis from L7.start to L7.start+(project(0,0,-(bh-bth))) + Tmp: line invis from L7.start to L7.start+Project(0,0,-(bh-bth)) line from L7.start to Intersect_(Tmp,L6) - move to G+(project(-2*bth,0,0)) - Tmp2: line invis to Here+(project(0,-bwid,0)) + move to G+Project(-2*bth,0,0) + Tmp2: line invis to Here+Project(0,-bwid,0) line from Intersect_(Tmp2,L3) to Intersect_(Tmp,Tmp2) line from Intersect_(Tmp,L4) to Intersect_(Tmp2,Tmp) - +] with .sw at last [].se+(0.2,0) +') .PE diff --git a/graphics/circuit_macros/examples/Euro.m4 b/graphics/circuit_macros/examples/Euro.m4 index 34058d9147..5186cb2f5c 100644 --- a/graphics/circuit_macros/examples/Euro.m4 +++ b/graphics/circuit_macros/examples/Euro.m4 @@ -1,13 +1,5 @@ -% Euro symbol; process this file as follows: -% m4 Euro.m4 > Euro.pic; dpic -p Euro.pic > Euro.tex ; latex Euro; dvips Euro -\documentclass{article} -\usepackage{pstricks} -\usepackage{boxdims,xcolor} -\pagestyle{empty} -\thispagestyle{empty} -\begin{document} -\noindent\vspace{2ex} .PS +#Euro.m4 include(pstricks.m4) gen_init divert(-1) @@ -135,4 +127,3 @@ move euro_symbol(ht=72bp__*2; aspect=1.0; slant=15) .PE -\end{document} diff --git a/graphics/circuit_macros/examples/Geometry.m4 b/graphics/circuit_macros/examples/Geometry.m4 index ae0a661012..0cbf4bb499 100644 --- a/graphics/circuit_macros/examples/Geometry.m4 +++ b/graphics/circuit_macros/examples/Geometry.m4 @@ -1,11 +1,11 @@ .PS # Geometry.m4 gen_init - scale = 5/4 - A: Here; "A" at A above - B: A+(-1,-3.5); "B" at B below rjust - C: B+(4.6,0); "C" at C below ljust +Fig1: [ ls = 2/3 # local scale + A: Here; "A" at A above + B: A+(-1*ls,-3.5*ls); "B" at B below rjust + C: B+(4.6*ls,0); "C" at C below ljust AB: line from A to B BC: line from B to C CA: line from C to A @@ -42,5 +42,29 @@ gen_init line dashed from X to Y chop -linewid/2 RightAngle(A,Z,Y) + ] + +Fig2: [ ls = 3/4 # local scale +# https://tex.stackexchange.com/questions/593272/drawing-complex-geometry + P: dot(at Here); "P" at P.s below + N: dot(at P+(3.5*ls,1.5*ls)); "N" at N.se ljust below + O: dot(at (N,P)); "O" at O.s below + R: dot(at 1/3 between O and P);"R" at R.s below + M: dot(at (R,N)); "M" at M.se ljust below + Q: dot(at (M.x,M.y+distance(M,N)/distance(N,O)*distance(P,O)));"Q" at Q.e ljust + line from P to Q then to N then to O + B: line to P chop -0.3 + line from M to N + Pu: line from R to Q chop 0 chop -0.3 + H: line from P to N chop 0 chop -0.3 + X: dot(at Intersect_(Pu,H)); "X" at X.se ljust below + thinlines_ + RightAngle(Q,M,N) + RightAngle(Q,N,H.end) + RightAngle(N,O,B.start) + ArcAngle(N,P,Q,0.4); "$\beta$" at last arc.ne above ljust + ArcAngle(O,P,N,0.5); "$\alpha$" at last arc.start+(5bp__,8bp__) + ArcAngle(R,Q,N,0.5); "$\alpha$" at last arc.start+(8bp__,-5bp__) + ] with .w at Fig1.e+(-0.4,0) .PE diff --git a/graphics/circuit_macros/examples/Heathkit.m4 b/graphics/circuit_macros/examples/Heathkit.m4 index 4127c8287e..2cc23290a1 100644 --- a/graphics/circuit_macros/examples/Heathkit.m4 +++ b/graphics/circuit_macros/examples/Heathkit.m4 @@ -29,9 +29,9 @@ define(`dimen_',dimen_*4/5) # Grid ifdpic(`linethick_(0.4)',`linethick_(0)') 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 picwid/g by 10 do { sprintf(tsf(%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 } + for i=0 to picht/g by 10 do { sprintf(tsf(%g),i) at (0, i*g) rjust } linethick_(0.8) ifdpic(` diff --git a/graphics/circuit_macros/examples/Inductors.m4 b/graphics/circuit_macros/examples/Inductors.m4 new file mode 100644 index 0000000000..f250a81135 --- /dev/null +++ b/graphics/circuit_macros/examples/Inductors.m4 @@ -0,0 +1,47 @@ +.PS +# inductors.m4 +cct_init +iflatex(command "{\tt") + +movewid = 2 pt__ +hm = 2.05 +vm = 0.4 +{ {I: 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(,,3,M) ; move ;"`{...(,,3,M)}'" ljust} + move right_ hm + {inductor(,W,6,P1); variable; move + "`...(,W,6,P1);'" ljust "`variable'" ljust} + move right_ hm + {inductor(,L,9,K); move ;"`{...(,L,9,K)}'" ljust} +} + + move down vm; right_ +{ {inductor(,,,M3); addtaps(-,1/2,-dimen_/6); move; `"...(,{,},M3)"' ljust + {`"addtaps(-,1/2,-dimen\_/6)"' ljust at (I.start,last ""+(0,-0.2)) } + } + move right_ hm + {ebox(,,,0) ; move ;"`{ebox(,{,},0)}'" ljust} + move right_ hm -10bp__ + {TI: tapped(`ebox(,,,0)',-,1/4,-dimen_/6,3/4,-dimen_/6) ; move ; + "`tapped(\char96{}ebox(,{,},0)\char39,'" ljust at Here+(10bp__,-5bp__) \ + "-,1/4,-dimen\_/6," ljust "3/4,-dimen\_/6)" ljust + "\sl Tap1" at TI.Tap1 rjust below + "\sl Tap2" at TI.Tap2 ljust below } +} + + move down vm*5/4; right_ +{ {shielded(`inductor(,,,M)') ; move + `"shielded("' ljust `"\char96inductor(,{,},M)\char39)"' ljust + move to (3rd last line.start,Here) + shielded(`ebox(,,,0)',R) ; move; `"shielded(`ebox(,{,},0)',R)"' ljust } +} + +iflatex(command "}") +.PE diff --git a/graphics/circuit_macros/examples/Lyap.m4 b/graphics/circuit_macros/examples/Lyap.m4 index a1b40a8ad0..4bce1b1d37 100644 --- a/graphics/circuit_macros/examples/Lyap.m4 +++ b/graphics/circuit_macros/examples/Lyap.m4 @@ -7,7 +7,7 @@ viewaz = 30 viewel = 18 setview(viewaz,viewel) -Origin: project(0,0,0) +Origin: Project(0,0,0) # Components of view vector W w1 = view3D1 w2 = view3D2 @@ -45,20 +45,20 @@ define(`vx',`sum3D(vp(`$1',`$2'),0,0,h+(`$2')^2)') y = y1 + (y2-y1)/nT*i theta = atan2(y,(w3-2*y*w2)*q/2/w1) r = y/sin(theta) - T[i]: project(vx(theta,r)) + T[i]: Project(vx(theta,r)) } # front and back parts of the top curve n = 12 for i = 0 to n do { theta = theta1 + (theta2-theta1)/n*i - F[i]: project(vx(theta,c)) - Fp[i]: project(vp(theta,c)) + F[i]: Project(vx(theta,c)) + Fp[i]: Project(vp(theta,c)) } for i = 0 to n do { theta = theta2 + (theta1+twopi_-theta2)/n*i - B[i]: project(vx(theta,c)) - Bp[i]: project(vp(theta,c)) + B[i]: Project(vx(theta,c)) + Bp[i]: Project(vp(theta,c)) } # trajectory @@ -74,8 +74,8 @@ define(`defX',` rx = `$5' ; np = np-1 for i = 0 to `$3' do { tha = ts + (tf-ts)*i/(`$3') for thx = tha to -twopi_ by twopi_ do {} - `$4'[i]: project(vx(thx,rx)) - Xp[np]: project(vp(thx,rx)) + `$4'[i]: Project(vx(thx,rx)) + Xp[np]: Project(vp(thx,rx)) np = np+1 rx = beta*rx }') @@ -102,7 +102,7 @@ ifpstricks(` # Centre axis thinlines_ -line from Origin to project(0,0,h) +line from Origin to Project(0,0,h) # F[0] is the leftmost point of the front curve line from F[0] to Fp[0] # F[n] is the rightmost point of the front curve @@ -144,16 +144,16 @@ ifpstricks(` # Axes and vertical lines thinlines_ line from X1[0] to Xp[0] -arrow from Origin to project(1.5,0,0) +arrow from Origin to Project(1.5,0,0) "$x_1$" rjust below -arrow from Origin to project(0,1.5,0) +arrow from Origin to Project(0,1.5,0) "$x_2$" ljust -line dashed from project(0,0,h) to F[n/2] chop 0 chop arrowht/4 -arrow from F[n/2] to project(0,0,2) +line dashed from Project(0,0,h) to F[n/2] chop 0 chop arrowht/4 +arrow from F[n/2] to Project(0,0,2) "$v(X)$" ljust "`${0}$'" at Origin+(0,1 pt__) below -"$\Omega$" at project(0,0.9*c,0) above -"`$v(X) = c$'" at (project(vp(100*dtor_,c)))+(2bp__,0) above ljust +"$\Omega$" at Project(0,0.9*c,0) above +"`$v(X) = c$'" at (Project(vp(100*dtor_,c)))+(2bp__,0) above ljust .PE diff --git a/graphics/circuit_macros/examples/Makefile b/graphics/circuit_macros/examples/Makefile index cd0500c40c..4dc00e86f7 100644 --- a/graphics/circuit_macros/examples/Makefile +++ b/graphics/circuit_macros/examples/Makefile @@ -27,50 +27,52 @@ LIBDIR = .. # The dpic processor: -PIC = dpic -p -#PIC = $$HOME/dpic/build/p2c/ftp/dpic -p -#PIC = $$HOME/dpic/pa*dev/p2c/ftp/dpic -p -#PIC = $$HOME/dpic/bison/dpic -p -#PIC = $$HOME/dpic/bi*v/dpic -p +PIC = dpic +#PIC = $$HOME/dpic/bisondev/dpic +#PIC = $$HOME/dpic/bison/dpic +#PIC = $$HOME/dpic/pascaldev/test/dpic +#PIC = $$HOME/dpic/pascal/test/dpic -CONFIGFILE = pstricks.m4 +#MODE = -p +MODE = -g -# Testing the mingw version of dpic: -#PIC = $$HOME/dpic/bison/distsrc/Windows/dpic -p -#CUSTOM=windows.m4 +#CONF = pstricks.m4 +CONF = pgf.m4 # Uncomment for gpic. Use gpic or pic as applicable on your machine: -# PIC = gpic -t -# PIC = pic -t -# CONFIGFILE = gpic.m4 +# PIC = gpic +# PIC = pic +# MODE = -t +# CONF = gpic.m4 # Convert options EPSOPTS = PNGOPTS = -quiet -density 400 -scale 25% -alpha Remove -# M4 = m4 -B32000 # M4 = m4 -I $(LIBDIR) # If environment variable M4PATH has been set to the installation directory: M4 = m4 -######################################################################### - DOC = examples PICS = \ ABlogix.tex Adder.tex Alogix.tex AmpTable.tex Antennas.tex \ - AntiqueClock.tex Audio.tex Bip.tex Btree.tex Buttons.tex Byte.tex \ - CanLogic.tex CctTable.tex Conn.tex Connectors.tex \ + Audio.tex Bip.tex Btree.tex Buttons.tex Byte.tex \ + Capacitors.tex CanLogic.tex Chips.tex Conn.tex Connectors.tex \ Contacts.tex Contact.tex control.tex Counting.tex Crossbar.tex Crow.tex \ csc.tex Csource.tex Decoder.tex \ Demultiplexer.tex diamond.tex Dini.tex Diodes.tex Drive.tex Emarrows.tex \ ex00.tex ex01.tex ex02.tex ex03.tex ex04.tex ex05.tex ex06.tex ex08.tex \ ex09.tex ex10.tex ex11.tex ex12.tex ex15.tex ex16.tex ex17.tex ex18.tex \ ex21.tex exp.tex fet.tex Flow.tex Fuses.tex GrayCode.tex graysurf.tex \ - Grounds.tex Headers.tex Heathkit.tex I2L.tex Incleps.tex Jack.tex \ - lcct.tex Lyap.tex Logic.tex Loglog.tex MC.tex Mixer.tex MotorControl.tex \ - Multiplexer.tex NLG.tex NPDT.tex Nport.tex Opamp.tex Optoiso.tex \ - Pconn.tex PushPull.tex pwrsupply.tex Quantum.tex quick.tex random.tex \ - Rectifiers.tex recycle.tex relaycoil.tex Relay.tex rose.tex Rotbox.tex \ + Grounds.tex Headers.tex Heathkit.tex \ + I2L.tex Incleps.tex Inductors.tex Jack.tex \ + lcct.tex Lyap.tex Logic.tex Loglog.tex MC.tex Mixer.tex MoreTable.tex \ + MotorControl.tex Multiplexer.tex \ + NLG.tex NPDT.tex Nport.tex Opamp.tex Optoiso.tex \ + Pconn.tex Plate.tex PushPull.tex pwrsupply.tex \ + Quantum.tex quick.tex \ + random.tex Rectifiers.tex recycle.tex relaycoil.tex Relay.tex \ + Resistors.tex rose.tex Rotbox.tex \ Schottky.tex sfg.tex shapes.tex ShiftR.tex Sierpinski.tex Sixpole.tex \ Sources.tex SQUID.tex Switches.tex \ Tgate.tex Three.tex thyristor.tex \ @@ -80,20 +82,26 @@ PICS = \ # Files that have to be processed twice: BOXDIMS = ex09.tex Crow.tex Incleps.tex Lyap.tex Loglog.tex Opamp.tex \ random.tex Ttree.tex Windings.tex -BOXPICS = ex09.pic Crow.pic Incleps.pic Lyap.pic Loglog.pic Opamp.pic \ - random.pic Ttree.pic Windings.pic -DVIPSOPTS = -Ppdf -G0 -t letter +######################################################################### + DVIPSOPTS = -G0 -t letter -M4LIBS = $(CONFIGFILE) $(CUSTOM) DIMFILE = $(DOC).dim BS = tr '|' '\134' # Might be needed (change latex commands to $(LTX) ) # LTX = latex --shell-escape +LTX = pdflatex --shell-escape + +PDFLTXSRC=printf "|documentclass[11pt]{standalone}\n\ +|usepackage{times,boxdims,siunitx,amssymb,tikz,geometry}\n\ +|geometry{paperwidth=15in,paperheight=14in,margin=1in}\n\ +|pagestyle{empty}|thispagestyle{empty}\n\ +|begin{document}|noindent|input{"$*".tex}|end{document}\n" | $(BS) LTXFILE=printf "|documentclass[11pt]{article}\n\ -|usepackage{times,pstricks,boxdims,graphicx,pst-grad,pst-slpe}\n\ +|usepackage[dvipsnames]{xcolor}\n\ +|usepackage{times,boxdims,graphicx,pstricks}\n\ |usepackage{siunitx}\n\ |setlength{|textwidth}{28cm}|setlength{|textheight}{28cm}\n\ |setlength{|oddsidemargin}{0pt}|setlength{|evensidemargin}{0pt}\n\ @@ -101,107 +109,90 @@ LTXFILE=printf "|documentclass[11pt]{article}\n\ |pagestyle{empty}|thispagestyle{empty}\n\ |newbox|graph\n\ |begin{document}\n\ -|noindent|input{"$*".tex}\n\ +|noindent|input{"$*".tex}|box|graph\n\ |end{document}\n" | $(BS) .SUFFIXES: .ps .dvi .tex .m4 .pic .eps .png .pdf .svg .tif .gif -.dvi.ps: - dvips $(DVIPSOPTS) $* -o $*.ps - chmod 644 $*.ps -.m4.tex: - @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi ; touch F_$*.dim - $(M4) $(M4LIBS) $(DIMFILE) F_$*.dim $*.m4 | sed -e '/^ *$$/d' \ - | $(PIC) > $*.tex -# $(M4) $(M4LIBS) $(DIMFILE) F_$*.dim $*.m4 | sed -e '/^ *$$/d' > $*.pic -# $(PIC) $*.pic > $*.tex -# grep Production dpic.log >> newp.txt .m4.pic: - @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi - $(M4) $(M4LIBS) $(DIMFILE) $*.m4 > $*.pic + @touch $(DIMFILE) F_$*.dim + $(M4) $(CONF) $(DIMFILE) F_$*.dim $*.m4 > $*.pic +.m4.tex: + @touch $(DIMFILE) F_$*.dim + $(M4) $(CONF) $(DIMFILE) F_$*.dim $*.m4 | $(PIC) $(MODE) > $*.tex .m4.dvi: - @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi ; touch F_$*.dim - $(M4) $(M4LIBS) $(DIMFILE) F_$*.dim $*.m4 | sed -e '/^ *$$/d' \ - | $(PIC) > $*.tex - $(LTXFILE) > F_$*.tex + @touch $(DIMFILE) F_$*.dim + $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex + @$(LTXFILE) > F_$*.tex latex --quiet F_$* - touch F_$*.dim $(DIMFILE) ; rm -f $*.tex $*.pic ; make $*.tex + touch F_$*.dim $(DIMFILE) + $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex latex --quiet F_$* - touch F_$*.dim $(DIMFILE) ; rm -f $*.tex $*.pic ; make $*.tex + mv F_$*.dvi $*.dvi + rm -f F_* +.dvi.ps: + dvips $(DVIPSOPTS) $* -o $*.ps + chmod 644 $*.ps +.m4.ps: + @touch $(DIMFILE) F_$*.dim + $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex + @$(LTXFILE) > F_$*.tex latex --quiet F_$* + dvips $(DVIPSOPTS) F_$* -o $*.ps + chmod 644 $*.ps + rm -f F_* .m4.eps: - @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi ; touch F_$*.dim - $(M4) $(M4LIBS) $(DIMFILE) F_$*.dim $*.m4 | sed -e '/^ *$$/d' \ - | $(PIC) > $*.tex - $(LTXFILE) > F_$*.tex + @touch $(DIMFILE) F_$*.dim + $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex + @$(LTXFILE) > F_$*.tex latex --quiet F_$* - touch F_$*.dim $(DIMFILE) ; rm -f $*.tex $*.pic ; make $*.tex - latex --quiet F_$* - touch F_$*.dim $(DIMFILE) ; rm -f $*.tex $*.pic ; make $*.tex + $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex latex --quiet F_$* dvips F_$* -T128cm,28cm -o $*.ps -# dvips -Ppdf F_$* -T128cm,28cm -o $*.ps # Recent changes to PSTricks(?) have clashed with the use of TeXtoEPS # so use ps2epsi ps2epsi $*.ps $*.epsi sed -e '/%%Pages:/d' -e '/BeginPreview/,$$d' $*.epsi \ | tr '\015' '\012' > $*.eps sed -e '1,/EndPreview/d' $*.epsi >> $*.eps -.m4.ps: - make $*.tex && mv $*.tex test.tex; latex tst - rm -f test.tex $*.pic - if test -f tst.dim ; then cp tst.dim F_$*.dim ; fi - make $*.tex && mv $*.tex test.tex; latex tst - dvips $(DVIPSOPTS) tst -o $*.ps - chmod 644 $*.ps -#.m4.svg: -# make $*.eps -# convert $(EPSOPTS) $*.eps $*.svg + rm -f F_* +.m4.pdf: + @touch $(DIMFILE) F_$*.dim + $(M4) pgf.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -g > $*.tex + @$(PDFLTXSRC) > F_$*.tex + pdflatex --quiet F_$* + $(M4) pgf.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -g > $*.tex + pdflatex --quiet F_$* + mv F_$*.pdf $*.pdf + rm -f F_* .m4.png: - make $*.eps - convert $(PNGOPTS) $*.eps $*.png + make $*.pdf + convert $(PNGOPTS) $*.pdf $*.png @if test -f $*.png.0 ; then mv $*.png.0 $*.png ; fi + rm $*.pdf .m4.gif: - make $*.ps - convert $(GIFOPTS) $*.ps $*.gif -# @if test -f $*.png.0 ; then mv $*.png.0 $*.png ; fi + make $*.pdf + convert $(GIFOPTS) $*.pdf $*.gif + rm $*.pdf .m4.tif: - make $*.eps - convert $(EPSOPTS) $*.eps $*.tif + make $*.pdf + convert $(EPSOPTS) $*.pdf $*.tif @if test -f $*.tif.0 ; then mv $*.tif.0 $*.tif ; fi -.m4.pdf: - touch F_$*.dim - $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic - $(PIC) -g $*.pic > test.tex - sed -e '/^\\usepackage.*graphicx/s/^.*$$/\\usepackage{tikz}/' \ - -e '/pstricks/d' tst.tex > F_$*.tex - pdflatex --quiet F_$* - $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic - $(PIC) -g $*.pic > test.tex - pdflatex --quiet F_$* - mv F_$*.pdf $*.pdf + rm $*.pdf .m4.svg: - touch F_$*.dim - $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic - $(PIC) -g $*.pic > test.tex - sed -e '/^\\usepackage.*graphicx/s/^.*$$/\\usepackage{tikz}/' \ - -e '/pstricks/d' tst.tex > F_$*.tex - pdflatex --quiet F_$* - $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic - $(PIC) -g $*.pic > test.tex - pdflatex --quiet F_$* - mv F_$*.pdf $*.pdf - pdf2svg $*.pdf $*.svg - rm -f $*.pdf $*.pic F_$** + make $*.pdf + dvisvgm --pdf $*.pdf $*.svg + rm $*.pdf + ######################################################################### -$(DOC).pdf: clean pdfmode $(DOC).frp +$(DOC).pdf: clean pdfmode $(DOC).tex files.tex header.tex touch $(DOC).dim - rm -f $(BOXDIMS) $(BOXPICS) - make PIC="$(PIC) -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim pics + make CONF=pgf.m4 MODE=-g DIMFILE=$(DOC).dim pics + cp $(LIBDIR)/doc/Version.tex . pdflatex $(DOC) - rm -f $(BOXDIMS) $(BOXPICS) - make PIC="$(PIC) -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim pics + rm -f $(BOXDIMS) ${BOXDIMS:%.tex=%.pic} $(DOC).pdf + make CONF=pgf.m4 MODE=-g DIMFILE=$(DOC).dim $(BOXDIMS) pdflatex $(DOC) optpdf $(DOC).pdf @@ -216,47 +207,48 @@ psmode: pdfmode: printf "|usepackage{tikz}\n" | $(BS) > mode.tex -$(DOC).dvi: $(DOC).frs +$(DOC).dvi: $(DOC).tex files.tex header.tex psmode touch $(DOC).dim - for file in $(BOXDIMS) ; do rm -f $$file.tex $$file.pic ; done - make PIC="$(PIC)" CONFIGFILE=pstricks.m4 DIMFILE=$(DOC).dim pics - latex $(DOC) - for file in $(BOXDIMS) ; do rm -f $$file.tex $$file.pic ; done - make PIC="$(PIC)" CONFIGFILE=pstricks.m4 DIMFILE=$(DOC).dim pics - latex $(DOC) - -$(DOC).frs: $(DOC).tex files.tex header.tex psmode - make PIC="$(PIC) -p" CONFIGFILE=pstricks.m4 DIMFILE=$(DOC).dim pics + make CONF=pstricks.m4 MODE=-p DIMFILE=$(DOC).dim pics cp $(LIBDIR)/doc/Version.tex . latex $(DOC) - rm -f $(DOC).dvi - touch $(DOC).frs - -$(DOC).frp: $(DOC).tex files.tex header.tex pdfmode - make PIC="$(PIC) -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim pics - cp $(LIBDIR)/doc/Version.tex . - pdflatex $(DOC) - rm -f $(DOC).pdf - touch $(DOC).frp + rm -f $(BOXDIMS) ${BOXDIMS:%.tex=%.pic} $(DOC).dvi + make CONF=pstricks.m4 MODE=-p DIMFILE=$(DOC).dim $(BOXDIMS) + latex $(DOC) tst: - make test.tex; latex tst; rm -f test.tex test.pic - make DIMFILE=tst.dim test.tex; latex tst + @$(LTXFILE) | sed -e 's/{\.tex}/{test.tex}/' > tst.tex + make CONF=pstricks.m4 PIC=dpic MODE=-p test.tex; latex --quiet tst + rm -f test.tex test.pic + make CONF=pstricks.m4 PIC=dpic MODE=-p test.tex; latex --quiet tst dvips $(DVIPSOPTS) tst -o tst.ps -tst1: test.tex tst.tex - latex tst +tst1: + @$(LTXFILE) | sed -e 's/{\.tex}/{test.tex}/' > tst.tex + make CONF=pstricks.m4 PIC=dpic MODE=-p test.tex; latex --quiet tst dvips $(DVIPSOPTS) tst -o tst.ps -gtst: - touch test.m4; make PIC="gpic -t" CONFIGFILE="" tst +tikz: + @$(LTXFILE) | sed -e 's/{\.tex}/{test.tex}/' -e 's/pstricks/tikz/' > tst.tex + make CONF=pgf.m4 PIC=dpic MODE=-g test.tex; latex --quiet tst + dvips $(DVIPSOPTS) tst -o tst.ps -gtst1: - touch test.m4; make PIC="gpic -t" CONFIGFILE="" tst1 +gpic: + @$(LTXFILE) | sed -e 's/{\.tex}/{test.tex}/' > tst.tex + rm -f test.tex test.pic + make CONF=gpic.m4 PIC=pic MODE=-t test.tex; latex --quiet tst + dvips $(DVIPSOPTS) tst -o tst.ps echopics: @echo $(PICS) +testall: + (cd mf; make) + (cd mpost; make) + (cd psfrag; make) + (cd svg; make) + (cd xfig; make) + clobber: clean rm -f *.ps -@for dir in mf mpost pdflatex xfig psfrag svg dev test; \ @@ -270,16 +262,16 @@ clobber: clean for file in `ls *.tex` ; do \ nm=`echo $$file | sed -e "s/\(.*\)\.tex/\1/"` ; \ if test -s $$nm.m4 ; then rm -f $$nm.pic $$nm.tex ; fi ; done - @if test -f distmakefile ; then make -f distmakefile clobber ; fi +# @if test -f distmakefile ; then make -f distmakefile clobber ; fi clean: @printf "\n examples clean:\n" rm -f core boxdims.tar.gz pics rm -f *.dvi *.aux *.log *.toc *.blg *.eps *.tif *.epsi eps *-mfpic* *.svg rm -f fig*.tex $(PICS) *.roff *.int *.pic gpic.m4 test.tex xxx* *.fig - rm -f *.dim *.bak *.frs *.frp $(RPICS) rotate.ps tst.ps *.bbl *-pics.ps + rm -f *.dim *.bak rotate.ps tst.ps *.bbl *-pics.ps rm -f *.tfm *[0-9]pk *.png *.1 *.gif rm -f F_* Version.tex *stackdump *.ico rm -rf distfile distfile.tar.gz mode.tex @printf "\n" - @if test -f distmakefile ; then make -f distmakefile clean ; fi +# @if test -f distmakefile ; then make -f distmakefile clean ; fi diff --git a/graphics/circuit_macros/examples/MoreTable.m4 b/graphics/circuit_macros/examples/MoreTable.m4 new file mode 100644 index 0000000000..bfc41113c1 --- /dev/null +++ b/graphics/circuit_macros/examples/MoreTable.m4 @@ -0,0 +1,36 @@ +.PS +# MoreTable.m4 +cct_init + +movewid = 2 pt__ +hm = 2.05 +vm = 0.28 +{ {memristor ; move;"`{\tt memristor}'" ljust} + move right_ hm + {heater; move;"`{\tt heater}'" ljust} + move right_ hm + {tline ; move;"`{\tt tline}'" ljust} +} + move down 0.25; right_ +{ {pvcell ; move;"`{\tt pvcell}'" ljust} + move right_ hm + {reed ; move ;"`{\tt reed}'" ljust} + move right_ hm + {reed(,,,fill_(0.9),CR) ; move ; "`{\tt reed(,{,},fill\_(0.9),CR)}'" ljust} +} + move down 0.25; right_ +{ {gap ; move ;"`{\tt gap}'" ljust} + move right_ hm + {gap(,,A) ; move ;"`{\tt gap(,{,}A)}'" ljust} + move right_ hm + {arrowline ; move;"`{\tt arrowline}'" ljust} +} + move down 0.25; right_ +{ move down 0.10; right; {lamp ; move;"`{\tt lamp}'" ljust} + move right_ hm + {thermocouple ; move;"`{\tt thermocouple}'" ljust } +# move up 0.10 right_ hm +# {arrester ; move ;"`{\tt arrester}'" ljust} +} + +.PE diff --git a/graphics/circuit_macros/examples/Orbits.m4 b/graphics/circuit_macros/examples/Orbits.m4 index c49bacbc7c..ef85d27935 100644 --- a/graphics/circuit_macros/examples/Orbits.m4 +++ b/graphics/circuit_macros/examples/Orbits.m4 @@ -10,7 +10,7 @@ NeedDpicTools define(`orbitpos', `rot3Dx((`$2')*dtor_,rot3Dz((`$1')*dtor_,rot3Dy(-(`$4')*dtor_,`$3',0,0)))') -define(`PO',`B.C+(project(orbitpos(orbitlong,orbitlat,orbitrad,`$1')))') +define(`PO',`B.C+(Project(orbitpos(orbitlong,orbitlat,orbitrad,`$1')))') define vis { X: PO($1) if (distance(X,B.C)>crad) || \ diff --git a/graphics/circuit_macros/examples/Planes.m4 b/graphics/circuit_macros/examples/Planes.m4 index 726af31c56..b9d0579c69 100644 --- a/graphics/circuit_macros/examples/Planes.m4 +++ b/graphics/circuit_macros/examples/Planes.m4 @@ -77,10 +77,10 @@ ifelse(1,1,` # Recover the 4th corner and draw define(`drawfacet',` - NW_facet: project(xyz(($1)*3)) - NE_facet: project(xyz(($1)*3+1)) - SE_facet: project(xyz(($1)*3+2)) - SW_facet: project(x[($1)*3+2],y[($1)*3],z[($1)*3]) + NW_facet: Project(xyz(($1)*3)) + NE_facet: Project(xyz(($1)*3+1)) + SE_facet: Project(xyz(($1)*3+2)) + SW_facet: Project(x[($1)*3+2],y[($1)*3],z[($1)*3]) shd = 1-($2)^4 line from SW_facet to SE_facet then to NE_facet \ then to NW_facet then to SW_facet shaded rgbstring(shd,shd,shd) diff --git a/graphics/circuit_macros/examples/svg/Y14-5SVG.m4 b/graphics/circuit_macros/examples/Plate.m4 index 84cc6bcda6..0700f072a0 100644 --- a/graphics/circuit_macros/examples/svg/Y14-5SVG.m4 +++ b/graphics/circuit_macros/examples/Plate.m4 @@ -1,10 +1,11 @@ .PS +# Plate.m4 # ASME_Y14-5.m4 # https://en.wikipedia.org/wiki/Geometric_dimensioning_and_tolerancing # See the ASME Y14.5 standard, Figure 6-30. scale = 100/3 cct_init -include(../ASME_Y14-5.m4) +include(ASME_Y14-5.m4) ifsvg(`svg_font(sans-serif,10bp__)', `textht = 10bp__*2/3 iflatex(`command "{\sf"')') @@ -156,7 +157,7 @@ thinlines_ for_(0,315,45,`ctrarcr(C,d6/2,(m4x-22.5)*dtor_,(m4x+22.5)*dtor_) ctrline(from C+(Rect_(d6-d7/2,m4x)) to C+(Rect_(d7/2,m4x))) ') arcdimension_(from C+(0,d7/2) to C+(Rect_(d7/2,135)) with .c at C, - 8,"8X 45`'iflatex(^\circ)" wid textht*3.5,15,1) + 8,"8X 45`'iflatex($^\circ$)" wid textht*3.5,15,1) ifsvg("svg_deg" wid textht*2/3 with .w at last "".e) move to C+(0,d6/2) arrow <- from Here+(Rect_(8/2,75)) to Here+(Rect_(25,75)) then right_ 3 diff --git a/graphics/circuit_macros/examples/README-examples b/graphics/circuit_macros/examples/README-examples index 5561e4d3fc..c74c92c274 100644 --- a/graphics/circuit_macros/examples/README-examples +++ b/graphics/circuit_macros/examples/README-examples @@ -31,7 +31,7 @@ the boxdim macro is being used. If you only need to process once, type To use tikz and pdflatex to produce test.pdf, type "make test.pdf" as above. To test and debug a single diagram in a different directory, copy Makefile -and tst.tex to where you want to work, adjust the definition of LIBDIR +to where you want to work, adjust the definition of LIBDIR in Makefile if environment variable M4PATH has not been defined, and type one of the above commands. @@ -40,7 +40,7 @@ To use PSTricks instead, type "make clean; make examples.ps". To process the diagrams using TikZ PGF for processing either by LaTeX or PDFlatex, type "make" or "make examplespgf.ps" in the pgf subdirectory. -There are often several methods of producing similar graphical results, +There are often several methods for producing similar graphical results, particularly of text labels. Some of the diagrams in this directory are slightly more complicated than required for Tikz or PSTricks in order that they will work with other postprocessors. Dpic output that does diff --git a/graphics/circuit_macros/examples/Resistors.m4 b/graphics/circuit_macros/examples/Resistors.m4 new file mode 100644 index 0000000000..6e79c91966 --- /dev/null +++ b/graphics/circuit_macros/examples/Resistors.m4 @@ -0,0 +1,30 @@ +.PS +# Resistors.m4 +cct_init + +movewid = 2 pt__ +hm = 2.05 +vm = 0.28 +{ {resistor ; move ;"`{\tt resistor}'" ljust} + move right_ hm + {resistor(,,Q) ; move ;"`\tt resistor(,{,}Q) '" ljust} + move right_ hm + {resistor(,,E) ; move + "`\shortstack[l]{\tt resistor(,{,}E)\\ {\tt $\equiv$ ebox}}'" ljust} +} + move down vm; right_ +{ {resistor(,,ES) ; move ;"`\tt resistor(,{,}ES) '" ljust} + move right_ hm + {resistor(,,H) ; move ;"`\tt resistor(,{,}H) '" ljust} + move right_ hm + {ebox(,,,0.5) ; move ;"`{\tt ebox(,{,},0.5)}'" ljust} +} + move down vm; right_ +{ {resistor(,,V) ; move ;"`{\tt resistor(,{,}V)}'" ljust} + move right_ hm + {ebox(,0.5,0.3) ; move ;"`{\tt ebox(,0.5,0.3)}'" ljust} + move right_ hm+4bp__ + {resistor(,,B) ; move movewid-4bp__ ;"`{\tt resistor(,,B)}'" ljust} +} + +.PE diff --git a/graphics/circuit_macros/examples/control.m4 b/graphics/circuit_macros/examples/control.m4 index 62d92291ac..400b8873ac 100644 --- a/graphics/circuit_macros/examples/control.m4 +++ b/graphics/circuit_macros/examples/control.m4 @@ -30,6 +30,81 @@ S1: circle # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # +# https://tex.stackexchange.com/questions/575592/how-to-create-a-controls-system-diagram +Observer: [ + define(`thickarrow',`arrow thick 3 wid 7bp__') + define(`thickline',`line thick 3') + fillval = 0.6 + boxwid = 0.3 + boxht = 0.4 + circlerad = 0.1 + {"$r$" above ljust} +R: arrow +S: circle fill + {"$-$" below ljust at S.s; "$+$" above rjust at S.w+(2bp__,0)} +{ OLP: box invis fill 0.9 wid 3.1 ht 1.4 with .nw at Here+(0.3,boxht*5/4) + "\sf plant" at OLP.nw below ljust } +U: arrow right 0.4 + {"$u$" at last arrow+(2bp__,0) above } +Bp: box fill "$B$" + thickarrow right 0.4 +Sp: circle fill + {"$\;+$" below ljust at Sp.s; "$+$" above rjust at Sp.w+(2bp__,2bp__)} + thickarrow right 0.4 + {"`$\dot{\mathbf x}$'" at last arrow + (0,7bp__)} +Ip: box fill "$I/s$" + thickarrow right 1 + {"$\mathbf x$" at last arrow + (0,7bp__) } +Cp: box fill "$C$" +# print Cp.e.x - Bp.w.x + 0.2 + thickline right 0.4 +Yp: thickarrow + {"$\mathbf y$" at last arrow + (0,7bp__) } +Ap: box fill "$A$" with .n at Ip.s+(0,-boxht/2) + thickarrow <- from Ap.e right 0.4 then up Ip.y-Ap.y + thickarrow from Ap.w to (Sp,Ap) then to Sp.s +# print OLP.n.y-Ap.s.y+0.1 +# +K: box fill "$K$" at Ap + (0,-boxht*3/2) + arrow from K.w to (S,K) then to S.s + {OBS: box invis fill 0.9 wid 4.3 ht 1.8 with .nw at (S.w,K.s)-(0.1,0.1) + "\sf observer" at OBS.sw ljust above } +Io: box fill "$I/s$" at K + (0,-boxht*3/2) + thickarrow <- from Io.w left 0.4 + {"`$\dot{\hat{\mathbf x}}$'" at last arrow + (0,7bp__)} +Sxo: circle fill + {"$\;+$" below ljust at Sxo.s; "$+$" above rjust at Sxo.w+(2bp__,2bp__)} + thickarrow <- left 0.4 +SLo: circle fill + {"$\;+$" below ljust at SLo.s; "$+$" above rjust at SLo.w+(2bp__,2bp__)} + thickarrow <- left 0.4 +Bo: box fill "$B$" + arrow from 1/4 between U.start and U.end up boxht \ + then left 2*boxht then down Bp.y-Bo.y+boxht then to Bo.w +Ao: box fill "$A$" with .n at Io.s+(0,-boxht/2) + thickline from Io.e right 0.4 + {thickarrow <-> from K.e to (Here,K.e) then to (Here,Ao) then to Ao.e + thickarrow from Ao.w to (Sxo,Ao.w) then to Sxo.s } +Xhat: Here +Co: box fill "$C$" at (Cp,Here) + thickarrow right 0.4 + {"$\hat{\mathbf y}$" at last arrow + (0,7bp__) } + { thickarrow from Xhat to Co.w } + {"$\hat{\mathbf x}$" at last arrow + (0,7bp__) } +Syo: circle fill + {"$\;+$" above ljust at Syo.n; "$-$" below rjust at Syo.w+(2bp__,-2bp__)} + thickarrow <- from Syo.n to (Syo,Cp) +Lo: box fill "$L$" with .n at Ao.s+(0,-boxht/2) +# print Io.n.y+0.1 - (Lo.s.y-0.1) + thickarrow from Syo.s down Syo.s.y-Lo.y then to Lo.e + thickarrow from Lo.w to (SLo,Lo.w) then to SLo.s +] with .nw at last [].sw+(0,-0.3) + "(b) Single-input plant with feedback from a full-order observer" \ + below ljust at Observer.sw+(0,-5pt__) + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # + +ifelse(0,1,` Observer: [ {"$r$" above ljust} arrow S: circle @@ -53,13 +128,14 @@ Plant: box wid boxwid*3/2 ht boxht*5/4 \ 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 Observer.sw+(0,-5pt__) +] with .nw at last [].sw+(0,-0.5) +') # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # +ifelse(1,1,` Multiblock: [ +boxht = 0.4 boxwid = boxht circlerad = boxht*0.4 @@ -95,8 +171,9 @@ Rf: doublebox(R_2,R_3) at ((S1.x+T.x)/2,T.y-boxht*3/2) arrow from T to (T,Rf) then to Rf.e arrow from Rf.w to (S1,Rf) then to S1.s "$n_2$" at S1.s+(0,-boxht/2) ljust -] with .nw at Observer.sw + (0,-0.5) +] with .nw at Observer.sw + (0,-0.3) "(c) A multiblock example" below ljust at Multiblock.sw+(0,-5pt__) +') # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # @@ -128,15 +205,15 @@ G: box "plant" "$G$" "$-$" at Here + (-0.15,-0.1) arrow <- down from R.s "$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 Multiblock.sw + (0,-0.5) - "(d) Nonlinear feedforward (for performance) and small-signal feedback (for stability)" \ - below ljust at Nonlinear.sw+(0,-5pt__) +] with .nw at last [].sw + (0,-0.2) + "(d) Nonlinear feedforward (for performance) and small-signal feedback + (for stability)" below ljust at Nonlinear.sw+(0,-5pt__) +#print PID.n.y - Nonlinear.s.y .PE diff --git a/graphics/circuit_macros/examples/csc.m4 b/graphics/circuit_macros/examples/csc.m4 index 6fc3be88ba..69b8d20c3c 100644 --- a/graphics/circuit_macros/examples/csc.m4 +++ b/graphics/circuit_macros/examples/csc.m4 @@ -1,12 +1,15 @@ -ifelse(ifpstricks(T)`'ifmpost(T)`'ifpostscript(T)`'ifpgf(T),, - `PSTricks, MetaPost, PGF, or Postscript required for this diagram',`dnl -.PS 3.5 +.PS +#.PS 3.5 # csc.m4 gen_init +NeedDpicTools +ifelse(ifpstricks(T)`'ifmpost(T)`'ifpostscript(T)`'ifpgf(T),, + `PSTricks, MetaPost, PGF, or Postscript required for this diagram',` -circlerad=1.91 -hubrad=0.10 -s=0.5 +skale = 3.5/3.97*0.9955 +circlerad=1.91*skale +hubrad=0.10*skale +s=0.5*skale define(`midnight',`0.1, 0.1, 0.44') define(`white',`1, 1, 1') @@ -18,7 +21,7 @@ define(`lwid',1) define(`coord',`(s*(`$1'),s*(`$2'))') # Circle and spokes -# [ +CSC: [ rgbdraw(midnight, linethick=`0.'eval(lwid*15)/(1pt__) {circle with .c at Here @@ -72,5 +75,156 @@ rgbdraw(midnight, 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) ) -# ] with .sw at 1,1 -.PE') + ] +') +# PSTricks or tikz only: +ifelse(ifpstricks(T)`'ifpgf(T),T,` +Clock: [ +#.PS +# AntiqueClock.m4 +#gen_init +#NeedDpicTools + +iflatex(`latexcommand({\sf)') + +# https://tex.stackexchange.com/questions/236923/generate-analog-clock-with-numbered-face-add-seconds-roman-numerals + +# `hms2deg(hr,min,sec) hr:min:sec to degrees +# blank arg1: degrees for minute hand +# blank arg1 and arg2: degrees for second hand' +define(`hms2deg',`ifelse(`$1',, + `ifelse(`$2',, + `(90-pmod(ifelse(`$3',,0,`$3'),60)/60*360)', + `(90-(pmod(`$2',60)/60 + pmod(ifelse(`$3',,0,`$3'),60)/60/60)*360)')', + `(90-(pmod(`$1',12) + pmod(ifelse(`$2',,0,`$2'),60)/60 + dnl + pmod(ifelse(`$3',,0,`$3'),60)/3600)/12*360)')') + +# `SecondHand(length,hr,min,sec)' +define(`SecondHand',`[ shsf = (`$1')/3.2 + C: Here + { L: rpoint_(to (Rect_(`$1',hms2deg(,,`$4')))) } + line thick 8*shsf to rvec_(`$1',0) + ]') + +# `AntiqueMinuteHand(length,hr,min,sec)' +define(`AntiqueMinuteHand',`[ mhsf = (`$1')/2.84 + L: rpoint_(to (Rect_(`$1',hms2deg(,`$3',`$4')))) + C: circle fill_(0) diam 0.47*mhsf at L.start + move to C + spline from rvec_(0,0.047*mhsf) \ + to rvec_(1.65*mhsf,0.11*mhsf) \ + then to rvec_(`$1',0.018*mhsf) \ + then to rvec_(`$1',-0.018*mhsf) \ + then to rvec_(1.65*mhsf,-0.11*mhsf) \ + then to rvec_(0,-0.047*mhsf) \ + shaded rgbstring(0,0,0) + ]') + +# `AntiqueHourHand(length,hr,min,sec)' +define(`AntiqueHourHand',`[ hhsf = (`$1')/2.2 + L: rpoint_(to (Rect_(`$1',hms2deg(`$2',`$3',`$4')))) + C: circle fill_(0) diam 0.6*hhsf at L.start + move to C + v = 0.25*hhsf + { line to rvec_(1.1*hhsf,0) thick 0.15/(1bp__)*hhsf } + { C1: circle rad v at rvec_(1.25*hhsf,0) fill_(0) } + d = `$1'-1.25*hhsf + q = 1bp__*hhsf + r1 = (d^2 + q^2 - v^2)/(v-q)/2 + h = r1+v + shade(0, + arc ccw from C1+vec_(d/h*v,(r1+q)/h*v) to \ + C1+vec_(d,q) rad r1 with .c at C1+vec_(d,r1+q) + arc ccw from C1+vec_(d,-q) to C1+vec_(d/h*v,-(r1+q)/h*v) rad r1 \ + with .c at C1+vec_(d,-r1-q)) + ]') + +define(`AntiqueClock',`[ # h,m,s,diam +# Clock size parameters: + hour = ifelse(`$1',,3,`$1') + minute = ifelse(`$2',,41,`$2') + second = ifelse(`$3',,51,`$3') + # outer radius + ifelse(`$4',,`skale=0.5; r1=2',`r1=(`$4')/2; skale=r1/4') + r2 = r1-0.5*skale + r3 = r2-0.14*skale + r4 = r3 - 0.35*skale + r5 = r4 - 0.17*skale + r6 = r5 - 0.63*skale + r7 = r6 - 0.17*skale + shadelinethick = 1.0 + +C: circle thick 0.2 rad r1 + +define shadeline { + s = 1-($`'1)*2 + v = r*s + h = sqrt(r^2-v^2) + t = 1-abs(s) + line from (vrot_(-h,v,cost,sint)) to (vrot_(h,v,cost,sint)) \ + thick shadelinethick outlined rgbstring(t,t,t) + } + + r = r1 # Bezel outer + nlines = int(2*r/(shadelinethick pt__)*1.1) + cost = cosd(10); sint = sind(10); + ShadeObject(shadeline,nlines, 0, 0,0,0, 0.5, 1,1,1, 1, 0,0,0 ) at C + + r = r2 # Bezel inner + nlines = int(2*r/(shadelinethick pt__)*1.1) + cost = cosd(-10); sint = sind(-10); + ShadeObject(shadeline,nlines, 0, 0,0,0, 0.25, 0.8,0.8,0.8, 0.5, 1,1,1, + 0.75, 0.8,0.8,0.8, 1, 0,0,0 ) at C + +# Clock face +Face: circle thick 0 fill_(1) rad r3 at C + circle rad r4 at C + circle rad r5 at C + circle rad r6 at C + circle rad r7 at C + +# Text rotation for PSTricks or TikZ + define(`rottext', + `ifpstricks(`\rput[c]{%g}(0,0)',`ifpgf(`\pgftext[rotate=%g]',%g)')') +# Outer numbers + command sprintf("\font\outerfont=cmss12 at %4.2fin",r3-r4) + for mn = -15 to 15 by 5 do { sprintf("rottext{\outerfont %g}",\ + -mn/60*360,pmod(mn,60)) at C+(Rect_((r3+r4)/2,90-mn/60*360)) } + for mn = 20 to 40 by 5 do { sprintf("rottext{\outerfont %g}",\ + 180-mn/60*360,mn) at C+(Rect_((r3+r4)/2,90-mn/60*360)) } +# Outer tics + for mn = 1 to 60 do { t = 90-mn/60*360 + line from C+(Rect_(r5,t)) to C+(Rect_(r4,t)) } + +# Inner numbers + command sprintf("\font\innerfont=cmss12 at %4.2fin",r5-r6) + Loopover_(`mx',`t = (m4Lx-4)/12*360; + sprintf("rottext{\scalebox{0.7}[1.0]{\innerfont mx}}",-t) \ + at C+(Rect_((r5+r6)/2,90-t))', IX,X,XI,XII,I,II,III) + Loopover_(`mx',`t = (m4Lx+3)/12*360; + sprintf("rottext{\scalebox{0.7}[1.0]{\innerfont mx}}",-t+180) \ + at C+(Rect_((r5+r6)/2,90-t))', IV,V,VI,VII,VIII) + +# Inner tics + for mn = 5 to 60 by 5 do { t = 90-mn/60*360 + line from C+(Rect_(r7,t)) to C+(Rect_(r6,t)) } + +# Hands + AntiqueHourHand(r6,hour,minute,second) with .C at C + AntiqueMinuteHand(r5,hour,minute,second) with .C at C + SecondHand((r3+r4)/2,hour,minute,second) with .C at C + +# Center + dot(at C,0.1/4*r1,1) + ]') + + Clock1: AntiqueClock(,,,3.5) +# Clock2: AntiqueClock(4,50,07,2) at Clock1.e+(1.5,0) + + iflatex(`latexcommand(}%)') + + +#.PE + ] with .sw at last [].se+(0.25,0) +',` "AntiqueClock.m4 requires pstricks or pgf" ') +.PE diff --git a/graphics/circuit_macros/examples/examples.pdf b/graphics/circuit_macros/examples/examples.pdf Binary files differindex e658c456a0..300ab4abed 100644 --- a/graphics/circuit_macros/examples/examples.pdf +++ b/graphics/circuit_macros/examples/examples.pdf diff --git a/graphics/circuit_macros/examples/examples.tex b/graphics/circuit_macros/examples/examples.tex index 720e78861f..2b252a4e18 100644 --- a/graphics/circuit_macros/examples/examples.tex +++ b/graphics/circuit_macros/examples/examples.tex @@ -2,7 +2,6 @@ \documentclass[11pt]{article} \usepackage{times} -%\usepackage{pstricks,pst-grad} \input mode \usepackage{rotating} \usepackage{graphicx} @@ -22,24 +21,22 @@ \hfill\break This is a collection of diagrams the author has had occasion to produce - using m4 circuit macros and others, and gpic or dpic. In some cases - there are other or better m4 or pic constructs for producing the - same drawings, but the source-file names are shown for reference. - Most of the examples can be processed using either dpic~-p, dpic~-g, - or gpic~-t, but the possibility of other postprocessing has meant that + using m4 circuit macros and others, and dpic or gpic. In some cases + there are other or better m4 or pic constructs for producing the same + drawings, but names of the actual source-files are shown for reference. + Some of the later examples test the boundaries of what can be done + when employing a ``little language'' like pic. Most of the examples + can be processed using either dpic~-p, dpic~-g, or, with exceptions, + gpic~-t, but the possibility of other postprocessing has meant that sometimes the source is slightly more complicated than it would be if - only one workflow had been assumed. Some of the examples require dpic. - The most simplicity and elegance is achieved by sticking to one pic - interpreter and one postprocessor. + only one workflow had been assumed. The most simplicity and elegance + is achieved by sticking to one pic interpreter and one postprocessor. This document duplicates a few diagrams from the manual Circuit\_macros.pdf. There are also a few files in the examples directory that are not included in this document. To process {\sl file}.m4, for example, type "make {\sl file}.pdf." -% Some of the boundaries of what macros and the pic language can do are -% tested toward the end of the following examples. - \input files \endinput diff --git a/graphics/circuit_macros/examples/exp.m4 b/graphics/circuit_macros/examples/exp.m4 index c518eb9bcf..abcde1c751 100644 --- a/graphics/circuit_macros/examples/exp.m4 +++ b/graphics/circuit_macros/examples/exp.m4 @@ -32,37 +32,37 @@ arad = 0.6*g define(`D3',`0.3*g,0.6*g,0.9*g') # fixed coordinate frame -O: project(O3) -X: project(X0) -Y: project(Y0) +O: Project(O3) +X: Project(X0) +Y: Project(Y0) Fector(X0,Z0) with .Origin at O ; "$x_0$" at X rjust Fector(Y0,Z0) with .Origin at O ; "$y_0$" at Y ljust below - Fector(Z0,Y0) with .Origin at O ; "`$z_0$'" at project(Z0) above + Fector(Z0,Y0) with .Origin at O ; "`$z_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)) + 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 + arc -> ccw from Project(arad,0,0) to Project(rot3Dz(pazim,arad,0,0)) rad arad "$\theta$" below up_ - arc -> cw from project(rot3Dz(pazim,arad,0,0)) \ - to project(R01(arad,0,0)) rad arad - "$\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 + arc -> cw from Project(rot3Dz(pazim,arad,0,0)) \ + to Project(R01(arad,0,0)) rad arad + "$\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 "$\theta$" above right_ - arc -> cw from project(0,0,arad/2) to project(R01(0,0,arad/2)) rad arad/2 + arc -> cw from Project(0,0,arad/2) to Project(R01(0,0,arad/2)) rad arad/2 "$\phi$" ljust at Here+(-1pt__,-3pt__) Fector(R01(X0),R01(Z0)) with .Origin at O ; - "$x_1$" above rjust at project(R01(X0)) + "$x_1$" above rjust at Project(R01(X0)) Fector(R01(Y0),R01(Z0)) with .Origin at O ; - "$y_1$" ljust at project(R01(Y0)) + "$y_1$" ljust at Project(R01(Y0)) Fector(R01(Z0),R01(Y0)) with .Origin at O ; - "$z_1$" above at project(R01(Z0)) + "$z_1$" above at Project(R01(Z0)) thicklines_ # box object dimension @@ -72,23 +72,23 @@ 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) +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)))) +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 @@ -134,24 +134,24 @@ thicklines_ 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) + 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) + 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)))) +# 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,%" @@ -174,15 +174,15 @@ thicklines_ "$\alpha$" at 0.5<S,C> ljust define(`N3D',`0,0,2*alpha') # North pole - N: project(N3D) + N: Project(N3D) "$N$" at N+(0,3pt__) ljust phi = 65*dtor_ define(`Phat3D',`rot3Dz(phi,alpha*3,0,0)') - Phat: "$\hat{P}$" at project(Phat3D) ljust + Phat: "$\hat{P}$" at Project(Phat3D) ljust - X: project(rectht/2*0.8,0,0) - Y: project(0,rectwid/2*0.8,0) + 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 @@ -202,8 +202,8 @@ thinlines_ # axes arrow up alpha*0.5 chop 0.05 chop 0 ; "$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)) + arc ccw -> rad alpha from Project(alpha/2,0,0) to \ + Project(rot3Dz(phi,alpha/2,0,0)) "$\phi$" below at 0.5 between last arc.start and last arc.end # vector (ratio along (N to Phat)) @@ -212,7 +212,7 @@ define(`ray',`sum3D(N3D,sprod3D($1,diff3D(Phat3D,N3D)))') $2 = length3D(diff3D(ray($1),C3D))-alpha } findroot(rayvis, 1e-3, 1, 1e-8, p) # Find P - P: "$P$" at project(ray(p)) ljust above + P: "$P$" at Project(ray(p)) ljust above thicklines_ line dashed from N to P chop 0 chop 0.05 @@ -226,11 +226,11 @@ 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 } + 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 } + Q[n]: Project(sum3D(C3D,meridian(ang))); n+=1 } fitcurve(Q,n-1,dashed) define(`equator',`rot3Dz($1,alpha,0,0)') @@ -240,15 +240,15 @@ define(`equator',`rot3Dz($1,alpha,0,0)') 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 } + 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 } + 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))) + 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 "$\beta$" ljust at last arc.e+(0,2pt__) diff --git a/graphics/circuit_macros/examples/fet.m4 b/graphics/circuit_macros/examples/fet.m4 index 08498ef83d..9cbd0809ce 100644 --- a/graphics/circuit_macros/examples/fet.m4 +++ b/graphics/circuit_macros/examples/fet.m4 @@ -2,10 +2,8 @@ # `fet.m4' cct_init -dwn = 0.9 -dwn = 1.0 -rgt = 0.9 textht = 0.1 +define(`rmove',0.75) dnl `IRF4905(linespec,R)' define(`IRF4905', @@ -18,74 +16,84 @@ define(`IRF4905', G: Q.G circle rad 5*dimen_/10 at Q.tr_xy(0,1) ]') -define(`rmove',0.75) -define(`dir_',`right_') - -Orig: Here -dir_ - { move left 0.2 } - {J: j_fet(right_ dimen_,,,E) - "{\tt j\_fet(right\_ dimen\_,{,},E)}" wid 1.75 \ - with .nw at last [].sw+(0.0,-0.25) - "$G$" at last [].G rjust above - "$S$" at last [].S rjust - "$D$" at last [].D ljust - } - - move right_ 0.9; dir_ - {j_fet(,,P,) - "{\tt 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_ 0.9; dir_ - {e_fet(,R,,) - "{\tt e\_fet(,R,{,})}" at last [].s+(0,-0.05) below - "$G$" at last [].G rjust - "$S$" at last [].S rjust - "$D$" at last [].D ljust - } - - {move down_ dwn; dir_ - e_fet(,,P) - "{\tt e\_fet(,{,}P)}" at last [].s+(0.1,-0.2) below} - - move right_ 0.9; dir_ - {d_fet(,,,) - "{\tt d\_fet(,{,},)}" at last [].s+(0,-0.05) below} - - {move down_ dwn; dir_ - d_fet(,,P) - "{\tt d\_fet(,{,}P)}" at last [].s+(0,-0.05) below} - - move right_ 0.9; dir_ - {e_fet(,,,S) - "{\tt e\_fet(,{,},S)}" at last [].s+(0,-0.05) below} - - {move down_ dwn; dir_ - e_fet(,,P,S) - "{\tt e\_fet(,{,}P,S)}" at last [].s+(0,-0.2) below} - - move right_ 0.9; dir_ - {d_fet(,,,S) - "{\tt d\_fet(,{,},S)}" at last [].s+(0,-0.2) below} - - {move down_ dwn; dir_ - d_fet(,,P,S) - "{\tt d\_fet(,{,}P,S)}" at last [].s+(0,-0.05) below} - - move right_ 0.9; dir_ - {c_fet(,,,) - "{\tt `c\_fet'(,{,},)}" at last [].s+(0,-0.05) below} - - {move down_ dwn; dir_ - c_fet(,,P) - "{\tt `c\_fet'(,{,}P)}" at last [].s+(0,-0.2) below} +Row1: [ J: j_fet + { "{\tt j\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: j_fet(right_ dimen_,,P,E) with .w at J.e+(0.5,0) + { "{\tt j\_fet(right\_}" "{\tt dimen\_,{,}P,E)}" at J.s+(0,-13bp__) below + "$G$" at J.G rjust above + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: e_fet with .w at J.e+(0.5,0) + { "{\tt $\;$ e\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: e_fet(,,P) with .w at J.e+(0.6,0) + { "{\tt $\;$ e\_fet(,{,}P)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: e_fet(,,P,S) with .w at J.e+(0.7,0) + { "{\tt $\;$ e\_fet(,{,}P,S)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: c_fet with .w at J.e+(0.6,0) + { "{\tt $\;$ c\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: c_fet(,,P) with .w at J.e+(0.6,0) + { "{\tt $\;$ c\_fet(,{,}P)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + ] + +Row2: [ + J: d_fet + { "{\tt d\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: d_fet(,,P) with .w at J.e+(0.5,0) + { "{\tt d\_fet(,{,}P)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: d_fet(,,P,S) with .w at J.e+(0.7,0) + { "{\tt d\_fet(,{,}P,S)}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: g_fet with .w at J.e+(0.6,0) + { "{\tt g\_fet}" at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + J: g_fet(up_ dimen_,,P) with .w at J.e+(0.6,0) + { "{\tt `g\_fet'(up\_$\;\;$}" at last [].s below + "{\tt dimen\_,{,}P)}" at last [].s + (0,-12bp__) below + "{\sl G}" at last [].G rjust + "{\sl S}" at last [].S + (0,2bp__) ljust + "{\sl D}" at last [].D + (0,2bp__) ljust below } + right_ + M1: mosfet(,,dBSDFQM1,E) with .w at J.e+(0.5,0) + "$G0$" at M1.G0 above rjust + "$G1$" at M1.G1 above ljust + {"\tt `mosfet'(,{,}dBSDFQM1,E)" wid 1.45 \ + with .nw at last [].sw+(0,-0.2) } + M2: mosfet(,,dBSDFQuM1) with .nw at M1.ne+(0.5,0) + "$G0$" at M2.G0 above ljust + "$G1$" at M2.G1 above rjust + {"\tt ...(,{,}dBSDFQuM1)" wid 1.25 \ + with .n at last [].s+(0,-0.05) } + ] with .nw at Row1.sw+(0,-0.1) -move down 1; right_ - [ +Row3: [ linewid = linewid*1.2 Q1: mosfet(,,dGSDF,) @@ -132,8 +140,22 @@ move down 1; right_ "$D$" at last [].D ljust "$B$" at last [].B below } - - move right_ rmove + move right_ + J: Fe_fet #(right_ dimen_) + {`"{\tt $\;$ Fe\_fet}"' at J.s+(0,-0.05) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + move right_ + J: Fe_fet(,,TEDQSuB) + {`"{\tt $\;$ Fe\_fet(,,TEDSQuB)}"' at J.s+(0,-0.15) below + "$G$" at J.G rjust + "$S$" at J.S rjust + "$D$" at J.D ljust } + ] with .nw at last [].sw + +Row4: [ + {move left 0.5} Q5: mosfet(,,ZSDFdT,) {"\tt `$\ldots$'(,{,}ZSDFdT,)" at last [].s+(0,-0.05) below thinlines_ @@ -144,8 +166,7 @@ move down 1; right_ arrow <- down .08 right .24 from (Q5.G.x,Q5.G.y-0.02) "\tt dT" ljust thicklines_ } - - move right_ rmove + move right_ 0.8 up_ Q6: IRF4905 with .c at Here {`"\tt IRF4905"' at Q6.s+(0,-0.15) below @@ -153,18 +174,6 @@ move down 1; right_ "$D$" at Q6.D ljust above "$S$" at Q6.S ljust below } - ] with .nw at J.sw+(0,-1.35) #Orig+(-0.26,-1.2) - - right_ - M1: mosfet(,,dBSDFQM1,E) with .nw at J.nw+(0,-dwn) - "$G0$" at M1.G0 above rjust - "$G1$" at M1.G1 above ljust - {"\tt `mosfet'(,{,}dBSDFQM1,E)" wid 1.45 \ - with .nw at last [].sw+(0,-0.23) } - M2: mosfet(,,dBSDFQuM1) with .nw at M1.ne+(0.5,0) - "$G0$" at M2.G0 above ljust - "$G1$" at M2.G1 above rjust - {"\tt ...(,{,}dBSDFQuM1)" wid 1.25 \ - with .n at last [].s+(0,-0.05) } + ] with .nw at last [].sw .PE diff --git a/graphics/circuit_macros/examples/files.tex b/graphics/circuit_macros/examples/files.tex index f320c34f9c..a33d0dc50d 100644 --- a/graphics/circuit_macros/examples/files.tex +++ b/graphics/circuit_macros/examples/files.tex @@ -7,9 +7,21 @@ } \bfig{ - \centerline{{\small\getpic{CctTable}}} - \caption{Two-terminal elements, showing some variations - \src{CctTable.m4}.} + \centerline{{\small\getpic{Resistors}}} + \caption{Resistors, showing some variations + \src{Resistors.m4}.} + } + +\bfig{ + \centerline{{\small\getpic{Capacitors}}} + \caption{Capacitors, showing some variations + \src{Capacitors.m4}.} + } + +\bfig{ + \centerline{{\small\getpic{Inductors}}} + \caption{Inductors, showing some variations + \src{Inductors.m4}.} } \bfig{ @@ -47,6 +59,11 @@ \caption{Macros {\tt fuse} and {\tt cbreaker} \src{Fuses.m4}.} } +\bfig{ + \centerline{\getpic{MoreTable}} + \caption{Additional two-terminal elements + \src{MoreTable.m4}.} + } \bfig{ \centerline{\getpic{Grounds}} @@ -146,6 +163,12 @@ } \bfig{ + \centerline{\getpic{Chips}} + \caption{IC package outlines + \src{Chips.m4}.} + } + +\bfig{ \centerline{\getpic{fet}} \caption{FETs, showing programmable components and example customizations \src{fet.m4}.} @@ -484,7 +507,7 @@ \bfig{ \centerline{\getpic{control}} - \caption{Control-system block diagrams that do not require m4 + \caption{Control-system block diagrams \src{control.m4}.} } @@ -539,6 +562,12 @@ } \bfig{ + \centerline{\getpic{Plate}} + \caption{Dimensioning with tolerances + \src{Plate.m4}.} + } + +\bfig{ \centerline{\getpic{ex05}} \caption{Use of {\tt darrow} \src{ex05.m4}.} @@ -570,6 +599,7 @@ determines plotting order \src{graysurf.m4}.} } +\clearpage \bfig{ \centerline{\getpic{shapes}} @@ -578,12 +608,6 @@ } \bfig{ - \centerline{\getpic{AntiqueClock}} - \caption{An antique clock face - \src{AntiqueClock.m4}.} - } - -\bfig{ \centerline{\getpic{Lyap}} \caption{Illustrating a Lyapunov function \src{Lyap.m4}.} @@ -592,7 +616,7 @@ \bfig{ \centerline{\getpic{csc}} \caption{Conestoga Sailing Club (illustrating the filling of arbitrary - shapes) + shapes) and an antique clock face with shading and rotated text \src{csc.m4}.} } @@ -632,6 +656,7 @@ \caption{Dini surface and an icosahedron \src{Dini.m4}.} } +\clearpage \bfig{ \centerline{\getpic{Sierpinski}} diff --git a/graphics/circuit_macros/examples/graysurf.m4 b/graphics/circuit_macros/examples/graysurf.m4 index 22372697b2..9be043b849 100644 --- a/graphics/circuit_macros/examples/graysurf.m4 +++ b/graphics/circuit_macros/examples/graysurf.m4 @@ -25,9 +25,9 @@ Surface:[ Orig: (0,0) linethick_(1.2) - arrow from Orig to 1.2 <Orig,(project(xmax,0,0))> ; "$x$" below - arrow from Orig to 1.2 <Orig,(project(0,ymax,0))> ; "$y$" ljust - arrow from Orig to 1.2 <Orig,(project(0,0,zmax))> ; "$z$" rjust + arrow from Orig to 1.2 <Orig,(Project(xmax,0,0))> ; "$x$" below + arrow from Orig to 1.2 <Orig,(Project(0,ymax,0))> ; "$y$" ljust + arrow from Orig to 1.2 <Orig,(Project(0,0,zmax))> ; "$z$" rjust linethick_(0) for i = 0 to nx-1 do { @@ -36,10 +36,10 @@ Surface:[ 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)) + 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) @@ -63,8 +63,8 @@ define(`tvisible', `dot3D(View3D, 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" ljust +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" ljust dt = 10 # major angle degrees per facet ds = 10 # minor angle degrees per facet @@ -87,10 +87,10 @@ Y: arrow from Orig to (project(0,tradius+sradius*2,0)); "y" ljust 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))) + 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) @@ -102,10 +102,10 @@ thinlines_ } thicklines_ - arrow from Orig to (project(0,0,tradius*1.4)); "z" above - dashline(from Orig to (project(torus(0,0))),,,,G) + 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) + dashline(from Orig to (Project(torus(90,0))),,,,G) arrow to Y.end ] with .sw at last [].se+(0.2,0) @@ -130,11 +130,11 @@ Hat: [ 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)) +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 { @@ -150,14 +150,14 @@ Zv: (project(0,0,1)) 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) + with .c at (Project(0,0,(maxy^2-1)^2)+(0,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))) + 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 } @@ -168,21 +168,21 @@ 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+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 +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) + with .C at (Project(0,0,(maxy^2-1)^2)+(0,linethick bp__/2)) ] scaled 1.25 with .s at 1st [].ne+(0,-0.75) ] scaled 0.85 diff --git a/graphics/circuit_macros/examples/ics.m4 b/graphics/circuit_macros/examples/ics.m4 index c07cb61ea2..bf702d7c44 100644 --- a/graphics/circuit_macros/examples/ics.m4 +++ b/graphics/circuit_macros/examples/ics.m4 @@ -1,16 +1,6 @@ divert(-1) - Macros defining some integrated circuits and connectors - - `DIP_chip_outline( pin count, wid )' -define(`DIP_chip_outline', - `[ define(`m4chgw',`ifelse(`$2',,(18*L_unit),`$2')')dnl - Chip: box invis wid m4chgw ht lg_pinsep*eval((`$1')/2+1) - arcd(last box.n, lg_pinsep/2, 180, 360) - { line to last box.ne chop -linewid bp__/2 } - { line from last arc.start to last box.nw chop -linewid bp__/2 } - line from last box.nw to last box.sw then to last box.se then to last box.ne - `$3']') + Macros defining some integrated circuits and connectors for LaTeX `A sequence of pins along the east or west side of a chip: lg_pinseq(initial pin no, final pin no, @@ -20,6 +10,8 @@ define(`lg_pinseq',`for_($1,$2,1, `lg_pin( Chip.s`$3'+(0,($4+m4x)*lg_pinsep), $6`'m4x,Pin`'eval($5`'m4x),`$3'`$7',eval($5`'m4x))') ') +define(`ic_tiny',`iflatex(`\hbox{\tiny `$1'}',ifsvg(`svg_small(`$1')',`$1'))') +define(`ic_tilde',`iflatex(`{\raisebox{-0.5ex}{\char126}}',~)') define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin12,w,12) @@ -27,7 +19,7 @@ define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep lg_pinseq(0,2,w,4,9+,D) lg_pinseq(3,7,w,4,10+,D) lg_pin(Chip.sw_+(0,13*lg_pinsep),R/lg_bartxt(W),Pin21,w,21) - lg_pin(Chip.sw_+(0,14*lg_pinsep),V\hbox{\tiny CC},Pin24,w,24) + lg_pin(Chip.sw_+(0,14*lg_pinsep),V`'ic_tiny(CC),Pin24,w,24) lg_pin(Chip.se_+(0,lg_pinsep),lg_bartxt(OE),Pin20,eN,20) lg_pinseq(0,7,e,3,8-,A) lg_pinseq(8,9,e,3,31-,A) @@ -35,8 +27,8 @@ define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep `$1']') define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep - lg_pin(Chip.sw_+(0,lg_pinsep),V\hbox{\tiny SS},Pin21,w,21) - lg_pin(Chip.sw_+(0,2*lg_pinsep),V\hbox{\tiny SS},Pin1,w,1) + lg_pin(Chip.sw_+(0,lg_pinsep),V`'ic_tiny(SS),Pin21,w,21) + lg_pin(Chip.sw_+(0,2*lg_pinsep),V`'ic_tiny(SS),Pin1,w,1) lg_pin(Chip.sw_+(0,4*lg_pinsep),R/lg_bartxt(W),Pin34,w,34) lg_pinseq(0,7,w,6,33-,D) lg_pin(Chip.sw_+(0,15*lg_pinsep),lg_bartxt(RESET),Pin40,wN,40) @@ -44,19 +36,19 @@ define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep lg_pin(Chip.sw_+(0,19*lg_pinsep),lg_bartxt(NMI),Pin6,wN,6) 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\hbox{\tiny CC},Pin8,w,8) - lg_pin(Chip.se_+(0,lg_pinsep),{\large$\phi$}\hbox{\tiny 1}(in),Pin39,e,39) + lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'ic_tiny(CC),Pin8,w,8) + lg_pin(Chip.se_+(0,lg_pinsep),CK`'ic_tiny(1)(in),Pin39,e,39) lg_pin(Chip.se_+(0,4*lg_pinsep), - {\large$\phi$}\hbox{\tiny 2}(out),Pin37,e,37) + CK`'ic_tiny(2)(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),lg_bartxt(IRQ),Pin4,eN,4) `$1']') define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep - lg_pin(Chip.sw_+(0,lg_pinsep),V\hbox{\tiny SS},Pin1,w,1) + lg_pin(Chip.sw_+(0,lg_pinsep),V`'ic_tiny(SS),Pin1,w,1) lg_pin(Chip.sw_+(0,3*lg_pinsep),CS1,Pin24,w,24) - lg_pin(Chip.sw_+(0,4*lg_pinsep),{\large$\phi$},Pin25,w,25) + lg_pin(Chip.sw_+(0,4*lg_pinsep),CK,Pin25,w,25) lg_pin(Chip.sw_+(0,5*lg_pinsep),lg_bartxt(CS2),Pin23,wN,23) 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) @@ -65,7 +57,7 @@ define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep lg_pinseq(0,7,w,12,33-,D) lg_pin(Chip.sw_+(0,21*lg_pinsep),R/lg_bartxt(W),Pin22,w,22) lg_pin(Chip.sw_+(0,22*lg_pinsep),lg_bartxt(IRQ),Pin21,wN,21) - lg_pin(Chip.sw_+(0,23*lg_pinsep),V\hbox{\tiny CC},Pin20,w,20) + lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'ic_tiny(CC),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) @@ -81,12 +73,12 @@ define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep 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\hbox{\tiny CC},Pin16,w,16) + lg_pin(Chip.sw_+(0,10*lg_pinsep),V`'ic_tiny(CC),Pin16,w,16) lg_pinseq(0,6,e,2,15-,Y,n) lg_pin(Chip.se_+(0,9*lg_pinsep),Y7,Pin7,eN,7) `$1']') -define(`ic4017',`[ Chip: chip_gen(16) +define(`ic4017',`[ Chip: DIP_chip_outline(16) Loopover_(`x', `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)', PL, Q3, I3, I0, CLE, Q0, TC, GND) @@ -95,7 +87,7 @@ define(`ic4017',`[ Chip: chip_gen(16) MR, U/D, Q1, I1, I2, Q2, CLK, Vcc) `$1']') -define(`ic4510',`[ Chip: chip_gen(16) +define(`ic4510',`[ Chip: DIP_chip_outline(16) Loopover_(`x', `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)', PL, Q3, I3, I0, CLE, Q0, TC, GND) @@ -104,13 +96,13 @@ define(`ic4510',`[ Chip: chip_gen(16) MR, U/D, Q1, I1, I2, Q2, CLK, Vcc) `$1']') -define(`icVS1053',`[ Chip: chip_gen(32) +define(`icVS1053',`[ Chip: DIP_chip_outline(32) Loopover_(`x', `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)', LOUT,ROUT,GBUF,AGND,AGND,DREG,Vcc,3V3,GND,MISO,MOSI,sclk,RST,CS,DCS,DCS) Loopover_(`x', `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+16),e,eval(m4Lx+16))', - SDCD,RX,TX,7,6,5,4,3,2,1,0,GND,3V3,AGND,MIC-,MIC+) + SDCD,RX,TX,7,6,5,4,3,2,1,0,GND,3V3,AGND,MIC`$-$',MIC`$+$') `$1']') `ArduinoUno( wid,ht,pinlen )' @@ -125,14 +117,14 @@ define(`ArduinoUno',`[ Loopover_(`x',`ifelse(x,nul,, `Pin`'eval(5+m4Lx): line left_ plen from Connector.nw-(0,(5+m4Lx)*lg_pinsep) { "x" ljust at last line.start }')', - IOREF, RESET,`$+$`'3V3',`$+$`'5V', GND, GND, VIN, + IOREF, RESET,$+${3}V3,$+${5}V, GND, GND, VIN, nul, A0, A1, A2, A3, A4, A5) # Loopover_(`x',`ifelse(x,nul,, `Pin`'eval(22-m4Lx): line right_ plen from Connector.ne-(0,m4Lx*lg_pinsep) { "x" rjust at last line.start }')', - SCL, SDA, AREF, GND, D13, D12, \char126 D11, \char126 D10, \char126 D9, D8, - nul, D7, \char126 D6, \char126 D5, D4, \char126 D3, D2, TX D1, RX D0) + SCL, SDA, AREF, GND, D13, D12, ic_tilde`'D11, ic_tilde`'D10, ic_tilde`'D9, D8, + nul, D7, ic_tilde`'D6, ic_tilde`'D5, D4, ic_tilde`'D3, D2, TX D1, RX D0) # `$4'] ') @@ -148,15 +140,15 @@ define(`ArduinoLeonardo',`[ Loopover_(`x',`ifelse(x,nul,, `Pin`'eval(5+m4Lx): line left_ plen from Connector.nw-(0,(5+m4Lx)*lg_pinsep) { "x" ljust at last line.start }')', - IOREF, RESET,`$+$`'3V3',`$+$`'5V', GND, GND, VIN, + IOREF, RESET,$+${3}V3,$+${5}V, GND, GND, VIN, nul, A0, A1, A2, A3, A4, A5) # Loopover_(`x',`ifelse(x,nul,, `Pin`'eval(22-m4Lx): line right_ plen from Connector.ne-(0,m4Lx*lg_pinsep) { "x" rjust at last line.start }')', SCL, SDA, AREF, GND, - \char126 D13, D12, \char126 D11, \char126 D10, \char126 D9, D8, - nul, D7, \char126 D6, \char126 D5, D4, \char126 D3, D2, TX D1, RX D0) + ic_tilde`'D13, D12, ic_tilde`'D11, ic_tilde`'D10, ic_tilde`'D9, D8, + nul, D7, ic_tilde`'D6, ic_tilde`'D5, D4, ic_tilde`'D3, D2, TX D1, RX D0) # `$4'] ') @@ -221,12 +213,14 @@ define(`USB_C_Socket',`[ `B`'eval(13-m4Lx): dnl line left_ plen from Base.n-(m4bwid/2,(m4Lx+0.5)*lg_pinsep) {"x" ljust at last line.start}', - GND, RX1$+$, RX1$-$, VBUS, SBU2, D$-$, D$+$, CC2, VBUS, TX2$-$, TX2$+$, GND) + GND, RX1`$+$', RX1`$-$', VBUS, SBU2, D`$-$', D`$+$', CC2, VBUS, TX2`$-$', + TX2`$+$', GND) # Loopover_(`x', `A`'m4Lx: line right_ plen from Base.n+(m4bwid/2,-(m4Lx+0.5)*lg_pinsep) {"x" rjust at last line.start}', - GND, TX1$+$, TX1$-$, VBUS, CC1, D$+$, D$-$, SBU1, VBUS, RX2$-$, RX2$+$, GND) + GND, TX1`$+$', TX1`$-$', VBUS, CC1, D`$+$', D`$-$', SBU1, VBUS, RX2`$-$', + RX2`$+$', GND) # `$4']') @@ -245,8 +239,9 @@ define(`HDMI_micro',`[ `Pin`'m4Lx: line left_ plen from Base.nw-(0,m4bwid/3+m4Lx*lg_pinsep) {"x" ljust at last line.start} "m4Lx" at last line.c above', - HPD, UTILITY, D2$+$, D2\_SH, D2$-$, D1$+$, D1\_SH, D1$-$, D0$+$, D0\_SH, - D0$-$, CLK$+$, CLK\_SH, CLK$-$, CEC, GND, SCL, SDA, $+``$''5V) + HPD, UTILITY, D2`$+$', D2\_SH, D2`$-$', D1`$+$', D1\_SH, D1`$-$', + D0`$+$', D0\_SH, D0`$-$', CLK`$+$', CLK\_SH, CLK`$-$', + CEC, GND, SCL, SDA,$+${5}V) line from Base.nw+(m4bwid*2/3-lg_pinsep,0) up plen r_text(21) at last line.c+(-5bp__,0) r_text(SH2) at last line.start + (0,-10bp__) @@ -262,4 +257,51 @@ define(`HDMI_micro',`[ # `$4']') + `DIP_chip_outline( pin count, wid )' +define(`DIP_chip_outline', + `[ define(`m4pinct',`ifelse(`$1',,16,`$1')')dnl + define(`m4chgw',`ifelse(`$2',,(18*L_unit),`$2')')dnl + Chip: box invis wid m4chgw ht lg_pinsep*eval((m4pinct)/2+1) + arcd(Chip.n, lg_pinsep/2, 180, 360) + { line to Chip.ne chop -linewid bp__/2 } + { line from last arc.start to Chip.nw chop -linewid bp__/2 } + line from Chip.nw to Chip.sw then to Chip.se then to Chip.ne + `$3']') + + `DIP( pin count, attributes) + Dual in-line package + attributes=semicolon-separated list of optional terms: + bodywid=expr; (default 0.25 = 5*L_unit ) + bodylen=expr; (default pin count/2 x pinpitch) + pinpitch=expr; (default 0.1) + pinwid=expr; (default 0.06) + pinlen=expr; (default 0.05) + direct=U|D|L|R;(default U for up) + type=I|Q; (default I for uniform-length pins; + Q: staggered) ' +define(`DIP',`[ pinct= ifelse(`$1',,8,`$1') + setkeys_(`$2', + bodywid: 5*L_unit; + bodylen: m4pinpitch*int(pinct/2+0.5); + pinpitch:2*L_unit; + pinwid: 1.2*L_unit; + pinlen: L_unit; + direct:U:N; + type:I:N) + setdir_(m4direct,U) + Body: box ht_ m4bodywid wid_ m4bodylen + arcs = ifelse(m4dir,right,90,m4dir,up,180,m4dir,left,270,0) + arcd(Body.e_, 0.1/2, arcs,arcs+180) + np2 = int(pinct/2+0.5) + define(`m4bxht',`m4pinlen ifelse(m4type,Q,`*(1+(i%%2))')')dnl + for i=0 to np2-1 do { + exec sprintf("Pin%g: box ht_ m4bxht wid_ m4pinwid \ + with .s_ at (i+0.5)/np2 between Body.ne_ and Body.nw_",i+1) } + for i=np2+1 to pinct do { + exec sprintf("Pin%g: box ht_ m4bxht wid_ m4pinwid \ + with .n_ at (i-np2-0.5)/(pinct-np2) between Body.sw_ and Body.se_",i) } + `$3'; resetdir_ + popdef(`m4bodywid',`m4bodylen',`m4pinpitch',`m4pinwid',`m4pinlen',`m4direct', + `m4type') ]')) + divert(0)dnl diff --git a/graphics/circuit_macros/examples/lcct.m4 b/graphics/circuit_macros/examples/lcct.m4 index 8fe244d796..dc3f2cd890 100644 --- a/graphics/circuit_macros/examples/lcct.m4 +++ b/graphics/circuit_macros/examples/lcct.m4 @@ -3,6 +3,7 @@ log_init include(ics.m4) iflatex(`ifpsfrag(,`latexcommand({\sf)')') +maxpswid = 10 define(`dimen_',0.5) define(`elen_',dimen_) diff --git a/graphics/circuit_macros/examples/mf/cct.mf b/graphics/circuit_macros/examples/mf/cct.mf index e523a753e2..dd0dcdfd11 100644 --- a/graphics/circuit_macros/examples/mf/cct.mf +++ b/graphics/circuit_macros/examples/mf/cct.mf @@ -1,5 +1,5 @@ % cct.mf, generated by Mfpic, v1.10 2012/12/03, -% from TeX source "font" on 2021/01/03 at 16:42 +% from TeX source "font" on 2021/06/02 at 22:43 numeric mfpicversion; mfpicversion := 110; if unknown mode: mode := localfont; fi if unknown mag: mag := 1000/1000; fi @@ -81,69 +81,69 @@ store (curpath) drawn polyline (false) ((0,0), -(0.024933,0)); +(0.020249,0)); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0.024933,0),0.002767); +circle ((0.020249,0),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((0.070249,0.021131),-155,-410,0.05); +arcplr ((0.065564,0.021131),-155,-410,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0.102388,-0.017171),0.002767); +circle ((0.097703,-0.017171),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((0.134527,0.021131),-130,-410,0.05); +arcplr ((0.129843,0.021131),-130,-410,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0.166667,-0.017171),0.002767); +circle ((0.161982,-0.017171),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((0.198806,0.021131),-130,-410,0.05); +arcplr ((0.194121,0.021131),-130,-410,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0.230945,-0.017171),0.002767); +circle ((0.226261,-0.017171),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((0.263085,0.021131),-130,-385,0.05); +arcplr ((0.2584,0.021131),-130,-385,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0.3084,0),0.002767); +circle ((0.303716,0),0.002767); resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((0.3084,0), -(0.333333,0)); +((0.303716,0), +(0.323964,0)); endmfpic; % (3) line 59 in the TeX source. %------------------------------------------ @@ -163,69 +163,69 @@ store (curpath) drawn polyline (false) ((0,0), -(0,-0.024933)); +(0,-0.020249)); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0,-0.024933),0.002767); +circle ((0,-0.020249),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((0.021131,-0.070249),115,-140,0.05); +arcplr ((0.021131,-0.065564),115,-140,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0.017171,-0.102388),0.002767); +circle ((-0.017171,-0.097703),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((0.021131,-0.134527),140,-140,0.05); +arcplr ((0.021131,-0.129843),140,-140,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0.017171,-0.166667),0.002767); +circle ((-0.017171,-0.161982),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((0.021131,-0.198806),140,-140,0.05); +arcplr ((0.021131,-0.194121),140,-140,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0.017171,-0.230945),0.002767); +circle ((-0.017171,-0.226261),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((0.021131,-0.263085),140,-115,0.05); +arcplr ((0.021131,-0.2584),140,-115,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0,-0.3084),0.002767); +circle ((0,-0.303716),0.002767); resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((0,-0.3084), -(0,-0.333333)); +((0,-0.303716), +(0,-0.323964)); endmfpic; % (4) line 77 in the TeX source. %------------------------------------------ @@ -245,69 +245,69 @@ store (curpath) drawn polyline (false) ((0,0), -(-0.024933,0)); +(-0.020249,0)); resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0.024933,0),0.002767); +circle ((-0.020249,0),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((-0.070249,-0.021131),25,-230,0.05); +arcplr ((-0.065564,-0.021131),25,-230,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0.102388,0.017171),0.002767); +circle ((-0.097703,0.017171),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((-0.134527,-0.021131),50,-230,0.05); +arcplr ((-0.129843,-0.021131),50,-230,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0.166667,0.017171),0.002767); +circle ((-0.161982,0.017171),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((-0.198806,-0.021131),50,-230,0.05); +arcplr ((-0.194121,-0.021131),50,-230,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0.230945,0.017171),0.002767); +circle ((-0.226261,0.017171),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((-0.263085,-0.021131),50,-205,0.05); +arcplr ((-0.2584,-0.021131),50,-205,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0.3084,-0),0.002767); +circle ((-0.303716,-0),0.002767); resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((-0.3084,-0), -(-0.333333,-0)); +((-0.303716,-0), +(-0.323964,-0)); endmfpic; % (5) line 95 in the TeX source. %------------------------------------------ @@ -327,69 +327,69 @@ store (curpath) drawn polyline (false) ((0,0), -(0,0.024933)); +(0,0.020249)); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0,0.024933),0.002767); +circle ((0,0.020249),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((-0.021131,0.070249),-65,-320,0.05); +arcplr ((-0.021131,0.065564),-65,-320,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0.017171,0.102388),0.002767); +circle ((0.017171,0.097703),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((-0.021131,0.134527),-40,-320,0.05); +arcplr ((-0.021131,0.129843),-40,-320,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0.017171,0.166667),0.002767); +circle ((0.017171,0.161982),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((-0.021131,0.198806),-40,-320,0.05); +arcplr ((-0.021131,0.194121),-40,-320,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((0.017171,0.230945),0.002767); +circle ((0.017171,0.226261),0.002767); resizedrawpen (0.8bp); store (curpath) drawn -arcplr ((-0.021131,0.263085),-40,-295,0.05); +arcplr ((-0.021131,0.2584),-40,-295,0.05); resizedrawpen (0.4bp); store (curpath) drawn -circle ((-0,0.3084),0.002767); +circle ((-0,0.303716),0.002767); resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((-0,0.3084), -(-0,0.333333)); +((-0,0.303716), +(-0,0.323964)); endmfpic; % (6) line 113 in the TeX source. %------------------------------------------ @@ -398,52 +398,28 @@ endmfpic; % (6) line 113 in the TeX source. %----------------------------<7> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.146418, 0.333333, 0, 0.123214); +bounds (0, 0.333333, 0, 0); beginmfpic(7); % line 114 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; -store (curpath) -drawn -polyline (false) -((-0.146418,0.091964), -(0.146418,0.091964)); - -store (curpath) -drawn -polyline (false) -((-0.146418,0.123214), -(0.146418,0.123214)); - -endmfpic; % (7) line 122 in the TeX source. +endmfpic; % (7) line 118 in the TeX source. %------------------------------------------ %----------------------------<8> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.123214, 0, -0.146418, 0.333333); +bounds (0, 0, 0, 0.333333); -beginmfpic(8); % line 123 in the TeX source. +beginmfpic(8); % line 119 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; -store (curpath) -drawn -polyline (false) -((-0.091964,-0.146418), -(-0.091964,0.146418)); - -store (curpath) -drawn -polyline (false) -((-0.123214,-0.146418), -(-0.123214,0.146418)); - -endmfpic; % (8) line 131 in the TeX source. +endmfpic; % (8) line 123 in the TeX source. %------------------------------------------ @@ -452,7 +428,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0, 0.03125); -beginmfpic(9); % line 132 in the TeX source. +beginmfpic(9); % line 124 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -485,7 +461,7 @@ polyline (false) ((0.291667,0), (0.333333,0)); -endmfpic; % (9) line 144 in the TeX source. +endmfpic; % (9) line 136 in the TeX source. %------------------------------------------ @@ -494,7 +470,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0, 0.03125, -0.333333, 0); -beginmfpic(10); % line 145 in the TeX source. +beginmfpic(10); % line 137 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -511,23 +487,23 @@ arcplr ((0,-0.072917),90,-90,0.03125); store (curpath) drawn -arcplr ((-0,-0.135417),90,-90,0.03125); +arcplr ((0,-0.135417),90,-90,0.03125); store (curpath) drawn -arcplr ((-0,-0.197917),90,-90,0.03125); +arcplr ((0,-0.197917),90,-90,0.03125); store (curpath) drawn -arcplr ((-0,-0.260417),90,-90,0.03125); +arcplr ((0,-0.260417),90,-90,0.03125); store (curpath) drawn polyline (false) -((-0,-0.291667), -(-0,-0.333333)); +((0,-0.291667), +(0,-0.333333)); -endmfpic; % (10) line 157 in the TeX source. +endmfpic; % (10) line 149 in the TeX source. %------------------------------------------ @@ -536,7 +512,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.03125, 0); -beginmfpic(11); % line 158 in the TeX source. +beginmfpic(11); % line 150 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -549,7 +525,7 @@ polyline (false) store (curpath) drawn -arcplr ((-0.072917,0),-0,-180,0.03125); +arcplr ((-0.072917,0),0,-180,0.03125); store (curpath) drawn @@ -569,7 +545,7 @@ polyline (false) ((-0.291667,0), (-0.333333,0)); -endmfpic; % (11) line 170 in the TeX source. +endmfpic; % (11) line 162 in the TeX source. %------------------------------------------ @@ -578,7 +554,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.03125, 0, 0, 0.333333); -beginmfpic(12); % line 171 in the TeX source. +beginmfpic(12); % line 163 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -599,19 +575,19 @@ arcplr ((0,0.135417),-90,-270,0.03125); store (curpath) drawn -arcplr ((-0,0.197917),-90,-270,0.03125); +arcplr ((0,0.197917),-90,-270,0.03125); store (curpath) drawn -arcplr ((-0,0.260417),-90,-270,0.03125); +arcplr ((0,0.260417),-90,-270,0.03125); store (curpath) drawn polyline (false) -((-0,0.291667), -(-0,0.333333)); +((0,0.291667), +(0,0.333333)); -endmfpic; % (12) line 183 in the TeX source. +endmfpic; % (12) line 175 in the TeX source. %------------------------------------------ @@ -620,7 +596,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.03125, 0, 0, 0.333333); -beginmfpic(13); % line 184 in the TeX source. +beginmfpic(13); % line 176 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -641,71 +617,47 @@ arcplr ((0,0.135417),-90,-270,0.03125); store (curpath) drawn -arcplr ((-0,0.197917),-90,-270,0.03125); +arcplr ((0,0.197917),-90,-270,0.03125); store (curpath) drawn -arcplr ((-0,0.260417),-90,-270,0.03125); +arcplr ((0,0.260417),-90,-270,0.03125); store (curpath) drawn polyline (false) -((-0,0.291667), -(-0,0.333333)); +((0,0.291667), +(0,0.333333)); -endmfpic; % (13) line 196 in the TeX source. +endmfpic; % (13) line 188 in the TeX source. %------------------------------------------ %----------------------------<14> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.125, 0.333333, 0, 0.083333); +bounds (0, 0.333333, 0, 0); -beginmfpic(14); % line 197 in the TeX source. +beginmfpic(14); % line 189 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; -store (curpath) -drawn -polyline (false) -((-0.125,0.052083), -(0.125,0.052083)); - -store (curpath) -drawn -polyline (false) -((-0.125,0.083333), -(0.125,0.083333)); - -endmfpic; % (14) line 205 in the TeX source. +endmfpic; % (14) line 193 in the TeX source. %------------------------------------------ %----------------------------<15> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.083333, 0, -0.125, 0.333333); +bounds (0, 0, 0, 0.333333); -beginmfpic(15); % line 206 in the TeX source. +beginmfpic(15); % line 194 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; -store (curpath) -drawn -polyline (false) -((-0.052083,-0.125), -(-0.052083,0.125)); - -store (curpath) -drawn -polyline (false) -((-0.083333,-0.125), -(-0.083333,0.125)); - -endmfpic; % (15) line 214 in the TeX source. +endmfpic; % (15) line 198 in the TeX source. %------------------------------------------ @@ -714,7 +666,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.0625, 0.0625); -beginmfpic(16); % line 215 in the TeX source. +beginmfpic(16); % line 199 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -741,7 +693,7 @@ polyline (false) ((0.17492,0), (0.333333,0)); -endmfpic; % (16) line 226 in the TeX source. +endmfpic; % (16) line 210 in the TeX source. %------------------------------------------ @@ -750,7 +702,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.0625, 0.0625, -0.333333, 0); -beginmfpic(17); % line 227 in the TeX source. +beginmfpic(17); % line 211 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -777,7 +729,7 @@ polyline (false) ((0,-0.17492), (0,-0.333333)); -endmfpic; % (17) line 238 in the TeX source. +endmfpic; % (17) line 222 in the TeX source. %------------------------------------------ @@ -786,7 +738,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.0625, 0.0625); -beginmfpic(18); % line 239 in the TeX source. +beginmfpic(18); % line 223 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -813,7 +765,7 @@ polyline (false) ((-0.17492,0), (-0.333333,0)); -endmfpic; % (18) line 250 in the TeX source. +endmfpic; % (18) line 234 in the TeX source. %------------------------------------------ @@ -822,7 +774,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.0625, 0.0625, 0, 0.333333); -beginmfpic(19); % line 251 in the TeX source. +beginmfpic(19); % line 235 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -849,7 +801,7 @@ polyline (false) ((0,0.17492), (0,0.333333)); -endmfpic; % (19) line 262 in the TeX source. +endmfpic; % (19) line 246 in the TeX source. %------------------------------------------ @@ -858,7 +810,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.083333, 0.083333); -beginmfpic(20); % line 263 in the TeX source. +beginmfpic(20); % line 247 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -887,7 +839,7 @@ polyline (false) ((0.191667,0), (0.333333,0)); -endmfpic; % (20) line 275 in the TeX source. +endmfpic; % (20) line 259 in the TeX source. %------------------------------------------ @@ -896,7 +848,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.083333, 0.083333, 0, 0.333333); -beginmfpic(21); % line 276 in the TeX source. +beginmfpic(21); % line 260 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -925,7 +877,7 @@ polyline (false) ((0,0.191667), (0,0.333333)); -endmfpic; % (21) line 288 in the TeX source. +endmfpic; % (21) line 272 in the TeX source. %------------------------------------------ @@ -934,7 +886,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.051253, 0.051253); -beginmfpic(22); % line 289 in the TeX source. +beginmfpic(22); % line 273 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -945,9 +897,11 @@ polyline (false) ((0,0), (0.130582,0)); +resizedrawpen (0bp); + store (curpath) -filled drawn +filled lclosed polyline (false) ((0.130582,0), @@ -956,6 +910,17 @@ polyline (false) (0.130582,-0.041667), (0.130582,0)); +resizedrawpen (0.8bp); + +store (curpath) +drawn +polyline (false) +((0.130582,0), +(0.130582,0.041667), +(0.197216,0), +(0.130582,-0.041667), +(0.130582,0)); + store (curpath) drawn polyline (false) @@ -968,7 +933,7 @@ polyline (false) ((0.202751,0), (0.333333,0)); -endmfpic; % (22) line 305 in the TeX source. +endmfpic; % (22) line 294 in the TeX source. %------------------------------------------ @@ -977,7 +942,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.051253, 0.051253, -0.333333, 0); -beginmfpic(23); % line 306 in the TeX source. +beginmfpic(23); % line 295 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -988,9 +953,11 @@ polyline (false) ((0,0), (0,-0.130582)); +resizedrawpen (0bp); + store (curpath) -filled drawn +filled lclosed polyline (false) ((0,-0.130582), @@ -999,6 +966,17 @@ polyline (false) (-0.041667,-0.130582), (0,-0.130582)); +resizedrawpen (0.8bp); + +store (curpath) +drawn +polyline (false) +((0,-0.130582), +(0.041667,-0.130582), +(0,-0.197216), +(-0.041667,-0.130582), +(0,-0.130582)); + store (curpath) drawn polyline (false) @@ -1011,7 +989,7 @@ polyline (false) ((0,-0.202751), (0,-0.333333)); -endmfpic; % (23) line 322 in the TeX source. +endmfpic; % (23) line 316 in the TeX source. %------------------------------------------ @@ -1020,7 +998,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.051253, 0.051253); -beginmfpic(24); % line 323 in the TeX source. +beginmfpic(24); % line 317 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1031,9 +1009,11 @@ polyline (false) ((0,0), (-0.130582,0)); +resizedrawpen (0bp); + store (curpath) -filled drawn +filled lclosed polyline (false) ((-0.130582,0), @@ -1042,6 +1022,17 @@ polyline (false) (-0.130582,0.041667), (-0.130582,0)); +resizedrawpen (0.8bp); + +store (curpath) +drawn +polyline (false) +((-0.130582,0), +(-0.130582,-0.041667), +(-0.197216,0), +(-0.130582,0.041667), +(-0.130582,0)); + store (curpath) drawn polyline (false) @@ -1054,7 +1045,7 @@ polyline (false) ((-0.202751,0), (-0.333333,0)); -endmfpic; % (24) line 339 in the TeX source. +endmfpic; % (24) line 338 in the TeX source. %------------------------------------------ @@ -1063,7 +1054,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.051253, 0.051253, 0, 0.333333); -beginmfpic(25); % line 340 in the TeX source. +beginmfpic(25); % line 339 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1074,9 +1065,11 @@ polyline (false) ((0,0), (0,0.130582)); +resizedrawpen (0bp); + store (curpath) -filled drawn +filled lclosed polyline (false) ((0,0.130582), @@ -1085,6 +1078,17 @@ polyline (false) (0.041667,0.130582), (0,0.130582)); +resizedrawpen (0.8bp); + +store (curpath) +drawn +polyline (false) +((0,0.130582), +(-0.041667,0.130582), +(0,0.197216), +(0.041667,0.130582), +(0,0.130582)); + store (curpath) drawn polyline (false) @@ -1097,7 +1101,7 @@ polyline (false) ((0,0.202751), (0,0.333333)); -endmfpic; % (25) line 356 in the TeX source. +endmfpic; % (25) line 360 in the TeX source. %------------------------------------------ @@ -1106,7 +1110,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.051253, 0.051253); -beginmfpic(26); % line 357 in the TeX source. +beginmfpic(26); % line 361 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1117,9 +1121,11 @@ polyline (false) ((0,0), (0.130582,0)); +resizedrawpen (0bp); + store (curpath) -filled drawn +filled lclosed polyline (false) ((0.130582,0), @@ -1128,6 +1134,17 @@ polyline (false) (0.130582,-0.041667), (0.130582,0)); +resizedrawpen (0.8bp); + +store (curpath) +drawn +polyline (false) +((0.130582,0), +(0.130582,0.041667), +(0.197216,0), +(0.130582,-0.041667), +(0.130582,0)); + store (curpath) drawn polyline (false) @@ -1142,7 +1159,7 @@ polyline (false) ((0.202751,0), (0.333333,0)); -endmfpic; % (26) line 375 in the TeX source. +endmfpic; % (26) line 384 in the TeX source. %------------------------------------------ @@ -1151,7 +1168,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.051253, 0.051253, -0.333333, 0); -beginmfpic(27); % line 376 in the TeX source. +beginmfpic(27); % line 385 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1162,9 +1179,11 @@ polyline (false) ((0,0), (0,-0.130582)); +resizedrawpen (0bp); + store (curpath) -filled drawn +filled lclosed polyline (false) ((0,-0.130582), @@ -1173,6 +1192,17 @@ polyline (false) (-0.041667,-0.130582), (0,-0.130582)); +resizedrawpen (0.8bp); + +store (curpath) +drawn +polyline (false) +((0,-0.130582), +(0.041667,-0.130582), +(0,-0.197216), +(-0.041667,-0.130582), +(0,-0.130582)); + store (curpath) drawn polyline (false) @@ -1187,7 +1217,7 @@ polyline (false) ((0,-0.202751), (0,-0.333333)); -endmfpic; % (27) line 394 in the TeX source. +endmfpic; % (27) line 408 in the TeX source. %------------------------------------------ @@ -1196,7 +1226,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.051253, 0.051253); -beginmfpic(28); % line 395 in the TeX source. +beginmfpic(28); % line 409 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1207,9 +1237,11 @@ polyline (false) ((0,0), (-0.130582,0)); +resizedrawpen (0bp); + store (curpath) -filled drawn +filled lclosed polyline (false) ((-0.130582,0), @@ -1218,6 +1250,17 @@ polyline (false) (-0.130582,0.041667), (-0.130582,0)); +resizedrawpen (0.8bp); + +store (curpath) +drawn +polyline (false) +((-0.130582,0), +(-0.130582,-0.041667), +(-0.197216,0), +(-0.130582,0.041667), +(-0.130582,0)); + store (curpath) drawn polyline (false) @@ -1232,7 +1275,7 @@ polyline (false) ((-0.202751,0), (-0.333333,0)); -endmfpic; % (28) line 413 in the TeX source. +endmfpic; % (28) line 432 in the TeX source. %------------------------------------------ @@ -1241,7 +1284,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.051253, 0.051253, 0, 0.333333); -beginmfpic(29); % line 414 in the TeX source. +beginmfpic(29); % line 433 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1252,9 +1295,11 @@ polyline (false) ((0,0), (0,0.130582)); +resizedrawpen (0bp); + store (curpath) -filled drawn +filled lclosed polyline (false) ((0,0.130582), @@ -1263,6 +1308,17 @@ polyline (false) (0.041667,0.130582), (0,0.130582)); +resizedrawpen (0.8bp); + +store (curpath) +drawn +polyline (false) +((0,0.130582), +(-0.041667,0.130582), +(0,0.197216), +(0.041667,0.130582), +(0,0.130582)); + store (curpath) drawn polyline (false) @@ -1277,7 +1333,7 @@ polyline (false) ((0,0.202751), (0,0.333333)); -endmfpic; % (29) line 432 in the TeX source. +endmfpic; % (29) line 456 in the TeX source. %------------------------------------------ @@ -1286,7 +1342,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.036084, 0.333333, -0.051253, 0.051253); -beginmfpic(30); % line 433 in the TeX source. +beginmfpic(30); % line 457 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1297,7 +1353,7 @@ polyline (false) ((-0.036084,-0.045718), (-0.036084,0.045718)); -endmfpic; % (30) line 439 in the TeX source. +endmfpic; % (30) line 463 in the TeX source. %------------------------------------------ @@ -1306,7 +1362,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.051253, 0.051253, -0.333333, 0.036084); -beginmfpic(31); % line 440 in the TeX source. +beginmfpic(31); % line 464 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1317,7 +1373,7 @@ polyline (false) ((-0.045718,0.036084), (0.045718,0.036084)); -endmfpic; % (31) line 446 in the TeX source. +endmfpic; % (31) line 470 in the TeX source. %------------------------------------------ @@ -1326,7 +1382,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.0625, 0.0625); -beginmfpic(32); % line 447 in the TeX source. +beginmfpic(32); % line 471 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1365,7 +1421,7 @@ polyline (false) ((0.208333,0), (0.333333,0)); -endmfpic; % (32) line 465 in the TeX source. +endmfpic; % (32) line 489 in the TeX source. %------------------------------------------ @@ -1374,7 +1430,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.0625, 0.0625, -0.333333, 0); -beginmfpic(33); % line 466 in the TeX source. +beginmfpic(33); % line 490 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1413,7 +1469,7 @@ polyline (false) ((0,-0.208333), (0,-0.333333)); -endmfpic; % (33) line 484 in the TeX source. +endmfpic; % (33) line 508 in the TeX source. %------------------------------------------ @@ -1422,7 +1478,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.125, 0.125); -beginmfpic(34); % line 485 in the TeX source. +beginmfpic(34); % line 509 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1443,7 +1499,7 @@ polyline (false) ((0.291667,0), (0.333333,0)); -endmfpic; % (34) line 494 in the TeX source. +endmfpic; % (34) line 518 in the TeX source. %------------------------------------------ @@ -1452,7 +1508,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.125, 0.125, 0, 0.333333); -beginmfpic(35); % line 495 in the TeX source. +beginmfpic(35); % line 519 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1473,7 +1529,7 @@ polyline (false) ((0,0.291667), (0,0.333333)); -endmfpic; % (35) line 504 in the TeX source. +endmfpic; % (35) line 528 in the TeX source. %------------------------------------------ @@ -1482,7 +1538,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.083333, 0.083333, -0.041667, 0.041667); -beginmfpic(36); % line 505 in the TeX source. +beginmfpic(36); % line 529 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1495,7 +1551,7 @@ store (curpath) drawn arcplr ((0.041667,0),180,360,0.041667); -endmfpic; % (36) line 511 in the TeX source. +endmfpic; % (36) line 535 in the TeX source. %------------------------------------------ @@ -1504,7 +1560,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.15, 0.15); -beginmfpic(37); % line 512 in the TeX source. +beginmfpic(37); % line 536 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1530,7 +1586,7 @@ polyline (false) ((0.316667,0), (0.333333,0)); -endmfpic; % (37) line 525 in the TeX source. +endmfpic; % (37) line 549 in the TeX source. %------------------------------------------ @@ -1539,7 +1595,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.15, 0.15, 0, 0.333333); -beginmfpic(38); % line 526 in the TeX source. +beginmfpic(38); % line 550 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1565,7 +1621,7 @@ polyline (false) ((0,0.316667), (0,0.333333)); -endmfpic; % (38) line 539 in the TeX source. +endmfpic; % (38) line 563 in the TeX source. %------------------------------------------ @@ -1574,7 +1630,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.1875, -0.025, 0.025); -beginmfpic(39); % line 540 in the TeX source. +beginmfpic(39); % line 564 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1596,7 +1652,7 @@ polyline (false) ((0,0), (0.164594,0)); -endmfpic; % (39) line 548 in the TeX source. +endmfpic; % (39) line 572 in the TeX source. %------------------------------------------ @@ -1605,7 +1661,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.025, 0.025, -0.1875, 0); -beginmfpic(40); % line 549 in the TeX source. +beginmfpic(40); % line 573 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1627,7 +1683,7 @@ polyline (false) ((0,0), (0,-0.164594)); -endmfpic; % (40) line 557 in the TeX source. +endmfpic; % (40) line 581 in the TeX source. %------------------------------------------ @@ -1636,7 +1692,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.1875, 0, -0.025, 0.025); -beginmfpic(41); % line 558 in the TeX source. +beginmfpic(41); % line 582 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1658,7 +1714,7 @@ polyline (false) ((0,0), (-0.164594,0)); -endmfpic; % (41) line 566 in the TeX source. +endmfpic; % (41) line 590 in the TeX source. %------------------------------------------ @@ -1667,7 +1723,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.025, 0.025, 0, 0.1875); -beginmfpic(42); % line 567 in the TeX source. +beginmfpic(42); % line 591 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1689,7 +1745,7 @@ polyline (false) ((0,0), (0,0.164594)); -endmfpic; % (42) line 575 in the TeX source. +endmfpic; % (42) line 599 in the TeX source. %------------------------------------------ @@ -1698,7 +1754,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.132583, 0, 0.132583); -beginmfpic(43); % line 576 in the TeX source. +beginmfpic(43); % line 600 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1720,7 +1776,7 @@ polyline (false) ((0,0), (0.116385,0.116385)); -endmfpic; % (43) line 584 in the TeX source. +endmfpic; % (43) line 608 in the TeX source. %------------------------------------------ @@ -1729,7 +1785,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.132583, 0, 0, 0.132583); -beginmfpic(44); % line 585 in the TeX source. +beginmfpic(44); % line 609 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1751,7 +1807,7 @@ polyline (false) ((0,0), (-0.116385,0.116385)); -endmfpic; % (44) line 593 in the TeX source. +endmfpic; % (44) line 617 in the TeX source. %------------------------------------------ @@ -1760,7 +1816,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.132583, 0, -0.132583, 0); -beginmfpic(45); % line 594 in the TeX source. +beginmfpic(45); % line 618 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1782,7 +1838,7 @@ polyline (false) ((0,0), (-0.116385,-0.116385)); -endmfpic; % (45) line 602 in the TeX source. +endmfpic; % (45) line 626 in the TeX source. %------------------------------------------ @@ -1791,7 +1847,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.132583, -0.132583, 0); -beginmfpic(46); % line 603 in the TeX source. +beginmfpic(46); % line 627 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1813,7 +1869,7 @@ polyline (false) ((0,0), (0.116385,-0.116385)); -endmfpic; % (46) line 611 in the TeX source. +endmfpic; % (46) line 635 in the TeX source. %------------------------------------------ @@ -1822,7 +1878,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.125, 0.125); -beginmfpic(47); % line 612 in the TeX source. +beginmfpic(47); % line 636 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1851,7 +1907,7 @@ polyline (false) ((0.1875,0), (0.333333,0)); -endmfpic; % (47) line 624 in the TeX source. +endmfpic; % (47) line 648 in the TeX source. %------------------------------------------ @@ -1860,7 +1916,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.125, 0.125, -0.333333, 0); -beginmfpic(48); % line 625 in the TeX source. +beginmfpic(48); % line 649 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1889,7 +1945,7 @@ polyline (false) ((0,-0.1875), (0,-0.333333)); -endmfpic; % (48) line 637 in the TeX source. +endmfpic; % (48) line 661 in the TeX source. %------------------------------------------ @@ -1898,7 +1954,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.125, 0.125); -beginmfpic(49); % line 638 in the TeX source. +beginmfpic(49); % line 662 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1927,7 +1983,7 @@ polyline (false) ((-0.1875,0), (-0.333333,0)); -endmfpic; % (49) line 650 in the TeX source. +endmfpic; % (49) line 674 in the TeX source. %------------------------------------------ @@ -1936,7 +1992,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.125, 0.125, 0, 0.333333); -beginmfpic(50); % line 651 in the TeX source. +beginmfpic(50); % line 675 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -1965,7 +2021,7 @@ polyline (false) ((0,0.1875), (0,0.333333)); -endmfpic; % (50) line 663 in the TeX source. +endmfpic; % (50) line 687 in the TeX source. %------------------------------------------ @@ -1974,7 +2030,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.125, 0.125); -beginmfpic(51); % line 664 in the TeX source. +beginmfpic(51); % line 688 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2027,7 +2083,7 @@ polyline (false) ((0.270833,0), (0.333333,0)); -endmfpic; % (51) line 684 in the TeX source. +endmfpic; % (51) line 708 in the TeX source. %------------------------------------------ @@ -2036,7 +2092,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.125, 0.125, -0.333333, 0); -beginmfpic(52); % line 685 in the TeX source. +beginmfpic(52); % line 709 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2089,7 +2145,7 @@ polyline (false) ((0,-0.270833), (0,-0.333333)); -endmfpic; % (52) line 705 in the TeX source. +endmfpic; % (52) line 729 in the TeX source. %------------------------------------------ @@ -2098,7 +2154,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.125, 0.125); -beginmfpic(53); % line 706 in the TeX source. +beginmfpic(53); % line 730 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2151,7 +2207,7 @@ polyline (false) ((-0.270833,0), (-0.333333,0)); -endmfpic; % (53) line 726 in the TeX source. +endmfpic; % (53) line 750 in the TeX source. %------------------------------------------ @@ -2160,7 +2216,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.125, 0.125, 0, 0.333333); -beginmfpic(54); % line 727 in the TeX source. +beginmfpic(54); % line 751 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2213,7 +2269,7 @@ polyline (false) ((0,0.270833), (0,0.333333)); -endmfpic; % (54) line 747 in the TeX source. +endmfpic; % (54) line 771 in the TeX source. %------------------------------------------ @@ -2222,7 +2278,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.05, 0.05); -beginmfpic(55); % line 748 in the TeX source. +beginmfpic(55); % line 772 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2249,7 +2305,7 @@ polyline (false) ((0.291667,0), (0.333333,0)); -endmfpic; % (55) line 762 in the TeX source. +endmfpic; % (55) line 786 in the TeX source. %------------------------------------------ @@ -2258,7 +2314,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.05, 0.05, 0, 0.333333); -beginmfpic(56); % line 763 in the TeX source. +beginmfpic(56); % line 787 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2285,7 +2341,7 @@ polyline (false) ((0,0.291667), (0,0.333333)); -endmfpic; % (56) line 777 in the TeX source. +endmfpic; % (56) line 801 in the TeX source. %------------------------------------------ @@ -2294,7 +2350,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.021706, 0.125); -beginmfpic(57); % line 778 in the TeX source. +beginmfpic(57); % line 802 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2317,7 +2373,7 @@ polyline (false) ((0.25,0), (0.333333,0)); -endmfpic; % (57) line 788 in the TeX source. +endmfpic; % (57) line 812 in the TeX source. %------------------------------------------ @@ -2326,7 +2382,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.021706, 0.125, -0.333333, 0); -beginmfpic(58); % line 789 in the TeX source. +beginmfpic(58); % line 813 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2349,7 +2405,7 @@ polyline (false) ((0,-0.25), (0,-0.333333)); -endmfpic; % (58) line 799 in the TeX source. +endmfpic; % (58) line 823 in the TeX source. %------------------------------------------ @@ -2358,7 +2414,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.125, 0.021706); -beginmfpic(59); % line 800 in the TeX source. +beginmfpic(59); % line 824 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2381,7 +2437,7 @@ polyline (false) ((-0.25,0), (-0.333333,0)); -endmfpic; % (59) line 810 in the TeX source. +endmfpic; % (59) line 834 in the TeX source. %------------------------------------------ @@ -2390,7 +2446,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.125, 0.021706, 0, 0.333333); -beginmfpic(60); % line 811 in the TeX source. +beginmfpic(60); % line 835 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2413,7 +2469,7 @@ polyline (false) ((0,0.25), (0,0.333333)); -endmfpic; % (60) line 821 in the TeX source. +endmfpic; % (60) line 845 in the TeX source. %------------------------------------------ @@ -2422,7 +2478,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.021706, 0.125); -beginmfpic(61); % line 822 in the TeX source. +beginmfpic(61); % line 846 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2469,7 +2525,7 @@ polyline (false) ((0.25,0), (0.333333,0)); -endmfpic; % (61) line 837 in the TeX source. +endmfpic; % (61) line 861 in the TeX source. %------------------------------------------ @@ -2478,7 +2534,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.021706, 0.125, -0.333333, 0); -beginmfpic(62); % line 838 in the TeX source. +beginmfpic(62); % line 862 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2525,7 +2581,7 @@ polyline (false) ((0,-0.25), (0,-0.333333)); -endmfpic; % (62) line 853 in the TeX source. +endmfpic; % (62) line 877 in the TeX source. %------------------------------------------ @@ -2534,7 +2590,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.125, 0.021706); -beginmfpic(63); % line 854 in the TeX source. +beginmfpic(63); % line 878 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2581,7 +2637,7 @@ polyline (false) ((-0.25,0), (-0.333333,0)); -endmfpic; % (63) line 869 in the TeX source. +endmfpic; % (63) line 893 in the TeX source. %------------------------------------------ @@ -2590,7 +2646,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.125, 0.021706, 0, 0.333333); -beginmfpic(64); % line 870 in the TeX source. +beginmfpic(64); % line 894 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2637,7 +2693,7 @@ polyline (false) ((0,0.25), (0,0.333333)); -endmfpic; % (64) line 885 in the TeX source. +endmfpic; % (64) line 909 in the TeX source. %------------------------------------------ @@ -2646,7 +2702,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.032352, 0.125); -beginmfpic(65); % line 886 in the TeX source. +beginmfpic(65); % line 910 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2693,7 +2749,7 @@ polyline (false) ((0.25,0), (0.333333,0)); -endmfpic; % (65) line 901 in the TeX source. +endmfpic; % (65) line 925 in the TeX source. %------------------------------------------ @@ -2702,7 +2758,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.032352, 0.125, -0.333333, 0); -beginmfpic(66); % line 902 in the TeX source. +beginmfpic(66); % line 926 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2749,7 +2805,7 @@ polyline (false) ((0,-0.25), (0,-0.333333)); -endmfpic; % (66) line 917 in the TeX source. +endmfpic; % (66) line 941 in the TeX source. %------------------------------------------ @@ -2758,7 +2814,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.125, 0.032352); -beginmfpic(67); % line 918 in the TeX source. +beginmfpic(67); % line 942 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2805,7 +2861,7 @@ polyline (false) ((-0.25,0), (-0.333333,0)); -endmfpic; % (67) line 933 in the TeX source. +endmfpic; % (67) line 957 in the TeX source. %------------------------------------------ @@ -2814,7 +2870,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.125, 0.032352, 0, 0.333333); -beginmfpic(68); % line 934 in the TeX source. +beginmfpic(68); % line 958 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2861,7 +2917,7 @@ polyline (false) ((0,0.25), (0,0.333333)); -endmfpic; % (68) line 949 in the TeX source. +endmfpic; % (68) line 973 in the TeX source. %------------------------------------------ @@ -2870,7 +2926,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.625, -0.25, 0.25); -beginmfpic(69); % line 950 in the TeX source. +beginmfpic(69); % line 974 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2890,7 +2946,7 @@ polyline (false) (0.5625,0), (0.625,0)); -endmfpic; % (69) line 961 in the TeX source. +endmfpic; % (69) line 985 in the TeX source. %------------------------------------------ @@ -2899,7 +2955,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.25, 0.25, -0.625, 0); -beginmfpic(70); % line 962 in the TeX source. +beginmfpic(70); % line 986 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2919,7 +2975,7 @@ polyline (false) (0,-0.5625), (0,-0.625)); -endmfpic; % (70) line 973 in the TeX source. +endmfpic; % (70) line 997 in the TeX source. %------------------------------------------ @@ -2928,7 +2984,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.625, 0, -0.25, 0.25); -beginmfpic(71); % line 974 in the TeX source. +beginmfpic(71); % line 998 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2948,7 +3004,7 @@ polyline (false) (-0.5625,0), (-0.625,0)); -endmfpic; % (71) line 985 in the TeX source. +endmfpic; % (71) line 1009 in the TeX source. %------------------------------------------ @@ -2957,7 +3013,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.25, 0.25, 0, 0.625); -beginmfpic(72); % line 986 in the TeX source. +beginmfpic(72); % line 1010 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -2977,7 +3033,7 @@ polyline (false) (0,0.5625), (0,0.625)); -endmfpic; % (72) line 997 in the TeX source. +endmfpic; % (72) line 1021 in the TeX source. %------------------------------------------ @@ -2986,7 +3042,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.333333, -0.175, 0.175); -beginmfpic(73); % line 998 in the TeX source. +beginmfpic(73); % line 1022 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3015,7 +3071,7 @@ polyline (false) ((0.3125,0), (0.333333,0)); -endmfpic; % (73) line 1011 in the TeX source. +endmfpic; % (73) line 1035 in the TeX source. %------------------------------------------ @@ -3024,7 +3080,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, -0.333333, 0); -beginmfpic(74); % line 1012 in the TeX source. +beginmfpic(74); % line 1036 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3053,7 +3109,7 @@ polyline (false) ((0,-0.3125), (0,-0.333333)); -endmfpic; % (74) line 1025 in the TeX source. +endmfpic; % (74) line 1049 in the TeX source. %------------------------------------------ @@ -3062,7 +3118,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.333333, 0, -0.175, 0.175); -beginmfpic(75); % line 1026 in the TeX source. +beginmfpic(75); % line 1050 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3091,7 +3147,7 @@ polyline (false) ((-0.3125,0), (-0.333333,0)); -endmfpic; % (75) line 1039 in the TeX source. +endmfpic; % (75) line 1063 in the TeX source. %------------------------------------------ @@ -3100,7 +3156,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.333333); -beginmfpic(76); % line 1040 in the TeX source. +beginmfpic(76); % line 1064 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3129,7 +3185,7 @@ polyline (false) ((0,0.3125), (0,0.333333)); -endmfpic; % (76) line 1053 in the TeX source. +endmfpic; % (76) line 1077 in the TeX source. %------------------------------------------ @@ -3138,7 +3194,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.083333, 0.083333, -0.0625, 0); -beginmfpic(77); % line 1054 in the TeX source. +beginmfpic(77); % line 1078 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3161,7 +3217,7 @@ polyline (false) ((0.035714,-0.0625), (-0.035714,-0.0625)); -endmfpic; % (77) line 1064 in the TeX source. +endmfpic; % (77) line 1088 in the TeX source. %------------------------------------------ @@ -3170,7 +3226,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.083333, 0.083333, -0.1875, 0); -beginmfpic(78); % line 1065 in the TeX source. +beginmfpic(78); % line 1089 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3199,7 +3255,7 @@ polyline (false) ((0.035714,-0.1875), (-0.035714,-0.1875)); -endmfpic; % (78) line 1077 in the TeX source. +endmfpic; % (78) line 1101 in the TeX source. %------------------------------------------ @@ -3208,7 +3264,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.104167, 0.104167, -0.333333, -0); -beginmfpic(79); % line 1078 in the TeX source. +beginmfpic(79); % line 1102 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3281,16 +3337,16 @@ polyline (false) ((0.104167,-0.041667), (0.104167,0)); -endmfpic; % (79) line 1102 in the TeX source. +endmfpic; % (79) line 1126 in the TeX source. %------------------------------------------ %----------------------------<80> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0, 0.333333, -0.104167, 0.104167); +bounds (0, 0.333333, -0.104167, 0.104167); -beginmfpic(80); % line 1103 in the TeX source. +beginmfpic(80); % line 1127 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3343,7 +3399,7 @@ polyline (false) store (curpath) drawn -arcplr ((0.260417,0.104167),0,-180,0.03125); +arcplr ((0.260417,0.104167),-0,-180,0.03125); store (curpath) drawn @@ -3363,7 +3419,7 @@ polyline (false) ((0.041667,0.104167), (0,0.104167)); -endmfpic; % (80) line 1127 in the TeX source. +endmfpic; % (80) line 1151 in the TeX source. %------------------------------------------ @@ -3372,7 +3428,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.1625, 0.1625, 0, 0.3); -beginmfpic(81); % line 1128 in the TeX source. +beginmfpic(81); % line 1152 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3418,7 +3474,7 @@ polyline (false) ((0.1625,0.3), (-0.0375,0.21)); -endmfpic; % (81) line 1144 in the TeX source. +endmfpic; % (81) line 1168 in the TeX source. %------------------------------------------ @@ -3427,7 +3483,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.3, 0, -0.1625, 0.1625); -beginmfpic(82); % line 1145 in the TeX source. +beginmfpic(82); % line 1169 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3473,7 +3529,7 @@ polyline (false) ((-0.3,0.1625), (-0.21,-0.0375)); -endmfpic; % (82) line 1161 in the TeX source. +endmfpic; % (82) line 1185 in the TeX source. %------------------------------------------ @@ -3482,7 +3538,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.1625, 0.1625, 0, 0.3); -beginmfpic(83); % line 1162 in the TeX source. +beginmfpic(83); % line 1186 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3528,7 +3584,7 @@ polyline (false) ((-0.1625,0.3), (0.0375,0.21)); -endmfpic; % (83) line 1178 in the TeX source. +endmfpic; % (83) line 1202 in the TeX source. %------------------------------------------ @@ -3537,7 +3593,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.3, -0.1625, 0.1625); -beginmfpic(84); % line 1179 in the TeX source. +beginmfpic(84); % line 1203 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3583,7 +3639,7 @@ polyline (false) ((0.3,0.1625), (0.21,-0.0375)); -endmfpic; % (84) line 1195 in the TeX source. +endmfpic; % (84) line 1219 in the TeX source. %------------------------------------------ @@ -3592,7 +3648,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.1625, 0.1625, 0, 0.3); -beginmfpic(85); % line 1196 in the TeX source. +beginmfpic(85); % line 1220 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3638,7 +3694,7 @@ polyline (false) ((0.1625,0.3), (-0.0375,0.21)); -endmfpic; % (85) line 1212 in the TeX source. +endmfpic; % (85) line 1236 in the TeX source. %------------------------------------------ @@ -3647,7 +3703,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.3, 0, -0.1625, 0.1625); -beginmfpic(86); % line 1213 in the TeX source. +beginmfpic(86); % line 1237 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3693,7 +3749,7 @@ polyline (false) ((-0.3,0.1625), (-0.21,-0.0375)); -endmfpic; % (86) line 1229 in the TeX source. +endmfpic; % (86) line 1253 in the TeX source. %------------------------------------------ @@ -3702,7 +3758,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.1625, 0.1625, 0, 0.3); -beginmfpic(87); % line 1230 in the TeX source. +beginmfpic(87); % line 1254 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3748,7 +3804,7 @@ polyline (false) ((-0.1625,0.3), (0.0375,0.21)); -endmfpic; % (87) line 1246 in the TeX source. +endmfpic; % (87) line 1270 in the TeX source. %------------------------------------------ @@ -3757,7 +3813,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.3, -0.1625, 0.1625); -beginmfpic(88); % line 1247 in the TeX source. +beginmfpic(88); % line 1271 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3803,7 +3859,7 @@ polyline (false) ((0.3,0.1625), (0.21,-0.0375)); -endmfpic; % (88) line 1263 in the TeX source. +endmfpic; % (88) line 1287 in the TeX source. %------------------------------------------ @@ -3812,7 +3868,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.4, -0.2, 0.2); -beginmfpic(89); % line 1264 in the TeX source. +beginmfpic(89); % line 1288 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3821,7 +3877,7 @@ store (curpath) drawn circle ((0.2,0),0.2); -endmfpic; % (89) line 1269 in the TeX source. +endmfpic; % (89) line 1293 in the TeX source. %------------------------------------------ @@ -3830,7 +3886,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.252778); -beginmfpic(90); % line 1270 in the TeX source. +beginmfpic(90); % line 1294 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3870,7 +3926,7 @@ polyline (false) ((0.175,0.027778), (0,0.027778)); -endmfpic; % (90) line 1284 in the TeX source. +endmfpic; % (90) line 1308 in the TeX source. %------------------------------------------ @@ -3879,7 +3935,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.252778); -beginmfpic(91); % line 1285 in the TeX source. +beginmfpic(91); % line 1309 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3919,7 +3975,7 @@ polyline (false) ((-0.175,0.027778), (0,0.027778)); -endmfpic; % (91) line 1299 in the TeX source. +endmfpic; % (91) line 1323 in the TeX source. %------------------------------------------ @@ -3928,7 +3984,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.252778); -beginmfpic(92); % line 1300 in the TeX source. +beginmfpic(92); % line 1324 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -3974,7 +4030,7 @@ polyline (false) ((0.175,0.027778), (0,0.027778)); -endmfpic; % (92) line 1316 in the TeX source. +endmfpic; % (92) line 1340 in the TeX source. %------------------------------------------ @@ -3983,7 +4039,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.252778); -beginmfpic(93); % line 1317 in the TeX source. +beginmfpic(93); % line 1341 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4029,7 +4085,7 @@ polyline (false) ((-0.175,0.027778), (0,0.027778)); -endmfpic; % (93) line 1333 in the TeX source. +endmfpic; % (93) line 1357 in the TeX source. %------------------------------------------ @@ -4038,7 +4094,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.25); -beginmfpic(94); % line 1334 in the TeX source. +beginmfpic(94); % line 1358 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4111,7 +4167,7 @@ polyline (false) ((0.175,0.025), (0,0.025)); -endmfpic; % (94) line 1361 in the TeX source. +endmfpic; % (94) line 1385 in the TeX source. %------------------------------------------ @@ -4120,7 +4176,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.25); -beginmfpic(95); % line 1362 in the TeX source. +beginmfpic(95); % line 1386 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4193,7 +4249,7 @@ polyline (false) ((-0.175,0.025), (0,0.025)); -endmfpic; % (95) line 1389 in the TeX source. +endmfpic; % (95) line 1413 in the TeX source. %------------------------------------------ @@ -4202,7 +4258,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.25); -beginmfpic(96); % line 1390 in the TeX source. +beginmfpic(96); % line 1414 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4275,7 +4331,7 @@ polyline (false) ((0.175,0.025), (0,0.025)); -endmfpic; % (96) line 1417 in the TeX source. +endmfpic; % (96) line 1441 in the TeX source. %------------------------------------------ @@ -4284,7 +4340,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.25); -beginmfpic(97); % line 1418 in the TeX source. +beginmfpic(97); % line 1442 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4357,7 +4413,7 @@ polyline (false) ((-0.175,0.025), (0,0.025)); -endmfpic; % (97) line 1445 in the TeX source. +endmfpic; % (97) line 1469 in the TeX source. %------------------------------------------ @@ -4366,7 +4422,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.25); -beginmfpic(98); % line 1446 in the TeX source. +beginmfpic(98); % line 1470 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4427,7 +4483,7 @@ polyline (false) ((0.175,0.025), (0,0.025)); -endmfpic; % (98) line 1469 in the TeX source. +endmfpic; % (98) line 1493 in the TeX source. %------------------------------------------ @@ -4436,7 +4492,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.25); -beginmfpic(99); % line 1470 in the TeX source. +beginmfpic(99); % line 1494 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4497,7 +4553,7 @@ polyline (false) ((-0.175,0.025), (0,0.025)); -endmfpic; % (99) line 1493 in the TeX source. +endmfpic; % (99) line 1517 in the TeX source. %------------------------------------------ @@ -4506,7 +4562,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.25); -beginmfpic(100); % line 1494 in the TeX source. +beginmfpic(100); % line 1518 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4567,7 +4623,7 @@ polyline (false) ((0.175,0.025), (0,0.025)); -endmfpic; % (100) line 1517 in the TeX source. +endmfpic; % (100) line 1541 in the TeX source. %------------------------------------------ @@ -4576,7 +4632,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0.175, 0, 0.25); -beginmfpic(101); % line 1518 in the TeX source. +beginmfpic(101); % line 1542 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4637,7 +4693,7 @@ polyline (false) ((-0.175,0.025), (0,0.025)); -endmfpic; % (101) line 1541 in the TeX source. +endmfpic; % (101) line 1565 in the TeX source. %------------------------------------------ @@ -4646,7 +4702,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.35, -0.15, 0.15); -beginmfpic(102); % line 1542 in the TeX source. +beginmfpic(102); % line 1566 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4663,7 +4719,7 @@ store (curpath) drawn arcplr ((0.2,0),90,-90,0.15); -endmfpic; % (102) line 1551 in the TeX source. +endmfpic; % (102) line 1575 in the TeX source. %------------------------------------------ @@ -4672,7 +4728,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.15, 0.15, -0.35, 0); -beginmfpic(103); % line 1552 in the TeX source. +beginmfpic(103); % line 1576 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4689,7 +4745,7 @@ store (curpath) drawn arcplr ((0,-0.2),0,-180,0.15); -endmfpic; % (103) line 1561 in the TeX source. +endmfpic; % (103) line 1585 in the TeX source. %------------------------------------------ @@ -4698,7 +4754,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.35, 0, -0.15, 0.15); -beginmfpic(104); % line 1562 in the TeX source. +beginmfpic(104); % line 1586 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4715,7 +4771,7 @@ store (curpath) drawn arcplr ((-0.2,0),-90,-270,0.15); -endmfpic; % (104) line 1571 in the TeX source. +endmfpic; % (104) line 1595 in the TeX source. %------------------------------------------ @@ -4724,7 +4780,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.15, 0.15, 0, 0.35); -beginmfpic(105); % line 1572 in the TeX source. +beginmfpic(105); % line 1596 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4741,7 +4797,7 @@ store (curpath) drawn arcplr ((0,0.2),-180,-360,0.15); -endmfpic; % (105) line 1581 in the TeX source. +endmfpic; % (105) line 1605 in the TeX source. %------------------------------------------ @@ -4750,7 +4806,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.355556, -0.151089, 0.151089); -beginmfpic(106); % line 1582 in the TeX source. +beginmfpic(106); % line 1606 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4779,7 +4835,7 @@ store (curpath) drawn arcplr ((0.122222,0.105392),-90,-24.529547,0.256481); -endmfpic; % (106) line 1593 in the TeX source. +endmfpic; % (106) line 1617 in the TeX source. %------------------------------------------ @@ -4788,7 +4844,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.151089, 0.151089, -0.355556, -0); -beginmfpic(107); % line 1594 in the TeX source. +beginmfpic(107); % line 1618 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4817,7 +4873,7 @@ store (curpath) drawn arcplr ((0.105392,-0.122222),180,245.470453,0.256481); -endmfpic; % (107) line 1605 in the TeX source. +endmfpic; % (107) line 1629 in the TeX source. %------------------------------------------ @@ -4826,7 +4882,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.355556, -0, -0.151089, 0.151089); -beginmfpic(108); % line 1606 in the TeX source. +beginmfpic(108); % line 1630 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4855,7 +4911,7 @@ store (curpath) drawn arcplr ((-0.122222,-0.105392),90,155.470453,0.256481); -endmfpic; % (108) line 1617 in the TeX source. +endmfpic; % (108) line 1641 in the TeX source. %------------------------------------------ @@ -4864,7 +4920,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.151089, 0.151089, 0, 0.355556); -beginmfpic(109); % line 1618 in the TeX source. +beginmfpic(109); % line 1642 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4893,7 +4949,7 @@ store (curpath) drawn arcplr ((-0.105392,0.122222),0,65.470453,0.256481); -endmfpic; % (109) line 1629 in the TeX source. +endmfpic; % (109) line 1653 in the TeX source. %------------------------------------------ @@ -4902,7 +4958,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.175, -0.1, 0.1); -beginmfpic(110); % line 1630 in the TeX source. +beginmfpic(110); % line 1654 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4915,7 +4971,7 @@ polyline (false) (0,0.1), (0.175,0)); -endmfpic; % (110) line 1638 in the TeX source. +endmfpic; % (110) line 1662 in the TeX source. %------------------------------------------ @@ -4924,7 +4980,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.1, 0.1, -0.175, 0); -beginmfpic(111); % line 1639 in the TeX source. +beginmfpic(111); % line 1663 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4937,7 +4993,7 @@ polyline (false) (0.1,0), (0,-0.175)); -endmfpic; % (111) line 1647 in the TeX source. +endmfpic; % (111) line 1671 in the TeX source. %------------------------------------------ @@ -4946,7 +5002,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.175, 0, -0.1, 0.1); -beginmfpic(112); % line 1648 in the TeX source. +beginmfpic(112); % line 1672 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4959,7 +5015,7 @@ polyline (false) (0,-0.1), (-0.175,0)); -endmfpic; % (112) line 1656 in the TeX source. +endmfpic; % (112) line 1680 in the TeX source. %------------------------------------------ @@ -4968,7 +5024,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.1, 0.1, 0, 0.175); -beginmfpic(113); % line 1657 in the TeX source. +beginmfpic(113); % line 1681 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -4981,7 +5037,7 @@ polyline (false) (-0.1,0), (0,0.175)); -endmfpic; % (113) line 1665 in the TeX source. +endmfpic; % (113) line 1689 in the TeX source. %------------------------------------------ @@ -4990,7 +5046,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.425, -0.15, 0.15); -beginmfpic(114); % line 1666 in the TeX source. +beginmfpic(114); % line 1690 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5011,7 +5067,7 @@ store (curpath) drawn circle ((0.3875,0),0.0375); -endmfpic; % (114) line 1676 in the TeX source. +endmfpic; % (114) line 1700 in the TeX source. %------------------------------------------ @@ -5020,7 +5076,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.15, 0.15, -0.425, 0); -beginmfpic(115); % line 1677 in the TeX source. +beginmfpic(115); % line 1701 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5041,7 +5097,7 @@ store (curpath) drawn circle ((0,-0.3875),0.0375); -endmfpic; % (115) line 1687 in the TeX source. +endmfpic; % (115) line 1711 in the TeX source. %------------------------------------------ @@ -5050,7 +5106,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.425, 0, -0.15, 0.15); -beginmfpic(116); % line 1688 in the TeX source. +beginmfpic(116); % line 1712 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5071,7 +5127,7 @@ store (curpath) drawn circle ((-0.3875,0),0.0375); -endmfpic; % (116) line 1698 in the TeX source. +endmfpic; % (116) line 1722 in the TeX source. %------------------------------------------ @@ -5080,7 +5136,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.15, 0.15, 0, 0.425); -beginmfpic(117); % line 1699 in the TeX source. +beginmfpic(117); % line 1723 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5101,7 +5157,7 @@ store (curpath) drawn circle ((0,0.3875),0.0375); -endmfpic; % (117) line 1709 in the TeX source. +endmfpic; % (117) line 1733 in the TeX source. %------------------------------------------ @@ -5110,7 +5166,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.430556, -0.151089, 0.151089); -beginmfpic(118); % line 1710 in the TeX source. +beginmfpic(118); % line 1734 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5143,7 +5199,7 @@ store (curpath) drawn circle ((0.393056,-0.001089),0.0375); -endmfpic; % (118) line 1722 in the TeX source. +endmfpic; % (118) line 1746 in the TeX source. %------------------------------------------ @@ -5152,7 +5208,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.151089, 0.151089, -0.430556, -0); -beginmfpic(119); % line 1723 in the TeX source. +beginmfpic(119); % line 1747 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5185,7 +5241,7 @@ store (curpath) drawn circle ((-0.001089,-0.393056),0.0375); -endmfpic; % (119) line 1735 in the TeX source. +endmfpic; % (119) line 1759 in the TeX source. %------------------------------------------ @@ -5194,7 +5250,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.430556, -0, -0.151089, 0.151089); -beginmfpic(120); % line 1736 in the TeX source. +beginmfpic(120); % line 1760 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5227,7 +5283,7 @@ store (curpath) drawn circle ((-0.393056,0.001089),0.0375); -endmfpic; % (120) line 1748 in the TeX source. +endmfpic; % (120) line 1772 in the TeX source. %------------------------------------------ @@ -5236,7 +5292,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.151089, 0.151089, 0, 0.430556); -beginmfpic(121); % line 1749 in the TeX source. +beginmfpic(121); % line 1773 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5269,7 +5325,7 @@ store (curpath) drawn circle ((0.001089,0.393056),0.0375); -endmfpic; % (121) line 1761 in the TeX source. +endmfpic; % (121) line 1785 in the TeX source. %------------------------------------------ @@ -5278,7 +5334,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.4, -0.151089, 0.151089); -beginmfpic(122); % line 1762 in the TeX source. +beginmfpic(122); % line 1786 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5311,7 +5367,7 @@ store (curpath) drawn arcplr ((0.166667,0.105392),-90,-24.529547,0.256481); -endmfpic; % (122) line 1774 in the TeX source. +endmfpic; % (122) line 1798 in the TeX source. %------------------------------------------ @@ -5320,7 +5376,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.151089, 0.151089, -0.4, 0); -beginmfpic(123); % line 1775 in the TeX source. +beginmfpic(123); % line 1799 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5353,7 +5409,7 @@ store (curpath) drawn arcplr ((0.105392,-0.166667),180,245.470453,0.256481); -endmfpic; % (123) line 1787 in the TeX source. +endmfpic; % (123) line 1811 in the TeX source. %------------------------------------------ @@ -5362,7 +5418,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.4, -0, -0.151089, 0.151089); -beginmfpic(124); % line 1788 in the TeX source. +beginmfpic(124); % line 1812 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5395,7 +5451,7 @@ store (curpath) drawn arcplr ((-0.166667,-0.105392),90,155.470453,0.256481); -endmfpic; % (124) line 1800 in the TeX source. +endmfpic; % (124) line 1824 in the TeX source. %------------------------------------------ @@ -5404,7 +5460,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.151089, 0.151089, 0, 0.4); -beginmfpic(125); % line 1801 in the TeX source. +beginmfpic(125); % line 1825 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5437,7 +5493,7 @@ store (curpath) drawn arcplr ((-0.105392,0.166667),0,65.470453,0.256481); -endmfpic; % (125) line 1813 in the TeX source. +endmfpic; % (125) line 1837 in the TeX source. %------------------------------------------ @@ -5446,7 +5502,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.475, -0.151089, 0.151089); -beginmfpic(126); % line 1814 in the TeX source. +beginmfpic(126); % line 1838 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5483,7 +5539,7 @@ store (curpath) drawn circle ((0.4375,-0.001089),0.0375); -endmfpic; % (126) line 1827 in the TeX source. +endmfpic; % (126) line 1851 in the TeX source. %------------------------------------------ @@ -5492,7 +5548,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.151089, 0.151089, -0.475, 0); -beginmfpic(127); % line 1828 in the TeX source. +beginmfpic(127); % line 1852 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5529,7 +5585,7 @@ store (curpath) drawn circle ((-0.001089,-0.4375),0.0375); -endmfpic; % (127) line 1841 in the TeX source. +endmfpic; % (127) line 1865 in the TeX source. %------------------------------------------ @@ -5538,7 +5594,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.475, -0, -0.151089, 0.151089); -beginmfpic(128); % line 1842 in the TeX source. +beginmfpic(128); % line 1866 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5575,7 +5631,7 @@ store (curpath) drawn circle ((-0.4375,0.001089),0.0375); -endmfpic; % (128) line 1855 in the TeX source. +endmfpic; % (128) line 1879 in the TeX source. %------------------------------------------ @@ -5584,7 +5640,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.151089, 0.151089, 0, 0.475); -beginmfpic(129); % line 1856 in the TeX source. +beginmfpic(129); % line 1880 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5621,7 +5677,7 @@ store (curpath) drawn circle ((0.001089,0.4375),0.0375); -endmfpic; % (129) line 1869 in the TeX source. +endmfpic; % (129) line 1893 in the TeX source. %------------------------------------------ @@ -5630,7 +5686,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (0, 0.25, -0.1, 0.1); -beginmfpic(130); % line 1870 in the TeX source. +beginmfpic(130); % line 1894 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5647,7 +5703,7 @@ store (curpath) drawn circle ((0.2125,0),0.0375); -endmfpic; % (130) line 1879 in the TeX source. +endmfpic; % (130) line 1903 in the TeX source. %------------------------------------------ @@ -5656,7 +5712,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.1, 0.1, -0.25, 0); -beginmfpic(131); % line 1880 in the TeX source. +beginmfpic(131); % line 1904 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5673,7 +5729,7 @@ store (curpath) drawn circle ((0,-0.2125),0.0375); -endmfpic; % (131) line 1889 in the TeX source. +endmfpic; % (131) line 1913 in the TeX source. %------------------------------------------ @@ -5682,7 +5738,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.25, 0, -0.1, 0.1); -beginmfpic(132); % line 1890 in the TeX source. +beginmfpic(132); % line 1914 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5699,7 +5755,7 @@ store (curpath) drawn circle ((-0.2125,0),0.0375); -endmfpic; % (132) line 1899 in the TeX source. +endmfpic; % (132) line 1923 in the TeX source. %------------------------------------------ @@ -5708,7 +5764,7 @@ unitlen := 1.0pt#; xscale := 72; yscale := 72; bounds (-0.1, 0.1, 0, 0.25); -beginmfpic(133); % line 1900 in the TeX source. +beginmfpic(133); % line 1924 in the TeX source. resizedrawpen (0.8bp); setcolor (drawcolor) black; @@ -5725,7 +5781,7 @@ store (curpath) drawn circle ((0,0.2125),0.0375); -endmfpic; % (133) line 1909 in the TeX source. +endmfpic; % (133) line 1933 in the TeX source. %------------------------------------------ diff --git a/graphics/circuit_macros/examples/mf/cct.tfm b/graphics/circuit_macros/examples/mf/cct.tfm Binary files differindex 142e6cd003..a26fea7161 100644 --- a/graphics/circuit_macros/examples/mf/cct.tfm +++ b/graphics/circuit_macros/examples/mf/cct.tfm diff --git a/graphics/circuit_macros/examples/person.m4 b/graphics/circuit_macros/examples/person.m4 index c0033d63fe..5f5a9cb8bd 100644 --- a/graphics/circuit_macros/examples/person.m4 +++ b/graphics/circuit_macros/examples/person.m4 @@ -30,12 +30,17 @@ define(`person',`[ setkey_(`$1',height,linewid) divert(0)dnl linewid = 3*linewid + movewid = 0.2 setrgb(0.54,0.81,0.94,babyblue) person(fill="babyblue") + move person(width=linewid*3/4;fill="babyblue") + move person(width=linewid;fill="babyblue") + move person + move resetrgb person(height=1;fill="gray") diff --git a/graphics/circuit_macros/examples/relaycoil.m4 b/graphics/circuit_macros/examples/relaycoil.m4 index b3273794cd..7966a32294 100644 --- a/graphics/circuit_macros/examples/relaycoil.m4 +++ b/graphics/circuit_macros/examples/relaycoil.m4 @@ -3,7 +3,7 @@ cct_init spc = dimen_/3 -{ relaycoil; S: "\tt re{}laycoil" at last [].s+(0,-20bp__) +{ relaycoil; S: `"\tt relaycoil"' at last [].s+(0,-16bp__) { "\sl V1" wid 10bp__ at last [].V1 rjust "\sl V2" at last [].V2 ljust } K: relaycoil(NX) with .nw at last [].ne+(spc*4,0); "\tt (NX)" at (last [],S) @@ -20,10 +20,12 @@ cct_init { "\sl V1" at last [].V1 rjust; "\sl V2" at last [].V2 rjust } relaycoil(BXSR) with .nw at last [].ne+(spc*2,0); "\tt (BXSR)" at (last [],S) { "\sl V1" at last [].V1 ljust; "\sl V2" at last [].V2 ljust } - relaycoil(SR) with .nw at last [].ne+(spc*4,0); "\tt (SR)" at (last [],S) + relaycoil(SR) with .nw at last [].ne+(spc*3,0); "\tt (SR)" at (last [],S) relaycoil(SO) with .nw at last [].ne+(spc,0); "\tt (SO)" at (last [],S) relaycoil(SOR) with .nw at last [].ne+(spc,0); "\tt (SOR)" at (last [],S) + relaycoil(PC) with .nw at last [].ne+(spc,0); "\tt (PC)" at (last [],S) } + spc = dimen_/4 { move down_ 3/4; right_ relaycoil(HS); S: "\tt (HS)" at last [].s+(0,-12bp__) @@ -35,6 +37,7 @@ cct_init relaycoil(RH) with .nw at last [].ne+(spc,0); "\tt (RH)" at (last [],S) relaycoil(TH) with .nw at last [].ne+(spc,0); "\tt (TH)" at (last [],S) relaycoil(EL) with .nw at last [].ne+(spc,0); "\tt (EL)" at (last [],S) + relaycoil(MR) with .sw at last [].se+(spc,0); "\tt (MR)" at (last [],S) } .PE diff --git a/graphics/circuit_macros/examples/shapes.m4 b/graphics/circuit_macros/examples/shapes.m4 index 3555057447..749e09896d 100644 --- a/graphics/circuit_macros/examples/shapes.m4 +++ b/graphics/circuit_macros/examples/shapes.m4 @@ -18,14 +18,14 @@ define(`cylinder3D',`[ Start: (0,0) define(`M4CL',`xdispl,ydispl,zdispl')dnl lenc = length3D(M4CL) cs = dot3D(View3D,M4CL)/lenc - End: (project(M4CL)) + 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)) + 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)) @@ -52,7 +52,7 @@ define(`cone3D',`[ Start: (0,0) define(`M4CL',`xdispl,ydispl,zdispl')dnl lenc = length3D(M4CL) diamc = ifelse(`$4',,(lenc/2),`$4') ; radc = diamc/2 - End: (project(M4CL)) + End: (Project(M4CL)) cs = dot3D(View3D,M4CL)/lenc az = atan2(ydispl,xdispl) ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2)) @@ -64,7 +64,7 @@ define(`cone3D',`[ Start: (0,0) 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))))) + 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 } } } @@ -121,7 +121,7 @@ define(`prism3D',`[ Start: (0,0) 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 + 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 @@ -148,10 +148,10 @@ 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)) + 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 @@ -170,7 +170,7 @@ setview(azimuth,elev) 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)) + 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) [ @@ -180,7 +180,7 @@ setview(azimuth,elev) 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 .Start at (Project(rot3Dz(r,rot3Dy(pi_/4,len*0.5,0,0)))) } ] with .nw at last [].ne [ setlight(0,0) diff --git a/graphics/circuit_macros/examples/svg/AlogixSVG.m4 b/graphics/circuit_macros/examples/svg/AlogixSVG.m4 index 58cac40f0c..0336273903 100644 --- a/graphics/circuit_macros/examples/svg/AlogixSVG.m4 +++ b/graphics/circuit_macros/examples/svg/AlogixSVG.m4 @@ -21,9 +21,9 @@ A: Autologix( 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) + "svg_tt(`Autologix(Or(And(B,Not(C)),')" wid 165bp__ \ + with .w at B.sw+(-0.6,-0.15) + "svg_tt(`And(Not(A),B,C)),N)')" wid 122bp__ with .w at last "".w+(1.1,-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 diff --git a/graphics/circuit_macros/examples/svg/AntiqueClockSVG.m4 b/graphics/circuit_macros/examples/svg/AntiqueClockSVG.m4 deleted file mode 100644 index 63c169d3e2..0000000000 --- a/graphics/circuit_macros/examples/svg/AntiqueClockSVG.m4 +++ /dev/null @@ -1,156 +0,0 @@ -.PS -# AntiqueClockSVG.m4 -gen_init(svg_font(font-family="sans-serif" font-stretch="condensed")) - -# https://tex.stackexchange.com/questions/236923/generate-analog-clock-with-numbered-face-add-seconds-roman-numerals - -svg_rot_init(AntiqueClockSVG) - -# `hms2deg(hr,min,sec) hr:min:sec to degrees -# blank arg1: degrees for minute hand -# blank arg1 and arg2: degrees for second hand' -define(`hms2deg',`ifelse(`$1',, - `ifelse(`$2',, - `(90-pmod(ifelse(`$3',,0,`$3'),60)/60*360)', - `(90-(pmod(`$2',60)/60 + pmod(ifelse(`$3',,0,`$3'),60)/60/60)*360)')', - `(90-(pmod(`$1',12) + pmod(ifelse(`$2',,0,`$2'),60)/60 + dnl - pmod(ifelse(`$3',,0,`$3'),60)/3600)/12*360)')') - -# `SecondHand(length,hr,min,sec)' -define(`SecondHand',`[ shsf = (`$1')/3.2 - C: Here - { L: rpoint_(to (Rect_(`$1',hms2deg(,,`$4')))) } - line thick 8*shsf to rvec_(`$1',0) - ]') - -# `AntiqueMinuteHand(length,hr,min,sec)' -define(`AntiqueMinuteHand',`[ mhsf = (`$1')/2.84 - L: rpoint_(to (Rect_(`$1',hms2deg(,`$3',`$4')))) - C: circle fill_(0) diam 0.47*mhsf at L.start - move to C - spline from rvec_(0,0.047*mhsf) \ - to rvec_(1.65*mhsf,0.11*mhsf) \ - then to rvec_(`$1',0.018*mhsf) \ - then to rvec_(`$1',-0.018*mhsf) \ - then to rvec_(1.65*mhsf,-0.11*mhsf) \ - then to rvec_(0,-0.047*mhsf) \ - shaded rgbstring(0,0,0) - ]') - -# `AntiqueHourHand(length,hr,min,sec)' -define(`AntiqueHourHand',`[ hhsf = (`$1')/2.2 - L: rpoint_(to (Rect_(`$1',hms2deg(`$2',`$3',`$4')))) - C: circle fill_(0) diam 0.6*hhsf at L.start - move to C - v = 0.25*hhsf - { line to rvec_(1.1*hhsf,0) thick 0.15/(1bp__)*hhsf } - C1: rvec_(1.25*hhsf,0) - d = `$1'-1.25*hhsf - q = 1bp__*hhsf - r1 = (d^2 + q^2 - v^2)/(v-q)/2 - tang = atan2((r1+q),d) - for i=0 to 3 do { - X[i]: C1+vec_(rect_(v, pi_+i/3*( tang-pi_))) - Y[i]: C1+vec_(rect_(v,-pi_+i/3*(-tang+pi_))) - } - n = 3 - for i=1 to 4 do { aa = -pi_+tang + i/4*(pi_/2-tang) - XX: (d,r1+q)+(rect_(r1,aa)) - n+=1; - X[n]: C1+vec_(XX.x, XX.y) - Y[n]: C1+vec_(XX.x,-XX.y) - } - m = n - for i= 0 to m do { n+=1; X[n]: Y[m-i] } - fitcurve(X,n,shaded rgbstring(0,0,0)) - ]') - -define(`AntiqueClock',`[ # h,m,s,diam -# Clock size parameters: - hour = ifelse(`$1',,3,`$1') - minute = ifelse(`$2',,41,`$2') - second = ifelse(`$3',,51,`$3') - # outer radius - ifelse(`$4',,`skale=0.5; r1=2',`r1=(`$4')/2; skale=r1/4') - r2 = r1 - 0.5*skale - r3 = r2 - 0.14*skale - r4 = r3 - 0.35*skale - r5 = r4 - 0.17*skale - r6 = r5 - 0.63*skale - r7 = r6 - 0.17*skale - shadelinethick = 1.0 - -C: circle thick 0.2 rad r1 - -define shadeline { - s = 1-($`'1)*2 - v = r*s - h = sqrt(r^2-v^2) - t = 1-abs(s) - line from (vrot_(-h,v,cost,sint)) to (vrot_(h,v,cost,sint)) \ - thick shadelinethick outlined rgbstring(t,t,t) - } - - r = r1 # Bezel outer - nlines = int(2*r/(shadelinethick pt__)*1.1) - cost = cosd(10); sint = sind(10); - ShadeObject(shadeline,nlines, 0, 0,0,0, 0.5, 1,1,1, 1, 0,0,0 ) at C - - r = r2 # Bezel inner - nlines = int(2*r/(shadelinethick pt__)*1.1) - cost = cosd(-10); sint = sind(-10); - ShadeObject(shadeline,nlines, 0, 0,0,0, 0.25, 0.8,0.8,0.8, 0.5, 1,1,1, - 0.75, 0.8,0.8,0.8, 1, 0,0,0 ) at C - -# Clock face -Face: circle thick 0 fill_(1) rad r3 at C - circle rad r4 at C - circle rad r5 at C - circle rad r6 at C - circle rad r7 at C -# Ad hoc shift of rotated SVG text - define adj { (-cosd($`'1)*textht*0.5*sign(180-($`'1)),\ - (0.25+0.25*cosd(2*($`'1)))*textht) } -# Outer numbers - textht = (r3-r4)*0.6 - for mn = -15 to 15 by 5 do { t = 90-mn/60*360 - R:(Rect_((r3+r4)/2,t)) - svg_rot(-mn/60*360,sprintf("%g",pmod(mn,60)) at C+R+adj(t)) - } - for mn = 20 to 40 by 5 do { t = 450-mn/60*360 - R: (Rect_((r3+r4)/2,t)) - svg_rot(180-mn/60*360, sprintf("%g",pmod(mn,60)) at C+R+adj(t)) - } -# Outer tics - for mn = 1 to 60 do { t = 90-mn/60*360 - line from C+(Rect_(r5,t)) to C+(Rect_(r4,t)) } - -# Inner numbers - textht = (r5-r6)*0.6 - Loopover_(`mx',`tt = 90-(m4Lx-4)/12*360 - R: (Rect_((r5+r6)/2,tt)) - svg_rot(tt-90, "mx" at C+R+adj(tt)) ', - IX,X,XI,XII,I,II,III) - Loopover_(`mx',`tt = 360-m4Lx*30 - R: (Rect_((r5+r6)/2,tt)) - svg_rot(tt-270, "mx" at C+R+adj(tt)) ', - IV,V,VI,VII,VIII) - -# Inner tics - for mn = 5 to 60 by 5 do { t = 90-mn/60*360 - line from C+(Rect_(r7,t)) to C+(Rect_(r6,t)) } - -# Hands - AntiqueHourHand(r6,hour,minute,second) with .C at C - AntiqueMinuteHand(r5,hour,minute,second) with .C at C - SecondHand((r3+r4)/2,hour,minute,second) with .C at C - -# Center - dot(at C,0.1/4*r1,1) - ]') - - Clock1: AntiqueClock(,,,3.5) -# Clock2: AntiqueClock(4,48,07,2) at Clock1.e+(1.5,0) - - command "</g>" # end font -.PE diff --git a/graphics/circuit_macros/examples/svg/ArrowFnSVG.m4 b/graphics/circuit_macros/examples/svg/ArrowFnSVG.m4 new file mode 100644 index 0000000000..b72914b728 --- /dev/null +++ b/graphics/circuit_macros/examples/svg/ArrowFnSVG.m4 @@ -0,0 +1,59 @@ +.PS +# ArrowFnSVG.m4 +# https://tex.stackexchange.com/questions/581089/arrow-function-diagrams +gen_init + brad = 0.04 + bht = 0.4 + bwid = 0.25 +define(`rbox',`box rad brad outlined "Orange"') + +B1: [ + svg_font(Times,14bp__) + linethick = 1.2 + arrowwid = 0.08 + rbox wid 5*boxwid ht 3/2*boxwid + line from last box.w-(bht/4,0) "svg_it(X)" above ljust +T: Here + arrow up bwid right bwid then right bwid +F: rbox ht bht "svg_it(f)" + {"svg_it(Y)" above ljust } + arrow down bwid right bwid from T then right boxwid + bwid*3/2 +G: rbox ht bht "svg_it(g)" + {"svg_it(Z)" above ljust } +S: circle diam bht "svg_it(+)" at (G.e.x+boxwid,(F.y+G.y)/2) + d = F.y-S.nw.y + arrow from F.e to S.nw+(-d,d) then to S.nw + arrow from G.e to S.sw+(-d,-d) then to S.sw + arrow right from S.e + command "</g>" # end font + ] +[ + svg_font(Times,11bp__) + bht = bht/2 + sbwid = boxwid*3/4 + bbwid = sbwid*5/4 + dh = bht/2 +B1: rbox wid bbwid ht bbwid +B2: rbox wid sbwid*3/2 ht bbwid at B1+(3/2*bbwid,0) +B3: rbox wid bbwid ht bbwid at B2+(3/2*bbwid,0) +B4: rbox wid sbwid*3/2 ht bbwid at B3+(3/2*bbwid,0) +B5: rbox wid bbwid ht bbwid at B4+(3/2*bbwid,0) + F: rbox ht bht wid sbwid at B2.n-(0,bht*3/4) "svg_it(f)" +BR: B2.s+(0,B2.n.y-F.y) + G: rbox ht bht wid sbwid at (B4,F) "svg_it(g)" + S: circle diam bht*3/2 at B5+(bht/2,0) "svg_it(+)" + arrow right from S.e + T: B1.w+(dh,0) +B: rbox ht bbwid*5/4 wid boxwid*7.25 with .w at T-(sbwid*3/4,0) + { line from T left sbwid "svg_it(x)" above ljust } + arrow from T to (B1.e-(dh,0),F) then to F.w + arrow from F.e to (B3.w+(dh,0),F) then to (B3.e-(dh,0),BR) + continue to (B5.w+(dh,0),Here) then to S.sw + line thick 5 outlined "white" from B3.sw to B3.ne chop brad + arrow from T to (B1.e-(dh,0),BR) then to (B3.w+(dh,0),BR) \ + then to (B3.e-(dh,0),G) then to G.w + arrow from G.e to (B5.w+(dh,0),G) then to S.nw + command "</g>" # end font + ] with .nw at B1.sw+(0,-0.2) + +.PE diff --git a/graphics/circuit_macros/examples/svg/BtreeSVG.m4 b/graphics/circuit_macros/examples/svg/BtreeSVG.m4 index 158b475b7b..e025572a0a 100644 --- a/graphics/circuit_macros/examples/svg/BtreeSVG.m4 +++ b/graphics/circuit_macros/examples/svg/BtreeSVG.m4 @@ -4,8 +4,9 @@ gen_init(svg_font(sans-serif,11bp__)) sinclude(tst.dim) s_init(Btree) +maxpswid = 12 Btree: [ -circlerad = 0.45 +circlerad = 0.35 define n { [C: circle fill_(0.9) $1 if "$2" != "" then { @@ -97,11 +98,12 @@ define(`txw',`wid `$1'mm__')dnl scaled by 14/12 for 14 pt type + "((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); move right 0.2)), + txw(29) with .n at last "".ne+(0.2,-vsep*2/3); \ + move right 0.2)), Node(3,"svg_it(h(x`'svg_sub(9)))" txw(8) \ at 0.5 between Head1 and Head2))) -] with .w at last [].e+(-0.75,0) +] with .w at last [].e+(-1,0) command "</g>" # end font .PE diff --git a/graphics/circuit_macros/examples/svg/CapacitorsSVG.m4 b/graphics/circuit_macros/examples/svg/CapacitorsSVG.m4 new file mode 100644 index 0000000000..1942860d37 --- /dev/null +++ b/graphics/circuit_macros/examples/svg/CapacitorsSVG.m4 @@ -0,0 +1,38 @@ +.PS +# `Capacitors.m4' +cct_init(svg_font(sans-serif,11pt__)) +textwid = 1.5 +movewid = 2 pt__ +hm = 2.1 +vm = 0.28 + +hm = 2.05 +vm = 0.28 +{ {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_ +{ {capacitor(,dC); move ;"`capacitor(,dC) '" ljust} + move right_ hm + {capacitor(,dF); move ;"`capacitor(,dF) '" ljust} +} + + command "</g>" # end font +.PE diff --git a/graphics/circuit_macros/examples/svg/ChipsSVG.m4 b/graphics/circuit_macros/examples/svg/ChipsSVG.m4 new file mode 100644 index 0000000000..3d9ccb1edc --- /dev/null +++ b/graphics/circuit_macros/examples/svg/ChipsSVG.m4 @@ -0,0 +1,44 @@ +.PS +# ChipsSVG.m4 +log_init +include(icsSVG.m4) +svg_font(sans-serif,8.5bp__) + +Chips: [ + ic4017 + {"4017" at last [].Chip.sw below ljust} + move + ic4510 + {"4510" at last [].Chip.sw below ljust} + move + icVS1053 + {"VS1053" at last [].Chip.sw below ljust} + + DIP_chip_outline with .sw at last [].se+(0.5,0) + { `"DIP_chip_outline"' at last [].s below } + ] + +DIPs: [ + DIP0: DIP + DIP32: DIP(32,direct=R;bodywid=0.5*scale) with .sw at last [].se+(0.5,0) + DIP16: DIP(16,type=Q;pinwid=1bp__) with .sw at DIP32.se+(1.5,0) + + thinlines_ + { "svg_tt(`DIP')" at DIP0.s - (0,10bp__) } + { arrow <- from DIP0.Pin1 up 0.2; "svg_it(`Pin1')" ljust at Here+(-0.05,0.1) } + { arrow <- from DIP0.c up 0.7 right 0.25; "svg_it(`Body')" ljust } + { 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__) } + { 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 } + + { "svg_tt(`DIP(16,type=Q;pinwid=1bp__)')" at DIP16.sw - (0,10bp__) ljust } + thicklines_ + + ] with .nw at last [].sw+(0,-0.3) + + command "</g>" +.PE diff --git a/graphics/circuit_macros/examples/svg/CrossbarSVG.m4 b/graphics/circuit_macros/examples/svg/CrossbarSVG.m4 deleted file mode 100644 index 12bb2d72c3..0000000000 --- a/graphics/circuit_macros/examples/svg/CrossbarSVG.m4 +++ /dev/null @@ -1,54 +0,0 @@ -.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/graphics/circuit_macros/examples/svg/CrullerSVG.m4 b/graphics/circuit_macros/examples/svg/CrullerSVG.m4 index f4630aff06..7f8173b52a 100644 --- a/graphics/circuit_macros/examples/svg/CrullerSVG.m4 +++ b/graphics/circuit_macros/examples/svg/CrullerSVG.m4 @@ -52,10 +52,10 @@ 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))) + 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 ) \ diff --git a/graphics/circuit_macros/examples/svg/DiniSVG.m4 b/graphics/circuit_macros/examples/svg/DiniSVG.m4 index 5631a4822f..1846917a4a 100644 --- a/graphics/circuit_macros/examples/svg/DiniSVG.m4 +++ b/graphics/circuit_macros/examples/svg/DiniSVG.m4 @@ -46,10 +46,10 @@ define(`Dini', du = ur/ugrid/2 dv = vr/vgrid/2 for i=0 to n do { - NE: project(Dini(ciu[ix[i]]+du,civ[ix[i]]+dv)) - SE: project(Dini(ciu[ix[i]]+du,civ[ix[i]]-dv)) - SW: project(Dini(ciu[ix[i]]-du,civ[ix[i]]-dv)) - NW: project(Dini(ciu[ix[i]]-du,civ[ix[i]]+dv)) + NE: Project(Dini(ciu[ix[i]]+du,civ[ix[i]]+dv)) + SE: Project(Dini(ciu[ix[i]]+du,civ[ix[i]]-dv)) + SW: Project(Dini(ciu[ix[i]]-du,civ[ix[i]]-dv)) + NW: Project(Dini(ciu[ix[i]]-du,civ[ix[i]]+dv)) f = (-cos(ciu[ix[i]])+1)/2 g = ( sin(ciu[ix[i]])+1)/2 line from NE to SE then to SW then to NW then to NE \ @@ -174,9 +174,9 @@ array2(h,m4inx,53,54,55,58,59,57) } for i=1 to n do { for j=1 to 6 do { x[j]=h[ih[i],j] } - line from project((v[x[1],1]),(v[x[1],2]),(v[x[1],3]))\ - for_(2,6,1,`to project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ - to project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0.95) + line from Project((v[x[1],1]),(v[x[1],2]),(v[x[1],3]))\ + for_(2,6,1,`to Project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ + to Project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0.95) } m = 0 for i=1 to 12 do { # Visible pentagons @@ -185,9 +185,9 @@ array2(h,m4inx,53,54,55,58,59,57) } for i=1 to m do { for j=1 to 5 do { x[j]=p[ip[i],j] } - line from project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) \ - for_(2,5,1,`to project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ - to project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0) + line from Project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) \ + for_(2,5,1,`to Project((v[x[m4x],1]),(v[x[m4x],2]),(v[x[m4x],3]))\')\ + to Project((v[x[1],1]),(v[x[1],2]),(v[x[1],3])) thick 0.2 fill_(0) } ] scaled 2.5 with .sw at last [].se+(1,0) .PE diff --git a/graphics/circuit_macros/examples/svg/EEPSVG.m4 b/graphics/circuit_macros/examples/svg/EEPSVG.m4 new file mode 100644 index 0000000000..4f928f927d --- /dev/null +++ b/graphics/circuit_macros/examples/svg/EEPSVG.m4 @@ -0,0 +1,553 @@ +.PS +# EEPSVG.m4 +# https://electrical-engineering-portal.com/single-line-diagrams-symbols-drawings-analysis + +cct_init +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. + +# 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. +# 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: +# 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: +# 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. +# 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 + + + u = dimen_ + + svg_font(sans-serif,9.0bp__,textoffset) + +define(`ctb',`[CT: sl_ct(,,`$1') + L: line up_ u/2 with .c at CT.L.c + BU: sl_breaker( up_ u*2/3,box=fill_(0)) + BR: sl_breaker( right_ ifelse(`$1',U,,-)u*3/4 \ + from CT.ifelse(`$1',U,Te,Ts),box=fill_(0))]') + +define(`tsbx',`sl_ttbox(`$1',`$2';lgth=u*0.4;wdth=u/2;text="TS")') +define(`lcdiam',u*0.85) +define(`lcirc',`[C: circle diam lcdiam ifelse(`$1',,,`$1') + line right C.diam*3/4 with .c at C + ifelse(`$2',,,`$2' at C.ne above ) + ifelse(`$3',,,`$3' at C.se below ) + ]') + +define(`Svee',`[S: Here; line from (sqrt(3),1)*(`$1') to S \ + then to (sqrt(3),-1)*(`$1')]') + +Box1: [ + V: line down_ u + {`"13.8 kV 3 ph + GND 60 Hz"' at V.start rjust} + { ellipse wid u/6 ht u/10 at Here+(0,u/3) + line right_ u/2 from last ellipse.e + ellipse wid u*4/3 ht u/2 "M1-00" } + AT: open_arrow(ToPos(,U,u), u/3*sqrt(3)/2, u/3) + dot(at 2nd last line.start) + { line left_ u then up_ u/3 ht u/10 wid u/10; dot } + line down_ u + { line up_ u/2 from last line.end+(-u/6,u/8) + sl_disk( left_ u/2 from last line.c,diam=u/3;name=L ); move to L.c + for_(45,315,90,`{line to L.c+(Rect_(L.diam,m4x)) chop u/5 chop 0}') } + T: dot + { sl_transformer(right_ 2*u,cycles=2;name=Tr1) + {"14400:120` 'V" at last [].n above} + { Svee(u/7) with .ne at Tr1.sw+(-u/15,-u/15) + Svee(u/7) with .nw at Tr1.se+( u/15,-u/15); ground(at last [].S) } + dot; fuse(right_ u,C) + line to (Here,1st ellipse) + MB: box wid 3/4*u ht 3/4*u with .sw at Here+(-u/8,0) + circle diam 5/8*u at last box "M" } + line down u/2 + CT1: ctb(U) with .BU.end at Here + {"500:5" rjust at CT1.CT.w } + { Svee(u/7) with .S at CT1.CT.Ts+( u/4,0); ground(at last [].S) } + line from MB.se+(-u/8,0) down_ MB.s.y-CT1.BR.y then to CT1.BR.end + line from CT1.L.start down_ 3/4*u + T2: dot + { line left_ u from T2; sl_drawout(,type=T,R); fuse(left_ u,C) + sl_transformer(left_ u/2,cycles=2;name=Tr2) + {"14400:120` 'V" at last [].n above} + {Ysymbol(with .ne at Tr2.sw+(u/8,0),type=G;size=u/6)} + {Ysymbol(with .nw at Tr2.se+(u/15,0),type=G;size=u/6)} + fuse(left_ u,C); sl_drawout(,type=T) + TS1: tsbx(left_ u*3/4) } + CT2: ctb(U) with .BU.end at Here + {"800:5" rjust at CT2.CT.w } + {Ysymbol(at CT2.CT.Ts+(u/2,-u/8),type=G;size=u/5)} + sl_breaker(up_ 2.0*u with .end at CT2.L.start, + lgth=u*0.75;wdth=u*0.8;name=M1;type=D) + {`"52-M1" "1200 A"' at M1} + CT3: ctb(D) with .BU.end at last line.start + {"800:5" ljust at CT3.CT.e } + BT3: CT3.BR.end + {Ysymbol(at CT3.CT.Te+(-u/2,-u/8),type=G;size=u/5)} + CT4: ctb(D) with .BU.end at CT3.L.start + {"600:5 MR" ljust at CT4.CT.e } + {Ysymbol(at CT4.CT.Te+(-u/2,-u/8),type=G;size=u/5)} + line from CT4.L.start down_ u; dot; + { line left_ u then up_ u/3 ht u/10 wid u/10; dot } + AB: arrow down_ u*2/3 ht u/3*sqrt(3)/2 wid u/3 + tsbx(left_ u from CT3.BR.end,text="SB") + line to (TS1.start,Here) + tsbx(left_ u*3/4); line left_ u/2+lcdiam/2 then up_ u/5 + CEDR3: lcirc("59" "M1","(3)") with .C.s at Here + Q: line left_ u*3/4 from CEDR3.C.w + { line left_ u/8 from Q.c+(u/8,CEDR3.C.rad) \ + then down_ CEDR3.C.diam then right_ u/8 } + CEDR4: lcirc("22" "M1","(1)") with .C.e at Here + { arrow right_ 3/2*u from CEDR3.C.e + lcirc("86" "M1","(1)") with .C.w at Here + arrow right_ u from last [].C.e + "TRIP M1" ljust above "TRIP S1" ljust } + { CEDR1: lcirc("59" "M1",,"(3)") with .C.w at (Q.c,T2) + { line from TS1.end to CEDR1.C.e } + CEDR2: lcirc("22" "M1",,"(3)") + arrow up u*2/3 from (CEDR2.e.x,CEDR2.n.y+u/3) + "TRIP S1" above; "TRIP M1" at last "".n above + move to last arrow.start + line from CEDR2.n to (CEDR2,Here) then to (CEDR1,Here) then to CEDR1.n + } + EDR5000: box wid TS1.end.x-CEDR4.C.w.x-u/8 ht last arrow.y-CEDR4.C.s.y+u/2 \ + with .n at last arrow "EDR-5000-M1" + M2: box wid u*1.1 ht u*0.85 at (TS1,CT4.BR) "PXM6000" "METER" + { line from M2.e to CT4.BR.end } + line from M2.w left_ u*3/4 + BT: dot + line to (EDR5000.w,Here)+(-u/5,0); Lft: Here + continue to (Here,CEDR2.C) then to CEDR2.C.w + Head: line down_ u*3/4 from AB.end + { ellipse wid u/6 ht u/10 at Here+(0,u/3) + line left_ u/2 from last ellipse.w + ellipse wid u*4/3 ht u/2 "M1-00" } + { line right_ u*3/4 then down_ u/8; + {line right_ u/10 with .c at Here} + {line right_ u/10 with .c at Here+(0,-u/8)} + pushdef(`dimen_',u/2) ground(at last line.c) popdef(`dimen_') } + { line down_ u/8 from Here+(u/2,0) + { pushdef(`dimen_',u/2) ground(at Here+(0,-u/8)) popdef(`dimen_') } + pushdef(`dotrad_',dotrad_/2) gap(down_ u/8,1) popdef(`dotrad_') } + BB: arrow <- down_ u/2 ht u/3*sqrt(3)/2 wid u/3 + sl_transformer(down_ u,name=Tr3) + { CUR2: lcirc("21" "T1",,"(1)") with .C.c at Tr3.e+(u,0) + CUR3: lcirc("49" "T1",,"(1)") with .C.w at CUR2.C.e + CUR1: lcirc("21" "T1","(1)") with .C.c at CUR2.C.c+(Rect_(CUR2.C.diam,60)) + } + line from BT to (BT.x,AB.y+u/10); X: Here; corner + CT5: ctb(U) with .BU.end at Tr3.L2.end + {"600:5" ljust below at CT5.CT.e } + corner(,at CT5.CT.Ts); ground + line from CT5.BR.end to (CUR3.C.e,CT5.BR.end)+(u/6,0) + continue to (Here,X) + tsbx(up_ u*4/3) + CUR5: lcirc("51G" "T1","(1)") with .C.s at Here + CUR6: lcirc("87" "T1","(1)") with .C.c at CUR5.C.c+(2*u,0) + arrow up_ u*2/3 from CUR5.C.n + CUR4: lcirc("86" "T1","(1)") with .C.s at Here + arrow up_ u*2/3 from CUR4.C.n + arrow <- from CUR4.C.w left CUR4.C.w.x-CUR1.C.x; corner + J2: line to CUR1.C.n + arrow from CUR6.C.w left_ u/3 then up_ CUR4.C.y-CUR6.C.y then to CUR4.C.e + tsbx(up_ u from CUR6.C.n) + line to (Here,CT2.BR) then to CT2.BR.end + crossover(from X to (CUR5,X)-(u*2/3,0),L,AB,J2); corner + tsbx(up_ u*4/3); dot + ETR5000: box wid CUR6.C.e.x-CUR1.C.x + u/5 ht CUR5.C.diam+u/2 \ + with .nw at (CUR1.C.n.x-u/8,CUR5.C.n.y+u/6) + {" ETR-5000-T1" wid 72bp__ at ETR5000.s above } + AL: arrow from Tr3.L2.c down_ u ht u/3*sqrt(3)/2 wid u/3; BX: Here + { line down_ u*2/3 from Here+( u/12,0) } + { line down_ u*2/3 from Here+(-u/12,0) } + { line down_ u*2/3; Bbot: Here } + { ellipse wid u/6 ht u/10 at Here+(0,-u/6) + line left_ u/2 from last ellipse.e + ellipse wid u*2 ht u/2 `"2000 A BUSWAY"' } + line from (CUR6,Bbot) to (CUR6,X); tsbx(to CUR6.C.s) + Outer: box ht AT.end.y-AB.end.y wid ETR5000.e.x-Lft.x + u/3 \ + with .nw at (Lft.x-u/6,AT.end.y) + `"USG-1A"' ljust \ + `"13.8 KV 1200 A"' ljust \ + `"50 kA SYM S.C."' ljust \ + `"(15 kV - 95 kV BIL RATED)"' ljust at Outer.nw+(0,-u*2/3) + ] + + command "</g>" + +.PE diff --git a/graphics/circuit_macros/examples/svg/EscherSVG.m4 b/graphics/circuit_macros/examples/svg/EscherSVG.m4 new file mode 100644 index 0000000000..191123754e --- /dev/null +++ b/graphics/circuit_macros/examples/svg/EscherSVG.m4 @@ -0,0 +1,188 @@ +.PS +# EscherSVG.m4 +# https://tex.stackexchange.com/questions/129274/showcase-of-optical-illusions-made-with-tex-latex-luatex-context +threeD_init +[ + u=1/2.54 # unit size; could use scale for this + + define(`treadcolor',`0.8,0.75,0.7') + define(`darkgrn',`.1,.1,0') + define(`lightgrn',`.7,.7,.6') + + define(`northsteps',3) + define(`eaststeps',8) + define(`southsteps',7) + define(`weststeps',4) + define(`baselayers',10) + define(`eb',eval(baselayers+eaststeps)) + define(`ebs',eval(eb+southsteps)) + define(`under',7) + + azimuth = -45 # view angles + elevation = 25 + setview(azimuth,elevation,0) + # projected unit vectors + UX: Project(u,0,0) + UY: Project(0,-u,0) + UZ: Project(0,0,u) + # layer thickness in units of u + f= -(eaststeps*UX.y + southsteps*UY.y - weststeps*UX.y - northsteps*UY.y)/dnl + ((eaststeps+southsteps+weststeps+northsteps)*UZ.y) + # XY projection of 3D coords in units of u +define proj {UX*($1)+UY*($2)+UZ*($3)} + +define tread {line from UY/2 \ + to UY then to UY+UX then to UX then to (0,0) \ + then to UY/2 shaded rgbstring(treadcolor) \ + with .start at proj($1,$2,$3)+UY/2 } + +define wrect {line invis from (0,0) to UX*($4) \ + then to UX*($4)+UZ*($5) \ + then to UZ*($5) then to (0,0) with .start at proj($1,$2,$3) \ + shaded rgbstring(r,g,b)} + +define srect {line invis from (0,0) to UY*($4) then to UY*($4)+UZ*($5) \ + then to UZ*($5) then to (0,0) with .start at proj($1,$2,$3) \ + shaded rgbstring(r,g,b) } + # color blending +define(`blendwht',`between3D(`$1',`$2',`$3',`$4',1,1,1)') +define makergb { r = $1; g = $2; b = $3 } +define dorgb { gg = $2 + if $1==0 then { makergb(blendwht(gg,lightgrn)) } \ + else { makergb(blendwht(gg,darkgrn)) } } + +# East + for i=-under to baselayers do { + dorgb((i%2),0.2) + wrect(1,1,i*f,eaststeps-2,-f) } + for i=0 to eaststeps do { + dorgb((i%2),0.2) + wrect(i,1,(baselayers+i)*f,(eaststeps+1-i),-f) + tread(i,0,(baselayers+i)*f) + line from proj(i,1,(baselayers+i)*f) \ + to proj(i,1,(baselayers-1+i)*f) } +# South + for i=0 to eb do { + dorgb((i%2),0.4) + srect(eaststeps+1,0,i*f,southsteps+1,-f) } + for i=1 to southsteps do { + dorgb((i%2),0.4) + srect(eaststeps+1,i,(eb+i)*f,(southsteps+1-i),-f) + tread(eaststeps,i,(eb+i)*f) + line from proj(eaststeps+1,i,(eb+i)*f) \ + to proj(eaststeps+1,i,(eb+i-1)*f) } +# North + for i=-under to baselayers-northsteps-1 do { + dorgb((i%2),0.1) + srect(1,1,i*f,northsteps-1,-f) } + for i=1 to northsteps do { + dorgb((i%2),0.1) + srect(1,1,(baselayers-i)*f,i,-f) + wrect(0,1+i,(baselayers-i)*f,1,-f) + line from proj(0,1+i,(baselayers-i)*f) \ + to proj(0,1+i,(baselayers-i-1)*f) + line from proj(1,1+i,(baselayers-i)*f) \ + to proj(1,1+i,(baselayers-i-1)*f) + tread(0,i,(baselayers-i)*f) } +# West + for i=0 to ebs do { + dorgb((i%2),0.4) + wrect(eaststeps+1,southsteps+1,i*f,-(weststeps+1),-f) } + for i=0 to weststeps-1 do { + dorgb((i%2),0.4) + wrect(eaststeps-i,southsteps+1,(ebs+i+1)*f,-(weststeps-i),-f,) + srect(eaststeps-i,southsteps,(ebs+i+1)*f,1,-f) + if i!=weststeps-1 then { + line from proj(eaststeps-i,southsteps,(ebs+i+1)*f) \ + to proj(eaststeps-i,southsteps,(ebs+i)*f) } + line from proj(eaststeps-i,southsteps+1,(ebs+i+1)*f) \ + to proj(eaststeps-i,southsteps+1,(ebs+i)*f) + tread(eaststeps-(i+1),southsteps,(ebs+i+1)*f) } +# Corner lines + define(`dgreen',`outlined rgbstring(blendwht(0.2,darkgrn))') + line dgreen from proj(1,1,(baselayers-1)*f) to proj(1,1,-under*f) + line dgreen from proj(eaststeps+1,southsteps+1,ebs*f) \ + to proj(eaststeps+1,southsteps+1,-f) + line dgreen from proj(0,northsteps+1,(baselayers-northsteps)*f) \ + to last line.end-UX*(weststeps+1) then to last line.end \ + then to proj(eaststeps+1,0,-f) then to proj(eaststeps+1,0,eb*f) + ] + +ifelse(1,1,` +[ + setview(-45,20) + bwid = 2.8 + bh = 1.5 + bdp = 1.8 + bth = 0.3 + A: Project(0,0,0) + AA: A+Project(bth,bth,-bth) + B: Project(0,bwid,0) + BB: B+Project(bth,-bth,-bth) + C: Project(bdp,bwid,0) + D: Project(bdp,0,0) + E: Project(0,0,-bh) + F: Project(bdp,0,-bh) + G: Project(bdp,bwid,-bh) + H: B + Project(0,0,-bh) + + line from A to B then to C then to D then to A then to E then to F \ + then to G then to H then to E + line from C to G + line from A+Project(bth,bth,0) to B+Project(bth,-bth,0) \ + then to C+Project(-bth,-bth,0) + L1: line to D+Project(-bth,bth,0) + L2: line to A+Project(bth,bth,0) + L4: line from E+Project(bth,bth,0) to H+Project(bth,-bth,0) + L3: line to C+Project(-bth,-bth,-bh) + line to F+Project(-bth,bth,0) then to A+Project(bth,bth,-bh) + + L5: line from D+Project(-bth,0,-bth) to A+Project(bth,0,-bth) + line to E+Project(bth,0,bth) + L6: line to Here+Project(0,bwid-2*bth,0) + L7: line from D+Project(0,bth,-bth) to C+Project(0,-bth,-bth) + line to G+Project(0,-bth,bth) + L8: line to Here+Project(-bdp+2*bth,0,0) + Tmp: line invis from L8.start+Project(-bth,0,0) up bh + line from Tmp.start to Intersect_(Tmp,L7) + Tmp: line invis from L8.end up bh + line from L8.end to Intersect_(Tmp,L7) + line from Intersect_(Tmp,L1) to BB+Project(bth,0,0) + Tmp: line invis to Here+Project(bdp,0,0) + line from Tmp.start to Intersect_(Tmp,L1) + + Tmp: line invis from H up bh + line from H to Intersect_(Tmp,L7) + line from Intersect_(Tmp,L1) to B+Project(bth,-bth,0) + + Tmp: line invis from AA to AA+Project(0,bwid,0) + Tmp2: line invis up bh from L6.end + line from Intersect_(Tmp,L2) to Intersect_(Tmp2,Tmp) \ + then to Intersect_(Tmp2,L1) + line from L6.end to Intersect_(Tmp2,L7) + + Tmp: line invis down bh from AA + line from Intersect_(Tmp,L6) to Intersect_(Tmp,L5) + + Tmp: line invis down bh from D + line from D to Intersect_(Tmp,L6) + line from Intersect_(Tmp,L4) to F+Project(-bth,bth,0) + + Tmp: line invis from L5.start to L5.start+Project(0,0,-bh) + move to E+Project(0,2*bth,0) + Tmp2: line invis to Here+Project(bdp,0,0) + line from L5.start to Intersect_(Tmp,L6) + line from Intersect_(Tmp,L4) to Intersect_(Tmp,Tmp2) \ + then to Intersect_(Tmp2,L4) + + Tmp: line invis from L7.start to L7.start+Project(0,0,-(bh-bth)) + line from L7.start to Intersect_(Tmp,L6) + + move to G+Project(-2*bth,0,0) + Tmp2: line invis to Here+Project(0,-bwid,0) + line from Intersect_(Tmp2,L3) to Intersect_(Tmp,Tmp2) + line from Intersect_(Tmp,L4) to Intersect_(Tmp2,Tmp) + +] with .sw at last [].se+(0.2,0) +') +.PE diff --git a/graphics/circuit_macros/examples/svg/GeometrySVG.m4 b/graphics/circuit_macros/examples/svg/GeometrySVG.m4 index ae0a661012..bb6ff0bd2a 100644 --- a/graphics/circuit_macros/examples/svg/GeometrySVG.m4 +++ b/graphics/circuit_macros/examples/svg/GeometrySVG.m4 @@ -3,6 +3,8 @@ gen_init scale = 5/4 +G: [ + A: Here; "A" at A above B: A+(-1,-3.5); "B" at B below rjust C: B+(4.6,0); "C" at C below ljust @@ -42,5 +44,167 @@ gen_init line dashed from X to Y chop -linewid/2 RightAngle(A,Z,Y) + ] scaled 0.8 +Lyap: [ +#.PS +# Lyap.m4 +threeD_init +#scale = 1/1.2 + +viewaz = 30 +viewel = 18 +setview(viewaz,viewel) + +Origin: Project(0,0,0) +# Components of view vector W +w1 = view3D1 +w2 = view3D2 +w3 = view3D3 +# Shape factor of the ellipse on the xy plane +q = Cos(40) + +# cost function +h = 0.5 +c = 1 +# The projected ellipse is (x/q)^2 + y^2 = c. +# The cost is v = c+h +define(`vs',``$2'*q*cos(`$1'),`$2'*sin(`$1')') +define(`vp',`vs(`$1',`$2'),0') +define(`vx',`sum3D(vp(`$1',`$2'),0,0,h+(`$2')^2)') + +# The gradient of v is (2x/q, 2y, -1) and the line +# separating front and back is W^T * grad(v) = 0 +# This line intersects the projected ellipse at +# x1,y1 and x2,y2 + ap = w2^2*q^2/w1^2+1 + bp = -w2*w3*q^2/w1^2 + cp = w3^2*q^2/4/w1^2-c + m = sqrt(bp^2-4*ap*cp) + y1 = (-bp+m)/ap/2 ; x1 = (w3-2*y1*w2)*q/2/w1 + y2 = (-bp-m)/ap/2 ; x2 = (w3-2*y2*w2)*q/2/w1 + t1 = atan2(y1,x1) + t2 = atan2(y2,x2) + theta1 = min(t1,t2) + theta2 = max(t1,t2) + +# tangent curve + nT = 11 + for i = 0 to nT do { + y = y1 + (y2-y1)/nT*i + theta = atan2(y,(w3-2*y*w2)*q/2/w1) + r = y/sin(theta) + T[i]: Project(vx(theta,r)) + } + +# front and back parts of the top curve + n = 12 + for i = 0 to n do { + theta = theta1 + (theta2-theta1)/n*i + F[i]: Project(vx(theta,c)) + Fp[i]: Project(vp(theta,c)) + } + for i = 0 to n do { + theta = theta2 + (theta1+twopi_-theta2)/n*i + B[i]: Project(vx(theta,c)) + Bp[i]: Project(vp(theta,c)) + } + +# trajectory +rotations = 1.55 +nx = 7 +thetas = 75*dtor_ +thetaf = thetas - rotations*twopi_ +rx = c*0.9 +beta = exp(log(.5)/20) + +define(`defX',` rx = `$5' ; np = np-1 + ts = `$1' ; tf = `$2' + for i = 0 to `$3' do { + tha = ts + (tf-ts)*i/(`$3') + for thx = tha to -twopi_ by twopi_ do {} + `$4'[i]: Project(vx(thx,rx)) + Xp[np]: Project(vp(thx,rx)) + np = np+1 + rx = beta*rx + }') + +np = 1 +defX(thetas,theta1,nx,X1,rx) +defX(theta1,theta2-twopi_,nx,X2,rx/beta) +defX(theta2-twopi_,theta1-twopi_,nx,X3,rx/beta) +defX(theta1-twopi_,thetaf,5,X4,rx/beta) + +# First draw the inside back +# B is the back curve +# T is the outline +ifpstricks(` +\psset{gradbegin=lightgray,gradend=darkgray,gradlines=1000} +\pscustom[fillstyle=gradient,gradmidpoint=0.7]{ + fitcurve(B,n) + for i = 0 to nT do {TT[i]: T[nT-i] } + fitcurve(TT,nT) +\relax} ', +` fitcurve(B,n) + for i = 0 to nT do {TT[i]: T[nT-i] } + fitcurve(TT,nT) ') + +# Centre axis +thinlines_ +line from Origin to Project(0,0,h) +# F[0] is the leftmost point of the front curve +line from F[0] to Fp[0] +# F[n] is the rightmost point of the front curve +line from F[n] to Fp[n] +thicklines_ + +# Now draw the outside front +ifpstricks(` +\newgray{gray1}{0.9}% +\newgray{gray2}{0.4}% +\psset{gradbegin=gray1,gradend=gray2,gradlines=1000} +\pscustom[linewidth=0pt,fillstyle=gradient,gradmidpoint=0.99]{ + fitcurve(F,n) + fitcurve(T,nT) +\relax} ', +` shade(1,fitcurve(F,n) + fitcurve(T,nT)) ') +# T is the limit curve of visibility + fitcurve(T,nT) +# F is the top front + fitcurve(F,n) +# Front and back projections of the top on xy + fitcurve(Fp,n) + fitcurve(Bp,n) + +# The trajectory in pieces, to allow dashed parts + fitcurve(X1,nx) + fitcurve(X2,nx,dotted 0.025) + fitcurve(X3,nx) + fitcurve(X4,3,dotted 0.015) + arca(from X4[4] to X4[2],ccw,0.3,<-) + +# Projected trajectory + np = np-2 + fitcurve(Xp,np-1) + arca(from Xp[np] to Xp[np-2],ccw,0.18,<-) + "svg_it(X(t))" at Xp[np]-(2bp__,0) ljust + +# Axes and vertical lines +thinlines_ + line from X1[0] to Xp[0] +arrow from Origin to Project(1.5,0,0) +"svg_it(x)`'svg_sub(1)" rjust below +arrow from Origin to Project(0,1.5,0) +"svg_it(x)`'svg_sub(2)" wid 10bp__ ljust +line dashed from Project(0,0,h) to F[n/2] chop 0 chop arrowht/4 +arrow from F[n/2] to Project(0,0,2) +"svg_it(v(X))" ljust + +"svg_it(0)" at Origin+(0,1 pt__) below +"svg_Omega" at Project(0,0.9*c,0) above +"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) .PE diff --git a/graphics/circuit_macros/examples/svg/GrayCodeSVG.m4 b/graphics/circuit_macros/examples/svg/GrayCodeSVG.m4 index 8d11969049..b878e63d8e 100644 --- a/graphics/circuit_macros/examples/svg/GrayCodeSVG.m4 +++ b/graphics/circuit_macros/examples/svg/GrayCodeSVG.m4 @@ -2,6 +2,7 @@ # Gray_code.m4 gen_init +GrayCode: [ outer = 4 inner = 0.75 nbits = 10 @@ -17,4 +18,62 @@ C: circle diam outer arcd(C,outer/2-(bit-0.5)*lthk,startang,endang) thick lthk/(1bp__) } } + ] +Crossbar: [ +#.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 + ] with .w at last [].e+(0.25,0) .PE diff --git a/graphics/circuit_macros/examples/svg/InductorsSVG.m4 b/graphics/circuit_macros/examples/svg/InductorsSVG.m4 new file mode 100644 index 0000000000..9c9e1476db --- /dev/null +++ b/graphics/circuit_macros/examples/svg/InductorsSVG.m4 @@ -0,0 +1,47 @@ +.PS +# `Inductors.m4' +cct_init(svg_font(sans-serif,10pt__)) +textwid = 1.5 +movewid = 2 pt__ +hm = 2.1 +vm = 0.28 + +hm = 2.05 +vm = 0.28 +{ {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(,,3,M) ; move ;"`...(,,3,M) '" ljust} + move right_ hm + {inductor(,W,6,P1); variable; move; "`...(,W,6,P1); variable'" ljust} + move right_ hm+5bp__ + {inductor(,L,9,K); move ;"`...(,L,9,K) '" ljust} +} + + move down vm; right_ +{ {I:inductor(,,,M3); addtaps(-,1/2,-dimen_/6); move; `"...(,,,M3)"' ljust + {`"addtaps(-,1/2,-dimen_/6)"' ljust at (I.start,last ""+(0,-textht*3/2)) } + } + move right_ hm + {ebox(,,,0) ; move ;"`ebox(,,,0) '" ljust} + move right_ hm -10bp__ + {TI: tapped(`ebox(,,,0)',-,1/4,-dimen_/6,3/4,-dimen_/6) ; move ; + "`tapped(`ebox(,,,0)','" ljust at Here+(10bp__,-5bp__) \ + "-,1/4,-dimen_/6," ljust "3/4,-dimen_/6)" ljust + "svg_it(Tap1)" at TI.Tap1 rjust below + "svg_it(Tap2)" at TI.Tap2 ljust below } +} + + move down vm*3/2; right_ +{ {shielded(`inductor(,,,M)') ; move + `"shielded(`inductor(,,,M)')"' ljust + move to (3rd last line.start,Here) + shielded(`ebox(,,,0)',R) ; move; `"shielded(`ebox(,,,0)',R)"' ljust } +} + + command "</g>" # end font +.PE diff --git a/graphics/circuit_macros/examples/svg/LyapSVG.m4 b/graphics/circuit_macros/examples/svg/LyapSVG.m4 deleted file mode 100644 index 6ed269a428..0000000000 --- a/graphics/circuit_macros/examples/svg/LyapSVG.m4 +++ /dev/null @@ -1,159 +0,0 @@ -.PS -# Lyap.m4 -threeD_init -scale = 1/1.2 - -viewaz = 30 -viewel = 18 -setview(viewaz,viewel) - -Origin: project(0,0,0) -# Components of view vector W -w1 = view3D1 -w2 = view3D2 -w3 = view3D3 -# Shape factor of the ellipse on the xy plane -q = Cos(40) - -# cost function -h = 0.5 -c = 1 -# The projected ellipse is (x/q)^2 + y^2 = c. -# The cost is v = c+h -define(`vs',``$2'*q*cos(`$1'),`$2'*sin(`$1')') -define(`vp',`vs(`$1',`$2'),0') -define(`vx',`sum3D(vp(`$1',`$2'),0,0,h+(`$2')^2)') - -# The gradient of v is (2x/q, 2y, -1) and the line -# separating front and back is W^T * grad(v) = 0 -# This line intersects the projected ellipse at -# x1,y1 and x2,y2 - ap = w2^2*q^2/w1^2+1 - bp = -w2*w3*q^2/w1^2 - cp = w3^2*q^2/4/w1^2-c - m = sqrt(bp^2-4*ap*cp) - y1 = (-bp+m)/ap/2 ; x1 = (w3-2*y1*w2)*q/2/w1 - y2 = (-bp-m)/ap/2 ; x2 = (w3-2*y2*w2)*q/2/w1 - t1 = atan2(y1,x1) - t2 = atan2(y2,x2) - theta1 = min(t1,t2) - theta2 = max(t1,t2) - -# tangent curve - nT = 11 - for i = 0 to nT do { - y = y1 + (y2-y1)/nT*i - theta = atan2(y,(w3-2*y*w2)*q/2/w1) - r = y/sin(theta) - T[i]: project(vx(theta,r)) - } - -# front and back parts of the top curve - n = 12 - for i = 0 to n do { - theta = theta1 + (theta2-theta1)/n*i - F[i]: project(vx(theta,c)) - Fp[i]: project(vp(theta,c)) - } - for i = 0 to n do { - theta = theta2 + (theta1+twopi_-theta2)/n*i - B[i]: project(vx(theta,c)) - Bp[i]: project(vp(theta,c)) - } - -# trajectory -rotations = 1.55 -nx = 7 -thetas = 75*dtor_ -thetaf = thetas - rotations*twopi_ -rx = c*0.9 -beta = exp(log(.5)/20) - -define(`defX',` rx = `$5' ; np = np-1 - ts = `$1' ; tf = `$2' - for i = 0 to `$3' do { - tha = ts + (tf-ts)*i/(`$3') - for thx = tha to -twopi_ by twopi_ do {} - `$4'[i]: project(vx(thx,rx)) - Xp[np]: project(vp(thx,rx)) - np = np+1 - rx = beta*rx - }') - -np = 1 -defX(thetas,theta1,nx,X1,rx) -defX(theta1,theta2-twopi_,nx,X2,rx/beta) -defX(theta2-twopi_,theta1-twopi_,nx,X3,rx/beta) -defX(theta1-twopi_,thetaf,5,X4,rx/beta) - -# First draw the inside back -# B is the back curve -# T is the outline -ifpstricks(` -\psset{gradbegin=lightgray,gradend=darkgray,gradlines=1000} -\pscustom[fillstyle=gradient,gradmidpoint=0.7]{ - fitcurve(B,n) - for i = 0 to nT do {TT[i]: T[nT-i] } - fitcurve(TT,nT) -\relax} ', -` fitcurve(B,n) - for i = 0 to nT do {TT[i]: T[nT-i] } - fitcurve(TT,nT) ') - -# Centre axis -thinlines_ -line from Origin to project(0,0,h) -# F[0] is the leftmost point of the front curve -line from F[0] to Fp[0] -# F[n] is the rightmost point of the front curve -line from F[n] to Fp[n] -thicklines_ - -# Now draw the outside front -ifpstricks(` -\newgray{gray1}{0.9}% -\newgray{gray2}{0.4}% -\psset{gradbegin=gray1,gradend=gray2,gradlines=1000} -\pscustom[linewidth=0pt,fillstyle=gradient,gradmidpoint=0.99]{ - fitcurve(F,n) - fitcurve(T,nT) -\relax} ', -` shade(1,fitcurve(F,n) - fitcurve(T,nT)) ') -# T is the limit curve of visibility - fitcurve(T,nT) -# F is the top front - fitcurve(F,n) -# Front and back projections of the top on xy - fitcurve(Fp,n) - fitcurve(Bp,n) - -# The trajectory in pieces, to allow dashed parts - fitcurve(X1,nx) - fitcurve(X2,nx,dotted 0.025) - fitcurve(X3,nx) - fitcurve(X4,3,dotted 0.015) - arca(from X4[4] to X4[2],ccw,0.3,<-) - -# Projected trajectory - np = np-2 - fitcurve(Xp,np-1) - arca(from Xp[np] to Xp[np-2],ccw,0.18,<-) - "svg_it(X(t))" at Xp[np]-(2bp__,0) ljust - -# Axes and vertical lines -thinlines_ - line from X1[0] to Xp[0] -arrow from Origin to project(1.5,0,0) -"svg_it(x)`'svg_sub(1)" rjust below -arrow from Origin to project(0,1.5,0) -"svg_it(x)`'svg_sub(2)" wid 10bp__ ljust -line dashed from project(0,0,h) to F[n/2] chop 0 chop arrowht/4 -arrow from F[n/2] to project(0,0,2) -"svg_it(v(X))" ljust - -"svg_it(0)" at Origin+(0,1 pt__) below -"svg_Omega" at project(0,0.9*c,0) above -"svg_it(v(X) = c)" at (project(vp(100*dtor_,c)))+(2bp__,0) above ljust - -.PE diff --git a/graphics/circuit_macros/examples/svg/Makefile b/graphics/circuit_macros/examples/svg/Makefile index 4436cd1aa5..1826a94d7a 100644 --- a/graphics/circuit_macros/examples/svg/Makefile +++ b/graphics/circuit_macros/examples/svg/Makefile @@ -15,7 +15,7 @@ DPIC = dpic #DPIC = ../../../dpic/bi*dev/dpic # To test the Windows executable. Change these as needed for the operating -# system. NOTE: AntiqueClockSVG.m4 and Connectors.m4 use awk and sed which +# system. NOTE: cscSVG.m4 and Connectors.m4 use awk and sed which # do not work at present with the Windows version. # M4LIBS = svg.m4 windows.m4 # DPIC = ../../../dpic/bison/distsrc/Windows/dpic @@ -50,21 +50,23 @@ DPIC = dpic CCTSVG = \ AdderSVG.svg AlogixSVG.svg ABlogixSVG.svg AmpTableSVG.svg AntennasSVG.svg \ - AntiqueClockSVG.svg \ AudioSVG.svg \ + AudioSVG.svg \ BipSVG.svg BtreeSVG.svg ByteSVG.svg ButtonsSVG.svg \ - CanLogicSVG.svg CctTableSVG.svg ConnSVG.svg ConnectorsSVG.svg \ + CanLogicSVG.svg CapacitorsSVG.svg ChipsSVG.svg ConnSVG.svg ConnectorsSVG.svg \ ContactSVG.svg ContactsSVG.svg \ - CountingSVG.svg CrossbarSVG.svg CrowSVG.svg CsourceSVG.svg \ + CountingSVG.svg CrowSVG.svg CsourceSVG.svg \ DecoderSVG.svg DemultiplexerSVG.svg DiniSVG.svg DiodesSVG.svg DriveSVG.svg \ - EmarrowsSVG.svg \ + EEPSVG.svg EmarrowsSVG.svg \ FlowSVG.svg FontsSVG.svg FusesSVG.svg \ GeometrySVG.svg GrayCodeSVG.svg GroundsSVG.svg \ - HeadersSVG.svg HeathkitSVG.svg InclepsSVG.svg I2LSVG.svg JackSVG.svg \ - LyapSVG.svg LogicSVG.svg LoglogSVG.svg \ - MCSVG.svg MixerSVG.svg MotorControlSVG.svg MultiplexerSVG.svg \ + HeadersSVG.svg HeathkitSVG.svg \ + InclepsSVG.svg InductorsSVG.svg I2LSVG.svg JackSVG.svg \ + LogicSVG.svg LoglogSVG.svg \ + MCSVG.svg MixerSVG.svg MoreTableSVG.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\ + PconnSVG.svg PlateSVG.svg PushPullSVG.svg QuantumSVG.svg \ + RectifiersSVG.svg RelaySVG.svg ResistorsSVG.svg RotboxSVG.svg\ SchottkySVG.svg ShiftRSVG.svg SierpinskiSVG.svg \ SixpoleSVG.svg SourcesSVG.svg SQUIDSVG.svg SwitchesSVG.svg \ TTLnandSVG.svg TgateSVG.svg ThreeSVG.svg \ @@ -76,8 +78,7 @@ CCTSVG = \ expSVG.svg fetSVG.svg graysurfSVG.svg lcctSVG.svg \ pwrsupplySVG.svg quickSVG.svg randomSVG.svg recycleSVG.svg relaycoilSVG.svg \ roseSVG.svg sfgSVG.svg shapesSVG.svg paletteSVG.svg \ - thyristorSVG.svg ujtSVG.svg UNOSVG.svg wormSVG.svg XORSVG.svg Np.svg \ - Y14-5SVG.svg + thyristorSVG.svg ujtSVG.svg UNOSVG.svg wormSVG.svg XORSVG.svg Np.svg examplesSVG.html: examplesSVG.htmx cp ../quick.m4 . @@ -89,7 +90,7 @@ examplesSVG.html: examplesSVG.htmx SED = sed -e '/^\%/d' TEST = test tst: - if test -f test.pic; then printf "\n\nUsage: make clean tst\n\n"; exit 1; fi + @if test -f test.pic; then printf "\n\nUsage: make clean tst\n\n"; exit 1;fi m4 $(M4LIBS) test.m4 | $(SED) > test.pic $(DPIC) -v $(TEST).pic > $(TEST).svg m4 $(M4LIBS) $(TEST).m4 | $(SED) > $(TEST).pic @@ -112,20 +113,14 @@ tstSVG.html: tstSVG.htmx $(TEST).svg xst: Incleps.png -AntiqueClockSVG.svg ConnectorsSVG.svg: +# necessary because of rotated text: +ConnectorsSVG.svg cscSVG.svg test.svg: m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic $(DPIC) -v $*.pic > $*.svg m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic $(DPIC) -v $*.pic > $*.svg grep '<\!-- width' $*.svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' > $*.siz -xntiqueClockSVG.svg: - m4 $(M4LIBS) AntiqueClockSVG.m4 | sed -e '/^\%/d' > AntiqueClockSVG.pic - $(DPIC) -v AntiqueClockSVG.pic > AntiqueClockSVG.svg - m4 $(M4LIBS) AntiqueClockSVG.m4 | sed -e '/^\%/d' > AntiqueClockSVG.pic - $(DPIC) -v AntiqueClockSVG.pic > AntiqueClockSVG.svg - grep '<\!-- width' AntiqueClockSVG.svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' > AntiqueClockSVG.siz - InclepsSVG.svg: InclepsSVG.m4 m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic $(DPIC) -v $*.pic > $*.svg diff --git a/graphics/circuit_macros/examples/svg/MoreTableSVG.m4 b/graphics/circuit_macros/examples/svg/MoreTableSVG.m4 new file mode 100644 index 0000000000..e06efb5d5e --- /dev/null +++ b/graphics/circuit_macros/examples/svg/MoreTableSVG.m4 @@ -0,0 +1,41 @@ +.PS +# MoreTableSVG.m4 +cct_init(svg_font(sans-serif,11pt__)) +textwid = 1.5 +movewid = 2 pt__ +hm = 2.1 +vm = 0.28 + +hm = 2.05 +vm = 0.28 + +{ {memristor ; move;"`memristor '" ljust} + move right_ hm + {heater; move;"`heater '" ljust} + move right_ hm + {tline ; move;"`tline '" ljust} +} + move down 0.25; right_ +{ {pvcell ; move;"`pvcell '" ljust} + move right_ hm + {reed ; move ;"`reed '" ljust} + move right_ hm + {reed(,,,fill_(0.9),CR) ; move ; "`reed(,,,fill_(0.9),CR) '" 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} +} + move down 0.25; right_ +{ move down 0.10; right; {lamp ; move;"`lamp '" ljust} + move right_ hm + {thermocouple ; move;"`thermocouple '" ljust } +# move up 0.10 right_ hm +# {arrester ; move ;"`arrester '" ljust} +} + + command "</g>" # end font +.PE diff --git a/graphics/circuit_macros/examples/svg/MultiplexerSVG.m4 b/graphics/circuit_macros/examples/svg/MultiplexerSVG.m4 index aba528b33b..1cd5605d6f 100644 --- a/graphics/circuit_macros/examples/svg/MultiplexerSVG.m4 +++ b/graphics/circuit_macros/examples/svg/MultiplexerSVG.m4 @@ -17,7 +17,6 @@ log_init "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 diff --git a/graphics/circuit_macros/examples/svg/PlateSVG.m4 b/graphics/circuit_macros/examples/svg/PlateSVG.m4 new file mode 100644 index 0000000000..e54235ebc5 --- /dev/null +++ b/graphics/circuit_macros/examples/svg/PlateSVG.m4 @@ -0,0 +1,173 @@ +.PS +# ASME_Y14-5.m4 +# https://en.wikipedia.org/wiki/Geometric_dimensioning_and_tolerancing +# See the ASME Y14.5 standard, Figure 6-30. +scale = 100/3 +cct_init +include(../ASME_Y14-5.m4) +ifsvg(`svg_font(sans-serif,9.5bp__)', +`textht = 10bp__*2/3 + iflatex(`command "{\sf"')') +# ASME Y14.5 specs: + arrowht = textht*0.8 + arrowwid = textht*0.6 + maxpswid = 12 + +# Diameters + d1 = (20.13+20.00)/2 + d2 = 31.7 + d3 = 36 + d4 = (40.60+40.45)/2 + d5 = 57 + d6 = 86 + d7 = 100 + d8 = 8.0 + adj = 1.5 + +Section: [ + Orig: (0,0) + T0: (0,-d7/2) + T1: (6,-d5/2) + T2: (15.5,-d3/2) + T3: (22,-d3/2-adj) + T4: (32,-d2/2) + T5: (41.3,0) + T6: (9.5,-d4/2) +# for_(0,5,1,`"m4x" at T`'m4x') +# Hatching + H: hatchbox(invis ht d7 wid 41.3,2,thick 0.4,-45) with .w at Orig + box invis fill_(1) wid T5.x-T1.x ht T1.y-H.s.y with .se at H.se + box same with .ne at H.ne + box invis fill_(1) wid T3.x-T2.x ht T2.y-T1.y with .nw at T2 + box same with .sw at (T2.x,-T2.y) + box invis fill_(1) wid T4.x-T3.x ht T3.y-T1.y with .nw at T3 + box same with .sw at (T3.x,-T3.y) + box invis fill_(1) wid T5.x-T4.x ht T4.y-T1.y with .nw at T4 + box same with .sw at (T4.x,-T4.y) +# Section outline lower + line from (0,-d4/2) to T0 then right T1.x-T0.x then up 1 + arcto(T1,(T2,T1),1) + line to (T2,T1) then up 1 + arcto(T2,(T3,T2),1) + arcto((T3,T2),T3,0.5) + arcto(T3,(T4,T3),0.5) + arcto((T4,T3),T4,1) + arcto(T4,(T5,T4),1) + line to (T5,T4) then to (T5.x,-T4.y) then left 1 +# Section outline upper + line from (0,d4/2) to (0,-T0.y) then right T1.x-T0.x then down 1 + arcto((T1.x,-T1.y),(T2.x,-T1.y),1) + line to (T2.x,-T1.y) then down 1 + arcto((T2.x,-T2.y),(T3.x,-T2.y),1) + arcto((T3.x,-T2.y),(T3.x,-T3.y),0.5) + arcto((T3.x,-T3.y),(T4.x,-T3.y),0.5) + arcto((T4.x,-T3.y),(T4.x,-T4.y),1) + arcto((T4.x,-T4.y),(T5.x,-T4.y),1) + line to (T5.x,-T4.y) + + box wid 6 ht d8 fill_(1) with .w at (0,d6/2) + box wid 6 ht d8 fill_(1) with .w at (0,-d6/2) + box invis wid T6.x ht d4 fill_(1) with .w at Orig + box wid T5.x-T6.x ht d1 fill_(1) with .e at T5 + + line from (Orig.x,-T6.y) to (Orig.x,T6.y) + arcto(T6,(T6,Orig),1) + arcto((T6.x,-T6.y),(0,-T6.y),1) + line to (0,-T6.y) + +define(`dialabel', +`[tmpthick = linethick; linethick_(1) + [Y14_dia_]; [$1 wid ifelse(`$2',,textht,`$2')] with .w at last [].e+(0.5,0) + linethick_(tmpthick)]') + +thinlines_ + dimension_(from (0,T6.y) to (0,-T6.y),40,dialabel("40.60" "40.45",12),textht*3) + line up 4 from AE_dimen_.end + Y14_frame(Y14_per_,Y14_dia_;"0";"(M)","A") with .sw at Here + Y14_frame("B") with .s at last [].n+(0,6) +thicklines_(1) + datumarrow(from last [].s to 2nd last [].n) +thinlines_ + dimension_(from T2 to (T2.x,-T2.y),30, + dialabel("35.5" "36.0",12),textht*3) + dimension_(from T0 to T0+(T1.x,0),-8," 6.1 " " 5.9 ",textht) + dimension_(from S_dimen_.end to S_dimen_.end+(T2.x,0),-9, + "15.4" "15.6",textht*4) + line from E_dimen_.start to (T2,T1) chop 0 chop 1 + dimension_(from S_dimen_.end to S_dimen_.end+(T3.x,0),-9, + "21.9" "22.1",textht*4) + line from E_dimen_.start to T3 chop 0 chop 1 + dimension_(from S_dimen_.end to S_dimen_.end+(T4.x,0),-9, + "31.9" "32.1",textht*4) + line from E_dimen_.start to (T4,T3) chop 0 chop 1 + dimension_(from S_dimen_.end to S_dimen_.end+(T5.x,0),-9, + "41.2" "41.4",textht*4) + line from E_dimen_.start to (T5,T4) chop 0 chop 1 + line from S_dimen_.start to T0 chop 0 chop 1 + dimension_(from (0,d7/2) right T6.x,8,"9.6" "9.4",3*textht) + line from E_dimen_.start to (T6.x,d4/2) chop 0 chop 1 + ctrline(from (-3,0) to T5+(3,0),T5.x/2) + ctrline(from (-3,d6/2) right T1.x+6) + ctrline(from (-3,-d6/2) right T1.x+6) + dimension_(from T5-(0,d1/2) to T5+(0,d1/2),-14, + dialabel("20.13" "20.00",4*textht),textht*3) + dimension_(from T5-(0,d2/2) to T5+(0,d2/2),-35, + dialabel("31.8" "31.6",3*textht),textht*3) + arrow <- from (T5.x+6,d1/2) by (Rect_(20,75)) then right 6 + Y14_frame(Y14_cir_,"0.06" wid 3*textht,"A","B") with .w at Here + Y14_frame("C") with .n at last [].se+(-6,-8) +thicklines_(1) + datumarrow(from last [].n up 8) +thinlines_ + arrow <- from (T5.x+6,-d2/2) by (Rect_(10,-75)) then right 4 + Y14_frame(Y14_cir_,"0.1" wid textht*2,"C") with .w at Here + arrow <- from ((T3.x+T4.x)/2,d3/2+adj) by (Rect_(30,75)) then right 4 + "M42 X 1.5 - 6g" wid 9*textht ljust + Y14_frame(Y14_pos_,Y14_dia_;"0.1" wid textht*2;"(M)","C";"(M)") \ + with .nw at last "".sw+(0,-2) + line from (T2.x,-T1.y) up 25 chop 1 chop 0 + Y14_frame(Y14_par_,"0.06" wid 3*textht,"A") with .sw at Here + Y14_frame(Y14_sur_," 0.1 " wid 3*textht,"A") with .sw at last [].nw + arrow <- from (0,-d6/2+10) left 13 + Y14_frame(Y14_fla_,"0.02" wid 4*textht) with .e at Here + Y14_frame("A") with .n at last [].s+(0,-6) + datumarrow(from last [].n up 6) + ] + +Topview:[ + C: circle diam d7 + for i=0 to 7 do { circle diam d8 at C+(Rect_(d6/2,i/8*360)) } + C5: circle diam d5 at C + C4: circle diam d3+2*adj at C + C3: circle dashed diam d3 at C + C2: circle diam d2 at C + C1: circle diam d1 at C + +thinlines_ + dimension_(from C.w-(0,10) to C.e-(0,10),-C.rad-15, + dialabel("100" "99",textht*3),textht*5) + dimension_(from C5.w-(0,5) to C5.e-(0,5),-C.rad-5, + dialabel("57.2" "56.8",textht*4),textht*5) + arrow <-> from C+(Rect_(d6/2,-120)) to C+(Rect_(d6/2,60)) + line from last arrow.end to C+(Rect_(d7/2+6,60)) then right 4 + dialabel("86.2" "85.8",textht*4) with .w at Here+(1,0) + ctrline(from (C.x-(d6-d7/2),C.y) to (C.x+(d6-d7/2),C.y)) + ctrline(from (C.x,C.y-d6/2+d8/2) to (C.x,C.y+d6/2-d8/2)) + for_(0,315,45,`ctrarcr(C,d6/2,(m4x-22.5)*dtor_,(m4x+22.5)*dtor_) + ctrline(from C+(Rect_(d6-d7/2,m4x)) to C+(Rect_(d7/2,m4x))) ') + arcdimension_(from C+(0,d7/2) to C+(Rect_(d7/2,135)) with .c at C, + 8,"8X 45`'iflatex($^\circ$)" wid textht*3.5,15,1) + ifsvg("svg_deg" wid textht*2/3 with .w at last "".e) + move to C+(0,d6/2) + arrow <- from Here+(Rect_(8/2,75)) to Here+(Rect_(25,75)) then right_ 3 + "8X" wid 2*textht ljust + linethick_(1); [Y14_dia_] with .w at last "".e+(1,0) + "7.9 - 8.1" wid 8*textht ljust + Y14_frame(Y14_pos_,Y14_dia_;"0.14" wid 3*textht;"(M)","A","C") \ + with .nw at 2nd last "".sw+(0,-2) + + ] with .C at Section.Orig+(4.5*scale,0) + + +command iflatex(`"}"',ifsvg(`"</g>"')) +.PE diff --git a/graphics/circuit_macros/examples/svg/PushPullSVG.m4 b/graphics/circuit_macros/examples/svg/PushPullSVG.m4 index 775b9de966..c3610fdaf6 100644 --- a/graphics/circuit_macros/examples/svg/PushPullSVG.m4 +++ b/graphics/circuit_macros/examples/svg/PushPullSVG.m4 @@ -1,6 +1,6 @@ .PS # `PushPullSVG.m4' -cct_init(svg_font(sans-serif,10bp__,1bp__)) +cct_init(svg_font(sans-serif,9bp__,1bp__)) linewid = 1.2*linewid diff --git a/graphics/circuit_macros/examples/svg/ResistorsSVG.m4 b/graphics/circuit_macros/examples/svg/ResistorsSVG.m4 new file mode 100644 index 0000000000..4fb0be47f0 --- /dev/null +++ b/graphics/circuit_macros/examples/svg/ResistorsSVG.m4 @@ -0,0 +1,34 @@ +.PS +# `ResistorsSVG.m4' +cct_init(svg_font(sans-serif,11pt__)) +textwid = 1.5 +movewid = 2 pt__ +hm = 2.1 +vm = 0.28 + +hm = 2.05 +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)'" ljust " svg_equiv `ebox'" ljust} +} + move down vm; right_ +{ {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} +} + move down vm; right_ +{ {resistor(,,V) ; move ; "`resistor(,,V) '" 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} +} + + command "</g>" # end font +.PE diff --git a/graphics/circuit_macros/examples/svg/ShiftRSVG.m4 b/graphics/circuit_macros/examples/svg/ShiftRSVG.m4 index 9a0b56d523..de8e13843e 100644 --- a/graphics/circuit_macros/examples/svg/ShiftRSVG.m4 +++ b/graphics/circuit_macros/examples/svg/ShiftRSVG.m4 @@ -6,9 +6,7 @@ textoffset = textht/6 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 textht with .end at 2nd last ""+(-textoffset,0.4*textht)))') + :S;NE:CK;:R, N:PR, :Q;;ifelse(`$1',1,:svg_ol(Q)), N:CLR,,)') F0: customFF(1) @@ -21,8 +19,7 @@ define(`customFF',`FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,, 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" wid 33bp__ at NCLR.start rjust - line left last "".wid with .c at last "".n+(0,1.5bp__) + "svg_ol(CLEAR)" wid 33bp__ at NCLR.start rjust CLK: NOT_gate(right T.x-Serial.x from NCLR.start+(0,-BUF_ht*3/2*L_unit)) "CLOCK" at CLK.start rjust diff --git a/graphics/circuit_macros/examples/svg/TTLnandSVG.m4 b/graphics/circuit_macros/examples/svg/TTLnandSVG.m4 index e1d7d4dae1..7b27077866 100644 --- a/graphics/circuit_macros/examples/svg/TTLnandSVG.m4 +++ b/graphics/circuit_macros/examples/svg/TTLnandSVG.m4 @@ -48,8 +48,7 @@ Vcc:dot; "+5 svg_norm(V)" ljust at last [].e 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) + "svg_it(Z = svg_ol(X1 . X2 . X3))" wid lw ljust command "</g>" # end font .PE diff --git a/graphics/circuit_macros/examples/svg/UNO.m4 b/graphics/circuit_macros/examples/svg/UNO.m4 deleted file mode 100644 index 60689f15ec..0000000000 --- a/graphics/circuit_macros/examples/svg/UNO.m4 +++ /dev/null @@ -1,265 +0,0 @@ -.PS -# UNOSVG.m4 -log_init -include(../ics.m4) -textoffset = 1.5bp__ -svg_font(sans-serif,9.0bp__,textoffset) - -divert(-1) - - `Header([1|2][A],rows,wid,ht,type) - arg1: number of columns; A= type A - arg2: pins per column - arg3,4: custom wid, ht - arg5: eg fill_(0.9)' -define(`Header', -`[ define(`m4tp',ifinstr(`$1',A,A))define(`m4Hq',patsubst(`$1',A))dnl - define(`m4Hn',`ifelse(m4Hq,,1,m4Hq)')dnl - define(`m4Hm',`ifelse(`$2',,2,`$2')')dnl - define(`m4Hw',`ifelse(`$3',,`m4Hn*L_unit*3',`($3)')')dnl - define(`m4Hh',`ifelse(`$4',,`m4Hm*L_unit*3',`($4)')')dnl - Block: rotbox(m4Hw,m4Hh,`$5') - ifelse(`m4tp',A,`pushdef(`L_unit',(linewid/6))') - define(`m4Hct',1)dnl - for_(1,m4Hm,1, - `HeaderPin(Block.NW+vec_(L_unit*3/2,-(m4x-1/2)*m4Hh/m4Hm), - eval(m4Hct-1), P`'m4Hct,w) define(`m4Hct',incr(m4Hct)) - ifelse(m4Hn,2,`HeaderPin(Block.NE+vec_(-L_unit*3/2,-(m4x-1/2)*m4Hh/m4Hm), - 1, P`'m4Hct,e) define(`m4Hct',incr(m4Hct))') ') - ifelse(`m4Hq',A,`popdef(`L_unit')') - `$6' ]') - `HeaderPin(location,type,Picname, - n|e|s|w,[length][;pinsize]) - arg2: 0= square' -define(`HeaderPin', - `ifinstr(`$5',;, - `stacksplit_(`m4Hdr',`$5',;)dnl - define(`m4Hps',ifelse(m4Hdr,,`L_unit',m4Hdr))popdef(`m4Hdr')dnl - define(`m4Hpl',ifelse(m4Hdr,,`lg_plen*L_unit',m4Hdr))popdef(`m4Hdr') ', - `define(`m4Hps',L_unit)dnl - define(`m4Hpl',`ifelse(`$5',,lg_plen*L_unit,`$5')')')dnl - ifelse(`$1',,,`move to `$1';') - ifelse(`$3',,,`$3':) line to ifelse( - `$4',n,`rvec_(0,m4Hpl)', `$4',e,`rvec_(m4Hpl,0)', - `$4',s,`rvec_(0,-m4Hpl)', `rvec_(-m4Hpl,0)') - ifelse(`$3',,,Pin`$3':) ifelse(ifelse(`$2',,0,`$2'),0, - `rotbox(m4Hps,m4Hps,fill_(1))', - `circle diam m4Hps fill_(1)') at last line.start ') - -define(`brdge',`eleminit_(`$1') - define(`m4h',ifelse(`$2',,`sourcerad_',`($2)/2'))dnl - { line to rvec_(rp_len/2-m4h/2,0) - move to rvec_(m4h/2,0) - for m4ng=75 to 255 by 180 do {{ - m4fshade(0, arc cw from rvec_(Rect_(m4h/2,m4ng)) \ - to rvec_(Rect_(m4h/2,-m4ng)) \ - with .c at Here ) }} - line from rvec_(m4h/2,0) to rvec_(rp_len/2,0) } - { [box invis ht_ m4h wid_ m4h] at rvec_(rp_len/2,0) } - line to rvec_(rp_len,0) invis ') - -define(`ATMEGA16U2',`[ - Chip: box wid 10*lg_pinsep ht 25*lg_pinsep - Loopover_(`x', - `Arightpin(patsubst(x,;,`,'))', - 6;PD0, 7;PD1, 8;PD2, 9;PD3, 10;PD4, 11;PD5, 12;PD6, 13;PD7, - 131;nul, - 5;PC2, 26;PC4, 25;PC5, 23;PC6, 22;PC7, - 132;nul, - 133;nul, - 14;PB0, 15;PB1, 16;PB2, 17;PB3, 18;PB4, 19;PB5, 20;PB6, 21;PB7) - Loopover_(`x', - `Aleftpin(patsubst(x,;,`,'))', - 33;PAD, - 100;nul, - 28;UGND, 29;D`'svg_it(+), 30;D`'svg_it(-), 31;UVCC, 27;UCAP, - 101;nul, 102;nul, - 3;GND, 4;VCC, 103;nul, - 104;nul, - 32;AVCC, - 105;nul, 106;nul, - 1;XTAL1, - 107;nul, - 2;XTAL2(PC0), - 108;nul, 109;nul) - lg_pin(Pin109+(0,lg_pinsep),RESET,Pin24,wN,24,pinlen) - ]') -define(`Aleftpin',`move to Chip.sw+(0,m4Lx*lg_pinsep) - Pin`$1': ifelse(`$2',nul,Here,dnl - `line left pinlen "`$1'" above - "`$2'" ljust at last line.start')') -define(`Arightpin',`move to Chip.se+(0,m4Lx*lg_pinsep) - Pin`$1': ifelse(`$2',nul,Here,dnl - `line right pinlen "`$1'" above - "`$2'" rjust at last line.start')') - -define(`ATMEGA328P',`[ - Chip: box wid 10*lg_pinsep ht 23*lg_pinsep - Loopover_(`x', - `Arightpin(patsubst(x,;,`,'))', - 2;PD0, 3;PD1, 4;PD2, 5;PD3, 6;PD4, 11;PD5, 12;PD6, 13;PD7, - 100;nul, - 23;PC0, 24;PC1, 25;PC2, 26;PC3, 27;PC4, 28;PC5, - 101;nul, - 14;PB0, 15;PB1, 16;PB2, 17;PB3, 18;PB4, 19;PB5) - Loopover_(`x', - `Aleftpin(patsubst(x,;,`,'))', - 201;nul, 202;nul, 203;nul, 204;nul, 205;nul, 206;nul, 207;nul, 208;nul, - 209;nul, - 8;GND, 7;VCC, - 301;nul, - 22;AGND, 20;AVCC, 21;AREF, - 302;nul, - 9;XTAL1, - 303;nul, - 9;XTAL2, - 304;nul, 305;nul) - lg_pin(Pin305+(0,lg_pinsep),RESET,Pin1,wN,1,pinlen) - ]') - -divert(0)dnl - - maxpswid = 20 - maxpsht = 20 - - define(`pinlen',`30bp__') - define(`lg_pinsep',(1.2*lg_pinsep)) - del = lg_pinsep - - U3: ATMEGA16U2 - `"ATMEGA16U2-MU(R)"' at U3.Chip.s below - `"U3"' at U3.Chip.nw ljust above - ZU4: ATMEGA328P with .Chip.nw at U3.Chip.sw+(0,-1) - `"ATMEGA328P-PU"' at ZU4.Chip.s below - `"ZU4"' at ZU4.Chip.nw ljust above - - dot(at U3.Pin2.end) - R1: resistor(down_ 2*lg_pinsep,,E) - rlabel(,"R1" rjust "1M" rjust) - dot - dot(at R1.start-(2*del,0)) - xtal(down_ 2*lg_pinsep) - rlabel(16,,MHz); dot - XT2: dot(at last line.start-(2*del,0)); { "XT2" at last [].n above } - - Br1: brdge(from U3.Pin33.end to (XT2,U3.Pin33)); BRE: dot - line to (Here,U3.Pin28) then to U3.Pin28.end - {"UGND" at (Br1,Here) above} - - XT1: dot(at XT2-(del,R1.len)); { "XT1" at last [].n above } - line from XT1 to U3.Pin1.end - line from U3.Pin2.end to (XT1,XT2) - C11: capacitor(left_ 3*del); rlabel(,C11); llabel(,22pF) - C9: capacitor(from XT1 to (Here,XT1)); {"C9" "22pF" at last [].s+(0,-11bp__)} - { line to C11.end } - dot - G1: ground(,,E); { "GND" at last line.c below } - line from XT1 down_ 3*del; continue to (G1,Here); dot(,,1) - {"XT3" at last [].n above} - dot(at Here+(0,-3/2*del),,1); {"XT4" at last [].n above} - { line to (XT2,Here) then to XT2 chop dotrad_ chop 0 } - USBVCC: dot(at Here+(0,-7/2*del),,1) - {"USBVCC" at last [].n-(3/2*del,0) above ljust} - { line to (Here,U3.Pin31) chop dotrad_ chop 0; continue to U3.Pin31.end } - dot(at Here+(2*del,0),,1); {"VUCAP" at last [].e+(0,-5bp__) ljust} - line to (Here,U3.Pin27) chop dotrad_ chop 0; dot - line from U3.Pin27.end to (G1.x-4.5*del,U3.Pin27.y) - C8: capacitor(down_ to (Here,Br1)); llabel(C8,,1`'svg_micro) - Bus1: dot - - dot(at U3.Pin33.end) - move to U3.Pin3.end; line to (Here,U3.Chip.s) - G2: ground(,T,E); {"GND" at last line.c below } - - dot(at U3.Pin32.end) - {line to U3.Pin4.end; dot} - line left del; ground(,,E,U); {"svg_it(+)5V" at last line.c above} - - G3: ground(at (C8.x-del,G2.y),T,E); {"GND" at last line.c below } - capacitor(up_ to (Here,C8.start)); { llabel(100n,,C7) } - line to (Here,U3.Pin4) then to U3.Pin4.end - - line from U3.Pin30.end to (G1.x-2*del,U3.Pin30.y); continue to (Here,U3.Pin1) - { "RD`'svg_it(-)" above rjust }; continue left_ 2*del - RN3A: resistor(left_ 3/2*dimen_,,E); rlabel(,22R RN3A) - Dm: line left_ 7*del - -USB: [ K: box invis wid dimen_/2 ht 5*lg_pinsep - "USB" rjust at K.e - line thick 1.5 from K.nw to K.ne then to K.se then to K.sw - Loopover_(`x', - `Pin`'m4Lx: K.ne-(0,m4Lx/5*K.ht) - "x" at Pin`'m4Lx ljust above', - 1 XUSB, 2 D`'svg_it(-), 3 D`'svg_it(+), 4 UGND) - P_1: K.sw; {"P$`1'" at P_1 below rjust} - P_2: K.s; {"P$`2'" at P_2 below ljust} - ] with .Pin2 at Here; "X2" at USB.ne above rjust - - move to U3.Pin29.end - line to (G1.x-3*del,Here.y); continue to (Here,Dm-(0,lg_pinsep)) - { "RD`'svg_it(+)" above rjust} - continue to (RN3A.start,Here) - RN3D: resistor(left_ 3/2*dimen_,,E); llabel(,22R RN3D) - line to USB.Pin3 - - dot(at RN3A.end); line to (Here,RN3D) - Z2: variable(`resistor(down_ to (Here,U3.Pin27),,E); rlabel(Z2)',NN) - dot(at RN3D.end-(2*del,0)) - Z1: variable(`resistor(to (Here,U3.Pin27),,E); rlabel(Z1)',NN) - dot; line to (Z2,Here) - move up Z1.len/4 from last line.c; "CG0603MLC-05E" "X 2" - - line down_ del from USB.P_1; continue to (USB.P_2,Here); dot - line from USB.P_2 to (USB.P_2,Z1.end) then to Z1.end - dot(at (USB.P_2,Here)+(3/2*del,0)); line to (Here,USBVCC) - dot(,,1); {"USHIELD" at last [].n+(4bp__,0) above} - - L1: reversed(`inductor',down_ from Z1.end to (Z1,C8.end),W,,M) - rlabel(L1); llabel( BLM21); dot - { dot(at (Z2,Here)); line to (Here,U3.Pin28); dot(,,1) - "UGND" at last [].n above } - line from USB.Pin1 to (Z2,USB.Pin1) then up 2*del - XUSB: dot(,,1); {"XUSB" at last [].n above} - line from (Z1,USB.Pin3) to (Z1,XUSB); - DP: dot(,,1); {"D`'svg_it(+)" at last [].n above} - dot(at (DP,USB.Pin2)-(2*del,0)); line to (Here,XUSB) - DM: dot(,,1); "D`'svg_it(-)" at last [].n above - line from USB.Pin4 to (DM,USB.Pin4) then to (DM,BRE) then to BRE - - dot(at (U3.Chip.w.x-3*lg_pinsep,U3.Pin24.y)) - D3: diode(up_ 7*lg_pinsep); llabel(,,D3) - dot(at (D3.start-(2*del,0))) - RN1C: resistor(up_ D3.len,,E); llabel(,10K); llabel(RN1C); dot - line from D3.end to (Here.x-2*del,Here.y) - right_ - ICSP1: Header(2A,3,4*del,3*lg_pinsep) with .P2.end at Here - "ICSP1" at last [].Block.nw above ljust - "3X2 M" at last [].Block.sw below ljust - for_(1,5,2,`"m4x" at ICSP1.P`'m4x.end above ljust') - for_(2,6,2,`"m4x" at ICSP1.P`'m4x.end above rjust') - - dot(at ICSP1.P2.end+(del/2,0)); line up_ 2*del - G5: ground(,T,E); "svg_it(+)5V" above - ground(at (G5,ICSP1.P6),,E); {"GND" at last line.w below rjust} - {line to ICSP1.P6.end} - R2: dot(at ICSP1.P5.end-(lg_pinsep/2,0)); {line to ICSP1.P5.end} - { line to (Here,G5); dot(,,1); "RESET2" at last [].n above } - line to (R2,U3.Pin24) then to U3.Pin24.end - line from ICSP1.P4.end to (U3.Pin24.end,ICSP1.P4); dot - { line to (Here,G5); dot(,,1); "MOSI2" at last [].n above } - Turn: (U3.Pin21.end.x+4*lg_pinsep,Here.y) - line to (Turn,Here) then down Here.y-U3.Pin16.y then to U3.Pin16.end - line from ICSP1.P3.end to (R2.x-lg_pinsep,ICSP1.P3.y) \ - then down R2.y-U3.Pin24.y - continue to (D3.x+2*del,Here.y) then up ICSP1.P4.y-Here.y-2*lg_pinsep - continue to (Turn.x-2*lg_pinsep,Here.y) then down Here.y-U3.Pin15.y \ - then to U3.Pin15 - move to ICSP1.P1.end; line left Here.x-R2.x+2*lg_pinsep; dot - { line to (Here,G5); dot(,,1); "MISO2" at last [].n above rjust } - line down Here.y-U3.Pin24.y-2*lg_pinsep - continue to (D3.x+del,Here.y) then up ICSP1.P4.y-Here.y-lg_pinsep - continue to (Turn.x-lg_pinsep,Here.y) then down Here.y-U3.Pin17.y \ - then to U3.Pin17 - - command "</g>" -.PE diff --git a/graphics/circuit_macros/examples/svg/UNOSVG.m4 b/graphics/circuit_macros/examples/svg/UNOSVG.m4 index 8ae314f1af..8c1ba33248 100644 --- a/graphics/circuit_macros/examples/svg/UNOSVG.m4 +++ b/graphics/circuit_macros/examples/svg/UNOSVG.m4 @@ -507,8 +507,8 @@ Pwr: [ "LP2985-33DBVR" at U2.s below "U2" above ljust at U2.nw "3" above rjust at U2.w; line left del from U2.w then up_ lg_pinsep; dot - "ON/OFF" at U2.w ljust - line right_ textht*0.66*3 from U2.w+(textht*0.66*5,textht) + "ON/svg_ol(OFF)" at U2.w ljust +# line right_ textht*0.66*3 from U2.w+(textht*0.66*5,textht) U2P2: U2.w+(0,-lg_pinsep); "2" at U2P2 above rjust; "GND" at U2P2 ljust line from U2P2 left del then down_ del G15: ground(,T,E); "GND" at last line.c below diff --git a/graphics/circuit_macros/examples/svg/WindingsSVG.m4 b/graphics/circuit_macros/examples/svg/WindingsSVG.m4 index 0ead17d87f..e4faa89b5c 100644 --- a/graphics/circuit_macros/examples/svg/WindingsSVG.m4 +++ b/graphics/circuit_macros/examples/svg/WindingsSVG.m4 @@ -1,6 +1,6 @@ .PS # Windings.m4 -cct_init(svg_font(sans-serif,11bp__)) +cct_init(svg_font(sans-serif,10bp__)) textoffset = 3bp__ define(`vlight',`rgbstring(0.9,0.9,0.9)') diff --git a/graphics/circuit_macros/examples/svg/controlSVG.m4 b/graphics/circuit_macros/examples/svg/controlSVG.m4 index 53db5c6312..ab2eea7efc 100644 --- a/graphics/circuit_macros/examples/svg/controlSVG.m4 +++ b/graphics/circuit_macros/examples/svg/controlSVG.m4 @@ -1,97 +1,224 @@ .PS -# control.m4 -#.PS 5i -cct_init(svg_font(sans-serif,11bp__)) +# controlSVG.m4 +gen_init(svg_font(Times,11bp__)) linewid = linewid*0.8 - circlerad = 0.35/2 + circlerad = 0.25/2 bw = boxwid/2 bh = boxht/2 + maxpsht = 15 + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # + 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 ; 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 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 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__) + "svg_it(-)" rjust at Here+(-2bp__,-2bp__) +] + "(a) svg_it(PID) control" below ljust at PID.sw+(0,-5pt__) + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # + +# https://tex.stackexchange.com/questions/575592/how-to-create-a-controls-system-diagram +Observer: [ + define(`thickarrow',`arrow thick 3 wid 7bp__') + define(`thickline',`line thick 3') + fillval = 0.6 + boxwid = 0.3 + boxht = 0.4 + circlerad = 0.1 + {"svg_it(r)" above ljust} +R: arrow +S: circle fill + {"svg_thinsp`'svg_it(-)" below ljust at S.s + "svg_it(+)" above rjust at S.w+(2bp__,0)} +{ PLT: box invis fill 0.9 wid 3.1 ht 1.2 with .nw at Here+(0.3,boxht*3/4) + "svg_it(Plant)" at PLT.sw above ljust } +U: arrow right 0.4 + {"svg_it(u)" at last arrow+(2bp__,0) above } +Bp: box fill "svg_it(B)" + thickarrow right 0.4 +Sp: circle fill + {"svg_thinsp`'svg_it(+)" below ljust at Sp.s + "+" above rjust at Sp.w+(2bp__,2bp__)} + thickarrow right 0.4 + {"svg_bf(x)" at last arrow + (0,7bp__); "." at last "".n +(0,textoffset)} +Ip: box fill "svg_it(I/s)" + thickarrow right 1 + {"svg_bf(x)" at last arrow + (0,7bp__) } +Cp: box fill "svg_it(C)" +# print Cp.e.x - Bp.w.x + 0.2 + thickline right 0.4 +Yp: thickarrow + {"svg_bf(y)" at last arrow + (0,7bp__) } +Ap: box fill "svg_it(A)" with .n at Ip.s+(0,-boxht/2) + thickarrow <- from Ap.e right 0.4 then up Ip.y-Ap.y + thickarrow from Ap.w to (Sp,Ap) then to Sp.s +# print PLT.n.y-Ap.s.y+0.1 +# +K: box fill "svg_it(K)" at Ap + (0,-boxht*3/2) + arrow from K.w to (S,K) then to S.s + {OBS: box invis fill 0.9 wid 4.3 ht 1.8 with .nw at (S.w,K.s)-(0.1,0.1) + "svg_it(Observer)" at OBS.sw ljust above } +Io: box fill "svg_it(I/s)" at K + (0,-boxht*3/2) + thickarrow <- from Io.w left 0.4 + {"svg_bf(x)" at last arrow + (0,7bp__); "svg_circ" at last "" + "." at last "".n above} +Sxo: circle fill + {"svg_thinsp`'svg_it(+)" below ljust at Sxo.s + "svg_it(+)" above rjust at Sxo.w+(2bp__,2bp__)} + thickarrow <- left 0.4 +SLo: circle fill + {"svg_thinsp`'svg_it(+)" below ljust at SLo.s + "svg_it(+)" above rjust at SLo.w+(2bp__,2bp__)} + thickarrow <- left 0.4 +Bo: box fill "svg_it(B)" + arrow from 1/4 between U.start and U.end up boxht*3/4 \ + then left 2*boxht then down Bp.y-Bo.y+boxht*3/4 then to Bo.w +Ao: box fill "svg_it(A)" with .n at Io.s+(0,-boxht/2) + thickline from Io.e right 0.4 + {thickarrow <-> from K.e to (Here,K.e) then to (Here,Ao) then to Ao.e + thickarrow from Ao.w to (Sxo,Ao.w) then to Sxo.s } +Xhat: Here +Co: box fill "svg_it(C)" at (Cp,Here) + thickarrow right 0.4 + {"svg_bf(y)" at last arrow + (0,7bp__); "svg_circ" at last ""} + { thickarrow from Xhat to Co.w } + {"svg_it(x)" at last arrow + (0,7bp__); "svg_circ" at last "" } +Syo: circle fill + {"svg_it(+)" above ljust at Syo.n + "svg_it(-)" above rjust at Syo.w+(2bp__,2bp__)} + thickarrow <- from Syo.n to (Syo,Cp) +Lo: box fill "svg_it(L)" with .n at Ao.s+(0,-boxht/2) +# print Io.n.y+0.1 - (Lo.s.y-0.1) + thickarrow from Syo.s down Syo.s.y-Lo.y then to Lo.e + thickarrow from Lo.w to (SLo,Lo.w) then to SLo.s + ] with .nw at last [].sw+(0,-0.5) -Obs: [ {"svg_it(r)" above ljust} +Eqns: [ {"svg_it(r)" above ljust} + ex = textht*2/3 + define(`DDt',`svg_frac(svg_it(d):1*ex,svg_it(dt):2*ex)') arrow S: circle - "-" below rjust at S.s + "svg_it(-)" 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 + line right linewid + {"svg_hat(svg_bf(x))" at last line.c above } +Obs:box wid linewid*5 ht boxht*5/4 + [ DDt; "svg_hat(svg_bf(x)) svg_it(= (A-LC)) svg_hat(svg_bf(x)) + svg_it(+ Bu + L)svg_bf(y)" wid 1.5 ljust ] at Obs + "svg_it(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 +Plant: box wid boxwid*3/2 ht boxht*5/4 + [ DDt; "svg_bf(x) svg_it(= A) svg_bf(x) svg_it(+ Bu)" wid 0.8 ljust + "svg_bf(y) svg_it( = C) svg_bf(x)" wid 0.6 ljust \ + at last "".w + (0,-textht*2) ] at Plant+(0,0.05) + "svg_it(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__) + ] with .nw at last [].sw+(0,-0.1) + "(b) Plant with feedback from a full-order observer" \ + below ljust at Eqns.sw+(0,-5pt__) + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # + +Multiblock: [ +boxht = 0.4 +boxwid = boxht + +define summer { circle + {line from last circle.nw to last circle.se + line from last circle.sw to last circle.ne + "svg_it($1)" at 0.6 between last circle and last circle.n + "svg_it($2)" at 0.6 between last circle and last circle.s + "svg_it($3)" at 0.6 between last circle and last circle.e + "svg_it($4)" at 0.6 between last circle and last circle.w } +} -NL: [boxwid = boxwid*1.8 - boxht = boxht*3/2 + arrow "svg_it(E`'svg_sub(1))" above +S1: summer(,-,,+) + linewid = boxwid/2 + arrow "svg_epsilon" above + [box "svg_it(H)svg_sub(1)"; arrow; box "svg_it(H)svg_sub(2)"] + arrow +S2: summer(-,,,+) + arrow +T: [box "svg_it(H)svg_sub(3)"; arrow; box "svg_it(H)svg_sub(4)"] + line +Y: Here + arrow + "svg_it(S)svg_sub(1)" above +R1: box "svg_it(R)svg_sub(1)" at (T.x,T.y+boxht*3/2) + arrow from Y to (Y,R1) then to R1.e + arrow from R1.w to (S2,R1) then to S2.n + "svg_it(n)svg_sub(1)" ljust at S2.n+(0,boxht/2) + left +Rf: [box "svg_it(R)svg_sub(2)"; arrow; box "svg_it(R)svg_sub(3)"] \ + at ((S1.x+T.x)/2,T.y-boxht*3/2) + arrow from T to (T,Rf) then to Rf.e + arrow from Rf.w to (S1,Rf) then to S1.s + "svg_it(n)svg_sub(2)" at S1.s+(0,-boxht/2) ljust +] with .nw at Eqns.sw + (0,-0.3) + "(c) A multiblock example" below ljust at Multiblock.sw+(0,-5pt__) + +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # + +Nonlinear: [boxwid = boxwid*3/2; 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 + boxwid = boxwid*0.6 + boxht = boxht/2 +R: box "reference" "svg_it(R)" + arrow right linewid*4/3 + {"svg_it(y)svg_sub(c)[ref]" at last arrow+(0,textht/3) above } +Gh: box "\"i`'nverse\"" "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 + box "stabilizer" "svg_it(K)" + arrow "svg_delta`'u" above D: circle - line from Gh.e to (D,Gh.e) "svg_it(u`'svg_sub(ref))" above + line from Gh.e to (D,Gh.e) "svg_it(u)[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 + 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)" wid 0.2 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) + "svg_it(-)" rjust below 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__) +] with .nw at last [].sw + (0,-0.3) + "(d) Nonlinear feedforward (for performance) and small-signal feedback + (for stability)" below ljust at Nonlinear.sw+(0,-5pt__) - command "</g>" # end font +#print PID.n.y - Nonlinear.s.y +command "</g>" .PE diff --git a/graphics/circuit_macros/examples/svg/cscSVG.m4 b/graphics/circuit_macros/examples/svg/cscSVG.m4 index 375881b471..afc633403f 100644 --- a/graphics/circuit_macros/examples/svg/cscSVG.m4 +++ b/graphics/circuit_macros/examples/svg/cscSVG.m4 @@ -1,10 +1,12 @@ -.PS 3.5 +.PS +#.PS 3.5 # csc.m4 gen_init -circlerad=1.91*scale -hubrad=0.10 -s=0.5 +skale = 3.5/3.97*0.9955 +circlerad=1.91*skale +hubrad=0.10*skale +s=0.5*skale define(`midnight',`26,26,112') define(`white',`255,255,255') @@ -16,7 +18,7 @@ define(`lwid',1) define(`coord',`(s*(`$1'),s*(`$2'))') # Circle and spokes -# [ +CSC: [ rgbdraw(midnight, linethick=`0.'eval(lwid*15)/(1pt__) {circle with .c at Here @@ -74,6 +76,167 @@ resetrgb resetrgb linethick=`0.'eval(lwid*15)/(1pt__) -# ] with .sw at 1,1 + ] +Clock: [ +#.PS +# AntiqueClockSVG.m4 +#gen_init +svg_font(font-family="sans-serif" font-stretch="condensed") + +# https://tex.stackexchange.com/questions/236923/generate-analog-clock-with-numbered-face-add-seconds-roman-numerals + +#svg_rot_init(AntiqueClockSVG) +#svg_rot_init(test) +svg_rot_init(cscSVG) + +# `hms2deg(hr,min,sec) hr:min:sec to degrees +# blank arg1: degrees for minute hand +# blank arg1 and arg2: degrees for second hand' +define(`hms2deg',`ifelse(`$1',, + `ifelse(`$2',, + `(90-pmod(ifelse(`$3',,0,`$3'),60)/60*360)', + `(90-(pmod(`$2',60)/60 + pmod(ifelse(`$3',,0,`$3'),60)/60/60)*360)')', + `(90-(pmod(`$1',12) + pmod(ifelse(`$2',,0,`$2'),60)/60 + dnl + pmod(ifelse(`$3',,0,`$3'),60)/3600)/12*360)')') + +# `SecondHand(length,hr,min,sec)' +define(`SecondHand',`[ shsf = (`$1')/3.2 + C: Here + { L: rpoint_(to (Rect_(`$1',hms2deg(,,`$4')))) } + line thick 8*shsf to rvec_(`$1',0) + ]') + +# `AntiqueMinuteHand(length,hr,min,sec)' +define(`AntiqueMinuteHand',`[ mhsf = (`$1')/2.84 + L: rpoint_(to (Rect_(`$1',hms2deg(,`$3',`$4')))) + C: circle fill_(0) diam 0.47*mhsf at L.start + move to C + spline from rvec_(0,0.047*mhsf) \ + to rvec_(1.65*mhsf,0.11*mhsf) \ + then to rvec_(`$1',0.018*mhsf) \ + then to rvec_(`$1',-0.018*mhsf) \ + then to rvec_(1.65*mhsf,-0.11*mhsf) \ + then to rvec_(0,-0.047*mhsf) \ + shaded rgbstring(0,0,0) + ]') + +# `AntiqueHourHand(length,hr,min,sec)' +define(`AntiqueHourHand',`[ hhsf = (`$1')/2.2 + L: rpoint_(to (Rect_(`$1',hms2deg(`$2',`$3',`$4')))) + C: circle fill_(0) diam 0.6*hhsf at L.start + move to C + v = 0.25*hhsf + { line to rvec_(1.1*hhsf,0) thick 0.15/(1bp__)*hhsf } + C1: rvec_(1.25*hhsf,0) + d = `$1'-1.25*hhsf + q = 1bp__*hhsf + r1 = (d^2 + q^2 - v^2)/(v-q)/2 + tang = atan2((r1+q),d) + for i=0 to 3 do { + X[i]: C1+vec_(rect_(v, pi_+i/3*( tang-pi_))) + Y[i]: C1+vec_(rect_(v,-pi_+i/3*(-tang+pi_))) + } + n = 3 + for i=1 to 4 do { aa = -pi_+tang + i/4*(pi_/2-tang) + XX: (d,r1+q)+(rect_(r1,aa)) + n+=1; + X[n]: C1+vec_(XX.x, XX.y) + Y[n]: C1+vec_(XX.x,-XX.y) + } + m = n + for i= 0 to m do { n+=1; X[n]: Y[m-i] } + fitcurve(X,n,shaded rgbstring(0,0,0)) + ]') + +define(`AntiqueClock',`[ # h,m,s,diam +# Clock size parameters: + hour = ifelse(`$1',,3,`$1') + minute = ifelse(`$2',,41,`$2') + second = ifelse(`$3',,51,`$3') + # outer radius + ifelse(`$4',,`skale=0.5; r1=2',`r1=(`$4')/2; skale=r1/4') + r2 = r1 - 0.5*skale + r3 = r2 - 0.14*skale + r4 = r3 - 0.35*skale + r5 = r4 - 0.17*skale + r6 = r5 - 0.63*skale + r7 = r6 - 0.17*skale + shadelinethick = 1.0 + +C: circle thick 0.2 rad r1 + +define shadeline { + s = 1-($`'1)*2 + v = r*s + h = sqrt(r^2-v^2) + t = 1-abs(s) + line from (vrot_(-h,v,cost,sint)) to (vrot_(h,v,cost,sint)) \ + thick shadelinethick outlined rgbstring(t,t,t) + } + + r = r1 # Bezel outer + nlines = int(2*r/(shadelinethick pt__)*1.1) + cost = cosd(10); sint = sind(10); + ShadeObject(shadeline,nlines, 0, 0,0,0, 0.5, 1,1,1, 1, 0,0,0 ) at C + + r = r2 # Bezel inner + nlines = int(2*r/(shadelinethick pt__)*1.1) + cost = cosd(-10); sint = sind(-10); + ShadeObject(shadeline,nlines, 0, 0,0,0, 0.25, 0.8,0.8,0.8, 0.5, 1,1,1, + 0.75, 0.8,0.8,0.8, 1, 0,0,0 ) at C + +# Clock face +Face: circle thick 0 fill_(1) rad r3 at C + circle rad r4 at C + circle rad r5 at C + circle rad r6 at C + circle rad r7 at C +# Ad hoc shift of rotated SVG text + define adj { (-cosd($`'1)*textht*0.5*sign(180-($`'1)),\ + (0.25+0.25*cosd(2*($`'1)))*textht) } +# Outer numbers + textht = (r3-r4)*0.6 + for mn = -15 to 15 by 5 do { t = 90-mn/60*360 + R:(Rect_((r3+r4)/2,t)) + svg_rot(-mn/60*360,sprintf("%g",pmod(mn,60)) at C+R+adj(t)) + } + for mn = 20 to 40 by 5 do { t = 450-mn/60*360 + R: (Rect_((r3+r4)/2,t)) + svg_rot(180-mn/60*360, sprintf("%g",pmod(mn,60)) at C+R+adj(t)) + } +# Outer tics + for mn = 1 to 60 do { t = 90-mn/60*360 + line from C+(Rect_(r5,t)) to C+(Rect_(r4,t)) } + +# Inner numbers + textht = (r5-r6)*0.6 + Loopover_(`mx',`tt = 90-(m4Lx-4)/12*360 + R: (Rect_((r5+r6)/2,tt)) + svg_rot(tt-90, "mx" at C+R+adj(tt)) ', + IX,X,XI,XII,I,II,III) + Loopover_(`mx',`tt = 360-m4Lx*30 + R: (Rect_((r5+r6)/2,tt)) + svg_rot(tt-270, "mx" at C+R+adj(tt)) ', + IV,V,VI,VII,VIII) + +# Inner tics + for mn = 5 to 60 by 5 do { t = 90-mn/60*360 + line from C+(Rect_(r7,t)) to C+(Rect_(r6,t)) } + +# Hands + AntiqueHourHand(r6,hour,minute,second) with .C at C + AntiqueMinuteHand(r5,hour,minute,second) with .C at C + SecondHand((r3+r4)/2,hour,minute,second) with .C at C + +# Center + dot(at C,0.1/4*r1,1) + ]') + + Clock1: AntiqueClock(,,,3.5) +# Clock2: AntiqueClock(4,48,07,2) at Clock1.e+(1.5,0) + + command "</g>" # end font +#.PE + ] with .sw at last [].se+(0.25,0) .PE diff --git a/graphics/circuit_macros/examples/svg/ex21SVG.m4 b/graphics/circuit_macros/examples/svg/ex21SVG.m4 index 785c13361e..b9aa8ac18d 100644 --- a/graphics/circuit_macros/examples/svg/ex21SVG.m4 +++ b/graphics/circuit_macros/examples/svg/ex21SVG.m4 @@ -7,13 +7,9 @@ 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 @@ -21,7 +17,6 @@ JK: FlipFlop(JK) with .Chip.sw at last [].se + (0.4,0) # 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') diff --git a/graphics/circuit_macros/examples/svg/examplesSVG.htmx b/graphics/circuit_macros/examples/svg/examplesSVG.htmx index 8bec348222..22ab9f9c42 100644 --- a/graphics/circuit_macros/examples/svg/examplesSVG.htmx +++ b/graphics/circuit_macros/examples/svg/examplesSVG.htmx @@ -154,6 +154,7 @@ There are a number of other issues: e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%",XYZ)</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_sf(</g>text`'m4tt)</g>: sans-serif (Helvetica) <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>: @@ -162,8 +163,13 @@ There are a number of other issues: 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_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 <li>m4tt svg_rot(</g>degrees, "text" [at position]`'m4tt)</g>: Rotate text degrees (default 90) ccw. Requires m4tt`'svg_rot_init(</g>filename`'m4tt)</g> and the source @@ -184,6 +190,8 @@ There are a number of other issues: <!-- Reference: https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references + and + https://www.toptal.com/designers/htmlarrows/math/ --> <hr width="100%" align="left"> <table cellpadding="2" cellspacing="0" width="75%" > @@ -292,8 +300,17 @@ There are a number of other issues: <hr> -cfig(CctTableSVG, - Two-terminal elements, showing some variations) +cfig(ResistorsSVG, + Resistors, showing some variations) + +cfig(CapacitorsSVG, + Capacitors) + +cfig(InductorsSVG, + Inductors) + +cfig(MoreTableSVG, + Some other two-terminal elements) cfig(DiodesSVG, Diodes: a m4tt`'K</g> in the second argument draws an open @@ -361,7 +378,11 @@ cfig(HeadersSVG, The m4tt`'Header</g> macro) cfig(ConnectorsSVG, - Some connectors with simple geometry and lists of labels) + Some integrated circuits and connectors with simple geometry + and lists of labels) + +cfig(ChipsSVG, + IC outlines) cfig(fetSVG, FETs`,' showing programmable components and example customizations) @@ -547,6 +568,10 @@ cfig(ABlogixSVG, cfig(XORSVG, Realizations of the XOR function using m4tt`'Autologix</g>) +cfig(EEPSVG, + Part of a single-line diagram of a power distribution system + using draft elements) + cfig(paletteSVG, A draft palette of a few elements for Inkscape using a 1 mm grid) @@ -555,13 +580,14 @@ cfig(ex00SVG, Line diagrams) cfig(controlSVG, - Control-system block diagrams that do not require m4) + Control-system block diagrams) cfig(GrayCodeSVG, - Gray code 10-bit encoder disk pattern) + Gray code 10-bit encoder disk pattern`,' + and a crossbar switch) -cfig(CrossbarSVG, - A crossbar switch) +#cfig(CrossbarSVG, +# A crossbar switch) cfig(ByteSVG, Elementary splines) @@ -591,7 +617,7 @@ cfig(ex09SVG, specifies the arc to be dimensioned and the second argument is the outward radial offset of the dimension arrow arc.) -cfig(Y14-5SVG, +cfig(PlateSVG, Dimensioning with tolerances according to ASME Y14.5) Use of m4tt`'darrow</g> and m4tt`'Darc</g>) @@ -602,10 +628,10 @@ cfig(LoglogSVG, A graph drawn using the pic language) cfig(GeometrySVG, - A plane geometry example) + A plane geometry example`,' and an illustration of a Lyapunov function) -cfig(LyapSVG, - Illustrating a Lyapunov function) +#cfig(LyapSVG, +# Illustrating a Lyapunov function) cfig(randomSVG, Testing random numbers) @@ -622,21 +648,23 @@ cfig(graysurfSVG, cfig(shapesSVG, Basic shapes) -cfig(AntiqueClockSVG, - An antique clock face) +#fig(AntiqueClockSVG, +# An antique clock face) cfig(cscSVG, - Conestoga Sailing Club (illustrating the filling of arbitrary - shapes)) + Conestoga Sailing Club (illustrating the filling of arbitrary shapes)`,' + and an antique clock face with shading and rotated text) cfig(roseSVG, - Redrawn from a detail of the set design for the musical - <i>Dracula</i>`,' used for testing m4tt`'dpic</g>. This diagram + A window redrawn from a detail of the set design for the musical + <i>Dracula</i>`,' used for testing m4tt`'dpic</g>`,' + and an experimental halftone. This diagram consumes much LaTeX main memory but can be produced directly as pdf using m4tt`'dpic -d</g>`,' as svg using m4tt`'dpic -g</g>`,' or as postscript using m4tt`'dpic -r</g> - since no text formatting is required) + since no text formatting is required. The right object + adjusts the size of dots to produce a halftone effect) cfig(diamondSVG, Variations on M. Goossens`,' S. Rahtz`,' and F. Mittelbach`,' diff --git a/graphics/circuit_macros/examples/svg/expSVG.m4 b/graphics/circuit_macros/examples/svg/expSVG.m4 index deff7bae07..27209b094e 100644 --- a/graphics/circuit_macros/examples/svg/expSVG.m4 +++ b/graphics/circuit_macros/examples/svg/expSVG.m4 @@ -76,37 +76,37 @@ arad = 0.6*g define(`D3',`0.3*g,0.6*g,0.9*g') # fixed coordinate frame -O: project(O3) -X: project(X0) -Y: project(Y0) +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 + 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)) + 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 + 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 + 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 + 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)) + "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)) + "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)) + "svg_it(z`'svg_sub(1))" above at Project(R01(Z0)) thicklines_ # box object dimension @@ -116,23 +116,23 @@ 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) +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)))) +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 @@ -178,24 +178,24 @@ thicklines_ 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) + 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) + 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)))) +# 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,%" @@ -218,16 +218,16 @@ thicklines_ "svg_alpha" at 0.5<S,C> ljust define(`N3D',`0,0,2*alpha') # North pole - N: project(N3D) + 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 + 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) + 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 @@ -247,8 +247,8 @@ thinlines_ # axes 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)) + 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)) @@ -257,7 +257,7 @@ define(`ray',`sum3D(N3D,sprod3D($1,diff3D(Phat3D,N3D)))') $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 + P: "svg_it(P)" at Project(ray(p)) ljust above thicklines_ line dashed from N to P chop 0 chop 0.05 @@ -271,11 +271,11 @@ 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 } + 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 } + Q[n]: Project(sum3D(C3D,meridian(ang))); n+=1 } fitcurve(Q,n-1,dashed) define(`equator',`rot3Dz($1,alpha,0,0)') @@ -285,15 +285,15 @@ define(`equator',`rot3Dz($1,alpha,0,0)') 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 } + 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 } + 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))) + 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__) diff --git a/graphics/circuit_macros/examples/svg/fetSVG.m4 b/graphics/circuit_macros/examples/svg/fetSVG.m4 index 2393513219..8495eb9e94 100644 --- a/graphics/circuit_macros/examples/svg/fetSVG.m4 +++ b/graphics/circuit_macros/examples/svg/fetSVG.m4 @@ -1,13 +1,14 @@ .PS # `fetSVG.m4' cct_init(svg_font(Times,11bp__)) -dwn = 0.8 -rgt = 0.9 + +textht = 0.1 +define(`rmove',0.75) dnl `IRF4905(linespec,R)' define(`IRF4905', `[ ifelse(`$1',,,`eleminit_(`$1')') - Q: mosfet(,`$2',LdPzEDSQdB,) ifelse(`$1',,` + Q: mosfet(,`$2',dMdPzEDSQdB,) 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 @@ -15,138 +16,153 @@ define(`IRF4905', 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_ -[ +{move left 20bp__} +Row1: [ J: j_fet + { "svg_tt(`j_fet')" at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: j_fet(right_ dimen_,,P,E) with .w at J.e+(0.5,0) + { "svg_tt(`j_fet(right_')" at J.s+(0,-4bp__) below "svg_tt(`dimen_,,P,E)')" + "svg_it(G)" at J.G rjust above + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: e_fet with .w at J.e+(0.5,0) + { "svg_tt(` e_fet')" at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: e_fet(,,P) with .w at J.e+(0.6,0) + { "svg_tt(` e_fet(,,P)')" at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: e_fet(,,P,S) with .w at J.e+(0.8,0) + { "svg_tt(` e_fet(,,P,S)')" at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: c_fet with .w at J.e+(0.7,0) + { "svg_tt(` c_fet')" at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: c_fet(,,P) with .w at J.e+(0.7,0) + { "svg_tt(` c_fet(,,P)')" wid 72bp__ at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + ] + +Row2: [ + J: d_fet + { "svg_tt(`d_fet')" at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: d_fet(,,P) with .w at J.e+(0.5,0) + { "svg_tt(`d_fet(,,P)')" at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: d_fet(,,P,S) with .w at J.e+(0.8,0) + { "svg_tt(`d_fet(,,P,S)')" at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: g_fet with .w at J.e+(0.6,0) + { "svg_tt(`g_fet')" at J.s+(0,-0.05) below + "svg_it(G)" at J.G rjust + "svg_it(S)" at J.S rjust + "svg_it(D)" at J.D ljust } + J: g_fet(up_ dimen_,,P) with .w at J.e+(0.6,0) + { "svg_tt(`g_fet(up_')" at last [].s below + "svg_tt(` dimen_,,P)')" at last [].s + (0,-12bp__) below + "svg_it(G)" at last [].G rjust + "svg_it(S)" at last [].S + (0,2bp__) ljust + "svg_it(D)" at last [].D + (0,2bp__) ljust below } + right_ + M1: mosfet(,,dBSDFQM1,E) with .w at J.e+(0.6,0) + "svg_it(G0)" at M1.G0 above rjust + "svg_it(G1)" at M1.G1 above ljust + {"svg_tt(`mosfet(,,dBSDFQM1,E)')" wid 1.45 \ + with .nw at last [].sw+(0,-0.2) } + M2: mosfet(,,dBSDFQuM1) with .nw at M1.ne+(0.6,0) + "svg_it(G0)" at M2.G0 above ljust + "svg_it(G1)" at M2.G1 above rjust + {"svg_tt(`...(,,dBSDFQuM1')" wid 1.25 \ + with .n at last [].s+(0,-0.05) } + ] with .nw at Row1.sw+(0,-10bp__) # Row2 + +Row3: [ linewid = linewid*1.2 Q1: mosfet(,,dGSDF,) - { "`mosfet'(,,dGSDF,)" at last [].s+(0,-0.1) below wid 1.3 + {"svg_tt(`mosfet(,,dGSDF,)')" wid 1.25 \ + with .nw at last [].sw+(-0.2,-0.05) thinlines_ arrow <- down .05 left .15 from (Q1.G.x,Q1.G.y-0.05) - "dG" rjust + "svg_tt(dG)" rjust arrow <- down .10 left .30 from Q1.Channel.start+(.15,0) - "F" rjust + "svg_tt(F)" rjust arrow <- down .05 left .15 from (Q1.S.x,Q1.S.y+0.05) - "S" rjust + "svg_tt(S)" rjust arrow <- down .05 right .15 from (Q1.D.x,Q1.D.y+0.05) - "D" ljust + "svg_tt(D)" ljust thicklines_ } move right_ rmove Q2: mosfet(,,uHSDF,) - {"`...'(,,uHSDF,)" at last [].s+(0,-0.15) below + {"svg_tt(`...(,,uHSDF,)')" at last [].s+(0,-0.2) below thinlines_ arrow <- down .05 left .15 from (Q2.G.x,Q2.G.y-0.05) - "uH" rjust + "svg_tt(uH)" rjust thicklines_ } move right_ rmove - Q3: mosfet(,,LEDSQuB,) - {"`...'(,,LEDSQuB,)" at last [].s+(0,-0.15) below + Q3: mosfet(,,dMEDSQuB,) + {"svg_tt(`...(,,dMEDSQuB,)')" at last [].s+(0,-0.05) below thinlines_ arrow <- down .05 left .15 from (Q3.G.x,Q3.G.y-0.05) - "L" rjust + "svg_tt(dM)" rjust arrow <- down .13 left .30 from Q3.Channel.start+(.12,0) - "E" rjust + "svg_tt(E)" rjust arrow <- down .05 left .10 from Q3.S+(.06,0) - "Q" rjust + "svg_tt(Q)" rjust arrow <- down .08 right .24 from (Q3.B.x,Q3.B.y+0.175) - "uB" ljust + "svg_tt(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 + Q4: mosfet(,,uMEDSuB) + {"svg_tt(`...(,,uMEDSuB,)')" at last [].s+(0,-0.2) below + "svg_it(G)" at last [].G rjust + "svg_it(S)" at last [].S rjust + "svg_it(D)" at last [].D ljust + "svg_it(B)" at last [].B below } move right_ rmove Q5: mosfet(,,ZSDFdT,) - {"`...'(,,ZSDFdT,)" at last [].s+(0,-0.05) below + {"svg_tt(`...(,,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 + "svg_tt(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 + "svg_tt(dT)" ljust thicklines_ } - move right_ rmove + move right_ rmove+0.1 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 + {"svg_tt(`IRF4905')" at Q6.s+(0,-0.15) below + "svg_it(G)" at Q6.G rjust + "svg_it(D)" at Q6.D ljust above + "svg_it(S)" at Q6.S ljust below } - ] with .n at last [].s+(0,-.2) + ] with .nw at Row2.sw + (0,-10bp__) command "</g>" # end font .PE diff --git a/graphics/circuit_macros/examples/svg/graysurfSVG.m4 b/graphics/circuit_macros/examples/svg/graysurfSVG.m4 index 13c91aabc0..a42709b96e 100644 --- a/graphics/circuit_macros/examples/svg/graysurfSVG.m4 +++ b/graphics/circuit_macros/examples/svg/graysurfSVG.m4 @@ -25,9 +25,9 @@ Surface:[ 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 + 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 { @@ -36,10 +36,10 @@ Surface:[ 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)) + 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) @@ -63,8 +63,8 @@ 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__ +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 @@ -87,10 +87,10 @@ Y: arrow from Orig to (project(0,tradius+sradius*2,0)); "y" below wid 4bp__ 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))) + 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) @@ -103,10 +103,10 @@ thinlines_ } thicklines_ - arrow from Orig to (project(0,0,tradius*1.4)); "z" above - dashline(from Orig to (project(torus(0,0))),,,,G) + 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) + dashline(from Orig to Project(torus(90,0)),,,,G) arrow to Y.end ] with .sw at last [].se+(0.2,0) @@ -131,11 +131,11 @@ Hat: [ 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)) +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 { @@ -151,14 +151,14 @@ Zv: (project(0,0,1)) 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) + with .c at Project(0,0,(maxy^2-1)^2)+(0,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))) + 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 } @@ -169,21 +169,21 @@ 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+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 +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) + with .C at Project(0,0,(maxy^2-1)^2)+(0,linethick bp__/2) ] scaled 1.25 with .s at 2nd [].ne+(0,-0.75) ] scaled 0.85 diff --git a/graphics/circuit_macros/examples/svg/icsSVG.m4 b/graphics/circuit_macros/examples/svg/icsSVG.m4 index 0733bbef64..8a3c99b66f 100644 --- a/graphics/circuit_macros/examples/svg/icsSVG.m4 +++ b/graphics/circuit_macros/examples/svg/icsSVG.m4 @@ -1,110 +1,108 @@ divert(-1) - Macros defining some integrated circuits and connectors - -define(`lg_pinsep',3*L_unit) logic pin separation in logic units -define(`lg_chipwd',18*L_unit) default chip width -define(`overbar_',`{ line right last "".wid with .c at last "".n+(0,1bp__) }') + Macros defining some integrated circuits and connectors for SVG `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])' + lg_pinseq(initial pin no, final pin no, + e|w, initial offset, pinnum_root, Labelroot, [N])' + `e.g., lg_pinseq(1,8,w)' 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(`ic_tiny',`iflatex(`\hbox{\tiny `$1'}',ifsvg(`svg_small(`$1')',`$1'))') + define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep 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; overbar_ - + lg_pin(Chip.sw_+(0,2*lg_pinsep),lg_bartxt(CS),Pin18,wN,18) 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+(0,1bp__) } - - 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; overbar_ - + lg_pin(Chip.sw_+(0,13*lg_pinsep),R/lg_bartxt(W),Pin21,w,21) + lg_pin(Chip.sw_+(0,14*lg_pinsep),V`'ic_tiny(CC),Pin24,w,24) + lg_pin(Chip.se_+(0,lg_pinsep),lg_bartxt(OE),Pin20,eN,20) 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) `$1']') define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep - 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+(0,1bp__) } - + lg_pin(Chip.sw_+(0,lg_pinsep),V`'ic_tiny(SS),Pin21,w,21) + lg_pin(Chip.sw_+(0,2*lg_pinsep),V`'ic_tiny(SS),Pin1,w,1) + lg_pin(Chip.sw_+(0,4*lg_pinsep),R/lg_bartxt(W),Pin34,w,34) 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; overbar_ - + lg_pin(Chip.sw_+(0,15*lg_pinsep),lg_bartxt(RESET),Pin40,wN,40) 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; overbar_ - + lg_pin(Chip.sw_+(0,19*lg_pinsep),lg_bartxt(NMI),Pin6,wN,6) 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_pin(Chip.sw_+(0,23*lg_pinsep),V`'ic_tiny(CC),Pin8,w,8) + lg_pin(Chip.se_+(0,lg_pinsep),CK`'ic_tiny(1)(in),Pin39,e,39) + lg_pin(Chip.se_+(0,4*lg_pinsep), CK`'ic_tiny(2)(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; overbar_ + lg_pin(Chip.se+(0,23*lg_pinsep),lg_bartxt(IRQ),Pin4,eN,4) `$1']') define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep - lg_pin(Chip.sw_+(0,lg_pinsep),V`'svg_small(SS,75),Pin1,w,1) + lg_pin(Chip.sw_+(0,lg_pinsep),V`'ic_tiny(SS),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; overbar_ - + lg_pin(Chip.sw_+(0,5*lg_pinsep),lg_bartxt(CS2),Pin23,wN,23) 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+(0,1bp__) } - - 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; overbar_ - - lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'svg_small(CC,75),Pin20,w,20) + lg_pin(Chip.sw_+(0,21*lg_pinsep),R/lg_bartxt(W),Pin22,w,22) + lg_pin(Chip.sw_+(0,22*lg_pinsep),lg_bartxt(IRQ),Pin21,wN,21) + lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'ic_tiny(CC),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; overbar_ - + lg_pin(Chip.se_+(0,23*lg_pinsep),lg_bartxt(RESET),Pin34,eN,34) `$1']') define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep 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; overbar_ - - 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; overbar_ - + lg_pin(Chip.sw_+(0,2*lg_pinsep),lg_bartxt(G2a),Pin4,wN,4) + lg_pin(Chip.sw_+(0,3*lg_pinsep),lg_bartxt(G2b),Pin5,wN,5) 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_pin(Chip.sw_+(0,10*lg_pinsep),V`'ic_tiny(CC),Pin16,w,16) lg_pinseq(0,6,e,2,15-,Y,n) lg_pin(Chip.se_+(0,9*lg_pinsep),Y7,Pin7,eN,7) `$1']') +define(`ic4017',`[ Chip: DIP_chip_outline(16) + Loopover_(`x', + `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)', + PL, Q3, I3, I0, CLE, Q0, TC, GND) + Loopover_(`x', + `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+8),e,eval(m4Lx+8))', + MR, U/D, Q1, I1, I2, Q2, CLK, Vcc) + `$1']') + +define(`ic4510',`[ Chip: DIP_chip_outline(16) + Loopover_(`x', + `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)', + PL, Q3, I3, I0, CLE, Q0, TC, GND) + Loopover_(`x', + `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+8),e,eval(m4Lx+8))', + MR, U/D, Q1, I1, I2, Q2, CLK, Vcc) + `$1']') + +define(`icVS1053',`[ Chip: DIP_chip_outline(32) + Loopover_(`x', + `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)', + LOUT,ROUT,GBUF,AGND,AGND,DREG,Vcc,3V3,GND,MISO,MOSI,sclk,RST,CS,DCS,DCS) + Loopover_(`x', + `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+16),e,eval(m4Lx+16))', + SDCD,RX,TX,7,6,5,4,3,2,1,0,GND,3V3,AGND,MIC`'svg_it(-),MIC`'svg_it(+)) + `$1']') + `ArduinoUno( wid,ht,pinlen )' define(`ArduinoUno',`[ define(`m4bwid',`ifelse(`$1',,`24*L_unit',`$1')')dnl @@ -118,7 +116,7 @@ define(`ArduinoUno',`[ Loopover_(`x',`ifelse(x,nul,, `Pin`'eval(5+m4Lx): line left_ plen from Connector.nw-(0,(5+m4Lx)*lg_pinsep) { "x" ljust at last line.start }')', - IOREF, RESET,`+`'3V3',`+`'5V', GND, GND, VIN, + IOREF, RESET,svg_it(+)3V3,svg_it(+)5V, GND, GND, VIN, nul, A0, A1, A2, A3, A4, A5) # Loopover_(`x',`ifelse(x,nul,, @@ -141,7 +139,7 @@ define(`ArduinoLeonardo',`[ Loopover_(`x',`ifelse(x,nul,, `Pin`'eval(5+m4Lx): line left_ plen from Connector.nw-(0,(5+m4Lx)*lg_pinsep) { "x" ljust at last line.start }')', - IOREF, RESET,`+`'3V3',`+`'5V', GND, GND, VIN, + IOREF, RESET,svg_it(+)3V3,svg_it(+)5V, GND, GND, VIN, nul, A0, A1, A2, A3, A4, A5) # Loopover_(`x',`ifelse(x,nul,, @@ -155,8 +153,8 @@ Loopover_(`x',`ifelse(x,nul,, `RPi( wid,ht,pinlen )' define(`RPi',`[ - define(`m4bwid',`ifelse(`$1',,`34*L_unit',`$1')')dnl - define(`m4bht',`ifelse(`$2',,`21*lg_pinsep',`$2')')dnl + define(`m4bwid',`ifelse(`$1',,`34*L_unit',`$1')')dnl + define(`m4bht',`ifelse(`$2',,`21*lg_pinsep',`$2')')dnl # GPIO: box wid m4bwid ht m4bht plen = ifelse(`$4',,`6*L_unit',`$4') @@ -171,9 +169,11 @@ Loopover_(`x',`ifelse(x,nul,,`A_LeftGPIO(m4Lx,patsubst(x,;,`,'))')', ;3V3, 2;SDA1, 3;SCL1, 4;GPIO_GCLK, ;GND, - 17;GPIO_GEN0, 27;GPIO_GEN2, 22;GPIO_GEN3, + 17;GPIO_GEN0, 27;GPIO_GEN2, + 22;GPIO_GEN3, ;3V3, - 10;SPI_MOSI, 9;SPI_MISO, 11;SPI_SCLK, + 10;SPI_MOSI, 9;SPI_MISO, + 11;SPI_SCLK, ;GND, ;ID_SD, 5;, 6;, 13;, 19;, 26;, @@ -193,7 +193,8 @@ Loopover_(`x',`ifelse(x,nul,,`A_RightGPIO(m4Lx,patsubst(x,;,`,'))')', ;GND, 23;GPIO_GEN4, 24;GPIO_GEN5, ;GND, - 25;GPIO_GEN6, 8;SPI_CEO_N, 7;SPI_CE1_N, + 25;GPIO_GEN6, 8;SPI_CEO_N, + 7;SPI_CE1_N, ;ID_SC, ;GND, 12;, @@ -214,12 +215,14 @@ define(`USB_C_Socket',`[ `B`'eval(13-m4Lx): dnl line left_ plen from Base.n-(m4bwid/2,(m4Lx+0.5)*lg_pinsep) {"x" ljust at last line.start}', - GND, RX1+, RX1-, VBUS, SBU2, D-, D+, CC2, VBUS, TX2-, TX2+, GND) + GND, RX1`'svg_it(+), RX1`'svg_it(-), VBUS, SBU2, D`'svg_it(-), + D`'svg_it(+), CC2, VBUS, TX2`'svg_it(-), TX2`'svg_it(+), GND) # Loopover_(`x', `A`'m4Lx: line right_ plen from Base.n+(m4bwid/2,-(m4Lx+0.5)*lg_pinsep) {"x" rjust at last line.start}', - GND, TX1+, TX1-, VBUS, CC1, D+, D-, SBU1, VBUS, RX2-, RX2+, GND) + GND, TX1`'svg_it(+), TX1`'svg_it(-), VBUS, CC1, D`'svg_it(+), + D`'svg_it(-), SBU1, VBUS, RX2`'svg_it(-), RX2`'svg_it(+), GND) # `$4']') @@ -238,11 +241,13 @@ define(`HDMI_micro',`[ `Pin`'m4Lx: line left_ plen from Base.nw-(0,m4bwid/3+(m4Lx-1/2)*lg_pinsep) {"x" ljust at last line.start} "m4Lx" at last line.c above', - HPD, UTILITY, D2+, D2_SH, D2-, D1+, D1_SH, D1-, D0+, D0_SH, - D0-, CLK+, CLK_SH, CLK-, CEC, GND, SCL, SDA, +5V) - line from Base.nw+(m4bwid*2/3-lg_pinsep,0) up plen + HPD, UTILITY, D2`'svg_it(+), D2_SH, D2`'svg_it(-), + D1`'svg_it(+), D1_SH, D1`'svg_it(-),D0`'svg_it(+), D0_SH, + D0`'svg_it(-), CLK`'svg_it(+), CLK_SH, CLK`'svg_it(-), + CEC, GND, SCL, SDA,svg_it(+)5V) +L1: line from Base.nw+(m4bwid*2/3-lg_pinsep,0) up plen svg_rot(90,"21" at last line.c +(-2bp__,0)) - svg_rot(90,sprintf("SH2") at last line.start + (4bp__,-8bp__)) + svg_rot(90,"SH2" at last line.start + (4bp__,-8bp__)) line from Base.nw+(m4bwid*2/3-2*lg_pinsep,0) up plen svg_rot(90,"20" at last line.c+(-2bp__,0)) svg_rot(90,"SH1" at last line.start + (4bp__,-8bp__)) @@ -255,4 +260,52 @@ define(`HDMI_micro',`[ # `$4']') + `DIP_chip_outline( pin count, wid )' +define(`DIP_chip_outline', + `[ define(`m4pinct',`ifelse(`$1',,16,`$1')')dnl + define(`m4chgw',`ifelse(`$2',,(18*L_unit),`$2')')dnl + Chip: box invis wid m4chgw ht lg_pinsep*eval((m4pinct)/2+1) + arcd(last box.n, lg_pinsep/2, 180, 360) + { line to last box.ne chop -linewid bp__/2 } + { line from last arc.start to last box.nw chop -linewid bp__/2 } + line from last box.nw to last box.sw then to last box.se then to last box.ne + `$3']') + + `DIP( pin count, attributes) + Dual in-line package + attributes=semicolon-separated list of optional terms: + bodywid=expr; (default 0.25 = 5*L_unit ) + bodylen=expr; (default pin count/2 x pinpitch) + pinpitch=expr; (default 0.1) + pinwid=expr; (default 0.06) + pinlen=expr; (default 0.05) + direct=U|D|L|R;(default U for up) + type=I|Q; (default I for uniform-length pins; + Q: staggered) ' +define(`DIP',`[ pinct= ifelse(`$1',,8,`$1') + Loopover_(`Z',`setkey_(`$2',patsubst(Z,:.*),patsubst(Z,.*:))', + bodywid: 5*L_unit, + bodylen: m4pinpitch*int(pinct/2+0.5), + pinpitch:2*L_unit, + pinwid: 1.2*L_unit, + pinlen: L_unit) + Loopover_(`Z',`setkey_(`$2',patsubst(Z,:.*),patsubst(Z,.*:),N)', + direct:U, + type:I) + setdir_(m4direct,U) + Body: box ht_ m4bodywid wid_ m4bodylen + arcs = ifelse(m4dir,right,90,m4dir,up,180,m4dir,left,270,0) + arcd(Body.e_, 0.1/2, arcs,arcs+180) + np2 = int(pinct/2+0.5) + define(`m4bxht',`m4pinlen ifelse(m4type,Q,`*(1+(i%%2))')')dnl + for i=0 to np2-1 do { + exec sprintf("Pin%g: box ht_ m4bxht wid_ m4pinwid \ + with .s_ at (i+0.5)/np2 between Body.ne_ and Body.nw_",i+1) } + for i=np2+1 to pinct do { + exec sprintf("Pin%g: box ht_ m4bxht wid_ m4pinwid \ + with .n_ at (i-np2-0.5)/(pinct-np2) between Body.sw_ and Body.se_",i) } + `$3'; resetdir_ + popdef(`m4bodywid',`m4bodylen',`m4pinpitch',`m4pinwid',`m4pinlen',`m4direct', + `m4type') ]')) + divert(0)dnl diff --git a/graphics/circuit_macros/examples/svg/paletteSVG.m4 b/graphics/circuit_macros/examples/svg/paletteSVG.m4 index 6128441fc8..4c5a40f038 100644 --- a/graphics/circuit_macros/examples/svg/paletteSVG.m4 +++ b/graphics/circuit_macros/examples/svg/paletteSVG.m4 @@ -322,14 +322,10 @@ A:Gridbox( speaker ) Below(A) 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 +A:Gridbox( FlipFlop(D) ) Below(A) + Gridbox( FlipFlop(T) ) Right + Gridbox( FlipFlop(RS)) Right + Gridbox( FlipFlop(JK)) Right ] with .nw at (0,0) diff --git a/graphics/circuit_macros/examples/svg/roseSVG.m4 b/graphics/circuit_macros/examples/svg/roseSVG.m4 index b386d9aea5..32c5dfdbc5 100644 --- a/graphics/circuit_macros/examples/svg/roseSVG.m4 +++ b/graphics/circuit_macros/examples/svg/roseSVG.m4 @@ -1,12 +1,13 @@ .PS -# rose.m4 +# roseSVG.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 +scale = 1.25 +Rose: [ define(`gold_',`1,0.84,0') define(`rose',`point_(`$2'); CC: (vec_(`$1',0)); rrad = `$3' @@ -127,5 +128,39 @@ C: (0,0) box wid tmp ht tmp at C ] with .sw at 1,1 +] # Rose + +Halftone: [ +#.PS +# SpiralHalftoneSVG.m4 +# https://tex.stackexchange.com/questions/584455/how-to-draw-this-spiral-made-of-circles-in-latex +# gen_init + + r = 133/255; g = 196/255; b = 100/255 + skale = 2/3*scale + skale = 2.49/4.25 + + holerad = 1*skale + outerrad = 4.25*skale + + define grcirc {circle diam $1 colored rgbstring(r,g,b)} + + npts = 200 + outercdiam = (outerrad/npts)*twopi_ + angoffset = -5*pi_/4 + da = twopi_/npts*10/3 + radc = outerrad + for x = 0 to 1 do { + cdiam = outercdiam*radc/outerrad + for i=0 to npts-1 do { ang = i/npts*twopi_ + grcirc(cdiam*abs(ang-pi_)/pi_) at rect_(radc,ang+angoffset) } + angoffset += da + radc -= cdiam*2/3 + if radc < holerad then { x = 1 } else { x = 0 } + } + +#.PE + ] with .sw at Rose.se+(0.2,0) + ') .PE diff --git a/graphics/circuit_macros/examples/svg/shapesSVG.m4 b/graphics/circuit_macros/examples/svg/shapesSVG.m4 index 08962e9f85..b0b66fa0bb 100644 --- a/graphics/circuit_macros/examples/svg/shapesSVG.m4 +++ b/graphics/circuit_macros/examples/svg/shapesSVG.m4 @@ -1,5 +1,5 @@ .PS -# shapes.m4 +# shapesSVG.m4 threeD_init divert(-1) @@ -18,14 +18,14 @@ define(`cylinder3D',`[ Start: (0,0) define(`M4CL',`xdispl,ydispl,zdispl')dnl lenc = length3D(M4CL) cs = dot3D(View3D,M4CL)/lenc - End: (project(M4CL)) + 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)) + 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)) @@ -48,7 +48,7 @@ define(`cone3D',`[ Start: (0,0) define(`M4CL',`xdispl,ydispl,zdispl')dnl lenc = length3D(M4CL) diamc = ifelse(`$4',,(lenc/2),`$4') ; radc = diamc/2 - End: (project(M4CL)) + End: Project(M4CL) cs = dot3D(View3D,M4CL)/lenc az = atan2(ydispl,xdispl) ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2)) @@ -60,7 +60,7 @@ define(`cone3D',`[ Start: (0,0) 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))))) + 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 } } } @@ -116,7 +116,7 @@ define(`prism3D',`[ Start: (0,0) 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 + 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 @@ -143,10 +143,10 @@ 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)) + 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 @@ -165,7 +165,7 @@ setview(azimuth,elev) 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)) + 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) [ @@ -175,7 +175,7 @@ setview(azimuth,elev) 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 .Start at Project(rot3Dz(r,rot3Dy(pi_/4,len*0.5,0,0))) } ] with .nw at last [].ne [ setlight(0,0) diff --git a/graphics/circuit_macros/examples/svg/sldtestsSVG.m4 b/graphics/circuit_macros/examples/svg/sldtestsSVG.m4 new file mode 100644 index 0000000000..658af488d6 --- /dev/null +++ b/graphics/circuit_macros/examples/svg/sldtestsSVG.m4 @@ -0,0 +1,104 @@ +.PS +# slddiagsSVG.m4 +cct_init(svg_font(sans-serif,10bp__)) +include(../test/sld/SLD.m4) + +divert(-1) + +divert(0)dnl + +Pic1: [ +define(`TRFDY', + `sl_transformer(down_ elen_ `$1',type=S) + { Deltasymbol(at last [].M1); Ysymbol(at 2nd last [].M2,,D) } ') + + T: dot + switch(up_ elen_); {"Public supply" above} + Bus1: sl_busbar(right_ 5*dimen_,6,port=D) with .c at T + {"svg_small(20 kV)" at Bus1.Start above ljust} + S1: switch(from Bus1.P1-(0,elen_) up_ elen_) + S2: switch(from Bus1.P2-(0,elen_) up_ elen_) + TRF1: TRFDY(from Bus1.P3); arrow down_ dimen_/3 + TRF2: TRFDY(from Bus1.P4); arrow down_ dimen_/3 + TRF3: TRFDY(from Bus1.P5); arrow down_ dimen_/3 + S3: switch(from Bus1.P6-(0,elen_) up_ elen_) + Bus2: sl_busbar(right_ 1.5*dimen_,3,port=D) with .c at Bus1.P1+(0,-dimen_*3) + {"svg_small(20 kV)" at Bus2.Start above ljust} + {"svg_small(1.25 MVA)" at Bus2.P2 below} + S4: switch(from Bus2.P2 to S1.start) + TRF4: TRFDY(from Bus2.P1) + S4: switch(from Bus2.P3+(0,-elen_) to Bus2.P3) +] + +Pic3: [ +# https://tex.stackexchange.com/questions/597643/draw-a-power-system-network + B1: sl_busbar(up_ dimen_*4/3,3) + sl_transformer(right_ 2*dimen_ from last [].P2, + type=S;body=shaded "lightgray"); variable(,,,dimen_*3/2) + B2: sl_busbar(up_ dimen_*4/3,3) + { line left_ dimen_/2 from B2.P1 + C1: capacitor(down_ dimen_/2); ground(,T) } + line right_ dimen_/2 + { line to (Here,C1.start); C2: capacitor(to (Here,C1.end)); ground(,T) } + ebox(right_ 3.5*dimen_, 2.5*dimen_, dimen_/5, 0.75) + { line to (Here,C1.start); C3: capacitor(to (Here,C1.end)); ground(,T) } + line right_ dimen_/2 + B3: sl_busbar(up_ dimen_*4.5,6) + line right_ dimen_*3/4 from B3.P1; box wid dimen_*3 ht dimen_*.6 \ + shaded "Goldenrod" "Static Load" + line right_ dimen_*3/4 from B3.P2; box wid dimen_*3 ht dimen_*.6 \ + shaded rgbstring(0.99*0.8, 0.74*0.8, 0.71*0.8) "Electronic Load" + sl_disk(at B3.P3,,R, + text="A/C";circle=shaded ```rgbstring(.2,.8,.2)''';diam=dimen_*3/4) + sl_disk(at B3.P4,,R, + text="M";circle=shaded ```rgbstring(.21,.47,.86)''';diam=dimen_*3/4) + sl_disk(at B3.P5,,R, + text="M";circle=shaded ```rgbstring(.2,.6,.8)''';diam=dimen_*3/4) + sl_disk(at B3.P6,,R, + text="M";circle=shaded ```rgbstring(.2,.63,.8)''';diam=dimen_*3/4) + sl_disk(at 1/2 between B3.P1 and B3.P2,,L, + text="svg_small(DER_A)";\ + circle=shaded ```rgbstring(0.78,0.36,0.3)''';diam=dimen_*3/4) +] with .nw at last [].sw + (100bp__,120bp__) + +Pic2: [ +define(`shadedb',`shaded "CornflowerBlue"') +Loopover_(`LR', # loop to take advantage of symmetry + `define(`lrdir',ifelse(LR,L,`right_',`left_'))dnl + LR`'side: [ + sl_generator(,dimen_,LR,type=B;name=G1;circle=shadedb,box=shadedb) + T1: sl_transformer(lrdir dimen_*3/2) + Bus1: sl_busbar(up_ dimen_*3/2,3,) with .P2 at Here + Br1: sl_breaker(from Bus1.P3 lrdir elen_,box=shadedb) + line lrdir dimen_ + Br2: sl_breaker(from Bus1.P1 lrdir elen_,box=shadedb) + Br3: sl_breaker(down_ dimen_,box=shadedb) + Bus2: sl_busbar(lrdir dimen_,3) with .P2 at Here + T2: sl_transformer(down_ dimen_ from Bus2.P2,name=X2) + sl_disk(,dimen_/2,D,type=B;text="SM";name=SM1;circle=shadedb,box=shadedb) + ground(at last circle.s,dimen_/2) + ]', + L,R) + "Bus 1" at Lside.Bus1.top above + "Bus 2" at Rside.Bus1.top above + "Bus 3" at Lside.Bus2.w above + "Bus 4" at Rside.Bus2.e above + "TL`'svg_sub(1) 50 km 69 kV" at 1/2 between Lside.Br1 and Rside.Br1 above + "TL`'svg_sub(2) 30 km" ljust "69 kV" ljust at Lside.Br2.end + (-18bp__,12bp__) + "TL`'svg_sub(2) 20 km" ljust "69 kV" ljust at Rside.Br2.end + (-18bp__,12bp__) + "G`'svg_sub(1) 50 MVA" ljust "13.8 kV" ljust at Lside.G1.w+(0,-28bp__) + "G`'svg_sub(2) 30 MVA" ljust "13.8 kV" ljust at Rside.G1.w+(0,-28bp__) + "T`'svg_sub(1) 50 MVA" ljust "13.8/69 kV svg_Delta/Y" ljust \ + at Lside.T1.start+(0,-33bp__) + "T`'svg_sub(2) 30 MVA" ljust "69/13.8 kV Y/svg_Delta" ljust \ + at Rside.T1.end+(5bp__,-33bp__) + "T`'svg_sub(3) 50 MVA" rjust "13.8/69 kV Y/svg_Delta" rjust \ + at Lside.X2.w+(-4bp__,0) + "T`'svg_sub(4) 20 MVA" ljust "69/6.9 kV Y/svg_Delta" ljust \ + at Rside.X2.e+(4bp__,0) + "SM`'svg_sub(1) 30 MVA" rjust "13.8 kV" rjust at Lside.SM1.w+(-4bp__,0) + "SM`'svg_sub(2) 20 MVA" ljust "6.9 kV" ljust at Rside.SM1.e+( 4bp__,0) +] with .nw at (Pic1.w,last [].sw + (0,-15bp__)) + +command "</g>" +.PE diff --git a/graphics/circuit_macros/examples/svg/tstSVG.htmx b/graphics/circuit_macros/examples/svg/tstSVG.htmx index d81a22927a..65425998fc 100644 --- a/graphics/circuit_macros/examples/svg/tstSVG.htmx +++ b/graphics/circuit_macros/examples/svg/tstSVG.htmx @@ -86,6 +86,7 @@ more basic. e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%",XYZ)</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_sf(</g>text`'m4tt)</g>: sans-serif (Helvetica) <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>: @@ -96,6 +97,11 @@ more basic. 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_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 <li>m4tt svg_rot(</g>degrees, "text" [at position]`'m4tt)</g>: Rotate text degrees (default 90) ccw. Requires m4tt`'svg_rot_init(</g>filename`'m4tt)</g> and the source diff --git a/graphics/circuit_macros/examples/tikz.tex b/graphics/circuit_macros/examples/tikz.tex deleted file mode 100644 index fc3f4c17dc..0000000000 --- a/graphics/circuit_macros/examples/tikz.tex +++ /dev/null @@ -1,15 +0,0 @@ -\documentclass[11pt]{article} -\usepackage{tikz} -\usepackage{siunitx} -\usepackage[T1]{fontenc} -\usepackage{boxdims} -\addtolength{\textwidth}{2cm} -\addtolength{\textheight}{3cm} -\setlength{\oddsidemargin}{0pt} -\setlength{\evensidemargin}{0pt} -\setlength{\hoffset}{-0.5in} -\pagestyle{empty} -\thispagestyle{empty} -\begin{document} - \noindent\vspace{2ex}\input{test.tex} -\end{document} diff --git a/graphics/circuit_macros/examples/tst.tex b/graphics/circuit_macros/examples/tst.tex index c4549a1631..029dcc31fa 100644 --- a/graphics/circuit_macros/examples/tst.tex +++ b/graphics/circuit_macros/examples/tst.tex @@ -1,23 +1,12 @@ \documentclass[11pt]{article} -% Custimize your packages here: -\usepackage[dvips]{graphicx} -\usepackage{pstricks,pst-slpe,pst-grad} -\usepackage{boxdims} -\usepackage{upgreek} -\usepackage{siunitx} -\usepackage{amssymb} -% -%\addtolength{\textwidth}{2cm} -\addtolength{\textwidth}{10cm} % for Tubediags.ps -%\addtolength{\textheight}{3cm} -\addtolength{\textheight}{10cm} % for Tubediags.ps -\setlength{\oddsidemargin}{0pt} -\setlength{\evensidemargin}{0pt} -\setlength{\hoffset}{-0.5in} -\newbox\graph -\pagestyle{empty} -\thispagestyle{empty} -% -\begin{document} - \noindent\vspace{2ex}\input{test.tex}\box\graph -\end{document} + \usepackage[dvipsnames]{xcolor} + \usepackage{times,boxdims,graphicx,pstricks} + \usepackage{siunitx} + \setlength{\textwidth}{28cm}\setlength{\textheight}{28cm} + \setlength{\oddsidemargin}{0pt}\setlength{\evensidemargin}{0pt} + \setlength{\hoffset}{-1cm} + \pagestyle{empty}\thispagestyle{empty} + \newbox\graph + \begin{document} + \noindent\input{test.tex}\box\graph + \end{document} diff --git a/graphics/circuit_macros/examples/tsttikz.tex b/graphics/circuit_macros/examples/tsttikz.tex new file mode 100644 index 0000000000..00e327c454 --- /dev/null +++ b/graphics/circuit_macros/examples/tsttikz.tex @@ -0,0 +1,19 @@ +\documentclass[11pt]{standalone} +% Custimize your packages here: +\usepackage{graphicx} +%\usepackage{pstricks,pst-slpe,pst-grad} +\usepackage{tikz} +\usepackage{boxdims} +\usepackage{upgreek} +\usepackage{siunitx} +\usepackage{amssymb} +\usepackage{geometry} +% for Heathkit.m4: +\geometry{paperwidth=15in,paperheight=14in,margin=1in} +\newbox\graph +\pagestyle{empty} +\thispagestyle{empty} +% +\begin{document} + \noindent\vspace{2ex}\input{test.tex}\box\graph +\end{document} diff --git a/graphics/circuit_macros/examples/venus.m4 b/graphics/circuit_macros/examples/venus.m4 new file mode 100644 index 0000000000..8494638258 --- /dev/null +++ b/graphics/circuit_macros/examples/venus.m4 @@ -0,0 +1,73 @@ +.PS +# venus.m4 +# https://tex.stackexchange.com/questions/576423/a-more-precise-dance-of-planets-with-metapost-and-tikz +# https://tex.stackexchange.com/questions/575986/dance-of-venus-and-variations-in-tikz-pgf + +gen_init +NeedDpicTools +maxpsht = 20 + +thinlines_ + +define(`venus', +`setkeys_(`$1', + outerlength:4; + innerlength:2.8933; + outerrate:8; + innerrate:13; + maxtimes:2880; + increment:2; + changephase:0 ) + sizefactor = 165/200 + nmaxtimes = 360*m4outerrate + for x=0 to nmaxtimes by m4increment do { + if "$2" != "" then { hue = \ + abs(sind(360*x/nmaxtimes*abs(m4innerrate-m4outerrate)+m4changephase-60)) + hsvtorgb(hue*360,1,1,r,g,b) + line from (Rect_(m4outerlength,x))*sizefactor \ + to (Rect_(m4innerlength,x/m4outerrate*m4innerrate))*sizefactor \ + outlined rgbstring(r,g,b) } \ + else { + line from (Rect_(m4outerlength,x))*sizefactor \ + to (Rect_(m4innerlength,x/m4outerrate*m4innerrate))*sizefactor + } + } ') + +AA:[ + sizefactor = 1/2.54 + define(`venusA',`[ + setkeys_(`$1', + iterations:270; + outerdistance:5.41; + innerdistance:7.48; + outerperiod:123; + innerperiod:200; + step:5) + for x=0 to m4iterations by m4step do { + line from (Rect_(m4outerdistance,x))*sizefactor \ + to (Rect_(m4innerdistance,x/m4outerperiod*m4innerperiod))*sizefactor \ + outlined "gray" + } + ]') + +# 3 columns, 5 rows + sizefactor /= 3 + Orig:(0,0) + for i=1 to 5 do { + iteri = 180 + (i-1)*540 + for j=1 to 3 do { + if (i==1) && (j==1) then { iter = 270 } \ + else { iter = iteri + (j-1)*180 } + V[i,j]: venusA(iterations=iter) with .sw at Orig + sprintf("%g",iter) at last [] #colored rgbstring(1,0,0) + Orig: V[i,j].se + } + Orig: V[i,1].sw-(0,V[i,1].ht) + } + ] + +BB:[ + venus(outerrate=8;innerrate=17;increment=2;innerlength=3.5;changephase=60,T) + ] with .nw at AA.sw+(0,-0.5) + +.PE diff --git a/graphics/circuit_macros/examples/xfig/xfiglib.fig b/graphics/circuit_macros/examples/xfig/xfiglib.fig index 255d8170c1..081aef7471 100644 --- a/graphics/circuit_macros/examples/xfig/xfiglib.fig +++ b/graphics/circuit_macros/examples/xfig/xfiglib.fig @@ -6,7 +6,7 @@ Letter 100.00 Single -2 -# dpic version 2021.01.01 option -x for Fig 3.2 +# dpic version 2021.05.15 option -x for Fig 3.2 1200 2 6 0 0 3975 5025 6 0 0 3975 5025 @@ -17,33 +17,37 @@ Single -6 6 375 75 600 675 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 - 525 675 525 545 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 525 545 3 3 528 545 528 545 -5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 491 525 545 441 478 546 452 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 546 452 3 3 549 452 549 452 -5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 414 546 452 440 414 546 375 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 546 375 3 3 549 375 549 375 -5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 336 546 375 440 336 546 298 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 546 298 3 3 549 298 549 298 -5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 259 546 298 441 272 525 205 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 525 205 3 3 528 205 528 205 + 525 675 525 551 +6 440 205 549 556 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 525 551 3 3 528 551 528 551 +5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 496 525 551 441 483 546 458 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 546 458 3 3 549 458 549 458 +5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 419 546 458 440 419 546 381 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 546 381 3 3 549 381 549 381 +5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 342 546 381 440 342 546 303 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 546 303 3 3 549 303 549 303 +5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 265 546 303 441 278 525 211 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 525 211 3 3 528 211 528 211 +-6 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 - 525 205 525 75 + 525 211 525 86 -6 6 750 75 975 675 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 - 900 675 900 545 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 900 545 3 3 903 545 903 545 -5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 491 900 545 816 478 921 452 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 921 452 3 3 924 452 924 452 -5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 414 921 452 815 414 921 375 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 921 375 3 3 924 375 924 375 -5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 336 921 375 815 336 921 298 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 921 298 3 3 924 298 924 298 -5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 259 921 298 816 272 900 205 -1 3 0 0 0 -1 0 -1 -1 0 1 0.0 900 205 3 3 903 205 903 205 + 900 675 900 551 +6 815 205 924 556 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 900 551 3 3 903 551 903 551 +5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 496 900 551 816 483 921 458 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 921 458 3 3 924 458 924 458 +5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 419 921 458 815 419 921 381 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 921 381 3 3 924 381 924 381 +5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 342 921 381 815 342 921 303 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 921 303 3 3 924 303 924 303 +5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 265 921 303 816 278 900 211 +1 3 0 0 0 -1 0 -1 -1 0 1 0.0 900 211 3 3 903 211 903 211 +-6 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 - 900 205 900 75 + 900 211 900 86 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 790 551 790 199 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 @@ -52,20 +56,24 @@ Single 6 1125 75 1200 675 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 1200 675 1200 525 -5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1200 488 1200 525 1163 488 1200 450 +6 1162 225 1200 525 +5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1200 488 1200 525 1162 488 1200 450 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1200 413 1200 450 1163 413 1200 375 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1200 338 1200 375 1163 338 1200 300 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1200 263 1200 300 1163 263 1200 225 +-6 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 1200 225 1200 75 -6 6 1350 75 1500 675 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 1500 675 1500 525 +6 1463 225 1500 525 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1500 488 1500 525 1463 488 1500 450 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1500 413 1500 450 1463 413 1500 375 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1500 338 1500 375 1463 338 1500 300 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1500 263 1500 300 1463 263 1500 225 +-6 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 1500 225 1500 75 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 @@ -293,10 +301,12 @@ Single 6 2400 1575 2700 2025 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 2400 1575 2400 1620 +6 2400 1620 2445 1980 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2400 1665 2400 1620 2445 1665 2400 1710 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2400 1755 2400 1710 2445 1755 2400 1800 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2400 1845 2400 1800 2445 1845 2400 1890 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2400 1935 2400 1890 2445 1935 2400 1980 +-6 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 2400 1980 2400 2025 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 @@ -305,10 +315,12 @@ Single 2595 1620 2595 1980 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 2700 2025 2700 1980 +6 2655 1620 2700 1980 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2700 1935 2700 1980 2655 1935 2700 1890 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2700 1845 2700 1890 2655 1845 2700 1800 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2700 1755 2700 1800 2655 1755 2700 1710 5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2700 1665 2700 1710 2655 1665 2700 1620 +-6 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 2700 1620 2700 1575 -6 diff --git a/graphics/circuit_macros/gpic.m4 b/graphics/circuit_macros/gpic.m4 index 9a364657f7..41a5d3d394 100644 --- a/graphics/circuit_macros/gpic.m4 +++ b/graphics/circuit_macros/gpic.m4 @@ -1,7 +1,7 @@ divert(-1) gpic.m4 Initialization for gpic. -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * diff --git a/graphics/circuit_macros/lib3D.m4 b/graphics/circuit_macros/lib3D.m4 index 12f5170274..38ccc99d23 100644 --- a/graphics/circuit_macros/lib3D.m4 +++ b/graphics/circuit_macros/lib3D.m4 @@ -1,9 +1,9 @@ divert(-1) lib3D.m4 Macros for rotation, projection, and other operations on argument triples representing - 3D vectors. + 3D vectors or colors. -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * @@ -26,21 +26,36 @@ ifdef(`libgen_',,`include(libgen.m4)divert(-1)') P =( -sin(az), cos(az), 0 ) (-sin(el)cos(az),-sin(az)sin(el),cos(el))' define(`setview',` -# setview - m4azim=ifelse(`$1',,0,`$1',0,0,`prod_(`$1',dtor_)') - m4elev=ifelse(`$2',,0,`$2',0,0,`prod_(`$2',dtor_)') - m4rot =ifelse(`$3',,0,`$3',0,0,`prod_(`$3',dtor_)') - m4caz=ifelse(`$1',,1,`$1',0,1,`$1',90,0,`$1',-90, 0,cos(m4azim)) - m4saz=ifelse(`$1',,0,`$1',0,0,`$1',90,1,`$1',-90,-1,sin(m4azim)) - m4cel=ifelse(`$2',,1,`$2',0,1,`$2',90,0,`$2',-90, 0,cos(m4elev)) - m4sel=ifelse(`$2',,0,`$2',0,0,`$2',90,1,`$2',-90,-1,sin(m4elev)) - m4cro=ifelse(`$3',,1,`$3',0,1,`$3',90,0,`$3',-90, 0,cos(m4rot)) - m4sro=ifelse(`$3',,0,`$3',0,0,`$3',90,1,`$3',-90,-1,sin(m4rot)) - view3D1=m4caz*m4cel - view3D2=m4saz*m4cel - view3D3=m4sel dnl - ifdef(`setlight_',,`; light3D1=view3D1; light3D2=view3D2; light3D3=view3D3') +`# setview($@)' +define(`m4azim',ifelse(`$1',,0,prod_($1,dtor_)))dnl +define(`m4elev',ifelse(`$2',,0,prod_($2,dtor_)))dnl +define(`m4rot', ifelse(`$3',,0,prod_($3,dtor_)))dnl +define(`m4azimr',`ifelse(`$1',,0,`prod_(`$1',dtor_)')')dnl +define(`m4elevr',`ifelse(`$2',,0,`prod_(`$2',dtor_)')')dnl +define(`m4rotx',`ifelse(`$3',,0,`prod_(`$3',dtor_)')')dnl +define(`m4caz', + `ifelse(`$1',,1,`$1',0,1,`$1',90,0,`$1',-90, 0,m4cos(m4azim))')dnl +define(`m4saz', + `ifelse(`$1',,0,`$1',0,0,`$1',90,1,`$1',-90,-1,m4sin(m4azim))')dnl +define(`m4cel', + `ifelse(`$2',,1,`$2',0,1,`$2',90,0,`$2',-90, 0,m4cos(m4elev))')dnl +define(`m4sel', + `ifelse(`$2',,0,`$2',0,0,`$2',90,1,`$2',-90,-1,m4sin(m4elev))')dnl +define(`m4cro',`ifelse(`$3',,1,`$3',0,1,`$3',90,0,`$3',-90, 0,m4cos(m4rot))')dnl +define(`m4sro',`ifelse(`$3',,0,`$3',0,0,`$3',90,1,`$3',-90,-1,m4sin(m4rot))')dnl + view3D1=m4caz*m4cel;dnl + view3D2=m4saz*m4cel;dnl + view3D3=m4sel + ifdef(`setlight_',,`light3D1=view3D1; light3D2=view3D2; light3D3=view3D3') +dnl Unit vectors projected on the view plane + UPx_: project(1,0,0) + UPy_: project(0,1,0) + UPz_: project(0,0,1) +`# setview end' ') +define(`m4cos',`ifelse(`$1',0,1,cos(`$1'))') +define(`m4sin',`ifelse(`$1',0,0,sin(`$1'))') + The resulting view vector #efine(`View3D',`PtoBase3D(1,0,0)') define(`View3D',`view3D1,view3D2,view3D3') @@ -51,36 +66,45 @@ define(`Pr_xy',`$1,$2') define(`Pr_xz',`$1,$3') define(`Pr_yz',`$2,$3') - Projection coords back to orig 3D coords + Projection coords back to orig 3D coords define(`PtoBase3D', `rot3Dz(m4azim,rot3Dy(-m4elev,rot3Dx(-m4rot,`$1',`$2',`$3')))') - This does the 3D to 2D axonometric projection - i.e. project(x,y,z) produces coordinate pair - u,v on the 2D plane defined by the view angles. -define(`project', -`Pr_yz(rot3Dx(m4rot,rot3Dy(m4elev,rot3Dz(-m4azim,`$1',`$2',`$3'))))') + This does the 3D to 2D axonometric projection + i.e. project(x,y,z) produces coordinate pair + u,v on the 2D plane defined by the view angles + and Project(x,y,z) produces position (u,v) +ifdpic( +`define(`project', + `Pr_yz(rot3Dx(m4rot,rot3Dy(m4elev,rot3Dz(-m4azim,`$1',`$2',`$3'))))') + define(`Project',`(ifelse(`$1',0, + `ifelse(`$2',0,`ifelse(`$3',0,`(0,0)',UPz_*(`$3'))', + `UPy_*(`$2')`'ifelse(`$3',0,,+UPz_*(`$3'))')', + `UPx_*(`$1')`'ifelse(`$2',0,,+UPy_*(`$2'))`'ifelse(`$3',0,,+UPz_*(`$3'))'))')', +`define(`project', + `Pr_yz(rot3Dx(m4rot,rot3Dy(m4elev,rot3Dz(-m4azim,`$1',`$2',`$3'))))') + define(`Project',`(project($@))')') `Rotation about x axis rot3Dx(angle,x1,x2,x3)' -define(`rot3Dx',``$2',diff_(prod_(cos(`$1'),`$3'),prod_(sin(`$1'),`$4')),dnl - sum_(prod_(sin(`$1'),`$3'),prod_(cos(`$1'),`$4'))') +define(`rot3Dx',``$2',diff_(prod_(m4cos(`$1'),`$3'),prod_(m4sin(`$1'),`$4')),dnl + sum_(prod_(m4sin(`$1'),`$3'),prod_(m4cos(`$1'),`$4'))') `Rotation about y axis rot3Dy(angle,x1,x2,x3)' -define(`rot3Dy',`sum_(prod_(cos(`$1'),`$2'),prod_(sin(`$1'),`$4')),`$3',dnl - diff_(prod_(cos(`$1'),`$4'),prod_(sin(`$1'),`$2'))') +define(`rot3Dy',`sum_(prod_(m4cos(`$1'),`$2'),prod_(m4sin(`$1'),`$4')),`$3',dnl + diff_(prod_(m4cos(`$1'),`$4'),prod_(m4sin(`$1'),`$2'))') `Rotation about z axis rot3Dz(angle,x1,x2,x3)' -define(`rot3Dz',`diff_(prod_(cos(`$1'),`$2'),prod_(sin(`$1'),`$3')),dnl - sum_(prod_(sin(`$1'),`$2'),prod_(cos(`$1'),`$3')),`$4'') +define(`rot3Dz',`diff_(prod_(m4cos(`$1'),`$2'),prod_(m4sin(`$1'),`$3')),dnl + sum_(prod_(m4sin(`$1'),`$2'),prod_(m4cos(`$1'),`$3')),`$4'') `Cross product cross3D(x1,y1,z1,x2,y2,z2)' define(`cross3D',`diff_(prod_(`$2',`$6'),prod_(`$3',`$5')),dnl - diff_(prod_(`$3',`$4'),prod_(`$1',`$6')),dnl - diff_(prod_(`$1',`$5'),prod_(`$2',`$4'))') + diff_(prod_(`$3',`$4'),prod_(`$1',`$6')),dnl + diff_(prod_(`$1',`$5'),prod_(`$2',`$4'))') `Dot product dot3D(x1,y1,z1,x2,y2,z2)' define(`dot3D',`(sum_( - sum_(prod_(`$1',`$4'),prod_(`$2',`$5')),prod_(`$3',`$6')))') + sum_(prod_(`$1',`$4'),prod_(`$2',`$5')),prod_(`$3',`$6')))') Vector addition, subtraction, scalar product define(`sum3D',`sum_(`$1',`$4'),sum_(`$2',`$5'),sum_(`$3',`$6')') define(`diff3D',`diff_(`$1',`$4'),diff_(`$2',`$5'),diff_(`$3',`$6')') @@ -92,40 +116,41 @@ define(`dcosine3D',`(ifelse(`$1',1,`$2',`$1',2,`$3',`$4'))') define(`length3D',`sqrt((`$1')^2+(`$2')^2+(`$3')^2)') Unit vector define(`unit3D',`sprod3D(1/length3D(`$1',`$2',`$3'),`$1',`$2',`$3')') + Proportion: between3D(x,Vec1,Vec2), i.e. + Vec1 * (1-x) + Vec2 * x +define(`between3D',`sum3D(sprod3D((1-(`$1')),`$2',`$3',`$4'), + sprod3D( `$1',`$5',`$6',`$7'))') - `Assign the direction cosines to variables - assign3D([u],[v],[w],x,y,z); eg + `assign3D([u],[v],[w],x,y,z); eg assign3D(u,v,w,cross3D(x1,y1,z1,x2,y2,z2)) - assigns the 4th arg to u, the 5th to v, - and the 6th to w as u, v,or w are nonblank' -define(`assign3D', -`ifelse(`$1',,,`$1' = `$4') - ifelse(`$2',,,`$2' = `$5') - ifelse(`$3',,,`$3' = `$6')') + assigns u = 4th arg, v = 5th arg, w = 6th arg, + for nonblank u, v, or w' +define(`assign3D',`assign3($@)') + `vassign3D(name,x,y,z); eg vassign3D(u,x,y,z) - assigns u[1] to x, u[2] to y, u[3] to z' + assigns u[1] = x, u[2] = y, u[3] = z' define(`vassign3D',`for i_vassign3D = 1 to 3 do { exec sprintf("`$1'[i_vassign3D] = $%g",i_vassign3D+3) }') Write out the 3 arguments for debug define(`print3D',`print sprintf("`$1'(%g,%g,%g)",`$2',`$3',`$4')') - `setlightlight (azimuth, elevation, rotation) + `setlight (azimuth, elevation, rotation) Set angles (degrees) for 3D highlighting. Defaults are the previous values for setview(). The Light3D vector is defined as for View3D.' define(`setlight',`define(`setlight_') - m4hzim=ifelse(`$1',,m4azim,`$1',0,0,`prod_(`$1',dtor_)') - m4hlev=ifelse(`$2',,m4elev,`$2',0,0,`prod_(`$2',dtor_)') - m4hot =ifelse(`$3',,m4rot,`$3',0,0,`prod_(`$3',dtor_)') - m4chz=ifelse(`$1',0,1,`$1',90,0,`$1',-90, 0,cos(m4hzim)) - m4shz=ifelse(`$1',0,0,`$1',90,1,`$1',-90,-1,sin(m4hzim)) - m4chl=ifelse(`$2',0,1,`$2',90,0,`$2',-90, 0,cos(m4hlev)) - m4shl=ifelse(`$2',0,0,`$2',90,1,`$2',-90,-1,sin(m4hlev)) - m4cho=ifelse(`$3',0,1,`$3',90,0,`$3',-90, 0,cos(m4hot)) - m4sho=ifelse(`$3',0,0,`$3',90,1,`$3',-90,-1,sin(m4hot)) + define(`m4hzim',`ifelse(`$1',,m4azimr,`prod_(`$1',dtor_)')')dnl + define(`m4hlev',`ifelse(`$2',,m4elevr,`prod_(`$2',dtor_)')')dnl + define(`m4hot',`ifelse(`$3',,m4rotx,`prod_(`$3',dtor_)')')dnl + define(`m4chz',`ifelse(`$1',0,1,`$1',90,0,`$1',-90, 0,cos(m4hzim))')dnl + define(`m4shz',`ifelse(`$1',0,0,`$1',90,1,`$1',-90,-1,sin(m4hzim))')dnl + define(`m4chl',`ifelse(`$2',0,1,`$2',90,0,`$2',-90, 0,cos(m4hlev))')dnl + define(`m4shl',`ifelse(`$2',0,0,`$2',90,1,`$2',-90,-1,sin(m4hlev))')dnl + define(`m4cho',`ifelse(`$3',0,1,`$3',90,0,`$3',-90, 0,cos(m4hot))')dnl + define(`m4sho',`ifelse(`$3',0,0,`$3',90,1,`$3',-90,-1,sin(m4hot))')dnl light3D1=m4chz*m4chl light3D2=m4shz*m4chl light3D3=m4shl diff --git a/graphics/circuit_macros/libcct.m4 b/graphics/circuit_macros/libcct.m4 index d0c1e00d14..ed3356f4b0 100644 --- a/graphics/circuit_macros/libcct.m4 +++ b/graphics/circuit_macros/libcct.m4 @@ -1,7 +1,7 @@ divert(-1) libcct.m4 -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * @@ -71,15 +71,17 @@ CUSTOMIZATIONS: DEBUGGING: The statement print "`$0'($@)" ; inserted into a macro will display the macro name and current arguments + Similarly, the m4 macro m4msg( text ) will display the text during m4 + processing. ============================================================================== This file redefines default arrow dimensions and the dotrad_ macro. ==============================================================================' - `capacitor( linespec,[char][+],R,height,wid ) - char: - F or none: flat plates - C = polarized, curved plate + `capacitor( linespec,chars,R,height,wid ) + Arg2 chars: + [d]F or blank: flat plates; d=hatched fill + [d]C = polarized, curved plate; d=variable E = polarized rectangular plates K = filled rectangular plates M = rectangular plates @@ -88,38 +90,40 @@ DEBUGGING: The statement + = polarity sign to right of drawing dir +L =polarity sign to left arg3 = R: reversed orientation - arg4 = height (defaults F: dimen_/3 - C,P: dimen_/4, E,K: dimen_/5) - arg5 = wid (defaults F: height*0.3, - C,P: height*0.4, E,K: height) ' + arg4 = height (defaults F: dimen_/3; + C,P: dimen_/4; E,K: dimen_/5) + arg5 = wid (defaults F: height*0.3; + C,P: height*0.4; E,K: height) ' define(`capacitor', - `ifelse(`$3',R,`reversed(`capacitor',`$1',`$2',,shift(shift(shift($@))))', +`ifelse(`$3',R,`reversed(`capacitor',`$1',`$2',,shift(shift(shift($@))))', `eleminit_(`$1') - define(`m4ctype',ifelse(`$2',,F,`$2',+,F,`$2',+L,F,`$2'))dnl - m4_dna(`m4ctype',+L)`'m4_dna(`m4ctype',+)dnl - { ifelse(m4ctype,F, + define(`dna_',`ifelse(`$2',,F,`$2')')dnl + { sc_draw(`dna_',F, `define(`m4cht',`ifelse(`$4',,`dimen_/3',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht*0.3',`($5)')')dnl line to rvec_(rp_len/2-m4cwd/2,0) {line from rvec_(0,-m4cht/2) \ to rvec_(0,m4cht/2)} + ifelse(m4a,d,`for_(1,3,1,{line from rvec_(0,m4cwd*(m4x-5/2)) \ + to rvec_(m4cwd,m4cwd*(m4x-3/2))})') move to rvec_(m4cwd,0) {line from rvec_(0,-m4cht/2) \ to rvec_(0,m4cht/2)} - line to rvec_(rp_len/2-m4cwd/2,0) ', - m4ctype,C, + line to rvec_(rp_len/2-m4cwd/2,0) ') + sc_draw(`dna_',C, `define(`m4cht',`ifelse(`$4',,`dimen_/4',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht*0.4',`($5)')')dnl define(`m4cr',`dimen_*0.25')dnl line to rvec_(rp_len/2-m4cwd/2,0) {line from rvec_(0,-m4cht/2) \ to rvec_(0,m4cht/2)} - {arc cw from rvec_(m4cwd,-m4cht/2) \ + {arc cw ifelse(m4a,d,-> wid lthick*4 ht lthick*4) \ + from rvec_(m4cwd,-m4cht/2) \ to rvec_(m4cwd,m4cht/2) \ with .c at rvec_(m4cwd+sqrt((m4cr)^2-(m4cht/2)^2),0) } line from last arc.c+vec_(-m4cr,0) \ - to rvec_(rp_len/2+m4cwd/2,0) ', - m4ctype,P, + to rvec_(rp_len/2+m4cwd/2,0) ') + sc_draw(`dna_',P, `define(`m4cht',`ifelse(`$4',,`dimen_/4',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht*0.4',`($5)')')dnl define(`m4cr',`dimen_*0.25')dnl @@ -131,8 +135,8 @@ define(`capacitor', {line from rvec_(m4cwd*2/3,-m4cht*3/8) \ to rvec_(m4cwd*2/3,m4cht*3/8)} line from rvec_(m4cwd*2/3,0) \ - to rvec_(rp_len/2+m4cwd/2,0) ', - m4ctype,E, + to rvec_(rp_len/2+m4cwd/2,0) ') + sc_draw(`dna_',E, `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht',`($5)')')dnl define(`m4cs',`(m4cwd/3.2)')dnl @@ -142,8 +146,8 @@ define(`capacitor', move to rvec_(m4cwd,0) {ifsvg(`lbox(-m4cs,m4cht,fill_(0))',`m4fshade(m4fill,lbox(-m4cs,m4cht))')} linethick_(m4linethicktemp) - line to rvec_(rp_len/2-m4cwd/2,0) ', - m4ctype,M, + line to rvec_(rp_len/2-m4cwd/2,0) ') + sc_draw(`dna_',M, `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht',`($5)')')dnl define(`m4cs',`(m4cwd/3.2)')dnl @@ -153,8 +157,8 @@ define(`capacitor', move to rvec_(m4cwd,0) { lbox(-m4cs,m4cht) } linethick_(m4linethicktemp) - line to rvec_(rp_len/2-m4cwd/2,0) ', - m4ctype,K, + line to rvec_(rp_len/2-m4cwd/2,0) ') + sc_draw(`dna_',K, `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht',`($5)')')dnl define(`m4cs',`(m4cwd/3.2)')dnl @@ -162,8 +166,8 @@ define(`capacitor', {ifsvg(`lbox(m4cs,m4cht,fill_(0))',`m4fshade(m4fill,lbox(m4cs,m4cht))')} move to rvec_(m4cwd,0) {ifsvg(`lbox(-m4cs,m4cht,fill_(0))',`m4fshade(m4fill,lbox(-m4cs,m4cht))')} - line to rvec_(rp_len/2-m4cwd/2,0) ', - m4ctype,N, + line to rvec_(rp_len/2-m4cwd/2,0) ') + sc_draw(`dna_',N, `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht*2/3',`($5)')')dnl define(`m4cs',`(m4cwd/3.2*3/2)')dnl @@ -195,9 +199,10 @@ define(`capacitor', Q=offset H=squared N=IEEE (default) + B=not burnable V=varistor variant R=to right of drawing direction - arg4: cycle width, default dimen_/6' + arg4: cycle width (default dimen_/6)' define(`resistor', `define(`m4h',`ifelse(`$4',,`dimen_/6',`($4)')/4')dnl ifinstr( @@ -257,6 +262,12 @@ define(`resistor', then to last line.end [box invis ht_ m4hh*m4v wid_ m4hh*m4n*2] at 2nd last line.c+(0,m4hh*m4v/2) }') + sc_draw(`dna_',B, + `resistor(`$1',`$2',dna_,`$4'); M4LBC: last line.c + m4lbwd = last [].wid_+lthick*2; m4lbht = last [].ht_+lthick*2 + [lbox(m4lbwd,m4lbht,thick 0.4)] with .c at M4LBC + [lbox(m4lbwd+2bp__,m4lbht+2bp__,thick 0.4)] with .c at M4LBC ') +# line invis from 2nd last line.start to 2nd last line.end ')') define(`M4_varistor',`eleminit_(`$1') @@ -361,13 +372,29 @@ ifelse(`$2',,`undefine(`m4tap_x')popdef(`m4type')popdef(`m4name')', m4name`'m4tap_x: Here } addtaps(,shift(shift(shift($@))))')') - `tapped(`two-terminal element',[. | <- | -> | <->], + `tapped(`two-terminal element', . | <- | -> | <-> , fractional pos, length, fractional pos, length,...) Draw the two-terminal element and taps in a [] block' define(`tapped',`[ $1 Start: last line.start; End: last line.end; C: last line.c addtaps(shift($@)) ]') + `shielded(`two-terminal element',L|U, line attributes ) + L= shield left half (wrt drawing direction) + R= shield right half (default both halves)' +define(`shielded',`[ $1 + Start: last line.start; End: last line.end; C: last line.c + W: last line.c - vec_(last [].wid_/2+dimen_/8,0) + E: last line.c + vec_(last [].wid_/2+dimen_/8,0) + NW: last [].nw_ + vec_(-dimen_/8,dimen_/8) + NE: last [].ne_ + vec_(dimen_/8,dimen_/8) + SE: last [].se_ + vec_(dimen_/8,-dimen_/8) + SW: last [].sw_ + vec_(-dimen_/8,-dimen_/8) + ifinstr(`$2',L,`line from W to NW then to NE then to E dashed `$3'', + `$2',R,`line from W to SW then to SE then to E dashed `$3'', + `line from W to NW then to NE then to SE then to SW then to W dashed `$3'') + `$4']') + `b_current( label, above_|below_, O[ut], S[tart]|E[nd], frac ) Branch current for last-drawn element. The arrowhead @@ -402,78 +429,81 @@ define(`rarrow',`define(`m4h',`min(lin_leng(last line),linewid)/2')dnl to last [].s_+vec_(m4h,-m4v) \ m4lstring(`$1',"sp_`iflatex(`$ `$1'$',` $1')'sp_") below_}') - `inductor( linespec,W|L,cycles,M|P,loop wid ) + `inductor( linespec, W|L, cycles, M|P|K[n], + loop wid ) W=wide arcs (default narrow); L=looped arcs - M=metal core; P=powder core - loop wid defaults W,L: dimen_/5, - other: dimen_/8' + arg4= M[n]=metal core + P[n]=(ferrite) powder core (dashed lines) + K[n]=long-dashed core lines + n=integer (default 2 lines) + arg5 loop wid defaults W,L: dimen_/5, + other: dimen_/8' define(`inductor',`eleminit_(`$1') define(`m4hlw',`ifelse(`$5',,`dimen_/10',`($5)/2')')dnl half loop wid define(`m4n',`ifelse(`$3',,4,`$3')')dnl - ifelse(`$2',W, - `m4Inductor', - `$2',L, - `m4Lnductor', - `m4inductor(,ifelse(`$5',,,`($5)/2'))') - ifelse(ifelse(`$4',M,T,`$4',P,T),T,`m4m_core(rvec_(rp_len/2,0), - m4wd,m4ht+dimen_/24,dimen_/16,ifelse(`$4',P,dashed m4wd/(2*m4n+1))) - define(`m4hs',`(dimen_/24+dimen_/16)')',`define(`m4hs',0)') - {[box invis ht_ m4ht+m4hs+m4dp wid_ m4wd] \ - at rvec_(rp_len/2,(m4ht+m4hs-m4dp)/2)} + ifelse(`$2',W, `define(`m4wd',((2*m4n-2)*m4c2t+2)*m4hlw)', + `$2',L, `define(`m4wd',(m4n+1)*m4hlw)', + `define(`m4ht',`ifelse(`$2',,`dimen_/16',`$2')')define(`m4wd',m4n*m4ht*2)') + { line to rvec_((rp_len-m4wd)/2,0) + ifelse(`$2',W,`m4Ibody', `$2',L,`m4Lbody', `m4ibody') with .S at Here + line from last [].E to last [].E+vec_((rp_len-m4wd)/2,0) } + ifelse(ifinstr(`$4',M,T,`$4',P,T,`$4',K,T),T, + `define(`m4nL',ifelse(len(`$4'),1,2,substr(`$4',1)))dnl + define(`m4hs',`(dimen_/24+(m4nL-1)*dimen_/16)')dnl + m4m_core(rvec_(rp_len/2,0), m4wd, m4ht+dimen_/24, dimen_/16, + ifinstr( `$4',P,`dashed m4wd/(2*m4n+1)', + `$4',K,`dashed m4wd/(2*m4n+1)*3'), m4nL) + {[box invis ht_ m4ht+m4hs+m4dp wid_ m4wd] \ + at rvec_(rp_len/2,(m4ht+m4hs-m4dp)/2)}') line to rvec_(rp_len,0) invis ') - `Wide loop inductor' -define(`m4Inductor',`define(`m4ht',`(1+m4st)*m4hlw')dnl - define(`m4dp',`(m4s2t-m4st)*m4hlw')define(`m4wd',((2*m4n-2)*m4c2t+2)*m4hlw)dnl - { line to rvec_(rp_len/2-((m4n-1)*m4c2t+m4ct)*m4hlw,0); round - arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4st-m4s2t)) \ - with .c at rvec_(vscal_(m4hlw,m4ct,m4st)); round - for m4i=3 to m4n do { arc cw from Here to rvec_(vscal_(m4hlw,2*m4c2t,0)) \ - with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round } - arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4s2t-m4st)) \ - with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round - line to rvec_(rp_len/2-((m4n-1)*m4c2t+m4ct)*m4hlw,0) } ') + `Wide loop inductor body' +define(`m4Ibody',`define(`m4ht',`(1+m4st)*m4hlw')dnl + define(`m4dp',`(m4s2t-m4st)*m4hlw')dnl + [S: Here; round + arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4st-m4s2t)) \ + with .c at rvec_(vscal_(m4hlw,m4ct,m4st)); round + for m4i=3 to m4n do { arc cw from Here to rvec_(vscal_(m4hlw,2*m4c2t,0)) \ + with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round } + arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4s2t-m4st)) \ + with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round + E: Here] ') define(`m4ct',`Cos(25)')define(`m4st',`Sin(25)') define(`m4c2t',`Cos(50)')define(`m4s2t',`Sin(50)') - `Looped inductor' -define(`m4Lnductor',`define(`m4ht',`m4hlw*10/8')dnl - define(`m4dp',`m4hlw/2')define(`m4wd',(m4n+1)*m4hlw)dnl - { line to rvec_(rp_len/2-m4wd/2,0); round + `Looped inductor body' +define(`m4Lbody',`define(`m4ht',`m4hlw*10/8')define(`m4dp',`m4hlw/2')dnl + [ S: Here; round spline ifdpic(0.55) \ - to rvec_(0,m4ht) for_(1,m4n,1,`\ - then to rvec_((m4x+0.3)*m4hlw, m4ht) \ - then to rvec_((m4x+0.3)*m4hlw,-m4dp) \ - then to rvec_((m4x-0.3)*m4hlw,-m4dp) \ - then to rvec_((m4x-0.3)*m4hlw, m4ht)\')\ - then to rvec_(m4wd,m4ht) \ - then to rvec_(m4wd,0) - round; line to rvec_(rp_len/2-m4wd/2,0) }') - `Narrow inductor' -define(`m4inductor',`define(`m4ht',`ifelse(`$2',,`dimen_/16',`$2')')dnl - define(`m4dp',0)define(`m4wd',m4n*m4ht*2)dnl + to rvec_(0,m4ht) for_(1,m4n,1,`\ + then to rvec_((m4x+0.3)*m4hlw, m4ht) \ + then to rvec_((m4x+0.3)*m4hlw,-m4dp) \ + then to rvec_((m4x-0.3)*m4hlw,-m4dp) \ + then to rvec_((m4x-0.3)*m4hlw, m4ht) \')\ + then to rvec_(m4wd,m4ht) \ + then to rvec_(m4wd,0); round; E: Here ] ') + `Narrow inductor body' +define(`m4ibody',`define(`m4dp',0)dnl ifelse(ifpstricks(T)`'ifmpost(T)`'ifpgf(T)`'ifsvg(T),T, `define(`m4y')',`undefine(`m4y')')dnl - { line to rvec_((rp_len-m4wd)/2,0) - ifdef(`m4y',`{line to rvec_(0,-hlth)};') - for m4i=1 to m4n do { - arc cw from Here to rvec_(m4ht*2,0) with .c at rvec_(m4ht,0) - ifdef(`m4y',`{line to rvec_(0,-hlth)}') } - line to rvec_((rp_len-m4wd)/2,0)} ') - - `m4m_core(bottom ctr, length, ht offset, - separation,linetype) - Two lines for the metal core' -define(`m4m_core',`dnl - {M4Core1: line from `$1'+vec_(-(`$2')/2,`$3') \ - to `$1'+vec_( (`$2')/2,`$3') `$5' - M4Core2: line from M4Core1.start+vec_(0,`$4') \ - to M4Core1.end+vec_(0,`$4') `$5'}') + [ S: Here; ifdef(`m4y',`{line to rvec_(0,-hlth)};') + for m4i=1 to m4n do { + arc cw from Here to rvec_(m4ht*2,0) with .c at rvec_(m4ht,0) + ifdef(`m4y',`{line to rvec_(0,-hlth)}') }; E: Here ] ') + `m4m_core(bottom center, length, ht offset, + separation, linetype, nlines) + nlines=lines for the metal core' +define(`m4m_core',`for_(1,`$6',1,`{M4Core`'m4x: line \ + from `$1'+vec_(-(`$2')/2,`$3'+(`$4')*(m4x-1)) \ + to `$1'+vec_( (`$2')/2,`$3'+(`$4')*(m4x-1)) `$5''})') `transformer( linespec, L|R, np, - [A|P][W|L][D1|D2|D12|D21], ns ) + [A|M[n]|P[n]|K[n]][W|L][D1|D2|D12|D21], ns ) 2-winding transformer or choke: np = number of primary arcs ns = number of secondary arcs - A = air core; P = powder (dashed) core + A = air core; + M[n] = metal core (default); n=number of lines + P[n] = powder (dashed) core + K[n] = long dashed core W = wide windings; L = looped windings D1: phase dots at P1 and S1 ends; D2: dots at P2 and S2 ends; D12: dots at P1 and S2 @@ -494,9 +524,12 @@ define(`transformer', `[ P1: Here define(`m4drt',m4dir) m4ns*m4ht*2)')dnl ifinstr(`$4',A, `move to last line.c+vec_(0,m4ht*ifelse(m4WL,W,3,m4WL,L,3,4))', - `m4m_core(rvec_(-(rp_len/2),0),max(m4wd,m4t),m4ht+dimen_/12,dimen_/8, - ifinstr(`$4',P,dashed m4wd/(2*m4n+1))) - move to last line.c+vec_(0,m4ht+dimen_/12)') + `define(`m4LL',`regexp(`$4',[MPK]\([0-9][0-9]*\),\1)')dnl + define(`m4nL',`ifelse(m4LL,,2,m4LL)')dnl + m4m_core(rvec_(-(rp_len/2),0), max(m4wd,m4t), m4ht+dimen_/12, dimen_/8, + ifinstr( `$4',P,`dashed m4wd/(2*m4n+1)', + `$4',K,`dashed m4wd/(2*m4n+1)*3'), m4nL) + move to last line.c+vec_(0,m4ht+dimen_/12) ') TS: Here S2: rvec_( ifelse(`$2',R,-)(ifelse(`$5',,rp_len/2,m4t/2)), 0 ) S1: 2 between S2 and Here @@ -662,19 +695,28 @@ define(`source',`ifelse(`$4',R, to rvec_(m4v,m4v)}', `{$2}' ) line from rvec_(m4h,0) \ - to rvec_(rp_len/2,0)} ') - { [box invis ht_ m4h*2 wid_ m4h*2] at rvec_(rp_len/2,0) } + to rvec_(rp_len/2,0)} + { [box invis ht_ m4h*2 wid_ m4h*2] at rvec_(rp_len/2,0) } ') line to rvec_(rp_len,0) invis ')') `Internal to source macro:' define(`m4_sourceGQ', -`{ line to rvec_(rp_len/2-3/2*m4h,0) - {[C1: circle rad m4h - L: C1+vec_(m4h/2, m4h*sqrt(3)/2) - R: C1+vec_(m4h/2,-m4h*sqrt(3)/2) - C2: ifelse(`$2',G,`circle rad m4h',`arc rad m4h from R to L') \ - with .c at C1 +vec_(m4h,0)] at rvec_(m4h*3/2,0)} - line from rvec_(m4h*3,0) \ - to rvec_(rp_len/2+3/2*m4h,0) } ') + `m4sv = m4h*2/3 + m4sh = sqrt((m4h)^2-m4sv^2) + { line to rvec_(rp_len/2-(m4h+m4sh),0) + {Body:[ Cx: rvec_(m4h,0) + ifelse(`$5',,,`{circle invis rad m4h `$5' with .c at Cx}') + L: Cx+vec_(m4sh, m4sv) + R: Cx+vec_(m4sh,-m4sv) + M1: Cx+vec_(-(m4h-m4sh)*3/5,0) + ifelse(`$5',,, + `{circle invis rad m4h `$5' with .c at Cx+vec_(m4sh*2,0)}') + C1: circle rad m4h with .c at Cx + C2: ifelse(`$2',G,`circle rad m4h',`arc rad m4h from R to L') \ + with .c at C1 +vec_(m4sh*2,0) + M2: C2+vec_((m4h-m4sh)*3/5,0) + ] at rvec_(m4h+m4sh,0)} + line from rvec_((m4h+m4sh)*2,0) \ + to rvec_(rp_len/2+(m4h+m4sh),0) } ') `ttmotor( linespec, string, diameter, brushwid, brushht )' define(`ttmotor',`eleminit_(`$1') @@ -1051,10 +1093,10 @@ define(`tbreaker',`eleminit_(`$1') define(`m4ho',0) m4j = max(0,rp_len/2-m4h/2) line to rvec_(m4j,0) {round - arc cw to rvec_( m4h/4,0)+vec_(Rect_(m4h/4,-60)) with .c at rvec_( m4h/4,0)} + arc cw to rvec_( m4h/4,0)+vec_(Rect_(m4h/4,-75)) with .c at rvec_( m4h/4,0)} move to rvec_(m4h,0) {round - arc cw to rvec_(-m4h/4,0)+vec_(Rect_(m4h/4,120)) with .c at rvec_(-m4h/4,0)} + arc cw to rvec_(-m4h/4,0)+vec_(Rect_(m4h/4,105)) with .c at rvec_(-m4h/4,0)} line to rvec_(m4j,0) ') } {[box invis ht_ m4v wid_ m4h ] at rvec_(rp_len/2,ifelse(`$2',R,-)m4ho) } @@ -1101,7 +1143,7 @@ define(`arrowline',`line ifelse(`$1',,`to rvec_(elen_,0)',`$1') T=truncated stem; N=normal ground, F=frame, S=signal, L=low-noise, P=protective, E=European; PA=protective alternate - down (default), up, left, right, angle (deg)' + Down (default), Up, Left, Right, angle (deg)' define(`ground',`box invis ht 0 wid 0 with .c ifelse(`$1',,`at Here',`$1') define(`m4v',`dimen_/6')define(`m4h',`dimen_/16')dnl {setdir_(ifelse(`$4',,-90,`$4')) @@ -1217,7 +1259,8 @@ define(`antenna',`[ T: Here then to rvec_(m4v*3/4,-m4v*sqrt(3)/4) } line from rvec_(m4v*3/4,0) \ to T') - `$5'; resetdir_ ] with .T ifelse(`$1',,`at Here',`$1')') + `$5'; resetdir_ ] with .T ifelse(`$1',,`at Here',`$1') + move to last [].T') `switch( linespec,L|R,[O|C][D],L|B|D ) Wrapper for bswitch, lswitch, dswitch @@ -1540,7 +1583,7 @@ define(`integrator',`eleminit_(`$1') - label, + label, size, chars) drawn as a []: defined positions: - W, N, E, S, Out, E1, E1, In1, In2 + W, N, E, S, Out, E1, E2, In1, In2 chars: P: power connections V1,V2 R: labels at In1,In2 swapped @@ -1561,8 +1604,8 @@ define(`dna_',`$5')dnl `line to N then to E then to S then to W; move to E') if rp_len > m4h then { line to rvec_(rp_len-m4h,0) } Out: Here } - E1: vec_(m4h/2,m4v/4) - E2: vec_(m4h/2,-m4v/4) + NE: vec_(m4h/2,m4v/4); E1: NE + SE: vec_(m4h/2,-m4v/4); E2: SE In1: vec_(0,m4v/4) In2: vec_(0,-m4v/4) { move to In`'ifinstr(dna_,R,2,1) @@ -2255,10 +2298,11 @@ E: Bulk.c+vec_(2*m4_U,ifelse(`$2',R,-)3.5*m4_U) e_fet(linespec, R, P, E|S ) d_fet(linespec, R, P, E|S ) c_fet(linespec, R, P ) + g_fet(linespec, R, P, shade spec ) with terminals S, D, G. arg 2: G pin drawn to right of curr direction arg 3: P-channel, default N - arg 4: envelope' + arg 4: envelope or simplified' define(`j_fet',`mosfet(`$1',`$2',ifelse(`$3',P,u,d)GSDF,`$4',`$5')') `Enhancement-mode FET e_fet(linespec,R,P,S,E)' define(`e_fet',`mosfet(`$1',`$2', @@ -2268,20 +2312,31 @@ define(`e_fet',`mosfet(`$1',`$2', define(`d_fet',`mosfet(`$1',`$2', ifelse(`$4',S,`TFDR'ifelse(`$3',P,u,d)S,`LFDSQ'ifelse(`$3',P,d,u)B), `$4',`$5')') - `Simplified switching c_fet(linespec,R,P) + `Simplified switching c_fet(linespec,R,P) arg 3: negated G pin' define(`c_fet',`mosfet(`$1',`$2',`ZSDF'ifelse(`$3',P,d)T,,`$4')') + `Graphene FET g_fet(linespec,R,P,shadespec)' +define(`g_fet',`mosfet(`$1',`$2',ifinstr(`$3',P,d,u)SKTF,`$4',`$5') ') + + `Fe_fet(linespec,R,chars) FET with + superimposed ferroelectric symbol: + arg1, arg2, arg3 are as for mosfet' +define(`Fe_fet',`mosfet(`$1',`$2',ifelse(`$3',,SDFT,`$3'),, + variable(,NN,60,dimen_/3, + at (0.5 between S and D)+vec_(0,ifelse(`$2',R,-)4*m4_U)); `$4')') + ` The comprehensive mosfet(linespec,R,BDEFGLQRSTXZ,E) Every drawn component is controlled by a letter or letter pair in arg 3; adding or changing elements is easily done by adding a test for a letter - or letter sequence: + or letter sequence. The modifiers u and d are optional: udB: center bulk connection pin; u or d arrow D: D pin and lead E: dashed substrate F: solid-line substrate udG: G pin to substrate at source; u or d arrow udH: G pin to substrate at center; u or d arrow + K: graphene hexagon L: G pin to channel (kept for compatibility for now; the same as dM below) udM: G pin to channel center or @@ -2301,13 +2356,23 @@ define(`mosfet', `define(`m4R',`ifelse(`$2',R,-)')dnl right orientation flag define(`dna_',`ifelse(`$3',,DSEdMuBQ,`$3')')dnl define(`m4s',ifinstr(dna_,Z,2.5,3.5))dnl size parameter + define(`m4hs',2.5)define(`m4hhx',m4hs*sqrt(3))dnl hex side len + define(`m4K',ifinstr(dna_,K,K))dnl [ ifelse(`$1',, - `tr_xy_init(,m4_U,m4R); S: tr_xy(-2,0); D: tr_xy(2,0)', + `tr_xy_init(,m4_U,m4R); ifinstr(dna_,K, + `S: tr_xy(-m4hs,0); D: tr_xy(m4hs,0); W: S; E: D + tr_xy_init(tr_xy(0,m4hhx/2-m4s),m4_U,m4R)', + `S: tr_xy(-2,0); D: tr_xy(2,0)')', `eleminit_(`$1'); tr_xy_init(last line.c,m4_U,m4R) - S: last line.start; line from S to tr_xy(-2,0) \ - then to tr_xy(-2,0)+vec_(0,m4R`'linethick pt__) - D: S+vec_(rp_len,0); line from D to tr_xy(2,0) \ - then to tr_xy(2,0)+vec_(0,m4R`'linethick pt__)') + ifinstr(dna_,K, + `S: last line.start; D: last line.end; + W: tr_xy(-m4hs,0); line from S to W + E: tr_xy( m4hs,0); line from D to E + tr_xy_init(tr_xy(0,m4hhx/2-m4s),m4_U,m4R)', + `S: last line.start; line from S to tr_xy(-2,0) \ + then to tr_xy(-2,0)+vec_(0,m4R`'linethick pt__) + D: S+vec_(rp_len,0); line from D to tr_xy(2,0) \ + then to tr_xy(2,0)+vec_(0,m4R`'linethick pt__)')') sc_draw(`dna_',B, `B: tr_xy(0,0); Bl: line from B to tr_xy(0,m4s) ifelse(m4a,,,`arrow m4c_l ht m4_Aht wid m4_Awd ifelse(m4a,d,<-) \ @@ -2349,6 +2414,13 @@ define(`mosfet', to G; arrow m4c_l ht m4_Aht wid m4_Awd \ from tr_xy(0,(m4s+3-m4_Aht/(m4_U))) \ to tr_xy(0,(m4s+3))')') + sc_draw(`dna_',K, + `NW: W+ta_xy( m4hs/2, m4hhx/2) + SW: W+ta_xy( m4hs/2,-m4hhx/2) + SE: E+ta_xy(-m4hs/2,-m4hhx/2) + NE: E+ta_xy(-m4hs/2, m4hhx/2) + Kl: line from NW \ + to W then to SW then to SE then to E then to NE then to NW `$4'') sc_draw(`dna_',L, `G: tr_xy(-2,(m4s+3.5)) Ll: line from tr_xy(2,(m4s+1)) \ @@ -2391,18 +2463,20 @@ define(`mosfet', `Rl: line thick 2*linethick from tr_xy(-2,m4s)\ -vec_(0,m4R`'linethick*3/2 pt__) \ to tr_xy(2,m4s)-vec_(0,m4R`'linethick*3/2 pt__) ') - sc_draw(`dna_',S, + sc_draw(`dna_',S,`ifelse(m4K,K, + `Sl: arrow m4c_l ht m4_Aht*2/3 wid m4_Awd \ + from ifelse(m4a,u,NW to W,W to NW)', `Sl: line from tr_xy(-2,0) \ to tr_xy(-2,m4s) ifelse(m4a,,,`arrow m4c_l ht m4_Aht wid m4_Awd ifelse(m4a,d,<-) \ from tr_xy(-2,m4s/2)-vec_(0,m4R`'m4_Aht/2) \ - to tr_xy(-2,m4s/2)+vec_(0,m4R`'m4_Aht/2) ')') + to tr_xy(-2,m4s/2)+vec_(0,m4R`'m4_Aht/2) ')')') sc_draw(`dna_',T, `Tl: line from tr_xy(-2,(m4s+1)) \ to tr_xy(2,(m4s+1)) ifelse(m4a,d,`Nt: circle rad m4_U*2/3 with .c at tr_xy(0,(m4s+1+2/3))') Gl: line from tr_xy(0,`(m4s+1'`ifelse(m4a,d,+4/3))') \ - to tr_xy(0,ifelse(`$4',E,(m4s+4),(m4s+4))); G: Here') + to tr_xy(0,(m4s+4)); G: Here') sc_draw(`dna_',X,dnl From Matteo Agostinelli `B: tr_xy(0,0); Xv: line from B to tr_xy(0,m4s-1) Xh: line from tr_xy(-1.5,m4s-1) \ @@ -2442,31 +2516,37 @@ define(`$1',substr($1,0,m4I_)`'substr($1,m4t))')')dnl sc_draw(dna string, chars, iftrue, iffalse)' define(`sc_draw',`m4_dna(`$1',`$2')ifelse(m4I_,-1,`$4',`$3')') - `Element labels to the left, right, centre of - the current direction. Labels are spaced and - treated as math, but copied literally if double - quoted or defined by sprintf' + `Element labels at the start, centre, and end + of the last [] block (or a named [] block) + in the current direction. Labels are + spaced and treated as math, but copied + literally if double quoted or defined + by sprintf. + Arg4 can be above, below, left, right + to supplement the default position. + Arg5 is the optional name of a [] block + and is last [] by default.' `The hash (pound sign) is used in svg text so we temporarily turn off comments for svg' define(`rlabel',`ifsvg(`changecom(,)')dnl -m4label(`$1',`$2',`$3',.s_,below_,`$4')`'ifsvg(`changecom(`#',)')') +m4label(`$1',`$2',`$3',.s_,below_,`$4',`$5')`'ifsvg(`changecom(`#',)')') define(`llabel',`ifsvg(`changecom(,)')dnl -m4label(`$1',`$2',`$3',.n_,above_,`$4')`'ifsvg(`changecom(`#',)')') +m4label(`$1',`$2',`$3',.n_,above_,`$4',`$5')`'ifsvg(`changecom(`#',)')') define(`clabel',`ifsvg(`changecom(,)')dnl -m4label(`$1',`$2',`$3',,,`$4')`'ifsvg(`changecom(`#',)')') +m4label(`$1',`$2',`$3',,,`$4',`$5')`'ifsvg(`changecom(`#',)')') labels at centre and both ends of an element `dimen_' long define(`m4label',`dnl ifelse(`$1',,, `{m4lstring(`$1',"sp_`'iflatex(`$ `$1'$',`$1')`'sp_") \ - at last [].w_ $5 rjust_ $6};')dnl + at ifelse(`$7',,last [],`$7').w_ $5 rjust_ $6};')dnl ifelse(`$2',,, `{m4lstring(`$2',"sp_`'iflatex(`$ `$2'$',`$2')`'sp_") \ - at last []$4 $5 $6};')dnl + at ifelse(`$7',,last [],`$7')$4 $5 $6};')dnl ifelse(`$3',,, `{m4lstring(`$3',"sp_`'iflatex(`$ `$3'$',`$3')`'sp_") \ - at last [].e_ $5 ljust_ $6};')dnl + at ifelse(`$7',,last [],`$7').e_ $5 ljust_ $6};')dnl ') `dlabel(long,lateral,label,label,label,chars) Labels for oblique or aligned elements @@ -2625,7 +2705,6 @@ define(`series_', popdef(`elen_')] with .Start at Here; move to last [].End ') - `reversed(`macro name in quotes', macro args) reverse polarity of two-terminal element' define(`reversed',`eleminit_(`$2') @@ -2638,33 +2717,43 @@ define(`reversed',`eleminit_(`$2') define(`resized',`define(`m4resiztmp',dimen_)define(`dimen_',(dimen_)*(`$1'))dnl $2(shift(shift($@))) define(`dimen_',m4resiztmp)') - `variable(`element', type, angle, length) + `variable(`element', type, [+|-]angle, + length, at position) overlaid arrow or line on two-terminal element to show variablility: type = [A|P|L|[u]N|[u]NN][C|S] - A=arrow, P=preset, L=linear, N=nonlinear, - NN=symmetric nonlinear, u changes direction, - C=continuous, S=setpwise' + A=arrow; P=preset; L=linear; N=nonlinear; + NN=symmetric nonlinear, u changes direction; + C=continuous; S=setpwise. + If arg3 begins with + or -, then the argument + (typically -45) is relative to the current + drawing angle. If arg5 is blank the symbol + is placed over the last []' define(`variable',`$1 - {[ define(`dna_',`ifelse($2,,A,$2)') ang = ifelse(`$3',,45,`$3') - M4_T: Here+(Rect_(ifelse(`$4',,`dimen_*0.8',`$4'),ang)) - sc_draw(`dna_',P,`Line: line to M4_T - [line to (Rect_(dimen_/6,ang-90))] at Line.end') - sc_draw(`dna_',L,`Line: line to M4_T') - sc_draw(`dna_',NN,`Line: ifelse(m4a,u, - `line from Here-(dimen_/6,0) to Here \ - then to M4_T then to M4_T+(dimen_/6,0)', - `line from Here-(0,dimen_/6) to Here \ - then to M4_T then to M4_T+(0,dimen_/6)') ') - sc_draw(`dna_',N,`Line: line to M4_T - ifelse(m4a,u,`line up dimen_/6 from Line.end', - `line left dimen_/6 from Line.start')') - sc_draw(`dna_',A,`Line: arrow to M4_T') - sc_draw(`dna_',C,`move to Line.end+(dimen_*0.10,-dimen_*0.06) - line to Here+(Rect_(dimen_/6,ang))') - sc_draw(`dna_',S,`move to Line.end+(dimen_*0.10,-dimen_*0.12) + {[ define(`dna_',ifelse($2,,A,$2))define(`m4sgn',regexp(`$3',^ *[+-]))dnl + ang = ifelse(m4sgn,-1,,rp_ang*rtod_) ifelse(`$3',,45,`$3') + define(`m4a2',`ifelse(m4sgn,0,rp_ang-pi_/2,0)') dnl + define(`m4a3',`ifelse(m4sgn,0,rp_ang,pi_/2)') dnl + define(`m4tip',`dimen_/8')dnl + T: (Rect_(ifelse(`$4',,`dimen_*0.8',`$4'),ang)) + sc_draw(`dna_',P,`Line: line to T; C: Line.c + [line to (Rect_(m4tip,ang-90))] at Line.end') + sc_draw(`dna_',L,`Line: line to T; C: Line.c') + sc_draw(`dna_',NN,`C: 1/2 between Here and T + ifelse(m4a,u,`Line: line from Here+(rect_(-m4tip,m4a3)) to Here \ + then to T then to T+(rect_( m4tip,m4a3))', + `Line: line from Here+(rect_(-m4tip,m4a2)) to Here \ + then to T then to T+(rect_( m4tip,m4a2))')') + sc_draw(`dna_',N,`C: 1/2 between Here and T + ifelse(m4a,u,`Line: line to T then to T+(rect_(m4tip,m4a3))', + `Line: line from T to Here \ + then to Here+(rect_(-m4tip,m4a2))')') + sc_draw(`dna_',A,`Line: arrow to T; C: Line.c') + sc_draw(`dna_',C,`move to T+(dimen_*0.10,-dimen_*0.06) + line to Here+(Rect_(m4tip,ang))') + sc_draw(`dna_',S,`move to T+(dimen_*0.10,-dimen_*0.12) line up dimen_*0.06 then right dimen_*0.12 then up dimen_*0.06') - `$5'] with .Line.c at last [].c } ') + `$6'] with .C ifelse(`$5',,at last [].c,`$5') } ') `Line hopping over named lines, diverting left or right: @@ -2852,8 +2941,9 @@ define(`contact',`[ dnl ') `$3'] ') + `relaycoil( chars, wid, ht, U|D|L|R|degrees ) - chars: + chars: (see IEC 60617 S00305 - S00319) X or default: external lines from A2 and B2 AX external lines at positions A1,A3 BX external lines at positions B1,B3 @@ -2862,10 +2952,11 @@ define(`contact',`[ dnl SOR slow operating and release SR slow release HS high speed - HS high speed NAC unaffected by AC current AC AC current ML mechanically latched + MR mechanically resonant + PC pulse counter PO polarized RM remanent RH remanent @@ -2902,11 +2993,11 @@ define(`relaycoil',`[ ifelse(`$4',,,`setdir_(`$4')') {line to rvec_(0,-m4ht/8)} {line from rvec_(m4wd,0) to rvec_(m4wd,-m4ht/8)}} }') sc_draw(`rcdna_',SO, - `{ move to rvec_(0,-(m4ht*5/8)); m4fshade(0,lbox(m4wd,m4ht/4)) }') - sc_draw(`rcdna_',SR, `{ move to rvec_(0,-(m4ht*5/8)); {lbox(m4wd,m4ht/4)} {line from rvec_(0,-m4ht/8) to rvec_(m4wd, m4ht/8)} {line from rvec_(0, m4ht/8) to rvec_(m4wd,-m4ht/8)} }') + sc_draw(`rcdna_',SR, + `{ move to rvec_(0,-(m4ht*5/8)); m4fshade(0,lbox(m4wd,m4ht/4)) }') sc_draw(`rcdna_',HS, `{ move to rvec_(0,-(m4ht*5/8)); lbox(m4wd,m4ht/4) } { move to rvec_(m4wd/2,-(m4ht/2)); line to rvec_(0,-m4ht/4)} ') @@ -2927,6 +3018,22 @@ define(`relaycoil',`[ ifelse(`$4',,,`setdir_(`$4')') `{ move to rvec_(0,-(m4ht*11/16)); { lbox(m4wd,m4ht*3/8) } line from rvec_(0,m4ht*3/16) to rvec_(m4wd/2,-m4ht*3/16) \ then to rvec_(m4wd,m4ht*3/16) } ') + sc_draw(`rcdna_',MR, + `{ move to rvec_(m4wd/2,m4ht/2) + { m4tmp = rp_ang; dashline(to rvec_(0,m4ht*3/4),,m4ht*3/16,m4ht*3/32) + point_(m4tmp)} + move to rvec_(0,m4ht*3/8) + ifgpic( + `arc rad m4wd/2 cw from rvec_(-m4wd/2,0) \ + to Here with .c at rvec_(-m4wd/4,-m4wd/4) + arc rad m4wd/2 ccw from Here to rvec_(m4wd/2,0) with .c \ + at rvec_(m4wd/4,m4wd/4)', + `sinusoid(m4wd/6,twopi_/(m4wd),pi_/2,-m4wd/2,m4wd/2) \ + with .Origin at Here ') } ') + sc_draw(`rcdna_',PC, + `{ move to rvec_(0,m4ht/2+m4wd/2) + { lbox(m4wd,m4wd) } + circle diam m4wd/2 at rvec_(m4wd/2,0) } ') sc_draw(`rcdna_',PO, `{ move to rvec_(0,-(m4ht*5/8)); { lbox(m4wd,m4ht/4) } m4fshade(0, line to rvec_(0,m4ht/8) \ @@ -3282,16 +3389,42 @@ define(`ACsymbol',`[ Origin: Here with .Origin at Origin } ') `$5'; resetdir_ ] with .Origin ifelse(`$1',,`at Here',`$1')') + `Deltasymbol(at position, keys, U|D|L|R|degrees) + keys: size=expr; + Arg4: drawing direction (default: Up)' +define(`Deltasymbol',`[ sq3 = sqrt(3) + setkey_(`$2',size,dimen_/10)dnl + setdir_(`$3',U) + line from vec_(vscal_(m4size,-sq3,0)) to \ + vec_(vscal_(m4size,-sq3,1)) then to Here \ + then to vec_(vscal_(m4size,-sq3,-1)) \ + then to vec_(vscal_(m4size,-sq3,0)) + `$4'; resetdir_ ] ifelse(`$1',,`at Here',`$1')') + + `Ysymbol(at position, keys, U|D|L|R|degrees) + keys: size=expr; type=G (grounded); + Arg4: drawing direction (default: Up)' +define(`Ysymbol',`[ sq3 = sqrt(3) + setkeys_(`$2',`size:dimen_/10:; type::N')dnl + setdir_(`$3',U) + C: Here + line from vec_(vscal_(m4size,-2/sq3,0)) to C + { line from vec_(vscal_(m4size,1/sq3,1)) to C \ + then to vec_(vscal_(m4size,1/sq3,-1)) } + ifelse(m4type,,,`line right_ m4size*3/2; corner + pushdef(`dimen_',m4size*4) ground popdef(`dimen_') ') + `$4'; resetdir_ ] ifelse(`$1',,`at Here',`$1')') + `DCsymbol(at position, len, ht, U|D|L|R|degrees) Arg4: drawing direction (default: current direction)' define(`DCsymbol',`[ define(`m4wid',`ifelse(`$2',,(dimen_/3),`($2)')')dnl - define(`m4ht',`ifelse(`$3',,`m4wid/5',`($3)')') + define(`m4ht',`ifelse(`$3',,`(m4wid/5)',`($3)')') setdir_(ifelse(`$4',,`ifdef(`m4a_',rp_ang*rtod_,0)',`$4')) - Origin: rvec_(m4wid/2,-m4ht/2) + Origin: rvec_(m4wid/2, m4ht/2) {line to rvec_(m4wid,0)} - dashline(from rvec_(0,-m4ht) to rvec_(m4wid,-m4ht),,m4wid/4) - `$5'; resetdir_ ] with .c ifelse(`$1',,`at Here',`$1')') + dashline(from rvec_(0, m4ht) to rvec_(m4wid, m4ht),,m4wid/4,m4wid/8) + `$5'; resetdir_ ] with .Origin ifelse(`$1',,`at Here',`$1')') `n-terminal box nterm(box specs; other commands, @@ -3389,7 +3522,7 @@ define(`microphone',`ifinstr(`$1',A, for j=-1 to 1 do { { circle at Here+(3*j*cspace,(abs(j)-3)*cspace) } if j != 0 then {{ circle at Here+(j*3/2*cspace,0) }} } - move up 5*cspace } ]', + move up 5*cspace }; ]', `[setdir_($1,R) define(`m4h',`ifelse(`$2',,`dimen_/2',`($2)')')dnl {L1: line from rvec_(m4h,-m4h/2) \ diff --git a/graphics/circuit_macros/libgen.m4 b/graphics/circuit_macros/libgen.m4 index c20416a726..ee5b954f4e 100644 --- a/graphics/circuit_macros/libgen.m4 +++ b/graphics/circuit_macros/libgen.m4 @@ -2,7 +2,7 @@ divert(-1) libgen.m4 Base macros for dpic and gpic diagrams -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * @@ -126,31 +126,31 @@ ifdef(`darrow_init',, `define(`darrow_init', `m4announceprocessor(`$0') ifdef(`darrow_',,`include(darrow.m4)') -`# darrow_init begin' gen_init `$1' -`# darrow_init end'')') +`# darrow_init end' +')') liblog.m4 ifdef(`log_init',, `define(`log_init', `m4announceprocessor(`$0') ifdef(`liblog_',,`include(liblog.m4)') -`# log_init begin' gen_init `$1' -`# log_init end'')') +`# log_init end' +')') lib3D.m4 ifdef(`threeD_init',, `define(`threeD_init', `m4announceprocessor(`$0') ifdef(`lib3D_',,`include(lib3D.m4)') -`# threeD_init begin' gen_init setview(20,20,0) `$1' -`# threeD_init end'')') +`# threeD_init end' +')') sfg graphs in libcct.m4 define(`sfg_init',`cct_init @@ -185,7 +185,7 @@ define(`SIdefaults', define(`latexcommand',`command "ifmpost(verbatimtex) `$1' ifmpost(etex)"') define(`m4announceprocessor',`dnl Do not change the format of the next line: -`#' `$1' Version 9.5: ifelse(m4picprocessor,gpic,`Gpic', +`#' `$1' Version 9.6: ifelse(m4picprocessor,gpic,`Gpic', m4postprocessor,pstricks,`PSTricks', m4postprocessor,pgf,`TikZ PGF', m4postprocessor,mfpic,`Mfpic', @@ -260,14 +260,15 @@ define(`m4c_',(-sin(rp_ang)))define(`m4d_',cos(rp_ang))')') `setdir_( U|D|L|R|degrees,default R|L|U|D|degrees ) set direction and default direction' define(`setdir_', - `pushdef(`m4sdir',`ifelse(`$1',,`ifelse(`$2',,R,`$2')',`$1')')dnl + `pushdef(`m4sdir',`ifelse(`$1',, + `ifelse(`$2',,`ifdef(`m4rp_ang',m4rp_ang*rtod_,R)',`$2')',`$1')')dnl m4sd_ang = rp_ang; pushdef(`m4tdir',m4dir)dnl ifinstr( m4sdir,R,`rp_ang = 0; right_', m4sdir,L,`rp_ang = pi_; left_', m4sdir,U,`rp_ang = pi_/2; up_', m4sdir,D,`rp_ang = -pi_/2; down_', -`rp_ang = prod_(`$1',dtor_)undefine(`m4rp_ang')dnl +`rp_ang = prod_(m4sdir,dtor_)undefine(`m4rp_ang')dnl define(`m4a_',cos(rp_ang))define(`m4b_',sin(rp_ang))dnl define(`m4c_',(-sin(rp_ang)))define(`m4d_',cos(rp_ang))');dnl popdef(`m4sdir')') @@ -385,6 +386,17 @@ define(`Loopover_',`ifelse(`$3',,, `pushdef(`$1',`$3')pushdef(`m4Lx',ifdef(`m4Lx',`incr(m4Lx)',1)) $2 Loopover_(`$1',`$2',shift(shift(shift($@))))popdef(`m4Lx')popdef(`$1')')') + `This is identical to Loopover_ and may be + a preferred name' + `foreach_(`variable',actions,value1,value2,...) + Repeat actions with variable set to each of + value1, value2, ... in succession, setting + macro m4Lx to 1, 2, ...; e.g. + foreach_(`x',`print "m4Lx. x"',Tom,Dick,Mary)' +define(`foreach_',`ifelse(`$3',,, +`pushdef(`$1',`$3')pushdef(`m4Lx',ifdef(`m4Lx',`incr(m4Lx)',1)) $2 +foreach_(`$1',`$2',shift(shift(shift($@))))popdef(`m4Lx')popdef(`$1')')') + `Transfer m4 stack to new stack performing arg3 stackexec_(`Source',`Dest',`actions')' define(`stackexec_',`ifdef(`$1',`$3`'dnl @@ -458,28 +470,31 @@ define(`intersect_',`((($3.x-$1.x)*($3.y-$4.y)-($3.y-$1.y)*($3.x-$4.x))/\ between `$1' and `$2')') `Dashed line drawn in detail - dashline(linespec, + dashline( + linespec, thickness|<-|->|<->|color, - dash len, gap len,G) + dash len, + gap len,G) Arg5=G ends (but does not start) - the line with a gap' + the line with a gap + Note: can change default direction' define(`dashline',`rpoint_(`$1')define(`m4opts',`$2') define(`m4dsh',`ifelse(`$3',,dashwid,abs(`$3'))')dnl - define(`m4ssv',`ifelse(`$4',,m4dsh/2,abs(`$4'))')dnl + define(`m4gap',`ifelse(`$4',,m4dsh/2,abs(`$4'))')dnl define(`m4lar',)define(`m4rar',)dnl - ifelse(m4xtract(`m4opts',<->),1,`define(`m4lar',<-)define(`m4rar',->)', - m4xtract(`m4opts',<-),1,`define(`m4lar',<-)', - m4xtract(`m4opts',->),1,`define(`m4rar',->)')dnl - if (m4dsh+m4ssv)==0 then { dashline_n = 1 } \ + ifelse(m4xtract(`m4opts',<->),1,`define(`m4lar',<-)define(`m4rar',->)',dnl + m4xtract(`m4opts',<-),1,`define(`m4lar',<-)',dnl + m4xtract(`m4opts',->),1,`define(`m4rar',->)') + if (m4dsh+m4gap)==0 then { dashline_n = 1 } \ else {dashline_n = max(1,\ - round_(abs((rp_len ifelse(`$5',G,,+m4ssv))/(m4dsh+m4ssv))))} - dashline_f = (rp_len-(dashline_n ifelse(`$5',G,,-1))*m4ssv)/dashline_n + int(abs((rp_len ifelse(`$5',G,,+m4gap))/(m4dsh+m4gap))))} + dashline_f = (rp_len-(dashline_n ifelse(`$5',G,,-1))*m4gap)/dashline_n for m4ti=1 to dashline_n do { if m4ti==1 then { line m4opts m4lar to rvec_(dashline_f,0) } \ else { if m4ti==dashline_n then { line m4opts m4rar to rvec_(dashline_f,0)}\ else { line m4opts to rvec_(dashline_f,0) }} ifelse(`$5',G,, - `if m4ti < dashline_n then {')move to rvec_(m4ssv,0)ifelse(`$5',G,,}) + `if m4ti < dashline_n then {')move to rvec_(m4gap,0)ifelse(`$5',G,,}) } ') `round(at location,line thickness,attributes) @@ -618,11 +633,18 @@ define(`Vdiff_',`ifdpic(`$1'-(`$2'), ``$1'-(`$2'.x,`$2'.y)')') `Product of vector and scalar: (V)*(s) with dpic, (V.x*s,V.y*s) with gpic' -define(`Vsprod_',`ifdpic((`$1')*(`$2'), +define(`Vsprod_',`ifdpic(`ifelse(`$2',0,0,`$2',1,(`$1'),(`$1')*(`$2'))', `(prod_(`$1'.x,`$2'),prod_(`$1'.y,`$2'))')') `The x,y coordinate pair of a position' define(`Vcoords_',`(`$1').x,(`$1').y') - + `assign3([u],[v],[w],x,y,z); eg + assign3(u,v,w,cross3D(x1,y1,z1,x2,y2,z2)) + assigns u = 4th arg, v = 5th arg, w = 6th arg, + for nonblank u, v, or w' +define(`assign3', +`ifelse(`$1',,,`$1' = `$4') + ifelse(`$2',,,`$2' = `$5') + ifelse(`$3',,,`$3' = `$6')') `binary_(n,[m]) binary representation of n, padded to m bits if arg2 is nonblank' @@ -731,6 +753,36 @@ define(`boxdim',`ifelse(`$2',v,`sum_(boxdim(`$1',h,`$3'),boxdim(`$1',d,0))', with m4x the final count' define(`m4inx',`define(`m4x',ifdef(`m4x',`incr(m4x)',1))m4x') + `Drawing conveniences:' + + `PtoL( position, U|D|L|R|deg, lgth ) + Generate a linespec from polar + info. Evaluates to `from position to + position+(Rect_(lgth,angle))' with lgth + default dimen_ and angle from arg2' +define(`PtoL',`pushdef(`M4pos',ifelse(`$1',,Here,`$1'))dnl + ifinstr(ifelse(`$2',,R,`$2'),R,`pushdef(`m4c',1)pushdef(`m4s',0)', + `$2',U,`pushdef(`m4c',0)pushdef(`m4s',1)', + `$2',L,`pushdef(`m4c',-1)pushdef(`m4s',0)', + `$2',D,`pushdef(`m4c',0)pushdef(`m4s',-1)', + `pushdef(`m4c',`cosd(`$2')')pushdef(`m4s',`sind(`$2')')')dnl +from M4pos to M4pos + (vscal_(ifelse(`$3',,dimen_,`$3'),m4c,m4s))dnl +popdef(`m4s',`m4c',`M4pos')') + + `ToPos( position, U|D|L|R|deg, lgth ) + Generate a linespec from polar + info. Evaluates to `from + position-(Rect_(lgth,angle)) to position' + with lgth default dimen_ and angle from arg2' +define(`ToPos',`pushdef(`M4pos',ifelse(`$1',,Here,`$1'))dnl + ifinstr(ifelse(`$2',,R,`$2'),R,`pushdef(`m4c',1)pushdef(`m4s',0)', + `$2',U,`pushdef(`m4c',0)pushdef(`m4s',1)', + `$2',L,`pushdef(`m4c',-1)pushdef(`m4s',0)', + `$2',D,`pushdef(`m4c',0)pushdef(`m4s',-1)', + `pushdef(`m4c',`cosd(`$2')')pushdef(`m4s',`sind(`$2')')')dnl +from M4pos - (vscal_(ifelse(`$3',,dimen_,`$3'),m4c,m4s)) to M4pos dnl +popdef(`m4s',`m4c',`M4pos')') + `String conveniences start here:' `xtract(string,substr1,substr2,...) extract substrings without deletion' @@ -769,7 +821,17 @@ define(`setkey_', `pushdef(key_prefix`'$2,ifelse(`$4',,(substr(m4sktmp,0,index(m4sktmp,;))), substr(m4sktmp,0,index(m4sktmp,;))))')')dnl popdef(`m4xt')') -define(`key_prefix',`m4') + +define(`key_prefix',`m4') # Could be locally redefined + + `setkeys_(string,keysequence) + Invoke setkey_ on each of a sequence of terms. + keysequence is a ; -separated sequence + of terms of the form + identifier:default value:N + containing 3 fields separated by : ' +define(`setkeys_',`Loopover_(`M4Z',`setkey_(`$1',patsubst(M4Z,:,`,')) dnl', + patsubst(`$2',;,`,'))') `String with exact typeset dimensions: Requires s_init(name), sinclude(filename.dim), @@ -903,7 +965,7 @@ define(`hatchbox',`[ a = pmod((ifelse(`$4',,45,`$4')+90),180)-90 `lbox(wid,ht,type) box oriented in current direction; - type= eg dotted' + arg3= eg dotted' define(`lbox',`pushdef(`m4bwd',ifelse(`$1',,boxwid,(`$1')))dnl pushdef(`m4bht',ifelse(`$2',,boxht,(`$2')))dnl line from rvec_(m4bwd,0) \ @@ -911,7 +973,8 @@ define(`lbox',`pushdef(`m4bwd',ifelse(`$1',,boxwid,(`$1')))dnl then to rvec_(0,m4bht/2) \ then to rvec_(0,neg_(m4bht)/2) \ then to rvec_(m4bwd,neg_(m4bht)/2) \ - then to rvec_(m4bwd,0) `$3' popdef(`m4bwd')popdef(`m4bht') ') + then to rvec_(m4bwd,0) `$3' dnl + popdef(`m4bwd')popdef(`m4bht') ') `rotbox(wid,ht,type,[r=val|t=val]) box oriented in current direction in [] block; @@ -927,6 +990,7 @@ define(`lbox',`pushdef(`m4bwd',ifelse(`$1',,boxwid,(`$1')))dnl define(`rotbox',`[ pushdef(`m4bw2',ifelse(`$1',,(boxwid/2),`(($1)/2)'))dnl pushdef(`m4bh2',ifelse(`$2',,(boxht/2) ,`(($2)/2)'))dnl + C: Here N: vec_(0, m4bh2) S: vec_(0,-m4bh2) E: vec_( m4bw2,0) @@ -958,7 +1022,7 @@ define(`rotbox',`[ SE: vec_( m4bw2,-m4bh2) NW: vec_(-m4bw2,m4bh2) SW: vec_(-m4bw2,-m4bh2) - line from E to NE then to NW then to SW then to SE then to E `$3' ') + Line: line from E to NE then to NW then to SW then to SE then to E `$3' ') dnl popdef(`m4bw2')popdef(`m4bh2') `$5' ]') `rotellipse(wid,ht,type) @@ -1163,7 +1227,7 @@ define(`m4shadedpverts',` ifelse($3,,,`$1[$2]: patsubst(`$3',|,`,') define(`m4vx',$2) m4shadedpverts(`$1',incr(`$2'),shift(shift(shift($@))))')') -define(`color255',`round_((`$1')*255),round_((`$2')*255),round_((`$3')*255)') +define(`color255',`int((`$1')*255+0.5),int((`$2')*255+0.5),int((`$3')*255+0.5)') `like shade(,) but without the argument: beginshade(gray value) @@ -1171,7 +1235,7 @@ define(`color255',`round_((`$1')*255),round_((`$2')*255),round_((`$3')*255)') endshade' define(`beginshade',`define(`m4_shade',`ifelse(`$1',,`fillval',`($1)')')dnl ifelse(m4picprocessor,gpic, - `command sprintf("\special{sh %g}",1-m4_shade)', + `command sprintf("`\special{sh %g}'",1-m4_shade)', m4postprocessor,mfpic, `ifelse(`$1',0, `command "\gfill\draw\lclosed"', @@ -1180,32 +1244,32 @@ define(`beginshade',`define(`m4_shade',`ifelse(`$1',,`fillval',`($1)')')dnl m4postprocessor,mpost, `command "def Y="', m4postprocessor,svg, - `command sprintf("<g fill=\"rgb(%g,%g,%g)\">",\ + `command sprintf(`"<g fill=\"rgb(%g,%g,%g)\">"',\ color255(m4_shade,m4_shade,m4_shade) )', m4postprocessor,pgf, `command "\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{}" command "\global\def\dpicstop{--}" - command sprintf("\dpicshdraw[fill=white!%g!black]",m4_shade*100)', + command sprintf(`"\dpicshdraw[fill=white!%g!black]"',m4_shade*100)', m4postprocessor,pstricks, - `command sprintf("\newgray{m4fillv}{%g}",m4_shade) - command sprintf("\pscustom[fillstyle=solid,fillcolor=m4fillv]{%%")', + `command sprintf(`"\newgray{m4fillv}{%g}"',m4_shade) + command sprintf(`"\pscustom[fillstyle=solid,fillcolor=m4fillv]{%%"')', m4postprocessor,postscript, - `command "/endstroke {}def /npath {}def newpath"')dnl + `command `"/endstroke {}def /npath {}def newpath"'')dnl ')') define(`endshade', `ifelse(m4postprocessor,pstricks, `command "}%"', m4postprocessor,postscript, - `command sprintf(" gsave %g setgray fill grestore",m4_shade) - command "/endstroke {ostroke} def /npath {newpath} def endstroke"', + `command sprintf(`" gsave %g setgray fill grestore"',m4_shade) + command `"/endstroke {ostroke} def /npath {newpath} def endstroke"'', m4postprocessor,pgf, `command "cycle; \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;}"', m4postprocessor,svg, `command "</g>"', m4postprocessor,mpost, `command "enddef; def drw= enddef; def X=--enddef;" - command sprintf("fill Y cycle withcolor %gwhite;",m4_shade) + command sprintf(`"fill Y cycle withcolor %gwhite;"',m4_shade) command "def drw=draw enddef; def X=;enddef; Y;"dnl ')') `gshade(gray value,A,B,...,Z,A,B) (Note last @@ -1222,9 +1286,20 @@ define(`gpolyline',`1-(`$1') between `$2' and `$3' \ `m4fshade(gray value,closed curve) internal' ifelse(m4picprocessor,gpic, - `define(`m4fshade',`shade(ifelse(`$1',,0,`$1'),`$2')')', + `define`m4fshade',`shade(ifelse(`$1',,0,`$1'),`$2')')', +m4postprocessor,xfig, + `define(`m4fshade',``$2' fill ifelse(`$1',,0,`$1')')', + `define(`m4fshade',``$2' dnl + ifdef(`r_',`shaded rgbstring(r_,g_,b_)',`fill ifelse(`$1',,0,`$1')')')') + +ifelse(0,1,` +ifelse(m4picprocessor,gpic, + `define`m4fshade',`shade(ifelse(`$1',,0,`$1'),`$2')')', m4postprocessor,xfig, `define(`m4fshade',``$2' fill ifelse(`$1',,0,`$1')')', +m4postprocessor,pdf, + `define(`m4fshade',``$2' dnl + ifdef(`r_',`shaded(r_,g_,b_)',`fill ifelse(`$1',,0,`$1')')')', m4postprocessor,svg, `define(`m4fshade', `ifdef(`r_',`rgbfill(color255(r_,g_,b_),`$2')', @@ -1232,15 +1307,17 @@ m4postprocessor,svg, `define(`m4fshade', `ifdef(`r_',`rgbfill(r_,g_,b_,`$2')', `shade(ifelse(`$1',,0,`$1'),`$2')')')') +') - `open_arrow(linespec, ht, wid) + `open_arrow(linespec, ht, wid, head attribs) arrow with outlined head' define(`open_arrow',`arrow invis `$1' - m4oatx = Here.x - last arrow.start.x; m4oaty = Here.y - last arrow.start.y - m4oatr = (ifelse(`$3',,arrowwid,`$3'))/vlength(m4oatx,m4oaty)/2 - line from last arrow.start to Here chop 0 chop ifelse(`$2',,arrowht,`$2') - line from last arrow.end to Here+(-m4oaty*m4oatr,m4oatx*m4oatr) \ - then to Here-(-m4oaty*m4oatr,m4oatx*m4oatr) then to last arrow.end ') + m4oatx = Here.x - last arrow.start.x; m4oaty = Here.y - last arrow.start.y + m4oatr = (ifelse(`$3',,arrowwid,`$3'))/vlength(m4oatx,m4oaty)/2 + line from last arrow.start to Here chop 0 chop ifelse(`$2',,arrowht,`$2') + line from last arrow.end to Here+(-m4oaty*m4oatr,m4oatx*m4oatr) \ + then to Here-(-m4oaty*m4oatr,m4oatx*m4oatr) \ + then to last arrow.end `$4'') `elchop(E,A) chop for ellipses evaluates to "chop r" where r is the distance @@ -1390,12 +1467,17 @@ define(`M4LET',`LCtangent((M4LP.x/m4LEta,M4LP.y/m4LEtb),`(0,0)',1,`$5')')dnl define(`langle', `atan2(M4Pos(`$2').y-M4Pos(`$1').y,M4Pos(`$2').x-M4Pos(`$1').x)') - `ArcAngle(Pos1,Pos2,Pos3,radius,attributes) + `ArcAngle(Pos1,Pos2,Pos3, + radius,attributes,label) arc angle symbol drawn ccw at Pos2 arg4: radius from Pos2 - arg5: line attributes, e.g. thick linethick/2' + arg5: line attributes, e.g. thick 0.4 -> + arg6: label (or other object) at mid-arc + e.g., ArcAngle(A,B,C,,,"$ABC$" ljust ) ' define(`ArcAngle',`arcr(`$2',ifelse(`$4',,arcrad,`$4'), - langle(`$2',`$1'),langle(`$2',`$3'),`$5') ') + langle(`$2',`$1'),langle(`$2',`$3'),`$5') + ifelse(`$6',,,`move to `$2'+ (rect_(ifelse(`$4',,arcrad,`$4')+textoffset, + (langle(`$2',`$1')+langle(`$2',`$3'))/2)); `$6'') ') `RightAngle(Pos1,Pos2,Pos3,linelen,attributes) Draw a right angle symbol at Pos2 @@ -1505,9 +1587,10 @@ define(`m4scale_',`define(`m4SC',`ifelse(`$2',,I,`substr(`$2',0,1)')')dnl same arguments' ifdpic(` define(`fitpoints',`defdfitpoints -dfitpoints($@)') + dfitpoints($@)') define(`defdfitpoints',`ifdef(`dfitpoints__',,`define(`dfitpoints__')dnl -patsubst(`define dfitpoints { +patsubst(`## pic fit curve macros +define dfitpoints { if "|3"=="" then { m_dfit=0 } else { m_dfit=|3 } if "|5"=="" then { mP_dfit=0 } else { mP_dfit=|5 } n_dfit = |2; np_dfit = n_dfit-m_dfit @@ -1555,7 +1638,8 @@ define dfitcurve { if "|4"=="" then { m_dfit=0 } else { m_dfit=|4 } for i_dfit=2 to np_dfit-2 do { continue to M4P_[i_dfit] } continue to 27/32 between M4P_[np_dfit-2] and M4P_[np_dfit-1] \ then to 21/32 between M4P_[np_dfit-1] and M4P_[np_dfit] \ - then to M4P_[np_dfit]) }',|,$) ') + then to M4P_[np_dfit]) } +` ## end fit curve defs'',|,$) ') dfitcurve($@) ') ') diff --git a/graphics/circuit_macros/liblog.m4 b/graphics/circuit_macros/liblog.m4 index a7ae395a75..95a6bf0ea1 100644 --- a/graphics/circuit_macros/liblog.m4 +++ b/graphics/circuit_macros/liblog.m4 @@ -1,7 +1,7 @@ divert(-1) liblog.m4 Logic gates -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * @@ -57,7 +57,8 @@ define(`lg_chipwd',`(18*L_unit)') `default chip width' define(`lg_pintxt', `"ifxfig(`$1',`ifsvg(`svg_small(`$1',75)',`sp_{\scriptsize `$1'}sp_')')"') `Logic pin text with bar where possible' -define(`lg_bartxt',`iflatex(`$\overline{\hbox{`$1'}}$',`$1')') +define(`lg_bartxt',`iflatex(`$\overline{\hbox{`$1'}}$', + `ifsvg(`svg_ol(`$1')',`$1')')') `The comma has to be at the top level' define(`m4_pattocomma',`patsubst(`$1',`$2',`,')') @@ -1043,4 +1044,5 @@ define(`m4_ffside', define(`m4drawpin',`lg_pin(`$1',`$4',ifelse(`$5',,`$2',`$5'),`$3')') ########################################################################### + divert(0)dnl diff --git a/graphics/circuit_macros/mfpic.m4 b/graphics/circuit_macros/mfpic.m4 index 0ef7c4bf8d..2bdd9e4c8e 100644 --- a/graphics/circuit_macros/mfpic.m4 +++ b/graphics/circuit_macros/mfpic.m4 @@ -1,7 +1,7 @@ divert(-1) mfpic.m4 Initialization for mfpic. -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * diff --git a/graphics/circuit_macros/mpost.m4 b/graphics/circuit_macros/mpost.m4 index 0536b66cb3..94b80828e6 100644 --- a/graphics/circuit_macros/mpost.m4 +++ b/graphics/circuit_macros/mpost.m4 @@ -1,7 +1,7 @@ divert(-1) mpost.m4 Initialization for metapost. -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * diff --git a/graphics/circuit_macros/pgf.m4 b/graphics/circuit_macros/pgf.m4 index 9715290491..04fc615f96 100644 --- a/graphics/circuit_macros/pgf.m4 +++ b/graphics/circuit_macros/pgf.m4 @@ -1,7 +1,7 @@ divert(-1) pgf.m4 Initialization for Tikz-pgf. -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * diff --git a/graphics/circuit_macros/postscript.m4 b/graphics/circuit_macros/postscript.m4 index 2860a2aa2a..7946ec30da 100644 --- a/graphics/circuit_macros/postscript.m4 +++ b/graphics/circuit_macros/postscript.m4 @@ -1,7 +1,7 @@ divert(-1) postscript.m4 Initialization for Postscript output. -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * diff --git a/graphics/circuit_macros/psfrag.m4 b/graphics/circuit_macros/psfrag.m4 index 6572761f35..3e3df16545 100644 --- a/graphics/circuit_macros/psfrag.m4 +++ b/graphics/circuit_macros/psfrag.m4 @@ -2,7 +2,7 @@ divert(-1) psfrag.m4 Initialization for dpic -f processing: Postscript with psfrag strings -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * diff --git a/graphics/circuit_macros/pstricks.m4 b/graphics/circuit_macros/pstricks.m4 index 48cc91af3a..28acb8fe6c 100644 --- a/graphics/circuit_macros/pstricks.m4 +++ b/graphics/circuit_macros/pstricks.m4 @@ -1,7 +1,7 @@ divert(-1) pstricks.m4 Initialization for PSTricks. -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * diff --git a/graphics/circuit_macros/svg.m4 b/graphics/circuit_macros/svg.m4 index 113174d0be..e686074a6b 100644 --- a/graphics/circuit_macros/svg.m4 +++ b/graphics/circuit_macros/svg.m4 @@ -1,7 +1,7 @@ divert(-1) svg.m4 Initialization for SVG output. -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * @@ -26,6 +26,7 @@ dnl Put define(`Inkscape') in the source for Inkscape input ifelse(ifdef(`Inkscape',T)`'ifdef(`nosvgformat',T),T, `define(`svg_it',`$1') define(`svg_tt',`$1') +define(`svg_sf',`$1') define(`svg_norm',`$1') define(`svg_bf',`$1') define(`svg_small',`$1') @@ -99,15 +100,22 @@ dptextratio)') define(`svg_symbol',`changecom(,)`$1'changecom(`#',)') define(`svg_it',`<tspan font-style=\"italic\">`$1'</tspan>') define(`svg_tt',`<tspan font-family=\"Courier\">`$1'</tspan>') +define(`svg_sf',`<tspan font-family=\"Helvetica\">`$1'</tspan>') define(`svg_norm',`<tspan font-style=\"normal\">`$1'</tspan>') define(`svg_bf',`<tspan font-style=\"bold\">`$1'</tspan>') -dnl To get %% in a sprintf string, set the size explicitly, +dnl T0 GET %% in a sprintf string, set the size explicitly, dnl eg sprintf("x`'svg_sub(%g,50%)",i) define(`svg_small',`svg_fsize(`$1',ifelse(`$2',,66,`$2'))') define(`svg_fsize',`<tspan font-size=\"ifelse(`$2',,100,`$2')%\">`$1'</tspan>') +dnl svg_ul(text) Underline text +define(`svg_ul',`<tspan text-decoration=\"overline\">`$1'</tspan>') +dnl svg_ol(text) Overline text +define(`svg_ol',`<tspan text-decoration=\"overline\">`$1'</tspan>') + +dnl svg_sup dnl This is black magic but seems necessary to work with Firefox dnl Arg 2: size of subscript font in percent dnl Arg 3: vertical shift, e.g. svg_sub(1,,0.5ex) @@ -126,6 +134,29 @@ define(`svg_sub',`<tspan font-size=\"ifelse(`$2',,70,`$2')%\" font-size=\"ifelse(`$2',,70,`$2')%\" dy=\"-ifelse(`$3',,0.66ex,`$3')\" dx=\"-0.5ex\"> </tspan>')dnl note the space + + + `svg_frac(numerator[:wid],denominator[:wid]) + Basic fraction for simple arguments + wid is in drawing units' +define(`svg_frac',`define(`m4ex',`(textht*0.675)')dnl sans-serif: 0.8525 +define(`m4num',`patsubst(`$1',:.*)')dnl +define(`m4den',`patsubst(`$2',:.*)')dnl +define(`m4numx',`ifinstr(`$1',:,((patsubst(`$1',.*:))/m4ex),len(`$1'))')dnl +define(`m4denx',`ifinstr(`$2',:,((patsubst(`$2',.*:))/m4ex),len(`$2'))')dnl +define(`m4mx',`max(m4numx,m4denx)')dnl + "<tspan dx="+sprintf("\"%gex\"", m4mx/2)+"> </tspan><tspan dy=\"-1.2ex\" + dx="+sprintf("\"%gex\"", (m4mx-m4numx)/2)+">m4num</tspan><tspan + dy=\" 2.6ex\" + dx="+sprintf("\"%gex\"", -m4numx/2-m4denx/2)+">m4den</tspan><tspan + dy=\"-1.4ex\" dx="+sprintf("\"%gex\"", m4mx/2-m4denx/2)+"> </tspan>" + line right m4mx*m4ex from Here+((m4mx/2-0.8)*m4ex,-0.2*m4ex) + move to Here+(0,0.2*m4ex) + {box invis wid last line.len ht 2.8*textht with .w at last line.start} +') + +define(`svg_hat',`<tspan>svg_circ</tspan><tspan dx=\"-0.9ex\">`$1'</tspan>') + define(`svg_alpha',`svg_symbol(&`#'945;)') define(`svg_beta',`svg_symbol(&`#'946;)') define(`svg_chi',`svg_symbol(&`#'967;)') @@ -174,14 +205,15 @@ define(`svg_backsl',`svg_symbol(&`#'92;)') define(`svg_pound',`svg_symbol(&`#'35;)') define(`svg_circ',`svg_symbol(&`#'710;)') define(`svg_deg',`svg_symbol(&`#'176;)') +define(`svg_equiv',`svg_symbol(&`#'8801;)') ') define(`svgcolor',`sprintf("rgb(%g,%g,%g)",\ -round_(`$1'),round_(`$2'),round_(`$3'))') +int(`$1'+0.5),int(`$2'+0.5),int(`$3'+0.5))') # Obsolete but kept for compatibility. Use `rgbstring(r,g,b)' define(`svgcolor255', - `svgcolor(round_((`$1')*255),round_((`$2')*255),round_((`$3')*255))') + `svgcolor(int((`$1')*255+0.5),int((`$2')*255+0.5),int((`$3')*255+0.5))') define(`svgLink',`command "<a xlink:href=\"`$1'\"dnl ifelse(`$3',,`target=\"_blank\"',`$3',B,,`$3')> diff --git a/graphics/circuit_macros/xfig.m4 b/graphics/circuit_macros/xfig.m4 index d0c42ce6db..f8966d999b 100644 --- a/graphics/circuit_macros/xfig.m4 +++ b/graphics/circuit_macros/xfig.m4 @@ -1,7 +1,7 @@ divert(-1) xfig.m4 Initialization for xfig. -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * |