From e693cca0faa732710182c7d86d1663a62dcbeb7f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 12 Feb 2022 21:16:00 +0000 Subject: circuit_macros (12feb22) git-svn-id: svn://tug.org/texlive/trunk@61987 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/circuit-macros/CHANGES | 4 + Master/texmf-dist/doc/latex/circuit-macros/Copying | 2 +- Master/texmf-dist/doc/latex/circuit-macros/INSTALL | 4 +- Master/texmf-dist/doc/latex/circuit-macros/README | 152 +- .../texmf-dist/doc/latex/circuit-macros/darrow.m4 | 30 +- .../latex/circuit-macros/doc/Circuit_macros.html | 8601 -------------------- .../latex/circuit-macros/doc/Circuit_macros.pdf | Bin 978438 -> 1020598 bytes .../latex/circuit-macros/doc/Circuit_macros.tex | 1 + .../doc/latex/circuit-macros/doc/DiodesMan.m4 | 14 +- .../doc/latex/circuit-macros/doc/Makefile | 7 +- .../doc/latex/circuit-macros/doc/PconnMan.m4 | 13 +- .../doc/latex/circuit-macros/doc/SLDs.tex | 1208 +++ .../doc/latex/circuit-macros/doc/SLDsMan.m4 | 228 + .../doc/latex/circuit-macros/doc/SwitchesMan.m4 | 141 +- .../doc/latex/circuit-macros/doc/Thermal.m4 | 2 +- .../doc/latex/circuit-macros/doc/Version.tex | 2 +- .../doc/latex/circuit-macros/doc/body.tex | 480 +- .../doc/latex/circuit-macros/doc/defines.tex | 405 +- .../doc/latex/circuit-macros/dpictools.pic | 104 +- .../doc/latex/circuit-macros/examples/Arrester.m4 | 28 - .../doc/latex/circuit-macros/examples/Arresters.m4 | 75 + .../latex/circuit-macros/examples/Consumption.m4 | 524 ++ .../doc/latex/circuit-macros/examples/Diodes.m4 | 12 +- .../doc/latex/circuit-macros/examples/EEP.m4 | 112 + .../doc/latex/circuit-macros/examples/Escher.m4 | 131 +- .../doc/latex/circuit-macros/examples/Eye.m4 | 55 + .../doc/latex/circuit-macros/examples/Flow.m4 | 2 +- .../doc/latex/circuit-macros/examples/Geometry.m4 | 60 + .../doc/latex/circuit-macros/examples/Lyap.m4 | 7 +- .../doc/latex/circuit-macros/examples/Makefile | 11 +- .../latex/circuit-macros/examples/README-examples | 2 +- .../doc/latex/circuit-macros/examples/Stator.m4 | 53 + .../doc/latex/circuit-macros/examples/Switches.m4 | 150 +- .../doc/latex/circuit-macros/examples/control.m4 | 4 +- .../doc/latex/circuit-macros/examples/ex05.m4 | 12 +- .../doc/latex/circuit-macros/examples/ex06.m4 | 28 +- .../doc/latex/circuit-macros/examples/examples.pdf | Bin 892920 -> 898616 bytes .../doc/latex/circuit-macros/examples/examples.tex | 1 + .../doc/latex/circuit-macros/examples/files.tex | 51 +- .../doc/latex/circuit-macros/examples/ics.m4 | 2 +- .../doc/latex/circuit-macros/examples/mf/cct.mf | 50 +- .../circuit-macros/examples/svg/CctTableSVG.m4 | 96 - .../latex/circuit-macros/examples/svg/DiodesSVG.m4 | 12 +- .../latex/circuit-macros/examples/svg/EEPSVG.m4 | 669 +- .../latex/circuit-macros/examples/svg/EscherSVG.m4 | 131 +- .../latex/circuit-macros/examples/svg/EyeSVG.m4 | 53 + .../latex/circuit-macros/examples/svg/FlowSVG.m4 | 2 +- .../circuit-macros/examples/svg/FourbarSVG.m4 | 4 +- .../circuit-macros/examples/svg/GeometrySVG.m4 | 268 +- .../latex/circuit-macros/examples/svg/LoglogSVG.m4 | 549 ++ .../doc/latex/circuit-macros/examples/svg/Makefile | 11 +- .../doc/latex/circuit-macros/examples/svg/SLD.m4 | 389 - .../circuit-macros/examples/svg/SwitchesSVG.m4 | 147 +- .../circuit-macros/examples/svg/controlSVG.m4 | 2 +- .../latex/circuit-macros/examples/svg/cscSVG.m4 | 4 +- .../circuit-macros/examples/svg/examplesSVG.htmx | 38 +- .../latex/circuit-macros/examples/svg/expSVG.m4 | 47 +- .../latex/circuit-macros/examples/svg/icsSVG.m4 | 6 +- .../latex/circuit-macros/examples/svg/quickSVG.m4 | 3 +- .../circuit-macros/examples/svg/slddiagsSVG.m4 | 100 + .../circuit-macros/examples/svg/sldtestsSVG.m4 | 104 - .../doc/latex/circuit-macros/examples/worm.m4 | 2 +- .../latex/circuit-macros/examples/xfig/xfiglib.fig | 22 +- Master/texmf-dist/doc/latex/circuit-macros/gpic.m4 | 2 +- .../texmf-dist/doc/latex/circuit-macros/lib3D.m4 | 2 +- .../texmf-dist/doc/latex/circuit-macros/libSLD.m4 | 689 ++ .../texmf-dist/doc/latex/circuit-macros/libcct.m4 | 744 +- .../texmf-dist/doc/latex/circuit-macros/libgen.m4 | 173 +- .../texmf-dist/doc/latex/circuit-macros/liblog.m4 | 30 +- .../texmf-dist/doc/latex/circuit-macros/mfpic.m4 | 2 +- .../texmf-dist/doc/latex/circuit-macros/mpost.m4 | 2 +- Master/texmf-dist/doc/latex/circuit-macros/pgf.m4 | 2 +- .../doc/latex/circuit-macros/postscript.m4 | 2 +- .../texmf-dist/doc/latex/circuit-macros/psfrag.m4 | 2 +- .../doc/latex/circuit-macros/pstricks.m4 | 2 +- Master/texmf-dist/doc/latex/circuit-macros/svg.m4 | 2 +- Master/texmf-dist/doc/latex/circuit-macros/xfig.m4 | 2 +- 77 files changed, 5895 insertions(+), 11188 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.html create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/doc/SLDs.tex create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/doc/SLDsMan.m4 delete mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/Arrester.m4 create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/Arresters.m4 create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/Consumption.m4 create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/EEP.m4 create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/Eye.m4 create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/Stator.m4 delete mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4 create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EyeSVG.m4 delete mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SLD.m4 create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/svg/slddiagsSVG.m4 delete mode 100644 Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sldtestsSVG.m4 create mode 100644 Master/texmf-dist/doc/latex/circuit-macros/libSLD.m4 diff --git a/Master/texmf-dist/doc/latex/circuit-macros/CHANGES b/Master/texmf-dist/doc/latex/circuit-macros/CHANGES index 20c9c25be3e..80c44977e3d 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/CHANGES +++ b/Master/texmf-dist/doc/latex/circuit-macros/CHANGES @@ -1,5 +1,9 @@ CHANGES +Version 9.8: Changes to libSLD macros, with descriptions + added to the manual. Tweaked macros ArcAngle, opamp, inductor, cross, + crossover, diode, rs_box, r_text, Deltasymbol, arrester, dswitch, + macros employing sc_draw. Version 9.7: Improved shadebox macro and a bugfix. Experimental single-line diagram elements. Revised fitcurve. New options for resistor, capacitor, ebox, xtal. Tweaked addtaps. Convert web version of Circuit_macros.pdf diff --git a/Master/texmf-dist/doc/latex/circuit-macros/Copying b/Master/texmf-dist/doc/latex/circuit-macros/Copying index cb33807a563..deabe0231fc 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/Copying +++ b/Master/texmf-dist/doc/latex/circuit-macros/Copying @@ -1,4 +1,4 @@ -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/INSTALL b/Master/texmf-dist/doc/latex/circuit-macros/INSTALL index 5d841884b71..42b11ff402d 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/INSTALL +++ b/Master/texmf-dist/doc/latex/circuit-macros/INSTALL @@ -70,8 +70,8 @@ TESTING: from the doc directory. They are duplicated to provide flexibility of directory structure and independency of sources. - No "make" facility? You have to test by hand (but see below for - diagram production software). Copy a test file as above into + No "make" facility? You have to test by hand (but see the README file + for diagram production software). Copy a test file as above into test.m4. Assuming you have dpic installed, type the following: m4 -I pstricks.m4 test.m4 > test.pic diff --git a/Master/texmf-dist/doc/latex/circuit-macros/README b/Master/texmf-dist/doc/latex/circuit-macros/README index 67fb1093f5e..326bb4730d6 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/README +++ b/Master/texmf-dist/doc/latex/circuit-macros/README @@ -1,5 +1,5 @@ -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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 * @@ -31,9 +31,9 @@ Sources are available as a git repository at REQUIRED SOFTWARE: Preferred setup: - GNU m4, dpic (see below), LaTeX, PSTricks, dvips - or m4, dpic, LaTeX or PDFLaTeX, TikZ-PGF + or + GNU m4, dpic, LaTeX, PSTricks, dvips The GNU m4 macro processor is assumed, and a small number of macros require GNU m4 features. Other versions of m4 will work with most macros. @@ -59,8 +59,8 @@ USAGE or pstricks graphics for LaTeX; see below for integration with other tools and production of other formats. You probably should try out the basic usage before integrating the macros with sophisticated - system-dependent tools. When developing your own diagrams, refer to - the macro descriptions in the List of Macros section of Circuit_macros.pdf. + system-dependent tools. When developing your own diagrams, refer to the + macro descriptions in the List of Macros section of Circuit_macros.pdf. Suppose that a source file, cct.m4 say, has been created and the top two lines are @@ -144,37 +144,54 @@ SOURCES AND MANUALS: (Do not read this manual first). Autoconf uses quote characters [ and ] instead of the default ` and ' which work well with the pic language. - Gpic is part of the GNU groff distribution, for which the source - and documentation is available from http://ftp.gnu.org/gnu/groff/ - but there are mirror sites as well. The original AT&T pic manual - can be obtained at http://doc.cat-v.org/unix/v10/10thEdMan/pic.pdf - A more extensive manual is found in the documentation that comes with - GNU pic, which is typically installed as gpic. A pdf copy is included - with the dpic distribution and a version can be found on the web at - http://www.kohala.com/start/troff/gpic.raymond.ps - DPIC: - Dpic is not included here you say? If you want to try the LaTeX - picture objects, mfpic, PSTricks, TikZ-PGF, MetaPost, xfig, SVG, PDF, - or Postscript output provided by dpic, there are at least three possibilities: - Some Linux distributions will install dpic automatically, the current - (free) C source and Windows executable can be obtaied from - http://ece.uwaterloo.ca/~aplevich/dpic/ - and a git repository containing complete source is at + Several Linux distributions will install dpic by command but the version + may not be the latest. A git repository containing complete source is at https://gitlab.com/aplevich/dpic - The source can be found in a number of repositories but many contain - older versions, see https://repology.org/project/dpic/badges + and source plus a Windows executable can be obtaied from + http://ece.uwaterloo.ca/~aplevich/dpic/ The best advice is to obtain the newest version. The dpic distribution includes dpic-doc.pdf, a manual containing a summary - of the pic language and of features unique to dpic. + of the pic language and a detailed description of features unique to dpic. + +GPIC: + Gpic is part of the GNU groff distribution, for which the source + and documentation is available from http://ftp.gnu.org/gnu/groff/ + but there are mirror sites as well. A more extensive manual is found + in the documentation that comes with GNU pic, which is typically + installed as gpic. A pdf copy is included with the dpic distribution + and a version can be found on the web at + http://www.kohala.com/start/troff/gpic.raymond.ps + The original AT&T pic manual can be found at + http://doc.cat-v.org/unix/v10/10thEdMan/pic.pdf + +SVG output, Inkscape: + Dpic -v produces svg output. If the result is to be directly + inserted into html, then as for Postscript output, the diagram + source file has to be adapted to remove any LaTeX formatting. The + configuration file svg.m4 contains macros that can assist. To avoid + this problem at the expense of an extra postprocessing step, + sophisticated text formatting and font selection can be retained + by first producing pdf output and then converting to SVG using, + say, pdf2svg (https://github.com/dawbarton/pdf2svg) or dvisvgm + (https://www.ctan.org/pkg/dvisvgm). + + SVG is the native file format for the Inkscape graphics editor. + Therefore, elements defined by these macros can be output by dpic -v in + svg format for later manipulation by Inkscape. A very basic palette of + circuit elements for Inkscape is found in examples/svg/paletteSVG.m4. + In the svg subdirectory, type "make paletteSVG.svg", read the resulting + file into Inkscape, and then ungroup the elements as desired. You would + probably wish to add to or customize these elements for extensive use. EXAMPLES A set of examples is included in this distribution, showing electric circuits, block diagrams, flow charts, signal-flow graphs, basic use of colour and fill, and other applications. Read the manual - Circuit_macros.pdf and view or print the file examples.pdf in the - examples directory. For the curious, There are additional source + Circuit_macros.pdf and view the files examples.pdf in the + examples directory or make and view the html file in the examples/svg + directory. For the curious, There are additional source files in the examples directory that are not shown in examples.pdf. For the possibly unstable development version of these macros, try http://ece.uwaterloo.ca/~aplevich/Circuit_macros/ @@ -184,14 +201,26 @@ EXAMPLES examples directory are for testing metafont, metapost, pgf, psfrag, and xfig examples. -INTEGRATION WITH OTHER TOOLS: - Installation and usage of the macros have evolved smewhat since the +WORKFLOW: + Installation and usage of the macros have evolved somewhat since the beginning, so archived instructions on the net may be slightly more - complicated than currently necessary. Because I was producing books, - I simply added commands to the appropriate Makefiles. However, others - have developed tools that simplify workflow for their circumstances. - The following are representative but keep in mind that systems and - installations evolve over time: + complicated than currently necessary. + + I use a very simple workflow most of the time: three open windows; + one to edit the diagram source, one to run LaTeX and produce pdf or + postscript, and a document viewer window. The lines + :set mps+=`:' + :set mps+=<:> + were added to my default .vimrc file to highlight matched pairs of + brackets, braces, parentheses, and, expecially for m4 programming, + single quotes. + +INTEGRATION WITH OTHER TOOLS: + To automate document production, I simply added commands to + the appropriate Makefiles. However, others have developed tools + that simplify workflow for their circumstances. The following are + representative but keep in mind that systems and installations evolve + over time: A Python-based GUI called PyCirkuit is at https://pypi.org/project/pycirkuit/ and @@ -220,13 +249,9 @@ INTEGRATION WITH OTHER TOOLS: https://github.com/ag-ckt/cirkuit/tree/V0.5.0. There is uncertainty about installation possibilities because of evolving library dependencies. - A wiki offering examples and tips is at - http://swwiki.e-dschungel.de/circuit_macros - It is in German but Google translate works well on the page. - Another recent introduction is at https://www.root.cz/clanky/publikovanie-elektrickych-schem-a-diagramov-pomocou-circuit-macros/ - It is in Czech but, again, Google translate works well. + It is in Czech but Google translate works well. LaTeX automation tools are discussed at, for example, http://tex.stackexchange.com/questions/64/tools-for-automating-document-compilation @@ -238,30 +263,24 @@ INTEGRATION WITH OTHER TOOLS: 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/ - VARIATIONS - Macros such as these inevitably will be modified to suit individual + Macros such as these will be modified inevitably to suit individual needs and taste. They continue to evolve in my own library as I use them and as others send comments. No such collection can hope to include all possible circuit-related symbols, so you will probably find yourself writing your own macros or adapting some of these. Be careful to rename modified macros to avoid confusion. The learning curve compares well to other packages, but there is no trivially - easy way to produce high-quality graphics. (If a picture is worth - a thousand words, ask yourself how long it would take to write and - revise a thousand words.) + easy way to produce high-quality graphics. (If "a picture is worth + a thousand words," ask yourself how long it would take to write, revise, + and perfect a thousand words.) See eschpic on Github for IEC-style electrical drawings. - For an example of the use of dpic in a wiki (thanks to Jason Grout), see - http://jasongrout.org/software/dokuwiki/format-plugin - - Pic dates from the 1980s and was first developed as a preprocessor for - the *roff family of Unix word processors. Some additional libraries such - as chem (for chemical structures) and dformat (for data structures) are - still viable. + The pic language dates from the 1980s and was first developed + as a preprocessor for the *roff family of Unix wordprocessors. + Some additional libraries such as chem (for chemical structures) + and dformat (for data structures) are still viable. Pic macros for drawing graphs are described at http://www.math.uiuc.edu/~west/gpic.html @@ -288,26 +307,6 @@ Postscript, CorelDraw, Adobe Illustrator: LaTeX formatting instructions in the source are not obeyed. These programs also import svg output produced by dpic -v. -SVG output, Inkscape: - Dpic -v produces svg output. If the result is to be directly - inserted into html, then as for Postscript output, the diagram - source file has to be adapted to remove any LaTeX formatting. The - configuration file svg.m4 contains macros that can assist. To avoid - this problem at the expense of an extra postprocessing step, - sophisticated text formatting and font selection can be retained - by first producing pdf output and then converting to SVG using, - say, pdf2svg (https://github.com/dawbarton/pdf2svg) or dvisvgm - (https://www.ctan.org/pkg/dvisvgm). - - SVG is the native file format for the Inkscape graphics editor. - Therefore, elements defined by these macros can be output by dpic - -v in svg format for later manipulation by Inkscape. A very basic - palette of circuit elements for importing into Inkscape is found - in examples/svg/paletteSVG.m4. In the svg subdirectory, type "make - paletteSVG.svg", read the resulting file into Inkscape, and then ungroup - the elements as desired. You would probably wish to add to or customize - these elements for extensive use. - Metafont: The file examples/mf/cct.mf is a Metafont source for a few variants of the basic elements, produced using the mfpic output of dpic. It may @@ -327,10 +326,11 @@ Xfig: LIBRARIES: The file libgen.m4 contains general-purpose macros and is read automatically by other libraries. The file libcct.m4 defines basic - circuit elements. Binary logic-circuit elements are in liblog.m4. - Macros for drawing 3D projections are in lib3D.m4, and some macros - for drawing double-line arrows are in darrow.m4. The file dpictools.pic - contains pic macros and is read automatically by some of the examples. + circuit elements. Binary logic-circuit elements are in liblog.m4 and + additional single-line elements are in libSLD.m4. Macros for drawing 3D + projections are in lib3D.m4, and some macros for drawing double-line + arrows are in darrow.m4. The file dpictools.pic contains pic macros + and is read automatically by some of the examples. Feel free to contact me with comments or questions. I have retired from full-time work but continue the hobby of maintaining these files. diff --git a/Master/texmf-dist/doc/latex/circuit-macros/darrow.m4 b/Master/texmf-dist/doc/latex/circuit-macros/darrow.m4 index 1f41c709823..4e3f757afc8 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/darrow.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/darrow.m4 @@ -1,7 +1,7 @@ divert(-1) darrow.m4 Macros for double lines and arrows -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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 * @@ -80,8 +80,8 @@ define(`dline',`deleminit_(`$1',,`$4') !- closed end with half-width line eg Dline(from A to B,E;ends=|-)' define(`Dline', - `setkey_(`$2',thick,dlthick) - setkey_(`$2',ends)pushdef(`m4ends',substr(m4ends,1,eval(len(m4ends)-2))) + `pushkey_(`$2',thick,dlthick) + pushkey_(`$2',ends)pushdef(`m4ends',substr(m4ends,1,eval(len(m4ends)-2))) dline(`$1',ifinstr(`$2',S,t),ifinstr(`$2',E,t),m4thick,m4ends) popdef(`m4ends')popdef(`m4ends')popdef(`m4thick') ') @@ -207,12 +207,12 @@ define(`darrow',`deleminit_(`$1',,`$4') !- closed end with half-width line eg Darrow(from A to B,E;ends=<-|)' define(`Darrow', - `setkey_(`$2',thick,dlthick) - setkey_(`$2',wid,dlthick*3/2) - setkey_(`$2',ht,dlthick) - setkey_(`$2',ends)pushdef(`m4ends',substr(m4ends,1,eval(len(m4ends)-2))) - darrow(`$1',ifinstr(`$2',S,t),ifinstr(`$2',E,t),m4thick,m4wid,m4ht,m4ends) -popdef(`m4ends')popdef(`m4ends')popdef(`m4ht')popdef(`m4wid')popdef(`m4thick')') + `pushkey_(`$2',thick,dlthick) + pushkey_(`$2',wid,dlthick*3/2) + pushkey_(`$2',ht,dlthick) + pushkey_(`$2',ends)pushdef(`m4ends',substr(m4ends,1,eval(len(m4ends)-2))) + darrow(`$1',ifinstr(`$2',S,t),ifinstr(`$2',E,t),m4thick,m4wid,m4ht,m4ends)dnl + popdef(`m4ends')popdef(`m4ends')popdef(`m4ht',`m4wid',`m4thick')') `dtee([L|R],dlthick) Construct tee with tail right, left, or back along current direction, leaving @@ -293,11 +293,11 @@ define(`darc',`[ C: (0,0) !- closed end with half-width line eg Darc(C,r,ang1,ang2,ends=<-|)' define(`Darc', - `setkey_(`$5',thick,dlthick) - setkey_(`$5',wid,dlthick*1.75) - setkey_(`$5',ht,dlthick) - setkey_(`$5',ends)pushdef(`m4ends',substr(m4ends,1,eval(len(m4ends)-2))) - darc(`$1',`$2',`$3',`$4',m4thick,m4wid,m4ht,m4ends) -popdef(`m4ends')popdef(`m4ends')popdef(`m4ht')popdef(`m4wid')popdef(`m4thick')') + `pushkey_(`$5',thick,dlthick) + pushkey_(`$5',wid,dlthick*1.75) + pushkey_(`$5',ht,dlthick) + pushkey_(`$5',ends)pushdef(`m4ends',substr(m4ends,1,eval(len(m4ends)-2))) + darc(`$1',`$2',`$3',`$4',m4thick,m4wid,m4ht,m4ends)dnl + popdef(`m4ends')popdef(`m4ends')popdef(`m4ht',`m4wid',`m4thick')') divert(0)dnl diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.html b/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.html deleted file mode 100644 index a2062072f81..00000000000 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.html +++ /dev/null @@ -1,8601 +0,0 @@ - - - - - - - - - - - - - - - - - -
-
M4 Macros for Electric Circuit Diagrams in L
A
T
E
X Documents
Dwight Aplevich
Contents, Version 9.6.4
1 Introduction . . . . . . . . . . . . . . . . . . . . . 1
2 Using the macros . . . . . . . . . . . . . . . . 2
2.1 Quick start . . . . . . . . . . . . . 2
2.1.1 Using m4 . . . . . . . . . . 3
2.1.2
Processing with dpic and
PSTricks or Tikz PGF . . . 3
2.1.3 Processing with gpic . . . . 3
2.1.4 Simplifications . . . . . . . 4
2.2 Including the libraries . . . . . . . 5
3 Pic essentials . . . . . . . . . . . . . . . . . . . . . 6
3.1 Manuals . . . . . . . . . . . . . . . 6
3.2
The linear objects:
line, arrow,
spline, arc . . . . . . . . . . . . 6
3.3 Positions . . . . . . . . . . . . . . . 7
3.4
The planar objects:
box, circle,
ellipse, and text . . . . . . . . . 7
3.5 Compound objects . . . . . . . . . 8
3.6 Other language facilities . . . . . . 8
4 Two-terminal circuit elements . . . . 9
4.1 Circuit and element basics . . . . . 9
4.2 The two-terminal elements . . . . . 10
4.3 Branch-current arrows . . . . . . . 14
4.4 Labels . . . . . . . . . . . . . . . . 15
5 Placing two-terminal elements . . . . 16
5.1 Series and parallel circuits . . . . . 17
6 Composite circuit elements . . . . . . . 18
6.1 Semiconductors . . . . . . . . . . . 25
7 Corners . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8 Looping . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9 Logic gates . . . . . . . . . . . . . . . . . . . . . . . 29
10 Integrated circuits . . . . . . . . . . . . . . . 33
11 Element and diagram scaling . . . . . 33
11.1 Circuit scaling . . . . . . . . . . . 34
11.2 Pic scaling . . . . . . . . . . . . . . 34
12 Writing macros . . . . . . . . . . . . . . . . . . 35
12.1 Macro arguments . . . . . . . . . . 38
13 Interaction with L
A
T
E
X . . . . . . . . . . . 39
14 PSTricks and other tricks . . . . . . . . 41
14.1 Tikz with pic . . . . . . . . . . . . 42
15 Web documents, pdf, and alterna-
tive output formats . . . . . . . . . . . . . . 42
16 Developer’s notes . . . . . . . . . . . . . . . . 43
17 Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
18 List of macros . . . . . . . . . . . . . . . . . . . . 47
References . . . . . . . . . . . . . . . . . . . . . . 70
1 Introduction
It appears that people who are unable to execute pretty pictures with pen and paper
find it gratifying to try with a computer [10].
This manual
1
describes a method for drawing electric circuits and other diagrams in L
A
T
E
X
and web documents. The diagrams are defined in the simple pic drawing language [
8
] augmented
with m4 macros [
9
], and are processed by m4 and a pic processor to convert them to Tikz PGF,
PSTricks, other L
A
T
E
X-compatible code, or SVG. In its basic form, the method has the advantages
and disadvantages of T
E
X itself, since it is macro-based and non-WYSIWYG, 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 IEC and IEEE standards [
6
,
7
], 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 combinations of them for particular drawings.
1
This document is best displayed with a reader that shows bookmarks.
1
-
2 Using the macros
This section describes the basic process of adding circuit diagrams to L
A
T
E
X documents to produce
postscript or pdf files. On some operating systems, project management software with graphical
interfaces can automate the process, but the steps can also be performed by a script, makefile, or by
hand for simple documents as described in Section 2.1.
The diagram source file is preprocessed as illustrated in Figure 1. A configuration file is read by
m4, followed by the diagram source. The result is passed through a pic interpreter to produce
.tex
output that can be inserted into a .tex document using the \input command.
.m4
diagram
.m4
macros
m4
pic
interpreter
.tex
files
L
A
T
E
X
or
PDFlatex
.dvi
or
.pdf
Figure 1: Inclusion of figures and macros in the L
A
T
E
X document.
The interpreter output contains Tikz PGF [
16
] commands, PSTricks [
17
] commands, basic L
A
T
E
X
graphics, tpic specials, or other formats, depending on the chosen options. These variations are
described in Section 15.
There are two principal choices of pic interpreter. One is dpic, described later in this document.
A partial alternative is GNU gpic -t (sometimes simply named pic) [
11
] together with a printer driver
that understands tpic specials, typically dvips [
14
]. The dpic processor extends the pic language in
small but important ways; consequently, some of the macros and examples in this distribution work
fully only with dpic. Pic processors contain basic macro facilities, so some of the concepts applied
here do not require m4.
2.1 Quick start
The contents of file
quick.m4
and resulting diagram are shown in Figure 2 to illustrate the language
and the production of basic labeled circuits.
.PS # Pic input begins with .PS
cct_init # Read in macro definitions and set defaults
elen = 0.75 # Variables are allowed; default units are inches
Origin: Here # Position names are capitalized
source(up_ elen); llabel(-,v_s,+)
resistor(right_ elen); rlabel(,R,)
dot
{ # Save the current position and direction
capacitor(down_ to (Here,Origin)) #(Here,Origin) = (Here.x,Origin.y)
rlabel(+,v,-); llabel(,C,)
dot
} # Restore position and direction
line right_ elen*2/3
inductor(down_ Here.y-Origin.y); rlabel(,L,); b_current(i)
line to Origin
.PE # Pic input ends
v
s
+
R
+
v
C L
i
Figure 2:
The file
quick.m4
and resulting diagram. There are several ways of drawing the same picture;
for example, nodes (such as
Origin
) can be defined and circuit branches drawn between them; or
absolute coordinates can be used (e.g.,
source(up_ from (0,0) to (0,0.75))
). Element sizes
and styles can be varied as described in later sections.
2
-
2.1.1 Using m4
The command
m4 filename . . .
causes m4 to search for the named files in the current directory and directories specified by
environmental variable
M4PATH
. Set
M4PATH
to the full name (i.e., the path) of the directory
containing
libcct.m4
and the other circuit library
.m4
files; otherwise invoke m4 as
m4 -I
installdir
where installdir is the path to the directory containing the library files. Now there are at least two
basic possibilities as follows, but be sure to read Section 2.1.4 for simplified use.
2.1.2 Processing with dpic and PSTricks or Tikz PGF
If you are using dpic with PSTricks, put
\usepackage{pstricks}
in the main L
A
T
E
X source file
header and type the following commands or put them into a script:
m4 pstricks.m4 quick.m4 > quick.pic
dpic -p quick.pic > quick.tex
To produce Tikz PGF code, the L
A
T
E
X header should contain
\usepackage{tikz}
. The commands
are modified to read pgf.m4 and invoke the -g option of dpic as follows:
m4 pgf.m4 quick.m4 > quick.pic
dpic -g quick.pic > quick.tex
A configuration file (
pstricks.m4
and
pgf.m4
in the above examples) is always the first file to
be given to m4. Put the following or its equivalent in the document body:
\begin{figure}[ht]
\centering
\input quick
\caption{Customized caption for the figure.}
\label{Symbolic_label}
\end{figure}
Then for PSTricks, the commands
latex
file
; dvips
file produce file
.ps
, which can be printed or
viewed using
gsview
, for example. For Tikz PGF, Invoking PDFlatex on the source produces
.pdf
output directly. The essential line is \input quick whether or not the figure environment is used.
The effect of the m4 command above is shown in Figure 3. Configuration files
pstricks.m4
or
pgf.m4
cause library
libgen.m4
to be read, thereby defining the macro
cct_init
. The diagram
source file is then read and the circuit-element macros in
libcct.m4
are defined during expansion
of cct_init.
.pic
m4
Configuration file
pstricks.m4 libgen.m4
· · ·
define(‘cct_init’,...)
· · ·
Diagram source quick.m4
.PS
cct_init
· · ·
libcct.m4
· · ·
define(‘resistor’,...)
· · ·
Figure 3: The command m4 pstricks.m4 quick.m4 > quick.pic.
2.1.3 Processing with gpic
If your printer driver understands tpic specials and you are using gpic (on some systems the gpic
command is pic), the commands are
3
-
m4 gpic.m4 quick.m4 > quick.pic
gpic -t quick.pic > quick.tex
and the figure inclusion statements are as shown:
\begin{figure}[ht]
\input quick
\centerline{\box\graph}
\caption{Customized caption for the figure.}
\label{Symbolic_label}
\end{figure}
2.1.4 Simplifications
M4 must read a configuration file before any other files, either before reading the diagram source file
or at the beginning of it. There are several ways to control the process, as follows:
1.
The macros can be processed by L
A
T
E
X-specific project software and by graphic applications
such as Pycirkuit [
12
]. Alternatively when many files are to be processed, a facility such as
Unix “make,” which is also available in PC and Mac versions, can be employed to automate
the required commands. On systems without such facilities, a scripting language can be used.
2. The m4 commands illustrated above can be shortened to
m4 quick.m4 > quick.pic
by inserting
include(pstricks.m4)
(assuming PSTricks processing) immediately after the
.PS
line, the effect of which is shown in Figure 4. However, if you then want to use Tikz PGF,
the line must be changed to include(pgf.m4).
.pic
m4
Diagram source
.PS
include(pstricks.m4)
cct_init
· · ·
Configuration file
pstricks.m4 libgen.m4
· · ·
define(‘cct_init’,...)
· · ·
libcct.m4
· · ·
define(‘resistor’,...)
· · ·
Figure 4:
The command
m4 quick.m4 > quick.pic
, with
include(pstricks.m4)
preceding
cct_init
.
3.
In the absence of a need to examine the file
quick.pic
, the commands for producing the
.tex
file can be reduced (provided the above inclusions have been made) to
m4 quick.m4 | dpic -p > quick.tex
4.
You can put several diagrams into a single source file. Make each diagram the body of a L
A
T
E
X
macro, as shown:
\newcommand{\diaA}{%
.PS
drawing commands
.PE
\box\graph }% \box\graph not required for dpic
\newcommand{\diaB}{%
.PS
drawing commands
.PE
\box\graph }% \box\graph not required for dpic
Produce a
.tex
file as usual, insert the
.tex
into the L
A
T
E
X source, and invoke the macros
\diaA and \diaB at the appropriate places.
4
-
5.
In some circumstances, it may be desirable to invoke m4 and dpic automatically from the
document. Define a macro \mtotex as shown in the following example:
\documentclass{article}
\usepackage{tikz}
\newcommand\mtotex[2]{\immediate\write18{m4 #2.m4 | dpic -#1 > #2.tex}}%
\begin{document}
\mtotex{g}{FileA} % Generate FileA.tex
\input{FileA.tex} \par
\mtotex{g}{FileB} % Generate FileB.tex
\input{FileB.tex}
\end{document}
The first argument of
\mtotex
is a
p
for pstricks or
g
for pgf. Sources
FileA.m4
and
FileB.m4
must contain any required
include
statements, and the main document should be processed
using the latex or pdflatex option
--shell-escape
. If the
M4PATH
environment variable is
not set then insert
-I
installdir after
m4
in the command definition, where installdir is the
absolute path to the installation directory. This method processes the picture source each
time L
A
T
E
X is run, so for large documents containing many diagrams, the
\mtotex
lines could
be commented out after debugging the corresponding graphic. A derivative of this method
that allows the insertion of pic code into a Tikz picture is described in Section 14.1.
6.
It might be convenient for the source of small diagrams to be part of the document source text.
The
filecontents
environment of current L
A
T
E
X allows this; older versions can employ a
now-obsolete package
filecontents.sty
. The following example for processing by
pdflatex
--shell-escape
first writes the m4 source to file
sample.m4
, invokes
\mtotex
on it, and reads
in the result:
\begin{filecontents}[overwrite,noheader,nosearch]{sample.m4}
include(pgf.m4)
.PS
cct_init
drawing commands . . .
.PE
\end{filecontents}
\mtotex{g}{sample}
\input{sample.tex}
2.2 Including the libraries
The configuration files for dpic are as follows, depending on the output format (see Section 15):
pstricks.m4, pgf.m4, mfpic.m4, mpost.m4, postscript.m4, psfrag.m4, svg.m4, gpic.m4,
or
xfig.m4
. The file
psfrag.m4
simply defines the macro
psfrag_
and then reads
postscript.m4
.
For gpic, the configuration file is
gpic.m4
. The usual case for producing circuit diagrams is to read
pstricks.m4
or
pgf.m4
first when dpic is the postprocessor or to set one of these as the default
configuration file.
At the top of each diagram source, put one or more initialization commands; that is,
cct_init, log_init, sfg_init, darrow_init, threeD_init
or, for diagrams not requiring specialized macros,
gen_init
. As shown in Figures 3 and 4, each
initialization command reads in the appropriate macro library if it hasn’t already been read; for
example, cct_init tests whether libcct.m4 has been read and includes it if necessary.
A few of the distributed example files contain other experimental macros that can be pasted into
diagram source files; see Flow.m4 or Buttons.m4, for example.
The libraries contain hints and explanations that might help in debugging or if you wish to
modify any of the macros. Macros are generally named using the obvious circuit element names
so that programming becomes something of an extension of the pic language. Some macro names
5
-
end in an underscore to reduce the chance of name clashes. These can be invoked in the diagram
source but there is no long-term guarantee that their names and functionality will remain unchanged.
Finally, macros intended only for internal use begin with the characters m4.
3 Pic essentials
Pic source is a sequence of lines in a text file. The first line of a diagram begins with
.PS
with
optional following arguments, and the last line is normally
.PE
. Lines outside of these pass through
the pic processor unchanged.
The visible objects can be divided conveniently into two classes, the linear objects
line, arrow,
spline, arc, and the planar objects box, circle, ellipse.
The object
move
is linear but draws nothing. A compound object, or
block,
is planar and
consists of a pair of square brackets enclosing other objects, as described in Section 3.5.
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. Objects or locations on the diagram can be given
symbolic names beginning with an upper-case letter.
3.1 Manuals
The classic pic manual [
8
] is still a good introduction to pic, but a more complete manual [
13
] can be
found in the GNU groff package, and both are available on the web [
8
,
13
]. Reading either will give
you competence with pic in an hour or two. Explicit mention of
*roff
string and font constructs in
these manuals should be replaced by their equivalents in the L
A
T
E
X context. A man-page language
summary is appended to the dpic manual [1].
A web search will yield good discussions of “little languages”; for pic in particular, see Chapter 9
of [2]. Chapter 1 of reference [4] also contains a brief discussion of this and other languages.
3.2 The linear objects: line, arrow, spline, arc
A line can be drawn as follows:
line from position to position
where position is defined below or
line direction distance
where direction is one of
up, down, left, right.
When used with the m4 macros described here,
it is preferable to add an underscore:
up_, down_, left_, right_.
The distance is a number or
expression and the units are inches, but the assignment
scale = 25.4
has the effect of changing the units to millimetres, as described in Section 11.
Lines can also be drawn to any distance in any direction. The example,
line up_ 3/sqrt(2) right_ 3/sqrt(2) dashed
draws a line 3 units long from the current location, at a 45
angle above horizontal. Lines (and
other objects) can be specified as dotted, dashed, or invisible, as above.
The construction
line from A to B chop x
truncates the line at each end by
x
(which may be negative) or, if
x
is omitted, by the current circle
radius, a convenience when A and B are circular graph nodes, for example. Otherwise
line from A to B chop x chop y
truncates the line by x at the start and y at the end.
Any of the above means of specifying line (or arrow) direction and length will be called a linespec.
Lines can be concatenated. For example, to draw a triangle:
line up_ sqrt(3) right_ 1 then down_ sqrt(3) right_ 1 then left_ 2
6
-
3.3 Positions
A position can be defined by a coordinate pair, e.g.
3,2.5
, more generally using parentheses by
(
expression, expression
)
, as a sum or difference as position +
(
expression, expression
)
, or by the
construction
(
position, position
)
, the latter taking the
x
-coordinate from the first position and
the
y
-coordinate from the second. A position can be given a symbolic name beginning with an
upper-case letter, e.g.
Top: (0.5,4.5)
. Such a definition does not affect the calculated figure
boundaries. The current position
Here
is always defined and is equal to (0
,
0) at the beginning of a
diagram or block. The coordinates of a position are accessible, e.g.
Top.x
and
Top.y
can be used in
expressions. The center, start, and end of linear objects (and the defined points of other objects as
described below) are predefined positions, as shown in the following example, which also illustrates
how to refer to a previously drawn element if it has not been given a name:
line from last line.start to 2nd last arrow.end then to 3rd line.center
Objects can be named (using a name commencing with an upper-case letter), for example:
Bus23: line up right
after which, positions associated with the object can be referenced using the name; for example:
arc cw from Bus23.start to Bus23.end with .center at Bus23.center
An arc is drawn by specifying its rotation, starting point, end point, and center, but sensible
defaults are assumed if any of these are omitted. Note that
arc cw from Bus23.start to Bus23.end
does not define the arc uniquely; there are two arcs that satisfy this specification. This distribution
includes the m4 macros
arcr( position, radius, start radians, end radians, modifiers, ht)
arcd( position, radius, start degrees, end degrees, modifiers, ht)
arca( chord linespec, ccw|cw, radius, modifiers)
to draw uniquely defined arcs. If the fifth argument of
arcr
or
arcd
contains
->
or
<-
then a
midpoint arrowhead of height specified by arg6 is added. For example,
arcd((1,-1),,0,-90,<- outlined "red") dotted
draws a red dotted arc with midpoint arrowhead, centre at (1
,
1)
,
and default radius. The example
arca(from (1,1) to (2,2),,1,->)
draws an acute angled arc with arrowhead on the chord defined by the first argument.
The linear objects can be given arrowheads at the start, end, or both ends, for example:
line dashed <- right 0.5
arc <-> height 0.06 width 0.03 ccw from Here to Here+(0.5,0) \
with .center at Here+(0.25,0)
spline -> right 0.5 then down 0.2 left 0.3 then right 0.4
The arrowheads on the arc above have had their shape adjusted using the
height
and
width
parameters.
3.4 The planar objects: box, circle, ellipse, and text
Planar objects are drawn by specifying the width, height, and position, thus:
A: box ht 0.6 wid 0.8 at (1,1)
after which, in this example, the position
A.center
is defined, and can be referenced simply as
A
.
The compass points
A.n, A.s, A.e, A.w, A.ne, A.se, A.sw, A.nw
are automatically defined, as
are the dimensions
A.height
and
A.width.
Planar objects can also be placed by specifying the
location of a defined point; for example, two touching circles can be drawn as shown:
circle radius 0.2
circle diameter (last circle.width * 1.2) with .sw at last circle.ne
The planar objects can be filled with gray or colour. For example, either
box dashed fill_(number) or box dashed outlined "color" shaded "color"
produces a dashed box. The first case has a gray fill determined by number, with 0 corresponding
to black and 1 to white; the second case allows color outline and fill, the color strings depending
on the postprocessor. Postprocessor-compatible RGB color strings are produced by the macro
rgbstring(red fraction, green fraction, blue fraction); to produce an orange fill for example:
... shaded rgbstring( 1, 0.645, 0)
7
-
Basic colours for lines and fills are provided by gpic and dpic, but more elaborate line and fill
styles or other effects can be incorporated, depending on the postprocessor, using
command "string"
where string is one or more postprocessor command lines.
Arbitrary text strings, typically meant to be typeset by L
A
T
E
X, are delimited by double-quote
characters and occur in two ways. The first way is illustrated by
"\large Resonances of $C_{20}H_{42}$" wid x ht y at position
which writes the typeset result, like a box, at position and tells pic its size. The default size assumed
by pic is given by parameters
textwid
and
textht
if it is not specified as above. The exact typeset
size of formatted text can be obtained as described in Section 13. The second occurrence associates
one or more strings with an object, e.g., the following writes two words, one above the other, at the
centre of an ellipse:
ellipse "\bf Stop" "\bf here"
The C-like pic function sprintf("format string",numerical arguments) is equivalent to a string.
3.5 Compound objects
A compound object is a group of statements enclosed in square brackets. Such an object is placed
by default as if it were a box, but it can also be placed by specifying the final position of a defined
point. A defined point is the center or compass corner of the bounding box of the compound object
or one of its internal objects. Consider the last line of the code fragment shown:
Ands: [ right_
And1: AND_gate
And2: AND_gate at And1 - (0,And1.ht*3/2)
. . .
] with .And2.In1 at position
The two gate macros evaluate to compound objects containing
Out
,
In1
, and other locations. The
final positions of all objects inside the square brackets are determined in the last line by specifying
the position of In1 of gate And2.
3.6 Other language facilities
All objects have default sizes, directions, and other characteristics, so part of the specification of an
object can sometimes be profitably omitted.
Another possibility for defining positions is
expression between position and position
which means
1st position + expression × (2nd position 1st position)
and which can be abbreviated as
expression < position , position >
Care has to be used in processing the latter construction with m4, since the comma may have to be
put within quotes, ‘,’ to distinguish it from the m4 argument separator.
Positions can be calculated using expressions containing variables. The scope of a position is the
current block. Thus, for example,
theta = atan2(B.y-A.y,B.x-A.x)
line to Here+(3*cos(theta),3*sin(theta)).
Expressions are the usual algebraic combinations of primary quantities: constants, environmental
parameters such as
scale,
variables, horizontal or vertical coordinates of terms such as position
.x
or position
.y
, dimensions of pic objects, e.g.
last circle.rad
. The elementary algebraic operators
are +, -, *, /, %, =, +=, -=, *=, /=, and %=, similar to the C language.
The logical operators
==, !=, <=, >=, >,
and
<
apply to expressions and strings. A modest
selection of numerical functions is also provided: the single-argument functions
sin, cos, log,
exp, sqrt, int
, where
log
and
exp
are base-10, the two-argument functions
atan2, max, min,
and the random-number generator rand(). Other functions are also provided using macros.
8
-
A pic manual should be consulted for details, more examples, and other facilities, such as the
branching facility
if expression then { anything } else { anything },
the looping facility
for variable = expression to expression by expression do { anything },
operating-system commands, pic macros, and external file inclusion.
4 Two-terminal circuit elements
There is a fundamental difference between the two-terminal elements, each of which is drawn along
an invisible straight-line segment, and other elements, which are compound objects mentioned in
Section 3.5. The two-terminal element macros follow a set of conventions described in this section,
and other elements will be described in Section 6.
4.1 Circuit and element basics
A list of the library macros and their arguments is in Section 18. The arguments have default values,
so that only those that differ from defaults need be specified.
Figure 5, which shows a resistor, also serves as an example of pic commands. The first part of
the source file for this figure is on the left:
.PS
cct_init
linewid = 2.0
linethick_(2.0)
R1: resistor
last []
R1.start R1.endR1.centre
elen_
dimen_
Figure 5: Resistor named R1, showing the size parameters, enclosing block, and predefined positions.
The lines of Figure 5 and the remaining source lines of the file are explained below:
The first line invokes the macro
cct_init
that loads the library
libcct.m4
and initializes
local variables needed by some circuit-element macros.
The sizes of circuit elements are proportional to the pic environmental variable
linewid
, so
redefining this variable changes element sizes. The element body is drawn in proportion to
dimen_
, a macro that evaluates to
linewid
unless redefined, and the default element length
is
elen_
, which evaluates to
dimen_*3/2
unless redefined. Setting
linewid
to 2.0 as in the
example means that the default element length becomes 3.0 in. For resistors, the default length
of the body is
dimen_/2,
and the width is
dimen_/6.
All of these values can be customized.
Element scaling and the use of SI units is discussed further in Section 11.
The macro
linethick_
sets the default thickness of subsequent lines (to 2.0 pt in the example).
Macro arguments are written within parentheses following the macro name, with no space
between the name and the opening parenthesis. Lines can be broken before macro arguments
because m4 and dpic ignore white space immediately preceding arguments. Otherwise, a long
line can be continued to the next by putting a backslash as the rightmost character.
The two-terminal element macros expand to sequences of drawing commands that begin with
‘line invis
linespec
, where linespec is the first argument of the macro if it is non-blank,
otherwise the line is drawn a distance
elen_
in the current direction, which is to the right
by default. The invisible line is first drawn, then the element is drawn on top of it. The
element—rather, the initial invisible line—can be given a name,
R1
in the example, so that
positions R1.start, R1.centre, and R1.end are automatically defined as shown.
9
-
The element body is overlaid by a block, which can be used to place labels around the element.
The block corresponds to an invisible rectangle with horizontal top and bottom lines, regardless
of the direction in which the element is drawn. A dotted box has been drawn in the diagram
to show the block boundaries.
The last sub-element, identical to the first in two-terminal elements, is an invisible line that
can be referenced later to place labels or other elements. If you create your own macros, you
might choose simplicity over generality, and include only visible lines.
To produce Figure 5, the following embellishments were added after the previously shown source:
thinlines_
box dotted wid last [].wid ht last [].ht at last []
move to 0.85 between last [].sw and last [].se
spline <- down arrowht*2 right arrowht/2 then right 0.15; "\tt last []" ljust
arrow <- down 0.3 from R1.start chop 0.05; "\tt R1.start" below
arrow <- down 0.3 from R1.end chop 0.05; "\tt R1.end" below
arrow <- down last [].c.y-last arrow.end.y from R1.c; "\tt R1.centre" below
dimension_(from R1.start to R1.end,0.45,\tt elen\_,0.4)
dimension_(right_ dimen_ from R1.c-(dimen_/2,0),0.3,\tt dimen\_,0.5)
.PE
The line thickness is set to the default thin value of
0.4 pt
, and the box displaying the element
body block is drawn. Notice how the width and height can be specified, and the box centre
positioned at the centre of the block.
The next paragraph draws two objects, a spline with an arrowhead, and a string left justified
at the end of the spline. Other string-positioning modifiers than
ljust
are
rjust, above,
and below.
The last paragraph invokes a macro for dimensioning diagrams.
4.2 The two-terminal elements
The two-terminal elements are shown in Figures 6 to 15 and part of Figure 16. Several elements
are included more than once to illustrate some of their arguments, which are listed in detail in
Section 18. Figure 6 shows some resistors with typical variants.
resistor
resistor(,,Q) resistor(,,V)
resistor(,,ES) resistor(,,H) resistor(,,AC)
resistor(,,B)
resistor(,,E)
ebox
ebox(,0.5,0.3)
ebox(,,,0.9)
ebox(,,,,shaded "green")
X
ebox(,wdth=0.2;box=dashed shaded "green";text="X")
Figure 6:
Resistors dawn by the macro
resistor(
linespec, n
|E,
chars
,
cycle wid
)
. The second argument
is either an integer to specify number of cycles, the letter
E
, or blank. The third argument specifies
the desired variant. The default ebox element designates a resistor.
The first macro argument specifies the invisible line segment along which the element is drawn.
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.
Thus, for example,
resistor(up_ 1.25,7)
draws a resistor 1.25 units long up from the current position, with 7 vertices per side. The macro
up_ evaluates to up but also resets the current directional parameters to point up.
10
-
Capacitors are illustrated in Figure 7. See Section 6 for the variable macro.
capacitor
capacitor(,C) capacitor(,C+)
capacitor(,P) capacitor(,E) capacitor(,K)
capacitor(,M) capacitor(,N) capacitor(,CP)
capacitor(,dC) capacitor(,dF)
variable(capacitor’,
NN,-30,dimen_/3)
Figure 7:
The
capacitor(
linespec, chars,
[R],
height, width
)
macro, and an example application of the
variable macro.
Basic inductors are illustrated in Figure 8.
inductor
inductor(,W) inductor(,L)
...(„3,M)
...(,W,6,P1);
variable
...(,L,9,K)
...(,,,M3)
addtaps(-,1/2,-dimen_/6)
ebox(,,,0)
tapped(‘ebox(,,,0)’,
-,1/4,-dimen_/6,
3/4,-dimen_/6)
Tap1 Tap2
shielded(
‘inductor(,,,M)’)
shielded(‘ebox(,,,0)’,R)
Figure 8:
Basic inductors created with the
inductor(
linespec,
W|L,
cycles,
M|P|K,
loop wid
)
macro,
the
ebox
macro for European-style inductors, and some modifications (see also Section 6). When an
embellished element is repeated several times, writing a wrapper macro may be desirable.
Some more basic elements are in Figure 9, and amplifiers in Figure 10.
lamp thermocouple
memristor heater tline
pvcell
reed
reed(,,,fill_(0.9),CR)
gap
gap(,,A)
arrowline
xtal
xtal(,type=R)
Figure 9: More two-terminal elements.
amp
amp(,0.3)
delay
delay(,0.2)
integrator
integrator(,0.3)
Figure 10: Amplifier, delay, and integrator.
Figure 11 shows sources, many of which contain internal symbols, and of which the
AC
and
S
options illustrate the need to draw a single cycle of a sinusoid or approximate sinusoid. As a
convenience, the macro
ACsymbol(at
position, length, height,
[A]U|D|L|R|
degrees
)
is included as
an interface to the sinusoid macro. For example to add the sumbol to an ebox:
ebox; { ACsymbol(at last [],,,dimen_/8) }
For direct current ( ), there is also
DCsymbol(at
position, length, height,
U|D|L|R|
degrees
)
,
and for power-system diagrams, macros
Deltasymbol(at
position, keys,
U|D|L|R|
degrees
)
, and
Ysymbol(at position, keys, U|D|L|R|degrees),
11
-
source
source(,I)
source(,i)
+
source(,V)
source(,v)
source(,S)
source(,AC)
source(,X)
source(,F)
source(,G)
source(,Q)
proximity
= consource(,P)
source(,,0.4)
source(,P)
source(,U)
source(,H)
source(,R)
source(,SC)
source(,SCr)
source(,T)
source(,L)
source(,B)
nullator
norator
source(,N)
mA
source(,"mA")
consource
consource(,I)
consource(,i)
source(,SE)
+
consource(,V)
consource(,v)
battery
battery(,3,R)
G
ttmotor(,G)
Figure 11: Sources and source-like elements.
Diodes and fuses are shown in Figures 12 and 13.
diode
diode(,S)
diode(,V)
diode(,v)
diode(,w)
diode(,B)
diode(,G)
diode(,K)
diode(,ZK)
diode(,CR)
diode(,L)
diode(,F)
diode(,Sh)
diode(,D)
diode(,Z,RE)
diode(,T)
diode(,P)
diode(,LE)
diode(,LER)
Figure 12:
The macro
diode(
linespec
,B|CR|D|L|LE[R]|P[R]|S|T|V|v|w|Z|
chars
,[R][E])
. Appending
K to the second argument draws an open arrowhead.
fuse
fuse(,D) fuse(,B) fuse(,C) fuse(,S) fuse(,SB)
cbreaker
cbreaker(,R) . . .(,,D) . . .(,,T) . . .(,,TS)
fuse(,HB)
(,HC,0.5,0.3)
Figure 13:
Variations of the macros
fuse(
linespec
, A|dA|B|C|D|E|S|HB|HC|SB,
wid
,
ht
)
and
cbreaker(linespec,L|R,D|T|TS).
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
mechanism, as follows.
The first argument of the macro
reversed(‘macro name’,macro arguments)
12
-
is the name of a two-terminal element in quotes, followed by the element arguments. The element is
drawn with reversed direction; thus,
diode(right_ 0.4); reversed(‘diode’,right_ 0.4)
draws two diodes to the right, but the second one points left.
Similarly, the macro
resized(factor,‘macro name’,macro arguments)
can be used to resize the body of an element by temporarily multiplying the
dimen_
macro by factor.
More general resizing should be done by redefining
dimen_
as described in Section 11.1. These two
macros can be nested; the following scales the above example by 1.8, for example
resized(1.8,‘diode’,right_ 0.4); resized(1.8,‘reversed’,‘diode’,right_ 0.4)
Figure 14 contains radiation-effect arrows for embellishing two-terminal and other macros. The
Head
Tail
A1
A2
em_arrows(N)
em_arrows(ND,45) . . .(I) . . .(ID) . . .(E) . . .(ED)
Figure 14: Radiation arrows: em_arrows(type, angle, length)
arrow stems are named A1, A2, and each pair is drawn in a
[]
block, with the names Head and
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
LE
option
in Figure 12. For absolute arrow directions, one can define a wrapper (see Section 12) for the
diode
macro to draw arrows at 45 degrees, for example:
define(‘myLED’,‘diode(‘$1’); em_arrows(N,45) with .Tail at last [].ne’)
Switches with numerous controls are in Figure 15.
lswitch
(,,O) (,,C) (,,DA) (,,dDO) (,,uDC)
(,,K) (,,KD) (,,KOD) (,,KCD)
bswitch
(,,C)
dswitch(,,)
W
B
(,,WdBK)
dB
K
(,,WBmdDK) (,,WBKTr)
(,,WdBL)
(,,WBCo)
(,,WBKCo) (,,WBCb) (,,WBDI) (,,WBSd) (,,WBFDI) (,,WBFSd)
(,,WBTh) (,,WBKC) (,,WBM) (,,WBCO) (,,WBMP) (,,WBoKCP)
(,,WBCY) (,,WBCZ) (,,WBCE) (,,WBRH) (,,WBRdH) (,,WBRHH)
(,,WBMMR) (,,WBMM) (,,WBMR) (,,WBEL) (,,WBLE) (,,WBoKEL)
(,,WBPr) (,,WBPrT)
(,,WBPrM)
Figure 15:
The
switch(
linespec
,L|R,
chars
,L|B|D)
macro is a wrapper for the macros
lswitch(
linespec
,[L|R],[O|C][D][K][A])
,
bswitch(
linespec
,[L|R],[O|C])
, and the many-
optioned
dswitch(
linespec
,R,W[ud]B[K]
chars
)
shown. The switch is drawn in the current drawing
direction. A second-argument
R
produces a mirror image with respect to the drawing direction. The
separately defined macros Proxim and Magn embellish switches in the second-last row.
13
-
Figure 16 shows a collection of surge-protection devices, or arresters, of which the
E
and
S
types
may be either 2-terminal or as 3-terminal (composite) elements described in Section 6.
arrester
arrester(,G)
...(,g)
...(,M) ...(,C) ...(,A)
...(,H) ...(,HR) ...(,P) ...(,s) ...(,F) ...(,S)
...(,E)
...(,DE)
A B
G
...(,DS)
A B
G
...(,DEL)
A B
G
...(,DSL)
A B
G
Figure 16:
Variations of the
arrester(
linespec, chars, wid
[:
arrowhead ht
],
ht
[:
arrowhead wid
])
macro. Putting
D
in argument 2 for the
S
or
E
configuration creates a 3-terminal composite element
with terminals A, B, and G.
Figure 17 shows some two-terminal elements with arrows or lines overlaid to indicate variability
using the macro
variable(‘element’,type,[+|-]angle,length),
where type is one of
A, P, L, N, NN
with
C
or
S
optionally appended to indicate continuous
or stepwise variation. Alternatively, this macro can be invoked similarly to the label macros in
Section 4.4 by specifying an empty first argument; thus, the following line draws the third resistor
in Figure 17:
resistor(up_ dimen_); variable(,uN)
A N uN NN uNN
C S
A
P
L
N
Figure 17:
Illustrating
variable(‘
element
’,[A|P|L|[u]N]|[u]NN]][C|S],[+|-]
angle
,
length
)
. For
example,
variable(‘resistor(up_ dimen_)’,A)
draws the leftmost resistor shown above. The
default angle is 45
, 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 Figure 7, for example. The array on the right shows the effect of the second argument.
4.3 Branch-current arrows
Arrowheads and labels can be added to conductors using basic pic statements. For example, the
following line adds a labeled arrowhead at a distance
alpha
along a horizontal line that has just
been drawn. Many variations of this are possible:
arrow right arrowht from last line.start+(alpha,0) "$i_1$" above
Macros have been defined to simplify labelling two-terminal elements, as shown in Figure 18.
The macro
b_current(label, above_|below_, In|O[ut], Start|E[nd], frac)
draws an arrow from the start of the last-drawn two-terminal element frac of the way toward the
body.
If the fourth argument is
End
, the arrow is drawn from the end toward the body. If the third
element is
Out
, the arrow is drawn outward from the body. The first argument is the desired label,
of which the default position is the macro
above_,
which evaluates to
above
if the current direction
14
-
i
b_current(i)
i
. . .(i,below_)
i
. . .(i,,O)
i
. . .(i,below_,O)
i
b_current(i,,,E)
i
. . .(i,below_,,E)
i
. . .(i,,O,E,0.2)
i
. . .(i,below_,O,E)
i
larrow(i)
i
rarrow(i)
i
larrow(i,<-)
i
rarrow(i,<-)
Figure 18: Illustrating b_current, larrow, and rarrow. The drawing direction is to the right.
is right or to
ljust, below, rjust
if the current direction is respectively down, left, up. The label
is assumed to be in math mode unless it begins with
sprintf
or a double quote, in which case it
is copied literally. A non-blank second argument specifies the relative position of the label with
respect to the arrow, for example
below_,
which places the label below with respect to the current
direction. Absolute positions, for example below or ljust, also can be specified.
For those who prefer a separate arrow to indicate the reference direction for current, the macros
larrow(
label
, ->|<-,
dist
)
and
rarrow(
label
, ->|<-,
dist
)
are provided. The label is placed
outside the arrow as shown in Figure 18. The first argument is assumed to be in math mode unless
it begins with
sprintf
or a double quote, in which case the argument is copied literally. The third
argument specifies the separation from the element.
4.4 Labels
Arbitrary labels can be positioned by any pic placement method including the representative basic
examples shown:
"text" at position
"text" at position above
"text" wid width ht height with .sw at position
In addition, special macros for labeling two-terminal elements are available:
llabel( arg1,arg2,arg3 )
clabel( arg1,arg2,arg3 )
rlabel( arg1,arg2,arg3 )
dlabel( long,lat,arg1,arg2,arg3,[X][A|B][L|R])
The first macro places the three arguments, which are treated as math-mode strings, on the
left side of the element block with respect to the current direction:
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 Figure 19. The macro
dlabel
performs these functions for an
.PS
# ‘Loop.m4’
cct_init
define(‘dimen_’,0.75)
loopwid = 1; loopht = 0.75
source(up_ loopht); llabel(-,v_s,+)
resistor(right_ loopwid); llabel(,R,); b_current(i)
inductor(down_ loopht,W); rlabel(,L,)
capacitor(left_ loopwid,C); llabel(+,v_C,-); rlabel(,C,)
.PE
v
s
+
R
i
L
+
v
C
C
Figure 19: A loop containing labeled elements, with its source code.
obliquely drawn element, placing the three macro arguments at
vec_(-long,lat), vec_(0,lat),
and
vec_(long,lat)
respectively relative to the centre of the element. In the fourth argument, an
X
aligns the labels with respect to the line joining the two terminals rather than the element body,
15
-
and
A, B, L, R
use absolute
above, below, left,
or
right
alignment respectively for the labels.
Labels beginning with
sprintf
or a double quote are copied literally rather than assumed to be in
math mode.
5 Placing two-terminal elements
The length and position of a two-terminal element are defined by a straight-line segment, so four
numbers or equivalent are required to place the element as in the following example:
resistor(from (1,1) to (2,1)).
However, pic has a very useful concept of the current point (explicitly named Here); thus,
resistor(to (2,1))
is equivalent to
resistor(from Here to (2,1)).
Any defined position can be used; for example, if C1 and L2 are names of previously defined
two-terminal elements, then, for example, the following places the resistor:
resistor(from L2.end to C1.start)
A line segment starting at the current position can also be defined using a direction and length.
To draw a resistor up d units from the current position, for example:
resistor(up_ d)
Pic stores the current drawing direction, which is unfortunately limited to
up, down, left,
right,
for reference when necessary. The circuit macros need to know the current direction, so
whenever
up, down, left, right
are used they should be written respectively as the macros
up_,
down_, left_, right_ as in 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 (but sometimes very elaborate) pic
code. Potentially, the matrix elements can be used for other transformations. The macro
setdir_(direction, default direction)
is preferred when setting drawing direction. The direction arguments are of the form
R[ight] | L[eft] | U[p] | D[own] | degrees,
but the macros
Point_(
degrees
), point_(
radians
),
and
rpoint_(
relative linespec
)
are employed
in many macros to re-define the entries of the matrix (named
m4a_
,
m4b_
,
m4c_
, and
m4d_
) for
the required rotation. The macro
eleminit_
in the two-terminal elements invokes
rpoint_
with a
specified or default linespec to establish element length and direction.
As shown in Figure 20,
Point_(-30); resistor
draws a resistor along a line with slope of -30
degrees, and
rpoint_(to Z)
sets the current direction cosines to point from the current location
to location Z. Macro
vec_(x,y)
evaluates to the position
(x,y)
rotated as defined by the argument
of the previous
setdir_, Point_, point_
or
rpoint_
command. The principal device used to
define relative locations in the circuit macros is
rvec_(x,y)
, which evaluates to position
Here +
vec_(x,y). Thus, line to rvec_(x,0) draws a line of length x in the current direction.
Figure 20 illustrates that some hand placement of labels using
dlabel
may be useful when
elements are drawn obliquely. The figure also illustrates that any commas within m4 arguments
must be treated specially because the arguments are separated by commas. Argument commas are
protected either by parentheses as in
inductor(from Cr to Cr+vec_(elen_,0))
, or by multiple
single quotes as in
‘‘,’’,
as necessary. Commas also may be avoided by writing
0.5 between L
and T instead of 0.5<L,T>.
16
-
.PS
# ‘Oblique.m4’
cct_init
Ct:dot; Point_(-60); capacitor(,C); dlabel(0.12,0.12,,,C_3)
Cr:dot; left_; capacitor(,C); dlabel(0.12,0.12,C_2,,)
Cl:dot; down_; capacitor(from Ct to Cl,C); dlabel(0.12,-0.12,,,C_1)
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.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)
line from L to 0.2<L,T>
source(to 0.5 between L and T); dlabel(sourcerad_+0.07,0.1,-,,+)
dlabel(0,sourcerad_+0.07,,u,)
resistor(to 0.8 between L and T); dlabel(0,0.15,,R_1,)
line to T
.PE
C
3
C
2
C
1
L
1
L
3
L
2
R
2
R
3
y
+
u
R
1
Figure 20: Illustrating elements drawn at oblique angles.
5.1 Series and parallel circuits
To draw elements in series, each element can be placed by specifying its line segment as described
previously, but the pic language makes some geometries particularly simple. Thus,
setdir_(Right)
resistor; llabel(,R); capacitor; llabel(,C); inductor; llabel(,L)
draws three elements in series as shown in the top line of Figure 21. However, the default length
R
C
L
R
C
L
R
C
L
Figure 21: Three ways of drawing basic elements in series.
elen_
appears too long for some diagrams. It can be redefined temporarily (to
dimen_
, say), by
enclosing the above line in the pair
pushdef(‘elen_’,dimen_) resistor. . . popdef(‘elen_’)
with the result shown in the middle row of the figure.
Alternatively, the length of each element can be tuned individually; for example, the capacitor in
the above example can be shortened as shown, producing the bottom line of Figure 21:
resistor; llabel(,R)
capacitor(right_ dimen_/4); llabel(,C)
inductor; llabel(,L)
If a macro that takes care of common cases automatically is to be preferred, you can use the
macro
series_(
elementspec, elementspec,
. . .)
. This macro draws elements of length
dimen_
from
the current position in the current drawing direction, enclosed in a
[ ]
block. The internal names
Start
,
End
, and
C
(for centre) are defined, along with any element labels. An elementspec is of
the form
[
Label
:]
element
; [
attributes
]
, where an attribute is zero or more of
llabel(. . .),
rlabel(. . .), or b_current(. . .).
17
-
Drawing elements in parallel requires a little more effort but, for example, three elements can be
drawn in parallel using the code snippet shown, producing the left circuit in Figure 22:
define(‘elen_’,dimen_)
L: inductor(right_ 2*elen_,W); llabel(+,L,-)
R1: resistor(right elen_ from L.start+(0,-dimen_)); llabel(,R1)
R2: resistor; llabel(,R2)
C: capacitor(right 2*elen_ from R1.start+(0,-dimen_)); llabel(,C)
line from L.start to C.start
line from L.end to C.end
+
L
R1 R2
C
Start
End
parallel_( ‘L:inductor(,W); llabel(+,L,-)’,
series_(‘R1:resistor; llabel(,R1)’, ‘R2:resistor; llabel(,R2)’),
‘C:capacitor; llabel(,C)’ )
R
1
R
2
L
C
+
V
Start
End
setdir_(Down)
parallel_(
series_(‘R1:resistor; rlabel(,R_1)’,
parallel_(
series_(‘resistor; rlabel(,R_2)’,
‘inductor(,W); rlabel(,L)’),
‘capacitor(,C); rlabel(,C)’ ),
line down dimen_/2),
‘Sep=linewid*3/2; V:source; rlabel(+,V,-)’)
Figure 22: Illustrating the macros parallel_ and series_, with Start and End points marked.
A macro that produces the same effect automatically is
parallel_(‘elementspec’, ‘elementspec’, . . .)
The arguments must be quoted to delay expansion, unless an argument is a nested
parallel_
or
series_
macro, in which case it is not quoted. The elements are drawn in a
[ ]
block with defined
points Start, End, and C. An elementspec is of the form
[Sep=val;][Label:] element; [attributes]
where an attribute is of the form
[llabel(. . .);] | [rlabel(. . .)] | [b_current(. . .);]
Putting
Sep=
val
;
in the first branch sets the default separation of all branches to val; in a later
element,
Sep=
val; applies only to that branch. An element may have normal arguments but should
not change the drawing direction.
6 Composite circuit elements
Many basic elements are not two-terminal. These elements are usually enclosed in a
[ ]
pic block,
and contain named interior locations and components. The block must be placed by using its
compass corners, thus: element
with
corner
at
position or, when the block contains a predefined
location, thus: element
with
location
at
position. A few macros are positioned with the first
argument; the
ground
macro, for example:
ground(at
position
).
In some cases, an invisible line
can be specified by the first argument 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.
18
-
The macro
potentiometer(
linespec
,
cycles
,
fractional pos
,
length
, . . .)
, shown in Figure 23,
first draws a resistor along the specified line, then adds arrows for taps at fractional positions along
the body, with default or specified length. A negative length draws the arrow from the right of the
current drawing direction.
potentiometer(down_ dimen_)
Start
End
T1
...(down_ dimen_,,0.5,-5mm__)
Start
End
T1
...(down_ dimen_,,0.25,-5mm__,0.75,5mm__)
Start
End
T1
T2
Figure 23: Default and multiple-tap potentiometer.
The macro
addtaps([
arrowhd
| type=
arrowhd
;name=
Name
],
fraction, length, fraction, length,
. . .)
, shown in Figure 24, will add taps to the immediately preceding two-terminal element. However,
R1.start R1.end
Tap1
Tap2
right_; t = 0.2in__
R1: resistor(,,E)
addtaps(<-,0.2,-t,0.8,t)
Tx1 Tx3
R2: ebox(,elen_*0.6)
addtaps(type=-;name=Tx,
0.2,-t,0.5,-t,0.8,-t)
R3.Start R3.End
R3.Tap1 R3.Tap3
R3: tapped(‘ebox(,elen_*0.6,)’,->,0.2,-t,0.5,-t,0.8,-t) \
with .Start at R1.start+(0.25in__,-0.6in__)
L1: tapped(‘inductor(right_ 9*dimen_/8,,9)’,
-,0,-t,3/9,-t/2,6/9,-t/2,1,-t)
L1.Tap1 L1.Tap4
Figure 24: Macros for adding taps to two-terminal elements.
the default names
Tap1, Tap2 . . .
may not be unique in the current scope. An alternative name
for the taps can be specified or, if preferable, the tapped element can be drawn in a [ ] block using
the macro
tapped(‘
two-terminal element
’, [
arrowhd
| type=
arrowhd
;name=
Name
],
fraction,
length, fraction, length,
. . .)
. Internal names
.Start, .End,
and .C are defined automatically,
corresponding to the drawn element. These and the tap names can be used to place the block.
These two macros require the two-terminal element to be drawn either up, down, to the left, or to
the right; they are not designed for obliquely drawn elements.
A few composite symbols derived from two-terminal elements are shown in Figure 25.
KelvinR
T1 T2
Start End
KelvinR(,R)
T1 T2
FTcap
Start End
T1
T2
FTcap(B)
Start End
T1
T2
FTcap(C)
Start End
T
FTcap(D)
Start End
T
Figure 25: Composite elements KelvinR(cycles,[R],cycle wid) and FTcap(chars) .
The ground symbol is shown in Figure 26. The first argument specifies position; for example,
the two lines shown have identical effect:
move to (1.5,2); ground
ground(at (1.5,2))
The second argument truncates the stem, and the third defines the symbol type. The fourth
argument specifies the angle at which the symbol is drawn, with D (down) the default. This macro
is one of several in which a temporary drawing direction is set using the
setdir_( U|D|L|R|
degrees,
default R|L|U|D|degrees ) macro and reset at the end using resetdir_.
19
-
ground
ground(,T)
(,,F)
(,,E)
(,dimen_/2,S)
(,,S,90)
(,,Q)
(,,L)
(,,P)
(,T,PA)
Figure 26: The ground( at position, T|stem length, N|F|S|L|P[A]|E, U|D|L|R|degrees ) macro.
The arguments of
antenna(at
position
, T|
stem length
, A|L|T|S|D|P|F, U|D|L|R|
degrees
)
shown in Figure 27 are similar to those of ground.
T
antenna
T
(,T)
T1 T2
(,,L)
T1 T2
(,T,L)
T
(,,T)
T1 T2
(,,S)
T1 T2
(,,D)
T
(,dimen_*3/4,P)
T
(,,F)
Figure 27: Antenna symbols, with macro arguments shown above and terminal names below.
Figure 28 illustrates the macro
opamp(
linespec, - label, + label, size, chars
)
. The element
is enclosed in a block containing the predefined internal locations shown. These locations can
+
opamp
Out
In1
In2
N
E1
E
E2
S
W
+
Point_(15); opamp(,,,,PR)
V1
V2
+
Point_(90); opamp
+
opamp(,,,,T)
Figure 28:
Operational amplifiers. The
P
option adds power connections. The second and third arguments
can be used to place and rotate arbitrary text at In1 and In2.
be referenced in later commands, for example as
last [].Out
.” The first argument defines the
direction and length of the opamp, but the position is determined either by the enclosing block of
the opamp, or by a construction such as
opamp with .In1 at Here
”, which places the internal
position In1 at the specified location. There are optional second and third arguments for which the
defaults are
\scriptsize$-$
and
\scriptsize$+$
respectively, and the fourth argument changes
the size of the opamp. The fifth argument is a string of characters.
P
adds a power connection,
R
exchanges the second and third entries, and T truncates the opamp point.
Typeset text associated with circuit elements is not rotated by default, as illustrated by the
second and third opamps in Figure 28. The
opamp
labels can be rotated if necessary by using
postprocessor commands (for example PSTricks \rput) as second and third arguments.
The code in Figure 29 places an opamp with three connections.
line right 0.2 then up 0.1
A: opamp(up_,,,0.4,R) with .In1 at Here
line right 0.2 from A.Out
line down 0.1 from A.In2 then right 0.2
+
Figure 29: A code fragment invoking the opamp(linespec,-,+,size,[R][P]) macro.
Figure 30 shows variants of the transformer macro, which has predefined internal locations P1,
P2, S1, S2, TP, and TS. The first argument specifies the direction and distance from P1 to P2,
with position determined by the enclosing block as for opamps. The second argument places the
secondary side of the transformer to the left or right of the drawing direction. The optional third
and fifth arguments specify the number of primary and secondary arcs respectively. If the fourth
20
-
P1
P2
TP
S1
S2
TS
transformer
P1
P2
TP
S1
S2
TS
...(down_ 0.6„2,P,8)
P1
P2
TP
S1
S2
TS
...(„8,WD12,4)
P1
P2
TP
S1
S2
TS
...(„9,AL)
P1
P2
TP
S1
S2
TS
...(,R,8,AW)
Figure 30:
The
transformer(
linespec
,L|R,
np
,[A|P][W|L][D1|D2|D12|D21],
ns
)
macro (drawing direc-
tion down), showing predefined terminal and centre-tap points.
argument string contains an
A
, the iron core is omitted; if a
P
, the core is dashed (powder); and if it
contains a
W
, wide windings are drawn. A
D1
puts phase dots at the P1, S1 end,
D2
at the P2, S2
ends, and D12 or D21 puts dots at opposite ends.
Figure 31 shows some audio devices, defined in
[]
blocks, with predefined internal locations as
shown. The first argument specifies the device orientation. Thus,
S: speaker(U) with .In2 at Here
places an upward-facing speaker with input In2 at the current location.
speaker
In1
In2
In3
In4 In5
In6 In7
Box
speaker(,,H)
bell
In1
In2
In3
Box Circle
buzzer
In1
In2
In3
Box
buzzer(,,C)
In1
In2
In3
Face
microphone
In1
In2
In3
Circle
microphone(A)
Head
Head.b
Stand.s
earphone
In1
In2
In3
Box
earphone(,,C)
L R
N
C
Figure 31:
Audio components:
speaker(U|D|L|R|
degrees
,
size
,
type
), bell, microphone, buzzer,
earphone, with their internally named positions and components.
The
nport(
box specs
[;
other commands
]
, nw, nn, ne, ns, space ratio, pin lgth, style
)
macro
is shown in Figure 32. The macro begins with the line
define(‘nport’,‘[Box: box ‘$1’
, so the
W1a
W1b
E1a
E1b
n-port
W1a
W1b
E1a
E3b
N1a N1b N2a N2b
S1a S4b
· · ·
.
.
.
W1 E1
S1
nport
nport(wid 2.0 ht 1 fill_(0.9) "n-port",1,2,3,4)
nterm
Figure 32:
The
nport
macro draws a sequence of pairs of named pins on each side of a box. The pin
names are shown. The default is a twoport. The
nterm
macro draws single pins instead of pin pairs.
first argument is a box specification such as size, fill, or text. The second to fifth arguments specify
the number of ports (pin pairs) to be drawn respectively on the west, north, east, and south sides
of the box. The end of each pin is named according to the side, port number, and
a
or
b
pin, as
shown. The sixth argument specifies the ratio of port width to inter-port space, the seventh is the
21
-
pin length, and setting the eighth argument to
N
omits the pin dots. The macro ends with
‘$9’]’)
,
so that a ninth argument can be used to add further customizations within the enclosing block.
The
nterm(
box specs, nw, nn, ne, ns, pin lgth, style
)
macro illustrated in Figure 32 is similar to
the
nport
macro but has one fewer argument, draws single pins instead of pin pairs, and defaults to
a 3-terminal box.
Many custom labels or added elements may be required, particularly for 2-ports. These elements
can be added using the first argument and the ninth of the
nport
macro. For example, the following
code adds a pair of labels to the box immediately after drawing it but within the enclosing block:
nport(; ‘"0"’ at Box.w ljust; ‘""’ at Box.e rjust)
If this trick were to be used extensively, then the following custom wrapper would save typing,
add the labels, and pass all arguments to nport:
define(‘nullor’,‘nport(‘$1’
{‘"${}0$"’ at Box.w ljust
‘"$\infty$"’ at Box.e rjust},shift($@))’)
The above example and the related gyrator macro are illustrated in Figure 33.
0
nullor
gyrator
gyrator(invis,,0,N)
gyrator(invis wid boxht,,0,NV)
Figure 33: The nullor example and the gyrator macro are customizations of the nport macro.
Figure 34 shows the macro
contact(
chars
)
, which contains predefined locations P, C, O for the
armature and normally closed and normally open terminals. An
I
in the first argument draws open
circles for contacts.
contact
P
O
C
(R)
P
O
C
(O) (C)
(P)
P
O
C
(PR)
P
O
C
(PO)
O
C
(PC)
(I)
P
O
C
(RI)
P
O
C
(OI) (CI) (PI)
O
C
(PIO) (PIC)
(T)
C
O
(RT)
O
C
(OT) (CT) (PT) (PTO) (PTC)
(U)
C
O
(RU)
O
C
(OU)
O
(CU)
C
(PU) (PUO) (PUC)
Figure 34:
The
contact(
chars
)
macro (default drawing direction right) can be used alone, in a set of
ganged contacts, or in relays.
The contacts(poles, chars) macro in Figure 35 draws multiple contacts.
For drawing relays, the macro
relaycoil(
chars, wid, ht,
U|D|L|R|
degrees
)
shown in Figure 36
provides a choice of connection points and actuator types.
22
-
contacts(2)
P1
O1
C1
P2
O2
C2
(2,I)
P1
O1
C1
P2
O2
C2
(2,IO)
P1
O1
P2
O2
(2,PICD)
P1
O1
C1
P2
O2
C2
(2,PTCD)
P1
O1
C1
P2
O2
C2
(2,PUCD)
P1
O1
C1
P2
O2
C2
Figure 35: The contacts(poles, chars) macro (drawing direction right).
relaycoil
V1 V2
(NX)
A1
A2
A3
B1
B2
B3
(AXSR)
V1
V2
(BXSR)
V1
V2
(SR) (SO) (SOR) (PC)
(HS) (NAC) (AC) (ML) (PO) (RM) (RH) (TH) (EL) (MR)
Figure 36: The relaycoil macro.
The
relay(
poles, chars
)
macro in Figure 37 defines coil terminals V1, V2 and contact terminals
P
i
, C
i
, O
i
.
V1 V2
P1
O1
C1
relay
P1
C1
P2
C2
(2,CTh)
P1
O1
P1
O2
(2,O)
V1
V2
P1
O1
C1
P2
O2
C2
(2,PIAX)
V1 V2
P1
O1
C1
P2
O2
C2
relay(2,R)
Figure 37: The relay(poles, chars) macro (drawing direction right).
The
jack
and
plug
macros and their defined points are illustrated in Figure 38. The first
argument of both macros establishes the drawing direction. The second argument is a string of
A
B
TB
TA
A
B A
B
C
A
B
C
plug
plug(,R) plug(,3) plug(L,3R)
L
F
G
L
LM
LB
S
L
S
L1
LM1
L2
LM2
S
L
LB
L
S
S1
SM1
LB
SB
jack
jack(,LMBS) ..(L,RLS) ..(L,RLBLMLMS) ..(,RSBSMLB)
Figure 38:
The
jack(U|D|L|R|
degrees
,
chars
)
and
plug(U|D|L|R|
degrees
,[2|3][R])
components and
their defined points.
characters defining drawn components. An
R
in the string specifies a right orientation with respect
to the drawing direction. The two principal terminals of the jack are included by putting
L S
or both
into the string with associated make (
M
) or break (
B
) points. Thus,
LMB
within the third argument
23
-
draws the
L
contact with associated make and break points. Repeated
L[M|B]
or
S[M|B]
substrings
add auxiliary contacts with specified make or break points.
A macro for drawing headers is in Figure 39, and some experimental connectors are shown in
Figure 40 and Figure 41. The
tstrip
macro allows key
=
value
;
arguments for width and height.
P1
Header
P2
Block
P1
Header(2,3,8mm__,10mm__)
P2
P5 P6
P1
left_; Header(2,4,,,fill_(0.9))
P8
P1
P2
down_; Header(2,8)
P15
P16
PinP1
PinP2
Figure 39: Macro Header(1|2, rows, wid, ht, type).
L1
L4
.
.
.
R1
R4
.
.
.
T1
T4
.
.
.
tstrip(U)
T1 T5· · ·
tstrip(R,5,
DO;wid=1.0;ht=0.25)
ccoax
C
S
ccoax(,F)
tconn(,O) (,>) (,>>)
tconn(,<) (,<<)
V
2
tbox(V_2)
V
1
tbox(V_1,,,<)
V
1
tbox(V_1,,,<>)
Figure 40:
Macros
tstrip(R|L|U|D|
degrees
,
chars
)
,
ccoax(at
location,
M|F,
diameter
)
,
tconn(linespec, >|»|<|«|O[F], wid), and tbox(text, wid, ht, <|>|<>,type).
H
pconnex(,A)
HN
G
(,AF) (,AC) (,ACF)
(U,D) (U,DF)
(U,J) (U,JF)
(,G) (,GF) (L,GF)
(,GC) (,GCF)
(,P) (,PF)
Figure 41:
A small set of power connectors drawn by
pconnex(R|L|U|D|
degrees, chars
)
. Each connector
has an internal H, N, and where applicable, a G shape.
The double-throw switches shown in Figure 42 are drawn in the current drawing direction like
the two-terminal elements, but are composite elements that must be placed accordingly.
A basic winding macro for magnetic-circuit sketches and similar figures is shown in Figure 43.
For simplicity, the complete spline is first drawn and then blanked in appropriate places using the
background (core) color (lightgray for example, default white).
24
-
RTL
NPDT
R
T
L
up_; NPDT
R1L1
R2L2
NPDT(2)
R1L1
R2L2
R3L3
NPDT(3,R)
R1 L1
R2 L2
left_; NPDT(2,R)
Figure 42: Multipole double-throw switches drawn by NPDT(npoles, [R]).
winding
winding(R)
pitch
diam core wid
core color
T1 T2
Left pins
cw
T1
T2
Left pins
ccw
T1
T2
Right pins
cw
T1
T2
Right pins
ccw
T1
T2
g
i
1
v
1
+
N
1
i
2
v
2
+
N
2
φ
Figure 43:
The
winding(L|R, diam, pitch, turns, core wid, core color)
macro draws a coil with
axis along the current drawing direction. Terminals
T1
and
T2
are defined. Setting the first argument
to R draws a right-hand winding.
6.1 Semiconductors
Figure 44 shows the variants of bipolar transistor macro bi_tr(linespec,L|R,P,E) which contains
predefined internal locations E, B, C. The first argument defines the distance and direction from E
to C, with location determined by the enclosing block as for other elements, and the base placed to
E
B
C
bi_tr(up_ dimen_)
E
B
C
bi_tr(,R)
E
B
C
bi_tr(,,P)
E
B
C
bi_tr(,,,E)
E
G
C
igbt
E
G
C
igbt(,,LD)
Figure 44: Variants of bipolar transistor bi_tr(linespec,L|R,P,E) (current direction upward).
the left or right of the current drawing direction according to the second argument. Setting the third
argument to
P
creates a PNP device instead of NPN, and setting the fourth to
E
draws an envelope
around the device. Figure 45 shows a composite macro with several optional internal elements.
E
B
C
Darlington
E
B
B1
C
(R,DZB1)
E
B
B1
C
(,EB1)
E
B
B1
C
(,EB1DZR1)
E
B
B1
C
(,EB1DE1E2)
Figure 45: Macro Darlington(L|R,[E][P][B1][E1|R1][E2|R2][D][Z]), drawing direction up_.
The code fragment example in Figure 46 places a bipolar transistor, connects a ground to the
emitter, and connects a resistor to the collector.
The
bi_tr
and
igbt
macros are wrappers for the macro
bi_trans(
linespec
, L|R,
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 Figure 47.
25
-
S: dot; line left_ 0.1; up_
Q1: bi_tr(,R) with .B at Here
ground(at Q1.E)
line up 0.1 from Q1.C; resistor(right_ S.x-Here.x); dot
Figure 46: The bi_tr(linespec,L|R,P,E) macro.
C
B
E
B
C
BU
uE
S
S
bi_trans(,,BCuEBUS)
C
B
E0E2 E1
Em2
bi_trans(,,BCdE2BU)
E
B
C0 C2C1
Cm2
bi_trans(,,BC2dEBU)
Figure 47:
The
bi_trans(
linespec
,L|R,
chars
,E)
macro. The sub-elements are specified by the third
argument. The substring En creates multiple emitters E0 to En. Collectors are similar.
A UJT macro with predefined internal locations B1, B2, and E is shown in Figure 48.
B1
E
B2
ujt(up_ dimen_,,,E)
B1
E
B2
ujt(,,P,)
B1
E
B2
ujt(,R,,)
B1
E
B2
ujt(,R,P,)
Figure 48: UJT devices, with current drawing direction up_.
A thyristor macro with predefined internal locations G and T1, T2, or A, K is in Figure 49.
Except for the G terminal, a thyristor (the
IEC
variant excluded) is much like a two-terminal
A
K
G
thyristor
T1
T2
G
...(,B)
T1
T2
G
...(,BRK)
T1
T2
G
...(,BE)
A
K
G
...(,A)
A
K
G
...(,F)
T1
T2
G
...(,BRE)
A
K
G
...(,UARE)
A
K
G
...(,AV)
A
K
G
...(,IEC)
A
K
G
...(,UAH)
A
K
Ga
...(,N)
A
K
Ga
...(,UANRE)
A
K
G
...(,SCR)
A
K
G
...(SCRE)
A
K
G
...(SCRRE)
A
K
G
...(SCS)
Ga
A
K
G
...(SCSE)
Ga
A
K
G
...(SUSE)
T1
T2
G
...(SBSE)
scr(,,Q)
Q.G
scs(,,Q2)
Q2.G
Q2.Ga
sus(,RE,Q3)
Q3.G
sbs(,E,Q4)
Q4.G
Figure 49:
The top two rows illustrate use of the
thyristor(
linespec, chars
)
macro, drawing direction
down_
, and the bottom row shows wrapper macros (drawing direction
right_
) that place the
thyristor like a two-terminal element. Append
K
to the second argument to draw open arrowheads.
element. The wrapper macro
scr(
linespec, chars, label
)
and similar macros
scs, sus,
and
sbs
place thyristors using linespec as for a two-terminal element, but require a third argument for the
label for the compound block; thus,
26
-
scr(from A to B,,Q3); line right from Q3.G
draws the element from position A to position B with label Q3, and draws a line from G.
Some FETs with predefined internal locations S, D, and G are also included, with similar
arguments to those of
bi_tr,
as shown in Figure 50. In all cases the first argument is a linespec,
j_fet
G
S D
j_fet(right_
dimen_,,P,E)
G
S D
e_fet
G
S D
e_fet(,,P)
G
S D
e_fet(,,P,S)
G
S D
c_fet
G
S D
c_fet(,,P)
G
S D
d_fet
G
S D
d_fet(,,P)
G
S D
d_fet(,,P,S)
G
S D
g_fet
G
S D
g_fet(up_
dimen_,,P)
G
S
D
G0
G1
mosfet(,,dBSDFQM1,E)
G0G1
...(,,dBSDFQuM1)
mosfet(,,dGSDF,)
dG
F
S D
. . .(,,uHSDF,)
uH
. . .(,,dMEDSQuB,)
dM
E
Q
uB
. . .(,,uMEDSuB)
G
S D
B
Fe_fet
G
S D
Fe_fet(„TEDSQuB)
G
S D
. . .(,,ZSDFdT,)
Z
dT
IRF4905
G
D
S
Figure 50:
JFET, insulated-gate enhancement and depletion MOSFETs, simplified versions, graphene,
and ferroelectric fets. These macros are wrappers that invoke the
mosfet
macro as shown in the
middle and bottom rows. The bottom-row examples show custom devices, the first defined by
omitting the substrate connection, and the second defined using a wrapper macro.
and entering
R
as the second argument orients the G terminal to the right of the current drawing
direction. The macros in the top three rows of the figure are wrappers for the general macro
mosfet(
linespec
,R,
characters
,E)
. The third argument of this macro is a subset of the characters
{BDEFGLMQRSTXZ}
, each letter corresponding to a diagram component as shown in the bottom row
of the figure. Preceding the characters
B
,
G
, and
S
by
u
or
d
adds an up or down arrowhead to the
pin, preceding
T
by
d
negates the pin, and preceding
M
by
u
or
d
puts the pin at the drain or source
end respectively of the gate. The obsolete letter
L
is equivalent to
dM
and has been kept temporarily
for compatibility. This system allows considerable freedom in choosing or customizing components,
as illustrated in Figure 50.
The number of possible semiconductor symbols is very large, so these macros must be regarded
as prototypes. Often an element is a minor modification of existing elements. For example, the
thyristor(
linespec
,
chars
)
macro illustrated in Figure 49 is derived from the diode and bipolar
transistor macros. Another example is the
tgate
macro shown in Figure 51, which also shows a
pass transistor.
A B
G
Gb
tgate
A B
G
Gb
tgate(,L)
A B
G
tgate(,B)
A B
G
Gb
ptrans
A B
G
Gb
ptrans(,L)
Figure 51:
The
tgate(
linespec,
[B][R|L])
element, derived from a customized diode and
ebox
, and the
ptrans(
linespec
, [R|L])
macro. These are not two-terminal elements, so the linespec argument
defines the direction and length of the line from A to B but not the element position.
27
-
Some other non-two-terminal macros are
dot
, which has an optional argument
at
location”,
the line-thickness macros, the
fill_
macro, and
crossover
, which is a useful if archaic method to
show non-touching conductor crossovers, as in Figure 52.
Q
1
Q
2
R
L
V
cc
R
L
R
1
R
1
R
2
V
cc
R
2
Figure 52: Bipolar transistor circuit, illustrating crossover and colored elements.
This figure also illustrates how elements and labels can be colored using the macro
rgbdraw(r, g, b, drawing commands)
where the r, g, b values are in the range 0 to 1 (integers from 0 to 255 for SVG) to specify the rgb
color. This macro is a wrapper for the following, which may be more convenient if many elements
are to be given the same color:
setrgb(r, g, b)
drawing commands
resetrgb
A macro is also provided for colored fills:
rgbfill(r, g, b, drawing commands)
These macros depend heavily on the postprocessor and are intended only for PSTricks, Tikz PGF,
MetaPost, SVG, and the Postscript or PDF output of dpic. Basic Pic objects are probably best
colored and filled as discussed in Section 3.4.
7 Corners
If two straight lines meet at an angle then, depending on the postprocessor, the corner may not be
mitred or rounded unless the two lines belong to a multisegment line, as illustrated in Figure 53. This
line up 0.2
line right 0.2
line up 0.2 \
then right 0.2
line up 0.2
line right 0.2 \
chop -hlth chop 0
line up 0.2
round
line right 0.2
line up 0.15 left 0.15
corner
line up 0.1 right 0.1
A
corner(,at A)
L M
Mitre_(L,M,5 bp__)
A
B
C
mitre_(A,B,C)
Figure 53: Producing mitred angles and corners.
is normally not an issue for circuit diagrams unless the figure is magnified or thick lines are drawn.
Rounded corners can be obtained by setting post-processor parameters, but the figure shows the effect
of macros
round
and
corner
. The macros
mitre_(
Position1,Position2,Position3,length,attributes
)
and
Mitre_(
Line1,Line2,length,attributes
)
may assist as shown. Otherwise, a right-angle line can
be extended by half the line thickness (macro
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.
28
-
8 Looping
Sequential actions can be performed using either the dpic command
for variable=expression to expression [by expression] do { actions }
or at the m4 processing stage. The libgen library defines the macro
for_(start, end, increment, ‘actions’)
for this and other purposes. Nested loops are allowed and the innermost loop index variable is
m4x.
The first three arguments must be integers and the end value must be reached exactly; for example,
for_(1,3,2,‘print In‘’m4x’)
prints locations In1 and In3, but
for_(1,4,2,‘print In‘’m4x’)
does not terminate since the index takes on values 1, 3, 5, . . ..
Repetitive actions can also be performed with the libgen macro
Loopover_(‘variable’, actions, value1, value2, . . .)
which evaluates actions for each instance of variable set to value1, value2, . . ..
9 Logic gates
Figure 54 shows the basic logic gates included in library
liblog.m4
. The first argument of the gate
macros can be an integer
N
from 0 to 16
,
specifying the number of input locations
In1, . . . InN,
as illustrated for the NOR gate in the figure. By default,
N
= 2 except for macros
NOT_gate
and
BUFFER_gate
, which have one input
In1
unless they are given a first argument, which is treated as
the line specification of a two-terminal element.
AND_gate
OR_gate
BUFFER_gate
XOR_gate
NAND_gate
NOR_gate(3)
Out
N_Out
In1
In2
In3
NOT_gate
NXOR_gate(NPN)
In1
In2
In3
&
NAND_gate(,B)
1
NOR_gate(3,NB)
= 1
BOX_gate(PN,N,,,=1)
=
BOX_gate(PP,N,,,=)
Figure 54:
Basic logic gates. The input and output locations of a three-input NOR gate are shown.
Inputs are negated by including an
N
in the second argument letter sequence. A
B
in the second
argument produces a box shape as shown in the rightmost column, where the second example has
AND functionality and the bottom two are examples of exclusive OR functions.
Input locations retain their positions relative to the gate body regardless of gate orientation, as
in Figure 55. Beyond a default number (6) of inputs, the gates are given wings as in Figure 56.
.PS
# ‘FF.m4’
log_init
S: NOR_gate
left_
R: NOR_gate at S+(0,-L_unit*(AND_ht+1))
line from S.Out right L_unit*3 then down S.Out.y-R.In2.y then to R.In2
line from R.Out left L_unit*3 then up S.In2.y-R.Out.y then to S.In2
line left 4*L_unit from S.In1 ; "$S$sp_" rjust
line right 4*L_unit from R.In1 ; "sp_$R$" ljust
.PE
S
R
Figure 55: SR flip-flop.
Negated inputs or outputs are marked by circles drawn using the
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
N_
. For example, the output circle of a nand gate is named
N_Out
and the outermost point of
the circle is named
Out.
Instead of a number, the first argument can be a sequence of letters
P
or
N
29
-
¯
Y
Y
¯
E
S
0
S
1
S
2
I
0
I
1
I
2
I
3
I
4
I
5
I
6
I
7
Figure 56: Eight-input multiplexer, showing a gate with wings.
to define normal or negated inputs; thus for example,
NXOR_gate(NPN)
defines a 3-input nxor gate
with not-circle inputs
In1
and
In3
and normal input
In2
as shown in the figure. The macro
IOdefs
can also be used to create a sequence of custom named inputs or outputs.
Gates are typically not two-terminal elements and are normally drawn horizontally or vertically
(although arbitrary directions may be set with e.g.
Point_(
degrees
)
). Each gate is contained in a
block of typical height
6*L_unit
where
L_unit
is a macro intended to establish line separation for
an imaginary grid on which the elements are superimposed.
Including an
N
in the second argument character sequence of any gate negates the inputs, and
including
B
in the second argument invokes the general macro
BOX_gate([P|N]...,[P|N],
horiz
size
,
vert size
,
label
)
, which draws box gates. Thus,
BOX_gate(PNP,N„8,\geq 1)
creates a gate of
default width, eight
L_unit
s height, negated output, three inputs with the second negated, and
internal label
1. If the fifth argument begins with
sprintf
or a double quote then the argument
is copied literally; otherwise it is treated as scriptsize mathematics.
A good strategy for drawing complex logic circuits might be summarized as follows:
Establish the absolute locations of gates and other major components (e.g. chips) relative to a
grid of mesh size commensurate with L_unit, which is an absolute length.
Draw minor components or blocks relative to the major ones, using parameterized relative
distances.
Draw connecting lines relative to the components and previously drawn lines.
Write macros for repeated objects.
Tune the diagram by making absolute locations relative, and by tuning the parameters. Some
useful macros for this are the following, which are in units of L_unit:
AND_ht, AND_wd: the height and width of basic AND and OR gates
BUF_ht, BUF_wd: the height and width of basic buffers
N_diam: the diameter of NOT circles
The macro
BUFFER_gate(
linespec
,[N|B],
wid
,
ht
,[N|P]*,[N|P]*)
is a wrapper for the compos-
ite element
BUFFER_gen
. If the second argument is
B
, then a box gate is drawn; otherwise the gate
is triangular. Arguments 5 and 6 determine the number of defined points along the northeast and
southeast edges respectively, with an
N
adding a NOT circle. 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
last []
, as
shown in Figure 57.
30
-
In1
bd = dimen_*3/4
BUFFER_gate(,,bd,bd)
NE
Out
SE
C
In1
N_NE1
N_NE2
Out
BUFFER_gate(,N,bd,bd,NN)
BUFFER_gen(ITNOC,bd,bd,PN,,N,
LH_symbol at C)
In1
In2
Out
N_SE1
C
BUFFER_gate(right_ elen_,,bd,bd)
BUFFER_gate(right_ elen_,N,bd,bd,,N,LH_symbol(I) at C)
line down dimen_/3 from last [].N_SE1.s then left dimen_*2/3
Figure 57:
The
BUFFER_gate
and
BUFFER_gen
macros. The bottom two examples show how the gate can
be drawn as a two-terminal macro but internal block locations must be referenced using last [].
Figure 58 shows the macro
FlipFlop(D|T|RS|JK,
label, boxspec, pinlength
)
, which is a wrapper
for the more general macro
FlipFlopX(
boxspec, label, leftpins, toppins, rightpins, bottompins,
pinlength
)
. The first argument modifies the box (labelled Chip) default specification. Each of
Q1
D
CK
Q
Q
FlipFlop(D,Q1)
Q2
T
CK
Q
Q
FlipFlop(T,Q2,
ht h1 wid w1 fill_(0.9))
R
S
Q
Q
FlipFlop(RS,,,
Chip.wid/8)
J
CK
K
CLR
Q
Q
PR
FlipFlop(JK)
D
CK
Q
Q
FlipFlopX(,,
:D;E:CK,,:Q;:lg_bartxt(Q))
T
CK
Q
FlipFlopX(,,
:T;E:CK,,:Q;)
J
CK
K
CLR
Q
FlipFlopX(,,
:J;E:CK;:K,N:CLR,:Q;)
Figure 58: The FlipFlop and FlipFlopX macros, with variations.
arguments 3 to 6 is null or a string of pinspecs separated by semicolons (
;
). A pinspec is either
empty (null) or of the form
[
pinopts
]:[
label
[:
Picname
]]
. The first colon draws the pin. Pins are
placed top to bottom or left to right along the box edges with null pinspecs counted for placement.
Pins are named by side and number by default; eg
W1, W2, ..., N1, N2, ..., E1, ..., S1,
...
; however, if
:
Picname is present in a pinspec then Picname replaces the default name. A
pinspec label is text placed at the pin base. Semicolons are not allowed in labels; use e.g.,
\char59{}
instead. To put a bar over a label, use
lg_bartxt(
label
)
. The pinopts are
[L|M|I|O][N][E]
as for
the lg_pin macro. Optional argument 7 is the pin length in drawing units.
Figure 59 shows a multiplexer block with variations, and Figure 60 shows the very similar
demultiplexer.
31
-
M1
0
1
2
3
Mux(4,M1)
In0
In1
In2
In3
Out
Sel
0
1
2
3
OE
left_; Mux(4,,LNOE)
In0
NOE
Out
Sel
00
01
10
11
OE
Mux(4,,OEBN2)
Sel0
Sel1
In0
In3
OE
0 1 2 3 4 5 6 7
down_; Mux(8,,L3,,28*L_unit)
Sel0
Sel2
In0 In7
Figure 59: The Mux(input count, label, [L][B|H|X][N[n]|S[n]][[N]OE],wid,ht) macro.
DM1
0
1
2
3
Demux(4,DM1)
Out0
Out3
In
Sel
0
1
2
3
OE
left_; Demux(4,,LOE)
Sel
Out0
OE
In
00
01
10
11
OE
(4,,NOEBN2)
Sel0
Sel1
Out0
Out3
NOE
In
0 1 2 3 4 5 6 7
down_; Demux(8,,L3,,28*L_unit)
Sel0
Sel2
Out0 Out7
In
Figure 60: The Demux(input count, label, [L][B|H|X][N[n]|S[n]][[N]OE],wid,ht) macro.
Customized gates can be defined simply. For example, the following code defines the custom
flipflops in Figure 61.
define(‘customFF’,‘FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,,
:S;NE:CK;:R, N:PR, :Q;;ifelse(‘$1’,1,:lg_bartxt(Q)), N:CLR) ’)
S
CK
R
PR
Q
Q
CLR
SERIAL
INPUT
CLEAR
CLOCK
S
CK
R
PR
Q
Q
CLR
S
CK
R
PR
Q
Q
CLR
S
CK
R
PR
Q
Q
CLR
S
CK
R
PR
Q
CLR
OUTPUT
PR4 PR3 PR2 PR1 PR0
PRESET
ENABLE
Figure 61: A 5-bit shift register.
This definition makes use of macros
L_unit
and
FF_ht
that predefine default dimensions. There are
three pins on the right; the centre pin is null and the bottom is null if the first macro argument is 1.
For hybrid applications, the
dac
and
adc
macros are illustrated in Figure 62. The figure shows the
default and predefined internal locations, the number of which can be specified as macro arguments.
In addition to the logic gates described here, some experimental IC chip diagrams are included
with the distributed example files.
32
-
In1
NW
SW SE
NE
N1
S1
Out1
C
dac
DAC
In1
In2
N1 N2
Out1
Out2
Out3
S1 S2 S3
Q: dac(,,2,2,3,3); "DAC" "2" at Q.C
NW
SW SE
NE
In1
N1
S1
Out1
C
adc
ADC
In1
In2
N1 N2
Out1
Out2
Out3
S1 S2 S3
adc(,,2,2,3,3)
Figure 62: The dac(width,height,nIn,nN,nOut,nS) and adc(width,height,nIn,nN,nOut,nS) macros.
10 Integrated circuits
Developing a definitive library of integrated circuits is problematic because context may determine
how they should be drawn. Logical clarity may require drawing a functional diagram in which the
connection pins are not in the physical order of a terminal diagram, for example. Circuit boards
and connectors are similar. Although the geometries are simple, managing lists of pin locations and
labels can be tedious and repetitive.
The many-argument macro
lg_pin(
location, label, Picname,
n|e|s|w [L|M|I|O][N][E],
pinno, optional length
)
can be used to draw a variety of pins as illustrated in the Figure 63.
To draw the left-side pins, for example, one can write
lg_pin( U.nw-(0,lg_pinsep), Vin, Pin1, w )
lg_pin( U.nw-(0,2*lg_pinsep),,, wL )
and so on. Each pin can also be given a pic name, some text to indicate function, and a number.
.PS
log_init
command "\small\sf"
U: box wid 18*L_unit ht 9*lg_pinsep
Loopover_(‘x’,
‘lg_pin(U.nw-(0,m4Lx*lg_pinsep),,,w‘’x)’,
nul,L,M,I,O,N,E,NE)
define(‘Upin’,
‘lg_pin(U.ne-(0,(17-‘$1’)*lg_pinsep),‘$2’,Pin‘$1’,e‘$3’,‘$1’,8*L_unit)’)
Loopover_(‘x’,
‘Upin(patsubst(x,;,‘,’))’,
16;Vin;, 15;D0;L, 14;D1;M, 13;D2;I, 12;D3;O, 11;D4;N, 10;D5;E, 9;D6;NE )
.PE
Vin
16
D0
15
D1
14
D2
13
D3
12
D4
11
D5
10
D6
9
Figure 63:
An imaginary 16-pin integrated circuit and its code. Pin variations defined by the first
Loopover_
are shown on the left; and text, pic labels, and pin numbers are defined on the right.
The third and successive arguments of the second
Loopover_
are
;
-separated pin number, text, and
pin type. The semicolons are changed to commas by the patsubst m4 macro and the Upin macro
gives the resulting arguments to lg_pin.
To reduce the tedium of adding the pins by hand, a list can be given to the
Loopover_(‘variable’,
actions
’,
value1, value2,
. . .)
which executes the given actions successively with variable = value1,
value2 . . . and the counter m4Lx set to 1, 2, . . . as in the diagram.
11 Element and diagram scaling
There are several issues related to scale changes. You may wish to use millimetres, for example,
instead of the default inches. You may wish to change the size of a complete diagram while keeping
33
-
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
except when svg is being produced.
The scaling of circuit elements will be described first, then the pic scaling facilities.
11.1 Circuit scaling
The circuit elements all have default dimensions that are multiples of the pic environmental parameter
linewid,
so changing this parameter changes default element dimensions. The scope of a pic variable
is the current block; therefore, a sequence such as
resistor
T: [linewid = linewid*1.5; up_; Q: bi_tr] with .Q.B at Here
ground(at T.Q.E)
resistor(up_ dimen_ from T.Q.C)
connects two resistors and a ground to an enlarged transistor. Alternatively, you may redefine the
default length elen_ or the body-size parameter dimen_. For example, adding the line
define(‘dimen_’,(dimen_*1.2))
after the
cct_init
line of
quick.m4
produces slightly larger body sizes for all circuit elements. For
logic elements, the equivalent to the
dimen_
macro is
L_unit
, which has default value
(linewid/10)
.
The macros
capacitor, inductor,
and
resistor
have arguments that allow the body sizes to
be adjusted individually. The macro resized mentioned previously can also be used.
11.2 Pic scaling
There are at least three kinds of graphical elements to be considered:
1.
When generating final output after reading the
.PE
line, pic processors divide distances and
sizes by the value of the environmental parameter
scale
, which is 1 by default. Therefore, the
effect of assigning a value to
scale
at the beginning of the diagram is to change the drawing
unit (initially 1 inch) throughout the figure. For example, the file
quick.m4
can be modified
to use millimetres as follows:
.PS # Pic input begins with .PS
scale = 25.4 # mm
cct_init # Set defaults
elen = 19 # Variables are allowed
...
The default sizes of pic objects are redefined by assigning new values to the environmental
parameters
arcrad, arrowht, arrowwid, boxht, boxrad, boxwid, circlerad, dashwid,
ellipseht, ellipsewid, lineht, linewid, moveht, movewid, textht,
and
textwid.
The
. . .ht
and
. . .wid
parameters refer to the default sizes of vertical and horizontal lines, moves, etc.,
except for
arrowht
and
arrowwid
, which are arrowhead dimensions. The
boxrad
parameter
can be used to put rounded corners on boxes. Assigning a new value to
scale
also multiplies
all of these parameters except
arrowht, arrowwid, textht,
and
textwid
by the new value
of
scale
(gpic multiplies them all). Therefore, objects drawn to default sizes are unaffected
by changing
scale
at the beginning of the diagram. To change default sizes, redefine the
appropriate parameters explicitly.
2.
The
.PS
line can be used to scale the entire drawing, regardless of its interior. Thus, for
example, the line
.PS 100/25.4
scales the entire drawing to a width of 100 mm. Line thickness,
text size, and dpic arrowheads are unaffected by this scaling.
34
-
If the final picture width exceeds
maxpswid
, which has a default value of 8.5, then the picture
is scaled to this size. Similarly, if the height exceeds
maxpsht
(default 11), then the picture
is scaled to fit. These parameters can be assigned new values as necessary, for example, to
accommodate landscape figures.
3.
The finished size of typeset text is independent of pic variables, but can be determined as in
Section 13. Then,
"text" wid x ht y
tells pic the size of
text
, once the printed width
x
and height y have been found.
4.
Line widths are independent of diagram and text scaling, and have to be set explicitly.
For example, the assignment
linethick = 1.2
sets the default line width to 1.2 pt. The
macro
linethick_(
points
)
is also provided, together with default macros
thicklines_
and
thinlines_.
12 Writing macros
The m4 language is quite simple and is described in numerous documents such as the original
reference [
9
] or in later manuals [
15
]. If a new circuit or other element is required, then it may
suffice to modify and rename one of the library definitions or simply add an option to it. Hints for
drawing general two-terminal elements are given in
libcct.m4
. However, if an element or block is
to be drawn in only one orientation then most of the elaborations used for general two-terminal
elements in Section 4 can be dropped. If you develop a library of custom macros in the installation
directory then the statement include(mylibrary.m4) can bring its definitions into play.
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
[ ]
block. After the element arguments are
expanded, one argument beyond the normal list is automatically expanded before exiting the block,
as mentioned near the beginning of Section 6. This extra argument can be used to embellish the
element.
A macro is defined using quoted name and replacement text as follows:
define(‘name’,‘replacement text’)
After this line is read by the m4 processor, then whenever name is encountered as a separate
string, it is replaced by its replacement text, which may have multiple lines. The quotation characters
are used to defer macro expansion. Macro arguments are referenced inside a macro by number; thus
$1 refers to the first argument. A few examples will be given.
Example 1:
Custom two-terminal elements can often be defined by writing a wrapper for an
existing element. For example, an enclosed thermal switch can be defined as shown in Figure 64.
define(‘thermalsw’,
‘dswitch(‘$1’,‘$2’,WDdBTh)
circle rad distance(M4T,last line.c) at last line.c ’)
Figure 64: A custom thermal switch defined from the dswitch macro.
Example 2:
In the following, two macros are defined to simplify the repeated drawing of a series
resistor and series inductor, and the macro
tsection
defines a subcircuit that is replicated several
times to generate Figure 65.
.PS
# ‘Tline.m4’
cct_init
hgt = elen_*1.5
ewd = dimen_*0.9
define(‘sresistor’,‘resistor(right_ ewd); llabel(,r)’)
define(‘sinductor’,‘inductor(right_ ewd,W); llabel(,L)’)
define(‘tsection’,‘sinductor
{ dot; line down_ hgt*0.25; dot
parallel_(‘resistor(down_ hgt*0.5); rlabel(,R)’,
35
-
‘capacitor(down_ hgt*0.5); rlabel(,C)’)
dot; line down_ hgt*0.25; dot }
sresistor ’)
SW: Here
gap(up_ hgt)
sresistor
for i=1 to 4 do { tsection }
line dotted right_ dimen_/2
tsection
gap(down_ hgt)
line to SW
.PE
r
L
RC
r
L
RC
r
L
RC
r
L
RC
r
L
RC
r
Figure 65: A lumped model of a transmission line, illustrating the use of custom macros.
Example 3:
Figure 66 shows an element that is composed of several basic elements and that can be
drawn in any direction prespecified by
Point_(
degrees
)
. The labels always appear in their natural
horizontal orientation. Two flags in the argument determine the circuit orientation with respect to
r
π
+
v
π
g
m
v
π
r
o
Base
Emitter
Collector
hybrid_PI_BJT
r
π
+
v
π
g
m
v
π
r
o
hybrid_PI_BJT(M)
r
π
+
v
π
g
m
v
π
r
o
hybrid_PI_BJT(LM)
r
π
+
v
π
g
m
v
π
r
o
Point_(45)
hybrid_PI_BJT
Figure 66: A composite element containing several basic elements
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 allows two-terminal elements to change the current
drawing direction, so the value of
rp_ang
should be saved and restored as necessary after each
internal two-terminal element has been drawn. A draft of such a macro follows:
# ‘Point_(degrees)
# hybrid_PI_BJT([L][M])
# L=left orientation; M=mirror’
define(‘hybrid_PI_BJT’,
‘[ # Size (and direction) parameters:
hunit = ifinstr(‘$1’,M,-)dimen_
vunit = ifinstr(‘$1’,L,-)dimen_*3/2
hp_ang = rp_ang # Save the reference direction
36
-
Rpi: resistor(to rvec_(0,-vunit)); point_(hp_ang) # Restore direction
DotG: dot(at rvec_(hunit*5/4,0))
Gm: consource(to rvec_(0,vunit),I,R); point_(hp_ang) # Restore direction
dot(at rvec_(hunit*3/4,0))
Ro: resistor(to rvec_(0,-vunit)); point_(hp_ang) # Restore direction
line from Rpi.start to Rpi.start+vec_(-hunit/2,0) chop -lthick/2 chop 0
Base: dot(,,1)
line from Gm.end to Ro.start+vec_(hunit/2,0) chop -lthick/2 chop 0
Collector: dot(,,1)
line from Rpi.end to Ro.end chop -lthick/2
DotE: dot(at 0.5 between Rpi.end and DotG)
line to rvec_(0,-vunit/2)
Emitter: dot(,,1)
# Labels
‘"$\mathrm{r_\pi}$"’ at Rpi.c+vec_(hunit/4,0)
‘"$ + $"’ at Rpi.c+vec_(-hunit/6, vunit/4)
‘"$ - $"’ at Rpi.c+vec_(-hunit/6,-vunit/4)
‘"$\mathrm{v_\pi}$"’ at Rpi.c+vec_(-hunit/4,0)
‘"$\mathrm{g_m}$$\mathrm{v_\pi}$"’ at Gm.c+vec_(-hunit*3/8,-vunit/4)
‘"$\mathrm{r_o}$"’ at Ro.c+vec_(hunit/4,0)
‘$2’ ] ’)
Example 4:
A number of elements have arguments meant explicitly for customization. Figure 67
customizes the
source
macro to show a cycle of a horizontal sinusoid with adjustable phase given
by argument 2 in degrees, as might be wanted for a 3-phase circuit:
phsource(,120)
define(‘phsource’,‘source($1,
#‘Set angle to 0, draw sinusoid, restore angle’
m4smp_ang = rp_ang; rp_ang = 0
sinusoid(m4h/2,twopi_/(m4h),
ifelse(‘$2’,,,‘($2)/360*twopi_+’)pi_/2,-m4h/2,m4h/2) with .Origin at Here
rp_ang = m4smp_ang,
$3,$4,$5)’)
Figure 67: A source element customized using its second argument.
Example 5:
Repeated subcircuits might appear only as the subcircuit and its mirror image,
for example, so the power of the
vec_()
and
rvec_()
macros is not required. Suppose that an
optoisolator is to be drawn with left-right or right-left orientation as shown in Figure 68.
C CA A
E EK KB
Figure 68: Showing opto and opto(BR) with defined labels.
The macro interface could be something like the following:
opto( [L|R][A|B] ),
where an
R
in the argument string signifies a right-left (mirrored) orientation and the element is of
either
A
or
B
type; that is, there are two related elements that might be drawn in either orientation,
for a total of four possibilities. Those who find such an interface to be too cryptic might prefer to
invoke the macro as
opto(orientation=Rightleft;type=B),
37
-
which includes semantic sugar surrounding the
R
and
B
characters for readability; this usage is made
possible by testing the argument string using the
ifinstr()
macro rather than requiring an exact
match. A draft of the macro follows, and the file
Optoiso.m4
in the examples directory adds a third
type option.
# ‘opto([R|L][A|B])’
define(‘opto’,‘[{u = dimen_/2
Q: bi_trans(up u*2,ifinstr(‘$1’,R,R),ifinstr(‘$1’,B,B)CBUdE)
E: Q.E; C: Q.C; A:ifinstr(‘$1’,R,Q.e+(u*3/2,u),Q.w+(-u*3/2,u)); K: A-(0,u*2)
ifinstr(‘$1’,B,line from Q.B to (Q.B,E); B: Here)
D: diode(from A to K)
arrow from D.c+(0,u/6) to Q.ifinstr(‘$1’,R,e,w)+(0,u/6) chop u/3 chop u/4
arrow from last arrow.start-(0,u/3) to last arrow.end-(0,u/3)
Enc: box rad u wid abs(C.x-A.x)+u*2 ht u*2 with .c at 0.5 between C and K
‘$2’ }]’)
Two instances of this subcircuit are drawn and placed by the following code, with the result shown
in Figure 68.
Q1: opto
Q2: opto(type=B;orientation=Rightleft) with .w at Q1.e+(dimen_,0)
12.1 Macro arguments
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:
resistor( linespec, cycles, chars, cycle wid );
an integer (3, say) in the second argument specifies the number of cycles. Arguments could be
entered in a key–value style (for example,
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
setkey_(string, key, default value, [N])
The first argument is taken to be a sequence of semicolon (;)-separated terms of the form
key=value;. Then for example in a macro, the line
setkey_( ‘$2’, wdth, dimen_*2 )
checks argument 2 for a term
wdth=
value and defines the macro
m4wdth
to evaluate to
(dimen_*2)
if not found, otherwise to
(
value
).
The enclosing parentheses are omitted if the third argument of
setkey_ is N, as may be required if m4wdth is non-numeric.
In addition, the macro
setkeys_(string, keysequence)
applies
setkey_()
multiple times to its keysequence (second) argument. Each term of the second
argument consists of the three arguments of
setkey_
separated by the colons (:) rather than commas.
For example, consider the elementary example of a custom box macro:
define(‘custombox’,
‘setkeys_(‘$1’,wdth:boxwid:; hgt:boxht:; label::N; text::N)
ifelse(m4label,,,m4label:) box wid m4wdth ht m4hgt "m4text" ’)
Then
custombox(wdth=2; label=B1; text=Hello)
first causes the macros
m4wdth, m4hgt,
m4label,
and
m4text
to be created, with values
(2), (boxht), B1,
and
Hello
respectively, and
custombox evaluates to
B1: box wid (2) ht (boxht) "Hello".
The key prefix
m4
of the automatically created parameter macros can be redefined if necessary,
since it is given in the distribution by the line define(‘key_prefix’,‘m4’).
38
-
13 Interaction with L
A
T
E
X
The sizes of typeset labels and other T
E
X boxes are generally unknown prior to processing the
diagram by L
A
T
E
X. Although they are not needed for many circuit diagrams, these sizes may be
required explicitly for calculations or implicitly for determining the diagram bounding box. The
following example shows how text sizes can affect the overall size of a diagram:
.PS
B: box
"Left text" at B.w rjust
"Right text: $x^2$" at B.e ljust
.PE
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 size values. One solution to this problem is to measure the
text sizes by hand and include them literally, thus:
"Left text" wid 38.47pt__ ht 7pt__ at B.w rjust
but this is tedious.
Often, a better solution is to process the diagram twice. The diagram source is processed as
usual by m4 and a pic processor, and the main document source is L
A
T
E
Xed to input the diagram
and format the text, and also to write the text dimensions into a supplementary file. Then the
diagram source is processed again, reading the required dimensions from the supplementary file and
producing a diagram ready for final L
A
T
E
Xing. This hackery is summarized below, with an example
in Figure 69.
Put \usepackage{boxdims} into the document source.
Insert the following at the beginning of the diagram source, where jobname is the name of the
main L
A
T
E
X file:
sinclude(jobname.dim)
s_init(unique name)
Use the macro
s_box(
text
)
to produce typeset text of known size, or alternatively, invoke
the macros
\boxdims
and
boxdim
described later. The argument of
s_box
need not be text
exclusively; it can be anything that produces a T
E
X box, for example, \includegraphics.
.PS
gen_init
sinclude(Circuit_macros.dim)
s_init(stringdims)
B: box
s_box(Left text) at B.w rjust
s_box(Right text: $xˆ%g$,2) at B.e ljust
.PE
Left text
Right text: x
2
Figure 69:
Macro
s_box
sets string dimensions automatically when processed twice. If two or more
arguments are given to s_box, they are passed through sprintf. The bounding box is shown.
The macro s_box(text) evaluates initially to
"\boxdims{name}{text}" wid boxdim(name,w) ht boxdim(name,v)
On the second pass, this is equivalent to
"text" wid x ht y
where x and y are the typeset dimensions of the L
A
T
E
X input text. If
s_box
is given two or more
arguments as in Figure 69 then they are processed by sprintf.
The argument of
s_init
, which should be unique within jobname
.dim
, is used to generate a
unique
\boxdims
first argument for each invocation of
s_box
in the current file. If
s_init
has been
omitted, the symbols
!!
are inserted into the text as a warning. Be sure to quote any commas in
the arguments. Since the first argument of
s_box
is L
A
T
E
X source, make a rule of quoting it to avoid
39
-
comma and name-clash problems. For convenience, the macros
s_ht
,
s_wd
, and
s_dp
evaluate to
the dimensions of the most recent
s_box
string or to the dimensions of their argument names, if
present.
The file
boxdims.sty
distributed with this package should be installed where L
A
T
E
X can find it.
The essential idea is to define a two-argument L
A
T
E
X macro
\boxdims
that writes out definitions for
the width, height and depth of its typeset second argument into file jobname.
dim
, where jobname
is the name of the main source file. The first argument of
\boxdims
is used to construct unique
symbolic names for these dimensions. Thus, the line
box "\boxdims{Q}{\Huge Hi there!}"
has the same effect as
box "\Huge Hi there!"
except that the line
define(‘Q_w’,77.6077pt__)define(‘Q_h’,17.27779pt__)define(‘Q_d’,0.0pt__)dnl
is written into file jobname.
dim
(and the numerical values depend on the current font). These
definitions are required by the boxdim macro described below.
The L
A
T
E
X macro
\boxdimfile{dimension file}
is used to specify an alternative to jobname.
dim
as the dimension file to be written. This simplifies
cases where jobname is not known in advance or where an absolute path name is required.
Another simplification is available. Instead of the
sinclude(
dimension file
)
line above, the
dimension file can be read by m4 before reprocessing the source for the second time:
m4 library files dimension file diagram source file ...
Here is a second small example. Suppose that the file tsbox.m4 contains the following:
\documentclass{article}
\usepackage{boxdims,ifpstricks(pstricks,tikz)}
\begin{document}
.PS
cct_init s_init(unique) sinclude(tsbox.dim)
[ source(up_,AC); llabel(,s_box(AC supply)) ]; showbox_
.PE
\end{document}
The file is processed twice as follows:
m4 pgf.m4 tsbox.m4 | dpic -g > tsbox.tex; pdflatex tsbox
m4 pgf.m4 tsbox.m4 | dpic -g > tsbox.tex; pdflatex tsbox
The first command line produces a file
tsbox.pdf
with incorrect bounding box. The second command
reads the data in
tsbox.dim
to size the label correctly. The equivalent pstricks commands (note the
ifpstricks macro in the second line of the diagram source) are
m4 pstricks.m4 tsbox.m4 | dpic -p > tsbox.tex; latex tsbox
m4 pstricks.m4 tsbox.m4 | dpic -p > tsbox.tex; latex tsbox; dvips tsbox
Objects can be taylored to their attached text by invoking
\boxdims
and
boxdim
explicitly. The
small source file in Figure 70, for example, produces the box in the figure.
.PS
# ‘eboxdims.m4’
sinclude(Circuit_macros.dim) # The input file is Circuit_macros.tex
box fill_(0.9) wid boxdim(Q,w) + 5pt__ ht boxdim(Q,v) + 5pt__ \
"\boxdims{Q}{\large$\displaystyle\int_0^T e^{tA}\,dt$}"
.PE
Z
T
0
e
tA
dt
Q_w
Q_h+Q_d
Figure 70: Fitting a box to typeset text.
The figure is processed twice, as described previously. The line sinclude(jobname.dim) reads
the named file if it exists. The macro
boxdim(
name,suffix,default
)
from
libgen.m4
expands the
40
-
expression
boxdim(Q,w)
to the value of
Q_w
if it is defined, else to its third argument if defined, else
to 0, the latter two cases applying if jobname.
dim
doesn’t exist yet. The values of
boxdim(Q,h)
and
boxdim(Q,d)
are similarly defined and, for convenience,
boxdim(Q,v)
evaluates to the sum of these.
Macro pt__ is defined as *scale/72.27 in libgen.m4, to convert points to drawing coordinates.
Sometimes a label needs a plain background in order to blank out previously drawn components
overlapped by the label, as shown on the left of Figure 71. The technique illustrated in Figure 70
Wood chips
n
3
Figure 71: Illustrating the f_box macro.
is automated by the macro
f_box(
boxspecs, label arguments
)
. For the special case of only one
argument, e.g.,
f_box(Wood chips),
this macro simply overwrites the label on a white box of
identical size. Otherwise, the first argument specifies the box characteristics (except for size), and
the macro evaluates to
box boxspecs s_box(label arguments).
For example, the result of the following command is shown on the right of Figure 71.
f_box(color "lightgray" thickness 2 rad 2pt__,"\huge$n^{%g}$",4-1)
More tricks can be played. The example
Picture: s_box(‘\includegraphics{file.eps}’) with .sw at location
shows a nice way of including eps graphics in a diagram. The included picture (named
Picture
in the example) has known position and dimensions, which can be used to add vector graphics
or text to the picture. To aid in overlaying objects, the macro
boxcoord(
object name, x-fraction,
y-fraction
)
evaluates to a position, with
boxcoord(
object name
,0,0)
at the lower left corner of the
object, and boxcoord(object name,1,1) at its upper right.
14 PSTricks and other tricks
This section applies only to a pic processor (dpic) that is capable of producing output compatible
with PSTricks, Tikz PGF, or in principle, other graphics postprocessors.
By using
command
lines, or simply by inserting L
A
T
E
X graphics directives along with strings to be
formatted, one can mix arbitrary PSTricks (or other) commands with m4 input to create complicated
effects.
Some commonly required effects are particularly simple. For example, the rotation of text by
PSTricks postprocessing is illustrated by the file
.PS
# ‘Axes.m4’
arrow right 0.7 "‘$x$-axis’" below
arrow up 0.7 from 1st arrow.start "‘\rput[B]{90}(0,0){$y$-axis}’" rjust
.PE
which contains both horizontal text and text rotated 90
along the vertical line. This rotation of text
is also implemented by the macro
rs_box
, which is similar to
s_box
but rotates its argument by 90
,
a default angle that can be changed by preceding invocation with
define(‘text_ang’,
degrees
)
.
The
rs_box
macro requires either PSTricks or Tikz PGF and, like
s_box
, it calculates the size of
the resulting text box but requires the diagram to be processed twice.
Another common requirement is the filling of arbitrary shapes, as illustrated by the following
lines within a .m4 file:
command "‘\pscustom[fillstyle=solid,fillcolor=lightgray]{’"
drawing commands for an arbitrary closed curve
command "‘}%’"
For colour printing or viewing, arbitrary colours can be chosen, as described in the PSTricks
manual. PSTricks parameters can be set by inserting the line
command "‘\psset{option=value, . . .}’"
41
-
in the drawing commands or by using the macro psset_(PSTricks options).
The macros
shade(
gray value,closed line specs
)
and
rgbfill(
red value, green value, blue value,
closed line specs
)
can be invoked to accomplish the same effect as the above fill example, but are
not confined to use only with PSTricks.
Since arbitrary L
A
T
E
X can be output, either in ordinary strings or by use of
command
output,
complex examples such as found in reference [
3
], for example, can be included. The complications
are twofold: L
A
T
E
X and dpic may not know the dimensions of the formatted result, and the code
is generally unique to the postprocessor. Where postprocessors are capable of equivalent results,
then macros such as
rs_box
,
shade
, and
rgbfill
mentioned previously can be used to hide code
differences.
14.1 Tikz with pic
Arbitrary pic output can be inserted into a
\tikzpicture
environment. The trick is to keep the pic
and Tikz coordinate systems the same. The lines
\begin{tikzpicture}[scale=2.54]
\end{tikzpicture}%
in the dpic -g output must be changed to
\begin{scope}[scale=2.54]
\end{scope}%
This is accomplished, for example, by adapting the \mtotex macro of Section 2.1.4 as follows:
\newcommand\mtotikz[1]{\immediate\write18{m4 pgf.m4 #1.m4 | dpic -g
| sed -e "/begin{tikzpicture}/s/tikzpicture/scope/"
-e "/end{tikzpicture}/s/tikzpicture/scope/" > #1.tex}\input{./#1.tex}}%
Then, from within a Tikz pictdure,
\mtotikz{
filename
}
will create filename
.tex
from filename
.m4
and read the result into the Tikz code.
In addition, the Tikz code may need to refer to nodes defined in the pic diagram. The included
m4 macro
tikznode(
tikz node name,[position],[string]
)
defines a zero-size Tikz node at the given
pic position, which is
Here
by default. This macro must be invoked in the outermost scope of a pic
diagram, and the .PS value scaling construct may not be used.
15 Web documents, pdf, and alternative output formats
Circuit diagrams contain graphics and symbols, and the issues related to web publishing are similar
to those for other mathematical documents. Here the important factor is that gpic
-t
generates
output containing tpic
\special
commands, which must be converted to the desired output, whereas
dpic can generate several alternative formats, as shown in Figure 72. 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.
PDFlatex produces pdf without first creating a postscript file but does not handle tpic
\special
s,
so dpic must be installed.
Most PDFLatex distributions are not directly compatible with PSTricks, but the Tikz PGF
output of dpic is compatible with both L
A
T
E
X and PDFLatex. Several alternative dpic output
formats such as mfpic and MetaPost also work well. To test MetaPost, create a file filename
.mp
containing appropriate header lines, for example:
verbatimtex
\documentclass[11pt]{article}
\usepackage{times,boxdims,graphicx}
\boxdimfile{tmp.dim}
\begin{document} etex
42
-
L
A
T
E
X
L
A
T
E
X
pict2e
PDF
.pdf
-d
L
A
T
E
X
.tex
-e
tpic
.tex
L
A
T
E
X
psfrag
Postscript
psfrag
.eps
-f
L
A
T
E
X
or
PDFlatex
tikz
PGF
.tex
-g
L
A
T
E
X
Mfpic
Metafont
mfpic
.tex
-m
L
A
T
E
X
PSTricks
PSTricks
.tex
-p
dpic
MetaPost
Meta-
Post
.mp
-s
Post-
script
.eps
-r
L
A
T
E
X
or
PDFlatex
SVG
.svg
-v
Inkscape
or
HTML
Xfig
.fig
-x
Xfig
L
A
T
E
X
or
PDFlatex
gpic -t
m4
.pic.pic
Diagram source
Macro libraries
Figure 72:
Output formats produced by gpic
-t
and dpic. SVG output can be read by Inkscape or used
directly in web documents.
Then append one or more diagrams by using the equivalent of
m4 <installdir>mpost.m4 library files diagram.m4 | dpic -s » filename.mp
The command
mpost –tex=latex
filename
.mp end
processes this file, formatting the di-
agram text by creating a temporary
.tex
file, L
A
T
E
Xing it, and recovering the
.dvi
output to
create filename
.1
and other files. If the
boxdims
macros are being invoked, this process must be
repeated to handle formatted text correctly as described in Section 13. In this case, either put
sinclude(tmp.dim)
in the diagram
.m4
source or read the
.dim
file at the second invocation of m4
as follows:
m4 <installdir>mpost.m4 library files tmp.dim diagram.m4 | dpic -s » filename.mp
On some operating systems, the absolute path name for
tmp.dim
has to be used to ensure that
the correct dimension file is written and read. This distribution includes a
Makefile
that simplifies
the process; otherwise a script can automate it.
Having produced filename
.1
, rename it to filename
.mps
and, voilà, you can now run PDFlatex
on a .tex source that includes the diagram using \includegraphics{filename.mps} as usual.
The dpic processor can generate other output formats, as illustrated in Figure 72 and in example
files included with the distribution. The L
A
T
E
X drawing commands alone or with
eepic
or
pict2e
extensions are suitable only for simple diagrams.
16 Developer’s notes
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 L
A
T
E
X 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 [
5
], raw Postscript, Postscript with
psfrag
tags, raw PDF, PSTricks, and TikZ
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 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
43
-
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 m4 macro processor,
and therefore m4 is required here, although dpic now supports pic-like macros. Free versions of m4
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 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 Tikz PGF, for example, remains available, as arbitrary postprocessor code
can be included with pic code.
The dpic interpreter has several output-format options that may be useful. The
eepicemu
and
pict2e
extensions of the primitive L
A
T
E
X picture objects are supported. The mfpic output allows the
production of Metafont alphabets of circuit elements or other graphics, thereby essentially removing
dependence on device drivers, but with the complication of treating every alphabetic component
as a T
E
X box. The xfig output allows elements to be precisely defined with dpic and interactively
placed with xfig. Similarly, the SVG output can be read directly by the Inkscape graphics editor,
but SVG can also be used directly for web pages. Dpic will also generate low-level MetaPost or
Postscript code, so that diagrams defined using pic can be manipulated and combined with others.
The Postscript output can be imported into CorelDraw and Adobe Illustrator for further processing.
With raw Postscript, PDF, and SVG output, the user is responsible for ensuring that the correct
fonts are provided and for formatting the text.
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.
17 Bugs
This section provides hints and a list of common errors.
The distributed macros are not written for maximum robustness. 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 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, 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 received.
1. Misconfiguration:
One of the configuration files listed in Section 2.2 and
libgen.m4
must
be read by m4 before any other library macros. Otherwise, the macros assume default
configuration. To aid in detecting the default condition, a
WARNING
comment line is inserted
into the
pic
output. If only PSTricks is to be used, for example, then the simplest strategy is to
set it as the default processor by typing “make psdefault” in the installation directory to change
the mention of
gpic
to
pstricks
near the top of
libgen.m4
. Similarly if only Tikz PGF
will be used, change
gpic
to
pgf
using the Makefile. The package default is to read
gpic.m4
for historical compatibility. The processor options must be chosen correspondingly,
gpic -t
for
gpic.m4
and, most often,
dpic -p
or
dpic -g
when dpic is employed. For example, the
pipeline for PSTricks output from file quick.m4 is
m4 -I installdir pstricks.m4 quick.m4 | dpic -p > quick.tex
but for Tikz PGF processing, the configuration file and dpic option have to be changed:
m4 -I installdir pgf.m4 quick.m4 | dpic -g > quick.tex
44
-
Any non-default configuration file must appear explicitly in the command line or in an
include() statement.
2. Pic objects versus macros: A common error is to write something like
line from A to B; resistor from B to C; ground at D
when it should be
line from A to B; resistor(from B to C); ground(at D)
This error is caused by an unfortunate inconsistency between pic object attributes and the
way m4 and pic pass macro arguments.
3. Commas:
Macro arguments are separated by commas, so any comma that is part of an
argument must be protected by parentheses or quotes. Thus,
shadebox(box with .n at w,h)
produces an error, whereas
shadebox(box with .n at w‘,’h)
and
shadebox(box with .n at (w,h))
do not. The parentheses are preferred. For example, a macro invoked by circuit elements
contained the line
command "\pscustom[fillstyle=solid‘,’fillcolor=m4fillv]{%"
which includes a comma, duly quoted. However, if such an element is an argument of another
macro, the quotes are removed and the comma causes obscure “too many arguments” error
messages. Changing this line to
command sprintf("\pscustom[fillstyle=solid,fillcolor=m4fillv]{%%")
cured the problem because the protecting parentheses are not stripped away.
4. Default directions and lengths:
The linespec argument of element macros defines a
straight-line segment, which requires the equivalent of four parameters to be specified uniquely.
If information is omitted, default values are used. Writing
source(up_)
draws a source from the current position up a distance equal to the current
lineht
value,
which may cause confusion. Writing
source(0.5)
draws a source of length 0.5 units in the current pic default direction, which is one of
right,
left, up,
or
down.
The best practice is to specify both the direction and length of an element,
thus:
source(up_ elen_).
The effect of a linespec argument is independent of any direction set using the
Point_
or
similar macros. To draw an element at an obtuse angle (see Section 7) try, for example,
Point_(45); source(to rvec_(0.5,0))
5. Processing sequence:
It is easy to forget that m4 finishes before pic processing begins.
Consequently, it may be puzzling that the following mix of a pic loop and the m4 macro
s_box
does not appear to produce the required result:
for i=1 to 5 do {s_box(A[i]); move }
In this example, the
s_box
macro is expanded only once and the index
i
is not a number.
This particular example can be repaired by using an m4 loop:
for_(1,5,1,‘s_box(A[m4x]); move’)
Note that the loop index variable m4x is automatically defined.
45
-
6. Quotes: Single quote characters are stripped in pairs by m4, so the string
"‘‘inverse’’"
will become
"‘inverse’".
The cure is to add single quotes in pairs as necessary.
The only subtlety required in writing m4 macros is deciding when to quote macro arguments.
In the context of circuits it seemed best to assume that arguments would not be protected by
quotes at the level of macro invocation, but should be quoted inside each macro. There may
be cases where this rule is not optimal or where the quotes could be omitted, and there are
rare exceptions such as the parallel_ macro.
To keep track of paired single quotes, parentheses
(
,
)
,” braces
{
,
}
,” and brackets
[
,
]
,”
use an editor that highlights these pairs. For example, the vim editor highlights single quotes
with the command :set mps+=‘:’.
7. Dollar signs:
The
i
-th argument of an m4 macro is
$i,
where
i
is an integer, so the following
construction can cause an error when it is part of a macro,
"$0$" rjust below
since
$0
expands to the name of the macro itself. To avoid this problem, put the string in
quotes or write "$‘’0$".
8. Name conflicts:
Using the name of a macro as part of a comment or string is a simple and
common error. Thus,
arrow right "$\dot x$" above
produces an error message because
dot
is a macro name. Macro expansion can be avoided by
adding quotes, as follows:
arrow right ‘"$\dot x$"’ above
Library macros intended only for internal use have names that begin with
m4
or
M4
to avoid
name clashes, but in addition, a good rule is to quote all L
A
T
E
X in the diagram input.
If extensive use of strings that conflict with macro names is required, then one possibility is to
replace the strings by macros to be expanded by L
A
T
E
X, for example the diagram
.PS
box "\stringA"
.PE
with the L
A
T
E
X macro
\newcommand{\stringA}{
Circuit containing planar inductor and capacitor}
9. Current direction:
Some macros, particularly those for labels, do unexpected things if
care is not taken to preset the current direction using macros
right_, left_, up_, down_,
or rpoint_( · ). Thus for two-terminal macros it is good practice to write, e.g.
resistor(up_ from A to B); rlabel(,R_1)
rather than
resistor(from A to B); rlabel(,R_1),
which produce different results if the last-defined drawing direction is not
up
. It might be
possible to change the label macros to avoid this problem without sacrificing ease of use.
10. Position of elements that are not 2-terminal:
The linespec argument of elements
defined in
[ ]
blocks must be understood as defining a direction and length, but not the
position of the resulting block. In the pic language, objects inside these brackets are placed by
46
-
default as if the block were a box. Place the element by its compass corners or defined interior
points as described in the first paragraph of Section 6 on page 18, for example
igbt(up_ elen_) with .E at (1,0)
11. Pic error messages:
Some errors are detected only after scanning beyond the end of the
line containing the error. The semicolon is a logical line end, so putting a semicolon at the
end of lines may assist in locating bugs.
12. Line continuation:
A line is continued to the next if the rightmost character is a backslash
or, with dpic, if the backslash is followed immediately by the
#
character. A blank after the
backslash, for example, produces a pic error.
13. Scaling:
Pic and these macros provide several ways to scale diagrams and elements within
them, but subtle unanticipated effects may appear. The line
.PS x
provides a convenient way
to force the finished diagram to width
x.
However, if gpic is the pic processor then all scaled
parameters are affected, including those for arrowheads and text parameters, which may not
be the desired result. A good general rule is to use the
scale
parameter for global scaling
unless the primary objective is to specify overall dimensions.
14. Buffer overflow:
For some m4 implementations, the error message
pushed back more
than 4096 chars
results from expanding large macros or macro arguments, and can be
avoided by enlarging the buffer. For example, the option
-B16000
enlarges the buffer size to
16000 bytes. However, this error message could also result from a syntax error.
15. PSTricks anomaly:
If you are using PSTricks and you get the error message
Graphics
parameter ‘noCurrentPoint’ not defined..
then your version of PSTricks is older than
August 2010. You can do the following:
(a) Update your PSTricks package.
(b)
Instead, comment out the second definition of
M4PatchPSTricks
in
pstricks.m4
. The
first definition works for some older PSTricks distributions.
(c)
Insert
define(‘M4PatchPSTricks’,)
immediately after the
.PS
line of your diagram.
This change prevents the line
\psset{noCurrentPoint}
from being added to the
.tex
code for the diagram. This line is a workaround for a “feature” of the current PSTricks
\psbezier
command that changes its behaviour within the
\pscustom
environment. This
situation occurs rarely and so the line is unnecessary for many diagrams.
(d)
For very old versions of PSTricks such as pstricks97, disable the workaround totally by
changing the second definition in
pstricks.m4
to
define(‘M4PatchPSTricks’,)
. Undo
the change if you later update PSTricks.
16. m4 -I error:
Some old versions of m4 may not implement the
-I
option or the
M4PATH
environment variable that simplify file inclusion. The simplest course of action is probably
to install GNU m4, which is free and widely available. Otherwise, all
include(
filename
)
statements in the libraries and calling commands have to be given absolute filename paths.
You can define the
HOMELIB_
macro in
libgen.m4
to the path of the installation directory and
change the library include statements to the form include(HOMELIB_‘’filename).
18 List of macros
The following table lists macros in the libraries, configuration files, and selected macros from example
diagrams. Some of the sources in the
examples
directory contain additional macros, such as for
flowcharts, Boolean logic, and binary trees.
Internal macros defined within the libraries begin with the characters m4 or M4 and, for the
most part, are not listed here.
The library in which each macro is found is given, and a brief description.
47
-
A B C D E F G H I J K L M N O P R S T U V W X Y
A above_ gen string position above relative to current direction
abs_(number) gen absolute value function
ACsymbol(at position, len, ht, [A]U|D|L|R|degrees)
cct
draw an AC symbol ( 1-cycle sine wave); If arg 4 contains
A, two arcs are drawn. The current drawing direction is
default, otherwise Up, Down, Left, Right, or at degrees
slant; (Section 4.2) e.g.,
ebox; {ACsymbol(at last [],,dimen_/8)}
adc(width,height,nIn,nN,nOut,nS)
cct ADC with defined width, height, and number of inputs
Ini, top terminals Ni, ouputs Outi, and bottom
terminals Si
addtaps[arrowhd | type=arrowhd;name=Name], fraction, length, fraction, length, · · ·)
cct Add taps to the previous two-terminal element. arrowhd
= blank or one of . - <- -> <->. 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, · · · by default or Name1, Name2, · · · if
specified (Section 6)
along_(linear object name) gen short for between name.start and name.end
Along_(LinearObj,distance,[R])gen Position arg2 (default all the way) along a linear object
from .start to .end (from .end to .start if arg3=R)
amp(linespec,size) cct amplifier (Section 4.2)
And, Or, Not, Nand, Nor, Xor, Nxor, Buffer
log Wrappers of AND_gate, . . . for use in the Autologix
macro
AND_gate(n,N) log basic ‘and’ gate, 2 or n inputs; N=negated input.
Otherwise, arg1 can be a sequence of letters
P|N
to define
normal or negated inputs (Section 9)
AND_gen(n,chars,[wid,[ht]]) log general AND gate: n=number of inputs (0 n 16);
chars: B=base and straight sides; A=Arc;
[N]NE,[N]SE,[N]I,[N]N,[N]S=inputs or circles;
[N]O=output; C=center. Otherwise, arg1 can be a
sequence of letters
P|N
to define normal or negated inputs.
AND_ht log height of basic ‘and’ and ‘or’ gates in L_units
AND_wd log width of basic ‘and’ and ‘or’ gates in L_units
antenna(at location, T, A|L|T|S|D|P|F, U|D|L|R|degrees)
cct antenna, without stem for nonblank 2nd arg; A=aerial,
L=loop, T=triangle, S=diamond, D=dipole, P=phased,
F=fork; up, down, left, right, or angle from horizontal
(default 90) (Section 6)
arca(absolute chord linespec, ccw|cw, radius, modifiers)
gen
arc with acute angle (obtuse if radius is negative), drawn
in a [ ] block
ArcAngle(position, position, position, radius, modifiers, label)
gen Arc angle symbol drawn ccw at arg2. Arg4 is the radius
from arg2; arg5 contains line attributes, e.g., thick
linethick/2 ->; arg6 is an optional label at mid-arc
arcd(center, radius,start degrees,end degrees)
48
-
gen Arc definition (see arcr), angles in degrees (Section 3.3)
arcdimension_(arcspec,offset,label, D|H|W|blank width,tic offset,arrowhead )
gen like dimension_, for drawing arcs for dimensioning
diagrams; arrowhead=-> | <-. Uses the first argument
as the attributes of an invisible arc: arc invis arg1.
Arg2 is the radial displacement (possibly negative) of the
dimension arrows. If arg3 is s_box(...) or rs_box(. . . )
and arg4=D|H|W then arg4 means: D: blank width is the
diagonal length of arg3; H: blank width is the height of
arg3 + textoffset*2; W: blank width is the width of
arg3 + textoffset*2; otherwise arg4 is the absolute
blank width
arcr(center,radius,start angle,end angle,modifiers,ht)
gen Arc definition. If arg5 contains <- or -> then a midpoint
arrowhead of height equal to arg6 is added. Arg5 can
contain modifiers (e.g. outlined "red"), for the arc and
arrowhead. Modifiers following the macro affect the arc
only, e.g., arcr(A,r,0,pi_/2,->) dotted ->
(Section 3.3)
arcto(position 1,position 2,radius,[dashed|dotted])
gen line toward position 1 with rounded corner toward
position 2
arrester(linespec,chars, len[:arrowhead ht], ht[:arrowhead wid] )
cct Arg2 chars: G= spark gap (default), g= general (dots), E=
gas discharge, S= box enclosure, C= carbon block, A=
electrolytic cell,
H=
horn gap,
P=
protective gap,
s=
sphere
gap, F= film element, M= multigap. Modifiers in arg2: R=
right orientation, L= left orientation, D= 3-terminal
element for S, E only, with terminals A, B, G
(Section 4.2)
arrowline(linespec) cct
line (dotted, dashed permissible) with centred arrowhead
(Section 4.2)
AutoGate log Draw the tree for a gate as in the Autologix macro. No
inputs or external connections are drawn. The names of
the internal gate inputs are stacked in ‘AutoInNames’
assign3(var name,var name,var name,arg4,arg5,arg6)
gen Assigns $1 = arg4 if $1 is nonblank; similarly $2 = arg5
and $3 = arg6
Autologix(
Boolean function sequence
,[N[oconnect]][L[eftinputs]][R][V][M][;offset=
value
]
49
-
log Draw the Boolean expressions defined in function
notation using And, Or, Not, Buffer, Xor, Nand,
Nor, Nxor and variables, e.g.,
Autologix(And(Or(x1, x2),Or( x1,x2)));. The
Boolean functions are separated by semicolons (;).
Function outputs are aligned vertically but appending
:location attribute to a function can be used to place it.
Each unique variable var causes an input point Invar to
be defined. Preceding the variable by a ˜ causes a not
gate to be drawn at the input. The inputs are drawn in a
row at the upper left by default. An L in arg2 draws the
inputs in a column at the left;
R
reverses the order of the
drawn inputs; V scans the expression from right to left
when listing inputs;
M
draws the left-right mirror image of
the diagram; and N draws only the function tree without
the input array. The inputs are labelled In1, In2, . . . and
the function outputs are Out1, Out2, . . . . Each variable
var corresponds also to one of the input array points with
label Invar. Setting offset=value displaces the drawn
input list in order to disambiguate the input connections
when L is used
B b_ gen blue color value
b_current(label,pos,In|Out,Start|End,frac)
cct
labelled branch-current arrow to frac between branch end
and body (Section 4.3)
basename_(string sequence, separator)
gen Extract the rightmost name from a sequence of names
separated by arg2 (default dot .”)
battery(linespec,n,R) cct n-cell battery: default 1 cell, R=reversed polarity
(Section 4.2)
beginshade(gray value) gen begin gray shading, see shade e.g., beginshade(.5);
closed line specs; endshade
bell( U|D|L|R|degrees, size) cct bell, In1 to In3 defined (Section 6)
below_ gen string position relative to current direction
bi_tr(linespec,L|R,P,E) cct left or right, N- or P-type bipolar transistor, without or
with envelope (Section 6.1)
bi_trans(linespec,L|R,chars,E)
cct bipolar transistor, core left or right; chars: BU=bulk line,
B=base line and label, S=Schottky base hooks,
uEn|dEn=emitters E0 to En, uE|dE=single emitter,
Cn|uCn|dCn=collectors C0 to Cn; u or d add an arrow,
C=single collector; u or d add an arrow, G=gate line and
location, H=gate line; L=L-gate line and location,
[d]D=named parallel diode, d=dotted connection,
[u]T=thyristor trigger line; arg 4 = E: envelope
(Section 6.1)
binary_(n, [m]) gen binary representation of n, left padded to m digits if the
second argument is nonblank
BOX_gate(inputs,output,swid,sht,label)
log output=[P|N], inputs=[P|N]. . ., sizes swid and sht in
L_units (default AND_wd = 7) (Section 9)
boxcoord(planar obj,x fraction,y fraction)
gen internal point in a planar object
50
-
boxdim(name,h|w|d|v,default) gen
evaluate, e.g. name
_w
if defined, else default if given, else
0 v gives sum of d and h values (Section 13)
bp__ gen big-point-size factor, in scaled inches, (*scale/72)
bswitch(linespec, [L|R],chars)
cct pushbutton switch R=right orientation (default L=left);
chars: O= normally open, C=normally closed
BUF_ht log basic buffer gate height in L_units
BUF_wd log basic buffer gate width in L_units
BUFFER_gate(linespec, [N|B], wid, ht, [N|P]*, [N|P]*, [N|P]*)
log basic buffer, dfault 1 input or as a 2-terminal element,
arg2:
N
=negated input,
B
=box gate; arg 5: normal (
P
) or
negated N) inputs labeled In1 (Section 9)
BUFFER_gen(chars,wd,ht,[N|P]*,[N|P]*,[N|P]*)
log general buffer, chars: T=triangle, [N]O=output location
Out
(
NO
draws circle
N_Out
);
[N]I, [N]N, [N]S, [N]NE,
[N]SE input locations; C=centre location. Args 4-6 allow
alternative definitions of respective In, NE, and SE
argument sequences
buzzer( U|D|L|R|degrees, size,[C])
cct buzzer, In1 to In3 defined, C=curved (Section 6)
C c_fet(linespec,R,P) cct left or right, plain or negated pin simplified MOSFET
capacitor(linespec,chars,R, height, wid)
cct
capacitor, chars: F or blank=flat plate; dF flat plate with
hatched fill; C=curved-plate; dC=curved-plate with
variability arrowhead; CP=constant phase element;
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; 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, CP: height*0.8, E,K: height) (Section 4.2)
cbreaker(linespec,L|R,D|Th|TS)
cct circuit breaker to left or right, D=with dots; Th=thermal;
TS=squared thermal (Section 4.2)
ccoax(at location, M|F, diameter)
cct coax connector, M=male, F=female (Section 6)
cct_init cct initialize circuit-diagram environment (reads libcct.m4)
centerline_(linespec, thickness|color, minimum long dash len, short dash len, gap len
gen Technical drawing centerline
Cintersect(Pos1, Pos2, rad1, rad2, [R])
gen Upper (lower if arg5=R) intersection of circles at Pos1
and Pos2, radius rad1 and rad2
clabel(label,label,label,arg4,arg5)
cct Triple label along the drawing axis of an element in the
current direction (Section 4.4). Labels are placed at the
beginning, centre, or end of the last
[]
block (or a named
[] block). The labels are treated as math, but copied
literally if in double quotes or defined by sprintf. Arg4
can be
above, below, left,
or
right
to supplement the
default position. Arg5 is the optional name of a [] block
to be labelled and is last [] by default
51
-
cm__ gen absolute centiimetres
consource(linespec,V|I|v|i,R)cct voltage or current controlled source with alternate forms;
R=reversed polarity (Section 4.2)
contact(chars) cct single-pole contact: O= normally open, C= normally
closed (default), I= open circle contacts, P= three
position, R= right orientation, T= T contacts, U= U
contacts (Section 6)
contacts(count, chars) cct multiple ganged single-pole contacts: P= three position,
O= normally open, C= normally closed, D= dashed
ganging line over contact armatures I= open circle
contacts, R= right orientation, T= T contacts, U= U
contact lines parallel to drawing direction (Section 6)
contline(line) gen evaluates to continue if processor is dpic, otherwise to
first arg (default line)
corner(line thickness,attributes,turn radians)
gen Mitre (default filled square) drawn at end of last line or
at a given position. arg1 default: current line thickness;
arg2: e.g.
outlined
string; if arg2 starts with
at
position
then a manhattan (right-left-up-down) corner is drawn;
arg3= radians (turn angle, +ve is ccw, default
π/
2). The
corner is enclosed in braces in order to leave Here
unchanged unless arg2 begins with at (Section 7)
Cos(integer) gen cosine function, integer degrees
cosd(arg) gen cosine of an expression in degrees
Cosine( amplitude, freq, time, phase )
gen function a × cos(ωt + φ)
cross(at location) gen plots a small cross
cross3D(x1,y1,z1,x2,y2,z2) 3D cross product of two triples
crossover(linespec, L|R, Line1, ...)
cct line jumping left or right over named lines (Section 6.1)
crosswd_ gen cross dimension
csdim_ cct controlled-source width
D d_fet(linespec,R,P,E|S) cct left or right, N or P depletion MOSFET, envelope or
simplified (Section 6.1)
dabove(at location) darrow above (displaced dlinewid/2)
dac(width,height,nIn,nN,nOut,nS)
cct DAC with defined width, height, and number of inputs
Ini, top terminals Ni, ouputs Outi, and bottom
terminals Si (Section 9)
darc(
center position
,
radius
,
start radians
,
end radians
,
dline thickness
,
arrowhead wid
,
ar-
rowhead ht, terminals)
darrow
See also
Darc
. CCW arc in
dline
style, with closed ends
or (dpic only) arrowheads. Permissible terminals: x-, -x,
x-x, ->, x->, <-, <-x, <-> where x means | or
(half-thickness line) !.
Darc(center position, radius, start radians, end radians, parameters)
darrow Wrapper for darc. CCW arc in dline style, with closed
ends or (dpic only) arrowheads. Semicolon-separated
parameters: thick=value, wid=value, ends= x-, -x, x-x,
->, x->, <-, <-x, <-> where x means | or (half-thickness
line) !.
52
-
Darlington(L|R,chars) cct Composite Darlington pair Q1 and Q2 with internal
locations E, B, C; Characters in arg2: E= envelope, P=
P-type, B1= internal base lead, D= damper diode, R1=
Q1 bias resistor; E1= ebox, R2= Q2 bias resistor; E1=
ebox, Z= zener bias diode (Section 6.1)
darrow_init darrow initialize darrow drawing parameters (reads darrow.m4)
Darrow(linespec, parameters) darrow Wrapper for darrow. Semicolon-separated parameters: S,
E
truncate at start or end by dline thickness/2;
thick=
val
(total thicknes, ie width); wid=val (arrowhead width);
ht=val (arrowhead height); ends= x-x or -x or x- where
x is ! (half-width line) or | (full-width line).
darrow(linespec, t,t,width,arrowhd wd,arrowhd ht,parameters)
darrow
See also
Darrow
. double arrow, truncated at beginning or
end, specified sizes, with arrowhead or closed stem.
parameters= x
-
or
->
or x
->
or
<-
or
<-
x or
<->
where x
is | or !. The !- or -! parameters close the stem with
half-thickness lines to simplify butting to other objects.
dashline(linespec,thickness|color|<->, dash len, gap len,G)
gen dashed line with dash at end (G ends with gap)
dbelow(at location) darrow below (displaced dlinewid/2)
dcosine3D(i,x,y,z) 3D extract i-th entry of triple x,y,z
DCsymbol(at position, len, ht, U|D|L|R|degrees)
cct A DC symbol (a dashed line below a solid line). The
current drawing direction is default, otherwise Up, Down,
Left, Right, or at degrees slant; e.g., source(up_
dimen_); { DCsymbol(at last []„,R) } (Section 4.2)
delay_rad_ cct delay radius
delay(linespec,size) cct delay element (Section 4.2)
deleminit_ darrow sets drawing direction for dlines
Deltasymbol(at position,keys, U|D|L|R|degrees) (default U for up)
cct Delta symbol for power-system diagrams. keys:
size=expression
Demux(n,label, [L][B|H|X][N[n]|S[n]][[N]OE], wid,ht)
log binary multiplexer, n inputs, L reverses input pin
numbers, B displays binary pin numbers, H displays
hexadecimal pin numbers, X do not print pin numbers,
N[
n
]
puts Sel or Sel0 .. Sel
n
at the top (i.e., to the left of
the drawing direction), S[n] puts the Sel inputs at the
bottom (default) OE (N=negated) OE pin (Section 9)
dend(at location) darrow close (or start) double line
dfillcolor darrow dline fill color (default white)
diff_(a,b) gen difference function
diff3D(x1,y1,z1,x2,y2,z2) 3D difference of two triples
dimen_ cct size parameter for scaling circuit element bodies
(Section 11.1)
dimension_(linespec,offset,label, D|H|W|blank width,tic offset,arrowhead )
gen macro for dimensioning diagrams; arrowhead=-> | <-
diode(linespec,B|CR|D|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars,[R][E])
53
-
cct diode: B=bi-directional, CR=current regulator, D=diac,
G=Gunn, L=open form with centre line, LE[R]=LED
[right], P[R]=photodiode [right], S=Schottky,
Sh=Shockley, T=tunnel, V=varicap, v=varicap (curved
plate),
w
=varicap (reversed polarity),
Z
=zener; appending
K to arg 2 draws open arrowheads; arg 3: R=reversed
polarity, E=enclosure (Section 4.2)
dir_ darrow
used for temporary storage of direction by darrow macros
distance(Position 1, Position2)
gen distance between named positions
distance(position, position) gen distance between positions
dlabel(long,lat,label,label,label,chars)
cct general triple label; chars: x (drawing direction)
displacement is from the centre of the last line rather than
the centre of the last
[ ]
; L,R,A,B align labels ljust, rjust,
above, or below (absolute) respectively (Section 4.4)
dleft darrow double line left turn
Dline(linespec, parameters) darrow
Wrapper for
dline
. Semicolon-separated parameters:
S
,
E
truncate at start or end by dline thickness/2; thick=val
(total thicknes, ie width); ends= x-x or -x or x- where x
is ! (half-width line) or | (full-width line).
dline(linespec,t,t,width,parameters)
darrow See also Dline. Double line, truncated by half width at
either end, closed at either or both ends. parameters=
x-x or -x or x- where x is ! (half-width line) or |
(full-width line).
dlinewid darrow width of double lines
dljust(at location) darrow ljust (displaced dlinewid/2)
dn_ gen down with respect to current direction
dna_ cct internal character sequence that specifies which
subcomponents are drawn
dot(at location,radius,fill) gen filled circle (third arg= gray value: 0=black, 1=white)
dot3D(x1,y1,z1,x2,y2,z2) 3D dot product of two triples
dotrad_ gen dot radius
down_ gen sets current direction to down (Section 5)
dright darrow double arrow right turn
drjust(at location) darrow rjust (displaced dlinewid/2)
dswitch(linespec,L|R,W[ud]B[K]chars)
54
-
cct SPST switch left or right, W=baseline, B=contact blade,
dB=contact blade to the right of drawing direction, Bm
= mirror contact blade, Bo = contact blade more widely
open, Cb = circuit-breaker function, Co = contactor
function, C = external operating mechanism, D = circle
at contact and hinge, (dD = hinge only, uD = contact
only) E = emergency button, EL = early close (or late
open), LE = late close (or early open), F = fused, H =
time delay closing, uH = time delay opening, HH = time
delay opening and closing, K=vertical closing contact line,
L = limit, M = maintained (latched), MM = momentary
contact on make, MR = momentary contact on release,
MMR = momentary contact on make and release, O =
hand operation button, P = pushbutton, Pr[T|M] =
proximity (touch-sensitive or magnetically controlled), Th
= thermal control linkage, Tr = tripping, Y = pull switch,
Z = turn switch (Section 4.2)
dtee([L|R]) darrow double arrow tee junction with tail to left, right, or
(default) back along current direction
dtor_ gen degrees to radians conversion constant
dturn(degrees ccw) darrow turn dline arg1 degrees left (ccw)
E E__ gen the constant e
e_ gen .e relative to current direction
e_fet(linespec,R,P,E|S) cct left or right, N or P enhancement MOSFET, normal or
simplified, without or with envelope (Section 6.1)
earphone( U|D|L|R|degrees, size)
cct earphone, In1 to In3 defined (Section 6)
ebox(linespec,lgth,wdth,fill value, box attributes)
cct
two-terminal box element with adjustable dimensions and
fill value 0 (black) to 1 (white). lgth (length) and wdth
(width) are relative to the direction of linespec.
Alternatively, argument 1 is the linespec and argument 2
is a semicolon-separated sequence of key=value terms.
The possible keys are lgth, wdth, text, box, e.g.,
lgth=0.2; text="XX"; box=shaded "green"
(Section 4.2)
elchop(Name1,Name2) gen chop for ellipses: evaluates to chop r where r is the
distance from the centre of ellipse Name1 to the
intersection of the ellipse with a line to location Name2;
e.g., line from A to E elchop(E,A)
eleminit_(linespec) cct internal line initialization
elen_ cct default element length
em_arrows([N|I|E][D],angle,length)
cct radiation arrows, N=nonionizing, I=ionizing, E=simple;
D=dot (Section 4.2)
endshade gen end gray shading, see beginshade
Equidist3(Pos1, Pos2, Pos3, Result, distance)
gen Calculates location named Result equidistant from the
first three positions, i.e. the centre of the circle passing
through the three positions. If arg5 is nonblank, it is
equated to the radius.
55
-
expe gen exponential, base e
F f_box(boxspecs,text,expr1,· · ·)gen like s_box but the text is overlaid on a box of identical
size. If there is only one argument then the default box is
invisible and filed white (Section 13)
Fector(x1,y1,z1,x2,y2,z2) 3D vector projected on current view plane with top face of
3-dimensonal arrowhead normal to x2,y2,z2
Fe_fet(linespec,R,chars) cct
FET with superimposed ferroelectric symbol. Args 1 to 3
are as for the mosfet macro (Section 6.1)
FF_ht cct flipflop height parameter in L_units
FF_wid cct flipflop width parameter in L_units
fill_(number) gen fill macro, 0=black, 1=white (Section 6.1)
fitcurve(V,n,[e.g. dotted],m (default 0))
gen Draw a spline through positions V[m], ldots V[n]: Works
only with dpic.
FlipFlop(D|T|RS|JK,label,boxspec,pinlength)
log flip-flops, boxspec=e.g. ht x wid y (Section 9)
FlipFlop6(label,spec,boxspec) log This macro (6-input flip-flops) has been superseded by
FlipFlopX and may be deleted in future.
spec=[[n]NQ][[n]Q][[n]CK][[n]PR][lb]
[[n]CLR][[n]S][[n].|D|T|R] to include and negate
pins, lb to print labels
FlipFlopJK(label, spec,boxspec)
log This macro (JK flip-flop) has been superseded by
FlipFlopX and may be deleted in future. Similar to
FlipFlop6.
FlipFlopX(boxspec, label, leftpins, toppins, rightpins, bottompins, pinlength)
log General flipflop. Arg 1 modifies the box (labelled Chip)
default specification. Each of args 3 to 6 is null or a
string of pinspecs separated by semicolons (
;
). A Pinspec
is either empty or of the form
[pinopts]:[label[:Picname]]. The first colon draws the
pin. Pins are placed top to bottom or left to right along
the box edges with null pinspecs counted for placement.
Pins are named by side and number by default; eg W1,
W2, ..., N1, N2, ..., E1, ..., S1, ... ; however,
if
:
Picname is present in a pinspec then Picname replaces
the default name. A pinspec label is text placed at the
pin base. Semicolons are not allowed in labels; use, e.g.,
\char59{} instead. To put a bar over a label, use
lg_bartxt(label). The pinopts are [N|L|M][E]; N=pin
with not circle;
L
=active low out;
M
=active low in;
E
=edge
trigger (Section 9). Optional arg 7 is the length of pins
for_(start,end,increment,‘actions’)
gen integer for loop with index variable m4x (Section 8)
foreach_(‘variable’,actions,value1, value2, . . .)
gen Clone of Loopover_ by a different name: Repeat actions
with variable set successively to value1, value2,
. . .
, setting
macro m4Lx to 1, 2, . . ., terminating if variable is nul
FTcap(chars) cct Feed-through capacitor; example of a composite element
derived from a two-terminal element. Defined points:
.Start, .End, .C .T1 .T2 T Arg 1: (default) A= type A,
B= type B, C= type C (Section 6)
56
-
fuse(linespec, type, wid, ht) cct fuse symbol, type= A|B|C|D|S|HB|HC|SB or dA=D
(Section 4.2)
G g_ gen green color value
G_hht log gate half-height in L_units
g_fet(linespec,R,P,shade spec)cct left or right, N or P graphene FET, without or with
shading (Section 6.1)
gap(linespec,fill,A) cct gap with (filled) dots, A=chopped arrow between dots
(Section 4.2)
gen_init gen
initialize environment for general diagrams (customizable,
reads libgen.m4)
glabel_ cct internal general labeller
gpolyline_(fraction,location, ...)
gen internal to gshade
graystring(gray value) gen
evaluates to a string compatible with the postprocessor in
use to go with colored, shaded, or outlined attributes.
(PSTricks, metapost, pgf-tikz, pdf, postscript, svg). The
argument is a fraction in the range [0, 1]; see rgbstring
grid_(x,y) log absolute grid location
ground(at location, T|stem length, N|F|S|L|P[A]|E, U|D|L|R|degrees)
cct ground, without stem for 2nd arg = T; N=normal,
F=frame, S=signal, L=low-noise, P=protective,
PA=protective alternate, E=European; up, down, left,
right, or angle from horizontal (default -90) (Section 6)
gshade(gray value,A,B,...,Z,A,B)
gen (Note last two arguments). Shade a polygon with named
vertices, attempting to avoid sharp corners
gyrator(box specs,space ratio,pin lgth,[N][V])
cct Gyrator two-port wrapper for nport, N omits pin dots; V
gives a vertical orientation (Section 6)
H H_ht log hysteresis symbol dimension in L_units
Header(1|2,rows,wid,ht,box attributes)
log
Header block with 1 or 2 columns and square Pin 1: arg1
= number of columns; arg2 = pins per column; arg3,4 =
custom wid, ht; arg5 = e.g., fill_(0.9) (Section 6)
HeaderPin(location, type, Picname,n|e|s|w,length)
log General pin for Header macro; arg 4 specifies pin
direction with respect to the current drawing direction)
hatchbox(boxspec,hashsep,hatchspec)
gen Manhattan box with 45 degree hatching, e.g.,
hatchbox(outlined "blue"„dashed outlined
"green" thick 0.4)
heater(linespec, ndivisions, wid, ht)
cct heater element (Section 4.2)
hex_digit(n) gen hexadecimal digit for 0 n < 16
hexadecimal_(n, [m]) gen hexadecimal representation of n, left padded to m digits
if the second argument is nonblank
hlth gen current line half thickness in drawing units
hoprad_ cct hop radius in crossover macro
ht_ gen height relative to current direction
57
-
I ifdpic(if true,if false) gen test if dpic has been specified as pic processor
ifgpic(if true,if false) gen test if gpic has been specified as pic processor
ifinstr(string,string,if true,if false)
gen
test if the second argument is a substring of the first; also
ifinstr(string,string,if true,string,string,if true, . . .
if false)
ifmfpic(if true,if false) gen test if mfpic has been specified as pic post-processor
ifmpost(if true,if false) gen test if MetaPost has been specified as pic post-processor
ifpgf(if true,if false) gen test if Tikz PGF has been specified as pic post-processor
ifpostscript(if true,if false) gen test if Postscript (dpic -r) has been specified as pic
output format
ifpsfrag(if true,if false) gen Test if either psfrag or psfrag_ has been defined. For
postscript with psfrag strings, one or the other should be
defined prior to or at the beginning of the diagram
ifpstricks(if true,if false) gen test if PSTricks has been specified as post-processor
ifroff(if true,if false) gen test if troff or groff has been specified as post-processor
ifxfig(if true,if false) gen test if Fig 3.2 (dpic -x) has been specified as pic output
format
igbt(linespec,L|R,[L][[d]D]) cct left or right IGBT, L=alternate gate type, D=parallel
diode, dD=dotted connections
in__ gen absolute inches
inductor(linespec, W|L, cycles, M[n]|P[n]|K[n], loop wid)
cct inductor, arg2: narrow (default), W=wide, L=looped;
arg3: number of arcs or cycles (default 4); arg4:
M=magnetic core, P=powder (dashed) core,
K=long-dashed core, n=integer (default 2) number of core
lines named M4Core1, M4Core2, . . .; arg5: loop width
(default L,W: dimen_/5; other: dimen_/8) (Section 4.2)
inner_prod(linear obj,linear obj)
gen inner product of (x,y) dimensions of two linear objects
Int_ gen corrected (old) gpic int() function
integrator(linespec,size) cct integrating amplifier (Section 4.2)
intersect_(line1.start,line1.end, line2.start,line2.end)
gen intersection of two lines
Intersect_(Name1,Name2) gen intersection of two named lines
IOdefs(linespec,label,[P|N]*,L|R)
log
Define locations label
1
,
. . .
label
n
along the line;
P
= label
only; N=with NOT_circle; R=circle to right of current
direction
J j_fet(linespec,L|R,P,E) cct left or right, N or P JFET, without or with envelope
(Section 6.1)
jack(U|D|L|R|degrees,chars) cct arg1: drawing direction; string arg2: R=right orientation,
one or more L[M][B] for L and auxiliary contacts with
make or break points; S[M][B] for S and auxiliary
contacts (Section 6)
K KelvinR(cycles,[R],cycle wid) cct
IEEE resistor in a
[ ]
block with Kelvin taps T1 and T2
(Section 6)
L L_unit log logic-element grid size
lamp(linespec, [R]) cct Two-terminal incandescent lamp (Section 4.2)
58
-
larrow(label,->|<-,dist) cct arrow dist to left of last-drawn 2-terminal element
(Section 4.3)
lbox(wid, ht, attributes) gen box oriented in current direction, arg 3= e.g. dashed
shaded "red"
LCintersect(line name, Centre, rad, [R])
gen First (second if arg4 is R) intersection of a line with a
circle
LCtangent(Pos1, Centre, rad, [R])
gen Left (right if arg4=R) tangent point of line from Pos1 to
circle at Centre with radius arg3
left_ gen left with respect to current direction (Section 5)
length3D(x,y,z) 3D Euclidean length of triple x,y,z
LEintersect(line name, Centre, ellipse wid, ellipse ht, [R])
gen First (second if arg5 is R) intersection of a line with an
ellipse
LEtangent(Pos1, Centre, ellips wid, ellipse ht [R])
gen Left (right if arg5=R) tangent point of line from Pos1 to
ellipse at Centre with given width and height
lg_bartxt log draws an overline over logic-pin text (except for xfig)
lg_pin(location, label, Picname, n|e|s|w[L|M|I|O][N][E], pinno, optlen)
log comprehensive logic pin; label= text (indicating logical
pin function, usually), Picname= pic label for referring to
the pin (line), n|e|s|w=orientation (north, south, east,
west), L=active low out, M=active low in, I=inward
arrow, O=outward arrow, N=negated, E=edge trigger
lg_pintxt log reduced-size text for logic pins
lg_plen log logic pin length in in L_units
LH_symbol([U|D|L|R|degrees][I])
log logic-gate hysteresis symbol; I=inverted
lin_ang(line-reference) gen the angle from .start to .end of a line or move
lin_leng(line-reference) gen
length of a line, equivalent to line-reference
.len
with dpic
linethick_(number) gen set line thickness in points
ljust_ gen ljust with respect to current direction
llabel(label,label,label,arg4,arg5)
cct Triple label on the left of an element with respect to the
current direction (Section 4.4). Labels are placed at the
beginning, centre, or end of the last
[]
block (or a named
[] block). The labels are treated as math, but copied
literally if in double quotes or defined by sprintf. Arg4
can be
above, below, left,
or
right
to supplement the
default position. Arg5 is the optional name of a [] block
to be labelled and is last [] by default
loc_(x, y) gen location adjusted for current direction
log_init log initialize environment for logic diagrams (customizable,
reads liblog.m4)
log10E_ gen constant log
10
(e)
loge gen logarithm, base e
Loopover_(‘variable’,actions,value1, value2, . . .)
gen Repeat actions with variable set successively to value1,
value2,
. . .
, setting macro
m4Lx
to 1, 2,
. . .
, terminating if
variable is nul
59
-
lp_xy log coordinates used by lg_pin
lpop(xcoord, ycoord, radius, fill, zero ht)
gen for lollipop graphs: filled circle with stem to
(xcoord,zeroht)
lswitch( linespec, L|R, chars )
cct knife switch R=right orientation (default L=left);
chars=[O|C][D][K][A] O=opening arrow; C=closing
arrow; D=dots; K=closed switch; A=blade arrowhead
(Section 4.2)
lt_ gen left with respect to current direction
LT_symbol(U|D|L|R|degrees) log logic-gate triangle symbol
lthick gen current line thickness in drawing units
M m4_arrow(linespec,ht,wid) gen arrow with adjustable head, filled when possible
m4dupstr(string,n,‘name’) gen Defines name as n concatenated copies of string.
m4lstring(arg1,arg2) gen
expand arg1 if it begins with
sprintf
or
"
, otherwise arg2
m4xpand(arg) gen Evaluate the argument as a macro
m4xtract(‘string1’,string2) gen delete string2 from string1, return 1 if present
manhattan gen sets direction cosines for left, right, up, down
Max(arg, arg, . . .) gen Max of an arbitrary number of inputs
memristor(linespec, wid, ht) cct memristor element (Section 4.2)
microphone( A|U|D|L|R|degrees, size)
cct
microphone; if arg1 = A: upright mic, otherwise arg1 sets
direction of standard microphone with In1 to In3 defined
(Section 6)
Min(arg, arg, . . .) gen Min of an arbitrary number of inputs
Mitre_(Line1,Line2,length,line attributes)
gen e.g., Mitre_(L,M) draws angle at intersection of lines L
and M with legs of length arg3 (default linethick
bp__/2); sets Here to intersection (Section 7)
mitre_(Position1,Position2,Position3,length,line attributes)
gen
e.g.,
mitre_(A,B,C)
draws angle ABC with legs of length
arg4 (default
linethick bp__/2
); sets
Here
to Position2
(Section 7)
mm__ gen absolute millimetres
mosfet(linespec,L|R,chars,E) cct MOSFET left or right, included components defined by
characters, envelope. arg 3 chars: [u][d]B: center bulk
connection pin; D: D pin and lead; E: dashed substrate;
F: solid-line substrate; [u][d]G: G pin to substrate at
source; [u][d]H: G pin to substrate at center; L: G pin
to channel (obsolete); [u][d]M: G pin to channel; u: at
drain end; d: at source end
[u][d]M
n
:
multiple gates G0
to Gn Py: parallel diode; Pz: parallel zener diode; Q:
connect B pin to S pin;
R:
thick channel;
[u][d]S:
S pin
and lead u: arrow up; d: arrow down; [d]T: G pin to
center of channel d: not circle; X: XMOSFET terminal;
Z: simplified complementary MOS (Section 6.1)
Mux_ht cct Mux height parameter in L_units
Mux_wid cct Mux width parameter in L_units
Mux(n,label, [L][B|H|X][N[n]|S[n]][[N]OE], wid,ht)
60
-
log binary multiplexer, n inputs, L reverses input pin
numbers, B display binary pin numbers, H display
hexadecimal pin numbers, X do not print pin numbers,
N[
n
]
puts Sel or Sel0 .. Sel
n
at the top (i.e., to the left of
the drawing direction), S[n] puts the Sel inputs at the
bottom (default) OE (N=negated) OE pin (Section 9)
Mx_pins log max number of gate inputs without wings
N n_ gen .n with respect to current direction
N_diam log diameter of ‘not’ circles in L_units
N_rad log radius of ‘not’ circles in L_units
NAND_gate(n,N) log ‘nand’ gate, 2 or n inputs; N=negated input. Otherwise,
arg1 can be a sequence of letters P|N to define normal or
negated inputs. (Section 9)
ne_ gen .ne with respect to current direction
NeedDpicTools gen executes copy "HOMELIB_/dpictools.pic" if the file
has not been read
neg_ gen unary negation
NOR_gate(n,N) log ‘nor’ gate, 2 or n inputs; N=negated input. Otherwise,
arg1 can be a sequence of letters P|N to define normal or
negated inputs. (Section 9)
norator(linespec,width,ht) cct norator two-terminal element (Section 4.2)
NOT_circle log ‘not’ circle
NOT_gate(linespec,[B][N|n],wid,height)
log ‘not’ gate. When 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: B=box gate, N=not circle at input and output,
n=not circle at input only (Section 9)
NOT_rad log ‘not’ radius in absolute units
NPDT(npoles,[R]) cct Double-throw switch; npoles: number of poles; R= right
orientation with respect to drawing direction (Section 6)
nport(box spec;other commands, 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, . . . 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 (Section 6)
nterm(box spec;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,
. . .
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.
nterm(,,,,,,N,"$a$" at Box.w ljust,"$b$" at
Box.e rjust, "$c$" at Box.s above)
nullator(linespec,width,ht) cct nullator two-terminal element (Section 4.2)
nw_ gen .nw with respect to current direction
61
-
NXOR_gate(n,N) log ‘nxor’ gate, 2 or n inputs; N=negated input. Otherwise,
arg1 can be a sequence of letters P|N to define normal or
negated inputs. (Section 9)
O opamp(linespec,label,label,size,chars, other commands)
cct operational amplifier with , + or other internal labels,
specified size. chars: P= add power connections, R= swap
In1, In2 labels,
T=
truncated point. The internally defined
positions are W, N, E, S, Out, NE, SE, In, In2, and the
(obsolete) positions E1 = NE, E2 = SE. The first and last
arguments allow added customizations (Section 6)
open_arrow(linespec,ht,wid) gen arrow with adjustable open head
OR_gate(n,N) log
‘or’ gate, 2 or n inputs; N=negated input. Otherwise, arg1
can be a sequence of letters P|N to define normal or
negated inputs. (Section 9)
OR_gen(n,chars,[wid,[ht]]) log general OR gate: n=number of inputs (0 n 16);
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
P|N
to define normal or negated inputs.
OR_rad log radius of OR input face in L_units
P parallel_(‘elementspec’,‘elementspec. . .)
cct Parallel combination of two-terminal elements in a [ ]
block. Each argument is a quoted elementspec of the form
[Sep=val;][Label:] element; [attributes] where an
attribute is of the form [llabel(. . .);] |
[rlabel(. . .);] | [b_current(. . .);]. An argument
may also be series_(. . .) or parallel_(. . .) without
attributes or quotes. Sep=val; in the first branch sets the
default separation of all branches to val; in a later
element Sep=val; applies only to that branch. An element
may have normal arguments but should not change the
drawing direction. (Section 5.1)
proximity(linespec) cct proximity detector (= consource(,P))
pc__ gen absolute points
pvcell(linespec, width, height) cct PV cell
px__ gen absolute SVG screen pixels
pconnex(R|L|U|D|degrees,chars)
cct power connectors, arg 1: drawing direction; chars:
R=right orientation, M|F= male, female, A|AC=115V, 3
prong, B=box, C=circle, P= PC connector, D= 2-pin
connector, G|GC= GB 3-pin, J= 110V 2-pin (Section 6)
pi_ gen π
plug(U|D|L|R|degrees,[2|3][R])
cct arg1: drawing direction; string arg2: R right orientation,
2|3 number of conductors (Section 6)
pmod(integer, integer) gen +ve mod(M, N) e.g., pmod(3, 5) = 2
point_(angle) gen (radians) set direction cosines
perpto(Pos1, Line, Point) gen Point is the label for the point on Line of the
perpendicular from Point to Line.
PerpTo(Pos1, Pos2, Pos3) gen The point between Pos2 and Pos3 of intersection of the
perpendicular to Pos1, i.e., the perpendicular projection
of Pos1 onto the line from Pos2 to Pos3.
62
-
Point_(integer) gen sets direction cosines in degrees (Section 5)
polar_(x,y) gen rectangular-to polar conversion
langle(Start, End) gen
Angle in radians from horizontal of the line from Start to
End.
potentiometer(linespec,cycles,fractional pos,length,· · ·)
cct resistor with taps T1, T2, . . . with specified fractional
positions and lengths (possibly neg) (Section 6)
print3D(x,y,z) 3D write out triple for debugging
prod_(a,b) gen binary multiplication
project(x,(y,(z) 3D 3D to 2D projection onto the plane perpendicular to the
view vector with angles defined by setview(azim, elev)
psset_(PSTricks settings) gen set PSTricks parameters
pt__ gen T
E
X point-size factor, in scaled inches, (*scale/72.27)
PtoL(position, U|D|L|R|degrees, length)
gen
Evaluates to
from
position
to
position
+ Rect_(
length,
angle) from the polar-coordinate data in the arguments
ptrans(linespec, [R|L]) cct pass transistor; L= left orientation (Section 6.1)
R r_ gen red color value
rarrow(label,->|<-,dist) cct arrow dist to right of last-drawn 2-terminal element
(Section 4.3)
Rect_(radius,angle) gen (deg) polar-to-rectangular conversion
rect_(radius,angle) gen (radians) polar-rectangular conversion
reed(linespec, width, height, box attribues, [R][C])
cct Enclosed reed two-terminal contact; R=right orientation;
C=closed contact; e.g., reed(„dimen_/5,shaded
"lightgreen" (Section 6)
relay(number of poles, chars) cct relay: n poles (default 1), chars: O=normally open,
C=normally closed, P=three position, default double
throw, L=drawn left (default), R=drawn right,
Th
=thermal. Argument 3=
[L|R]
is deprecated but works
for backward compatibility (Section 6)
relaycoil(chars, wid, ht, R|L|U|D|degrees)
cct chars: X=or default: external lines from A2 and B2;
AX=external lines at positions A1,A3; BX=external lines
at positions B1,B3; NX=no lines at positions
A1,A2,A3,B1,B2,B3; SO=slow operating; SOR=slow
operating and release; SR=slow release; HS=high speed;
NAC=unaffected by AC current; AC AC=current;
ML=mechanically latched; PO=polarized; RM=remanent;
RH=remanent; TH=thermal; EL=electronic (Section 6)
resetdir_ gen resets direction set by setdir_
resetrgb gen cancel r_, g_, b_ color definitions
resistor(linespec,n|E,chars, cycle wid)
cct resistor, n cycles (default 3), chars: AC=general complex
element, E=ebox, ES=ebox with slash, Q=offset,
H
=squared,
N
=IEEE,
B
=not burnable,
V
=varistor variant,
R=right-oriented, cycle width (default dimen_/6)
(Section 4.2)
resized(factor,‘macro name’,args)
cct scale the element body size by factor
63
-
restorem4dir([‘stack name’]) gen Restore m4 direction parameters from the named stack;
default ‘savm4dir_’
reversed(‘macro name’,args) cct reverse polarity of 2-terminal element
rgbdraw(color triple, drawing 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 setrgb (Section 6.1).
Exceptionally, the color of SVG arrows other than the
default black has to be defined using the
outlined
string
and shaded string constructs.
rgbfill(color triple, closed path)
gen fill with arbitrary color (color entries are 0 to 1 except
SVG entries which are 0 to 255); see
setrgb
(Section 6.1)
rgbstring(color triple or color name)
gen
evaluates to a string compatible with the postprocessor in
use to go with colored, shaded, or outlined attributes.
(PSTricks, metapost, pgf-tikz, pdf, postscript, svg). The
arguments are fractions in the range [0, 1]; For example,
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
right_ gen set current direction right (Section 5)
RightAngle(Pos1, Pos2, Pos3, line len, attributes)
gen Draw a right-angle symbol at Pos2, of size given by arg4.
Arg5 = line attributes, e.g., outlined "gray"
rjust_ gen right justify with respect to current direction
rlabel(label,label,label,arg4,arg5)
cct
Triple label on the right of an element with respect to the
current direction (Section 4.4). Labels are placed at the
beginning, centre, or end of the last
[]
block (or a named
[] block). The labels are treated as math, but copied
literally if in double quotes or defined by sprintf. Arg4
can be
above, below, left,
or
right
to supplement the
default position. Arg5 is the optional name of a [] block
to be labelled and is last [] by default
rot3Dx(radians,x,y,z) 3D rotates x,y,z about x axis
rot3Dy(radians,x,y,z) 3D rotates x,y,z about y axis
rot3Dz(radians,x,y,z) 3D rotates x,y,z about z axis
Rot_(position, degrees) gen rotate position by degrees
rot_(x, y, angle) gen rotate x,y by theta radians
rotbox(wid,ht,type,[r|t=val]) gen box oriented in current direction in [ ] block; type= e.g.
dotted shaded "green". Defined internal locations: N,
E, S, W (and NE, SE, NW, SW if arg4 is blank). If arg4
is
r=
val then corners have radius val. If arg4 is
t=
val then
a spline with tension val is used to draw a “superellipse,”
and the bounding box is then only approximate.
rotellipse(wid,ht,type) gen ellipse oriented in current direction in [ ] block; e.g.
Point_(45); rotellipse(,,dotted fill_(0.9)).
Defined internal locations: N, S, E, W.
round(at location,line thickness,attributes)
64
-
gen filled circle for rounded corners; attributes=colored
"gray" for example; leaves Here unchanged if arg1 is
blank (Section 7)
rpoint_(linespec) gen set direction cosines
rpos_(position) gen Here + position
rrot_(x, y, angle) gen Here + vrot_(x, y, cos(angle), sin(angle))
rs_box(text,expr1,· · ·) gen like s_box but the text is rotated by text_ang (default
90) degrees (Section 13), (Section 14)
rsvec_(position) gen Here + position
rt_ gen right with respect to current direction
rtod__ gen constant, degrees/radian
rtod_ gen constant, degrees/radian
rvec_(x,y) gen location relative to current direction
S s_ gen .s with respect to current direction
s_box(text,expr1,· · ·) gen generate dimensioned text string using \boxdims from
boxdims.sty
. Two or more args are passed to
sprintf()
(default 90) degrees (Section 13)
s_dp(name,default) gen depth of the most recent (or named) s_box (Section 13)
s_ht(name,default) gen
height of the most recent (or named)
s_box
(Section 13)
s_init(name) gen initialize s_box string label to name which should be
unique (Section 13)
s_name gen the value of the last s_init argument (Section 13)
s_wd(name,default) gen width of the most recent (or named) s_box (Section 13)
savem4dir([‘stack name’]) gen Stack m4 direction parameters in the named stack
(default ‘savm4dir_’)
sbs(linespec, chars, label) cct Wrapper to place an SBS thyristor as a two-terminal
element with
[ ]
block label given by the third argument
(Section 6.1)
sc_draw(dna string, chars, iftrue, iffalse)
cct test if chars are in string, deleting chars from string
scr(linespec, chars, label) cct Wrapper to place an SCR thyristor as a two-terminal
element with
[ ]
block label given by the third argument
(Section 6.1)
scs(linespec, chars, label) cct Wrapper to place an SCS thyristor as a two-terminal
element with
[ ]
block label given by the third argument
(Section 6.1)
se_ gen .se with respect to current direction
series_(elementspec, elementspec, . . .)
cct Series combination in a [] block of elements with
shortened default length. An elementspec is of the form
[Label:] element; [attributes], where an attribute is
of the form [llabel(. . .);] | [rlabel(. . .);]
[b_current(. . .);]. Internal points Start, End, and C
are defined (Section 5.1)
setdir_(R|L|U|D|degrees, default U|D|R|L|degrees)
gen
store drawing direction and set it to up, down, left, right,
or angle in degrees (reset by resetdir_). The directions
may be spelled out, i.e., Right, Left, . . . (Section 5.1)
65
-
setrgb(red value, green value, blue value,[name])
gen
define colour for lines and text, optionally named (default
lcspec); svg values are integers from 0 to 255
(Section 6.1)
setkey_(string, key, default,[N])
gen Key-value definition. The string contains
semicolon-separated terms of the form key=value. Then
macro m4key is defined using pushdef to be (value) but
if arg4 is nonbland, the parentheses are omitted.
setview(azimuth degrees,elevation degrees)
3D set projection viewpoint
sfg_init(default line len, node rad, arrowhd len, arrowhd wid), (reads libcct.m4)
cct initialization of signal flow graph macros
sfgabove cct like above but with extra space
sfgarc(linespec,text,text justification,cw|ccw, height scale factor)
cct directed arc drawn between nodes, with text label and a
height-adjustment parameter
sfgbelow cct like below but with extra space
sfgline(linespec,text,text justification)
cct directed straight line chopped by node radius, with text
label
sfgnode(at location,text,above|below,circle options)
cct small circle default white interior, with text label. The
default label position is inside if the diameter is bigger
than textht and textwid; otherwise it is sfgabove.
Options such as fill or line thickness can be given.
sfgself(at location, U|D|L|R|degrees, text, text justification, cw|ccw, scale factor)
cct self-loop drawn at angle angle from a node, with text
label and a size-adjustment parameter
shade(gray value,closed line specs)
gen Fill arbitrary closed curve
shadebox(box attributes, shade width)
gen
Box with edge shading. Arg2 is in points. See also
shaded
ShadedPolygon(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 vertexseq is a colon (:)
separated sequence of vertex positions (or names) of the
polygon in cw or ccw order. A colorseq is of the form 0,
r0,g0,b0, frac1,r1,g1,b1, frac2,r2,g2,b2, . . . 1,rn,gn,bn with
0 < frac1 < frac2 . . . 1
shadowed(box|circle|ellipse|line, position spec, keys)
gen Object with specified shadow. possspec is e.g., with .w
at ... or at position. The keys are attrib=object
attributes; shadowthick=expr; (default
linethick*)5/4), shadowcolor=string; (default
"gray"), shadowangle=expr; (default 45) for box only:
rad=expr;
shielded(‘two-terminal element’, L|U, line attributes)
cct shielding in a [ ] 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 .Start, .End, and .C are defined
66
-
SIdefaults gen
Sets
scale = 25.4
for drawing units in mm, and sets pic
parameters 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,
sign_(number) gen sign function
Sin(integer) gen sine function, integer degrees
sinc(number) gen the sinc(x) function
sind(arg) gen sine of an expression in degrees
sinusoid(amplitude, frequency, phase, tmin, tmax, linetype)
gen draws a sinusoid over the interval (t
min
, t
max
); e.g., to
draw a dashed sine curve, amplitude a, of n cycles of
length x from A,
sinusoid(a,twopi_*n/x,-pi_/2,0,x,dashed) with
.Start at A
source(linespec, V|v|I|i|AC|B|F|G|H|J|Q|L|N|P|S[C[r]]|E[r]]|T|X|U|other, 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 (Section 4.2)
sourcerad_ cct default source radius
sp_ gen evaluates to medium space for gpic strings
speaker( U|D|L|R|degrees,size,H)
cct speaker, In1 to In7 defined; H=horn (Section 6)
sprod3D(a,x,y,z) 3D scalar product of triple x,y,z by a
sqrta(arg) gen square root of the absolute value of arg; i.e.,
sqrt(abs(arg))
SQUID(n, diameter, initial angle, ccw|cw)
cct Superconducting quantum interface device with n
junctions labeled J1, ... Jn placed around a circle
with initial angle -90 deg (by default) with respect to the
current drawing direction. The default diameter is
dimen_
stackargs_(‘stackname’,args) gen
Stack arg 2, arg 3, ... onto the named stack up to a blank
arg
stackcopy_(‘name 1’,‘name 2’)
gen
Copy stack 1 into stack 2, preserving the order of pushed
elements
stackdo_(‘stackname’,commands)
gen
Empty the stack to the first blank entry, performing arg 2
stackexec_(‘name 1’,‘name 2’,commands)
gen Copy stack 1 into stack 2, performing arg3 for each
nonblank entry
stackprint_(‘stack name’) gen Print the contents of the stack to the terminal
stackreverse_(‘stack name’) gen Reverse the order of elements in a stack, preserving the
name
67
-
stacksplit_(‘stack name’,string,separator)
gen Stack the fields of string left to right separated by
nonblank separator (default .). White space preceding the
fields is ignored.
sum_(a,b) gen binary sum
sum3D(x1,y1,z1,x2,y2,z2) 3D sum of two triples
sus(linespec, chars, label) cct Wrapper to place an SUS thyristor as a two-terminal
element with
[ ]
block label given by the third argument
(Section 6.1)
svec_(x,y) log scaled and rotated grid coordinate vector
sw_ gen .sw with respect to current direction
switch(linespec,L|R,[C|O][D],[B|D])
cct
SPST switch (wrapper for bswitch, lswitch, and dswitch),
arg2: R=right orientation (default L=left); if arg4=blank
(knife switch): arg3 = [O|C][D][A] O= opening,
C=closing, D=dots, A=blade arrowhead; if arg4=B
(button switch): arg3 = O|C O=normally open,
C=normally closed, if arg4=D: arg3 = same as for
dswitch (Section 4.2)
T ta_xy(x, y) cct macro-internal coordinates adjusted for L|R
tapped(‘
two-terminal element
’, [
arrowhd
| type=
arrowhd
;name=
Name
],
fraction, length, frac-
tion, length, · · ·)
cct Draw the two-terminal element with taps in a [ ] block
(see addtaps). arrowhd = blank or one of . - <- ->
<->. 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,
· · ·
by default or Name1,
Name2,
· · ·
if specified. Internal block names are
.Start,
.End, and .C corresponding to the drawn element, and
the tap names (Section 6)
tbox(text,wid,ht,<|>|<>,type) cct Pointed terminal box. The text is placed at the
rectangular center in math mode unless the text begins
with " or 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. (Section 6)
tconn(linespec,>|»|<|«|O[F],wid)
cct Terminal connector, O=circle; OF=filled circle; > or »
output connector (default
>
) ;
< or « input connector
;
arg3 is arrowhead width or circle diameter (Section 6)
tgate(linespec, [B][R|L]) cct transmission gate, B= ebox type; L= oriented left
(Section 6.1)
thermocouple(linespec, wid, ht, L|R)
cct Thermocouple drawn to the left (by default) of the
linespec line. If the linespec length equals wid (default
dimen_/5), then only the two branches appear. R= right
orientation. (Section 4.2)
thicklines_(number) gen set line thickness in points
thinlines_(number) gen set line thickness in points
threeD_init 3D initialize 3D transformations (reads lib3D.m4)
68
-
thyristor(linespec,[SCR|SCS|SUS|SBS|IEC][chars])
cct Composite thyristor element in []block: types SCR:
silicon controlled rectifier (default), SCS: silicon
controlled switch, SUS: silicon unilateral switch, SBS:
silicon bilateral switch, IEC: type IEC. 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 (Section 6.1)
tikznode(Tikz node name, position)
pgf insert Tikz code to define a zero-size Tikz node at
location (default
Here
) to assist with inclusion of pic code
output in Tikz diagrams. This macro must be invoked in
the outermost pic scope. (Section 14.1)
tline(linespec,wid,ht) cct transmission line, manhattan direction (Section 4.2)
ToPos(position, U|D|L|R|degrees, length)
gen Evaluates to from position - Rect_(length, angle) to
position from the polar-coordinate data in the arguments
tr_xy_init(origin, unit size, sign )
cct initialize tr_xy
tr_xy(x, y) cct relative macro internal coordinates adjusted for L|R
transformer(linespec,L|R,np,[A|P][W|L][D1|D2|D12|D21],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 (Section 6)
tstrip(R|L|U|D|degrees, nterms, chars)
cct terminal strip, chars: I=invisible terminals, C=circle
terminals (default), D=dot terminals, O=omitted
separator lines, wid=value; total strip width, ht=value;
strip height (Section 6)
ttmotor(linespec, string, diameter, brushwid, brushht)
cct motor with label (Section 4.2)
twopi_ gen 2π
U ujt(linespec,R,P,E) cct unijunction transistor, right, P-channel, envelope
(Section 6.1)
unit3D(x,y,z) 3D unit triple in the direction of triple x,y,z
up__ gen up with respect to current direction
up_ gen set current direction up (Section 5)
V variable(‘element’, [A|P|L|[u]N|[u]NN][C|S], [+|-]angle, length, at position)
cct overlaid arrow or line to indicate variable 2-terminal
element: A=arrow, P=preset, L=linear, N= symmetric
nonlinear, C=continuous, S=setpwise; 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
[ ]
block (Section 4.2)
69
-
Vcoords_(position) gen The x, y coordinate pair of the position
Vdiff_(position,position) gen Vdiff_(A,B) evaluates to A-(B) with dpic, A-(B.x,B.y)
with gpic
vec_(x,y) gen position rotated with respect to current direction
View3D 3D The view vector (triple) defined by setview(azim, elev).
The
project
macro projects onto the plane perpendicular
to this vector
vlength(x,y) gen vector length
p
x
2
+ y
2
vperp(linear object) gen unit-vector pair CCW-perpendicular to linear object
Vperp(position name, position name)
gen unit-vector pair CCW-perpendicular to line joining two
named positions
vrot_(x,y,xcosine,ycosine) gen rotation operator
vscal_(number,x,y) gen vector scale operator
Vsprod_(position, expression) gen The vector in arg 1 multiplied by the scalar in arg 2
Vsum_(position,position) gen Vsum_(A,B) evaluates to A+B with dpic, A+(B.x,B.y)
with gpic
W w_ gen .w with respect to current direction
while_(‘test’,‘actions’) gen Integer m4 while loop
wid_ gen width with respect to current direction
winding(L|R, diam, pitch, turns, core wid, core color)
cct core winding drawn in the current direction;
R=right-handed (Section 6)
XOR_gate(n,N) log ‘xor’ gate, 2 or n inputs; N=negated input. Otherwise,
arg1 can be a sequence of letters P|N to define normal or
negated inputs. (Section 9)
XOR_off log XOR and NXOR offset of input face
X xtal(linespec,keys) cct Quartz crystal. The keys are type=N (default) or R
(round); type N keys: lgth=expr (body length);
wdth=expr (body width); bxwd=expr (body inner box
width); box= box attributes (shaded . . .); type R keys:
outerdiam=expr; innerdiam=expr; outer= outer circle
attributes (dotted . . .); inner= inner circle attributes
(shaded . . .) (Section 4.2)
xtract(string, substr1, substr2, . . .)
gen returns substrings if present
Y Ysymbol(at position,keys, U|D|L|R|degrees) (default U for up)
cct Y symbol for power-system diagrams keys:
size=expression; type=G
References
[1] J. D. Aplevich. Drawing with dpic, 2015. In the dpic source distribution.
[2] J. Bentley. More Programming Pearls. Addison-Wesley, Reading, Massachusetts, 1988.
[3]
D. Girou. Présentation de PSTricks. Cahiers GUTenberg, 16, 1994.
http://cahiers.
gutenberg.eu.org/cg-bin/article/CG_1994___16_21_0.pdf.
70
-
[4]
M. Goossens, S. Rahtz, and F. Mittelbach. The L
A
T
E
XGraphics Companion. Addison-Wesley,
Reading, Massachusetts, 1997.
[5] J. D. Hobby. A user’s manual for MetaPost, 1990.
[6]
IEC. International standard database snapshot 2007-01, graphical symbols for diagrams, 2007.
IEC-60617.
[7]
IEEE. Graphic symbols for electrical and electronic diagrams, 1975. Std 315-1975, 315A-1986,
reaffirmed 1993.
[8]
B. W. Kernighan. PIC—A graphics language for typesetting, user manual. Technical Report
116, AT&T Bell Laboratories, 1991. http://doc.cat-v.org/unix/v10/10thEdMan/pic.pdf.
[9]
B. W. Kernighan and D. M. Richie. The M4 macro processor. Technical report, Bell Laboratories,
1977.
[10] Thomas K. Landauer. The Trouble with Computers. MIT Press, Cambridge, 1995.
[11] W. Lemberg. Gpic man page, 2005. http://www.manpagez.com/man/1/groff/.
[12]
O. Mas. Pycirkuit 0.5.0. Python Software Foundation, 2019.
https://pypi.org/project/
pycirkuit/.
[13]
E. S. Raymond. Making pictures with GNU PIC, 1995. In GNU groff source distribution, also
in the dpic package and at http://www.kohala.com/start/troff/gpic.raymond.ps.
[14] T. Rokicki. DVIPS: A T
E
X driver. Technical report, Stanford, 1994.
[15] R. Seindal et al. GNU m4, 1994. http://www.gnu.org/software/m4/manual/m4.html.
[16]
T. Tantau. Tikz & pgf, 2013.
http://mirrors.ctan.org/graphics/pgf/base/doc/
pgfmanual.pdf.
[17]
T. Van Zandt. PSTricks: Postscript macros for generic tex, 2007.
http://mirrors.ctan.org/
graphics/pstricks/base/doc/pst-user.pdf.
71
-
-
- -
- - diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.pdf b/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.pdf index 02df6fffe21..9dd8ad83772 100644 Binary files a/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.pdf and b/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.pdf differ diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.tex index 10f8d34107b..a5529a90f92 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.tex +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.tex @@ -6,6 +6,7 @@ \usepackage{boxdims} \usepackage{multicol} \usepackage{xspace} +\usepackage{float} \input mode \usepackage{ifpdf} \usepackage{bookmark} diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/DiodesMan.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/DiodesMan.m4 index 360d8e9d9e0..fb433235e11 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/DiodesMan.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/DiodesMan.m4 @@ -1,7 +1,9 @@ .PS -# `Diodes.m4' +# Diodes.m4 cct_init + movewid = 2pt__ + { {diode ; move ; "`{\tt diode}'" ljust} move down 0.2; right_ {diode(,S) ; move ; "`{\tt diode(,S)}'" ljust} @@ -15,6 +17,8 @@ movewid = 2pt__ {diode(,B) ; move ; "`{\tt diode(,B)}'" ljust} move down 0.2; right_ {diode(,G) ; move ; "`{\tt diode(,G)}'" ljust} + move down 0.2; right_ + {diode(,D) ; move ; "`{\tt diode(,D)}'" ljust} } move right_ 2.0 @@ -30,14 +34,18 @@ movewid = 2pt__ move down 0.2; right_ {diode(,Sh) ; move ; "`{\tt diode(,Sh)}'" ljust} move down 0.2; right_ - {diode(,D) ; move ; "`{\tt diode(,D)}'" ljust} + {diode(,M) ; move ; "`{\tt diode(,M)}'" ljust} + move down 0.2; right_ + {diode(,MK) ; move ; "`{\tt diode(,MK)}'" ljust} } move right_ 2.0 { {diode(,Z,RE) ; move ; "`{\tt diode(,Z,RE)}'" ljust} + move down 0.30; right_ + {diode(,U) ; move ; "`{\tt diode(,U)}'" ljust} move down 0.25; right_ {diode(,T) ; move ; "`{\tt diode(,T)}'" ljust} - move down 0.30; right_ + move down 0.20; right_ {diode(,P) ; move ; "`{\tt diode(,P)}'" ljust} move down 0.30; right_ {diode(,LE) ; move ; "`{\tt diode(,LE)}'" ljust} diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/doc/Makefile index d91801fcf94..e7ba8ab0611 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/Makefile +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Makefile @@ -17,7 +17,8 @@ PICTEX = \ 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 ResistorsMan.tex \ - Series.tex ShiftRMan.tex Sinus.tex SourcesMan.tex SwitchesMan.tex \ + Series.tex ShiftRMan.tex Sinus.tex SLDsMan.tex SourcesMan.tex \ + SwitchesMan.tex \ Taps.tex TgateMan.tex Thermal.tex Tline.tex \ VariableMan.tex WindingsMan.tex Workflow.tex XformMan.tex \ arrowex.tex \ @@ -106,7 +107,8 @@ citations: mode.tex $(DOC).bbl $(PICTEX) $(DOC).bbl: $(DOC).bib $(DOC).aux bibtex $(DOC) -$(DOC).aux: mode.tex $(DOCSRC) heading.tex $(VERBATIM) $(PICTEX) +# $(DOC).aux: mode.tex $(DOCSRC) heading.tex $(VERBATIM) $(PICTEX) +$(DOC).aux: mode.tex $(DOCSRC) $(VERBATIM) $(PICTEX) @printf "\n $(DOC).aux:\n\n" $(LATEX) $(DOC) ; bibtex $(DOC) rm -f $(BOXDIMS) @@ -124,6 +126,7 @@ heading.tex: printf '\\usepackage{verbatim,url}\n' >> heading.tex printf '\\usepackage{multicol}\n' >> heading.tex printf '\\usepackage{amssymb,boxdims}\n' >> heading.tex $(PST) + printf '\\usepackage{float}\n' >> heading.tex $(PST) opampex.tex tran.tex bitr.tex: opampex.m4 $(M4) $(M4LIBS) $*.m4 > $*.pic diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/PconnMan.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/PconnMan.m4 index 45a259636fd..0933af6810a 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/PconnMan.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/PconnMan.m4 @@ -45,13 +45,18 @@ P2: [ `"\tt (,GC)"' ht 11pt__ at last [].s below C10: pconnex(,GCF) with .w at last [].e + (0.2,0) `"\tt (,GCF)"' ht 11pt__ at last [].s below -] with .nw at P1.C1.sw + (0,-0.35) -P3: [ - C4: pconnex(,P) + C4: pconnex(,P) with .w at last [].e + (0.2,0) `"\tt (,P)"' at last [].s below C11: pconnex(,PF) with .w at last [].e+(0.2,0) `"\tt (,PF)"' at (C11,last "") below -] with .nw at P2.C9.sw + (0,-0.35) +] with .nw at P1.C1.sw + (0,-0.35) + +#P3: [ +# C4: pconnex(,P) +# `"\tt (,P)"' at last [].s below +# C11: pconnex(,PF) with .w at last [].e+(0.2,0) +# `"\tt (,PF)"' at (C11,last "") below +#] with .nw at P2.C9.sw + (0,-0.35) .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/SLDs.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/SLDs.tex new file mode 100644 index 00000000000..b7e43a7c7ca --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/SLDs.tex @@ -0,0 +1,1208 @@ +% SLDs.m4 +% +\global\newcommand{\SLDTransformers}{% +\begin{tikzpicture}[scale=2.54]% +% dpic version 2021.11.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 +{\sf +\dpicdraw (0.673611,-0.739236) + --(0.673611,-0.504861)\dpicstop +\dpicdraw (0.673611,-0.504861) + --(0.673611,-0.504861)\dpicstop +\dpicdraw (0.673611,-0.411111) + --(0.626736,-0.411111) + --(0.626736,-0.504861) + --(0.720486,-0.504861) + --(0.720486,-0.411111) + --(0.673611,-0.411111)\dpicstop +\dpicdraw (0.673611,-0.411111) + --(0.673611,-0.411111)\dpicstop +\dpicdraw (0.673611,-0.411111) + --(0.673611,-0.270486)\dpicstop +\dpicdraw (0.673611,-0.270486) + --(0.673611,-0.270486)\dpicstop +\dpicdraw (0.511111,-0.270486) + --(0.511111,-0.270486)\dpicstop +\dpicdraw (0.511111,-0.270486) + --(0.511111,-0.276042)\dpicstop +\dpicdraw (0.511111,-0.270486) + ..controls (0.511111,-0.24805) and (0.5293,-0.229861) + ..(0.551736,-0.229861) + ..controls (0.574173,-0.229861) and (0.592361,-0.24805) + ..(0.592361,-0.270486)\dpicstop +\dpicdraw (0.592361,-0.270486) + --(0.592361,-0.276042)\dpicstop +\dpicdraw (0.592361,-0.270486) + ..controls (0.592361,-0.24805) and (0.61055,-0.229861) + ..(0.632986,-0.229861) + ..controls (0.655423,-0.229861) and (0.673611,-0.24805) + ..(0.673611,-0.270486)\dpicstop +\dpicdraw (0.673611,-0.270486) + --(0.673611,-0.276042)\dpicstop +\dpicdraw (0.673611,-0.270486) + ..controls (0.673611,-0.24805) and (0.6918,-0.229861) + ..(0.714236,-0.229861) + ..controls (0.736673,-0.229861) and (0.754861,-0.24805) + ..(0.754861,-0.270486)\dpicstop +\dpicdraw (0.754861,-0.270486) + --(0.754861,-0.276042)\dpicstop +\dpicdraw (0.754861,-0.270486) + ..controls (0.754861,-0.24805) and (0.77305,-0.229861) + ..(0.795486,-0.229861) + ..controls (0.817923,-0.229861) and (0.836111,-0.24805) + ..(0.836111,-0.270486)\dpicstop +\dpicdraw (0.836111,-0.270486) + --(0.836111,-0.276042)\dpicstop +\dpicdraw (0.836111,-0.270486) + --(0.836111,-0.270486)\dpicstop +\dpicdraw (0.836111,-0.135069) + --(0.836111,-0.135069)\dpicstop +\dpicdraw (0.836111,-0.135069) + --(0.836111,-0.129514)\dpicstop +\dpicdraw (0.836111,-0.135069) + ..controls (0.836111,-0.157506) and (0.817923,-0.175694) + ..(0.795486,-0.175694) + ..controls (0.77305,-0.175694) and (0.754861,-0.157506) + ..(0.754861,-0.135069)\dpicstop +\dpicdraw (0.754861,-0.135069) + --(0.754861,-0.129514)\dpicstop +\dpicdraw (0.754861,-0.135069) + ..controls (0.754861,-0.189236) and (0.673611,-0.189236) + ..(0.673611,-0.135069)\dpicstop +\dpicdraw (0.673611,-0.135069) + --(0.673611,-0.129514)\dpicstop +\dpicdraw (0.673611,-0.135069) + ..controls (0.673611,-0.189236) and (0.592361,-0.189236) + ..(0.592361,-0.135069)\dpicstop +\dpicdraw (0.592361,-0.135069) + --(0.592361,-0.129514)\dpicstop +\dpicdraw (0.592361,-0.135069) + ..controls (0.592361,-0.189236) and (0.511111,-0.189236) + ..(0.511111,-0.135069)\dpicstop +\dpicdraw (0.511111,-0.135069) + --(0.511111,-0.129514)\dpicstop +\dpicdraw (0.511111,-0.135069) + --(0.511111,-0.135069)\dpicstop +\dpicdraw (0.673611,-0.135069) + --(0.673611,-0.135069)\dpicstop +\dpicdraw (0.673611,-0.135069) + --(0.673611,0.005556)\dpicstop +\dpicdraw (0.673611,0.005556) + --(0.673611,0.005556)\dpicstop +\dpicdraw (0.673611,0.099306) + --(0.626736,0.099306) + --(0.626736,0.005556) + --(0.720486,0.005556) + --(0.720486,0.099306) + --(0.673611,0.099306)\dpicstop +\dpicdraw (0.673611,0.099306) + --(0.673611,0.099306)\dpicstop +\dpicdraw (0.673611,0.099306) + --(0.673611,0.333681)\dpicstop +\draw (0.673611,-0.739236) node[below=-2bp]{sl\_transformer(,,C,C)}; +\dpiclw=0.4bp +\filldraw[line width=0bp](0.565454,0.132304) + --(0.626736,0.099306) + --(0.593738,0.160588) --cycle\dpicstop +\dpicdraw (0.619901,0.106141) + --(0.460069,0.265972)\dpicstop +\draw (0.460069,0.265972) node[left=-2bp]{\sl BrO}; +\filldraw[line width=0bp](0.781769,-0.537859) + --(0.720486,-0.504861) + --(0.753484,-0.566144) --cycle\dpicstop +\dpicdraw (0.727322,-0.511697) + --(0.887153,-0.671528)\dpicstop +\draw (0.887153,-0.671528) node[right=-2bp]{\sl BrI}; +\dpiclw=0.8bp +\dpicdraw (1.273611,-0.739236) + --(1.273611,-0.504861)\dpicstop +\dpicdraw (1.273611,-0.504861) + --(1.273611,-0.504861)\dpicstop +\fill[fill=black,line width=0bp](1.273611,-0.411111) + --(1.226736,-0.411111) + --(1.226736,-0.504861) + --(1.320486,-0.504861) + --(1.320486,-0.411111) + --(1.273611,-0.411111)--cycle +\dpicstop +\dpicdraw (1.273611,-0.411111) + --(1.226736,-0.411111) + --(1.226736,-0.504861) + --(1.320486,-0.504861) + --(1.320486,-0.411111) + --(1.273611,-0.411111)\dpicstop +\dpicdraw (1.273611,-0.411111) + --(1.273611,-0.411111)\dpicstop +\dpicdraw (1.273611,-0.411111) + --(1.273611,-0.270486)\dpicstop +\dpicdraw (1.273611,-0.270486) + --(1.273611,-0.270486)\dpicstop +\dpicdraw (1.273611,-0.107986) circle (0.063976in)\dpicstop +\dpicdraw (1.273611,0.135764) circle (0.063976in)\dpicstop +\dpicdraw (1.273611,0.298264) + --(1.273611,0.298264)\dpicstop +\dpicdraw (1.273611,0.298264) + --(1.273611,0.438889)\dpicstop +\dpicdraw (1.273611,0.438889) + --(1.273611,0.438889)\dpicstop +\fill[fill=black,line width=0bp](1.273611,0.532639) + --(1.226736,0.532639) + --(1.226736,0.438889) + --(1.320486,0.438889) + --(1.320486,0.532639) + --(1.273611,0.532639)--cycle +\dpicstop +\dpicdraw (1.273611,0.532639) + --(1.226736,0.532639) + --(1.226736,0.438889) + --(1.320486,0.438889) + --(1.320486,0.532639) + --(1.273611,0.532639)\dpicstop +\dpicdraw (1.273611,0.532639) + --(1.273611,0.532639)\dpicstop +\dpicdraw (1.273611,0.532639) + --(1.273611,0.767014)\dpicstop +\draw (1.273611,-0.739236) node[below=-2bp]{.{.}.(,type=S,O,O)}; +\dpiclw=0.4bp +\filldraw[line width=0bp](0.763661,-0.06047) + --(0.754861,-0.129514) + --(0.800213,-0.076716) --cycle\dpicstop +\dpicdraw (0.758787,-0.12068) + --(0.921528,0.245486)\dpicstop +\draw (0.921528,0.245486) node[above=-2bp]{Body}; +\filldraw[line width=0bp](1.053407,0.052807) + --(1.111111,0.013889) + --(1.084359,0.078144) --cycle\dpicstop +\dpicdraw (0.921528,0.245486) + --(1.104988,0.021369)\dpicstop +\filldraw[line width=0bp](1.193738,-0.566144) + --(1.226736,-0.504861) + --(1.165454,-0.537859) --cycle\dpicstop +\dpicdraw (1.219901,-0.511697) + --(1.126736,-0.604861)\dpicstop +\dpiclw=0.8bp +\dpicdraw (2.173611,-0.739236) + --(2.173611,-0.504861)\dpicstop +\dpicdraw (2.173611,-0.504861) + --(2.173611,-0.504861)\dpicstop +\dpicdraw (2.173611,-0.411111) + --(2.126736,-0.411111) + --(2.126736,-0.504861) + --(2.220486,-0.504861) + --(2.220486,-0.411111) + --(2.173611,-0.411111)\dpicstop +\dpicdraw (2.173611,-0.411111) + --(2.173611,-0.411111)\dpicstop +\dpicdraw (2.173611,-0.411111) + --(2.173611,-0.270486)\dpicstop +\dpicdraw (2.173611,-0.270486) + --(2.173611,-0.270486)\dpicstop +\dpicdraw (2.173611,-0.107986) circle (0.063976in)\dpicstop +\dpicdraw (2.173611,0.135764) circle (0.063976in)\dpicstop +\dpicdraw (2.173611,0.298264) + --(2.173611,0.298264)\dpicstop +\dpicdraw (2.173611,-0.183042) + --(2.173611,-0.107986)\dpicstop +\dpicdraw (2.108611,-0.070458) + --(2.173611,-0.107986) + --(2.238611,-0.070458)\dpicstop +\dpicdraw (2.173611,-0.107986) + --(2.417361,-0.107986)\dpicstop +\dpicdraw (2.411806,-0.107986) + --(2.422917,-0.107986)\dpicstop +\dpicdraw (2.417361,-0.107986) + --(2.417361,-0.232986)\dpicstop +\dpicdraw (2.500694,-0.232986) + --(2.334028,-0.232986)\dpicstop +\dpicdraw (2.472917,-0.264236) + --(2.361806,-0.264236)\dpicstop +\dpicdraw (2.453075,-0.295486) + --(2.381647,-0.295486)\dpicstop +\dpicdraw (2.173611,0.210819) + --(2.173611,0.135764)\dpicstop +\dpicdraw (2.238611,0.098236) + --(2.173611,0.135764) + --(2.108611,0.098236)\dpicstop +\dpicdraw (2.173611,0.135764) + --(2.417361,0.135764)\dpicstop +\dpicdraw (2.411806,0.135764) + --(2.422917,0.135764)\dpicstop +\dpicdraw (2.417361,0.135764) + --(2.417361,0.010764)\dpicstop +\dpicdraw (2.500694,0.010764) + --(2.334028,0.010764)\dpicstop +\dpicdraw (2.472917,-0.020486) + --(2.361806,-0.020486)\dpicstop +\dpicdraw (2.453075,-0.051736) + --(2.381647,-0.051736)\dpicstop +\dpicdraw (2.173611,0.298264) + --(2.173611,0.438889)\dpicstop +\dpicdraw (2.173611,0.438889) + --(2.173611,0.438889)\dpicstop +\dpicdraw (2.173611,0.532639) + --(2.126736,0.532639) + --(2.126736,0.438889) + --(2.220486,0.438889) + --(2.220486,0.532639) + --(2.173611,0.532639)\dpicstop +\dpicdraw (2.173611,0.532639) + --(2.173611,0.532639)\dpicstop +\dpicdraw (2.173611,0.532639) + --(2.173611,0.767014)\dpicstop +\draw (2.173611,-0.739236) node[below=-2bp]{.{.}.(,,C,C,YN,YN)}; +\dpicdraw (3.073611,-0.739236) + --(3.073611,-0.504861)\dpicstop +\dpicdraw (3.073611,-0.504861) + --(3.073611,-0.504861)\dpicstop +\dpicdraw (3.073611,-0.411111) + --(3.026736,-0.411111) + --(3.026736,-0.504861) + --(3.120486,-0.504861) + --(3.120486,-0.411111) + --(3.073611,-0.411111)\dpicstop +\dpicdraw (3.073611,-0.411111) + --(3.073611,-0.411111)\dpicstop +\dpicdraw (3.073611,-0.411111) + --(3.073611,-0.270486)\dpicstop +\dpicdraw (3.073611,-0.270486) + --(3.073611,-0.270486)\dpicstop +\dpicdraw (3.073611,-0.107986) circle (0.063976in)\dpicstop +\dpicdraw (3.073611,0.135764) circle (0.063976in)\dpicstop +\dpicdraw (3.073611,0.298264) + --(3.073611,0.298264)\dpicstop +\dpicdraw (3.073611,-0.078778) + --(3.138611,-0.078778) + --(3.073611,-0.191361) + --(3.008611,-0.078778) + --(3.073611,-0.078778)\dpicstop +\dpicdraw (3.073611,0.210819) + --(3.073611,0.135764)\dpicstop +\dpicdraw (3.138611,0.098236) + --(3.073611,0.135764) + --(3.008611,0.098236)\dpicstop +\dpicdraw (3.073611,0.298264) + --(3.073611,0.438889)\dpicstop +\dpicdraw (3.073611,0.438889) + --(3.073611,0.438889)\dpicstop +\fill[fill=black,line width=0bp](3.073611,0.532639) + --(3.026736,0.532639) + --(3.026736,0.438889) + --(3.120486,0.438889) + --(3.120486,0.532639) + --(3.073611,0.532639)--cycle +\dpicstop +\dpicdraw (3.073611,0.532639) + --(3.026736,0.532639) + --(3.026736,0.438889) + --(3.120486,0.438889) + --(3.120486,0.532639) + --(3.073611,0.532639)\dpicstop +\dpicdraw (3.073611,0.532639) + --(3.073611,0.532639)\dpicstop +\dpicdraw (3.073611,0.532639) + --(3.073611,0.767014)\dpicstop +\draw (3.073611,-0.739236) node[below=-2bp]{.{.}.(,type=S,C,O,Delta,Y)}; +\dpicdraw (3.973611,-0.739236) + --(3.973611,-0.648611)\dpicstop +\dpicdraw (3.973611,-0.486111) circle (0.063976in)\dpicstop +\dpicdraw (3.973611,-0.242361) circle (0.063976in)\dpicstop +\dpicdraw (3.973611,-0.079861) + --(3.973611,0.010764)\dpicstop +\dpicdraw (3.973611,-0.561167) + --(3.973611,-0.486111)\dpicstop +\dpicdraw (3.908611,-0.448583) + --(3.973611,-0.486111) + --(4.038611,-0.448583)\dpicstop +\dpicdraw (3.973611,-0.271569) + --(3.908611,-0.271569) + --(3.973611,-0.158986) + --(4.038611,-0.271569) + --(3.973611,-0.271569)\dpicstop +\draw (3.973611,-0.739236) node[below=-2bp]{.{.}.(,type=S,{,},Y,Delta)}; +\dpicdraw (4.873611,-0.739236) + --(4.873611,-0.504861)\dpicstop +\dpicdraw (4.873611,-0.504861) + --(4.873611,-0.504861)\dpicstop +\dpicdraw (4.873611,-0.411111) + --(4.826736,-0.411111) + --(4.826736,-0.504861) + --(4.920486,-0.504861) + --(4.920486,-0.411111) + --(4.873611,-0.411111)\dpicstop +\dpicdraw (4.873611,-0.411111) + --(4.873611,-0.411111)\dpicstop +\dpicdraw (4.873611,-0.411111) + --(4.873611,-0.270486)\dpicstop +\dpicdraw (4.873611,-0.270486) + --(4.873611,-0.270486)\dpicstop +\dpicdraw[line width=0.4bp](4.873611,-0.270486) circle (0.00109in)\dpicstop +\dpicdraw (4.873611,0.054514) circle (0.063976in)\dpicstop +\dpicdraw (4.873611,-0.270486) + ..controls (4.771315,-0.193764) and (4.711111,-0.073356) + ..(4.711111,0.054514)\dpicstop +\dpicdraw (4.873611,0.217014) + --(4.873611,0.217014)\dpicstop +\dpicdraw (4.873611,0.217014) + --(4.873611,0.357639)\dpicstop +\dpicdraw (4.873611,0.357639) + --(4.873611,0.357639)\dpicstop +\dpicdraw (4.873611,0.451389) + --(4.826736,0.451389) + --(4.826736,0.357639) + --(4.920486,0.357639) + --(4.920486,0.451389) + --(4.873611,0.451389)\dpicstop +\dpicdraw (4.873611,0.451389) + --(4.873611,0.451389)\dpicstop +\dpicdraw (4.873611,0.451389) + --(4.873611,0.685764)\dpicstop +\draw (4.873611,-0.739236) node[below=-2bp]{.{.}.(,type=A,C,C)}; +}% +\end{tikzpicture}% +} +\global\newcommand{\SLDTwoTerms}{% +\begin{tikzpicture}[scale=2.54]% +% dpic version 2021.11.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 +{\sf +\dpicdraw (0,0.671523) + --(0.234375,0.671523)\dpicstop +\dpicdraw (0.234375,0.671523) + --(0.234375,0.671523)\dpicstop +\fill[fill=green,line width=0bp](0.328125,0.671523) + --(0.328125,0.718398) + --(0.234375,0.718398) + --(0.234375,0.624648) + --(0.328125,0.624648) + --(0.328125,0.671523)--cycle +\dpicstop +\dpicdraw (0.328125,0.671523) + --(0.328125,0.718398) + --(0.234375,0.718398) + --(0.234375,0.624648) + --(0.328125,0.624648) + --(0.328125,0.671523)\dpicstop +\dpicdraw (0.328125,0.671523) + --(0.328125,0.671523)\dpicstop +\dpicdraw (0.328125,0.671523) + --(0.46875,0.671523)\dpicstop +\dpicdraw (0.46875,0.671523) + --(0.46875,0.671523)\dpicstop +\dpicdraw (0.84375,0.671523) + --(0.84375,0.859023) + --(0.46875,0.859023) + --(0.46875,0.484023) + --(0.84375,0.484023) + --(0.84375,0.671523)\dpicstop +\dpicdraw (0.84375,0.671523) + --(0.84375,0.671523)\dpicstop +\dpicdraw (0.84375,0.671523) + --(0.984375,0.671523)\dpicstop +\dpicdraw (0.984375,0.671523) + --(0.984375,0.671523)\dpicstop +\fill[fill=red,line width=0bp](1.078125,0.671523) + --(1.078125,0.718398) + --(0.984375,0.718398) + --(0.984375,0.624648) + --(1.078125,0.624648) + --(1.078125,0.671523)--cycle +\dpicstop +\dpicdraw (1.078125,0.671523) + --(1.078125,0.718398) + --(0.984375,0.718398) + --(0.984375,0.624648) + --(1.078125,0.624648) + --(1.078125,0.671523)\dpicstop +\dpicdraw (1.078125,0.671523) + --(1.078125,0.671523)\dpicstop +\dpicdraw (1.078125,0.671523) + --(1.3125,0.671523)\dpicstop +\draw (1.451389,0.671523) node[right=-2bp]{sl\_ttbox(,,box=shaded "green",box=shaded "red")}; +\dpicdraw (0,0.171523) + --(0.1875,0.171523)\dpicstop +\dpicdraw (0.5625,0.171523) + --(0.5625,0.359023) + --(0.1875,0.359023) + --(0.1875,-0.015977) + --(0.5625,-0.015977) + --(0.5625,0.171523)\dpicstop +\dpicdraw (0.5625,0.171523) + --(0.75,0.171523)\dpicstop +\dpicdraw (0.5625,0.359023) + --(0.1875,-0.015977)\dpicstop +\dpicdraw (0.229167,0.265273) + ..controls (0.23052,0.268098) and (0.232917,0.273065) + ..(0.234514,0.276354) + ..controls (0.236111,0.279643) and (0.238748,0.284911) + ..(0.240397,0.288106) + ..controls (0.242046,0.291302) and (0.244953,0.296489) + ..(0.246883,0.299679) + ..controls (0.248813,0.302868) and (0.251926,0.307403) + ..(0.253828,0.309795) + ..controls (0.25573,0.312188) and (0.2588,0.31533) + ..(0.260677,0.316804) + ..controls (0.262554,0.318279) and (0.265593,0.31988) + ..(0.267456,0.320378) + ..controls (0.26932,0.320875) and (0.272347,0.320875) + ..(0.27421,0.320378) + ..controls (0.276074,0.31988) and (0.279112,0.318279) + ..(0.28099,0.316804) + ..controls (0.282867,0.31533) and (0.285937,0.312188) + ..(0.287839,0.309795) + ..controls (0.289741,0.307403) and (0.292853,0.302868) + ..(0.294783,0.299679) + ..controls (0.296713,0.296489) and (0.299869,0.290821) + ..(0.301823,0.287034) + ..controls (0.303777,0.283246) and (0.306964,0.276831) + ..(0.308932,0.272721) + ..controls (0.310901,0.268611) and (0.314099,0.261934) + ..(0.316068,0.257824) + ..controls (0.318036,0.253714) and (0.321223,0.247299) + ..(0.323177,0.243511) + ..controls (0.325131,0.239724) and (0.328287,0.234056) + ..(0.330217,0.230867) + ..controls (0.332147,0.227677) and (0.335259,0.223142) + ..(0.337161,0.22075) + ..controls (0.339063,0.218357) and (0.342133,0.215216) + ..(0.34401,0.213741) + ..controls (0.345888,0.212266) and (0.348926,0.210665) + ..(0.35079,0.210168) + ..controls (0.352653,0.20967) and (0.35568,0.20967) + ..(0.357544,0.210168) + ..controls (0.359407,0.210665) and (0.362446,0.212266) + ..(0.364323,0.213741) + ..controls (0.3662,0.215216) and (0.36927,0.218357) + ..(0.371172,0.22075) + ..controls (0.373074,0.223142) and (0.376187,0.227677) + ..(0.378117,0.230867) + ..controls (0.380047,0.234056) and (0.382954,0.239243) + ..(0.384603,0.242439) + ..controls (0.386252,0.245634) and (0.388889,0.250902) + ..(0.390486,0.254191) + ..controls (0.392083,0.25748) and (0.39448,0.262447) + ..(0.395833,0.265273)\dpicstop +\dpicdraw (0.354167,0.061106) + --(0.520833,0.061106)\dpicstop +\dpicdraw (0.354167,0.094439) + --(0.395833,0.094439)\dpicstop +\dpicdraw (0.416667,0.094439) + --(0.458333,0.094439)\dpicstop +\dpicdraw (0.479167,0.094439) + --(0.520833,0.094439)\dpicstop +\dpicdraw (0.888889,0.171523) + --(1.076389,0.171523)\dpicstop +\dpicdraw (1.451389,0.171523) + --(1.451389,0.359023) + --(1.076389,0.359023) + --(1.076389,-0.015977) + --(1.451389,-0.015977) + --(1.451389,0.171523)\dpicstop +\dpicdraw (1.451389,0.171523) + --(1.638889,0.171523)\dpicstop +\dpicdraw (1.451389,0.359023) + --(1.076389,-0.015977)\dpicstop +\dpicdraw (1.118056,0.248606) + --(1.284722,0.248606)\dpicstop +\dpicdraw (1.118056,0.281939) + --(1.159722,0.281939)\dpicstop +\dpicdraw (1.180556,0.281939) + --(1.222222,0.281939)\dpicstop +\dpicdraw (1.243056,0.281939) + --(1.284722,0.281939)\dpicstop +\dpicdraw (1.243056,0.077773) + ..controls (1.244409,0.080598) and (1.246806,0.085565) + ..(1.248403,0.088854) + ..controls (1.25,0.092143) and (1.252637,0.097411) + ..(1.254286,0.100606) + ..controls (1.255935,0.103802) and (1.258842,0.108989) + ..(1.260772,0.112179) + ..controls (1.262702,0.115368) and (1.265815,0.119903) + ..(1.267717,0.122295) + ..controls (1.269619,0.124688) and (1.272688,0.12783) + ..(1.274566,0.129304) + ..controls (1.276443,0.130779) and (1.279482,0.13238) + ..(1.281345,0.132878) + ..controls (1.283209,0.133375) and (1.286236,0.133375) + ..(1.288099,0.132878) + ..controls (1.289962,0.13238) and (1.293001,0.130779) + ..(1.294879,0.129304) + ..controls (1.296756,0.12783) and (1.299826,0.124688) + ..(1.301728,0.122295) + ..controls (1.30363,0.119903) and (1.306742,0.115368) + ..(1.308672,0.112179) + ..controls (1.310602,0.108989) and (1.313757,0.103321) + ..(1.315712,0.099534) + ..controls (1.317666,0.095746) and (1.320853,0.089331) + ..(1.322821,0.085221) + ..controls (1.32479,0.081111) and (1.327988,0.074434) + ..(1.329956,0.070324) + ..controls (1.331925,0.066214) and (1.335111,0.059799) + ..(1.337066,0.056011) + ..controls (1.33902,0.052224) and (1.342176,0.046556) + ..(1.344106,0.043367) + ..controls (1.346036,0.040177) and (1.349148,0.035642) + ..(1.35105,0.03325) + ..controls (1.352952,0.030857) and (1.356022,0.027716) + ..(1.357899,0.026241) + ..controls (1.359777,0.024766) and (1.362815,0.023165) + ..(1.364679,0.022668) + ..controls (1.366542,0.02217) and (1.369569,0.02217) + ..(1.371432,0.022668) + ..controls (1.373296,0.023165) and (1.376334,0.024766) + ..(1.378212,0.026241) + ..controls (1.380089,0.027716) and (1.383159,0.030857) + ..(1.385061,0.03325) + ..controls (1.386963,0.035642) and (1.390075,0.040177) + ..(1.392005,0.043367) + ..controls (1.393935,0.046556) and (1.396843,0.051743) + ..(1.398492,0.054939) + ..controls (1.400141,0.058134) and (1.402778,0.063402) + ..(1.404375,0.066691) + ..controls (1.405972,0.06998) and (1.408369,0.074947) + ..(1.409722,0.077773)\dpicstop +\draw (1.777778,0.171523) node[right=-2bp]{sl\_rectifier, sl\_inverter}; +\dpicdraw (0,-0.245144) + --(0.328125,-0.245144)\dpicstop +\dpicdraw (0.421875,-0.245144) + --(0.421875,-0.198269) + --(0.328125,-0.198269) + --(0.328125,-0.292019) + --(0.421875,-0.292019) + --(0.421875,-0.245144)\dpicstop +\dpicdraw (0.421875,-0.245144) + --(0.75,-0.245144)\dpicstop +\dpicdraw (0.888889,-0.245144) + --(1.180556,-0.245144)\dpicstop +\dpicdraw (1.164931,-0.213894) + ..controls (1.21441,-0.147922) and (1.313368,-0.147922) + ..(1.362847,-0.213894)\dpicstop +\dpicdraw (1.347222,-0.245144) + --(1.638889,-0.245144)\dpicstop +\dpicdraw (2.105903,-0.245144) + --(2.230903,-0.245144)\dpicstop +\dpicdraw (2.324653,-0.245144) + --(2.324653,-0.198269) + --(2.230903,-0.198269) + --(2.230903,-0.292019) + --(2.324653,-0.292019) + --(2.324653,-0.245144)\dpicstop +\dpicdraw (2.324653,-0.245144) + --(2.449653,-0.245144)\dpicstop +\dpicdraw (2.105903,-0.245144) + --(2.043403,-0.245144)\dpicstop +\dpicdraw (2.105903,-0.307644) + --(2.043403,-0.245144) + --(2.105903,-0.182644)\dpicstop +\dpicdraw (2.043403,-0.307644) + --(1.980903,-0.245144) + --(2.043403,-0.182644)\dpicstop +\dpicdraw (1.980903,-0.245144) + --(1.777778,-0.245144)\dpicstop +\dpicdraw (2.449653,-0.245144) + --(2.512153,-0.245144)\dpicstop +\dpicdraw (2.449653,-0.182644) + --(2.512153,-0.245144) + --(2.449653,-0.307644)\dpicstop +\dpicdraw (2.512153,-0.182644) + --(2.574653,-0.245144) + --(2.512153,-0.307644)\dpicstop +\dpicdraw (2.574653,-0.245144) + --(2.777778,-0.245144)\dpicstop +\draw (2.277778,-0.198269) node[above=-2bp]{D}; +\draw (2.916667,-0.245144) node{\shortstack{\rlap{\hbox to 2bp{}sl\_breaker, sl\_breaker(,type=C)}\\% +\rlap{\hbox to 2bp{}sl\_breaker(,type=D;name=B3) ; llabel(,"D",{,},B3)}}}; +\dpicdraw (0,-0.745144) + --(0.234375,-0.745144)\dpicstop +\dpicdraw (0.234375,-0.745144) + --(0.234375,-0.745144)\dpicstop +\dpicdraw (0.328125,-0.745144) + --(0.328125,-0.698269) + --(0.234375,-0.698269) + --(0.234375,-0.792019) + --(0.328125,-0.792019) + --(0.328125,-0.745144)\dpicstop +\dpicdraw (0.328125,-0.745144) + --(0.328125,-0.745144)\dpicstop +\dpicdraw (0.328125,-0.745144) + --(0.46875,-0.745144)\dpicstop +\dpicdraw (0.46875,-0.745144) + --(0.579861,-0.745144) + --(0.579861,-0.856255)\dpicstop +\dpicdraw[line width=0.4bp](0.579861,-0.856255) circle (0.00109in)\dpicstop +\dpicdraw (0.579861,-0.856255) + ..controls (0.480872,-0.856255) and (0.431298,-0.736573) + ..(0.501294,-0.666577) + ..controls (0.57129,-0.596581) and (0.690972,-0.646155) + ..(0.690972,-0.745144)\dpicstop +\dpicdraw[line width=0.4bp](0.690972,-0.745144) circle (0.00109in)\dpicstop +\dpicdraw (0.690972,-0.745144) + --(0.690972,-0.745144)\dpicstop +\dpicdraw (0.690972,-0.745144) + --(0.831597,-0.745144)\dpicstop +\dpicdraw (0.831597,-0.745144) + --(0.831597,-0.745144)\dpicstop +\dpicdraw (0.925347,-0.745144) + --(0.925347,-0.698269) + --(0.831597,-0.698269) + --(0.831597,-0.792019) + --(0.925347,-0.792019) + --(0.925347,-0.745144)\dpicstop +\dpicdraw (0.925347,-0.745144) + --(0.925347,-0.745144)\dpicstop +\dpicdraw (0.925347,-0.745144) + --(1.159722,-0.745144)\dpicstop +\draw (1.298611,-0.745144) node[right=-2bp]{sl\_reactor(,,C,C)}; +\dpicdraw (3,-0.745144) + --(3.375,-0.745144)\dpicstop +\dpicdraw (3.3125,-0.682644) + --(3.375,-0.745144) + --(3.3125,-0.807644)\dpicstop +\dpicdraw (3.375,-0.682644) + --(3.4375,-0.745144) + --(3.375,-0.807644)\dpicstop +\dpicdraw (3.4375,-0.745144) + --(3.75,-0.745144)\dpicstop +\draw (3.888889,-0.745144) node[right=-2bp]{sl\_drawout}; +}% +\end{tikzpicture}% +} +\global\newcommand{\SLDOneTerms}{% +\begin{tikzpicture}[scale=2.54]% +% dpic version 2021.11.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 +{\sf +\dpicdraw (0.2,0.288889) circle (0.07874in)\dpicstop +\dpicdraw (0.2,0.088889) + --(0.2,-0.511111)\dpicstop +\draw (0.2,-0.511111) node[below=-2bp]{sl\_disk}; +\dpicdraw (0.8,-0.511111) + --(0.8,-0.192361)\dpicstop +\dpicdraw (0.8,-0.192361) + --(0.8,-0.192361)\dpicstop +\dpicdraw (0.8,-0.079861) + --(0.74375,-0.079861) + --(0.74375,-0.192361) + --(0.85625,-0.192361) + --(0.85625,-0.079861) + --(0.8,-0.079861)\dpicstop +\dpicdraw (0.8,-0.079861) + --(0.8,-0.079861)\dpicstop +\dpicdraw (0.8,0.088889) + --(0.8,-0.079861)\dpicstop +\dpicdraw (0.8,0.488889) + --(0.6,0.488889) + --(0.6,0.088889) + --(1,0.088889) + --(1,0.488889) + --(0.8,0.488889)\dpicstop +\draw (0.8,-0.511111) node[below=-2bp]{sl\_box(,,C)}; +\dpiclw=0.4bp +\filldraw[line width=0bp](0.917533,-0.169109) + --(0.85625,-0.136111) + --(0.889248,-0.197394) --cycle\dpicstop +\dpicdraw (0.863086,-0.142947) + --(1.00625,-0.286111)\dpicstop +\draw (1.00625,-0.286111) node[right=-2bp]{\sl Br}; +\filldraw[line width=0bp](0.402704,0.114469) + --(0.341421,0.147468) + --(0.37442,0.086185) --cycle\dpicstop +\dpicdraw (0.348257,0.140632) + --(0.491421,-0.002532)\dpicstop +\draw (0.491421,-0.002532) node[below=-2bp]{\sl Head}; +\filldraw[line width=0bp](0.565263,0.039695) + --(0.6,0.100009) + --(0.537799,0.068776) --cycle\dpicstop +\dpicdraw (0.491421,-0.002532) + --(0.592972,0.093372)\dpicstop +\dpiclw=0.8bp +\dpicdraw (1.4,0.088889) + --(1.4,-0.511111)\dpicstop +\dpicdraw (1.4,0.488889) + --(1.2,0.488889) + --(1.2,0.088889) + --(1.6,0.088889) + --(1.6,0.488889) + --(1.4,0.488889)\dpicstop +\dpicdraw (1.4,0.088889) + --(1.2,0.288889)\dpicstop +\dpicdraw (1.2,0.288889) + --(1.4,0.488889)\dpicstop +\dpicdraw (1.4,0.088889) + --(1.6,0.288889)\dpicstop +\dpicdraw (1.6,0.288889) + --(1.4,0.488889)\dpicstop +\dpicdraw (1.2,0.088889) + --(1.6,0.488889)\dpicstop +\dpicdraw (1.6,0.088889) + --(1.2,0.488889)\dpicstop +\draw (1.4,-0.511111) node[below=-2bp]{sl\_grid}; +\dpicdraw (2,-0.511111) + --(2,-0.192361)\dpicstop +\dpicdraw (2,-0.192361) + --(2,-0.192361)\dpicstop +\fill[fill=black,line width=0bp](2,-0.079861) + --(1.94375,-0.079861) + --(1.94375,-0.192361) + --(2.05625,-0.192361) + --(2.05625,-0.079861) + --(2,-0.079861)--cycle +\dpicstop +\dpicdraw (2,-0.079861) + --(1.94375,-0.079861) + --(1.94375,-0.192361) + --(2.05625,-0.192361) + --(2.05625,-0.079861) + --(2,-0.079861)\dpicstop +\dpicdraw (2,-0.079861) + --(2,-0.079861)\dpicstop +\dpicdraw (2,0.088889) + --(2,-0.079861)\dpicstop +\dpicdraw (2,0.088889) + --(1.904,0.088889) + --(2,0.358889) + --(2.096,0.088889) + --(2,0.088889)\dpicstop +\draw (2,-0.511111) node[below=-2bp]{sl\_load(,,O)}; +\dpicdraw (2.6,0.088889) + --(2.6,-0.511111)\dpicstop +\dpicdraw (2.6,0.538889) + --(2.375,0.538889) + --(2.375,0.088889) + --(2.825,0.088889) + --(2.825,0.538889) + --(2.6,0.538889)\dpicstop +\dpicdraw (2.375,0.448889) + --(2.825,0.448889)\dpicstop +\draw (2.6,-0.511111) node[below=-2bp]{sl\_meterbox}; +\dpicdraw (3.2,0.288889) circle (0.07874in)\dpicstop +\dpicdraw (3.2,0.088889) + --(3.2,-0.511111)\dpicstop +\filldraw[line width=0bp](3.30019,0.401009) + --(3.289805,0.389387) + ..controls (3.304441,0.383072) and (3.317977,0.374465) + ..(3.329904,0.363889) + ..controls (3.326373,0.381145) and (3.31983,0.397644) + ..(3.310575,0.41263) + --(3.30019,0.401009)\dpicstop +\filldraw[line width=0bp](3.09981,0.401009) + --(3.110195,0.389387) + ..controls (3.095559,0.383072) and (3.082023,0.374465) + ..(3.070096,0.363889) + ..controls (3.073627,0.381145) and (3.08017,0.397644) + ..(3.089425,0.41263) + --(3.09981,0.401009)\dpicstop +\dpicdraw (3.30918,0.391746) + ..controls (3.249964,0.454603) and (3.150036,0.454603) + ..(3.09082,0.391746)\dpicstop +\dpicdraw (3.2,0.438889) + --(3.2,0.213889)\dpicstop +\draw (3.2,-0.511111) node[below=-2bp]{sl\_syncmeter}; +\dpicdraw (3.8,0.288889) circle (0.07874in)\dpicstop +\dpicdraw (3.8,0.088889) + --(3.8,-0.511111)\dpicstop +\dpicdraw (3.941421,0.43031) + --(3.658579,0.147468)\dpicstop +\dpicdraw (3.658579,0.43031) + --(3.941421,0.147468)\dpicstop +\draw (3.8,-0.511111) node[below=-2bp]{sl\_lamp}; +}% +\end{tikzpicture}% +} +\global\newcommand{\SLDGenerators}{% +\begin{tikzpicture}[scale=2.54]% +% dpic version 2021.11.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 +{\sf +\dpicdraw (0.2,0.313889) circle (0.07874in)\dpicstop +\dpicdraw (0.2,0.113889) + --(0.2,-0.486111)\dpicstop +\dpicdraw (0.1,0.313889) + ..controls (0.101633,0.317298) and (0.104524,0.323288) + ..(0.10645,0.327254) + ..controls (0.108376,0.331221) and (0.111555,0.337567) + ..(0.113542,0.341414) + ..controls (0.115528,0.34526) and (0.119026,0.351491) + ..(0.121345,0.355316) + ..controls (0.123665,0.359141) and (0.1274,0.364567) + ..(0.129679,0.367423) + ..controls (0.131958,0.370279) and (0.135631,0.374023) + ..(0.137875,0.375776) + ..controls (0.140119,0.377529) and (0.143747,0.379432) + ..(0.145971,0.380021) + ..controls (0.148194,0.380611) and (0.151806,0.380611) + ..(0.154029,0.380021) + ..controls (0.156253,0.379432) and (0.159881,0.377529) + ..(0.162125,0.375776) + ..controls (0.164369,0.374023) and (0.168042,0.370279) + ..(0.170321,0.367423) + ..controls (0.1726,0.364567) and (0.176335,0.359141) + ..(0.178655,0.355316) + ..controls (0.180974,0.351491) and (0.184771,0.344682) + ..(0.187125,0.340123) + ..controls (0.18948,0.335564) and (0.193321,0.327833) + ..(0.195696,0.322875) + ..controls (0.198071,0.317916) and (0.201929,0.309861) + ..(0.204304,0.304903) + ..controls (0.206679,0.299945) and (0.21052,0.292214) + ..(0.212875,0.287655) + ..controls (0.215229,0.283096) and (0.219026,0.276286) + ..(0.221345,0.272462) + ..controls (0.223665,0.268637) and (0.2274,0.263211) + ..(0.229679,0.260355) + ..controls (0.231958,0.257499) and (0.235631,0.253755) + ..(0.237875,0.252002) + ..controls (0.240119,0.250249) and (0.243747,0.248346) + ..(0.245971,0.247757) + ..controls (0.248194,0.247167) and (0.251806,0.247167) + ..(0.254029,0.247757) + ..controls (0.256253,0.248346) and (0.259881,0.250249) + ..(0.262125,0.252002) + ..controls (0.264369,0.253755) and (0.268042,0.257499) + ..(0.270321,0.260355) + ..controls (0.2726,0.263211) and (0.276335,0.268637) + ..(0.278655,0.272462) + ..controls (0.280974,0.276286) and (0.284472,0.282518) + ..(0.286458,0.286364) + ..controls (0.288445,0.290211) and (0.291624,0.296557) + ..(0.29355,0.300523) + ..controls (0.295476,0.304489) and (0.298367,0.31048) + ..(0.3,0.313889)\dpicstop +\draw (0.2,-0.486111) node[below=-2bp]{sl\_generator}; +\dpicdraw (0.92,0.313889) circle (0.07874in)\dpicstop +\dpicdraw (0.92,0.113889) + --(0.92,-0.486111)\dpicstop +\dpicdraw[fill=black,draw=black](0.92,0.313889) circle (0.003937in)\dpicstop +\fill[fill=black,line width=0bp](0.958641,0.326961) + ..controls (0.948548,0.320361) and (0.938016,0.315861) + ..(0.935235,0.316961) + ..controls (0.932455,0.318062) and (0.929846,0.322431) + ..(0.929439,0.326671) + ..controls (0.929031,0.330911) and (0.933085,0.337672) + ..(0.938448,0.341695) + ..controls (0.94381,0.345719) and (0.949873,0.349869) + ..(0.951922,0.350918) + ..controls (0.95397,0.351967) and (0.956702,0.353539) + ..(0.957992,0.354412) + ..controls (0.959283,0.355285) and (0.984674,0.36683) + ..(1.014418,0.380068) + ..controls (1.044162,0.393307) and (1.070453,0.404315) + ..(1.072843,0.404531) + ..controls (1.075233,0.404747) and (1.076797,0.403238) + ..(1.076318,0.401177) + ..controls (1.075839,0.399117) and (1.022884,0.365719) + ..(0.958641,0.326961) --cycle\dpicstop +\dpicdraw[line width=0.2bp,draw=black](0.958641,0.326961) + ..controls (0.948548,0.320361) and (0.938016,0.315861) + ..(0.935235,0.316961) + ..controls (0.932455,0.318062) and (0.929846,0.322431) + ..(0.929439,0.326671) + ..controls (0.929031,0.330911) and (0.933085,0.337672) + ..(0.938448,0.341695) + ..controls (0.94381,0.345719) and (0.949873,0.349869) + ..(0.951922,0.350918) + ..controls (0.95397,0.351967) and (0.956702,0.353539) + ..(0.957992,0.354412) + ..controls (0.959283,0.355285) and (0.984674,0.36683) + ..(1.014418,0.380068) + ..controls (1.044162,0.393307) and (1.070453,0.404315) + ..(1.072843,0.404531) + ..controls (1.075233,0.404747) and (1.076797,0.403238) + ..(1.076318,0.401177) + ..controls (1.075839,0.399117) and (1.022884,0.365719) + ..(0.958641,0.326961)\dpicstop +\fill[fill=black,line width=0bp](0.889359,0.340817) + ..controls (0.900121,0.335377) and (0.909284,0.328505) + ..(0.909722,0.325547) + ..controls (0.910159,0.322589) and (0.907679,0.318145) + ..(0.904211,0.315672) + ..controls (0.900743,0.313199) and (0.892861,0.31333) + ..(0.886695,0.315962) + ..controls (0.88053,0.318594) and (0.873904,0.32177) + ..(0.871971,0.323019) + ..controls (0.870038,0.324268) and (0.867311,0.325848) + ..(0.86591,0.326529) + ..controls (0.864509,0.327211) and (0.841814,0.343428) + ..(0.815478,0.362568) + ..controls (0.789141,0.381707) and (0.766462,0.398972) + ..(0.76508,0.400934) + ..controls (0.763698,0.402896) and (0.764223,0.405004) + ..(0.766247,0.40562) + ..controls (0.768271,0.406235) and (0.823671,0.377074) + ..(0.889359,0.340817) --cycle\dpicstop +\dpicdraw[line width=0.2bp,draw=black](0.889359,0.340817) + ..controls (0.900121,0.335377) and (0.909284,0.328505) + ..(0.909722,0.325547) + ..controls (0.910159,0.322589) and (0.907679,0.318145) + ..(0.904211,0.315672) + ..controls (0.900743,0.313199) and (0.892861,0.31333) + ..(0.886695,0.315962) + ..controls (0.88053,0.318594) and (0.873904,0.32177) + ..(0.871971,0.323019) + ..controls (0.870038,0.324268) and (0.867311,0.325848) + ..(0.86591,0.326529) + ..controls (0.864509,0.327211) and (0.841814,0.343428) + ..(0.815478,0.362568) + ..controls (0.789141,0.381707) and (0.766462,0.398972) + ..(0.76508,0.400934) + ..controls (0.763698,0.402896) and (0.764223,0.405004) + ..(0.766247,0.40562) + ..controls (0.768271,0.406235) and (0.823671,0.377074) + ..(0.889359,0.340817)\dpicstop +\fill[fill=black,line width=0bp](0.912,0.273889) + ..controls (0.911331,0.28593) and (0.9127,0.297301) + ..(0.915043,0.299159) + ..controls (0.917386,0.301017) and (0.922474,0.301091) + ..(0.92635,0.299324) + ..controls (0.930226,0.297557) and (0.934054,0.290665) + ..(0.934857,0.28401) + ..controls (0.93566,0.277354) and (0.936223,0.270028) + ..(0.936107,0.267729) + ..controls (0.935992,0.265431) and (0.935988,0.262279) + ..(0.936098,0.260725) + ..controls (0.936209,0.259171) and (0.933511,0.231409) + ..(0.930104,0.199031) + ..controls (0.926697,0.166653) and (0.923085,0.13838) + ..(0.922077,0.136202) + ..controls (0.921069,0.134024) and (0.91898,0.133424) + ..(0.917435,0.134869) + ..controls (0.91589,0.136314) and (0.913444,0.198873) + ..(0.912,0.273889) --cycle\dpicstop +\dpicdraw[line width=0.2bp,draw=black](0.912,0.273889) + ..controls (0.911331,0.28593) and (0.9127,0.297301) + ..(0.915043,0.299159) + ..controls (0.917386,0.301017) and (0.922474,0.301091) + ..(0.92635,0.299324) + ..controls (0.930226,0.297557) and (0.934054,0.290665) + ..(0.934857,0.28401) + ..controls (0.93566,0.277354) and (0.936223,0.270028) + ..(0.936107,0.267729) + ..controls (0.935992,0.265431) and (0.935988,0.262279) + ..(0.936098,0.260725) + ..controls (0.936209,0.259171) and (0.933511,0.231409) + ..(0.930104,0.199031) + ..controls (0.926697,0.166653) and (0.923085,0.13838) + ..(0.922077,0.136202) + ..controls (0.921069,0.134024) and (0.91898,0.133424) + ..(0.917435,0.134869) + ..controls (0.91589,0.136314) and (0.913444,0.198873) + ..(0.912,0.273889)\dpicstop +\draw (0.92,-0.486111) node[below=-2bp]{.{.}.(,type=WT)}; +\dpicdraw (1.64,0.313889) circle (0.07874in)\dpicstop +\dpicdraw (1.64,0.113889) + --(1.64,-0.486111)\dpicstop +\dpicdraw (1.64,0.163889) + --(1.64,0.288889)\dpicstop +\dpicdraw (1.565,0.288889) + --(1.715,0.288889)\dpicstop +\dpicdraw (1.49,0.338889) + --(1.79,0.338889)\dpicstop +\dpicdraw (1.64,0.338889) + --(1.64,0.463889)\dpicstop +\dpicdraw (1.74,0.360556) + --(1.74,0.427222)\dpicstop +\dpicdraw (1.706667,0.393889) + --(1.773333,0.393889)\dpicstop +\dpicdraw (1.706667,0.247222) + --(1.773333,0.247222)\dpicstop +\draw (1.64,-0.486111) node[below=-2bp]{.{.}.(,type=BS)}; +\dpicdraw (2.36,0.113889) + --(2.36,-0.486111)\dpicstop +\dpicdraw (2.36,0.513889) + --(2.24,0.513889) + --(2.24,0.113889) + --(2.48,0.113889) + --(2.48,0.513889) + --(2.36,0.513889)\dpicstop +\dpicdraw (2.27,0.113889) + --(2.36,0.213889) + --(2.45,0.113889)\dpicstop +\draw (2.36,-0.486111) node[below=-2bp]{.{.}.(,type=PV)}; +\dpicdraw (3.08,0.313889) circle (0.07874in)\dpicstop +\dpicdraw (3.08,0.113889) + --(3.08,-0.486111)\dpicstop +\dpicdraw (3.013333,0.313889) + --(3.022265,0.313889)\dpicstop +\dpicdraw (3.022265,0.380556) + --(3.022265,0.447222) + --(3.1322,0.380556) + --(3.022265,0.313889) + --(3.022265,0.380556)\dpicstop +\dpicdraw (3.137735,0.176504) + --(3.137735,0.451274)\dpicstop +\dpicdraw (3.022265,0.176504) + --(3.022265,0.451274)\dpicstop +\dpicdraw (3.137735,0.247222) + --(3.137735,0.313889) + --(3.0278,0.247222) + --(3.137735,0.180556) + --(3.137735,0.247222)\dpicstop +\dpicdraw (3.137735,0.313889) + --(3.146667,0.313889)\dpicstop +\draw (3.08,-0.486111) node[below=-2bp]{.{.}.(,type=StatG)}; +\dpicdraw (3.8,0.313889) circle (0.07874in)\dpicstop +\draw (3.8,0.313889) node{SG}; +\dpicdraw (3.8,0.113889) + --(3.8,-0.486111)\dpicstop +\draw (3.8,-0.486111) node[below=-2bp]{sl\_disk(,text="SG")}; +}% +\end{tikzpicture}% +} +\global\newcommand{\SLDComposite}{% +\begin{tikzpicture}[scale=2.54]% +% dpic version 2021.11.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 +{\sf +\dpicdraw (0.02,0.516) + --(0.610551,0.516)\dpicstop +\dpicdraw (0.225276,0.5655) + --(0.225276,0.5655)\dpicstop +\dpicdraw (0.225276,0.5655) + --(0.225276,0.559944)\dpicstop +\dpicdraw (0.225276,0.5655) + ..controls (0.225276,0.590353) and (0.245423,0.6105) + ..(0.270276,0.6105) + ..controls (0.295128,0.6105) and (0.315276,0.590353) + ..(0.315276,0.5655)\dpicstop +\dpicdraw (0.315276,0.5655) + --(0.315276,0.559944)\dpicstop +\dpicdraw (0.315276,0.5655) + ..controls (0.315276,0.590353) and (0.335423,0.6105) + ..(0.360276,0.6105) + ..controls (0.385128,0.6105) and (0.405276,0.590353) + ..(0.405276,0.5655)\dpicstop +\dpicdraw (0.405276,0.5655) + --(0.405276,0.559944)\dpicstop +\dpicdraw (0.405276,0.5655) + --(0.405276,0.5655)\dpicstop +\dpicdraw (0.225276,0.5655) + --(0.225276,0.4215)\dpicstop +\dpicdraw (0.405276,0.5655) + --(0.405276,0.4215)\dpicstop +\dpicdraw (0.315276,0.5655) + --(0.315276,0.4215)\dpicstop +\draw (0.315276,0.004833) node(CTLt){sl\_ct(type=L)}; +\dpiclw=0.4bp +\filldraw[line width=0bp](0.203429,0.355415) + --(0.225276,0.4215) + --(0.17066,0.378354) --cycle\dpicstop +\dpicdraw (0.219732,0.413581) + --(0.128053,0.282611)\dpicstop +\draw (0.128053,0.282611) node[below left=-2bp]{\sl Tstart}; +\filldraw[line width=0bp](0.459891,0.378354) + --(0.405276,0.4215) + --(0.427122,0.355415) --cycle\dpicstop +\dpicdraw (0.410819,0.413581) + --(0.502498,0.282611)\dpicstop +\draw (0.502498,0.282611) node[below right=-2bp]{\sl Tend}; +\filldraw[line width=0bp](0.347962,0.36005) + --(0.315276,0.4215) + --(0.308738,0.352206) --cycle\dpicstop +\dpicdraw (0.317171,0.412021) + --(0.343053,0.282611)\dpicstop +\draw (0.343053,0.282611) node[below=-2bp]{\sl Tc}; +\dpiclw=0.8bp +\dpicdraw (1.810551,0.516) + --(1.954551,0.516)\dpicstop +\dpicdraw[line width=0.4bp](1.954551,0.516) circle (0.00109in)\dpicstop +\dpicdraw (1.954551,0.516) + ..controls (1.954551,0.622039) and (2.040513,0.708) + ..(2.146551,0.708) + ..controls (2.25259,0.708) and (2.338551,0.622039) + ..(2.338551,0.516)\dpicstop +\dpicdraw[line width=0.4bp](2.338551,0.516) circle (0.00109in)\dpicstop +\dpicdraw (2.338551,0.516) + --(2.482551,0.516)\dpicstop +\dpicdraw (2.146551,0.516) circle (0.037795in)\dpicstop +\dpicdraw (2.146551,0.42) + --(2.146551,0.276)\dpicstop +\draw (2.146551,0.004833) node{sl\_ct(type=C)}; +\dpiclw=0.4bp +\filldraw[line width=0bp](1.788705,0.449915) + --(1.810551,0.516) + --(1.755936,0.472854) --cycle\dpicstop +\dpicdraw (1.805008,0.508081) + --(1.713329,0.377111)\dpicstop +\draw (1.713329,0.377111) node[below left=-2bp]{\sl Tstart}; +\filldraw[line width=0bp](2.537167,0.472854) + --(2.482551,0.516) + --(2.504397,0.449915) --cycle\dpicstop +\dpicdraw (2.488095,0.508081) + --(2.579773,0.377111)\dpicstop +\draw (2.579773,0.377111) node[below right=-2bp]{\sl Tend}; +\draw (2.146551,0.276) node[right=-2bp]{\sl Tc}; +\dpiclw=0.8bp +\dpicdraw[fill=black](0.14,-0.684) circle (0.009449in)\dpicstop +\dpicdraw[fill=black](0.74,-0.684) circle (0.009449in)\dpicstop +\dpicdraw[fill=black](1.34,-0.684) circle (0.009449in)\dpicstop +\dpicdraw[fill=black](1.94,-0.684) circle (0.009449in)\dpicstop +\dpicdraw[line width=1.6bp](0.02,-0.684) + --(2.06,-0.684)\dpicstop +\draw (2.66,-0.684) node[right=-2bp]{sl\_busbar(right\_ 3{\tt*}dimen\_,4,port=D)}; +\dpiclw=0.4bp +\filldraw[line width=0bp](0.162659,-0.593961) + --(0.150733,-0.662534) + --(0.198436,-0.61185) --cycle\dpicstop +\dpicdraw (0.155056,-0.653887) + --(0.229267,-0.505466)\dpicstop +\draw (0.229267,-0.505466) node[right=-2bp]{\sl P1}; +\filldraw[line width=0bp](0.762659,-0.593961) + --(0.750733,-0.662534) + --(0.798436,-0.61185) --cycle\dpicstop +\dpicdraw (0.755056,-0.653887) + --(0.829267,-0.505466)\dpicstop +\draw (0.829267,-0.505466) node[right=-2bp]{\sl P2}; +\filldraw[line width=0bp](1.362659,-0.593961) + --(1.350733,-0.662534) + --(1.398436,-0.61185) --cycle\dpicstop +\dpicdraw (1.355056,-0.653887) + --(1.429267,-0.505466)\dpicstop +\draw (1.429267,-0.505466) node[right=-2bp]{\sl P3}; +\filldraw[line width=0bp](1.962659,-0.593961) + --(1.950733,-0.662534) + --(1.998436,-0.61185) --cycle\dpicstop +\dpicdraw (1.955056,-0.653887) + --(2.029267,-0.505466)\dpicstop +\draw (2.029267,-0.505466) node[right=-2bp]{\sl P4}; +\filldraw[line width=0bp](2.126667,-0.664) + --(2.06,-0.684) + --(2.126667,-0.704) --cycle\dpicstop +\dpicdraw (2.069667,-0.684) + --(2.164833,-0.684) + ..controls (2.228278,-0.684) and (2.276667,-0.650667) + ..(2.31,-0.584) + --(2.36,-0.484)\dpicstop +\draw (2.36,-0.484) node[above right=-2bp]{\sl End}; +\filldraw[line width=0bp](0,-0.617333) + --(0.02,-0.684) + --(0.04,-0.617333) --cycle\dpicstop +\dpicdraw (0.02,-0.674333) + --(0.02,-0.629167) + ..controls (0.02,-0.599056) and (0.036667,-0.550667) + ..(0.07,-0.484) + --(0.12,-0.384)\dpicstop +\draw (0.12,-0.384) node[above=-2bp]{\sl Start}; +\dpiclw=0.8bp +}% +\end{tikzpicture}% +} +\vspace*{-0.5\baselineskip} diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/SLDsMan.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/SLDsMan.m4 new file mode 100644 index 00000000000..67cb2fa8557 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/SLDsMan.m4 @@ -0,0 +1,228 @@ +% SLDsMan.m4 +define(`SLDheading',` +cct_init +include(libSLD.m4) + mr = dimen_*6/5 + dv = 20bp__ + ds = dimen_/3 + movewid = 10bp__ + right_ +')dnl +% +\global\newcommand{\SLDTransformers}{% +.PS +SLDheading +command "{\sf" +define(`Below',`ifelse(`$1',,below,`$1',0,below,`-(0,dv*(`$1'))')') +Transformers: [ setdir_(U) + { Tr1: sl_transformer(,name=TR1,C,C) + "sl\_transformer(,,C,C)" wid 97bp__ at Tr1.start Below(0) } + { thinlines_ + arrow <- up_ dimen_/3 left_ dimen_/3 from BrO.nw; "\sl BrO" rjust + arrow <- down_ dimen_/5 right_ dimen_*3/4 from BrI.e; BrIx: Here + { "\sl BrI" below } + thicklines_ } + move right_ mr*3/2; up_ + { Tr2: sl_transformer(,type=S,O,O) + ".{.}.(,type=S,O,O)" at Tr2.start Below(1) } + { thinlines_ + arrow <- up_ dimen_*3/4 right_ dimen_*2/3 from 1/2 between TR1.ne and TR1.n + { "\sl Body" above } + arrow to Body.w + arrow from BrIx to BrI.w + arrow <- up_ dimen_*3/4 right_ dimen_/2 from Body.C2 chop Body.C2.rad chop 0 + { "\sl C2" above } + arrow <- down_ dimen_*3/4 right_ dimen_/2 from Body.C1 chop Body.C1.rad \ + chop 0 + { "\sl C1" below } + arrow <- right_ dimen_/2 from Body.M2; { "\sl M2" ljust } + arrow <- right_ dimen_/2 from Body.M1; { "\sl M1" ljust } + thicklines_ } + + move right_ mr*3/2; up_ + { TRF21: sl_transformer(, type=S,C,C,YN,YN) + ".{.}.(,type=S,C,C,YN,YN)" wid 97bp__ at TRF21.start Below(0) } + move right_ mr*3/2; up_ + { TRF22: sl_transformer(, type=S,X,/,Delta,Y) + ".{.}.(,type=S,X,/,Delta,Y)" wid 97bp__ at TRF22.start Below(1) } + move right_ mr*3/2; up_ + { TRF23: sl_transformer(,type=S,,,Y,Delta) + ".{.}.(,type=S,{,},Y,Delta)" wid 97bp__ at TRF23.start Below(0) } + move right_ mr*3/2; up_ + { TRF24: sl_transformer(, type=A,S,S3) + ".{.}.(,type=A,S,S3)" wid 97bp__ at TRF24.start Below(1) } + ] + +command "}%" +.PE +} +\global\newcommand{\SLDTwoTerms}{% +.PS +SLDheading +command "{\sf" +TwoTerms: [ + { sl_ttbox(,,box=shaded "green",box=shaded "red") #; llabel(,"ttbox",,,Body) + move; "sl\_ttbox(,,box=shaded \"green\",box=shaded \"red\")" ljust } + move down; right_ + { sl_rectifier #; llabel(,"Re",,,Body) + move right_ + sl_inverter #; llabel(,"Inv",,,Body) + move; "sl\_rectifier, sl\_inverter" ljust } + move down dimen_*5/6; right_ + { sl_breaker #; llabel(,"Br") + move right 10bp__ + sl_breaker(,type=C;name=C) #; llabel(,"C") + move right 10bp__ + sl_breaker(,type=D;name=B3) ;llabel(,"\sl D",,,B3) + move; `"sl\_breaker, sl\_breaker(,type=C)"' ljust \ + `"sl\_breaker(,type=D;name=B3) ; llabel(,\"D\",{,},B3)"' ljust } + move down dimen_*2/3; right_ + { R: sl_reactor(,,C,C) #; llabel(,"\sl R",,,Body) + move; "sl\_reactor(,,C,C)" ljust } + move right_ dimen_*6; right_ + { sl_drawout #; llabel(,"\sl Dr") + move; "sl\_drawout" ljust } + ] #with .nw at Transformers.sw + (0,-dimen_) + +command "}%" +.PE +} +\global\newcommand{\SLDOneTerms}{% +.PS +SLDheading +command "{\sf" +define(`Below',`ifelse(`$1',,below,`$1',0,below,`-(0,dv*(`$1'))')') + +OneTerms: [ +define(`dimen_',dimen_*1.2) + up_ + D: sl_disk + {"sl\_disk" at D.s Below(0) } + move right_ mr; up_ + B: sl_box(,,C); Bre: Br.e; {"sl\_box(,,C)" at B.s Below(1) + thinlines_ + arrow <- from last circle.se down dimen_/4 right dimen_/4 + { "\sl Head" Below(0) } + { M1: move from Head.sw to Head.nw } + { M2: move to Head } + arrow to Intersect_(M1,M2) + thicklines_ + } + move right_ mr; up_ + G: sl_grid(,,X) ; {"sl\_grid(,,X)" at G.s Below(0)} + { thinlines_ + Brc: 1/2 between Bre and Br.w + arrow <- from Bre to Brc+(0,-dimen_/4); { "\sl Br" below } + arrow to Br.w + thicklines_ } + move right_ mr; up_ + L: sl_load(,,O) ; {"sl\_load(,,O)" at L.s Below(1) } + move right_ mr; up_ + M: sl_meterbox ; {"sl\_meterbox" at M.s Below(0)} + move right_ mr; up_ + S: sl_syncmeter ; {"sl\_syncmeter" at S.s Below(1)} + move right_ mr; up_ + P: sl_lamp ; {"sl\_lamp" at P.s Below(0) } + ] #with .nw at TwoTerms.sw + (0,-dimen_*2/3) + +command "}%" +.PE +} +\global\newcommand{\SLDGenerators}{% +.PS +SLDheading +command "{\sf" +define(`Below',`ifelse(`$1',,below,`$1',0,below,`-(0,dv*(`$1'))')') + +Generators:[ + up_ + GEN0: sl_generator ; {"sl\_generator" at GEN0.s Below(0)} + move right_ mr; up_ + GEN1: sl_generator(,type=WT); {".{.}.(,type=WT)" at GEN1.s Below(1)} + move right_ mr; up_ + GEN2: sl_generator(, type=BS); {".{.}.(,type=BS)" at GEN2.s Below(0)} + move right_ mr; up_ + GEN3: sl_generator(, type=PV); {".{.}.(,type=PV)" at GEN3.s Below(1)} + move right_ mr; up_ + GEN4: sl_generator(, type=StatG); {".{.}.(,type=StatG)" at GEN4.s Below(0)} + move right_ mr; up_ + GEN4: sl_generator(, type=Y); {".{.}.(,type=Y)" at GEN4.s Below(1)} + { thinlines_ + arrow <- from Head_Y.N down_ dimen_/2 right_ dimen_*0.6 + "\sl Head\_Y.N" below + thicklines_ } + move right_ mr; up_ + GEN4: sl_generator(, type=Delta); {".{.}.(,type=Delta)" at GEN4.s Below(0)} + move right_ mr; up_ + GEN5: sl_disk(, text="SG"); {"sl\_disk(,text=\"SG\")" at GEN5.s Below(1)} + ] #with .nw at OneTerms.sw + (0,-dimen_*2/3) + +command "}%" +.PE +} +\global\newcommand{\SLDComposite}{% +.PS +SLDheading +command "{\sf" + +Composite: [ +ifelse(1,1,` + Ref: line right_ 1.5 cm__ + CTL: sl_ct at last line.c + CTLt: "sl\_ct" at CTL.Tc+(0,-30bp__) + thinlines_ + arrow <- from CTL.Tstart down 10bp__ left_ 7bp__; "\sl Tstart" below rjust + arrow <- from CTL.Tend down 10bp__ right_ 7bp__; "\sl Tend" below ljust + arrow <- from CTL.Tc down 10bp__ right_ 2bp__ ; "\sl Tc" below + thicklines_ + CTC: sl_transformer3(,type=C) with .Tstart at Ref.end+(3/2*dimen_,0) + "sl\_transformer3(," ljust at (CTC.Tstart-(12bp__,0),CTLt) \ + "type=C)" ljust + thinlines_ + arrow <- from CTC.Tstart down 10bp__ left 7bp__; "\sl Tstart" below rjust + arrow <- from CTC.Tend down 10bp__ right 7bp__; "\sl Tend" below ljust + "\sl Tc" at CTC.Tc ljust + thicklines_ + BB: sl_busbar(right_ 3*dimen_,4,port=D) with .Start at Ref.start+(0,-dimen_*2) + "sl\_busbar(right\_ 3{\tt*}dimen\_,4,port=D)" ljust at BB.Start+(0,-15bp__) + thinlines_ + arrow up ds right ds/2 <- from BB.P1.ne chop dotrad_; "\sl P1" ljust + arrow up ds right ds/2 <- from BB.P2.ne chop dotrad_; "\sl P2" ljust + arrow up ds right ds/2 <- from BB.P3.ne chop dotrad_; "\sl P3" ljust + arrow up ds right ds/2 <- from BB.P4.ne chop dotrad_; "\sl P4" ljust + spline <- from BB.End right ds then up ds right ds/2; "\sl End" above + spline <- from BB.Start up ds/2 then up ds right ds/2; "\sl Start" above + thicklines_ + Tr3: sl_transformer3(,,,Y:Y:Delta) with .Tc at CTC.ne + (dimen_*2,0) + {"sl\_transformer3(," ljust at Tr3.sw+(0,-25bp__) "Y:Y:Delta)" ljust} +') + Tr32: sl_transformer3(,direct=R,C:C:box=shaded "green",Y:Y:Delta) \ + with .Tstart at Tr3.Tc + (dimen_,0) + "sl\_transformer3(," ljust at Tr32.sw+(15bp__,-25bp__) \ + "direct=R,C:C:box=shaded \"green\"," ljust \ + "Y:Y:Delta)" ljust + "\sl Tstart" at Tr32.Tstart+(0,-4bp__) below + "\sl Tend" at Tr32.Tend+(0,-4bp__) below + "\sl Tc" at Tr32.Tc ljust + "\sl BrI" at Tr32.BrI.n above + "\sl BrO" at Tr32.BrO.n above + "\sl Br" at Tr32.Br.w rjust +# "\sl C1" at Tr32.Body.C1.nw rjust +# "\sl C2" at Tr32.Body.C2.ne ljust +# "\sl C3" at Tr32.C3.se ljust + ] #with .nw at Generators.sw+(0,-dimen_/2) + +command "}%" +.PE +} +%\iffalse +%\SLDTransformers +%\par \vspace*{\baselineskip} +%\SLDGenerators +%\par \vspace*{\baselineskip} +%\SLDTwoTerms +%\par +%\SLDOneTerms +%\par \vspace*{\baselineskip} +%\fi +%\SLDComposite diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/SwitchesMan.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/SwitchesMan.m4 index e7d82badab4..9f589801714 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/SwitchesMan.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/SwitchesMan.m4 @@ -1,132 +1,145 @@ .PS -# Switches.m4 +# SwitchesMan.m4 cct_init -define(`Below',`at last [].s+(0,-10bp__)') +define(`Below',`at last [].s+(0,-(8 ifelse(`$1',,,+10*(`$1')))bp__)') movewid = 0.25 + # Row 1 right_; { - lswitch; {S:"\tt ls{}witch" Below} + lswitch; {"\tt ls{}witch" at last [].s Below} move right_ - lswitch(,,O); {"\tt (,{,}O)" at (last [],S)} + lswitch(,,O); {"\tt (,{,}O)" at last [].s Below} move right_ - lswitch(,,C); {"\tt (,{,}C)" at (last [],S)} + lswitch(,,C); {"\tt (,{,}C)" at last [].s Below} move right_ - lswitch(,,DA); {"\tt (,{,}DA)" at (last [],S)} + lswitch(,,DA); {"\tt (,{,}DA)" at last [].s Below} move right_ - lswitch(,,dDO); {"\tt (,{,}dDO)" at (last [],S)} + lswitch(,,dDO); {"\tt (,{,}dDO)" at last [].s Below} move right_ - lswitch(,,uDC); {"\tt (,{,}uDC)" at (last [],S)} + lswitch(,,uDC); {"\tt (,{,}uDC)" at last [].s Below} } # Row 2 move down 0.4; right_; { - lswitch(,,K); {S:"\tt (,{,}K)" Below} + lswitch(,,K); {"\tt (,{,}K)" at last [].s Below} move right_ - lswitch(,,KD); {"\tt (,{,}KD)" at (last [],S)} + lswitch(,,KD); {"\tt (,{,}KD)" at last [].s Below} move right_ - lswitch(,,KOD); {"\tt (,{,}KOD)" at (last [],S)} + lswitch(,,KOD); {"\tt (,{,}KOD)" at last [].s Below} move right_ - lswitch(,,KCD); {"\tt (,{,}KCD)" at (last [],S)} + lswitch(,,KCD); {"\tt (,{,}KCD)" at last [].s Below} move right_ - bswitch; {"\tt `bswitch'" at (last [],S)} + bswitch; {"\tt `bswitch'" at last [].s Below} move right_ - bswitch(,,C); {"\tt (,{,}C)" at (last [],S)} + bswitch(,,C); {"\tt (,{,}C)" at last [].s Below} } # Row 3 - move down; right_; { - D: dswitch(,,); {S: "\tt ds{}witch(,{},)" Below} + move down 0.45; right_; { + D: dswitch(,,); {"\tt ds{}witch(,{},)" at last [].s Below} thinlines_ - { spline <- from 0.25 along_(D) up 0.1 then up 0.05 left 0.1 - {"\tt W" rjust} - spline <- from D.c+(0,m4sc*2) up 0.1 then up 0.05 left 0.1 - {"\tt B" rjust }} + {spline <- from last [].B.c up 0.1 then up 0.05 left 0.1; "\tt B" rjust} thicklines_ move right_ - D: dswitch(,,WdBK); {"\tt (,{,}WdBK)" at (last [],S)+(0,-4bp__)} + dswitch(,,WdBK); {"\tt (,{,}WdBK)" at last [].s Below} thinlines_ - { spline <- from tr_xy(0,-2) up 0.1 then up 0.10 left 0.1 - {"\tt dB" rjust} - spline <- from tr_xy(4,-2) right 0.1 then right 0.05 up 0.15 + { spline <- from 0.5 along_(last [].B) up 0.1 then up 0.10 left 0.1 + {"\tt B" rjust} } + { spline <- from last [].K right 0.1 then right 0.05 up 0.15 {"\tt K" above }} thicklines_ move right_ - dswitch(,,WBmdDK); {"\tt (,{,}WBmdDK)" at (last [],S)} + dswitch(,,WBmdDK); {"\tt (,{,}WBmdDK)" at last [].s Below} move right_ - dswitch(,,WBKTr); {"\tt (,{,}WBKTr)" at (last [],S)} + dswitch(,,WBKTr); {"\tt (,{,}WBKTr)" at last [].s Below} move right_ - dswitch(,,WdBL); {"\tt (,{,}WdBL)" at (last [],S+(0,-4bp__))} + dswitch(,,WdBL); {"\tt (,{,}WdBL)" at last [].s Below} move right_ - dswitch(,,WBCo); {"\tt (,{,}WBCo)" at (last [],S)} + dswitch(,,WBSd); {"\tt (,{,}WBSd)" at last [].s Below} } # Row 4 move down 0.4; right_; { - dswitch(,,WBKCo); {S: "\tt (,{,}WBKCo)" Below} + dswitch(,,WBCb); {"\tt (,{,}WBCb)" at last [].s Below} move right_ - dswitch(,,WBCb); {"\tt (,{,}WBCb)" at (last [],S)} + dswitch(,,WBcCb); {"\tt (,{,}WBcCb)" at last [].s Below} move right_ - dswitch(,,WBDI); {"\tt (,{,}WBDI)" at (last [],S)} + dswitch(,,WBcDI); {"\tt (,{,}WBcDI)" at last [].s Below} + thinlines_ + {arrow <- from last [].DI.start up_ 0.1 right_ 0.15; "\tt DI" ljust} + thicklines_ move right_ - dswitch(,,WBSd); {"\tt (,{,}WBSd)" at (last [],S)} +# dswitch(,,WBDI); {"\tt (,{,}WBDI)" at last [].s Below} + dswitch(,,WBKCo); {"\tt (,{,}WBKCo)" at last [].s Below} move right_ - dswitch(,,WBFDI); {"\tt (,{,}WBFDI)" at (last [],S)} + dswitch(,,WBFDI); {"\tt (,{,}WBFDI)" at last [].s Below} move right_ - dswitch(,,WBFSd); {"\tt (,{,}WBFSd)" at (last [],S)} + dswitch(,,WBFSd); {"\tt (,{,}WBFSd)" at last [].s Below} } # Row 5 -# move down moveht*5/4; right_; { - move down moveht; right_; { - dswitch(,,WBTh); {S: "\tt (,{,}WBTh)" Below} + move down 0.4; right_; { + dswitch(,,WBMMR); {"\tt (,{,}WBMMR)" at last [].s Below} move right_ - dswitch(,,WBKC); {"\tt (,{,}WBKC)" at (last [],S)} + dswitch(,,WBMM); {"\tt (,{,}WBMM)" at last [].s Below} move right_ - dswitch(,,WBM); {"\tt (,{,}WBM)" at (last [],S)} + dswitch(,,WBMR); {"\tt (,{,}WBMR)" at last [].s Below} move right_ - dswitch(,,WBCO); {"\tt (,{,}WBCO)" at (last [],S)} + dswitch(,,WBEL); {"\tt (,{,}WBEL)" at last [].s Below} move right_ - dswitch(,,WBMP); {"\tt (,{,}WBMP)" at (last [],S)} + dswitch(,,WBLE); {"\tt (,{,}WBLE)" at last [].s Below} move right_ - dswitch(,,WBoKCP); {"\tt (,{,}WBoKCP)" at (last [],S)} + dswitch(,,WBoKEL); {"\tt (,{,}WBoKEL)" at last [].s Below} } # Row 6 - move down moveht*5/4; right_; { - dswitch(,,WBCY); {S: "\tt (,{,}WBCY)" Below} - move right_ - dswitch(,,WBCZ); {"\tt (,{,}WBCZ)" at (last [],S)} + move down moveht+2bp__; right_; { + dswitch(,,WBTh); {"\tt (,{,}WBTh)" at last [].s Below} move right_ - dswitch(,,WBCE); {"\tt (,{,}WBCE)" at (last [],S)} + dswitch(,,WBKC); {"\tt (,{,}WBKC)" at last [].s Below} + thinlines_ + { arrow <- from last [].C.c left 0.2; "\tt C" rjust } + thicklines_ move right_ - dswitch(,,WBRH); {"\tt (,{,}WBRH)" at (last [],S)} + dswitch(,,WBM); {"\tt (,{,}WBM)" at last [].s Below} move right_ - dswitch(,,WBRdH); {"\tt (,{,}WBRdH)" at (last [],S)} + dswitch(,,WBCO); {"\tt (,{,}WBCO)" at last [].s Below} move right_ - dswitch(,,WBRHH); {"\tt (,{,}WBRHH)" at (last [],S)} + dswitch(,,WBMP); {"\tt (,{,}WBMP)" at last [].s Below} + move down_ 2bp__ then right_ + dswitch(,,WBoKCP); {"\tt (,{,}WBoKCP)" at last [].s Below} } # Row 7 - move down 0.4; right_; { - dswitch(,,WBMMR); {S: "\tt (,{,}WBMMR)" Below} + move down moveht*7/6; right_; { + dswitch(,,WBCY); {"\tt (,{,}WBCY)" at last [].s Below} move right_ - dswitch(,,WBMM); {"\tt (,{,}WBMM)" at (last [],S)} + dswitch(,,WBCZ); {"\tt (,{,}WBCZ)" at last [].s Below} move right_ - dswitch(,,WBMR); {"\tt (,{,}WBMR)" at (last [],S)} + dswitch(,,WBCE); {"\tt (,{,}WBCE)" at last [].s Below} move right_ - dswitch(,,WBEL); {"\tt (,{,}WBEL)" at (last [],S)} + dswitch(,,WBRH); {"\tt (,{,}WBRH)" at last [].s Below} move right_ - dswitch(,,WBLE); {"\tt (,{,}WBLE)" at (last [],S)} + dswitch(,,WBRdH); {"\tt (,{,}WBRdH)" at last [].s Below} move right_ - dswitch(,,WBoKEL); {"\tt (,{,}WBoKEL)" at (last [],S)} + dswitch(,,WBRHH); {"\tt (,{,}WBRHH)" at last [].s Below} } # Row 8 move down moveht; right_; { move down_ 2bp__; right_ - dswitch(,,WBPr); {S: "\tt (,{,}WBPr)" Below} + dswitch(,,WBPr); {"\tt (,{,}WBPr)" at last [].s 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} + dswitch(,,WBPrT); {"\tt (,{,}WBPrT)" at last [].s Below} move down_ 6bp__ then right_ - dswitch(,,WBPrM); {S: "\tt (,{,}WBPrM)" Below} + dswitch(,,WBPrM); {"\tt (,{,}WBPrM)" at last [].s Below} + move right_ + dswitch(,,WBDIGX,W); #{"\tt (,{,}WBDIGX,W)" at last [].s Below} + {"\tt (,{,}WBDIGX," ljust at last line.start+(0,-15bp__) \ + "\tt text=W)" ljust} + move right_ + dswitch(,,WBDIGC,text=M) + {"\tt (,{,}WBDIGC," ljust at last line.start+(0,-15bp__) \ + "\tt text=M)" ljust} + move right_ + dswitch(,,WBcDIGC,text=M) # + {"\tt (,{,}WBcDIGC," ljust at last line.start+(0,-15bp__) \ + "\tt text=M)" ljust} } + .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Thermal.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Thermal.m4 index 68cdd7a0c07..afa2947a3aa 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/Thermal.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Thermal.m4 @@ -3,6 +3,6 @@ cct_init define(`thermalsw', `dswitch(`$1',`$2',WDdBTh) - circle rad distance(M4T,last line.c) at last line.c') + circle rad distance(last [].T,last line.c) at last line.c') thermalsw .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Version.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/Version.tex index 7079b5d95b1..91db3d8a250 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/Version.tex +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Version.tex @@ -1 +1 @@ -Version 9.7 +Version 9.8 diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/body.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/body.tex index 0acc9dc2ec5..c7c7b2bc6bd 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/body.tex +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/body.tex @@ -35,6 +35,7 @@ \newcommand{\PR}[1]{\hyperref[#1]{page~\pageref*{#1}}} \newcommand{\FR}[1]{\hyperref[#1]{Figure~\ref*{#1}}} \newcommand{\FRS}[1]{\hyperref[#1]{Figures~\ref*{#1}}} +\newcommand{\MR}[2]{\hyperref[#1]{#2}} \newcommand{\REF}[1]{\hyperref[#1]{\ref*{#1}}} \newcommand{\LQ}{\char96} \newcommand{\RQ}{\char39} @@ -72,7 +73,8 @@ 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 -combinations of them for particular drawings. +combinations of them for particular drawings, +a process for which \Mfour\ and \pic\ are well suited. \xection{Using the macros\label{Using:}} This section describes the basic process of adding circuit diagrams to @@ -121,7 +123,7 @@ The contents of file {\tt quick.m4} and resulting diagram are shown in % to show several ways for placing circuit elements, %and to provide sufficient information for producing and the production of basic labeled circuits. -\begin{figure}[h!] +\begin{figure}[ht] \parbox{\textwidth}{\small\verbatiminput{quick.m4}}% \hfill\llap{\raise-1.15in\hbox{\input quick }}% % \hfill\llap{\raise-1.15in\hbox{\pdftooltip{\input quick }% @@ -856,25 +858,26 @@ were added after the previously shown source: \end{itemize} \subsection{The two-terminal elements\label{Twoterminal:}} -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 +Two-terminal elements are shown in +\FRS{Resistors} to~\REF{Switches} and part of~\FR{Arresters}. +Several are included more than once to illustrate some of their arguments, which are listed in detail in \SR{defines}. + +\enlargethispage{\baselineskip} \FR{Resistors} shows some resistors with typical variants. -\begin{figure}[h!] +The first macro argument specifies the +\begin{figure}[H] \input ResistorsMan - \caption{Resistors dawn by the macro + \caption{Resistors drawn 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 -the invisible line segment along which the element is drawn. + \end{figure} +\noindent% +invisible line segment along which the element is drawn. If the argument is blank, the element is drawn from the current position in the current drawing direction along a default length. @@ -890,7 +893,6 @@ vertices per side. The macro {\tt up\_} evaluates to {\tt up} but also resets the current directional parameters to point up. -\pagebreak Capacitors are illustrated in \FR{Capacitors}. See \SR{Composite:} for the {\tt variable} macro. \begin{figure}[h!t] @@ -935,7 +937,7 @@ to draw a single cycle of a sinusoid or approximate sinusoid. \end{figure} 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 + [n:][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: \par @@ -949,24 +951,16 @@ and for power-system diagrams, macros and {\tt Ysymbol(at {\sl position, keys,} U|D|L|R|{\sl degrees})}, -\pagebreak -Diodes and fuses are shown in \FRS{Diodes} and \REF{Fuses}. -\begin{figure}[h!] +%Diodes and fuses are shown in \FRS{Diodes} and \REF{Fuses}. +Diodes are shown in \FR{Diodes}. +\begin{figure}[h!t] \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])}. + \caption{The macro {\tt + diode(\linespec, B|CR|D|L|LE[R]|P[R]|S|T|U|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}[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} -\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 @@ -999,9 +993,39 @@ by 1.8, for example {\tt resized(1.8,`diode',right\_ 0.4);} {\tt resized(1.8,`reversed',`diode',right\_ 0.4)} +Fuses are shown in \FR{Fuses} +and switches with numerous controls in \FR{Switches}. +\begin{figure}[h!t] + \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} + +%\enlargethispage{\baselineskip}% +\begin{figure}[h!t] +%\vspace*{-\baselineskip} + \input SwitchesMan + \caption{The + {\tt switch(\linespec,L|R,{\sl chars},L|B|D,{\sl attribs})} + 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 {\sl chars,text})} 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 bottom row.} + \label{Switches} + \end{figure} + +\pagebreak \FR{Emarrows} contains radiation-effect arrows for embellishing two-terminal and other macros. -\begin{figure}[h!] +\begin{figure}[h!t] \input EmarrowsMan \caption{Radiation arrows: {\tt em\_arrows({\sl type, angle, length})}} \label{Emarrows} @@ -1019,29 +1043,10 @@ 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!] +\begin{figure}[ht] \input ArrestersMan \caption{Variations of the {\tt arrester({\sl linespec, chars,} {\sl wid}[{\tt :}{\sl arrowhead ht}], @@ -1278,7 +1283,6 @@ as in {\tt `{`,'}',} as necessary. Commas also may be avoided by writing {\tt 0.5 between L and T} instead of {\tt 0.5.} -\pagebreak \subsection{Series and parallel circuits\label{Seriesandparallel:}} To draw elements in series, each element can be placed by specifying @@ -1392,7 +1396,6 @@ 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}, @@ -1454,7 +1457,6 @@ have identical effect: \par ground(at (1.5,2)) } -%\noindent The second argument truncates the stem, and the third defines the symbol type. The fourth argument specifies the angle at which the symbol is drawn, @@ -1518,12 +1520,12 @@ The code in \FR{opampex} places an opamp with three connections. \begin{figure}[h!b] \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{opampex} \end{figure} +\pagebreak \FR{Xform} shows variants of the transformer macro, which has predefined internal locations {\sl P1,} {\sl P2,} {\sl S1,} {\sl S2,} {\sl TP,} and {\sl TS.} @@ -1638,18 +1640,17 @@ An {\tt I} in the first argument draws open circles for contacts. \begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi% \input ContactMan - \vspace{-1ex} \caption{The {\tt contact({\sl chars})} macro (default drawing direction right) - can be used alone, in a set of ganged contacts, or in relays.} + can be used alone, in a set of ganged contacts, or in relays.}% \label{Contact} \end{figure} +\pagebreak The {\tt contacts({\sl poles, chars})} macro in \FR{Contacts} draws multiple contacts. -\begin{figure}[ht] +\begin{figure}[h!t] \input ContactsMan - \vspace{-1ex} \caption{The {\tt contacts({\sl poles, chars})} macro (drawing direction right).} \label{Contacts} @@ -1659,7 +1660,6 @@ 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% @@ -1682,8 +1682,8 @@ 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}[!ht] +The first +\begin{figure}[H] \input JackMan \vspace{-1ex} \caption{The {\tt jack(U|D|L|R|{\sl degrees}, {\sl chars})} @@ -1691,6 +1691,8 @@ The first argument of both macros establishes the drawing direction. and their defined points.} \label{Jack} \end{figure} +\noindent% +argument of both macros establishes the drawing direction. The second argument is a string of characters defining drawn components. An {\tt R} in the string specifies a right orientation with respect to the drawing direction. @@ -1703,16 +1705,16 @@ The first argument of both macros establishes the drawing direction. or {\tt S[M|B]} substrings add auxiliary contacts with specified make or break points. -A macro for drawing headers is in \FR{Headers}, -and some experimental connectors are shown in \FR{Conn} and \FR{Pconn}. +A macro for drawing headers is in \FR{Headers}. +Some 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}[h!b] +\begin{figure}[h!t] \input HeadersMan \caption{Macro {\tt Header(1|2, {\sl rows, wid, ht, type})}.} \label{Headers} \end{figure} -\begin{figure}[h!b] +\begin{figure}[h!t] \input ConnMan \caption{Macros {\tt tstrip(R|L|U|D|{\sl degrees}, {\sl chars})}, {\tt ccoax(at} {\sl location}, {\tt M|F, {\sl diameter})}, @@ -1720,8 +1722,7 @@ for width and height. {\tt tbox({\sl text, wid, ht}, <|>|<>,{\sl type})}. } \label{Conn} \end{figure} - -\begin{figure}[ht] +\begin{figure}[h!t] \input PconnMan \caption{A small set of power connectors drawn by {\tt pconnex(R|L|U|D|}{\sl degrees, chars}{\tt)}. Each connector has @@ -1733,7 +1734,7 @@ 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!t] - \ifpdf{\vspace*{-1ex}}\fi% +% \ifpdf{\vspace*{-1ex}}\fi% \input NPDTMan \caption{Multipole double-throw switches drawn by {\tt NPDT({\sl npoles}, [R])}.} @@ -1821,9 +1822,7 @@ and {\sl E} is shown in \FR{ujt}. 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% +\begin{figure}[H] \input thyristorMan \vspace*{-1ex} \caption{The top two rows illustrate use of the @@ -1834,10 +1833,11 @@ 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} +Except for the {\sl G} terminal, a thyristor (the {\tt IEC} variant excluded) 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, +{\tt scs, sus,} and {\tt sbs} +place thyristors using {\sl linespec} as for a two-terminal element, but require a third argument for the label for the compound block; thus, {\tt scr(from A to B,{,}Q3); line right from Q3.G} @@ -1851,6 +1851,7 @@ 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] +\vspace*{-\baselineskip} \input fetMan \caption{JFET, insulated-gate enhancement and depletion MOSFETs, simplified versions, graphene, and ferroelectric fets. @@ -1879,15 +1880,15 @@ temporarily for compatibility. This system allows considerable freedom in choosing or customizing components, as illustrated in \FR{fet}. +\enlargethispage{\baselineskip} The number of possible semiconductor symbols is very large, so these macros must be regarded as prototypes. -Often an element is a minor modification of existing elements. For example, -the {\tt thyristor(\linespec, {\sl chars})} macro illustrated in -\FR{thyristor} is derived from the diode and bipolar transistor macros. +Often an element is a minor modification of existing elements. +The {\tt thyristor(\linespec, {\sl chars})} macro in +\FR{thyristor} is derived from diode and bipolar transistor macros. Another example is the {\tt tgate} macro shown in \FR{Tgate}, which also shows a pass transistor. -\begin{figure}[h!t] -% \ifpdf\vspace*{-\baselineskip}\fi% +\begin{figure}[H] \input TgateMan \caption{The {\tt tgate({\sl linespec,} [B][R|L])} element, derived from a customized diode and {\tt ebox}, and the @@ -1962,7 +1963,6 @@ 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 @@ -2140,6 +2140,7 @@ 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. @@ -2155,7 +2156,6 @@ 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}. @@ -2235,6 +2235,182 @@ which executes the given actions successively with {\sl variable} = {\sl value1}, {\sl value2} $\ldots$ and the counter {\tt m4Lx} set to 1, 2, $\ldots$ as in the diagram. +\xection{Single-line diagrams\label{SingleLine:}} +\input SLDsMan + Standard single-line diagrams for power distribution employ many of + the normal two-terminal elements along with others that are unique to + the context. This distribution contains a library of draft single-line + diagram (SLD) elements that can be loaded with the + command {\tt include(libSLD.m4)}. + The {\tt examples.pdf} and {\tt examplesSVG.html} + documents include samplers of some of their uses. + + Writing macros for special elements is always an option but the SLD + macros allow considerable scope for customization. Diagram-wide + or block-scope changes are made by redefining + environmental variables, particularly + {\tt linethick,} for example, and {\tt linewidth} for scaling. + Element body sizes are altered using, for example, + {\tt define(`dimen\_',dimen\_*1.2)} as for the normal circuit elements. + To apply such a change to a single element, use + {\tt pushdef(`dimen\_',{\sl expr})} {\sl element statements} + {\tt popdef(`dimen\_').} +The SLD library also includes a number of redefinable default +style parameters, which are currently: +\begin{verbatim} +define(`sl_breakersize_',`dimen_*3/16') # breaker box size +define(`sl_breakersep_',`dimen_/2') # breaker separation from body +define(`sl_ttboxlen_',`dimen_*3/4') # inline box length +define(`sl_ttboxwid_',`dimen_*3/4') # inline box width +define(`sl_sboxlen_',`dimen_*2/3') # stem box length +define(`sl_sboxwid_',`dimen_*2/3') # stem box wid +define(`sl_diskdia_',`dimen_*2/3') # sl_disk diam +define(`sl_chevronsiz_',`dimen_/4') # sl_drawout (chevron) size +define(`sl_loadwid_',`dimen_*0.32') # load width +define(`sl_loadlen_',`dimen_*0.45') # load length +define(`sl_transcale_',1) # transformer body scale factor +define(`sl_busthick_',linethick*2) # sl_bus line thickness +define(`sl_busindent_',`min(dimen_/5,rp_len/5)') # bus end extension +\end{verbatim} + + The macros also allow for extensive customization of individual + elements using a key-value mechanism. + The greatest control of appearance is obtained by drawing all + elements individually; however, + provision is made for automatically attaching circuit breakers + and other symbols to elements. + +\subsection{Two-terminal SLD elements\label{TwoTermSLD:}} +The two-terminal SLD elements are drawn along an invisible line segment +that can be named as for normal two-terminal elements. +There are four arguments for which defaults are provided as always. +The transformers are shown in \FR{SLDTransformers} and other two-terminal +elements in \FR{SLDTwoTerms}. +\begin{figure}[h!t] + \SLDTransformers + \caption{The SLD draft transformers + drawn by {\tt sl\_transformer({\sl linespec, key-value pairs, + stem object, stem object, type {\tt S} circle object, + type {\tt S} circle object})}, + drawing direction {\tt up\_}.} + \label{SLDTransformers} + \end{figure} + +The first argument is the linespec defining the direction and location +of the element, e.g., +{\tt sl\_transformer(right\_ {\sl expr}).} +\begin{figure}[h!t] + \SLDTwoTerms + \caption{SLD two-terminal elements, drawing direction {\tt right\_}.} + \label{SLDTwoTerms} + \end{figure} + +The second argument is a sequence of semicolon (;)-separated key-value +pairs that customize the element body, depending on the case, e.g., +{\tt sl\_ttbox(,lgth={\sl expr}; wdth={\sl expr}; + text="{\sl internal label}"; box=shaded~"yellow").} + +If the third argument is blank, then a plain input stem is drawn for the +element. +If it is a {\tt C} then a default closed +breaker is inserted and an {\tt O} inserts a default open breaker, +and similarly an {\tt X} or slash ({\tt/}) add these elements. +If it or its prefix is {\tt S:} or {\tt S$n$:} where $n$ is an integer, +then, instead of a breaker, +an $n$-line slash symbol is drawn using the macro +{\tt sl\_slash(at {\sl position, keys,} [$n$:]R|L|U|D|{\sl degrees}).} + +Otherwise, one or more of the extensive {\tt sl\_ttbox} body +key-value pairs will insert a custom breaker as needed. These keys include: +{\tt lgth={\sl expr}, +wdth={\sl expr}, +name={\sl Name}, +text="{\sl text}", +box={\sl other box attributes, e.g., {\tt dashed, shaded,} $\ldots$}.} +For the slash symbol, the {\tt sl\_slash} keys are valid. + +The fourth argument is like the third but controls a breaker or slash +symbol in the output +lead. The example, {\tt sl\_transformer(right\_ elen\_ from A,,C,C)} +draws a transformer with closed breakers in the input and output leads. + +Exception are the {\tt sl\_drawout()} element which does not have breakers +and the {\tt transformer()} element which has an extra two arguments for +the frequently used {\tt S} variant. + +The body can be given a name with {\tt name={\sl Label};} in the +second argument. The default two-terminal name is {\sl Body} +except for the {\tt sl\_breaker} element which has default body name {\sl Br} +and the {\tt sl\_slash} element which has default name {\sl SL}. +Annotations can be added by writing {\tt "{\sl text}" at {\sl +position}} as always, but there are other ways. One alternative is to +use, for example, {\tt llabel({\sl text, text, text, position, name})} +as usual. However, this macro positions text by default with respect +to {\tt last []} which normally will be incorrect if breakers are +automatically included with the element. +In the latter case, enter the element body name as the fifth argument +of {\tt llabel()}. +For example, {\tt B: sl\_ttbox} creates an element of which +the invisible centre line has name {\sl B} and the body has name {\sl Body,} +and can be labelled like a normal two-terminal element. If, however, +breakers are included using {\tt B: tt\_box(,{,},C,C)} then write, for example, +{\tt llabel(,Box 15,{,},Body)} to place the label correctly. + +\subsection{One-terminal and composite SLD elements\label{OneTermSLD:}} +The one-terminal elements have two components: a stem with optional +breaker or slash symbol, and a head. +SLD generators are shown in \FR{SLDGenerators}, other +one-terminal elements in \FR{SLDOneTerms}. +\begin{figure}[h!t] + \SLDGenerators + \caption{SLD generators, drawing direction {\tt up\_}.} + \label{SLDGenerators} + \end{figure} +\begin{figure}[h!t] + \SLDOneTerms + \caption{SLD one-terminal elements, drawing direction {\tt up\_}.} + \label{SLDOneTerms} + \end{figure} +There are three arguments, as follows. + +The first argument is a linespec which defines the location and drawing +direction of the element stem. +The second argument is a sequence of semicolon-separated key-value pairs +as necessary to customize and name the element head, of which the +default name is {\sl Head}. +The third argument controls the presence and type of the object in the stem +as for the two-terminal element breakers. The default breaker name is {\sl Br} +and the default slash name is {\sl SL.} + +A stem of zero length is allowed when only the element head is needed. +Because a line segment of zero length has undefined direction, the +first argument must be one of {\tt U, D, L, R} (for up, down, left, right) +or a number to set the direction in degrees, optionally followed by +{\tt at {\sl position}} to set the position ({\tt Here} by default). +For example, {\tt sl\_box(45 at Here+(1,0))}. + +The macros {\tt sl\_busbar({\sl linespec, np, keys})} and +{\tt sl\_ct({\sl keys}),} +shown in \FR{SLDComposite}, +are composite; that is, they are {\tt [ ]} blocks with defined +internal positions. For {\tt sl\_busbar}, these are +{\sl Start, End,} and +{\sl P1, P2, $\ldots$ Pnp} where {\sl np} is the value of the +second argument. +\begin{figure}[h!t] + \SLDComposite + \caption{The {\tt sl\_busbar()} and two variants of {\tt sl\_ct}.} + \label{SLDComposite} + \end{figure} + +For example, the line +\par +{\tt line right\_ 3cm\_\_; sl\_busbar(up\_ 4.5cm\_\_,5) with .P3 at Here} +\vspace*{\parsep} +\par +\noindent% + draws a vertical busbar at the end of a horizontal line. + \xection{Element and diagram scaling\label{Scaling:}} There are several issues related to scale changes. You may wish to use @@ -2380,9 +2556,9 @@ Custom two-terminal elements can often be defined by writing a wrapper for an existing element. For example, an enclosed thermal switch can be defined as shown in \FR{Thermal}. \begin{figure}[ht] - \parbox{4.2in}{\tt define(`thermalsw',\hfill\break + \parbox{5in}{\tt define(`thermalsw',\hfill\break \hbox{}\space`dswitch(`\$1',`\$2',WDdBTh)\hfill\break - \hbox{}\space\space circle rad distance(M4T,last line.c) + \hbox{}\space\space circle rad distance(last [].T,last line.c) at last line.c ') }% \hfill\raise-0.15in\hbox{\input Thermal } \caption{A custom thermal switch defined from the {\tt dswitch} macro.} @@ -2404,7 +2580,6 @@ a subcircuit that is replicated several times to generate \FR{Tline}. \end{figure} \Example{3} -%\par\noindent {\bf Example 3:} \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 @@ -2618,40 +2793,69 @@ 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 +parameters are entered using keys. Two macros assist this process. +The first is -{\tt setkey\_({\sl string, key, default value, }[N])} +{\tt pushkey\_({\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 +%The first argument is a sequence of terms of the form +%{\tt {\sl key}={\sl value}}. +%The terms are separated by semicolon (;) characters. +For example in a macro, the line -{\tt setkey\_( `\$2', wdth, dimen\_*2 )} +{\tt pushkey\_( `\$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 would be required if -{\tt m4wdth} were to be non-numeric. +checks macro argument 2 for the substring {\tt wdth=}{\sl expression} +and, if found, defines the macro {\tt m4wdth}, using {\tt pushdef()}, +to equal {\tt ({\sl expression})}; if the substring is not found, {\tt +m4wdth} is given the default value {\tt (dimen\_*2).} The enclosing +parentheses are omitted if the fourth argument of {\tt pushkey\_} is +nonblank as would be required if {\tt m4wdth} were to be non-numeric. +Argument 1 can contain several such substrings separated by semicolons. In addition, the macro -{\tt setkeys\_({\sl string, keysequence})} +{\tt pushkeys\_({\sl string, keysequence})} \noindent -applies {\tt setkey\_()} multiple times to its {\sl keysequence} +applies {\tt pushkey\_()} 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. +Each term of the second argument consists of the rightmost three +arguments of {\tt pushkey\_} separated by the colons (:) rather than commas. + +%For example, suppose that a macro contains the line +% +%{\tt pushkeys\_(`\$1', wdth:dimen\_/2; type::N)} +% +%\noindent +%and is invoked as {\tt {\sl macro}(type=Basic;wdth=0.2, $\ldots$)}. +%The first argument is scanned, resulting in +%{\tt m4wdth} defined to be +%{\tt (0.2)} and {\tt m4type} to be {\tt Basic}. + +The macros {\tt setkey\_()} and {\tt setkeys\_()} are similar to +{\tt pushkey\_()} and {\tt pushkeys\_()} respectively but use the +m4 {\tt define} command rather than {\tt pushdef}. + +For example, the macro +{\tt sarrow({\sl linespec}, {\sl keys})} +can generate the custom arrows shown below the three native arrows +in \FR{arrowex}. The defined keys are + {\tt type=}; {\tt lgth=}; {\tt wdth=}; {\tt shaft=}; and {\tt head=}. +Many variations of these arrowheads are possible. +\begin{figure}[h!t] + \input arrowex + \caption{The three \dpic native arrows and others generated by + {\tt sarrow({\sl linespec}, {\sl keys})}.} + \label{arrowex} + \end{figure} -For example, consider the elementary example of a custom box macro: +As another example, consider the elementary example of a custom box macro: \begin{verbatim} define(`custombox', -`setkeys_(`$1',wdth:boxwid:; hgt:boxht:; label::N; text::N) +`pushkeys_(`$1',wdth:boxwid:; hgt:boxht:; label::N; text::N) ifelse(m4label,,,m4label:) box wid m4wdth ht m4hgt "m4text" ') \end{verbatim} @@ -2666,21 +2870,6 @@ 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')}. -%\iffalse -As another example, the macro -{\tt sarrow({\sl linespec}, {\sl keys})} -can generate the custom arrows shown below the three native arrows -in \FR{arrowex}. The defined keys are - {\tt type=}; {\tt lgth=}; {\tt wdth=}; {\tt shaft=}; and {\tt head=}. -Many variations of these arrowheads are possible. -\begin{figure}[h!t] - \input arrowex - \caption{The three \dpic native arrows and others generated by - {\tt sarrow({\sl linespec}, {\sl keys})}.} - \label{arrowex} - \end{figure} -%\fi - \xection{Interaction with \latex\label{Interaction:}} The sizes of typeset labels and other \tex boxes are generally unknown @@ -2846,6 +3035,7 @@ the {\tt ifpstricks} macro in the second line of the diagram source) are \hbox{} +\pagebreak Objects can be taylored to their attached text by invoking \verb|\boxdims| and \verb|boxdim| explicitly. The small source file in \FR{boxdims}, for example, @@ -2931,10 +3121,13 @@ the rotation of text by \PSTricks postprocessing is illustrated by the file which contains both horizontal text and text rotated $90^\circ$ along the vertical line. This rotation of text is also implemented by the macro -{\tt rs\_box}, which is similar +{\tt rs\_boxs([angle={\sl expr};] {\sl text}[,{\sl expr, expr $\ldots$}])}, +which is similar to {\tt s\_box} but rotates its argument by~$90^\circ,$ a default angle that can be changed by preceding invocation with -\verb|define(`text_ang',|{\sl degrees}{\tt )}. The {\tt rs\_box} macro +\verb|define(`text_ang',|{\sl degrees}{\tt )} +or by starting the first argument with {\tt angle={\sl expr};}. +The {\tt rs\_box} macro requires either \PSTricks or \TPGF and, like {\tt s\_box}, it calculates the size of the resulting text box but requires the diagram to be processed twice. @@ -3097,14 +3290,15 @@ 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. +\pagebreak \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 +write a \pic-like interpreter (\dpic) to eliminate the tedious coordinate +calculations required when drawing with \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. @@ -3118,26 +3312,27 @@ 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. +The simple \pic\ language is but one of many available tools for creating +line graphics. Consequently, the main value of this distribution is +not necessarily 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 decades, and which now total thousands +of lines. The learning curve of \pic\ compares well with other +possibilities, but 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, but the payoff +can be worth the effort. 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. +although \dpic now supports \pic-like macros. Free versions of \Mfour +are available for Unix and its descendents, Windows, and other operating +systems. Additionally, the simplicity of \Mfour and \pic enables the +writing of custom macros, which are mentioned from time to time in this +manual and included in some of the examples. 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 @@ -3175,6 +3370,7 @@ 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. +\pagebreak \xection{Bugs\label{Bugs:}} This section provides hints and a list of common errors. @@ -3195,7 +3391,7 @@ received. \bflistitem}[2]{\phantomsection\pdfbookmark[subsection]{#1}{#2}{\bf #1: }} \begin{enumerate} -%\item {\bf Misconfiguration:} +%\pagebreak \item \bflistitem{Misconfiguration}{misconfig}% One of the configuration files @@ -3479,6 +3675,7 @@ without sacrificing ease of use. -B16000} enlarges the buffer size to 16000 bytes. However, this error message could also result from a syntax error. +\iffalse \item \bflistitem{\PSTricks anomaly}{anomaly} If you are using \PSTricks and @@ -3503,6 +3700,7 @@ without sacrificing ease of use. to {\tt define(`M4PatchPSTricks',)}. Undo the change if you later update \PSTricks. \end{enumerate} +\fi \item \bflistitem{m4 {\tt -I} error}{mfourerror}\label{Mfourerror:} diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/defines.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/defines.tex index e5982031792..eb7d914fb20 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/doc/defines.tex +++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/defines.tex @@ -49,10 +49,11 @@ {gen} {absolute value function} \macrodef{ACsymbol}{ACsymbol}{(at {\sl position, len, ht,} - [A]U|D|L|R|{\sl degrees}) } + [n:][A]U|D|L|R|{\sl degrees}) } {cct} - {draw an AC symbol ( 1-cycle sine wave); If arg 4 contains A, two arcs - are drawn. The current drawing direction is default, otherwise Up, Down, + {draw a stack of $n$ (default 1) AC symbols + ( 1-cycle sine waves); If arg 4 contains A, two arcs + are used. The current drawing direction is default, otherwise Up, Down, Left, Right, or at {\sl degrees} slant; \seesect{Twoterminal:} e.g.,\\ {\tt ebox; $\lbrace$ACsymbol(at last [],{,}dimen\_/8)$\rbrace$}} \macrodef{adc}{adc}{({\sl width,height,nIn,nN,nOut,nS})} @@ -349,10 +350,11 @@ arg5 = wid (defaults F: {\sl height}*0.3, C,P: {\sl height}*0.4, CP: {\sl height}*0.8, E,K: {\sl height}) \seesect{Twoterminal:}} -\macrodef{cbreaker}{cbreaker}{(\linespec,L|R,D|Th|TS)} +\macrodef{cbreaker}{cbreaker}{(\linespec, L|R, D|Th|TS, body name)} {cct} {circuit breaker to left or right, {\tt D}=with dots; {\tt Th}=thermal; - {\tt TS}=squared thermal\seesect{Twoterminal:}} + {\tt TS}=squared thermal; default body bounding box name is + {\sl Br}\seesect{Twoterminal:}} \macrodef{ccoax}{ccoax}{(at {\sl location}, M|F, {\sl diameter})} {cct} {coax connector, {\tt M}=male, {\tt F}=female @@ -441,9 +443,10 @@ \macrodef{cross3D}{cross3D}{({\sl x1,y1,z1,x2,y2,z2})} {3D} {cross product of two triples} -\macrodef{crossover}{crossover}{(\linespec, L|R, Line1, ...)} +\macrodef{crossover}{crossover}{(\linespec, [L|R][:{\sl line attributes}], + Line1, Line2, .{.}.)} {cct} - {line jumping left or right over named lines\seesect{Semiconductors:}} + {line jumping left or right over ordered named lines\seesect{Semiconductors:}} \macrodef{crosswd\_}{crosswd_}{} {gen} {cross dimension} @@ -557,7 +560,9 @@ U|D|L|R|{\sl degrees}) (default {\tt U} for up)} {cct} {Delta symbol for power-system diagrams. - {\sl keys:} {\tt size={\sl expression}}} + {\sl keys:} {\tt size={\sl expression;}} + {\tt type=C|O} (default {\tt C} for closed; + {\tt O} draws an ``open'' symbol); } \macrodef{Demux}{Demux}{({\sl n},{\sl label}, {\tt [L][B|H|X][N[{\sl n}]|S[{\sl n}]][[N]OE], {\sl wid},{\sl ht}})} @@ -593,7 +598,7 @@ {macro for dimensioning diagrams; {\sl arrowhead=}{\tt -> | <-}} \macrodef{diode}{diode}{(\linespec,% -B|CR|D|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars,% +B|CR|D|G|L|LE[R]|P[R]|S|Sh|T|U|V|v|w|Z|chars,% [R][E])} {cct} {diode: @@ -607,6 +612,7 @@ B|CR|D|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars,% {\tt S}=Schottky, {\tt Sh}=Shockley, {\tt T}=tunnel, + {\tt U}=limiting, {\tt V}=varicap, {\tt v}=varicap (curved plate), {\tt w}=varicap (reversed polarity), @@ -699,7 +705,7 @@ B|CR|D|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars,% \macrodef{drjust}{drjust}{(at {\sl location})} {darrow} {rjust (displaced dlinewid/2)} -\macrodef{dswitch}{dswitch}{(\linespec,L|R,W[ud]B[K]{\sl chars})} +\macrodef{dswitch}{dswitch}{(\linespec,L|R,W[ud]B {\sl chars})} {cct} {SPST switch left or right, W=baseline, B=contact blade, dB=contact blade to the right of drawing direction, @@ -1511,6 +1517,23 @@ elementspec}\char39,% {cct} {pass transistor; {\tt L=} left orientation \seesect{Semiconductors:}} +\macrodef{pushkey\_}{pushkey_}{({\sl string, key, default value,}[N])} + {gen} + {Key-value definition. + If {\sl string} contains the substring + {\sl key}{\tt =}{\sl expr} then macro {\tt m4{\sl key}} + is defined using {\tt pushdef()} to + expand to {\tt ({\sl expr})}, or to {\tt ({\sl default value})} if the + substring is missing. Arg 1 can contain several such substrings separated + by semicolons. + If arg4 is nonblank, the parentheses are omitted. + \seesect{Macroarguments:}} +\macrodef{pushkeys\_}{pushkeys_}{({\sl string, key sequence})} + {gen} + {Multiple key-value definitions. Arg 2 is a semicolon-separated + sequence of terms of the form {\tt {\sl key}:{\sl default value}:[N]}. + Macro {\tt pushkey\_} is applied to each of the terms in order. + \seesect{Macroarguments:}} \Letter{R}% \macrodef{r\_}{r_}{} {gen} @@ -1606,6 +1629,10 @@ degrees})} {Draw a right-angle symbol at {\sl Pos2}, of size given by arg4. Arg5 = line attributes, e.g., {\tt outlined "gray"}} +\macrodef{r\_text}{s_text}{({\sl text},{\sl degrees})} + {gen} + {Rotate text by arg2 degrees (PSTricks, PGF, or SVG only). + \seesect{Interaction:}, \seesect{Pstricks:}} \macrodef{rjust\_}{rjust_}{} {gen} {right justify with respect to current direction} @@ -1660,10 +1687,16 @@ degrees})} \macrodef{rrot\_}{rrot_}{({\sl x, y, angle})} {gen} {\tt Here + vrot\_({\sl x, y, cos(angle), sin(angle))}} -\macrodef{rs\_box}{rs_box}{({\sl text},{\sl expr1},$\cdots$)} +\macrodef{rs\_box}{rs_box}{([angle={\sl expr};] + {\sl text},{\sl expr1},$\cdots$)} {gen} {like {\tt s\_box} but the text is rotated by {\tt text\_ang} - (default 90) degrees \seesect{Interaction:}, \seesect{Pstricks:}} + (default 90) degrees. Two or more args are passed to {\tt sprintf()}. + If the first argument begins with {\tt angle={\sl expr};} then + the specified angle is used. + The examples {\tt define(`text\_ang',45); rs\_box(Hello World)} and + {\tt rs\_box(angle=45; Hello World)} are equivalent + \seesect{Interaction:}, \seesect{Pstricks:}} \macrodef{rsvec\_}{rsvec_}{({\sl position})} {gen} {Here + {\sl position}} @@ -1756,7 +1789,7 @@ $\ldots$)} 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})} + 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 @@ -1771,11 +1804,14 @@ U|D|R|L|{\sl degrees})} 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 - 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.} + {Key-value definition, like {\tt pushkey\_()} but the resulting + macro is defined using {\tt define()} rather than {\tt pushdef().} + \seesect{Macroarguments:}} +\macrodef{setkeys\_}{setkeys_}{({\sl string, key sequence})} + {gen} + {Multiple key-value definition using {\tt define()} rather than + {\tt pushdef().} See macro {\tt pushkeys\_}. + \seesect{Macroarguments:}} \macrodef{setview}{setview}{({\sl azimuth degrees},{\sl elevation degrees})} {3D} {set projection viewpoint} @@ -1850,8 +1886,8 @@ justification})} \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})} @@ -1867,14 +1903,339 @@ justification})} {gen} {sine of an expression in degrees} \macrodef{sinusoid}{sinusoid}{({\sl amplitude, frequency, phase, tmin, -tmax, - linetype})} + 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}} +\macrodef{sl\_box}{sl_box}{({\sl stem linespec, keys, stem object})} + {SLD} + {One-terminal SLD element: argument 1 is a \linespec\ to define the stem + or, in the case of a zero-length stem, one of {\tt U, D, L, R,} or an + angle in degrees, optionally followed by {\tt at {\sl position}}. + The position is {\sl Here} by default. + + Argument 2 contains semicolon (;)-separated key-value attributes + of the head: + {\tt name={\sl{}Name}} (default {\sl Head}); + {\tt lgth={\sl{}expr}}; + {\tt wdth={\sl{}expr}}; + {\tt text="{\sl{}text}"}, + {\tt box={\sl{}box pic attributes}}. + + If argument 3 is null then a plain stem is drawn; if it is of the + form {\tt S:}{\sl keys} or {\tt S$n$:}{\sl keys} an $n$-line slash + symbol is overlaid on the stem; otherwise the keys are for an overlaid + breaker, so that a {\tt C} specifies a default closed breaker, {\tt + O} an open breaker, {\tt X,} {\tt /,} or \bsl\ for these marks, or + \MR{sl_ttbox}{\tt sl\_ttbox} key-value pairs defining box attributes + for the breaker (default name {\sl Br}) + + \seesect{SingleLine:}} +\macrodef{sl\_breaker}{sl_breaker}{({\sl linespec,} {\tt type=[A|C][D];} + {\sl ttbox args})} + {SLD} + {Two-terminal SLD element: + type {\tt A} (the default) is for a box breaker; type + {\tt C} for a curved breaker; adding a {\tt D} puts drawout elements + in the input and output leads. + Otherwise, the arguments are as for + \MR{sl_ttbox}{\tt sl\_ttbox} + \seesect{SingleLine:}} +\macrodef{sl\_busbar}{sl_busbar}{({\sl linespec, np, keys})} + {SLD} + {Composite SLD element drawn in a {\tt [ ]} block. A busbar is + essentially a thick straight line + drawn along the {\sl linespec} with positions evenly distributed + along it. For example, + {\tt line right\_; sl\_busbar(, up\_ 4.5, 5) with .P3 at Here}. + + Argument 1 is a \linespec\ to define the direction and length of the + busbar (but not its position, since it is drawn in a {\tt [ ]} block). + + Argument 2 is the number $np$ of evenly spaced positions + $P1, P2, \ldots Pnp$ along the line with $P1$ and $Pnp$ indented + from the ends of the line. + + Argument 3 contains semicolon (;)-separated key-value attributes + of the line: + {\tt port=D} (for a dot at each port position); + {\tt line=}{\sl pic line attributes}. + {\tt indent=}{\sl indent distance}. + \seesect{SingleLine:}} +\macrodef{sl\_ct}{sl_ct}{% + ({\tt at}{\sl position},{\sl keys},{\tt R|L|U|D|}{\sl degrees})} + {SLD} + {Composite SLD element drawn in a {\tt [ ]} block: + + The keys are as follows: + {\tt type=L|N|S[n]} (default {\tt L;} {\tt S$n$} draws an $n$-line slash + symbol, default 2); {\tt N} means no stem); + {\tt scale={\sl expr} (default 1.0)}; + {\tt grnd={\sl expr} attached ground at given angle + (type {\tt S} or {\tt N}))}; + {\tt stemlgth={\sl{}expr}}; + {\tt wdth={\sl{}expr}}; + {\tt direct=U|D|L|R|{\sl degrees}} (drawing direction). + + Key {\tt stemlgth} is the length of the leads at the start, centre, and end, + with labeled ends {\sl Tstart, Tc,} and {\sl Tend}. + The {\tt L} (default) variant also defines internal labels + Internal labels {\sl L} and {\sl C} are included. + + Key {\tt scale} allows scaling (default scale 1.0) but, with \dpic, + the {\tt scaled} directive can also be used. + \seesect{SingleLine:}} +\macrodef{sl\_disk}{sl_disk}{({\sl stem linespec, keys, breaker})} + {SLD} + {One-terminal SLD element: argument 1 is a \linespec\ to define the stem + or, in the case of a zero-length stem, one of {\tt U, D, L, R,} or an + angle in degrees, optionally followed by {\tt at {\sl position}}. + The position is {\sl Here} by default. + + Argument 2 contains semicolon (;)-separated key-value attributes + of the head: + {\tt name={\sl{}Name}} (default {\sl Head}); + {\tt text="{\sl{}text}"}; + {\tt diam={\sl{}expr}}; + {\tt circle={\sl{}circle pic attributes}}. + + Argument 3 is null for no breaker in the stem, {\tt C} for a default + closed breaker, {\tt O} for an open breaker, {\tt X,} {\tt /,} or \bsl\ for + these marks, or + \MR{sl_ttbox}{\tt sl\_ttbox} + key-value pairs defining box attributes for the breaker + (default name {\sl Br}) + \label{sl_disk}% + \seesect{SingleLine:}} +\macrodef{sl\_drawout}{sl_drawout}{({\sl linespec, keys,} R)} + {SLD} + {Two-terminal SLD element: argument 1 is a \linespec\ as for ordinary + two-terminal elements. + + Argument 2 contains semicolon (;)-separated key-value body attributes: + {\tt type=T} (for truncated leads); + {\tt lgth={\sl{}expr},} + {\tt wdth={\sl{}expr}} (body size); + {\tt name={\sl{}Name}} (default {\sl Body}); + {\tt line={\sl{}pic line attributes}}; (e.g., {\tt thick 2}) + + Argument 3 is {\tt R} to reverse the direction of the drawn chevrons. + \seesect{SingleLine:}} +\macrodef{sl\_generator}{sl_generator}{({\sl stem linespec, keys, breaker})} + {SLD} + {One-terminal SLD element: argument 2 is + {\tt type=AC|WT|BS|StatG|PV|Y|Delta} and, + if {\tt type=PV,} the {\tt SL\_box} keys; + otherwise, the {\tt sl\_disk} body keys. + + Argument 3 is null for no breaker in the stem, {\tt C} for a default + closed breaker, {\tt O} for an open breaker, {\tt X,} {\tt /,} or \bsl\ for + these marks, or + \MR{sl_ttbox}{\tt sl\_ttbox} + key-value pairs defining box attributes for the breaker + (default name {\sl Br}) + \seesect{SingleLine:}} +\macrodef{sl\_grid}{sl_grid}{({\sl stem linespec, keys, breaker})} + {SLD} + {One-terminal SLD element: argument 1 is a \linespec\ to define the stem + or, in the case of a zero-length stem, one of {\tt U, D, L, R,} or an + angle in degrees, optionally followed by {\tt at {\sl position}}. + The position is {\sl Here} by default. + + Argument 2 contains semicolon (;)-separated key-value attributes + of the head: + {\tt name={\sl{}Name}} (default {\sl Head}); + {\tt lgth={\sl{}expr}}; + {\tt wdth={\sl{}expr}}. + + Argument 3 is null for no breaker in the stem, {\tt C} for a default + closed breaker, {\tt O} for an open breaker, {\tt X,} {\tt /,} or \bsl\ for + these marks, or + \MR{sl_ttbox}{\tt sl\_ttbox} + key-value pairs defining box attributes for the breaker + (default name {\sl Br}) + \seesect{SingleLine:}} +\macrodef{sl\_inverter}{sl_inverter}{({\sl ttbox args})} + {SLD} + {Two-terminal SLD element: the arguments are as for + \MR{sl_ttbox}{\tt sl\_ttbox} + \seesect{SingleLine:}} +\macrodef{sl\_lamp}{sl_lamp}{({\sl stem linespec, keys, breaker})} + {SLD} + {One-terminal SLD element: the arguments are as for + \MR{sl_disk}{\tt sl\_disk} + \seesect{SingleLine:}} +\macrodef{sl\_load}{sl_load}{({\sl stem linespec, keys, breaker})} + {SLD} + {One-terminal SLD element: argument 1 is a \linespec\ to define the stem + or, in the case of a zero-length stem, one of {\tt U, D, L, R,} or an + angle in degrees, optionally followed by {\tt at {\sl position}}. + The position is {\sl Here} by default. + + Argument 2 contains semicolon (;)-separated key-value attributes + of the head: + {\tt name={\sl{}Name}} (default {\sl Head}); + {\tt lgth={\sl{}expr}}; + {\tt wdth={\sl{}expr}}; + {\tt head={\sl{}arrowhead pic attributes}}. + + Argument 3 is null for no breaker in the stem, {\tt C} for a default + closed breaker, {\tt O} for an open breaker, {\tt X,} {\tt /,} or \bsl\ for + these marks, or + \MR{sl_ttbox}{\tt sl\_ttbox} + key-value pairs defining box attributes for the breaker + (default name {\sl Br}) + \seesect{SingleLine:}} +\macrodef{sl\_meterbox}{sl_meterbox}{({\sl stem linespec, keys, breaker})} + {SLD} + {One-terminal SLD element: argument 1 is a \linespec\ to define the stem + or, in the case of a zero-length stem, one of {\tt U, D, L, R,} or an + angle in degrees, optionally followed by {\tt at {\sl position}}. + The position is {\sl Here} by default. + + Argument 2 contains semicolon (;)-separated key-value attributes + of the head: + {\tt name={\sl{}Name}} (default {\sl Head}); + {\tt lgth={\sl{}expr}}; + {\tt wdth={\sl{}expr}}; + {\tt text="{\sl{}text}"}, + {\tt box={\sl{}box pic attributes}}. + + Argument 3 is null for no breaker in the stem, {\tt C} for a default + closed breaker, {\tt O} for an open breaker, {\tt X,} {\tt /,} or \bsl\ for + these marks, or + \MR{sl_ttbox}{\tt sl\_ttbox} + key-value pairs defining box attributes for the breaker + (default name {\sl Br}) + \seesect{SingleLine:}} +\macrodef{sl\_reactor}{sl_reactor}{({\sl stem linespec, keys, breaker keys, + breaker keys})} + {SLD} + {Two-terminal SLD element: argument 1 is a \linespec\ as for ordinary + two-terminal elements. + + Argument 2 contains semicolon (;)-separated key-value body attributes: + {\tt name={\sl{}Name}} (default {\sl Body}); + {\tt diam={\sl{}expr}}. + + Argument 3 is null for no breaker in the input lead, {\tt C} for a default + closed breaker, {\tt O} for an open breaker, {\tt X,} {\tt /,} or \bsl\ for + these marks, or + key-value pairs as above defining breaker attributes + except that the default breaker name is {\sl BrI}. + + Argument 4 defines the breaker in the output lead as for argument 3 + except that the default breaker name is {\sl BrO}. + \seesect{SingleLine:}} +\macrodef{sl\_rectifier}{sl_rectifier}{({\sl ttbox args})} + {SLD} + {Two-terminal SLD element: the arguments are as for + \MR{sl_ttbox}{\tt sl\_ttbox} + \seesect{SingleLine:}} +\macrodef{sl\_slash}{sl_slash}{(at {\sl position, keys,} + [$n$:]R|L|U|D|{\sl degrees})} + {SLD} + {Slash symbol for SLD elements: draws $n$ slashes in a {\tt [] } block. + The keys are + {\tt lines={\sl line attributes,} e.g., dotted thick {\sl expr}}; + {\tt size=}{\sl expr} (default {\tt ht dimen\_/3}). + \seesect{SingleLine:}} +% +\macrodef{sl\_transformer}{sl_transformer}{({\sl linespec, keys, + input breaker keys, output breaker keys, + input circle inner object, output circle inner object})} + {SLD} + {Two-terminal SLD element: argument 1 is a \linespec\ as for ordinary + two-terminal elements. + + Argument 2 contains semicolon (;)-separated key-value body attributes: + {\tt name={\sl{}Name}} (default {\sl Body}); + {\tt scale={\sl expr}} (body size factor, default 1.0); + {\tt type=I|S|A[R]} (default {\tt I}). + + Additional type {\tt I} keys are + {\tt cycles={\sl{}integer}} (default 4); + {\tt core=A|M[$n$]|P[$n$]|K[$n$]}, $n$={\sl integer} (default 2 lines). + + Additional type {\tt S} keys are + {\tt body={\sl circle pic attributes}} e.g., {\tt shaded "{\sl color}"}. + + Type {\tt A} keys are + {\tt body={\sl circle pic attributes}}. Type {\tt AR} means right + orientation. + + Argument 3 is null for no breaker in the input lead, {\tt C} for a default + closed breaker, {\tt O} for an open breaker, {\tt X,} {\tt /,} or \bsl\ for + these marks, or + key-value pairs as above defining breaker attributes + except that the default breaker name is {\sl BrI}. + + Argument 4 defines the breaker in the output lead as for argument 3 + except that the default breaker name is {\sl BrO}. + + Argumentss 5 and 6 for the input and output circles respectively are: + {\tt Y} for a Y-symbol; + {\tt YN} for a Y-symbol with ground; + {\tt Delta} for a $\Delta$ symbol; + otherwise, other customization commands expanded in a {\tt \lbr\rbr} pair. + \seesect{SingleLine:}} +% +\macrodef{sl\_transformer3}{sl_transformer3}{({\sl linespec, keys, + breaker keys, symbol keys})} + {SLD} + {Composite (block) SLD element: argument 1 is a \linespec\ that can be used + to set the direction and distance between primary terminals but not + position. + + Argument 2 contains semicolon (;)-separated key-value body attributes: + {\tt name={\sl{}Name}} (default {\sl Body}); + {\tt type=S|C} (default {\tt S}); + {\tt scale={\sl expr}} (body size factor, default 1.0); + {\tt direct=L|R} (default {\tt L}) direction of the tertiary + circle and terminal relative to the drawing direction; + {\tt body={\sl circle attributes}}. + + Argument 3 is colon (:)-separated sequence of up to three breaker + attribute specifications for the input, output, and teriary breaker + in order. A null or blank means no breaker, {\tt tt\_breaker} + specifications otherwise. Default breaker names are {\sl BrI} + and {\sl BrO} as for + {\tt sl\_transformer,} and {\sl Br} for the third breaker. + + Argument 4 is colon (:)-separated sequence of up to three symbol + specifications for the input, output, and teriary circle + in order. A null or blank means no symbol; + {\tt Y} for a Y-symbol; + {\tt Delta} for a $\Delta$ symbol; + otherwise, other customization commands expanded in a {\tt \lbr\rbr} pair. + \seesect{SingleLine:}} +\macrodef{sl\_ttbox}{sl_ttbox}{({\sl linespec, keys, input breaker keys, + output breaker keys})} + {SLD} + {Two-terminal SLD element: argument 1 is a \linespec\ as for ordinary + two-terminal elements. + + Argument 2 contains semicolon (;)-separated key-value body attributes: + {\tt name={\sl{}Name}} (default {\sl Body}); + {\tt lgth={\sl{}expr}}; + {\tt wdth={\sl{}expr}}; + {\tt text="{\sl{}text}"}; + {\tt box={\sl{}box pic attributes}}; + {\tt supp={\sl{}additional {\tt rotbox} commands}}. + + Argument 3 is null for no breaker in the input lead, {\tt C} for a default + closed breaker, {\tt O} for an open breaker, {\tt X,} {\tt /,} or \bsl\ for + these marks, or + key-value pairs as above defining breaker attributes + except that the default breaker name is {\sl BrI}. + + Argument 4 defines the breaker in the output lead as for argument 3 + except that the default breaker name is {\sl BrO}. + \label{sl_ttbox}% + \seesect{SingleLine:}} \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)} diff --git a/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic b/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic index d53fdd4c136..fc3ec3f62cd 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic +++ b/Master/texmf-dist/doc/latex/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 "dpictools.pic" -# Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under # +# Circuit_macros Version 9.8, copyright (c) 2022 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 # @@ -99,6 +99,12 @@ define cross3 { # $1 . $2 define dot3 {($1[1]*$2[1]+$1[2]*$2[2]+$1[3]*$2[3])} +# $3 = $1 * $2 +define sprod3 { + $3[1]=($1)*$2[1] + $3[2]=($1)*$2[2] + $3[3]=($1)*$2[3]} + # |$1| define length3 { sqrt($1[1]^2+$1[2]^2+$1[3]^2) } @@ -253,6 +259,15 @@ define dpquicksort { [ if $3 > $2 then { # Evaluates to a rotated pair (like m4 rot_ ) define dprot { cos($1)*($2)-sin($1)*($3),sin($1)*($2)+cos($1)*($3) } +# dprtext(degrees,text) +# Rotated pstricks or pgf text in a [] box +define dprtext {[ if "$1"=="" then { a = 90 } else { a = $1 } + if dpicopt==optPSTricks then { + sprintf("\rput[c]{%g}(0,0)",a)+"{$2}"} else { + if dpicopt==optPGF then { + sprintf("\pgftext[rotate=%g]",a)+"{$2}" } else { "$2" }} + ]} + # rgbtohsv(r,g,b,h,s,v) # rgb color triple to hsv with h range 0 to 360 define rgbtohsv { $4 = 0; $5 = 0; $6 = 0 @@ -450,6 +465,91 @@ if "cosh"=="co"+"sh" then { define sinh {((expe($1) - expe(-($1)))/2)} } +## dpic equivalents or almost equivalents to libgen.m4 routines ######## +## Including them here has to be regarded as experimental for now ###### + +define cosd {cos(($1)*dtor_)} +define sind {sin(($1)*dtor_)} + +define ceiling {(-floor(-($1)))} +define round_ {int($1+sign($1)/2)} + +define bp__ {*(scale/72)} # Absolute Adobe point +define pt__ {*(scale/72.27)} # Absolute TeX point +define pc__ {*(12*scale/72.27)} # Absolute Pica +define in__ {*scale} # Absolute inch +define cm__ {*(scale/2.54)} # Absolute cm +define mm__ {*(scale/25.4)} # Absolute mm +define lthick {(linethick bp__)} +if dpicopt==optSVG then { define px__ {*(scale/dpPPI)} } \ +else { define px__ {*(scale/96)} } # Absolute pixels + +rtod_ = 57.295779513082323 +dtor_ = 0.017453292519943295 +twopi_ = 6.2831853071795862 +pi_ = twopi_/2 +# Polar to rectangular conversion +define Rect_ {($1)*cos(($2)*dtor_),($1)*sin(($2)*dtor_)} + +# intersect_(Start1,End1,Start2,End2) +# Intersection of lines joining named positions +define intersect_ {((($3.x-$1.x)*($3.y-$4.y)-($3.y-$1.y)*($3.x-$4.x))/\ + (($2.x-$1.x)*($3.y-$4.y)-($2.y-$1.y)*($3.x-$4.x)) \ + between $1 and $2) } +# Intersect_(Name1,Name2) +# Intersection of named lines +define Intersect_ {intersect_($1.start,$1.end,$2.start,$2.end)} + +# drawdir_(degrees) +# Nearest multiple of 90 +define drawdir_ {(int(pmod($1+45,360)/90)*90)} + +# vlength(x,y) 2-D vector length +define vlength {sqrt(abs(($1)^2+($2)^2))} + +# distance(Pos1,Pos2) distance between positions +define distance {vlength(($1).x-($2).x,($1).y-($2).y)} + +# For PGF, PSTricks, or SVG only: +define dpshade { beginshade($1); $2; endshade } # like libgen shade() + +# beginshade +if dpicopt==optPGF then { + define beginshade { if "$1"!="" then { dpshade_=$1 } else { dpshade_=0.5 } + command "\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{}" + command "\global\def\dpicstop{--}" + command sprintf("\dpicshdraw[fill=white!%g!black]",dpshade_*100) } } \ +else { if dpicopt==optPSTricks then { + define beginshade { if "$1"!="" then { dpshade_=$1 } else { dpshade_=0.5 } + command sprintf("\newgray{m4fillv}{%g}",dpshade_) + command sprintf("\pscustom[fillstyle=solid,fillcolor=m4fillv]{%%") } } \ +else { if dpicopt==optSVG then { + define beginshade { if "$1"!="" then { dpshade_=$1 } else { dpshade_=0.5 } + command sprintf("",int(dpshade_*255+0.5),\ + int(dpshade_*255+0.5),int(dpshade_*255+0.5))} } }} + +# endshade +if dpicopt==optPGF then { + define endshade {command "cycle; \ + \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;}"} } \ +else { if dpicopt==optPSTricks then { + define endshade {command "}%"} } \ +else { if dpicopt==optSVG then { + define endshade { command ""} } }} + +# rgbstring +if dpicopt==optPGF then { + define rgbstring \ + {sprintf("{rgb,1:red,%7.5f;green,%7.5f;blue,%7.5f}",$1,$2,$3)} } \ +else { if dpicopt==optPSTricks then { + define rgbstring \ + {sprintf("{rgb,1:red,%7.5f;green,%7.5f;blue,%7.5f}",$1,$2,$3)} } \ +else { if dpicopt==optSVG then { + define rgbstring {sprintf("rgb(%g,%g,%g)",\ + int(($1)*255+0.5),int(($2)*255+0.5),int(($3)*255+0.5))} } }} + +####################################################################### + # print " *** dpic: dpictools.pic processed" -define dpictools {1} +define dpictools_ {1} # dpictools end diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Arrester.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Arrester.m4 deleted file mode 100644 index 791a2f21623..00000000000 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/Arrester.m4 +++ /dev/null @@ -1,28 +0,0 @@ -.PS -# Arrester.m4 -cct_init - -divert(-1) - -divert(0)dnl - -movewid = movewid/2 - M: arrester - {"\tt arr{}ester()" at last [].s below} - N: arrester(,D) with .A at M.end+(movewid,0) - {"\strut\tt $\cdots$(,D)" at last [].s below} - P: arrester(,LD) with .A at N.B+(movewid,0) - {"\tt (,LD)" at last [].s below} - move; H: arrester(,S) - {"\tt (,S)" at last [].s below} - move; Q: arrester(,E) - {"\tt (,E)" at last [].s below} - R: arrester(,ED) with .A at Q.end+(movewid,0) - {"\tt $\cdots$(,ED)" at last [].s below} - thinlines_ - Loopover_(`X', - `spline <- from X.A up 8bp__ then up 6bp__ right 4bp__; "\sl A" ljust - spline <- from X.B up 8bp__ then up 6bp__ left 4bp__; "\sl B" rjust - arrow <- from X.G right 12bp__ up 2bp__; "\sl G" ljust',N,R) - -.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Arresters.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Arresters.m4 new file mode 100644 index 00000000000..25dd8a8e33f --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Arresters.m4 @@ -0,0 +1,75 @@ +.PS +# Arresters.m4 +cct_init + + sep = 0.2 + +R1: [ + arrester + {`"\tt arrester"' at last line.c+(0,-0.2)} + move sep + arrester(,G) + {`"\tt arrester(,G)"' at last line.c+(0,-0.2)} + move sep + arrester(,g) + {`"\tt ...(,g)"' at last line.c+(0,-0.2)} + move sep + arrester(,M) + {`"\tt \ldots(,M)"' at last line.c+(0,-0.2)} + move sep + arrester(,C) + {`"\tt \ldots(,C)"' at last line.c+(0,-0.2)} + move sep + arrester(,A) + {`"\tt \ldots(,A)"' at last line.c+(0,-0.2)} + ] + +R2: [ + arrester(,H) + {`"\tt \ldots(,H)"' at last line.c+(0,-0.2)} + move sep + arrester(,HR) + {`"\tt \ldots(,HR)"' at last line.c+(0,-0.2)} + move sep + arrester(,P) + {`"\tt \ldots(,P)"' at last line.c+(0,-0.2)} + move sep + arrester(,s) + {`"\tt \ldots(,s)"' at last line.c+(0,-0.2)} + move sep + arrester(,F) + {`"\tt \ldots(,F)"' at last line.c+(0,-0.2)} + move sep + arrester(,S) + {`"\tt \ldots(,S)"' at last line.c+(0,-0.2)} + + ] with .nw at R1.sw+(0,-0.2) + + define(`Dlabels', + `{ thinlines_ + arrow <- from A.A up 0.1 left 0.1; "\sl A" rjust + arrow <- from A.B up 0.1 right 0.1; "\sl B" ljust + arrow <- from A.G up 0.05 right 0.15; "\sl G" ljust + thicklines_ }') +[ + arrester(,E) + {`"\tt \ldots(,E)"' at last line.c+(0,-0.25)} + move sep + A: arrester(,DE) + {`"\tt \ldots(,DE)"' at last [].s+(0,-0.1)} + Dlabels + move sep*3 + A: arrester(,DS) + {`"\tt \ldots(,DS)"' at last [].s+(0,-0.1)} + Dlabels + move sep*3 + A: arrester(,DEL) + {`"\tt \ldots(,DEL)"' at last [].s+(0,-0.1)} + Dlabels + move sep*3 + A: arrester(,DSL) + {`"\tt \ldots(,DSL)"' at last [].s+(0,-0.1)} + Dlabels + ] with .nw at R2.sw+(0,-0.2) + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Consumption.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Consumption.m4 new file mode 100644 index 00000000000..3b165abb7f0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Consumption.m4 @@ -0,0 +1,524 @@ +.PS +# Consumption+.m4 +gen_init +{\sf +sinclude(examples.dim) +sinclude(tst.dim) +s_init(test) + +#nl raw data ranges + rxmin=1.76665, rxmax=5.87332, rymin=1.49164, rymax=4.00836 + +#nl horiz range + yearmin = 1850 + yearmax = 2040 +#nl data ranges + tonsmin = 0 + tonsmax = 2.0 + popmin = 0 + popmax = 10 +#nl page graph size + minx = 0 + maxx = 4.5 + maxx = 4.566 + miny = 0 + maxy = 3.5 + +define dtop {(minx + ($1-yearmin)/(yearmax-yearmin)*(maxx-minx), \ + miny + ($2-tonsmin)/(tonsmax-tonsmin)*(maxy-miny))} +define ptop {(minx + ($1-yearmin)/(yearmax-yearmin)*(maxx-minx), \ + miny + ($2-popmin)/(popmax-popmin)*(maxy-miny))} + +define(`rtod',`yearmin + (`$1'-rxmin)/(rxmax-rxmin)*(2010-yearmin), \ + tonsmin + (`$2'-rymin)/(rymax-rymin)*1.8') + +[ +nD = 0 +define data { nD+=1 + yr[nD]=$1; pop[nD]=$2/1e9; wood[nD]=$3; other[nD]=$4; hydro[nD]=$5 + coal[nD]=$6; oil[nD]=$7; gas[nD]=$8; nuclear[nD]=$9 } + +data(1850,1241000000,0.238506368,0.238506368,0.238506368,0.274220157,0.274220157,0.276138711,0.276138711) +data(1851,1247847137,0.238701076,0.238701076,0.238701076,0.2788137,0.2788137,0.280785327,0.280785327) +data(1852,1254732053,0.238886465,0.238886465,0.238886465,0.287918165,0.287918165,0.289942225,0.289942225) +data(1853,1261654955,0.239062633,0.239062633,0.239062633,0.290097546,0.290097546,0.292173405,0.292173405) +data(1854,1268616055,0.239229675,0.239229675,0.239229675,0.289984551,0.289984551,0.292111579,0.292111579) +data(1855,1275615561,0.239387687,0.239387687,0.239387687,0.289864062,0.289864062,0.292041635,0.292041635) +data(1856,1282653687,0.239651345,0.239651345,0.239651345,0.301026039,0.301026039,0.303253538,0.303253538) +data(1857,1289730646,0.239904902,0.239904902,0.239904902,0.298720029,0.298720029,0.300996841,0.300996841) +data(1858,1296846651,0.24014846,0.24014846,0.24014846,0.303062054,0.303062054,0.30538757,0.30538757) +data(1859,1304001918,0.240382123,0.240382123,0.240382123,0.309545901,0.309914765,0.312288384,0.312288384) +data(1860,1311196664,0.24060599,0.24060599,0.24060599,0.309390256,0.310123937,0.312545059,0.312545059) +data(1861,1318431107,0.240590657,0.240590657,0.240590657,0.319869525,0.320964008,0.323432041,0.323432041) +data(1862,1325705465,0.240568247,0.240568247,0.240568247,0.308599723,0.310051026,0.312565381,0.312565381) +data(1863,1333019958,0.24053884,0.24053884,0.24053884,0.318950063,0.320754238,0.323314334,0.323314334) +data(1864,1340374810,0.240502511,0.240502511,0.240502511,0.327038715,0.329191844,0.331797103,0.331797103) +data(1865,1347770241,0.240459339,0.240459339,0.240459339,0.328647778,0.331145979,0.333795828,0.333795828) +data(1866,1347770241,0.242191279,0.242191279,0.242191279,0.330379718,0.333234804,0.335943539,0.335943539) +data(1867,1362683739,0.241253672,0.241253672,0.241253672,0.336892133,0.340068952,0.342806283,0.342806283) +data(1868,1370202258,0.24163346,0.24163346,0.24163346,0.336747138,0.340257568,0.3430378,0.3430378) +data(1869,1377762260,0.242001817,0.242001817,0.242001817,0.33659359,0.340433875,0.343256455,0.343256455) +data(1870,1385363974,0.242358855,0.242358855,0.242358855,0.348847699,0.353014113,0.355878493,0.355878493) +data(1871,1393007630,0.24215233,0.24215233,0.24215233,0.358346838,0.362835686,0.365741322,0.365741322) +data(1872,1400693459,0.241940775,0.241940775,0.241940775,0.365684522,0.37049214,0.373438493,0.373438493) +data(1873,1408421694,0.24172425,0.24172425,0.24172425,0.360718048,0.365840803,0.368827338,0.368827338) +data(1874,1416192570,0.241502816,0.241502816,0.241502816,0.363892286,0.369326575,0.372352763,0.372352763) +data(1875,1424006320,0.241276535,0.241276535,0.241276535,0.362994434,0.368736684,0.371802,0.371802) +data(1876,1431863183,0.240604702,0.240604702,0.240604702,0.369663316,0.375709983,0.378813907,0.378813907) +data(1877,1439763395,0.239932976,0.239932976,0.239932976,0.368283426,0.374630997,0.377773011,0.377773011) +data(1878,1447707196,0.239261379,0.239261379,0.239261379,0.366907548,0.373552539,0.376732133,0.376732133) +data(1879,1455694826,0.238589927,0.238589927,0.238589927,0.373413172,0.380352127,0.383568794,0.383568794) +data(1880,1463726528,0.23791864,0.23791864,0.23791864,0.383753486,0.390982979,0.394236217,0.394236217) +data(1881,1471802544,0.237570608,0.237570608,0.237570608,0.392344331,0.399860965,0.403150275,0.403150275) +data(1882,1479923119,0.237219231,0.237219231,0.237227977,0.396963826,0.404764232,0.40808912,0.40808912) +data(1883,1488088499,0.236864558,0.236864558,0.236881953,0.403447314,0.411528151,0.414888128,0.414888128) +data(1884,1496298931,0.236506634,0.236506634,0.236532584,0.406015836,0.414373792,0.417768372,0.417768372) +data(1885,1504554663,0.236145507,0.236145507,0.236179917,0.404733187,0.413364978,0.416793681,0.416793681) +data(1886,1512855946,0.235261191,0.235261191,0.235303968,0.40293236,0.411834727,0.415297076,0.415297076) +data(1887,1521203030,0.23437947,0.23437947,0.23443052,0.406792802,0.415962519,0.419458041,0.419458041) +data(1888,1529596169,0.233500342,0.233500342,0.233559574,0.423718314,0.433152176,0.436680404,0.436680404) +data(1889,1538035617,0.232623805,0.232623805,0.232691127,0.425534315,0.435229149,0.438789617,0.438789617) +data(1890,1546521628,0.231749857,0.231749857,0.231825179,0.431025052,0.44097771,0.444569959,0.444569959) +data(1891,1555054461,0.23057828,0.23057828,0.230661512,0.436142504,0.446349864,0.449973439,0.449973439) +data(1892,1563634373,0.229412583,0.229412583,0.229503635,0.439357394,0.449816361,0.453470809,0.453470809) +data(1893,1572261624,0.228252736,0.228252736,0.228351521,0.431583686,0.442291192,0.445976065,0.445976065) +data(1894,1580936476,0.22709871,0.22709871,0.22720514,0.436575574,0.447528576,0.45124343,0.45124343) +data(1895,1589659190,0.225950477,0.225950477,0.226064464,0.441499685,0.452695166,0.456439562,0.456439562) +data(1896,1598430032,0.225392144,0.225392144,0.225513603,0.450527775,0.461962746,0.465736247,0.465736247) +data(1897,1607249265,0.224833135,0.224833135,0.224961981,0.457659825,0.469331318,0.473133492,0.473133492) +data(1898,1616117159,0.224273475,0.224273475,0.224409622,0.473569462,0.48547454,0.489304958,0.489304958) +data(1899,1625033980,0.223713188,0.223713188,0.223856553,0.494583176,0.506718923,0.510577162,0.510577162) +data(1900,1634000000,0.223152296,0.223152296,0.223302795,0.504825195,0.51718872,0.521074359,0.521074359) +data(1901,1648219401,0.221510378,0.221510378,0.221677629,0.505816316,0.519528083,0.5237969,0.5237969) +data(1902,1662562543,0.219880182,0.219880182,0.220068436,0.508573752,0.523333498,0.527978592,0.527978592) +data(1903,1677030501,0.218261627,0.218261627,0.218478353,0.530583699,0.546223844,0.551238406,0.551238406) +data(1904,1691624363,0.216654634,0.216654634,0.216900192,0.527887731,0.545298807,0.550676116,0.550676116) +data(1905,1706345223,0.215059124,0.215059124,0.215337131,0.547716584,0.564693219,0.570426643,0.570426643) +data(1906,1721194188,0.214836225,0.214836225,0.215148552,0.563118074,0.579880854,0.585963848,0.585963848) +data(1907,1736172371,0.214601167,0.214601167,0.214954035,0.596547339,0.617095414,0.62352152,0.62352152) +data(1908,1751280897,0.214354174,0.214354174,0.214752998,0.574277169,0.596299335,0.60306218,0.60306218) +data(1909,1766520901,0.214095471,0.214095471,0.214542936,0.586977877,0.609919015,0.61701231,0.61701231) +data(1910,1781893526,0.213825278,0.213825278,0.214318488,0.603352348,0.628089516,0.635693908,0.635693908) +data(1911,1797399927,0.212500054,0.212500054,0.213041248,0.605588411,0.631564823,0.639504319,0.639504319) +data(1912,1813041268,0.211181781,0.211181781,0.211751647,0.620130467,0.646297549,0.654565803,0.654565803) +data(1913,1828818723,0.209870438,0.209870438,0.210513435,0.644310839,0.672912362,0.681503109,0.681503109) +data(1914,1844733476,0.208566004,0.208566004,0.209324315,0.595307622,0.624513467,0.633420528,0.633420528) +data(1915,1860786724,0.207268457,0.207268457,0.208098411,0.584702733,0.615780985,0.624998263,0.624998263) +data(1916,1876979669,0.204485426,0.204485975,0.205402589,0.605882504,0.638934007,0.648455487,0.648455487) +data(1917,1893313529,0.201734987,0.201735896,0.202715085,0.616179081,0.652399178,0.662218924,0.662218924) +data(1918,1909789530,0.199016787,0.199017732,0.200115349,0.602687652,0.638337653,0.648449811,0.648449811) +data(1919,1926408908,0.196330472,0.196331097,0.196945715,0.535439366,0.575689906,0.586088699,0.586088699) +data(1920,1943172912,0.193675695,0.193676005,0.195243412,0.579848388,0.630973534,0.641653264,0.641653264) +data(1921,1960082799,0.192957547,0.192958381,0.194440762,0.512833825,0.567705487,0.578660532,0.578660532) +data(1922,1977139839,0.192237376,0.192238246,0.193895625,0.527050727,0.587771773,0.599365431,0.599365431) +data(1923,1994345313,0.19151527,0.191516348,0.193525554,0.578230714,0.649426509,0.662893064,0.662893064) +data(1924,2011700513,0.190791315,0.190792469,0.192986897,0.564368556,0.634750802,0.650057077,0.650057077) +data(1925,2029206742,0.190065598,0.190066911,0.192579912,0.561692328,0.634850472,0.651963721,0.651963721) +data(1926,2046865313,0.189342426,0.18934419,0.192313939,0.556598403,0.631036129,0.649924035,0.649924035) +data(1927,2064677552,0.188617585,0.188619709,0.191901916,0.581066305,0.66532014,0.685950808,0.685950808) +data(1928,2082644798,0.187891159,0.187893595,0.191560967,0.570524051,0.658240401,0.680582356,0.680582356) +data(1929,2082644798,0.188791962,0.188794439,0.19317309,0.596191895,0.694524554,0.718247863,0.718247863) +data(1930,2119049713,0.186433874,0.186436187,0.190385499,0.552331717,0.644491424,0.668934944,0.668934944) +data(1931,2137490116,0.185921585,0.185923717,0.190113868,0.506565457,0.594964462,0.620348577,0.620348577) +data(1932,2156090991,0.185404259,0.185406253,0.189724679,0.468661357,0.552304395,0.578611056,0.578611056) +data(1933,2174853735,0.184882022,0.184885026,0.189466471,0.478973885,0.569521584,0.596732983,0.596732983) +data(1934,2193779755,0.184354996,0.184357857,0.189137885,0.50231919,0.597048389,0.625146959,0.625146959) +data(1935,2212870475,0.183823303,0.183826489,0.189391253,0.513244919,0.615346693,0.6443151,0.6443151) +data(1936,2232127325,0.183422624,0.183426207,0.189292235,0.541976812,0.652213355,0.6820345,0.6820345) +data(1937,2251551752,0.183015177,0.183016132,0.189691455,0.557024422,0.681411525,0.713128315,0.713128315) +data(1938,2271145215,0.182601109,0.182608794,0.189219601,0.528985648,0.649365004,0.682755166,0.682755166) +data(1939,2290909184,0.182180563,0.182198879,0.189050477,0.544855454,0.669193862,0.704673928,0.704673928) +data(1940,2310845143,0.181753683,0.181773628,0.188817984,0.577859192,0.705095325,0.742626751,0.742626751) +data(1941,2330954589,0.180256141,0.180280081,0.187681608,0.587475315,0.717410922,0.756955672,0.756955672) +data(1942,2351239032,0.17877091,0.178803567,0.18636161,0.589499673,0.710751063,0.752271606,0.752271606) +data(1943,2371699993,0.17729789,0.177330845,0.185849103,0.596589637,0.725948747,0.769408049,0.769408049) +data(1944,2392339011,0.17583698,0.175847008,0.183932936,0.574921594,0.722215099,0.767576618,0.767576618) +data(1945,2413157633,0.174388081,0.174391359,0.182283924,0.493293215,0.63914527,0.68637295,0.68637295) +data(1946,2434157423,0.173522919,0.173531361,0.182267965,0.514250229,0.668057865,0.717384008,0.717384008) +data(1947,2455339957,0.172659705,0.172683238,0.181755468,0.551547112,0.719518964,0.773619655,0.773619655) +data(1948,2476706827,0.17179847,0.171828917,0.181742644,0.560535238,0.749010917,0.809647204,0.809647204) +data(1949,2498259635,0.170939245,0.17097559,0.181133719,0.538171636,0.723949765,0.788183962,0.788183962) +data(1950,2557628654,0.167579756,0.167622721,0.178408185,0.559396293,0.762977841,0.834822272,0.834822272) +data(1951,2594938936,0.167032664,0.167085184,0.179115513,0.574723533,0.802272625,0.886283415,0.886283415) +data(1952,2636770386,0.166215588,0.166275557,0.178905263,0.565999791,0.801386992,0.890443027,0.890443027) +data(1953,2682050452,0.165211328,0.165271599,0.178153454,0.56040182,0.805094458,0.897685967,0.897685967) +data(1954,2730224110,0.164066346,0.164125585,0.177552809,0.548214509,0.799870041,0.895277726,0.895277726) +data(1955,2782093851,0.162744571,0.162802026,0.177062242,0.572289721,0.849071541,0.950920777,0.950920777) +data(1956,2835293441,0.161343608,0.161397559,0.176802814,0.586639897,0.882197665,0.990604979,0.990610309) +data(1957,2891342302,0.159836585,0.159890471,0.176313385,0.589494533,0.894932945,1.010584994,1.010622753) +data(1958,2948128605,0.158347259,0.158403549,0.176092897,0.594122165,0.901178987,1.023306716,1.023348608) +data(1959,3000706677,0.157134282,0.157194027,0.175092878,0.60075882,0.926301469,1.060278841,1.060403012) +data(1960,3042990271,0.156490706,0.156555865,0.175795691,0.61309257,0.958977014,1.102738263,1.102971765) +data(1961,3084007286,0.155724141,0.155801371,0.175847845,0.582341401,0.945610971,1.097964839,1.098333034) +data(1962,3140187350,0.154229357,0.154309778,0.175037739,0.583886676,0.970894477,1.134494733,1.135032498) +data(1963,3209978774,0.152139251,0.152229147,0.173552486,0.585699084,0.991892736,1.166953505,1.167858812) +data(1964,3281412257,0.150062967,0.150160837,0.171811855,0.592867755,1.021995792,1.209049525,1.210281169) +data(1965,3350699989,0.14816998,0.148271574,0.171655685,0.592192206,1.043069039,1.239349435,1.241269627) +data(1966,3421015609,0.147131043,0.14723349,0.171776593,0.589397107,1.068586677,1.275452622,1.27813231) +data(1967,3490735455,0.146158896,0.14626543,0.170803075,0.56557596,1.069927556,1.288070014,1.291237119) +data(1968,3562786611,0.145129793,0.1452355,0.170411047,0.568040201,1.107666962,1.34146315,1.345320724) +data(1969,3637707956,0.14402776,0.144141478,0.170254838,0.567570209,1.136409991,1.38786865,1.392325229) +data(1970,3713327898,0.142943308,0.143053274,0.169862261,0.574604634,1.187424472,1.460093809,1.4656198) +data(1971,3790980082,0.141867123,0.1419725,0.169518561,0.562377273,1.199174341,1.484731543,1.492185663) +data(1972,3867242256,0.14088476,0.141006603,0.169241956,0.55299154,1.211873977,1.508449967,1.518429829) +data(1973,3942790520,0.139965732,0.140098019,0.168229646,0.551337808,1.256519325,1.5637256,1.576827076) +data(1974,4017323955,0.139116394,0.139264313,0.169566501,0.548855283,1.243354913,1.55159078,1.568155026) +data(1975,4088810897,0.138401041,0.13856795,0.16866321,0.563492361,1.21131787,1.515162671,1.537578295) +data(1976,4158888836,0.137644673,0.137823056,0.167542119,0.566773642,1.257660106,1.569161684,1.594857237) +data(1977,4229748034,0.136888084,0.137068744,0.166990254,0.571441309,1.275256046,1.610533422,1.641644931) +data(1978,4300631215,0.136155668,0.136323913,0.168223987,0.572181835,1.27205561,1.591706702,1.627562741) +data(1979,4374349678,0.135359212,0.13557451,0.168367796,0.588798681,1.303224877,1.642092677,1.678738222) +data(1980,4445423675,0.13466922,0.135694224,0.169018612,0.535103352,1.264795628,1.575204786,1.612060086) +data(1981,4526817917,0.134213008,0.135336361,0.168515198,0.530410164,1.209074468,1.518426926,1.559512282) +data(1982,4607193353,0.133802494,0.135342954,0.168753641,0.536996737,1.176267133,1.47980709,1.52463367) +data(1983,4688582743,0.133377208,0.135246041,0.169576319,0.532088682,1.158420925,1.46002144,1.510279864) +data(1984,4767669177,0.133030663,0.135364454,0.170242063,0.54694641,1.180279911,1.506703536,1.566412047) +data(1985,4849860549,0.132610473,0.135051242,0.169658748,0.552747513,1.171095757,1.504285752,1.573424331) +data(1986,4934211409,0.131291387,0.133685377,0.168393392,0.554194404,1.186400652,1.520044231,1.593296333) +data(1987,5021085089,0.129951317,0.132539382,0.166722644,0.554231496,1.181208808,1.524791298,1.603295671) +data(1988,5108736553,0.128637242,0.13125772,0.166140318,0.556210491,1.195203161,1.549641815,1.633219996) +data(1989,5195979089,0.127377522,0.13079373,0.164881748,0.553926742,1.193159265,1.553390392,1.638232703) +data(1990,5284252039,0.126134805,0.129737215,0.164632138,0.553384674,1.190735096,1.553386431,1.640350219) +data(1991,5367488662,0.125428663,0.12928236,0.164254982,0.528423389,1.154980396,1.516498613,1.613399159) +data(1992,5452187873,0.124710625,0.128643771,0.163153115,0.518552304,1.13735672,1.494240768,1.590566106) +data(1993,5534418049,0.12406988,0.128046593,0.163990775,0.50470235,1.119339298,1.477198192,1.575200738) +data(1994,5614530098,0.123494469,0.127690239,0.163473418,0.506216459,1.12531413,1.481458633,1.580083078) +data(1995,5695823105,0.122909758,0.127213893,0.164248122,0.510641048,1.135855904,1.49167459,1.592774524) +data(1996,5776327747,0.12216812,0.12649691,0.163557636,0.510522671,1.141850345,1.503121808,1.606488473) +data(1997,5854841500,0.121488167,0.12619452,0.163583023,0.524945344,1.167177534,1.523679854,1.624760285) +data(1998,5932024858,0.120853308,0.125593429,0.162567495,0.521014085,1.167330383,1.52595967,1.627688406) +data(1999,6008646651,0.120245994,0.125081498,0.162173341,0.512693203,1.14325022,1.505666716,1.609442579) +data(2000,6084703879,0.119665076,0.124729832,0.16178992,0.513011266,1.158715327,1.529969497,1.634878653) +data(2001,6160890093,0.119894056,0.125258541,0.161095098,0.524198822,1.1611659,1.535602425,1.642047723) +data(2002,6237154134,0.118903979,0.124921559,0.160784753,0.529942594,1.153921617,1.530689162,1.637033401) +data(2003,6313942570,0.117913902,0.124642773,0.160192176,0.546832827,1.182503339,1.566938847,1.670839416) +data(2004,6390636309,0.116923825,0.12432827,0.161759107,0.565673251,1.221114221,1.610936278,1.717713694) +data(2005,6467431499,0.115933748,0.124259776,0.162887647,0.604148825,1.263290753,1.659620623,1.765386482) +data(2006,6545218993,0.114943672,0.124695239,0.164252513,0.623509498,1.274460793,1.680457898,1.786351327) +data(2007,6623523655,0.113953595,0.125629532,0.165251003,0.637952129,1.279256584,1.68820381,1.790810594) +data(2008,6702159402,0.112963518,0.127142703,0.167940953,0.64989848,1.292105043,1.710278853,1.811269586) +data(2009,6780833881,0.111973441,0.127858368,0.168866486,0.654393109,1.282816573,1.686869485,1.785251313) +data(2010,6858584755,0.110983364,0.12921584,0.172117414,0.680609275,1.328410794,1.756431211,1.856334479) +data(2011,6935999491,0.109993287,0.130385385,0.173636892,0.704216284,1.348176864,1.785673581,1.880255695) +data(2012,7013871313,0.10900321,0.130975574,0.175672274,0.688388925,1.341250864,1.785302272,1.872409847) +data(2013,7092128094,0.108013133,0.132480909,0.177353971,0.688378378,1.336238537,1.781754888,1.868322734) +data(2014,7169968185,0.107023056,0.133567224,0.177755023,0.681107631,1.336758872,1.78693987,1.874787234) +data(2015,7247892788,0,0,0,0,0,0,0) +data(2016,7325996709,0,0,0,0,0,0,0) +data(2017,7405107650,0,0,0,0,0,0,0) +nD0=nD-3 + +define yrdata { nyd +=1; yrd[nyd]=$1; ypop[nyd]=$2/1e9 } + +nyd = 0 +yrdata(1850,1169923623) +yrdata(1851,1177298999) +yrdata(1852,1184724181) +yrdata(1853,1192199527) +yrdata(1854,1199725401) +yrdata(1855,1207302168) +yrdata(1856,1214930197) +yrdata(1857,1222609858) +yrdata(1858,1230341525) +yrdata(1859,1238125576) +yrdata(1860,1245962390) +yrdata(1861,1253852349) +yrdata(1862,1261795840) +yrdata(1863,1269793250) +yrdata(1864,1277844972) +yrdata(1865,1285951399) +yrdata(1866,1294112930) +yrdata(1867,1302329966) +yrdata(1868,1310602910) +yrdata(1869,1318932168) +yrdata(1870,1327318152) +yrdata(1871,1335761275) +yrdata(1872,1344261952) +yrdata(1873,1352820603) +yrdata(1874,1361437653) +yrdata(1875,1370113525) +yrdata(1876,1379548537) +yrdata(1877,1389051752) +yrdata(1878,1398623687) +yrdata(1879,1408264863) +yrdata(1880,1417975804) +yrdata(1881,1427757042) +yrdata(1882,1437609109) +yrdata(1883,1447532543) +yrdata(1884,1457527886) +yrdata(1885,1467595685) +yrdata(1886,1477736490) +yrdata(1887,1487950857) +yrdata(1888,1498239345) +yrdata(1889,1508602518) +yrdata(1890,1519040944) +yrdata(1891,1529555197) +yrdata(1892,1540145854) +yrdata(1893,1550813497) +yrdata(1894,1561558712) +yrdata(1895,1572382092) +yrdata(1896,1583284233) +yrdata(1897,1594265734) +yrdata(1898,1605327202) +yrdata(1899,1616469247) +yrdata(1900,1630171098) +yrdata(1901,1644554295) +yrdata(1902,1659067684) +yrdata(1903,1673712471) +yrdata(1904,1688489874) +yrdata(1905,1703401122) +yrdata(1906,1718447458) +yrdata(1907,1733630134) +yrdata(1908,1748950415) +yrdata(1909,1764409579) +yrdata(1910,1780008913) +yrdata(1911,1795749721) +yrdata(1912,1811633314) +yrdata(1913,1827661021) +yrdata(1914,1843834178) +yrdata(1915,1860154139) +yrdata(1916,1876622267) +yrdata(1917,1893239939) +yrdata(1918,1910008546) +yrdata(1919,1926929491) +yrdata(1920,1944419089) +yrdata(1921,1962566145) +yrdata(1922,1980884876) +yrdata(1923,1999376931) +yrdata(1924,2018043972) +yrdata(1925,2023803913) +yrdata(1926,2043462180) +yrdata(1927,2063406322) +yrdata(1928,2082689730) +yrdata(1929,2103850414) +yrdata(1930,2124167500) +yrdata(1931,2143802732) +yrdata(1932,2164157870) +yrdata(1933,2184604692) +yrdata(1934,2205534997) +yrdata(1935,2226530597) +yrdata(1936,2247993326) +yrdata(1937,2268545035) +yrdata(1938,2290267593) +yrdata(1939,2312702889) +yrdata(1940,2350947590) +yrdata(1941,2373554827) +yrdata(1942,2396382640) +yrdata(1943,2419433211) +yrdata(1944,2442708748) +yrdata(1945,2466211477) +yrdata(1946,2489943650) +yrdata(1947,2513907539) +yrdata(1948,2538105439) +yrdata(1949,2562539670) +yrdata(1950,2579434878) +yrdata(1951,2653954580) +yrdata(1952,2692712961) +yrdata(1953,2732388944) +yrdata(1954,2772909569) +yrdata(1955,2814390135) +yrdata(1956,2856675848) +yrdata(1957,2899864004) +yrdata(1958,2943689748) +yrdata(1959,2987555529) +yrdata(1960,3030709021) +yrdata(1961,3090453463) +yrdata(1962,3137151355) +yrdata(1963,3211786601) +yrdata(1964,3270671214) +yrdata(1965,3330055803) +yrdata(1966,3401169329) +yrdata(1967,3463250974) +yrdata(1968,3526647458) +yrdata(1969,3591511933) +yrdata(1970,3657420066) +yrdata(1971,3724116214) +yrdata(1972,3791497136) +yrdata(1973,3859732004) +yrdata(1974,3928723212) +yrdata(1975,3998320921) +yrdata(1976,4080634693) +yrdata(1977,4156349026) +yrdata(1978,4233151108) +yrdata(1979,4311785729) +yrdata(1980,4391777096) +yrdata(1981,4472736872) +yrdata(1982,4555816222) +yrdata(1983,4640588050) +yrdata(1984,4726272158) +yrdata(1985,4813567478) +yrdata(1986,4902566593) +yrdata(1987,4985904892) +yrdata(1988,5070443631) +yrdata(1989,5156030340) +yrdata(1990,5219191372) +yrdata(1991,5304659362) +yrdata(1992,5390911229) +yrdata(1993,5477320137) +yrdata(1994,5564356643) +yrdata(1995,5652711036) +yrdata(1996,5738516173) +yrdata(1997,5824945702) +yrdata(1998,5912061676) +yrdata(1999,5999735497) +yrdata(2000,6088144560) +yrdata(2001,6173932167) +yrdata(2002,6250016823) +yrdata(2003,6326520742) +yrdata(2004,6403805522) +yrdata(2005,6481944062) +yrdata(2006,6525559210) +yrdata(2007,6602274812) +yrdata(2008,6789771253) +yrdata(2009,6873741054) +yrdata(2010,6958169159) +yrdata(2011,7043008586) +yrdata(2012,7128176935) +yrdata(2013,7213426452) +yrdata(2014,7298453033) +yrdata(2015,7383008820) +yrdata(2016,7466964280) +yrdata(2017,7550262101) + + +thinlines_ +Left: line from dtop(yearmin,tonsmin) to dtop(yearmin,tonsmax) + htic = 8pt__ +# htic = maxy + vtic = 13pt__/2 +# vtic = maxy + s_box(0) at dtop(yearmin,tonsmin) rjust above + for y=0.2 to 2 by 0.2 do { + move to dtop(yearmin,y) + if y<2 then {{ line right htic }} + s_box("%g",y) rjust } + rs_box(`Tonnes of oil equivalent per capita') with .e at Left-(0.3,0) + +Right: line from dtop(yearmax,tonsmin) to dtop(yearmax,tonsmax) + for p=0 to popmax do { + move to ptop(yearmax,p) + if p>0 && p + + spline <- from dtop(yr[nD0]-1,0.12) left 0.2 up 0.1 then left 0.55 up 0.05 + s_box(Other renewables) with .b at Here+(-0.4,2pt__) + +# arrow <- from Population.end left 1.25 chop 3pt__ chop 0 +# s_box(`577\,\% of 1850 population') rjust +# arrow <- from NPopulation.end left 1.25 chop 3pt__ chop 0 +Q: NPopulation.end + (-1.25,-0.1) + spline ctension_ <- \ + from NPopulation.end+(-3pt__,0) left 0.3 down 0.1 then left 0.45 then to Q + s_box(`"%g\,\%% of 1850 population"',round_(ypop[nyd]/ypop[1]*10)*10) rjust + +# average growth rates per decade +# print ((ypop[nyd]/ypop[1])^(1/((yrd[nyd]-1850)/10))-1)*100 +# print ((pop[nD]/pop[1])^(1/((yr[nD]-1850)/10))-1)*100 +# print ((nuclear[nD0]/nuclear[1])^(1/((yr[nD0]-1850)/10))-1)*100 + +] +# maxx +#print maxpswid-(last [].wid-maxx) + +#print (last [].wid,last [].ht) +showbox_ +} +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Diodes.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Diodes.m4 index 360d8e9d9e0..d08a0322531 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/Diodes.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Diodes.m4 @@ -1,7 +1,9 @@ .PS -# `Diodes.m4' +# Diodes.m4 cct_init + movewid = 2pt__ + { {diode ; move ; "`{\tt diode}'" ljust} move down 0.2; right_ {diode(,S) ; move ; "`{\tt diode(,S)}'" ljust} @@ -15,6 +17,8 @@ movewid = 2pt__ {diode(,B) ; move ; "`{\tt diode(,B)}'" ljust} move down 0.2; right_ {diode(,G) ; move ; "`{\tt diode(,G)}'" ljust} + move down 0.2; right_ + {diode(,D) ; move ; "`{\tt diode(,D)}'" ljust} } move right_ 2.0 @@ -30,11 +34,15 @@ movewid = 2pt__ move down 0.2; right_ {diode(,Sh) ; move ; "`{\tt diode(,Sh)}'" ljust} move down 0.2; right_ - {diode(,D) ; move ; "`{\tt diode(,D)}'" ljust} + {diode(,M) ; move ; "`{\tt diode(,M)}'" ljust} + move down 0.2; right_ + {diode(,MK) ; move ; "`{\tt diode(,MK)}'" ljust} } move right_ 2.0 { {diode(,Z,RE) ; move ; "`{\tt diode(,Z,RE)}'" ljust} + move down 0.30; right_ + {diode(,U) ; move ; "`{\tt diode(,U)}'" ljust} move down 0.25; right_ {diode(,T) ; move ; "`{\tt diode(,T)}'" ljust} move down 0.30; right_ diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/EEP.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/EEP.m4 new file mode 100644 index 00000000000..e4130a83a32 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/EEP.m4 @@ -0,0 +1,112 @@ +.PS +# EEP.m4 +cct_init +include(libSLD.m4) + +command "{\sf" + +Pic1: [ + T: dot + switch(up_ elen_); {"Public supply" above} + Bus1: sl_busbar(right_ 5*dimen_,6,port=D) with .c at T + {"{\scriptsize 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: sl_transformer(from Bus1.P3 down_ elen_,type=S,,,Delta,Y) + arrow down_ dimen_/3 + TRF2: sl_transformer(from Bus1.P4 down_ elen_,type=S,,,Delta,Y) + arrow down_ dimen_/3 + TRF3: sl_transformer(from Bus1.P5 down_ elen_,type=S,,,Delta,Y) + 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) + {"{\scriptsize 20$\,$kV}" at Bus2.Start above ljust} + {"{\scriptsize 1.25$\,$MVA}" at Bus2.P2 below} + S4: switch(from Bus2.P2 to S1.start) + TRF4: sl_transformer(from Bus2.P1 down_ elen_,type=S,,,Delta,Y) + S4: switch(from Bus2.P3+(0,-elen_) to Bus2.P3) +] + +command "\definecolor{cornflowerblue}{rgb}{0.39, 0.58, 0.93}" +command "\definecolor{goldenrod}{rgb}{0.85, 0.65, 0.13}" +command "\definecolor{colorA}{rgb}{0.79, 0.59, 0.57}" +command "\definecolor{colorB}{rgb}{0.2, 0.8, 0.2}" +command "\definecolor{colorC}{rgb}{0.21, 0.47, 0.86}" +command "\definecolor{colorD}{rgb}{0.2, 0.6, 0.8}" +command "\definecolor{colorE}{rgb}{0.2, 0.63, 0.8}" +command "\definecolor{colorF}{rgb}{0.78, 0.36, 0.3}" +Pic2: [ +# 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 "colorA" "Electronic Load" + sl_disk(right_ dimen_ from B3.P3, + text="A/C";circle=shaded "colorB";diam=dimen_*3/4) + sl_disk(right_ dimen_ from B3.P4, + text="M";circle=shaded "colorC";diam=dimen_*3/4) + sl_disk(right_ dimen_ from B3.P5, + text="M";circle=shaded "colorD";diam=dimen_*3/4) + sl_disk(right_ dimen_ from B3.P6, + text="M";circle=shaded "colorE";diam=dimen_*3/4) + sl_disk(left_ dimen_ from 1/2 between B3.P1 and B3.P2, + text="\scriptsize DER\_A"; circle=shaded "colorF";diam=dimen_*3/4) +] with .nw at last [].sw + (100bp__,120bp__) + +Pic3: [ +define(`shadedb',shaded "cornflowerblue") +Loopover_(`LR', # loop to take advantage of symmetry + `define(`opposite',`ifelse(LR,left,right,left)')dnl + ifelse(LR,left,L,R)`'side: [ + sl_generator(LR dimen_/2,type=B;name=G1;circle=shadedb,box=shadedb) + { move from G1 opposite last circle.rad*3/2 down_ last circle.rad + ifelse(LR,left,`Delta',`Wye')symbol(,size=sourcerad_*2/3) } + T1: sl_transformer(opposite dimen_*3/2,name=Tx) + Bus1: sl_busbar(up_ dimen_*3/2,3,) with .P2 at Here + Br1: sl_breaker(from Bus1.P3 opposite elen_,box=shadedb) + line opposite dimen_*4/3 + Br2: sl_breaker(from Bus1.P1 opposite elen_,box=shadedb) + Br3: sl_breaker(down_ dimen_,box=shadedb) + Bus2: sl_busbar(opposite dimen_,3) with .P2 at Here + T2: sl_transformer(down_ dimen_ from Bus2.P2,name=X2) + sl_disk(down_ dimen_/2,type=B;text="SM";name=SM1;circle=shadedb,box=shadedb) + { move from last circle opposite sourcerad_*3 + Wyesymbol(,type=G`'ifelse(LR,right,L);size=sourcerad_*2/3) } + ]', + left,right) + "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$_1$ 50$\,$km 69$\,$kV" at 1/2 between Lside.Br1 and Rside.Br1 above + "TL$_2$ 30$\,$km" ljust "69$\,$kV" ljust at Lside.Br2.end + (-18bp__,12bp__) + "TL$_2$ 20$\,$km" ljust "69$\,$kV" ljust at Rside.Br2.end + (-18bp__,12bp__) + "G$_1$ 50$\,$MVA" ljust "13.8$\,$kV" ljust at Lside.G1.w+(-25bp__,-32bp__) + "G$_2$ 30$\,$MVA" ljust "13.8$\,$kV" ljust at Rside.G1.w+(10bp__,-28bp__) + "T$_1$ 50$\,$MVA" "13.8/69$\,$kV $\Delta$/Y" \ + at Lside.Tx.s+(-2bp__,-25bp__) below + "T$_2$ 30$\,$MVA" "69/13.8$\,$kV Y/$\Delta$" \ + at Rside.Tx.s+(2bp__,-27bp__) below + "T$_3$ 50$\,$MVA" rjust "13.8/69$\,$kV Y/$\Delta$" rjust \ + at Lside.X2.w+(-4bp__,0) + "T$_4$ 20$\,$MVA" ljust "69/6.9$\,$kV Y/$\Delta$" ljust \ + at Rside.X2.e+(4bp__,0) + "SM$_1$ 30$\,$MVA" rjust "13.8$\,$kV" rjust at Lside.SM1.w+(-4bp__,0) + "SM$_2$ 20$\,$MVA" ljust "6.9$\,$kV" ljust at Rside.SM1.e+( 4bp__,0) +] with .nw at (Pic1.w,last [].sw + (0,-15bp__)) + + command "}%" + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Escher.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Escher.m4 index f8bae7f728e..fad743d028e 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/Escher.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Escher.m4 @@ -2,6 +2,8 @@ # Escher.m4 # https://tex.stackexchange.com/questions/129274/showcase-of-optical-illusions-made-with-tex-latex-luatex-context threeD_init +[] +ifelse(1,1,` [ u=1/2.54 # unit size; could use scale for this @@ -107,82 +109,67 @@ define dorgb { gg = $2 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,` +define(`DPL',`(project(`$1',`$2',`$3'))') +define(`ISL',` + S1: `$2'; E1: `$2' + `$3' + S2: `$4'; E2: `$4' + `$5' + `$1': line from S2 to intersect_(S1,E1,S2,E2) ') + [ - 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) - + bwd = 2.8 + bht = 1.5 + bth = bwd/10 + setview(-45,20,0) + + L1: line from DPL(0,0,0) to DPL(0,0,bht) \ + then to DPL(0,bwd,bht) \ + then to DPL(bdp,bwd,bht) \ + then to DPL(bdp,bwd,0) \ + then to DPL(bdp,0,0) \ + then to DPL(0,0,0) + L2: line from DPL(bth,bth,bht) to DPL(bth,bwd-bth,bht) \ + then to DPL(bdp-bth,bwd-bth,bht) \ + then to DPL(bdp-bth,bth,bht) \ + then to DPL(bth,bth,bht) + L3: line from DPL(bth,bth,0) to DPL(bth,bwd-bth,0) \ + then to DPL(bdp-bth,bwd-bth,0) \ + then to DPL(bdp-bth,bth,0) \ + then to DPL(bth,bth,0) + L4: line from DPL(bdp,bth,bht-bth) to DPL(bdp,bwd-bth,bht-bth) \ + then to DPL(bdp,bwd-bth,bth) \ + then to DPL(bth+bth,bwd-bth,bth) + L5: line from DPL(bdp-bth,0,bht-bth) to DPL(bth,0,bht-bth) \ + then to DPL(bth,0,bth) \ + then to DPL(bth,bwd-bth-bth,bth) + L6: line from DPL(0,0,bht) to DPL(bdp,0,bht) \ + then to DPL(bdp,bwd,bht) + L7: line from DPL(0,0,0) to DPL(0,bwd,0) \ + then to DPL(bdp,bwd,0) + ISL(L8,L4.start,UPy_,L4.end,UPz_) + ISL(L9,L4.start,UPy_,DPL(0,bwd,0),UPz_) + ISL(L10,L4.start,UPy_,L5.end,UPz_) + ISL(L11,L5.end,UPy_,L4.start,UPz_) + ISL(L12,L5.end,UPy_,DPL(bdp,0,bht),UPz_) + ISL(L13,L5.end,UPy_,L5.start,UPz_) + ISL(L14,DPL(bdp-bth,bth,bht),UPy_,DPL(bth,bwd-bth-bth,bht-bth),UPz_) + ISL(L15,L2.start,UPx_,DPL(bth,bwd-bth-bth,bht-bth),UPy_) + ISL(L16,DPL(bdp-bth,bth,bht),UPy_,DPL(bth,bwd-bth,bht),UPz_) + ISL(L17,DPL(bdp-bth,bth,bht),UPy_,DPL(bth+bth,bwd-bth,bht-bth),UPz_) + ISL(L18,DPL(bdp-bth,bth,bht),UPy_,DPL(bth+bth,bwd-bth,bht-bth),UPx_) + ISL(L19,L3.start,UPy_,L5.start+DPL(0,0,-bht+bth+bth),UPx_) + ISL(L20,L3.start,UPy_,L5.start+DPL(0,0,-bht+bth+bth),UPz_) + ISL(L21,L3.start,UPy_,DPL(bdp-bth,bth,0),UPz_) + ISL(L22,L3.start,UPy_,L4.start+DPL(0,0,-bht+bth+bth),UPz_) + ISL(L23,DPL(bth,bwd-bth,0),UPx_,L4.start+DPL(0,0,-bht+bth+bth),UPy_) + ISL(L24,L5.start,UPx_,DPL(bth,bth,bth),UPz_) + ISL(L25,L4.start,UPy_,DPL(bdp-bth,bwd-bth,bth),UPz_) + +ifelse(0,1,`for i=1 to 7 do { exec sprintf("\"L%g.s\" at L%g.start",i,i) } + for i=8 to 10 do { exec sprintf("\"L%g\" at L%g",i,i) }') ] with .sw at last [].se+(0.2,0) ') .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Eye.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Eye.m4 new file mode 100644 index 00000000000..50a62c389ef --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Eye.m4 @@ -0,0 +1,55 @@ +.PS +# Eye.m4 +gen_init + +define(`eye',`[ u = `$1'; v = 0.47*u; w = 0.25*u + shade(1, + arc thick 0 from (u/2,0) to (-u/2,0) with .c at (0,-u/3) + arc thick 0 to (u/2,0) with .c at (0,u/3) ) + circle diam v fill_(0.25) at (0,0) + circle diam w fill_(0) at (0,0) + circle thick 0 diam last circle.diam/2 fill_(1) at last circle.nw + circle diam last circle.diam-lthick at last circle outlined graystring(0.9) + ] ') + + skale = 2/3 + Bx: box wid 11*skale ht 8.5*skale fill_(0) at (0,0) + ane = atan2(Bx.ht,Bx.wid)*rtod_ + d[5] = 0.92*Bx.ht + d[4] = 0.78*Bx.ht + d[3] = 0.62*Bx.ht + d[2] = 0.40*Bx.ht + d[1] = 0.25*Bx.ht + da = 1 + dax = 360/64 + C[0]: Bx.se; C[1]: Bx.nw + for a=-int(ane/dax)*dax to 180-ane by dax do { + T1: (Rect_(1,a+da)); T1: intersect_(Bx.ne,C[(a>ane)],Bx,T1) + T2: (Rect_(1,a)); T2: intersect_(Bx.ne,C[(a>ane)],Bx,T2) + line outlined "white" shaded "white" from Bx to T1 then to T2 then to Bx + line outlined "white" shaded "white" from Bx to T1*(-1) \ + then to T2*(-1) then to Bx + } + for i=5 to 2 by -1 do { + C[i]: circle diam d[i] fill_(0) at Bx + for a=0 to 359 by dax do { + T1: (Rect_(d[i]/2,a)) + T2: (Rect_(d[i]/2,a-da*2)) + shade(1, + arc cw thick 0 from T1 to T2 with .c at Bx + spline 0.55 thick 0 to 0.8 between Bx and T2 \ + then to (Rect_(d[i]/4,a+30)) + arc cw thick 0 to (Rect_(d[i]/4,a+32)) with .c at Bx + spline 0.55 thick 0 to 0.8 between Bx and T1 then to T1 ) + } + } + C[1]: circle thick 2 diam d[1] at Bx fill_(0.1) + eye(d[1]-4bp__) at (0,0) + for a=0 to 359 by dax do { + T1: (Rect_(d[1]/2-1bp__,a)) + T2: (Rect_(d[1]/2-1bp__,a+dax/2)) + line thick 0 from T1 to T2 then to 0.5 between Bx and T2 \ + then to 0.5 between Bx and T1 then to T1 shaded "white" #outlined "white" + } + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Flow.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Flow.m4 index f0f8a842f0b..f117c082c37 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/Flow.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Flow.m4 @@ -64,7 +64,7 @@ Repeatuntil: Frepeatuntil("$n \geq 5$",,,Fbox("Task"), "\sl .N" at Repeatuntil.N rjust above; "\sl .S" at Repeatuntil.S rjust below "\sl .E" at Repeatuntil.E ljust; "\sl .W" at Repeatuntil.W rjust - "\tt F{}repeatuntil" below at Repeatuntil.se +(-0.0,0.2) + "\tt F{}repeatuntil" below at Repeatuntil.se +(-0.0,0.1) Ifthenelse: Fifthenelse("$A + + B1: Cintersect(A0,a+b,B0,c) + B2: Cintersect(A0,b-a,B0,c) + arc dashed from B1 to B2 with .c at B0 + + A0B1: line thick 1.6 from A0 to B1 chop 2*ls chop 0 + line thick 1.6 from B0 to B1 chop 2*ls chop 0 "$c$" ljust + circle fill_(1) at B1; "$B_1$" wid 3*ls at B1+(5,0)*ls + A1: circle fill_(1) at LCintersect(A0B1,A0,a,R) + "$A_1$" at A1+(5,0)*ls + + A2: b/(b-a) between B2 and A0; "$a$" at 0.4 above rjust + "$b$" at 0.4 above rjust + A2B2: line thick 1.6 from A2 to B2 + line thick 1.6 from B0 to B2 chop 2*ls chop 0 + circle fill_(1) at B2; "$B_2$" at B2+(5,0)*ls + circle fill_(1) at A2; "$A_2$" at A2+(5,0)*ls + + thinlines_ + line from B0+(3*ls,0) right 4*ls + ArcAngle(Here,B0,B1,5*ls) ->; "$\psi_0$" at last arc.ne above ljust + ArcAngle(B1,B0,B2,8*ls) ->; "$\psi$" at last arc.n+(-3*ls,0) above + ArcAngle(A1,A0,B2,b*0.45) ->; "$\theta$" at last arc.start+(0,4*ls) + line from A0+(3*ls,0) right 8*ls + ArcAngle(Here,A0,B1,9*ls) ->; "$\theta_0$" at last arc.start+(2,2)*ls + + ] with .nw at Fig3.ne+(0.2,0.2) + .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Lyap.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Lyap.m4 index 4bce1b1d378..e01d365fc02 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/Lyap.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Lyap.m4 @@ -20,7 +20,7 @@ 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(`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)') @@ -133,7 +133,7 @@ ifpstricks(` 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,<-) + arca(from X4[4] to X4[3],ccw,0.3,<-) # Projected trajectory np = np-2 @@ -144,6 +144,7 @@ ifpstricks(` # Axes and vertical lines thinlines_ line from X1[0] to Xp[0] + line from X4[4] to Xp[np] arrow from Origin to Project(1.5,0,0) "$x_1$" rjust below arrow from Origin to Project(0,1.5,0) @@ -153,7 +154,7 @@ 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 +"$\Omega$" at Project(0,0.9*c,0)+(0,3bp__) above "`$v(X) = c$'" at (Project(vp(100*dtor_,c)))+(2bp__,0) above ljust .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/Makefile index 8e32490d6d4..55cf147dcc2 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/Makefile +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Makefile @@ -58,15 +58,16 @@ PICS = \ ABlogix.tex Adder.tex Alogix.tex AmpTable.tex Antennas.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 \ + Contacts.tex Contact.tex control.tex Crossbar.tex Crow.tex \ csc.tex Csource.tex Decoder.tex \ - Demultiplexer.tex diamond.tex Dini.tex Diodes.tex Drive.tex Emarrows.tex \ + Demultiplexer.tex diamond.tex Dini.tex Diodes.tex Drive.tex \ + EEP.tex Emarrows.tex Escher.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 Inductors.tex Jack.tex \ - lcct.tex Lyap.tex Logic.tex Loglog.tex MC.tex Mixer.tex MoreTable.tex \ + lcct.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 \ @@ -80,7 +81,7 @@ PICS = \ worm.tex Xform.tex XOR.tex # Files that have to be processed twice: -BOXDIMS = ex09.tex Crow.tex Incleps.tex Lyap.tex Loglog.tex Opamp.tex \ +BOXDIMS = ex09.tex Crow.tex Incleps.tex Loglog.tex Opamp.tex \ random.tex Ttree.tex Windings.tex ######################################################################### @@ -275,7 +276,7 @@ clean: rm -f fig*.tex $(PICS) *.roff *.int *.pic gpic.m4 test.tex xxx* *.fig 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 -f F_* Version.tex *stackdump *.ico ./.[A-Za-z]* rm -rf distfile distfile.tar.gz mode.tex @printf "\n" # @if test -f distmakefile ; then make -f distmakefile clean ; fi diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/README-examples b/Master/texmf-dist/doc/latex/circuit-macros/examples/README-examples index c74c92c274e..1f37cf5f36b 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/README-examples +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/README-examples @@ -56,4 +56,4 @@ The xfig subdirectory contains the file xfig/xfiglib.fig, which contains elements in xfig 3.2 format produced by dpic for importing into xfig. SVG: Look in the svg directory for an experimental configuration file and -examples. +examples. Type "make" in the svg directory to see the examples. diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Stator.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Stator.m4 new file mode 100644 index 00000000000..9141d20bd44 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Stator.m4 @@ -0,0 +1,53 @@ +.PS +# Stator.m4 +# https://tex.stackexchange.com/questions/612620/how-to-paint-inside-a-set-of-lines +gen_init + + outerwid = 5/2 + innerwid = 3.7/2 + nteeth = 32 + toothdepth = (innerwid/2)*(twopi_/nteeth) + statordepth = toothdepth*4 + viewangle = 30 + outershade = 0.9 + topshade = 0.8 + innershade = 0.6 + toothshade = 0.5 + + cv = cosd(viewangle) + sv = sind(viewangle) + define ang { ($1)/nteeth*twopi_ } + + T: (0,statordepth*cv) + Tc: (0,toothdepth*cv) + for i = 0 to nteeth/2 do { for j=1 to -1 by -2 do { # Shaded tooth walls + P: (cos(ang(i)+pi_/2)*j,sin(ang(i)+pi_/2)*sv)*outerwid/2 + Q: P*innerwid/outerwid + line from P to P+Tc then to Q+Tc then to Q then to P \ + shaded rgbstring(toothshade,toothshade,toothshade) } } + shade(innershade, # inner arc and teeth + E: ellipsearc(innerwid,innerwid*sv,pi_,0,0,cw) with .C at T + move to (innerwid/2,0) + toothht = toothdepth*cv + for i = 0 to nteeth/2 do { + line up toothht + ellipsearc(innerwid,innerwid*sv,ang(i),ang(i+1),0,ccw) with .Start at Here + move to last [].End + toothht = -toothht } ) + shade(outershade, # outer arc and teeth + E: ellipsearc(outerwid,outerwid*sv,0,pi_,0,cw) with .C at T + line down statordepth*cv from E.End + toothht = toothdepth*cv + for i = nteeth/2 to nteeth-1 do { + line up toothht + ellipsearc(outerwid,outerwid*sv,ang(i),ang(i+1),0,ccw) with .Start at Here + move to last [].End + toothht = -toothht } + line up statordepth*cv from E.Start-T ) + for r=innerwid to outerwid by lthick*2 do { # shade the top + ellipse wid r ht r*sv with .c at T \ + outlined rgbstring(topshade,topshade,topshade) } + ellipse wid outerwid ht outerwid*sv with .c at T + ellipse wid innerwid ht innerwid*sv with .c at T + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Switches.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Switches.m4 index 46b3f9240d3..3e599a39ef0 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/Switches.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Switches.m4 @@ -2,130 +2,144 @@ # Switches.m4 cct_init -define(`Below',`at last [].s+(0,-10bp__)') +define(`Below',`at last [].s+(0,-(8 ifelse(`$1',,,+10*(`$1')))bp__)') movewid = 0.25 + # Row 1 right_; { - lswitch; {S:"\tt ls{}witch" Below} + lswitch; {"\tt ls{}witch" at last [].s Below} move right_ - lswitch(,,O); {"\tt (,{,}O)" at (last [],S)} + lswitch(,,O); {"\tt (,{,}O)" at last [].s Below} move right_ - lswitch(,,C); {"\tt (,{,}C)" at (last [],S)} + lswitch(,,C); {"\tt (,{,}C)" at last [].s Below} move right_ - lswitch(,,DA); {"\tt (,{,}DA)" at (last [],S)} + lswitch(,,DA); {"\tt (,{,}DA)" at last [].s Below} move right_ - lswitch(,,dDO); {"\tt (,{,}dDO)" at (last [],S)} + lswitch(,,dDO); {"\tt (,{,}dDO)" at last [].s Below} move right_ - lswitch(,,uDC); {"\tt (,{,}uDC)" at (last [],S)} + lswitch(,,uDC); {"\tt (,{,}uDC)" at last [].s Below} } # Row 2 - move down; right_; { - lswitch(,,K); {S:"\tt (,{,}K)" Below} + move down 0.4; right_; { + lswitch(,,K); {"\tt (,{,}K)" at last [].s Below} move right_ - lswitch(,,KD); {"\tt (,{,}KD)" at (last [],S)} + lswitch(,,KD); {"\tt (,{,}KD)" at last [].s Below} move right_ - lswitch(,,KOD); {"\tt (,{,}KOD)" at (last [],S)} + lswitch(,,KOD); {"\tt (,{,}KOD)" at last [].s Below} move right_ - lswitch(,,KCD); {"\tt (,{,}KCD)" at (last [],S)} + lswitch(,,KCD); {"\tt (,{,}KCD)" at last [].s Below} move right_ - bswitch; {"\tt `bswitch'" at (last [],S)} + bswitch; {"\tt `bswitch'" at last [].s Below} move right_ - bswitch(,,C); {"\tt (,{,}C)" at (last [],S)} + bswitch(,,C); {"\tt (,{,}C)" at last [].s Below} } # Row 3 - move down; right_; { - D: dswitch(,,); {S: "\tt ds{}witch(,{},)" Below} + move down 0.45; right_; { + D: dswitch(,,); {"\tt ds{}witch(,{},)" at last [].s Below} thinlines_ - { spline <- from 0.25 along_(D) up 0.1 then up 0.05 left 0.1 - {"\tt W" rjust} - spline <- from D.c+(0,m4sc*2) up 0.1 then up 0.05 left 0.1 - {"\tt B" rjust }} + {spline <- from last [].B.c up 0.1 then up 0.05 left 0.1; "\tt B" rjust} thicklines_ move right_ - D: dswitch(,,WdBK); {"\tt (,{,}WdBK)" at (last [],S)+(0,-4bp__)} + dswitch(,,WdBK); {"\tt (,{,}WdBK)" at last [].s Below} thinlines_ - { spline <- from tr_xy(0,-2) up 0.1 then up 0.10 left 0.1 - {"\tt dB" rjust} - spline <- from tr_xy(4,-2) right 0.1 then right 0.05 up 0.15 + { spline <- from 0.5 along_(last [].B) up 0.1 then up 0.10 left 0.1 + {"\tt B" rjust} } + { spline <- from last [].K right 0.1 then right 0.05 up 0.15 {"\tt K" above }} thicklines_ move right_ - dswitch(,,WBmdDK); {"\tt (,{,}WBmdDK)" at (last [],S)} + dswitch(,,WBmdDK); {"\tt (,{,}WBmdDK)" at last [].s Below} move right_ - dswitch(,,WBKTr); {"\tt (,{,}WBKTr)" at (last [],S)} + dswitch(,,WBKTr); {"\tt (,{,}WBKTr)" at last [].s Below} move right_ - dswitch(,,WdBL); {"\tt (,{,}WdBL)" at (last [],S+(0,-4bp__))} + dswitch(,,WdBL); {"\tt (,{,}WdBL)" at last [].s Below} move right_ - dswitch(,,WBCo); {"\tt (,{,}WBCo)" at (last [],S)} + dswitch(,,WBSd); {"\tt (,{,}WBSd)" at last [].s Below} } # Row 4 - move down; right_; { - dswitch(,,WBKCo); {S: "\tt (,{,}WBKCo)" Below} + move down 0.4; right_; { + dswitch(,,WBCb); {"\tt (,{,}WBCb)" at last [].s Below} move right_ - dswitch(,,WBCb); {"\tt (,{,}WBCb)" at (last [],S)} + dswitch(,,WBcCb); {"\tt (,{,}WBcCb)" at last [].s Below} move right_ - dswitch(,,WBDI); {"\tt (,{,}WBDI)" at (last [],S)} + dswitch(,,WBcDI); {"\tt (,{,}WBcDI)" at last [].s Below} + thinlines_ + {arrow <- from last [].DI.start up_ 0.1 right_ 0.15; "\tt DI" ljust} + thicklines_ move right_ - dswitch(,,WBSd); {"\tt (,{,}WBSd)" at (last [],S)} +# dswitch(,,WBDI); {"\tt (,{,}WBDI)" at last [].s Below} + dswitch(,,WBKCo); {"\tt (,{,}WBKCo)" at last [].s Below} move right_ - dswitch(,,WBFDI); {"\tt (,{,}WBFDI)" at (last [],S)} + dswitch(,,WBFDI); {"\tt (,{,}WBFDI)" at last [].s Below} move right_ - dswitch(,,WBFSd); {"\tt (,{,}WBFSd)" at (last [],S)} + dswitch(,,WBFSd); {"\tt (,{,}WBFSd)" at last [].s Below} } # Row 5 - move down moveht*5/4; right_; { - dswitch(,,WBTh); {S: "\tt (,{,}WBTh)" Below} + move down 0.4; right_; { + dswitch(,,WBMMR); {"\tt (,{,}WBMMR)" at last [].s Below} move right_ - dswitch(,,WBKC); {"\tt (,{,}WBKC)" at (last [],S)} + dswitch(,,WBMM); {"\tt (,{,}WBMM)" at last [].s Below} move right_ - dswitch(,,WBM); {"\tt (,{,}WBM)" at (last [],S)} + dswitch(,,WBMR); {"\tt (,{,}WBMR)" at last [].s Below} move right_ - dswitch(,,WBCO); {"\tt (,{,}WBCO)" at (last [],S)} + dswitch(,,WBEL); {"\tt (,{,}WBEL)" at last [].s Below} move right_ - dswitch(,,WBMP); {"\tt (,{,}WBMP)" at (last [],S)} + dswitch(,,WBLE); {"\tt (,{,}WBLE)" at last [].s Below} move right_ - dswitch(,,WBoKCP); {"\tt (,{,}WBoKCP)" at (last [],S)} + dswitch(,,WBoKEL); {"\tt (,{,}WBoKEL)" at last [].s Below} } # Row 6 - move down moveht*5/4; right_; { - dswitch(,,WBCY); {S: "\tt (,{,}WBCY)" Below} + move down moveht+2bp__; right_; { + dswitch(,,WBTh); {"\tt (,{,}WBTh)" at last [].s Below} move right_ - dswitch(,,WBCZ); {"\tt (,{,}WBCZ)" at (last [],S)} - move right_ - dswitch(,,WBCE); {"\tt (,{,}WBCE)" at (last [],S)} + dswitch(,,WBKC); {"\tt (,{,}WBKC)" at last [].s Below} + thinlines_ + { arrow <- from last [].C.c left 0.2; "\tt C" rjust } + thicklines_ move right_ - dswitch(,,WBRH); {"\tt (,{,}WBRH)" at (last [],S)} + dswitch(,,WBM); {"\tt (,{,}WBM)" at last [].s Below} move right_ - dswitch(,,WBRdH); {"\tt (,{,}WBRdH)" at (last [],S)} + dswitch(,,WBCO); {"\tt (,{,}WBCO)" at last [].s Below} move right_ - dswitch(,,WBRHH); {"\tt (,{,}WBRHH)" at (last [],S)} + dswitch(,,WBMP); {"\tt (,{,}WBMP)" at last [].s Below} + move down_ 2bp__ then right_ + dswitch(,,WBoKCP); {"\tt (,{,}WBoKCP)" at last [].s Below} } # Row 7 - move down moveht; right_; { - move down_ 2bp__; right_ - dswitch(,,WBPr); {S: "\tt (,{,}WBPr)" Below} + move down moveht*7/6; right_; { + dswitch(,,WBCY); {"\tt (,{,}WBCY)" at last [].s 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} + dswitch(,,WBCZ); {"\tt (,{,}WBCZ)" at last [].s Below} + move right_ + dswitch(,,WBCE); {"\tt (,{,}WBCE)" at last [].s Below} + move right_ + dswitch(,,WBRH); {"\tt (,{,}WBRH)" at last [].s Below} + move right_ + dswitch(,,WBRdH); {"\tt (,{,}WBRdH)" at last [].s Below} + move right_ + dswitch(,,WBRHH); {"\tt (,{,}WBRHH)" at last [].s Below} } # Row 8 - move down; right_; { - dswitch(,,WBMMR); {S: "\tt (,{,}WBMMR)" Below} - move right_ - dswitch(,,WBMM); {"\tt (,{,}WBMM)" at (last [],S)} + move down moveht; right_; { + move down_ 2bp__; right_ + dswitch(,,WBPr); {"\tt (,{,}WBPr)" at last [].s Below} move right_ - dswitch(,,WBMR); {"\tt (,{,}WBMR)" at (last [],S)} + dswitch(,,WBPrT); {"\tt (,{,}WBPrT)" at last [].s Below} + move down_ 6bp__ then right_ + dswitch(,,WBPrM); {"\tt (,{,}WBPrM)" at last [].s Below} move right_ - dswitch(,,WBEL); {"\tt (,{,}WBEL)" at (last [],S)} + dswitch(,,WBDIGX,text=W); #{"\tt (,{,}WBDIGX,W)" at last [].s Below} + {"\tt (,{,}WBDIGX," ljust at last line.start+(0,-15bp__) \ + "\tt text=W)" ljust} move right_ - dswitch(,,WBLE); {"\tt (,{,}WBLE)" at (last [],S)} + dswitch(,,WBDIGC,text=M) + {"\tt (,{,}WBDIGC," ljust at last line.start+(0,-15bp__) \ + "\tt text=M)" ljust} move right_ - dswitch(,,WBoKEL); {"\tt (,{,}WBoKEL)" at (last [],S)} + dswitch(,,WBcDIGC,text=M) # + {"\tt (,{,}WBcDIGC," ljust at last line.start+(0,-15bp__) \ + "\tt text=M)" ljust} } + .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/control.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/control.m4 index aa3de4bff9b..db6a5940cc1 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/control.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/control.m4 @@ -13,7 +13,7 @@ PID: [ arrow S1: circle line right "$e(s)$" above - { arrow right ; box ht bh wid bw "$K_p$" + { arrow right ; box ht bh wid bw "$K_P$" arrow right linewid-circlerad ; S2: circle } { arrow up linewid then right ; box ht bh wid bw "$K_D s$" arrow to (S2,Here) then to S2.n } @@ -43,7 +43,7 @@ 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 } + "\sf plant" at OLP.sw above ljust } U: arrow right 0.4 {"$u$" at last arrow+(2bp__,0) above } Bp: box fill "$B$" diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex05.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex05.m4 index af26c787814..dbdacdab908 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex05.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex05.m4 @@ -9,11 +9,17 @@ darrow_init extlen=4*dx indel = boxht/3 -COb: box fill_ "C$\bar{\mbox{O}}$" +# Replacement for \bar, see +# https://tex.stackexchange.com/questions/22100/the-bar-and-overline-commands +command "\newcommand{\ols}[1]{% +\mskip.5\thinmuskip\overline{\mskip-.5\thinmuskip {#1} \mskip-.5\thinmuskip}% +\mskip.5\thinmuskip} % overline short " + +COb: box fill_ "C$\ols{\mbox{O}}$" CO:box fill_ with .nw at last box.se+(dx,-dx) "CO" CbOb: box fill_ with .nw at last box.se+(dx,-dx) \ - "$\bar{\mbox{C}}$$\bar{\mbox{O}}$" -CbO: box fill_ with .nw at last box.se+(dx,-dx) "$\bar{\mbox{C}}$O" + "$\ols{\mbox{C}}$$\ols{\mbox{O}}$" +CbO: box fill_ with .nw at last box.se+(dx,-dx) "$\ols{\mbox{C}}$O" dline(from CbO.s down_ dx,,t,,!-) dright diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex06.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex06.m4 index 4f6986a1337..1fb6b1bd7bf 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex06.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex06.m4 @@ -14,10 +14,13 @@ G: box invis wid 1i ht F.ht qmell = F.ht - ell kwid = F.wid-qmell-r + hatchbox(wid G.e.x-F.w.x ht F.ht,hatch) with .sw at F.sw + box invis fill_(1) ht ell wid E.e.x-F.w.x with .nw at F.nw + box wid G.e.x-F.w.x ht F.ht with .sw at F.sw thick linethick*3/2 Loopover_(`B', - `line from B.ne to B.se thick linethick*3/2 - B`'T: B.se + (-qmell,qmell) + `B`'T: B.se + (-qmell,qmell) + line invis fill_(1) from B.se to (B.se,B`'T) then to B`'T then to B.se line from (B.w,B`'T) to B`'T chop 0 chop -offset line from B`'T up ell chop -offset chop 0 line from B`'T + (-r,0) up ell @@ -27,28 +30,13 @@ G: box invis wid 1i ht F.ht "$t$" at (B`'T,B.n) + (-offset/2,offset) sprintf("$\overbrace{\phantom{\hbox to %gin{}}}^{\hbox{$k$}}$",kwid) \ at B.nw + (kwid/2,0) above - thinlines_ - for x = hatch to B`'T.x-B.w.x-r by hatch do {line down ell from B.nw+(x,0)} - for y = dhs to qmell by dhs do {line up y right y from (B.w,B`'T)+(0,-y)} - for x = y-qmell to B.wid-qmell*2 by dhs do { - line up qmell right qmell from B.sw+(x,0) } - for x = last line.start.x-B.w.x+dhs to B.wid by dhs do { - line up (B.wid-x)/2 right (B.wid-x)/2 from B.sw+(x,0) } - thicklines_ + hatchbox(wid kwid ht ell,hatch,,90) with .nw at B.nw + line from B.ne to B.se thick linethick*3/2 ',F,E) line from (G.w,ET) right G.wid line from ET + (0,r) left ET.x-E.w.x - - thinlines_ - for y = hatch to r by hatch do { line left r from ET+(0,r-y) } - for x = dhs to G.wid by dhs do { - line left x down x from G.nw+(x,0) } - for y=x-G.wid to G.ht-G.wid by dhs do { - line left G.wid down G.wid from G.ne+(0,-y) } - for x = y-(G.ht-G.wid) to G.wid by dhs do { - line right G.wid-x up G.wid-x from G.sw+(x,0) } - thicklines_ + hatchbox(wid r ht r,hatch,,0) with .se at ET "$q$" at F.sw + (-offset,offset/3) "$\ell$" at (F.w,FT) + (-offset,offset/3) diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.pdf b/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.pdf index 6d02c456cc8..7b89aac55c2 100644 Binary files a/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.pdf and b/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.pdf differ diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.tex index 79979379bbf..8d3af1327c3 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.tex +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.tex @@ -5,6 +5,7 @@ \input mode \usepackage{rotating} \usepackage{graphicx} +\usepackage{xcolor} \usepackage{boxdims} %\usepackage{upgreek} \usepackage{siunitx} diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/files.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/files.tex index 5a04b20edcf..03c9ffa090f 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/files.tex +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/files.tex @@ -14,19 +14,20 @@ \bfig{ \centerline{{\small\getpic{Capacitors}}} - \caption{Capacitors, showing some variations + \caption{Capacitors \src{Capacitors.m4}.} } \bfig{ \centerline{{\small\getpic{Inductors}}} - \caption{Inductors, showing some variations + \caption{Inductors \src{Inductors.m4}.} } \bfig{ \centerline{\getpic{Diodes}} - \caption{Diodes: a {\tt K} in the second argument draws an open arrowhead + \caption{Diodes: appending a {\tt K} to the second argument + draws an open arrowhead \src{Diodes.m4}.} } @@ -505,6 +506,12 @@ \src{ex00.m4}.} } +\bfig{ + \centerline{\getpic{EEP}} + \caption{A test of experimental single-line diagram macros + \src{EEP.m4}.} + } + \bfig{ \centerline{\getpic{control}} \caption{Control-system block diagrams @@ -539,7 +546,7 @@ \bfig{ \centerline{\getpic{ex06}} - \caption{Crosshatching by {\tt for} loops + \caption{Crosshatching \src{ex06.m4}.} } @@ -561,18 +568,19 @@ \src{ex09.m4}.} } -\bfig{ - \centerline{\getpic{ex05}} - \caption{Use of {\tt darrow} - \src{ex05.m4}.} - } - \bfig{ \centerline{\getpic{Plate}} \caption{Dimensioning with tolerances \src{Plate.m4}.} } +\bfig{ + \centerline{\getpic{ex05}} + \caption{The Kalman canonical decomposition of a dynamical system: + use of {\tt darrow} + \src{ex05.m4}.} + } + \bfig{ \centerline{\getpic{Loglog}} \caption{A graph drawn using the pic language @@ -595,8 +603,7 @@ \bfig{ \centerline{\getpic{graysurf}} - \caption{Plotting surfaces using gray scales. A sort algorithm - determines plotting order + \caption{Plotting surfaces using gray scales \src{graysurf.m4}.} } @@ -606,12 +613,6 @@ \src{shapes.m4}.} } -\bfig{ - \centerline{\getpic{Lyap}} - \caption{Illustrating a Lyapunov function - \src{Lyap.m4}.} - } - \bfig{ \centerline{\getpic{csc}} \caption{Conestoga Sailing Club (illustrating the filling of arbitrary @@ -625,7 +626,7 @@ {\it Dracula,} used for testing {\tt dpic}. This diagram consumes much \LaTeX\ main memory but can be produced directly as pdf using \hbox{\tt dpic -d}, - as svg using \hbox{\tt dpic -g}, + as svg using \hbox{\tt dpic -v}, or as postscript using \hbox{\tt dpic -r} since no text formatting is required \src{rose.m4}.} @@ -664,6 +665,12 @@ \src{Sierpinski.m4}.} } +\bfig{ + \centerline{\getpic{Escher}} + \caption{Two Escher-like objects + \src{Escher.m4}.} + } + \bfig{ \centerline{\getpic{recycle}} \caption{Modest repetition and partial fill @@ -676,12 +683,6 @@ \src{ex15.m4}.} } -\bfig{ - \centerline{\getpic{Counting}} - \caption{An example of enumeration - src{Counting.m4}.} - } - \bfig{ \centerline{\getpic{Crow}} \caption{Illustrating {\tt shadebox} and a custom crowfoot line termination diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ics.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ics.m4 index bf702d7c44f..98789b73cd8 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/ics.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ics.m4 @@ -290,7 +290,7 @@ define(`DIP',`[ pinct= ifelse(`$1',,8,`$1') type:I:N) setdir_(m4direct,U) Body: box ht_ m4bodywid wid_ m4bodylen - arcs = ifelse(m4dir,right,90,m4dir,up,180,m4dir,left,270,0) + arcs = ifelse(m4_dir_,right,90,m4_dir_,up,180,m4_dir_,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 diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/cct.mf b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/cct.mf index 16e77f4cbd7..85a84e5a7f8 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/cct.mf +++ b/Master/texmf-dist/doc/latex/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/10/02 at 01:36 +% from TeX source "font" on 2022/02/11 at 17:20 numeric mfpicversion; mfpicversion := 110; if unknown mode: mode := localfont; fi if unknown mag: mag := 1000/1000; fi @@ -142,8 +142,8 @@ resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((0.303716,0), -(0.323964,0)); +((0.313085,0), +(0.333333,0)); endmfpic; % (3) line 59 in the TeX source. %------------------------------------------ @@ -224,8 +224,8 @@ resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((0,-0.303716), -(0,-0.323964)); +((0,-0.313085), +(0,-0.333333)); endmfpic; % (4) line 77 in the TeX source. %------------------------------------------ @@ -306,8 +306,8 @@ resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((-0.303716,-0), -(-0.323964,-0)); +((-0.313085,0), +(-0.333333,0)); endmfpic; % (5) line 95 in the TeX source. %------------------------------------------ @@ -388,8 +388,8 @@ resizedrawpen (0.8bp); store (curpath) drawn polyline (false) -((-0,0.303716), -(-0,0.323964)); +((0,0.313085), +(0,0.333333)); endmfpic; % (6) line 113 in the TeX source. %------------------------------------------ @@ -491,11 +491,11 @@ 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 @@ -3262,7 +3262,7 @@ endmfpic; % (78) line 1101 in the TeX source. %----------------------------<79> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.104167, 0.104167, -0.333333, -0); +bounds (-0.104167, 0.104167, -0.333333, 0); beginmfpic(79); % line 1102 in the TeX source. @@ -3272,7 +3272,7 @@ setcolor (drawcolor) black; store (curpath) drawn polyline (false) -((-0.104167,-0), +((-0.104167,0), (-0.104167,-0.041667)); store (curpath) @@ -4815,7 +4815,7 @@ store (curpath) drawn polyline (false) ((0.122222,0.148911), -(0,0.148911)); +(-0,0.148911)); store (curpath) drawn @@ -4842,7 +4842,7 @@ endmfpic; % (106) line 1617 in the TeX source. %----------------------------<107> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.151089, 0.151089, -0.355556, -0); +bounds (-0.151089, 0.151089, -0.355556, 0); beginmfpic(107); % line 1618 in the TeX source. @@ -4862,7 +4862,7 @@ arcplr ((-0.001089,0.310672),-64.227634,-115.376934,0.35); store (curpath) drawn polyline (false) -((-0.151089,-0), +((-0.151089,0), (-0.151089,-0.122222)); store (curpath) @@ -4880,7 +4880,7 @@ endmfpic; % (107) line 1629 in the TeX source. %----------------------------<108> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.355556, -0, -0.151089, 0.151089); +bounds (-0.355556, 0, -0.151089, 0.151089); beginmfpic(108); % line 1630 in the TeX source. @@ -4929,7 +4929,7 @@ store (curpath) drawn polyline (false) ((-0.148911,0.122222), -(-0.148911,0)); +(-0.148911,-0)); store (curpath) drawn @@ -5175,7 +5175,7 @@ store (curpath) drawn polyline (false) ((0.122222,0.148911), -(0,0.148911)); +(-0,0.148911)); store (curpath) drawn @@ -5206,7 +5206,7 @@ endmfpic; % (118) line 1746 in the TeX source. %----------------------------<119> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.151089, 0.151089, -0.430556, -0); +bounds (-0.151089, 0.151089, -0.430556, 0); beginmfpic(119); % line 1747 in the TeX source. @@ -5226,7 +5226,7 @@ arcplr ((-0.001089,0.310672),-64.227634,-115.376934,0.35); store (curpath) drawn polyline (false) -((-0.151089,-0), +((-0.151089,0), (-0.151089,-0.122222)); store (curpath) @@ -5248,7 +5248,7 @@ endmfpic; % (119) line 1759 in the TeX source. %----------------------------<120> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.430556, -0, -0.151089, 0.151089); +bounds (-0.430556, 0, -0.151089, 0.151089); beginmfpic(120); % line 1760 in the TeX source. @@ -5301,7 +5301,7 @@ store (curpath) drawn polyline (false) ((-0.148911,0.122222), -(-0.148911,0)); +(-0.148911,-0)); store (curpath) drawn @@ -5416,7 +5416,7 @@ endmfpic; % (123) line 1811 in the TeX source. %----------------------------<124> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.4, -0, -0.151089, 0.151089); +bounds (-0.4, 0, -0.151089, 0.151089); beginmfpic(124); % line 1812 in the TeX source. @@ -5592,7 +5592,7 @@ endmfpic; % (127) line 1865 in the TeX source. %----------------------------<128> unitlen := 1.0pt#; xscale := 72; yscale := 72; -bounds (-0.475, -0, -0.151089, 0.151089); +bounds (-0.475, 0, -0.151089, 0.151089); beginmfpic(128); % line 1866 in the TeX source. diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4 deleted file mode 100644 index e46bb97a769..00000000000 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4 +++ /dev/null @@ -1,96 +0,0 @@ -.PS -# `CctTableSVG.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) = 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 - {move down_ 0.05; right_ - thermocouple ; move; "`thermocouple '" ljust; move up_ 0.05} - move right_ hm - {ebox(,0.5,0.3) ; move ; "`ebox(,0.5,0.3) '" ljust} -} - move down vm; right_ -{ {inductor ; move ; "`inductor '" ljust} - move right_ hm - {inductor(,W); move ; "`inductor(,W) '" ljust} - move right_ hm - {inductor(,L); move ; "`inductor(,L) '" ljust} -} - move down vm; right_ -{ {inductor(,,,M) ; move ; "`inductor(,,,M) '" ljust} - move right_ hm - {inductor(,W,6,P); move ; "`inductor(,W,6,P) '" ljust} - move right_ hm - {move right_ 0.2; ttmotor(,G) ; move ; "`ttmotor(,G) '" ljust} -} - move down vm; right_ -{ {capacitor ; move ; "`capacitor '" ljust} - move right_ hm - {capacitor(,C); move ; "`capacitor(,C) '" ljust} - move right_ hm - {capacitor(,C+); move ; "`capacitor(,C+) '" ljust} -} - move down vm; right_ -{ {capacitor(,P); move ; "`capacitor(,P) '" ljust} - move right_ hm - {capacitor(,E); move ; "`capacitor(,E) '" ljust} - move right_ hm - {capacitor(,K); move ; "`capacitor(,K) '" ljust} -} - move down 0.25; right_ -{ {capacitor(,M); move ; "`capacitor(,M) '" ljust} - move right_ hm - {capacitor(,N); move ; "`capacitor(,N) '" ljust} - move right_ hm - {xtal ; move ; "`xtal '" ljust} -} - move down 0.25; right_ -{ {memristor ; move; "`memristor '" ljust} - move right_ hm - {heater; move; "`heater '" ljust} - move right_ hm - {tline ; move; "`tline '" ljust} -} - move down 0.25; right_ -{ {move up_ 0.05; 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_ -{ {lamp ; move; "`lamp '" 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_ -{ {pvcell ; move; "`pvcell '" ljust} - move right_ hm - {arrester ; move ; "`arrester '" ljust} -} - - command "" # end font -.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4 index eb1c6f5672f..543132fe337 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4 @@ -2,6 +2,7 @@ # `Diodes.m4' cct_init(svg_font(sans-serif,11bp__)) movewid = 2pt__ + { {diode ; move ; "`diode'" ljust} move down 0.2; right_ {diode(,S) ; move ; "`diode(,S)'" ljust} @@ -15,11 +16,12 @@ movewid = 2pt__ {diode(,B) ; move ; "`diode(,B)'" ljust} move down 0.2; right_ {diode(,G) ; move ; "`diode(,G)'" ljust} + move down 0.2; right_ + {diode(,D) ; move ; "`diode(,D)'" ljust} } move right_ 2.0 -{ - {diode(,K) ; move ; "`diode(,K)'" ljust} +{ {diode(,K) ; move ; "`diode(,K)'" ljust} move down 0.2; right_ {diode(,ZK) ; move ; "`diode(,ZK)'" ljust} move down 0.2; right_ @@ -31,11 +33,13 @@ movewid = 2pt__ move down 0.2; right_ {diode(,Sh) ; move ; "`diode(,Sh)'" ljust} move down 0.2; right_ - {diode(,D) ; move ; "`diode(,D)'" ljust} + {diode(,M) ; move ; "`diode(,M)'" ljust} + move down 0.2; right_ + {diode(,MK) ; move ; "`diode(,MK)'" ljust} } move right_ 2.0 -{ {diode(,Z,RE) ; move ; "`diode(,Z,RE)'" ljust; move right 1.5} +{ {diode(,Z,RE) ; move ; "`diode(,Z,RE)'" ljust} move down 0.25; right_ {diode(,T) ; move ; "`diode(,T)'" ljust} move down 0.30; right_ diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EEPSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EEPSVG.m4 index 277b704cd89..25a9ff71d92 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EEPSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EEPSVG.m4 @@ -1,572 +1,107 @@ .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. - -# Notes for 1-terminal SLD elements: -# Argument 1 is normally the linespec of the stem to set the element direction -# and length. See also: PtoL defined in libgen.m4. -# For a 0-length stem (which has undefined direction): -# arg1 can also be U, D, L, R (for up, down, left, right), -# or a number to set the direction in degrees, optionally followed by -# `at position' to set the position (Here by default). -# Zero-length stem examples: sl_box(U), sl_box(45 at Here+(1,0)) -# Argument 2 contains semicolon (;)-separated key-value attributes -# of the element head as applicable: e.g., name=Carol; text="Stop"; lgth=expr -# If argument 3 is blank then no breaker is drawn. A non-blank argument 3 -# is C for a default closed breaker in the stem, O for an open breaker, -# or key-value pairs to specify breaker details. -# The element body (head) can be named with name=. It is overlaid with -# or contained in a [] block. - -# Notes for 2-terminal SLD elements: -# These obey the normal Circuit_macro two-terminal conventions. -# They can be labelled using rlabel() or llabel() as well as directly. -# Argument 2 contains key-value pairs to customize the element body, -# e.g., name=Name; text="text"; wdth=expr; ... -# Nonblank arguments 3 and 4 put a breaker in the input and output respectively. - -# Notes for attached breakers: -# Nonblank arguments 3 and 4 of the two-terminal elements and argument 3 of -# the 1-terminal elements specify a breaker in the input, output, and stem -# respectivlely. An O creates a default-size open breaker, and C a closed -# breaker, otherwise the argument contains key-value pairs to specify the -# details of the box; e.g., box=dotted 2bp__ shaded "green" - -# Notes for composite elements within a [ ] block: -# The SLD current transformer macro sl_ct is composite. -# Internal labels L (for inductor) and terminals Ts, Tc, and Te are defined. - -define(`sldlib_') -ifdef(`libcct_',,`include(libcct.m4)divert(-1)') - -# Default size parameters. These can be redefined in a diagram. - -define(`brksiz_',`dimen_*3/16') # Default inline box breaker size -define(`drosiz_',`dimen_/4') # Default sl_drawout (chevron) size - -# One-terminal elements ################################################### - - `sl_disk( stem linespec, keys, breaker ) - keys: name=Name; - text="text"; - diam=expr; - circle=circle attributes; eg diam expr' - `default breaker name Bd' -define(`sl_disk', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; circle::N; text::N; diam:dimen_*2/3')dnl - ifelse(`$3',, - `ifelse(m4name,,,m4name:) circle diam m4diam \ - at last line.end + vec_(m4diam/2,0) m4circle m4text - [ box invis wid_ m4diam ht_ m4diam ] at last circle - line from last line.end to last line.start', - `m4br_one(`sl_disk',`$1',`$2',m4brk_(`$3',Bd))') ') - - `sl_box( stem linespec, keys, breaker ) - keys: name=Name; lgth=expr; wdth=expr; - text="text"; - box= box attributes; (e.g. shade "red")' - `default breaker name Bb' -define(`sl_box', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; wdth:dimen_*2/3; lgth:dimen_*2/3; box::N; text::N')dnl - ifelse(`$3',, - `line from last line.end to last line.start - { ifelse(m4name,,,m4name:) [S:Here; lbox(m4lgth,m4wdth,m4box)] \ - with .S at last line.start } - ifelse(m4text,,,`{m4text at last []}')', - `m4br_one(`sl_box',`$1',`$2',m4brk_(`$3',Bb))') ') - - `sl_grid( stem linespec, keys, breaker ) - keys: name=Name; lgth=expr; wdth=expr;' - `default breaker name Bgr' -define(`sl_grid', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; wdth:dimen_*4/5; lgth:dimen_*2/3; box::N; text::N')dnl - ifelse(`$3',, - `line from last line.end to last line.start - { ifelse(m4name,,,m4name:) [S:Here - { ifelse(m4name,,,m4name:) lbox(m4lgth,m4wdth) } - { line to rvec_(m4lgth/2, m4wdth/2) - line to rvec_(m4lgth/2,-m4wdth/2) - line to rvec_(-m4lgth/2,-m4wdth/2) - line to rvec_(-m4wdth/2, m4wdth/2) } - { line from rvec_(0,m4wdth/2) to rvec_(m4lgth,-m4wdth/2) } - line from rvec_(0,-m4wdth/2) to rvec_(m4lgth,m4wdth/2) - ] with .S at last line.start } ', - `m4br_one(`sl_grid',`$1',`$2',m4brk_(`$3',Bgr))') ') - - `sl_load( stem linespec, keys, breaker ) - keys: name=Name; lgth=expr; wdth=expr; - head= arrowhead attributes;' - `default breaker name Bl' -define(`sl_load', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; wdth:dimen_*0.32; lgth:dimen_*0.45; head::N')dnl - ifelse(`$3',, - `line from last line.end to last line.start - { ifelse(m4name,,,m4name:) [S:Here; line to rvec_(0,m4wdth/2) \ - then to rvec_(m4lgth,0) then to rvec_(0,-m4wdth/2) \ - then to Here m4head ] with .S at last line.start } ', - `m4br_one(`sl_load',`$1',`$2',m4brk_(`$3',Bl))') ') - - `sl_meterbox( stem linespec, keys, breaker ) - keys: sl_box attributes' - `default breaker name Bm' -define(`sl_meterbox', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; wdth:dimen_*2/3; lgth:dimen_*2/3; box::N; text::N')dnl - ifelse(`$3',, - `line from last line.end to last line.start - {ifelse(m4name,,,m4name:) [S:Here; - { B: rotbox( m4lgth, m4wdth, m4box ) with .W at S } - a = rp_ang*rtod_ - if (abs(a-90) < 45) || (abs(a-180) < 45) || (abs(a+180) < 45) then { - C: rvec_(m4lgth*2/5,0) - line from rvec_(m4lgth*4/5,m4wdth/2) to rvec_(m4lgth*4/5,-m4wdth/2) } \ - else { C: rvec_(m4lgth*3/5,0) - line from rvec_(m4lgth/5,m4wdth/2) to rvec_(m4lgth/5,-m4wdth/2) } - ifelse(m4text,,,`m4text at C') - ] with .S at last line.start}', - `m4br_one(`sl_meterbox',`$1',`$2',m4brk_(`$3',Bm))') ') - - `sl_generator( stem linespec, keys, breaker )' - `default breaker name Bd' -define(`sl_generator',`sl_disk($@) - { ACsymbol(at last circle,,,R) - m4lcd = last circle.diam - [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } ') - - `sl_syncmeter( stem linespec, keys, breaker )' - `default breaker name Bd' -define(`sl_syncmeter',`sl_disk($@) - { Syncsymb(at last circle) - m4lcd = last circle.diam - [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } ') - - `sl_lamp( stem linespec, keys, breaker )' - `default breaker name Bd' -define(`sl_lamp',`sl_disk($@) - { line from last circle.ne to last circle.sw - line from last circle.nw to last circle.se - m4lcd = last circle.diam - [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } ') - -# One-terminal utilities ################################################## - - `Syncsymb(at position, rad) - Symbol for sync meter' -define(`Syncsymb',`[ define(`m4ssrad',`ifelse(`$2',,(dimen_/4),`($2)')')dnl - Origin: Here - {arc <-> ht arrowht/2 wid arrowwid*2/3 \ - from Rect_(m4ssrad,30) to Rect_(m4ssrad,150) with .c at Here} - line from (0,m4ssrad) to (0,-m4ssrad/2) - `$3' ] with .Origin ifelse(`$1',,`at Here',`$1')') - - `m4br_one( `name', stem linespec, body keys, - breaker keys )' - `Draw the breaker in the stem then the element' -define(`m4br_one', - `M4_S: last line.start - setkey_(`$4',lgth,brksiz_)dnl - line from M4_S to last line.end+vec_(-(m4lgth)*5/2,0) - sl_breaker(to rvec_(m4lgth,0),`$4') - $1(to rvec_((m4lgth)*3/2,0),`$3') - move to M4_S ') - - `sl_eleminit_(linespec or (for zero length) - U|D|L|R|number [at location])' -define(`sl_eleminit_', - `ifelse(regexp(`$1',^ *[UDLR0123456789]),-1, - `eleminit_(`$1',dimen_)', - `pushdef(`M4pos',`ifinstr(`$1',` at ',`patsubst(`$1',^.* at *)')')dnl - ifelse(M4pos,,,`move to M4pos;') setdir_(patsubst(`$1',` at.*')) - line invis from Here to Here popdef(`M4pos')')') - -# Two-terminal elements ################################################### - - `sl_transformer(linespec,keys, - input breaker keys, output breaker keys) - keys: - type=I|S - (type=I) loopwid=expr; (default dimen_*3/10) - cycles=n; (default 4) - core= A[ir]|M[n]|P[n]|K[n] - n=integer (default 2 lines) - (type=S) body=shaded "color"; - name=Body name; - (breaker default names BrI, BrO)' -define(`sl_transformer', - `setkeys_(`$2',name::N; type:I:N; cycles:4:N; core::N; body::N; - loopwid:3/20*dimen_; )dnl - ifelse(`$3'`$4',, - `ifinstr(m4type,S, - `source(`$1',G,,,m4body)', - `eleminit_(`$1'); m4atmp = rp_ang; m4slen = rp_len - ifelse(ifinstr(m4core,M,T,m4core,P,T,m4core,K,T),T, - `define(`m4nL',ifelse(len(m4core),1,2,substr(m4core,1)))dnl - define(`m4swd',(m4loopwid + dimen_/12+(m4nL-1)*dimen_/16))',dnl - `define(`m4swd',(m4loopwid*3/2))')dnl - { line to rvec_((m4slen-m4swd)/2,0) - {ifelse(m4name,,SL_box,m4name): [#linewid = linewid*m4scale - {L1: inductor(to vec_(0,-m4cycles*m4loopwid),,m4cycles,m4core, - m4loopwid)} - {point_(m4atmp) - L2: inductor(from vec_(m4swd,-m4cycles*m4loopwid) \ - to vec_(m4swd,0),,m4cycles,,m4loopwid)} - C2: last line.c; point_(m4atmp) ] with .L1.c at Here} - line from rvec_(m4swd,0) to rvec_((m4slen+m4swd)/2,0) } - line invis to rvec_(rp_len,0)') ', - `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 *)) ') - -# ####################################################################### - -# The following is defined in Circuit_macros 9.5.4 or later: - - `setkeys_(string,keysequence) - Invoke setkey_ on arg1 and each term in a - sequence of terms. - keysequence is a ;-separated sequence - of terms of the form - identifier:default value:N ' -define(`setkeys_',`Loopover_(`M4sk',`setkey_(`$1',patsubst(M4sk,:,`,')) dnl', - patsubst(`$2',;,`,'))') - -divert(0)dnl - - - 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) - ] +# slddiagsSVG.m4 +cct_init(svg_font(sans-serif,10bp__)) +include(libSLD.m4) +maxpsht = 30 + +Pic1: [ +define(`TrDeltaWye', + `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: sl_transformer(from Bus1.P3 down_ elen_,type=S,,,Delta,Y) + arrow down_ dimen_/3 + TRF2: sl_transformer(from Bus1.P4 down_ elen_,type=S,,,Delta,Y) + arrow down_ dimen_/3 + TRF3: sl_transformer(from Bus1.P5 down_ elen_,type=S,,,Delta,Y) + 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: sl_transformer(from Bus2.P1 down_ elen_,type=S,,,Delta,Y) + S4: switch(from Bus2.P3+(0,-elen_) to Bus2.P3) +] + +Pic2: [ +# 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 rgbstring(0.85, 0.65, 0.13) "Static Load" + line right_ dimen_*3/4 from B3.P2; box wid dimen_*3 ht dimen_*.6 \ + shaded rgbstring(0.79, 0.59, 0.57) "Electronic Load" + sl_disk(right_ dimen_ from B3.P3, + text="A/C";circle=shaded rgbstring(0.2, 0.8, 0.2);diam=dimen_*3/4) + sl_disk(right_ dimen_ from B3.P4, + text="M";circle=shaded rgbstring(0.21, 0.47, 0.86);diam=dimen_*3/4) + sl_disk(right_ dimen_ from B3.P5, + text="M";circle=shaded rgbstring(0.2, 0.6, 0.8);diam=dimen_*3/4) + sl_disk(right_ dimen_ from B3.P6, + text="M";circle=shaded rgbstring(0.2, 0.63, 0.8);diam=dimen_*3/4) + sl_disk(left_ dimen_ from 1/2 between B3.P1 and B3.P2, + 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__) + +Pic3: [ +define(`shadedb',`shaded rgbstring(0.39,0.50,0.93)') +Loopover_(`LR', # loop to take advantage of symmetry + `define(`opposite',`ifelse(LR,left,right,left)')dnl + ifelse(LR,left,L,R)`'side: [ + sl_generator(LR dimen_/2,type=B;name=G1;circle=shadedb,box=shadedb) + { move from G1 opposite last circle.rad*3/2 down_ last circle.rad + ifelse(LR,left,`Delta',`Wye')symbol(,size=sourcerad_*2/3) } + T1: sl_transformer(opposite dimen_*3/2,name=Tx) + Bus1: sl_busbar(up_ dimen_*3/2,3,) with .P2 at Here + Br1: sl_breaker(from Bus1.P3 opposite elen_,box=shadedb) + line opposite dimen_*4/3 + Br2: sl_breaker(from Bus1.P1 opposite elen_,box=shadedb) + Br3: sl_breaker(down_ dimen_,box=shadedb) + Bus2: sl_busbar(opposite dimen_,3) with .P2 at Here + T2: sl_transformer(down_ dimen_ from Bus2.P2,name=X2) + sl_disk(down_ dimen_/2,type=B;text="SM";name=SM1;circle=shadedb,box=shadedb) + { move from last circle opposite sourcerad_*3 + Wyesymbol(,type=G`'ifelse(LR,right,L);size=sourcerad_*2/3) } + ]', + left,right) + "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+(-25bp__,-32bp__) + "G`'svg_sub(2) 30 MVA" ljust "13.8 kV" ljust at Rside.G1.w+(10bp__,-28bp__) + "T`'svg_sub(1) 50 MVA" "13.8/69 kV svg_Delta/Y" \ + at Lside.Tx.s+(-2bp__,-25bp__) + "T`'svg_sub(2) 30 MVA" "69/13.8 kV Y/svg_Delta " \ + at Rside.Tx.s+(2bp__,-27bp__) + "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 "" diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EscherSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EscherSVG.m4 index 191123754e6..637f99b29a4 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EscherSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EscherSVG.m4 @@ -2,6 +2,8 @@ # EscherSVG.m4 # https://tex.stackexchange.com/questions/129274/showcase-of-optical-illusions-made-with-tex-latex-luatex-context threeD_init +[] +ifelse(1,1,` [ u=1/2.54 # unit size; could use scale for this @@ -107,82 +109,67 @@ define dorgb { gg = $2 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,` +define(`DPL',`(project(`$1',`$2',`$3'))') +define(`ISL',` + S1: `$2'; E1: `$2' + `$3' + S2: `$4'; E2: `$4' + `$5' + `$1': line from S2 to intersect_(S1,E1,S2,E2) ') + [ - 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) - + bwd = 2.8 + bht = 1.5 + bth = bwd/10 + setview(-45,20,0) + + L1: line from DPL(0,0,0) to DPL(0,0,bht) \ + then to DPL(0,bwd,bht) \ + then to DPL(bdp,bwd,bht) \ + then to DPL(bdp,bwd,0) \ + then to DPL(bdp,0,0) \ + then to DPL(0,0,0) + L2: line from DPL(bth,bth,bht) to DPL(bth,bwd-bth,bht) \ + then to DPL(bdp-bth,bwd-bth,bht) \ + then to DPL(bdp-bth,bth,bht) \ + then to DPL(bth,bth,bht) + L3: line from DPL(bth,bth,0) to DPL(bth,bwd-bth,0) \ + then to DPL(bdp-bth,bwd-bth,0) \ + then to DPL(bdp-bth,bth,0) \ + then to DPL(bth,bth,0) + L4: line from DPL(bdp,bth,bht-bth) to DPL(bdp,bwd-bth,bht-bth) \ + then to DPL(bdp,bwd-bth,bth) \ + then to DPL(bth+bth,bwd-bth,bth) + L5: line from DPL(bdp-bth,0,bht-bth) to DPL(bth,0,bht-bth) \ + then to DPL(bth,0,bth) \ + then to DPL(bth,bwd-bth-bth,bth) + L6: line from DPL(0,0,bht) to DPL(bdp,0,bht) \ + then to DPL(bdp,bwd,bht) + L7: line from DPL(0,0,0) to DPL(0,bwd,0) \ + then to DPL(bdp,bwd,0) + ISL(L8,L4.start,UPy_,L4.end,UPz_) + ISL(L9,L4.start,UPy_,DPL(0,bwd,0),UPz_) + ISL(L10,L4.start,UPy_,L5.end,UPz_) + ISL(L11,L5.end,UPy_,L4.start,UPz_) + ISL(L12,L5.end,UPy_,DPL(bdp,0,bht),UPz_) + ISL(L13,L5.end,UPy_,L5.start,UPz_) + ISL(L14,DPL(bdp-bth,bth,bht),UPy_,DPL(bth,bwd-bth-bth,bht-bth),UPz_) + ISL(L15,L2.start,UPx_,DPL(bth,bwd-bth-bth,bht-bth),UPy_) + ISL(L16,DPL(bdp-bth,bth,bht),UPy_,DPL(bth,bwd-bth,bht),UPz_) + ISL(L17,DPL(bdp-bth,bth,bht),UPy_,DPL(bth+bth,bwd-bth,bht-bth),UPz_) + ISL(L18,DPL(bdp-bth,bth,bht),UPy_,DPL(bth+bth,bwd-bth,bht-bth),UPx_) + ISL(L19,L3.start,UPy_,L5.start+DPL(0,0,-bht+bth+bth),UPx_) + ISL(L20,L3.start,UPy_,L5.start+DPL(0,0,-bht+bth+bth),UPz_) + ISL(L21,L3.start,UPy_,DPL(bdp-bth,bth,0),UPz_) + ISL(L22,L3.start,UPy_,L4.start+DPL(0,0,-bht+bth+bth),UPz_) + ISL(L23,DPL(bth,bwd-bth,0),UPx_,L4.start+DPL(0,0,-bht+bth+bth),UPy_) + ISL(L24,L5.start,UPx_,DPL(bth,bth,bth),UPz_) + ISL(L25,L4.start,UPy_,DPL(bdp-bth,bwd-bth,bth),UPz_) + +ifelse(0,1,`for i=1 to 7 do { exec sprintf("\"L%g.s\" at L%g.start",i,i) } + for i=8 to 10 do { exec sprintf("\"L%g\" at L%g",i,i) }') ] with .sw at last [].se+(0.2,0) ') .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EyeSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EyeSVG.m4 new file mode 100644 index 00000000000..457abb8081e --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EyeSVG.m4 @@ -0,0 +1,53 @@ +.PS +# EyeSVG.m4 +gen_init + +define(`eye',`[ u = $1; v = 0.47*u; w = 0.25*u + shade(1, + arc thick 0 from (u/2,0) to (-u/2,0) with .c at (0,-u/3) + arc thick 0 to (u/2,0) with .c at (0,u/3) ) + circle diam v fill_(0.24) at (0,0) + circle diam w fill_(0) at (0,0) + circle thick 0 diam last circle.diam/2 fill_(1) at last circle.nw + circle diam last circle.diam-lthick at last circle outlined graystring(0.9) + ] ') + + skale = 2/3 + Bx: box wid 11*skale ht 8.5*skale fill_(0) at (0,0) + C[0]: Bx.se; C[1]: Bx.nw + d[5] = 0.92*Bx.ht + d[4] = 0.78*Bx.ht + d[3] = 0.62*Bx.ht + d[2] = 0.40*Bx.ht + d[1] = 0.25*Bx.ht + ane = atan2(Bx.ht,Bx.wid)*rtod_ + dax = 360/64 + da = 1 + for a=-int(ane/dax)*dax to 180-ane by dax do { + T1: intersect_(Bx.ne,C[(a>ane)],Bx,(Rect_(1,a+da))) + T2: intersect_(Bx.ne,C[(a>ane)],Bx,(Rect_(1,a))) + line outlined "white" shaded "white" from Bx to T1 then to T2 then to Bx + line outlined "white" shaded "white" from Bx to T1*(-1) \ + then to T2*(-1) then to Bx + } + for i=5 to 2 by -1 do { + C[i]: circle diam d[i] fill_(0) at Bx + for a=0 to 359 by dax do { + T1: Rect_(d[i]/2,a) + T2: Rect_(d[i]/2,a-da*2) + nx = int(distance(T1,T2)/lthick*1.5+0.5) + for h = 1 to nx-1 do { + spline 0.55 outlined "white" from h/nx between T1 and T2 \ + to 0.8 between Bx and T2 then to (Rect_(d[i]/4,a+31)) } + } + } + C[1]: circle thick 2 diam d[1] at Bx fill_(0.1) + eye(d[1]-4bp__) at (0,0) + for a=0 to 359 by dax do { + T1: (Rect_(d[1]/2-1bp__,a)) + T2: (Rect_(d[1]/2-1bp__,a+dax/2)) + line thick 0.4 from T1 to T2 then to 0.5 between Bx and T2 \ + then to 0.5 between Bx and T1 then to T1 shaded "white" + } + +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4 index f0f5b6df71b..05f411cd6ac 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4 @@ -75,7 +75,7 @@ Repeatuntil: Frepeatuntil("svg_it(n svg_gt 5)",,,Fbox("Task"), "svg_it(.S)" at Repeatuntil.S rjust below "svg_it(.E)" at Repeatuntil.E ljust "svg_it(.W)" at Repeatuntil.W rjust - "svg_tt(`Frepeatuntil')" below at Repeatuntil.se +(-0.0,0.2) + "svg_tt(`Frepeatuntil')" below at Repeatuntil.se +(-0.0,0.1) Ifthenelse: Fifthenelse("svg_it(A svg_lt B)",,, Fbox("False"), diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FourbarSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FourbarSVG.m4 index 208e8178222..376fbe8efeb 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FourbarSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FourbarSVG.m4 @@ -35,8 +35,8 @@ define(`pivot',`[ B2: Cintersect(A0,b-a,B0,c) arc dashed from B1 to B2 with .c at B0 - A0B1: line thick 1.6 from A0 to B1 chop 2 chop - line thick 1.6 from B0 to B1 chop 2 chop "svg_it(c)" ljust + A0B1: line thick 1.6 from A0 to B1 chop 2 chop 0 + line thick 1.6 from B0 to B1 chop 2 chop 0 "svg_it(c)" ljust circle fill_(1) at B1; "svg_it(B`'svg_sub(1))" wid 3 at B1+(5,0) A1: circle fill_(1) at LCintersect(A0B1,A0,a,R) "svg_it(A`'svg_sub(1))" at A1+(5,0) diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GeometrySVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GeometrySVG.m4 index 5dc1284d080..de5fc625236 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GeometrySVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GeometrySVG.m4 @@ -1,14 +1,12 @@ .PS # Geometry.m4 +# Some constructions from https://tex.stackexchange.com/ gen_init - maxpswid = 10 - scale = 5/4 -Fig1: [ - - 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 @@ -45,181 +43,45 @@ Fig1: [ line dashed from X to Y chop -linewid/2 RightAngle(A,Z,Y) - ] scaled 0.8 - -Fig2: [ -#.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 .w at last [].e+(0.5,0) + ] + +Fig2: [ ls = 3/4 # local scale +# https://tex.stackexchange.com/questions/593272/drawing-complex-geometry + P: dot(at Here); "P" at P.s below + N: dot(at P+(3.5*ls,1.5*ls)); "N" at N.se ljust below + O: dot(at (N,P)); "O" at O.s below + R: dot(at 1/3 between O and P);"R" at R.s below + M: dot(at (R,N)); "M" at M.se ljust below + Q: dot(at (M.x,M.y+distance(M,N)/distance(N,O)*distance(P,O)));"Q" at Q.e ljust + line from P to Q then to N then to O + B: line to P chop -0.3 + line from M to N + Pu: line from R to Q chop 0 chop -0.3 + H: line from P to N chop 0 chop -0.3 + X: dot(at Intersect_(Pu,H)); "X" at X.se ljust below + thinlines_ + RightAngle(Q,M,N) + RightAngle(Q,N,H.end) + RightAngle(N,O,B.start) + ArcAngle(N,P,Q,0.4); "svg_beta" at last arc.ne above ljust + ArcAngle(O,P,N,0.5); "svg_alpha" at last arc.start+(5bp__,8bp__) + ArcAngle(R,Q,N,0.5); "svg_alpha" at last arc.start+(8bp__,-5bp__) + ] with .w at Fig1.e+(-0.4,0) Fig3: [ +# FourbarSVG.m4 # https://tex.stackexchange.com/questions/609452/help-drawing-a-more-sophisticated-right-triangle-with-tikz-or-something-else -gen_init - unit = 0.8 + textkht = 12/72 + unit = 0.6 C: Here; { "C" at C rjust below } B: C+(4*unit,0); { "B" at B ljust below } A: C+(0,3*unit); { "A" at A rjust above } H: PerpTo(C,A,B); { "H" at H ljust above } line from C to H then to B then to C shaded rgbstring(0.5,0.8,0.9) +# line from C to H then to B then to C shaded "CornflowerBlue" line from C to H then to A then to C shaded rgbstring(0.8,0.9,0.7) +# line from C to H then to A then to C shaded "SpringGreen" ArcAngle(C,A,B,unit*0.4) ArcAngle(C,A,B,unit*0.5) ArcAngle(A,B,C,unit*0.5,,"svg_theta" rjust) @@ -228,6 +90,66 @@ gen_init RightAngle(B,C,A,unit*0.17) RightAngle(C,H,A,unit*0.17) - ] with .sw at Fig2.se+(0.2,0) + ] with .nw at Fig1.sw+(0.2,-0.3) + +Fig4: [ + +# FourbarSVG.m4 +# https://tex.stackexchange.com/questions/563831/how-to-draw-four-bar-linkage-with-center-of-mass +ls = 1/25.4 # local scale + + a = 18*ls + b = 73*ls + c = 47*ls + d = 72*ls + A0: Here + B0: A0+(d,0) + circlerad = 1*ls + +define(`pivot',`[ + C: circle + line down_ 4*ls from C+(2*ls,0) + arc from last line.start to C+(-2*ls,0) with .c at C + line down_ 4*ls + B: line thick 1.6 right 7*ls with .c at (C,Here) + thinlines_ + sep = 0.9*ls + nhash = B.len/sep + for i=0 to nhash do { line down sep left sep from B.end-(i/nhash*B.len,0) } + thicklines_ + ]') + + pivot with .C at A0; "A`'svg_sub(0)" at A0-(5,0)*ls + circle dashed rad a at A0 + pivot with .C at B0; "B`'svg_sub(0)" at B0-(5,0)*ls + "d = A`'svg_sub(0)B`'svg_sub(0)" at 0.5 + + B1: Cintersect(A0,a+b,B0,c) + B2: Cintersect(A0,b-a,B0,c) + arc dashed from B1 to B2 with .c at B0 + + A0B1: line thick 1.6 from A0 to B1 chop 2*ls chop 0 + line thick 1.6 from B0 to B1 chop 2*ls chop 0 "c" ljust + circle fill_(1) at B1; "B`'svg_sub(1)" wid 3*ls at B1+(5,0)*ls + A1: circle fill_(1) at LCintersect(A0B1,A0,a,R) + "A`'svg_sub(1)" at A1+(5,0)*ls + + A2: b/(b-a) between B2 and A0; "a" at 0.4 above rjust + "b" at 0.4 above rjust + A2B2: line thick 1.6 from A2 to B2 + line thick 1.6 from B0 to B2 chop 2*ls chop 0 + circle fill_(1) at B2; "B`'svg_sub(2)" at B2+(5,0)*ls + circle fill_(1) at A2; "A`'svg_sub(2)" at A2+(5,0)*ls + + thinlines_ + line from B0+(3*ls,0) right 4*ls + ArcAngle(Here,B0,B1,5*ls) ->; "svg_psi`'svg_sub(0)" at last arc.ne above ljust + ArcAngle(B1,B0,B2,8*ls) ->; "svg_psi" at last arc.n+(-3*ls,0) above + ArcAngle(A1,A0,B2,b*0.45) ->; "svg_theta" at last arc.start+(0,4*ls) + line from A0+(3*ls,0) right 8*ls + ArcAngle(Here,A0,B1,9*ls) ->; "svg_theta`'svg_sub(0)" \ + at last arc.start+(2,2)*ls + + ] with .nw at Fig3.ne+(0.2,0.2) .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4 index d6b29d0fa02..37e6d746c69 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4 @@ -1,7 +1,9 @@ .PS # LoglogSVG.m4 gen_init(svg_font(sans-serif,11bp__)) +maxpswid = 12 +LL: [ define(`rint',`sign(`$1')*int(abs(`$1')+.5)') S:[ horiz = 4 @@ -76,6 +78,553 @@ Q: box invis fill_(1) wid 0.80 ht 0.18 \ # box wid S.wid ht S.ht at S # print (S.wid,S.ht)/(1 pc__) + command "" # end font +] # LL +#showbox_ + +Cons: [ +#.PS +## Consumption.m4 +#gen_init +svg_font(Helvetica,10pt__) + +#svg_rot_init(test) +svg_rot_init(LoglogSVG) + +divert(-1) + `brace(linespec,depth,arm thickness,attributes) + Curly brace along linespec + default depth is linewid/5 + attributes = eg + thick 0.4 outlined "string" shaded "string" + (default black)' +define(`brace',`rpoint_(ifelse(`$1',,`to rvec_(linewid,0)',`$1')) + M4brS: last line.start; M4brE: last line.end + [ brdepth = ifelse(`$2',,linewid/5,`$2') + brthick = ifelse(`$3',,brdepth/6,`$3') + define(`m4braceattribs', + `ifelse(`$4',,`thick 0.4 shaded rgbstring(0,0,0)',`$4')')dnl + tension = 0.55 + halfwid = distance(M4brS,M4brE) + smallrad = brdepth-brthick + bigrad = brdepth+brthick + for sgn=1 to -1 by -2 do { + S: rvec_(sgn*halfwid/2,0) + A: S+vec_(0,smallrad/2) + B: vec_(0,smallrad/2) + T: vec_(0,brdepth) + C: vec_(0,bigrad/2) + D: vec_(sgn*halfwid/2,bigrad/2) + {spline tension m4braceattribs \ + from S to tension between S and A \ + then to tension between A-vec_(sgn*bigrad/2,0) and A \ + then to A-vec_(sgn*bigrad/2,0) \ + then to B+vec_(sgn*bigrad/2,0) \ + then to tension between B+vec_(sgn*bigrad/2,0) and B \ + then to tension between T and B \ + then to T \ + then to tension between T and C \ + then to tension between C+vec_(sgn*bigrad/2,0) and C \ + then to C+vec_(sgn*bigrad/2,0) \ + then to D-vec_(sgn*bigrad/2,0) \ + then to tension between D-vec_(sgn*bigrad/2,0) and D \ + then to tension between S and D \ + then to S } + } + E: (0,0) +] with .E at 0.5 between M4brS and M4brE') +divert(0)dnl + +#nl raw data ranges + rxmin=1.76665, rxmax=5.87332, rymin=1.49164, rymax=4.00836 + +#nl horiz range + yearmin = 1850 + yearmax = 2040 +#nl data ranges + tonsmin = 0 + tonsmax = 2.0 + popmin = 0 + popmax = 10 +#nl page graph size + minx = 0 + maxx = 4.5 + maxx = 4.566 + miny = 0 + maxy = 3.5 + +define dtop {(minx + ($1-yearmin)/(yearmax-yearmin)*(maxx-minx), \ + miny + ($2-tonsmin)/(tonsmax-tonsmin)*(maxy-miny))} +define ptop {(minx + ($1-yearmin)/(yearmax-yearmin)*(maxx-minx), \ + miny + ($2-popmin)/(popmax-popmin)*(maxy-miny))} + +define(`rtod',`yearmin + (`$1'-rxmin)/(rxmax-rxmin)*(2010-yearmin), \ + tonsmin + (`$2'-rymin)/(rymax-rymin)*1.8') + +[ +nD = 0 +define data { nD+=1 + yr[nD]=$1; pop[nD]=$2/1e9; wood[nD]=$3; other[nD]=$4; hydro[nD]=$5 + coal[nD]=$6; oil[nD]=$7; gas[nD]=$8; nuclear[nD]=$9 } + +data(1850,1241000000,0.238506368,0.238506368,0.238506368,0.274220157,0.274220157,0.276138711,0.276138711) +data(1851,1247847137,0.238701076,0.238701076,0.238701076,0.2788137,0.2788137,0.280785327,0.280785327) +data(1852,1254732053,0.238886465,0.238886465,0.238886465,0.287918165,0.287918165,0.289942225,0.289942225) +data(1853,1261654955,0.239062633,0.239062633,0.239062633,0.290097546,0.290097546,0.292173405,0.292173405) +data(1854,1268616055,0.239229675,0.239229675,0.239229675,0.289984551,0.289984551,0.292111579,0.292111579) +data(1855,1275615561,0.239387687,0.239387687,0.239387687,0.289864062,0.289864062,0.292041635,0.292041635) +data(1856,1282653687,0.239651345,0.239651345,0.239651345,0.301026039,0.301026039,0.303253538,0.303253538) +data(1857,1289730646,0.239904902,0.239904902,0.239904902,0.298720029,0.298720029,0.300996841,0.300996841) +data(1858,1296846651,0.24014846,0.24014846,0.24014846,0.303062054,0.303062054,0.30538757,0.30538757) +data(1859,1304001918,0.240382123,0.240382123,0.240382123,0.309545901,0.309914765,0.312288384,0.312288384) +data(1860,1311196664,0.24060599,0.24060599,0.24060599,0.309390256,0.310123937,0.312545059,0.312545059) +data(1861,1318431107,0.240590657,0.240590657,0.240590657,0.319869525,0.320964008,0.323432041,0.323432041) +data(1862,1325705465,0.240568247,0.240568247,0.240568247,0.308599723,0.310051026,0.312565381,0.312565381) +data(1863,1333019958,0.24053884,0.24053884,0.24053884,0.318950063,0.320754238,0.323314334,0.323314334) +data(1864,1340374810,0.240502511,0.240502511,0.240502511,0.327038715,0.329191844,0.331797103,0.331797103) +data(1865,1347770241,0.240459339,0.240459339,0.240459339,0.328647778,0.331145979,0.333795828,0.333795828) +data(1866,1347770241,0.242191279,0.242191279,0.242191279,0.330379718,0.333234804,0.335943539,0.335943539) +data(1867,1362683739,0.241253672,0.241253672,0.241253672,0.336892133,0.340068952,0.342806283,0.342806283) +data(1868,1370202258,0.24163346,0.24163346,0.24163346,0.336747138,0.340257568,0.3430378,0.3430378) +data(1869,1377762260,0.242001817,0.242001817,0.242001817,0.33659359,0.340433875,0.343256455,0.343256455) +data(1870,1385363974,0.242358855,0.242358855,0.242358855,0.348847699,0.353014113,0.355878493,0.355878493) +data(1871,1393007630,0.24215233,0.24215233,0.24215233,0.358346838,0.362835686,0.365741322,0.365741322) +data(1872,1400693459,0.241940775,0.241940775,0.241940775,0.365684522,0.37049214,0.373438493,0.373438493) +data(1873,1408421694,0.24172425,0.24172425,0.24172425,0.360718048,0.365840803,0.368827338,0.368827338) +data(1874,1416192570,0.241502816,0.241502816,0.241502816,0.363892286,0.369326575,0.372352763,0.372352763) +data(1875,1424006320,0.241276535,0.241276535,0.241276535,0.362994434,0.368736684,0.371802,0.371802) +data(1876,1431863183,0.240604702,0.240604702,0.240604702,0.369663316,0.375709983,0.378813907,0.378813907) +data(1877,1439763395,0.239932976,0.239932976,0.239932976,0.368283426,0.374630997,0.377773011,0.377773011) +data(1878,1447707196,0.239261379,0.239261379,0.239261379,0.366907548,0.373552539,0.376732133,0.376732133) +data(1879,1455694826,0.238589927,0.238589927,0.238589927,0.373413172,0.380352127,0.383568794,0.383568794) +data(1880,1463726528,0.23791864,0.23791864,0.23791864,0.383753486,0.390982979,0.394236217,0.394236217) +data(1881,1471802544,0.237570608,0.237570608,0.237570608,0.392344331,0.399860965,0.403150275,0.403150275) +data(1882,1479923119,0.237219231,0.237219231,0.237227977,0.396963826,0.404764232,0.40808912,0.40808912) +data(1883,1488088499,0.236864558,0.236864558,0.236881953,0.403447314,0.411528151,0.414888128,0.414888128) +data(1884,1496298931,0.236506634,0.236506634,0.236532584,0.406015836,0.414373792,0.417768372,0.417768372) +data(1885,1504554663,0.236145507,0.236145507,0.236179917,0.404733187,0.413364978,0.416793681,0.416793681) +data(1886,1512855946,0.235261191,0.235261191,0.235303968,0.40293236,0.411834727,0.415297076,0.415297076) +data(1887,1521203030,0.23437947,0.23437947,0.23443052,0.406792802,0.415962519,0.419458041,0.419458041) +data(1888,1529596169,0.233500342,0.233500342,0.233559574,0.423718314,0.433152176,0.436680404,0.436680404) +data(1889,1538035617,0.232623805,0.232623805,0.232691127,0.425534315,0.435229149,0.438789617,0.438789617) +data(1890,1546521628,0.231749857,0.231749857,0.231825179,0.431025052,0.44097771,0.444569959,0.444569959) +data(1891,1555054461,0.23057828,0.23057828,0.230661512,0.436142504,0.446349864,0.449973439,0.449973439) +data(1892,1563634373,0.229412583,0.229412583,0.229503635,0.439357394,0.449816361,0.453470809,0.453470809) +data(1893,1572261624,0.228252736,0.228252736,0.228351521,0.431583686,0.442291192,0.445976065,0.445976065) +data(1894,1580936476,0.22709871,0.22709871,0.22720514,0.436575574,0.447528576,0.45124343,0.45124343) +data(1895,1589659190,0.225950477,0.225950477,0.226064464,0.441499685,0.452695166,0.456439562,0.456439562) +data(1896,1598430032,0.225392144,0.225392144,0.225513603,0.450527775,0.461962746,0.465736247,0.465736247) +data(1897,1607249265,0.224833135,0.224833135,0.224961981,0.457659825,0.469331318,0.473133492,0.473133492) +data(1898,1616117159,0.224273475,0.224273475,0.224409622,0.473569462,0.48547454,0.489304958,0.489304958) +data(1899,1625033980,0.223713188,0.223713188,0.223856553,0.494583176,0.506718923,0.510577162,0.510577162) +data(1900,1634000000,0.223152296,0.223152296,0.223302795,0.504825195,0.51718872,0.521074359,0.521074359) +data(1901,1648219401,0.221510378,0.221510378,0.221677629,0.505816316,0.519528083,0.5237969,0.5237969) +data(1902,1662562543,0.219880182,0.219880182,0.220068436,0.508573752,0.523333498,0.527978592,0.527978592) +data(1903,1677030501,0.218261627,0.218261627,0.218478353,0.530583699,0.546223844,0.551238406,0.551238406) +data(1904,1691624363,0.216654634,0.216654634,0.216900192,0.527887731,0.545298807,0.550676116,0.550676116) +data(1905,1706345223,0.215059124,0.215059124,0.215337131,0.547716584,0.564693219,0.570426643,0.570426643) +data(1906,1721194188,0.214836225,0.214836225,0.215148552,0.563118074,0.579880854,0.585963848,0.585963848) +data(1907,1736172371,0.214601167,0.214601167,0.214954035,0.596547339,0.617095414,0.62352152,0.62352152) +data(1908,1751280897,0.214354174,0.214354174,0.214752998,0.574277169,0.596299335,0.60306218,0.60306218) +data(1909,1766520901,0.214095471,0.214095471,0.214542936,0.586977877,0.609919015,0.61701231,0.61701231) +data(1910,1781893526,0.213825278,0.213825278,0.214318488,0.603352348,0.628089516,0.635693908,0.635693908) +data(1911,1797399927,0.212500054,0.212500054,0.213041248,0.605588411,0.631564823,0.639504319,0.639504319) +data(1912,1813041268,0.211181781,0.211181781,0.211751647,0.620130467,0.646297549,0.654565803,0.654565803) +data(1913,1828818723,0.209870438,0.209870438,0.210513435,0.644310839,0.672912362,0.681503109,0.681503109) +data(1914,1844733476,0.208566004,0.208566004,0.209324315,0.595307622,0.624513467,0.633420528,0.633420528) +data(1915,1860786724,0.207268457,0.207268457,0.208098411,0.584702733,0.615780985,0.624998263,0.624998263) +data(1916,1876979669,0.204485426,0.204485975,0.205402589,0.605882504,0.638934007,0.648455487,0.648455487) +data(1917,1893313529,0.201734987,0.201735896,0.202715085,0.616179081,0.652399178,0.662218924,0.662218924) +data(1918,1909789530,0.199016787,0.199017732,0.200115349,0.602687652,0.638337653,0.648449811,0.648449811) +data(1919,1926408908,0.196330472,0.196331097,0.196945715,0.535439366,0.575689906,0.586088699,0.586088699) +data(1920,1943172912,0.193675695,0.193676005,0.195243412,0.579848388,0.630973534,0.641653264,0.641653264) +data(1921,1960082799,0.192957547,0.192958381,0.194440762,0.512833825,0.567705487,0.578660532,0.578660532) +data(1922,1977139839,0.192237376,0.192238246,0.193895625,0.527050727,0.587771773,0.599365431,0.599365431) +data(1923,1994345313,0.19151527,0.191516348,0.193525554,0.578230714,0.649426509,0.662893064,0.662893064) +data(1924,2011700513,0.190791315,0.190792469,0.192986897,0.564368556,0.634750802,0.650057077,0.650057077) +data(1925,2029206742,0.190065598,0.190066911,0.192579912,0.561692328,0.634850472,0.651963721,0.651963721) +data(1926,2046865313,0.189342426,0.18934419,0.192313939,0.556598403,0.631036129,0.649924035,0.649924035) +data(1927,2064677552,0.188617585,0.188619709,0.191901916,0.581066305,0.66532014,0.685950808,0.685950808) +data(1928,2082644798,0.187891159,0.187893595,0.191560967,0.570524051,0.658240401,0.680582356,0.680582356) +data(1929,2082644798,0.188791962,0.188794439,0.19317309,0.596191895,0.694524554,0.718247863,0.718247863) +data(1930,2119049713,0.186433874,0.186436187,0.190385499,0.552331717,0.644491424,0.668934944,0.668934944) +data(1931,2137490116,0.185921585,0.185923717,0.190113868,0.506565457,0.594964462,0.620348577,0.620348577) +data(1932,2156090991,0.185404259,0.185406253,0.189724679,0.468661357,0.552304395,0.578611056,0.578611056) +data(1933,2174853735,0.184882022,0.184885026,0.189466471,0.478973885,0.569521584,0.596732983,0.596732983) +data(1934,2193779755,0.184354996,0.184357857,0.189137885,0.50231919,0.597048389,0.625146959,0.625146959) +data(1935,2212870475,0.183823303,0.183826489,0.189391253,0.513244919,0.615346693,0.6443151,0.6443151) +data(1936,2232127325,0.183422624,0.183426207,0.189292235,0.541976812,0.652213355,0.6820345,0.6820345) +data(1937,2251551752,0.183015177,0.183016132,0.189691455,0.557024422,0.681411525,0.713128315,0.713128315) +data(1938,2271145215,0.182601109,0.182608794,0.189219601,0.528985648,0.649365004,0.682755166,0.682755166) +data(1939,2290909184,0.182180563,0.182198879,0.189050477,0.544855454,0.669193862,0.704673928,0.704673928) +data(1940,2310845143,0.181753683,0.181773628,0.188817984,0.577859192,0.705095325,0.742626751,0.742626751) +data(1941,2330954589,0.180256141,0.180280081,0.187681608,0.587475315,0.717410922,0.756955672,0.756955672) +data(1942,2351239032,0.17877091,0.178803567,0.18636161,0.589499673,0.710751063,0.752271606,0.752271606) +data(1943,2371699993,0.17729789,0.177330845,0.185849103,0.596589637,0.725948747,0.769408049,0.769408049) +data(1944,2392339011,0.17583698,0.175847008,0.183932936,0.574921594,0.722215099,0.767576618,0.767576618) +data(1945,2413157633,0.174388081,0.174391359,0.182283924,0.493293215,0.63914527,0.68637295,0.68637295) +data(1946,2434157423,0.173522919,0.173531361,0.182267965,0.514250229,0.668057865,0.717384008,0.717384008) +data(1947,2455339957,0.172659705,0.172683238,0.181755468,0.551547112,0.719518964,0.773619655,0.773619655) +data(1948,2476706827,0.17179847,0.171828917,0.181742644,0.560535238,0.749010917,0.809647204,0.809647204) +data(1949,2498259635,0.170939245,0.17097559,0.181133719,0.538171636,0.723949765,0.788183962,0.788183962) +data(1950,2557628654,0.167579756,0.167622721,0.178408185,0.559396293,0.762977841,0.834822272,0.834822272) +data(1951,2594938936,0.167032664,0.167085184,0.179115513,0.574723533,0.802272625,0.886283415,0.886283415) +data(1952,2636770386,0.166215588,0.166275557,0.178905263,0.565999791,0.801386992,0.890443027,0.890443027) +data(1953,2682050452,0.165211328,0.165271599,0.178153454,0.56040182,0.805094458,0.897685967,0.897685967) +data(1954,2730224110,0.164066346,0.164125585,0.177552809,0.548214509,0.799870041,0.895277726,0.895277726) +data(1955,2782093851,0.162744571,0.162802026,0.177062242,0.572289721,0.849071541,0.950920777,0.950920777) +data(1956,2835293441,0.161343608,0.161397559,0.176802814,0.586639897,0.882197665,0.990604979,0.990610309) +data(1957,2891342302,0.159836585,0.159890471,0.176313385,0.589494533,0.894932945,1.010584994,1.010622753) +data(1958,2948128605,0.158347259,0.158403549,0.176092897,0.594122165,0.901178987,1.023306716,1.023348608) +data(1959,3000706677,0.157134282,0.157194027,0.175092878,0.60075882,0.926301469,1.060278841,1.060403012) +data(1960,3042990271,0.156490706,0.156555865,0.175795691,0.61309257,0.958977014,1.102738263,1.102971765) +data(1961,3084007286,0.155724141,0.155801371,0.175847845,0.582341401,0.945610971,1.097964839,1.098333034) +data(1962,3140187350,0.154229357,0.154309778,0.175037739,0.583886676,0.970894477,1.134494733,1.135032498) +data(1963,3209978774,0.152139251,0.152229147,0.173552486,0.585699084,0.991892736,1.166953505,1.167858812) +data(1964,3281412257,0.150062967,0.150160837,0.171811855,0.592867755,1.021995792,1.209049525,1.210281169) +data(1965,3350699989,0.14816998,0.148271574,0.171655685,0.592192206,1.043069039,1.239349435,1.241269627) +data(1966,3421015609,0.147131043,0.14723349,0.171776593,0.589397107,1.068586677,1.275452622,1.27813231) +data(1967,3490735455,0.146158896,0.14626543,0.170803075,0.56557596,1.069927556,1.288070014,1.291237119) +data(1968,3562786611,0.145129793,0.1452355,0.170411047,0.568040201,1.107666962,1.34146315,1.345320724) +data(1969,3637707956,0.14402776,0.144141478,0.170254838,0.567570209,1.136409991,1.38786865,1.392325229) +data(1970,3713327898,0.142943308,0.143053274,0.169862261,0.574604634,1.187424472,1.460093809,1.4656198) +data(1971,3790980082,0.141867123,0.1419725,0.169518561,0.562377273,1.199174341,1.484731543,1.492185663) +data(1972,3867242256,0.14088476,0.141006603,0.169241956,0.55299154,1.211873977,1.508449967,1.518429829) +data(1973,3942790520,0.139965732,0.140098019,0.168229646,0.551337808,1.256519325,1.5637256,1.576827076) +data(1974,4017323955,0.139116394,0.139264313,0.169566501,0.548855283,1.243354913,1.55159078,1.568155026) +data(1975,4088810897,0.138401041,0.13856795,0.16866321,0.563492361,1.21131787,1.515162671,1.537578295) +data(1976,4158888836,0.137644673,0.137823056,0.167542119,0.566773642,1.257660106,1.569161684,1.594857237) +data(1977,4229748034,0.136888084,0.137068744,0.166990254,0.571441309,1.275256046,1.610533422,1.641644931) +data(1978,4300631215,0.136155668,0.136323913,0.168223987,0.572181835,1.27205561,1.591706702,1.627562741) +data(1979,4374349678,0.135359212,0.13557451,0.168367796,0.588798681,1.303224877,1.642092677,1.678738222) +data(1980,4445423675,0.13466922,0.135694224,0.169018612,0.535103352,1.264795628,1.575204786,1.612060086) +data(1981,4526817917,0.134213008,0.135336361,0.168515198,0.530410164,1.209074468,1.518426926,1.559512282) +data(1982,4607193353,0.133802494,0.135342954,0.168753641,0.536996737,1.176267133,1.47980709,1.52463367) +data(1983,4688582743,0.133377208,0.135246041,0.169576319,0.532088682,1.158420925,1.46002144,1.510279864) +data(1984,4767669177,0.133030663,0.135364454,0.170242063,0.54694641,1.180279911,1.506703536,1.566412047) +data(1985,4849860549,0.132610473,0.135051242,0.169658748,0.552747513,1.171095757,1.504285752,1.573424331) +data(1986,4934211409,0.131291387,0.133685377,0.168393392,0.554194404,1.186400652,1.520044231,1.593296333) +data(1987,5021085089,0.129951317,0.132539382,0.166722644,0.554231496,1.181208808,1.524791298,1.603295671) +data(1988,5108736553,0.128637242,0.13125772,0.166140318,0.556210491,1.195203161,1.549641815,1.633219996) +data(1989,5195979089,0.127377522,0.13079373,0.164881748,0.553926742,1.193159265,1.553390392,1.638232703) +data(1990,5284252039,0.126134805,0.129737215,0.164632138,0.553384674,1.190735096,1.553386431,1.640350219) +data(1991,5367488662,0.125428663,0.12928236,0.164254982,0.528423389,1.154980396,1.516498613,1.613399159) +data(1992,5452187873,0.124710625,0.128643771,0.163153115,0.518552304,1.13735672,1.494240768,1.590566106) +data(1993,5534418049,0.12406988,0.128046593,0.163990775,0.50470235,1.119339298,1.477198192,1.575200738) +data(1994,5614530098,0.123494469,0.127690239,0.163473418,0.506216459,1.12531413,1.481458633,1.580083078) +data(1995,5695823105,0.122909758,0.127213893,0.164248122,0.510641048,1.135855904,1.49167459,1.592774524) +data(1996,5776327747,0.12216812,0.12649691,0.163557636,0.510522671,1.141850345,1.503121808,1.606488473) +data(1997,5854841500,0.121488167,0.12619452,0.163583023,0.524945344,1.167177534,1.523679854,1.624760285) +data(1998,5932024858,0.120853308,0.125593429,0.162567495,0.521014085,1.167330383,1.52595967,1.627688406) +data(1999,6008646651,0.120245994,0.125081498,0.162173341,0.512693203,1.14325022,1.505666716,1.609442579) +data(2000,6084703879,0.119665076,0.124729832,0.16178992,0.513011266,1.158715327,1.529969497,1.634878653) +data(2001,6160890093,0.119894056,0.125258541,0.161095098,0.524198822,1.1611659,1.535602425,1.642047723) +data(2002,6237154134,0.118903979,0.124921559,0.160784753,0.529942594,1.153921617,1.530689162,1.637033401) +data(2003,6313942570,0.117913902,0.124642773,0.160192176,0.546832827,1.182503339,1.566938847,1.670839416) +data(2004,6390636309,0.116923825,0.12432827,0.161759107,0.565673251,1.221114221,1.610936278,1.717713694) +data(2005,6467431499,0.115933748,0.124259776,0.162887647,0.604148825,1.263290753,1.659620623,1.765386482) +data(2006,6545218993,0.114943672,0.124695239,0.164252513,0.623509498,1.274460793,1.680457898,1.786351327) +data(2007,6623523655,0.113953595,0.125629532,0.165251003,0.637952129,1.279256584,1.68820381,1.790810594) +data(2008,6702159402,0.112963518,0.127142703,0.167940953,0.64989848,1.292105043,1.710278853,1.811269586) +data(2009,6780833881,0.111973441,0.127858368,0.168866486,0.654393109,1.282816573,1.686869485,1.785251313) +data(2010,6858584755,0.110983364,0.12921584,0.172117414,0.680609275,1.328410794,1.756431211,1.856334479) +data(2011,6935999491,0.109993287,0.130385385,0.173636892,0.704216284,1.348176864,1.785673581,1.880255695) +data(2012,7013871313,0.10900321,0.130975574,0.175672274,0.688388925,1.341250864,1.785302272,1.872409847) +data(2013,7092128094,0.108013133,0.132480909,0.177353971,0.688378378,1.336238537,1.781754888,1.868322734) +data(2014,7169968185,0.107023056,0.133567224,0.177755023,0.681107631,1.336758872,1.78693987,1.874787234) +data(2015,7247892788,0,0,0,0,0,0,0) +data(2016,7325996709,0,0,0,0,0,0,0) +data(2017,7405107650,0,0,0,0,0,0,0) +nD0=nD-3 + +define yrdata { nyd +=1; yrd[nyd]=$1; ypop[nyd]=$2/1e9 } + +nyd = 0 +yrdata(1850,1169923623) +yrdata(1851,1177298999) +yrdata(1852,1184724181) +yrdata(1853,1192199527) +yrdata(1854,1199725401) +yrdata(1855,1207302168) +yrdata(1856,1214930197) +yrdata(1857,1222609858) +yrdata(1858,1230341525) +yrdata(1859,1238125576) +yrdata(1860,1245962390) +yrdata(1861,1253852349) +yrdata(1862,1261795840) +yrdata(1863,1269793250) +yrdata(1864,1277844972) +yrdata(1865,1285951399) +yrdata(1866,1294112930) +yrdata(1867,1302329966) +yrdata(1868,1310602910) +yrdata(1869,1318932168) +yrdata(1870,1327318152) +yrdata(1871,1335761275) +yrdata(1872,1344261952) +yrdata(1873,1352820603) +yrdata(1874,1361437653) +yrdata(1875,1370113525) +yrdata(1876,1379548537) +yrdata(1877,1389051752) +yrdata(1878,1398623687) +yrdata(1879,1408264863) +yrdata(1880,1417975804) +yrdata(1881,1427757042) +yrdata(1882,1437609109) +yrdata(1883,1447532543) +yrdata(1884,1457527886) +yrdata(1885,1467595685) +yrdata(1886,1477736490) +yrdata(1887,1487950857) +yrdata(1888,1498239345) +yrdata(1889,1508602518) +yrdata(1890,1519040944) +yrdata(1891,1529555197) +yrdata(1892,1540145854) +yrdata(1893,1550813497) +yrdata(1894,1561558712) +yrdata(1895,1572382092) +yrdata(1896,1583284233) +yrdata(1897,1594265734) +yrdata(1898,1605327202) +yrdata(1899,1616469247) +yrdata(1900,1630171098) +yrdata(1901,1644554295) +yrdata(1902,1659067684) +yrdata(1903,1673712471) +yrdata(1904,1688489874) +yrdata(1905,1703401122) +yrdata(1906,1718447458) +yrdata(1907,1733630134) +yrdata(1908,1748950415) +yrdata(1909,1764409579) +yrdata(1910,1780008913) +yrdata(1911,1795749721) +yrdata(1912,1811633314) +yrdata(1913,1827661021) +yrdata(1914,1843834178) +yrdata(1915,1860154139) +yrdata(1916,1876622267) +yrdata(1917,1893239939) +yrdata(1918,1910008546) +yrdata(1919,1926929491) +yrdata(1920,1944419089) +yrdata(1921,1962566145) +yrdata(1922,1980884876) +yrdata(1923,1999376931) +yrdata(1924,2018043972) +yrdata(1925,2023803913) +yrdata(1926,2043462180) +yrdata(1927,2063406322) +yrdata(1928,2082689730) +yrdata(1929,2103850414) +yrdata(1930,2124167500) +yrdata(1931,2143802732) +yrdata(1932,2164157870) +yrdata(1933,2184604692) +yrdata(1934,2205534997) +yrdata(1935,2226530597) +yrdata(1936,2247993326) +yrdata(1937,2268545035) +yrdata(1938,2290267593) +yrdata(1939,2312702889) +yrdata(1940,2350947590) +yrdata(1941,2373554827) +yrdata(1942,2396382640) +yrdata(1943,2419433211) +yrdata(1944,2442708748) +yrdata(1945,2466211477) +yrdata(1946,2489943650) +yrdata(1947,2513907539) +yrdata(1948,2538105439) +yrdata(1949,2562539670) +yrdata(1950,2579434878) +yrdata(1951,2653954580) +yrdata(1952,2692712961) +yrdata(1953,2732388944) +yrdata(1954,2772909569) +yrdata(1955,2814390135) +yrdata(1956,2856675848) +yrdata(1957,2899864004) +yrdata(1958,2943689748) +yrdata(1959,2987555529) +yrdata(1960,3030709021) +yrdata(1961,3090453463) +yrdata(1962,3137151355) +yrdata(1963,3211786601) +yrdata(1964,3270671214) +yrdata(1965,3330055803) +yrdata(1966,3401169329) +yrdata(1967,3463250974) +yrdata(1968,3526647458) +yrdata(1969,3591511933) +yrdata(1970,3657420066) +yrdata(1971,3724116214) +yrdata(1972,3791497136) +yrdata(1973,3859732004) +yrdata(1974,3928723212) +yrdata(1975,3998320921) +yrdata(1976,4080634693) +yrdata(1977,4156349026) +yrdata(1978,4233151108) +yrdata(1979,4311785729) +yrdata(1980,4391777096) +yrdata(1981,4472736872) +yrdata(1982,4555816222) +yrdata(1983,4640588050) +yrdata(1984,4726272158) +yrdata(1985,4813567478) +yrdata(1986,4902566593) +yrdata(1987,4985904892) +yrdata(1988,5070443631) +yrdata(1989,5156030340) +yrdata(1990,5219191372) +yrdata(1991,5304659362) +yrdata(1992,5390911229) +yrdata(1993,5477320137) +yrdata(1994,5564356643) +yrdata(1995,5652711036) +yrdata(1996,5738516173) +yrdata(1997,5824945702) +yrdata(1998,5912061676) +yrdata(1999,5999735497) +yrdata(2000,6088144560) +yrdata(2001,6173932167) +yrdata(2002,6250016823) +yrdata(2003,6326520742) +yrdata(2004,6403805522) +yrdata(2005,6481944062) +yrdata(2006,6525559210) +yrdata(2007,6602274812) +yrdata(2008,6789771253) +yrdata(2009,6873741054) +yrdata(2010,6958169159) +yrdata(2011,7043008586) +yrdata(2012,7128176935) +yrdata(2013,7213426452) +yrdata(2014,7298453033) +yrdata(2015,7383008820) +yrdata(2016,7466964280) +yrdata(2017,7550262101) + +Left: line from dtop(yearmin,tonsmin) to dtop(yearmin,tonsmax) + htic = 8pt__ +# htic = maxy + vtic = 13pt__/2 +# vtic = maxy + "0" wid 5bp__ at dtop(yearmin,tonsmin) rjust above + for y=0.2 to 2 by 0.2 do { + move to dtop(yearmin,y) + if y<2 then {{ line right htic }} + sprintf("%g",y) wid 5bp__ rjust } + svg_rot(90,"Tonnes of oil equivalent per capita" at Left-(0.3,0)) + +Right: line from dtop(yearmax,tonsmin) to dtop(yearmax,tonsmax) + for p=0 to popmax do { + move to ptop(yearmax,p) + if p>0 && p + + spline <- from dtop(yr[nD0]-1,0.12) left 0.2 up 0.1 then left 0.55 up 0.05 + "Other renewables" wid 100bp__ with .b at Here+(-0.4,2pt__) + +Q: NPopulation.end + (-1.25,-0.1) + spline ctension_ <- \ + from NPopulation.end+(-3pt__,0) left 0.3 down 0.1 then left 0.45 then to Q + sprintf("%g %% of 1850 population",round_(ypop[nyd]/ypop[1]*10)*10) \ + wid 100bp__ rjust +] command "" # end font +#.PE + ] with .sw at last [].se+(-40bp__,0) # Cons +#showbox_ + .PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile index 1826a94d7a0..0b01e8bc612 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile @@ -54,9 +54,9 @@ CCTSVG = \ BipSVG.svg BtreeSVG.svg ByteSVG.svg ButtonsSVG.svg \ CanLogicSVG.svg CapacitorsSVG.svg ChipsSVG.svg ConnSVG.svg ConnectorsSVG.svg \ ContactSVG.svg ContactsSVG.svg \ - CountingSVG.svg CrowSVG.svg CsourceSVG.svg \ + CrowSVG.svg CsourceSVG.svg \ DecoderSVG.svg DemultiplexerSVG.svg DiniSVG.svg DiodesSVG.svg DriveSVG.svg \ - EEPSVG.svg EmarrowsSVG.svg \ + EEPSVG.svg EmarrowsSVG.svg EscherSVG.svg \ FlowSVG.svg FontsSVG.svg FusesSVG.svg \ GeometrySVG.svg GrayCodeSVG.svg GroundsSVG.svg \ HeadersSVG.svg HeathkitSVG.svg \ @@ -114,6 +114,13 @@ tstSVG.html: tstSVG.htmx $(TEST).svg xst: Incleps.png # necessary because of rotated text: +LoglogSVG.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 + ConnectorsSVG.svg cscSVG.svg test.svg: m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic $(DPIC) -v $*.pic > $*.svg diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SLD.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SLD.m4 deleted file mode 100644 index 96f04f72354..00000000000 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SLD.m4 +++ /dev/null @@ -1,389 +0,0 @@ -divert(-1) - -# This section defines *DRAFT* SLD elements with or without attached -# circuit breakers. Many other elements applicable to SLD drawings are -# already in libcct.m4. The contributions and suggestions of Benjamin -# Vilmann are acknowledged with thanks. - -# Notes for 1-terminal SLD elements: -# Argument 1 is normally the linespec of the stem to set the element direction -# and length. See also: PtoL defined in libgen.m4. -# For a 0-length stem (which has undefined direction): -# arg1 can also be U, D, L, R (for up, down, left, right), -# or a number to set the direction in degrees, optionally followed by -# `at position' to set the position (Here by default). -# Zero-length stem examples: sl_box(U), sl_box(45 at Here+(1,0)) -# Argument 2 contains semicolon (;)-separated key-value attributes -# of the element head as applicable: e.g., name=Carol; text="Stop"; lgth=expr -# If argument 3 is blank then no breaker is drawn. A non-blank argument 3 -# is C for a default closed breaker in the stem, O for an open breaker, -# or key-value pairs to specify breaker details. -# The element body (head) can be named with name=. It is overlaid with -# or contained in a [] block. - -# Notes for 2-terminal SLD elements: -# These obey the normal Circuit_macro two-terminal conventions. -# They can be labelled using rlabel() or llabel() as well as directly. -# Argument 2 contains key-value pairs to customize the element body, -# e.g., name=Name; text="text"; wdth=expr; ... -# Nonblank arguments 3 and 4 put a breaker in the input and output respectively. - -# Notes for attached breakers: -# Nonblank arguments 3 and 4 of the two-terminal elements and argument 3 of -# the 1-terminal elements specify a breaker in the input, output, and stem -# respectivlely. An O creates a default-size open breaker, and C a closed -# breaker, otherwise the argument contains key-value pairs to specify the -# details of the box; e.g., box=dotted 2bp__ shaded "green" - -# Notes for composite elements within a [ ] block: -# The SLD current transformer macro sl_ct is composite. -# Internal labels L (for inductor) and terminals Ts, Tc, and Te are defined. - -define(`sldlib_') -ifdef(`libcct_',,`include(libcct.m4)divert(-1)') - -# Default size parameters. These can be redefined in a diagram. - -define(`brksiz_',`dimen_*3/16') # Default inline box breaker size -define(`drosiz_',`dimen_/4') # Default sl_drawout (chevron) size - -# One-terminal elements ################################################### - - `sl_disk( stem linespec, keys, breaker ) - keys: name=Name; - text="text"; - diam=expr; - circle=circle attributes; eg diam expr' - `default breaker name Bd' -define(`sl_disk', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; circle::N; text::N; diam:dimen_*2/3')dnl - ifelse(`$3',, - `ifelse(m4name,,,m4name:) circle diam m4diam \ - at last line.end + vec_(m4diam/2,0) m4circle m4text - [ box invis wid_ m4diam ht_ m4diam ] at last circle - line from last line.end to last line.start', - `m4br_one(`sl_disk',`$1',`$2',m4brk_(`$3',Bd))') ') - - `sl_box( stem linespec, keys, breaker ) - keys: name=Name; lgth=expr; wdth=expr; - text="text"; - box= box attributes; (e.g. shade "red")' - `default breaker name Bb' -define(`sl_box', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; wdth:dimen_*2/3; lgth:dimen_*2/3; box::N; text::N')dnl - ifelse(`$3',, - `line from last line.end to last line.start - { ifelse(m4name,,,m4name:) [S:Here; lbox(m4lgth,m4wdth,m4box)] \ - with .S at last line.start } - ifelse(m4text,,,`{m4text at last []}')', - `m4br_one(`sl_box',`$1',`$2',m4brk_(`$3',Bb))') ') - - `sl_grid( stem linespec, keys, breaker ) - keys: name=Name; lgth=expr; wdth=expr;' - `default breaker name Bgr' -define(`sl_grid', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; wdth:dimen_*4/5; lgth:dimen_*2/3; box::N; text::N')dnl - ifelse(`$3',, - `line from last line.end to last line.start - { ifelse(m4name,,,m4name:) [S:Here - { ifelse(m4name,,,m4name:) lbox(m4lgth,m4wdth) } - { line to rvec_(m4lgth/2, m4wdth/2) - line to rvec_(m4lgth/2,-m4wdth/2) - line to rvec_(-m4lgth/2,-m4wdth/2) - line to rvec_(-m4wdth/2, m4wdth/2) } - { line from rvec_(0,m4wdth/2) to rvec_(m4lgth,-m4wdth/2) } - line from rvec_(0,-m4wdth/2) to rvec_(m4lgth,m4wdth/2) - ] with .S at last line.start } ', - `m4br_one(`sl_grid',`$1',`$2',m4brk_(`$3',Bgr))') ') - - `sl_load( stem linespec, keys, breaker ) - keys: name=Name; lgth=expr; wdth=expr; - head= arrowhead attributes;' - `default breaker name Bl' -define(`sl_load', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; wdth:dimen_*0.32; lgth:dimen_*0.45; head::N')dnl - ifelse(`$3',, - `line from last line.end to last line.start - { ifelse(m4name,,,m4name:) [S:Here; line to rvec_(0,m4wdth/2) \ - then to rvec_(m4lgth,0) then to rvec_(0,-m4wdth/2) \ - then to Here m4head ] with .S at last line.start } ', - `m4br_one(`sl_load',`$1',`$2',m4brk_(`$3',Bl))') ') - - `sl_meterbox( stem linespec, keys, breaker ) - keys: sl_box attributes' - `default breaker name Bm' -define(`sl_meterbox', - `sl_eleminit_(`$1') - setkeys_(`$2',`name::N; wdth:dimen_*2/3; lgth:dimen_*2/3; box::N; text::N')dnl - ifelse(`$3',, - `line from last line.end to last line.start - {ifelse(m4name,,,m4name:) [S:Here; - { B: rotbox( m4lgth, m4wdth, m4box ) with .W at S } - a = rp_ang*rtod_ - if (abs(a-90) < 45) || (abs(a-180) < 45) || (abs(a+180) < 45) then { - C: rvec_(m4lgth*2/5,0) - line from rvec_(m4lgth*4/5,m4wdth/2) to rvec_(m4lgth*4/5,-m4wdth/2) } \ - else { C: rvec_(m4lgth*3/5,0) - line from rvec_(m4lgth/5,m4wdth/2) to rvec_(m4lgth/5,-m4wdth/2) } - ifelse(m4text,,,`m4text at C') - ] with .S at last line.start}', - `m4br_one(`sl_meterbox',`$1',`$2',m4brk_(`$3',Bm))') ') - - `sl_generator( stem linespec, keys, breaker )' - `default breaker name Bd' -define(`sl_generator',`sl_disk($@) - { ACsymbol(at last circle,,,R) - m4lcd = last circle.diam - [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } ') - - `sl_syncmeter( stem linespec, keys, breaker )' - `default breaker name Bd' -define(`sl_syncmeter',`sl_disk($@) - { Syncsymb(at last circle) - m4lcd = last circle.diam - [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } ') - - `sl_lamp( stem linespec, keys, breaker )' - `default breaker name Bd' -define(`sl_lamp',`sl_disk($@) - { line from last circle.ne to last circle.sw - line from last circle.nw to last circle.se - m4lcd = last circle.diam - [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } ') - -# One-terminal utilities ################################################## - - `Syncsymb(at position, rad) - Symbol for sync meter' -define(`Syncsymb',`[ define(`m4ssrad',`ifelse(`$2',,(dimen_/4),`($2)')')dnl - Origin: Here - {arc <-> ht arrowht/2 wid arrowwid*2/3 \ - from Rect_(m4ssrad,30) to Rect_(m4ssrad,150) with .c at Here} - line from (0,m4ssrad) to (0,-m4ssrad/2) - `$3' ] with .Origin ifelse(`$1',,`at Here',`$1')') - - `m4br_one( `name', stem linespec, body keys, - breaker keys )' - `Draw the breaker in the stem then the element' -define(`m4br_one', - `M4_S: last line.start - setkey_(`$4',lgth,brksiz_)dnl - line from M4_S to last line.end+vec_(-(m4lgth)*5/2,0) - sl_breaker(to rvec_(m4lgth,0),`$4') - $1(to rvec_((m4lgth)*3/2,0),`$3') - move to M4_S ') - - `sl_eleminit_(linespec or (for zero length) - U|D|L|R|number [at location])' -define(`sl_eleminit_', - `ifelse(regexp(`$1',^ *[UDLR0123456789]),-1, - `eleminit_(`$1',dimen_)', - `pushdef(`M4pos',`ifinstr(`$1',` at ',`patsubst(`$1',^.* at *)')')dnl - ifelse(M4pos,,,`move to M4pos;') setdir_(patsubst(`$1',` at.*')) - line invis from Here to Here popdef(`M4pos')')') - -# Two-terminal elements ################################################### - - `sl_transformer(linespec,keys, - input breaker keys, output breaker keys) - keys: - type=I|S - (type=I) scale=expr; (default 1.5) - cycles=n; (default 4) - (type=S) body=shaded "color"; - name=Body name; - (breaker default names BrI, BrO)' -define(`sl_transformer', - `setkeys_(`$2',name::N; type:I:N; cycles:4:N; body::N; scale:1.5:; )dnl - ifelse(`$3'`$4',, - `ifinstr(m4type,S, - `source(`$1',G,,,m4body)', - `eleminit_(`$1'); m4atmp = rp_ang; m4slen = rp_len - define(`m4swd',`dimen_*3/16*m4scale')dnl - { line to rvec_((m4slen-m4swd)/2,0) - {ifelse(m4name,,SL_box,m4name): [ linewid = linewid*m4scale - {L1: inductor(to vec_(0,-m4cycles*dimen_/8),,m4cycles)} - {point_(m4atmp) - L2: inductor(from vec_(dimen_*3/16,-m4cycles*dimen_/8) \ - to vec_(dimen_*3/16,0),,m4cycles)} - C2: last line.c; point_(m4atmp) ] with .L1.c at Here} - line from rvec_(m4swd,0) to rvec_((m4slen+m4swd)/2,0) } - line invis to rvec_(rp_len,0)') ', - `m4br_two(`sl_transformer',`$1',`$2',m4brk_(`$3',BrI),m4brk_(`$4',BrO), - ifelse(`$3',,,I)`'ifelse(`$4',,,O))') ') - - `Two-terminal box' - `sl_ttbox(linespec,keys,breaker keys,breaker keys) - keys= lgth=expr; wdth=expr; box=attributes; - supp=additional rotbox commands; name=Body name; - text="text"; - (breaker default names BrI, BrO)' -define(`sl_ttbox', - `setkeys_(`$2',`lgth:dimen_*3/4; wdth:dimen_*3/4; - name::N; box::N; text::N; supp::N')dnl - ifelse(`$3'`$4',, - `eleminit_(`$1') - {line to rvec_((rp_len-m4lgth)/2,0) - {ifelse(m4name,,,m4name:)rotbox(m4lgth,m4wdth,m4box,,m4supp) \ - with .W at Here } - {ifelse(m4text,,,`{m4text at rvec_(m4lgth/2,0)}') } - line from rvec_(m4lgth,0) to rvec_((rp_len+m4lgth)/2,0)} - line invis to rvec_(rp_len,0) ', - `m4br_two(`sl_ttbox',`$1',`$2',m4brk_(`$3',BrI),m4brk_(`$4',BrO), - ifelse(`$3',,,I)`'ifelse(`$4',,,O))') ') - -define(`m4brk_',`ifelse(`$1',,, - `ifelse(`$1',C,,`$1',O,box=fill 0,`$1')`'ifelse(`$2',,,;name=`$2')')') - - `sl_rectifier(ttbox args)' -define(`sl_rectifier', - `sl_ttbox(`$@') - { line from last [].Line.ne to last [].Line.sw - AC: ACsymbol(at last [].C+(-m4lgth/6, m4wdth/4),,,R) - DC: DCsymbol(at 2nd last [].C+( m4lgth/6,-m4wdth/4),,,R) } ') - - `sl_inverter(ttbox args)' -define(`sl_inverter', - `sl_ttbox(`$@') - { line from last [].Line.ne to last [].Line.sw - DC: DCsymbol(at last [].C+(-m4lgth/6, m4wdth/4),,,R) - AC: ACsymbol(at 2nd last [].C+( m4lgth/6,-m4wdth/4),,,R) } ') - - `sl_breaker(linespec, type=[A|C][D]; ttbox keys) - C is for curved breaker - D is for sl_drawout' -define(`sl_breaker', - `setkeys_(`$2',`lgth:brksiz_; wdth:brksiz_; name::N; type::N')dnl - ifinstr(m4type,C, - `ifinstr(m4type,D, - `m4ch_two(`cbreaker',`$1')', - `ifelse(m4name,,,m4name:) cbreaker(`$1')')', - `ifinstr(m4type,D, - `m4ch_two(`sl_ttbox',`$1',lgth=m4lgth;wdth=m4wdth;`$2';name=Br)', - `sl_ttbox(`$1',lgth=m4lgth;wdth=m4wdth;`$2')') ') ') - - `sl_reactor(linespec,keys,breaker keys,breaker keys) - keys= - diam=expr, - (Default breaker names BrI and BrO)' -define(`sl_reactor', - `setkeys_(`$2',`diam:sourcerad_*4/3; type::N')dnl - ifelse(`$3'`$4',, - `eleminit_(`$1') - { line to rvec_(rp_len/2,0) then to rvec_(rp_len/2,-m4diam/2); round - arc rad m4diam/2 cw from Here to rvec_(m4diam/2,m4diam/2) \ - with .c at rvec_(0,m4diam/2); round - line to rvec_(rp_len/2-m4diam/2,0) } - {[ box invis ht m4diam wid m4diam ] at rvec_(rp_len/2,0)} - line invis to rvec_(rp_len,0) ', - `m4br_two(`sl_reactor', `$1', lgth=m4diam*2;`$2', - m4brk_(`$3',BrI),m4brk_(`$4',BrO),ifelse(`$3',,,I)`'ifelse(`$4',,,O))')') - - `sl_busbar( linespec, nports, keys ) - Labels P1, P2 ... Pnports are defined on the line. - keys: line=line attributes; - port=D; (dotted ports) - The bus extends beyond the first and last points - by dimen_/5 which can be redefined as - line=chop -(expr)' -define(`sl_busbar', - `define(`m4npoints',`ifelse(`$2',,2,`$2')')dnl - setkeys_(`$3',`line:thick 1.6 chop -dimen_/5:N; port::N')dnl - [ tmp_ang = rp_ang - eleminit_(`$1',(m4npoints-1)*dimen_) - Start: last line.start; End: last line.end - for_(1,m4npoints,1, - `P`'m4x: (m4x-1)/(m4npoints-1) between Start and End dnl - ifinstr(m4port,D,` ;dot(at P`'m4x)')') - Line: line from Start to End m4line - Start: last line.start; End: last line.end - point_(tmp_ang) ] ') - - `sl_drawout(linespec, keys, R) - Drawout (i.e. plugin) chevron element; - keys: type=T; (truncated leads) - lgth=expr; (body size) - wdth=expr; - name=Name; (body name) - line= line attributes (e.g. thick 2) - arg3=R reverse direction' -define(`sl_drawout', - `setkeys_(`$2',`lgth:drosiz_; wdth:drosiz_; type::N; name::N; line::N')dnl - eleminit_(`$1',ifelse(m4type,T,m4lgth)) - ifelse(`$3',R,`{M4ds: Here; move to last line.end; rp_ang = rp_ang+pi_') - {line to rvec_(rp_len/2,0) - ifelse(m4name,,,m4name:) [ - S: Here; {line from rvec_(-m4lgth/2,m4wdth/2) to Here then - to rvec_(-m4lgth/2,-m4wdth/2) m4line } - E: rvec_(m4lgth/2,0); line from rvec_(0,m4wdth/2) to E then - to rvec_(0,-m4wdth/2) m4line ] with .S at Here - ifelse(m4type,T,, - line from last [].E to last [].E+vec_((rp_len-m4lgth)/2,0))} - ifelse(`$3',R,`rp_ang = rp_ang-pi_; move to M4ds}') - line invis to rvec_(rp_len,0) ') - -# Two-terminal utilities ################################################## - - `Breakers in the input and output lines:' - `m4br_two(`2-term element macroname in quotes', - linespec, body keys, - input breaker keys, - output breaker keys, - I|O|IO)' - `(Default breaker names are BrI and BrO)' -define(`m4br_two', - `define(`m4il',`ifinstr(`$6',I,`setkey_(`$4',lgth,brksiz_) m4lgth',0)')dnl - define(`m4ol',`ifinstr(`$6',O,`setkey_(`$5',lgth,brksiz_) m4lgth',0)')dnl - define(`m4bl',`setkey_(`$3',lgth,dimen_*4/3) m4lgth')dnl - eleminit_(`$2',dimen_*3) - M4start: Here; M4end: last line.end - M4cc: last line.c+vec_(((m4il*3/2)-(m4ol*3/2)),0) - M4ii: M4cc+vec_(-min((m4bl/2+m4il/2),distance(M4start,M4cc)-m4il),0) - line from M4start to ifinstr(`$6',I, - `M4ii+vec_(-m4il,0); sl_breaker(to M4ii,`$4';name=BrI)',M4ii) - M4oi: M4cc+vec_(min((m4bl/2+m4ol/2),distance(M4end,M4cc)-m4ol),0) - $1(from M4ii to M4oi,`$3') - ifinstr(`$6',O,`sl_breaker(to M4oi+vec_(m4ol,0),`$5';name=BrO)') - line to M4end - line invis from M4start to M4end ') - - `Chevrons in the input and output lines:' - `m4ch_two(`2-term element macroname in quotes', - linespec, body keys, - input breaker keys, - output breaker keys, - I|O|IO)' -define(`m4ch_two', - `define(`m4bl',`setkey_(`$3',lgth,dimen_*3/8) m4lgth')dnl - eleminit_(`$2',dimen_*3) - M4start: Here; M4end: last line.end - M4elem: $1(to rvec_(m4bl+2*drosiz_,0) with .c at last line.c,`$3') - sl_drawout(from last line.start-vec_(drosiz_,0) to last line.start,type=T,R) - line from last line.start to M4start - sl_drawout(from M4elem.end to M4elem.end+vec_(drosiz_,0),type=T) - line to M4end - line invis from M4start to M4end') - -# Composite elements ################################################### - - `sl_ct( at position, stem length, U|D|L|R|expr, - scale=expr) (default scale is 1.5)' -define(`sl_ct', - `[ setdir_(`$3'); setkey_(`$4',scale,1.5); linewid = linewid*m4scale - L: inductor(to vec_(2*dimen_/8,0),,2) - stemlen = ifelse(`$2',,dimen_/5,`$2') - line from L.start to L.start+vec_(0,-stemlen) - Ts: Here - line from L.end to L.end+vec_(0,-stemlen) - Te: Here - line from L.c to L.c+vec_(0,-stemlen) - Tc: Here - resetdir_ ] with .L.c at ifelse(`$1',,Here,patsubst(`$1',^ *at *)) ') - -# ####################################################################### - -divert(0)dnl diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4 index 95c9f2b2caa..2bccc8cd8f7 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4 @@ -4,124 +4,145 @@ cct_init(svg_font(sans-serif,11bp__,2bp__)) textoffset = 3bp__ movewid = 0.25 + +define(`Below',`at last [].s+(0,-(8 ifelse(`$1',,,+10*(`$1')))bp__)') +movewid = 0.25 + # Row 1 right_; { - lswitch; {S:"svg_tt(`lswitch')" at last [].s+(0,-10bp__)} + lswitch; {"svg_tt(`lswitch')" at last [].s Below} move right_ - lswitch(,,O); {"svg_tt(`(,,O)')" at (last [],S)} + lswitch(,,O); {"svg_tt(`(,,O)')" at last [].s Below} move right_ - lswitch(,,C); {"svg_tt(`(,,C)')" at (last [],S)} + lswitch(,,C); {"svg_tt(`(,,C)')" at last [].s Below} move right_ - lswitch(,,DA); {"svg_tt(`(,,DA)')" at (last [],S)} + lswitch(,,DA); {"svg_tt(`(,,DA)')" at last [].s Below} move right_ - lswitch(,,dDO); {"svg_tt(`(,,dDO)')" at (last [],S)} + lswitch(,,dDO); {"svg_tt(`(,,dDO)')" at last [].s Below} move right_ - lswitch(,,uDC); {"svg_tt(`(,,uDC)')" at (last [],S)} + lswitch(,,uDC); {"svg_tt(`(,,uDC)')" at last [].s Below} } # Row 2 - move down; right_; { - lswitch(,,K); {S:"svg_tt(`(,,K)')" at last [].s+(0,-10bp__)} + move down 0.4; right_; { + lswitch(,,K); {"svg_tt(`(,,K)')" at last [].s Below} move right_ - lswitch(,,KD); {"svg_tt(`(,,KD)')" at (last [],S)} + lswitch(,,KD); {"svg_tt(`(,,KD)')" at last [].s Below} move right_ - lswitch(,,KOD); {"svg_tt(`(,,KOD)')" at (last [],S)} + lswitch(,,KOD); {"svg_tt(`(,,KOD)')" at last [].s Below} move right_ - lswitch(,,KCD); {"svg_tt(`(,,KCD)')" at (last [],S)} + lswitch(,,KCD); {"svg_tt(`(,,KCD)')" at last [].s Below} move right_ - bswitch; {"svg_tt(``bswitch'')" at (last [],S)} + bswitch; {"svg_tt(``bswitch'')" at last [].s Below} move right_ - bswitch(,,C); {"svg_tt(`(,,C)')" at (last [],S)} + bswitch(,,C); {"svg_tt(`(,,C)')" at last [].s Below} } # Row 3 - move down; right_; { - D: dswitch(,,); {S: "svg_tt(`dswitch(,,)')" at last [].s+(0,-10bp__)} + move down 0.45; right_; { + D: dswitch; {"svg_tt(`dswitch')" at D.start below ljust} thinlines_ - { spline <- from 0.25 along_(D) up 0.1 then up 0.05 left 0.1 - {"svg_tt(`W')" rjust} - spline <- from D.c+(0,m4sc*2) up 0.1 then up 0.05 left 0.1 - {"svg_tt(`B')" rjust }} + {spline <- from last [].B.c up 0.1 then up 0.05 left 0.1 + "svg_tt(`B')" rjust} thicklines_ move right_ - D: dswitch(,,WdBK); {"svg_tt(`(,,WdBK)')" at (last [],S)+(0,-4bp__)} + dswitch(,,WdBK); {"svg_tt(`(,,WdBK)')" at last [].s Below} thinlines_ - { spline <- from tr_xy(0,-2) up 0.1 then up 0.10 left 0.1 - {"svg_tt(`dB')" rjust} - spline <- from tr_xy(4,-2) right 0.1 then right 0.05 up 0.15 + { spline <- from 0.5 along_(last [].B) up 0.1 then up 0.10 left 0.1 + {"svg_tt(`B')" rjust} } + { spline <- from last [].K right 0.1 then right 0.05 up 0.15 {"svg_tt(`K')" above }} thicklines_ move right_ - dswitch(,,WBmdDK); {"svg_tt(`(,,WBmdDK)')" at (last [],S)} + dswitch(,,WBmdDK); {"svg_tt(`(,,WBmdDK)')" at last [].s Below} move right_ - dswitch(,,WBKTr); {"svg_tt(`(,,WBKTr)')" at (last [],S)} + dswitch(,,WBKTr); {"svg_tt(`(,,WBKTr)')" at last [].s Below} move right_ - dswitch(,,WdBL); {"svg_tt(`(,,WdBL)')" at (last [],S+(0,-4bp__))} + dswitch(,,WdBL); {"svg_tt(`(,,WdBL)')" at last [].s Below} move right_ - dswitch(,,WBCo); {"svg_tt(`(,,WBCo)')" at (last [],S)} + dswitch(,,WBSd); {"svg_tt(`(,,WBSd)')" at last [].s Below} } # Row 4 - move down; right_; { - dswitch(,,WBKCo); {S: "svg_tt(`(,,WBKCo)')" at last [].s+(0,-10bp__)} + move down 0.4; right_; { + dswitch(,,WBCb); {"svg_tt(`(,,WBCb)')" at last [].s Below} move right_ - dswitch(,,WBCb); {"svg_tt(`(,,WBCb)')" at (last [],S)} + dswitch(,,WBcCb); {"svg_tt(`(,,WBcCb)')" at last [].s Below} move right_ - dswitch(,,WBDI); {"svg_tt(`(,,WBDI)')" at (last [],S)} + dswitch(,,WBcDI); {"svg_tt(`(,,WBcDI)')" at last [].s Below} + thinlines_ + {arrow <- from last [].DI.start up_ 0.1 right_ 0.15; "svg_tt(`DI')" ljust} + thicklines_ move right_ - dswitch(,,WBSd); {"svg_tt(`(,,WBSd)')" at (last [],S)} +# dswitch(,,WBDI); {"svg_tt(`(,,WBDI)')" at last [].s Below} + dswitch(,,WBKCo); {"svg_tt(`(,,WBKCo)')" at last [].s Below} move right_ - dswitch(,,WBFDI); {"svg_tt(`(,,WBFDI)')" at (last [],S)} + dswitch(,,WBFDI); {"svg_tt(`(,,WBFDI)')" at last [].s Below} move right_ - dswitch(,,WBFSd); {"svg_tt(`(,,WBFSd)')" at (last [],S)} + dswitch(,,WBFSd); {"svg_tt(`(,,WBFSd)')" at last [].s Below} } # Row 5 - move down moveht*5/4; right_; { - dswitch(,,WBTh); {S: "svg_tt(`(,,WBTh)')" at last [].s+(0,-10bp__)} + move down 0.4; right_; { + dswitch(,,WBMMR); {"svg_tt(`(,,WBMMR)')" at last [].s Below} move right_ - dswitch(,,WBKC); {"svg_tt(`(,,WBKC)')" at (last [],S)} + dswitch(,,WBMM); {"svg_tt(`(,,WBMM)')" at last [].s Below} move right_ - dswitch(,,WBM); {"svg_tt(`(,,WBM)')" at (last [],S)} + dswitch(,,WBMR); {"svg_tt(`(,,WBMR)')" at last [].s Below} move right_ - dswitch(,,WBCO); {"svg_tt(`(,,WBCO)')" at (last [],S)} + dswitch(,,WBEL); {"svg_tt(`(,,WBEL)')" at last [].s Below} move right_ - dswitch(,,WBMP); {"svg_tt(`(,,WBMP)')" at (last [],S)} + dswitch(,,WBLE); {"svg_tt(`(,,WBLE)')" at last [].s Below} move right_ - dswitch(,,WBoKCP); {"svg_tt(`(,,WBoKCP)')" at (last [],S)} + dswitch(,,WBoKEL); {"svg_tt(`(,,WBoKEL)')" at last [].s Below} } # Row 6 - move down moveht*5/4; right_; { - dswitch(,,WBCY); {S: "svg_tt(`(,,WBCY)')" at last [].s+(0,-10bp__)} - move right_ - dswitch(,,WBCZ); {"svg_tt(`(,,WBCZ)')" at (last [],S)} + move down moveht+2bp__; right_; { + dswitch(,,WBTh); {"svg_tt(`(,,WBTh)')" at last [].s Below} move right_ - dswitch(,,WBCE); {"svg_tt(`(,,WBCE)')" at (last [],S)} + dswitch(,,WBKC); {"svg_tt(`(,,WBKC)')" at last [].s Below} + thinlines_ + { arrow <- from last [].C.c left 0.2; "svg_tt(`C')" rjust } + thicklines_ move right_ - dswitch(,,WBRH); {"svg_tt(`(,,WBRH)')" at (last [],S)} + dswitch(,,WBM); {"svg_tt(`(,,WBM)')" at last [].s Below} move right_ - dswitch(,,WBRdH); {"svg_tt(`(,,WBRdH)')" at (last [],S)} + dswitch(,,WBCO); {"svg_tt(`(,,WBCO)')" at last [].s Below} move right_ - dswitch(,,WBRHH); {"svg_tt(`(,,WBRHH)')" at (last [],S)} + dswitch(,,WBMP); {"svg_tt(`(,,WBMP)')" at last [].s Below} + move down_ 2bp__ then right_ + dswitch(,,WBoKCP); {"svg_tt(`(,,WBoKCP)')" at last [].s Below} } # Row 7 - move down moveht*5/4; right_; { - move down 2bp__; right_ - dswitch(,,WBPr); {S: "svg_tt(`(,,WBPr)')" at last [].s+(0,-10bp__)} + move down moveht*7/6; right_; { + dswitch(,,WBCY); {"svg_tt(`(,,WBCY)')" at last [].s Below} move right_ - dswitch(,,WBPrT); {S: "svg_tt(`(,,WBPrT)')" at last [].s+(0,-10bp__)} - move down_ 6bp__ then right_ - dswitch(,,WBPrM); {S: "svg_tt(`(,,WBPrM)')" at last [].s+(0,-10bp__)} + dswitch(,,WBCZ); {"svg_tt(`(,,WBCZ)')" at last [].s Below} + move right_ + dswitch(,,WBCE); {"svg_tt(`(,,WBCE)')" at last [].s Below} + move right_ + dswitch(,,WBRH); {"svg_tt(`(,,WBRH)')" at last [].s Below} + move right_ + dswitch(,,WBRdH); {"svg_tt(`(,,WBRdH)')" at last [].s Below} + move right_ + dswitch(,,WBRHH); {"svg_tt(`(,,WBRHH)')" at last [].s Below} } # Row 8 - move down; right_; { - dswitch(,,WBMMR); {S: "svg_tt(`(,,WBMMR)')" at last [].s+(0,-10bp__)} - move right_ - dswitch(,,WBMM); {"svg_tt(`(,,WBMM)')" at (last [],S)} + move down moveht; right_; { + move down_ 2bp__; right_ + dswitch(,,WBPr); {"svg_tt(`(,,WBPr)')" at last [].s Below} move right_ - dswitch(,,WBMR); {"svg_tt(`(,,WBMR)')" at (last [],S)} + dswitch(,,WBPrT); {"svg_tt(`(,,WBPrT)')" at last [].s Below} + move down_ 6bp__ then right_ + dswitch(,,WBPrM); {"svg_tt(`(,,WBPrM)')" at last [].s Below} move right_ - dswitch(,,WBEL); {"svg_tt(`(,,WBEL)')" at (last [],S)} + dswitch(,,WBDIGX,text=W); #{"svg_tt(`(,,WBDIGX,W)')" at last [].s Below} + {"svg_tt(`(,,WBDIGX,')" ljust at last line.start+(0,-15bp__) \ + "svg_tt(`text=W)')" ljust} move right_ - dswitch(,,WBLE); {"svg_tt(`(,,WBLE)')" at (last [],S)} + dswitch(,,WBDIGC,text=M) + {"svg_tt(`(,,WBDIGC,')" ljust at last line.start+(0,-15bp__) \ + "svg_tt(`text=M)')" ljust} move right_ - dswitch(,,WBoKEL); {"svg_tt(`(,,WBoKEL)')" at (last [],S)} + dswitch(,,WBcDIGC,text=M) # + {"svg_tt(`(,,WBcDIGC,')" ljust at last line.start+(0,-15bp__) \ + "svg_tt(`text=M)')" ljust} } command "')" # end font diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4 index ab2eea7efc8..29f80df2214 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4 @@ -14,7 +14,7 @@ PID: [ 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 to (S2,Here) ; arrow to S2.n } diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4 index afc633403fb..8f1b9546693 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4 @@ -69,11 +69,11 @@ 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) line to coord(2.1,-1.75) -resetrgb + resetrgb setrgb(white) spline from coord(-2.2,-2.05) to coord(-1,-2.08) then to coord(0.55,-1.77) line to coord(-2.2,-2.05) -resetrgb + resetrgb linethick=`0.'eval(lwid*15)/(1pt__) ] diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx index ec9847b32e2..a7c830ed542 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx @@ -55,6 +55,13 @@ ifinstr(`$3',y,,`
')') width="700px" border="0" align="center" >

SVG Circuit_macros examples, Version XXX

+ +Home +> +Examples +> +SVG +

@@ -309,7 +316,7 @@ cfig(InductorsSVG, Inductors) cfig(DiodesSVG, - Diodes: a m4tt`'K in the second argument draws an open + Diodes: appending a m4tt`'K to the second argument draws an open arrowhead) cfig(EmarrowsSVG, @@ -334,8 +341,9 @@ cfig(GroundsSVG, Ground symbols) cfig(SwitchesSVG, - The switch macros; m4tt`'switch(`,'`,'`,'L|B|D) is a wrapper - for m4tt`'lswitch`,' m4tt`'bswitch`,' and m4tt`'dswitch) + The switch macros; m4tt`'switch(`,'`,'`,'L|B|D,attribs) + is a wrapper for m4tt`'lswitch`,' m4tt`'bswitch`,' + and m4tt`'dswitch) cfig(AntennasSVG, Antenna symbols) @@ -585,8 +593,10 @@ cfig(GrayCodeSVG, Gray code 10-bit encoder disk pattern`,' and a crossbar switch) + cfig(ByteSVG, Elementary splines) @@ -597,7 +607,7 @@ cfig(RotboxSVG, draws a box in the current direction) cfig(ex06SVG, - Crosshatching by m4tt`'for loops) + Crosshatching) cfig(ex09SVG, Illustrating the macro @@ -616,18 +626,18 @@ cfig(ex09SVG, specifies the arc to be dimensioned and the second argument is the outward radial offset of the dimension arrow arc.) -cfig(ex05SVG, - Use of m4tt`'darrow and m4tt`'Darc) - cfig(PlateSVG, Dimensioning with tolerances according to ASME Y14.5) Use of m4tt`'darrow and m4tt`'Darc) +cfig(ex05SVG, + Use of m4tt`'darrow and m4tt`'Darc) + cfig(LoglogSVG, - A graph drawn using the pic language) + Graphs drawn using the pic language) cfig(GeometrySVG, - Plane geometry examples and an illustration of a Lyapunov function) + Plane geometry examples) cfig(cscSVG, Conestoga Sailing Club (illustrating the filling of arbitrary shapes)`,' @@ -684,14 +695,19 @@ cfig(SierpinskiSVG, The Sierpinski triangle and a Cayley graph: tests of pic macro recursion) +cfig(EscherSVG, + Two Escher-like objects) + cfig(recycleSVG, Modest repetition and partial fill) cfig(ex15SVG, Simple diagrams that are easily drawn by looping) + cfig(CrowSVG, Illustrating m4tt`'shadebox and a custom crowfoot line diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4 index 27209b094e1..4d12688f975 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4 @@ -8,51 +8,6 @@ NeedDpicTools # postprocessors do not have the same functionality so the following # demonstrates how it can be done in the pic language with m4 macros. -# `shadedpolygon(shadedpvertseq,line attributes, -# sweep angle (degrees),colorseq) -# arg1 is a colon (:) separated sequence of -# positions or position names, the vertices in -# order (cw or ccw) of the polygon. Colored -# shade lines are drawn perpendicular to the -# sweep angle. A colorseq is of the form -# 0,r0,g0,b0, -# frac1,r1,g1,b1, -# frac2,r2,g2,b2, -# ... -# 1,rn,gn,bn' -#`e.g. shadedpolygon((0,0):(0,1):(2,1):(2,0),,0,0,1,1,1,1,0,0,0)' -define(`shadedpolygon',`[ Origin: Here - shadedpverts(V,1,patsubst(patsubst(`$1',`,',|),:,`,')) - nverts = m4vx - T: (Rect_(1,`$3')) - p0 = 1; d[1] = T.x*V[1].x + T.y*V[1].y - pm = 1 - for i=2 to nverts do { d[i] = T.x*V[i].x + T.y*V[i].y - if d[i] < d[p0] then { p0 = i } - if d[i] > d[pm] then { pm = i } } - d0 = d[p0]; dmx = d[pm]-d0 - for i=1 to nverts do { d[i] = (d[i]-d0)/dmx } - qL = p0; pL = qL + 1; if pL > nverts then { pL = 1 } - qR = p0; pR = qR - 1; if pR < 1 then { pR = nverts } - nlines = int(1.5*dmx/lthick) - ShadeObject(ShadedPline,nlines,shift(shift(shift($@)))) \ - with .Origin at Origin - Midpt: 0.5 between V[1] and V[nverts] - line `$2' \ - from Midpt to for_(1,m4vx,1,`V[m4x] then to\') Midpt - Start: V[p0]; End: V[pm] - ]') -define(`shadedpverts',` -ifelse($3,,,`$1[$2]: patsubst(`$3',|,`,') define(`m4vx',$2) -shadedpverts(`$1',incr(`$2'),shift(shift(shift($@))))')') -define ShadedPline { - if $1 > d[pL] then { qL = pL; pL = qL + 1; if pL > nverts then {pL = 1} } - if $1 > d[pR] then { qR = pR; pR = qR - 1; if pR < 1 then {pR = nverts} } - M4L: ($1-d[qL])/(d[pL]-d[qL]) between V[qL] and V[pL] - M4R: ($1-d[qR])/(d[pR]-d[qR]) between V[qR] and V[pR] - line outlined rgbstring($2,$3,$4) \ - from M4L to M4R } - # Projected box object: [ g = 1.2 @@ -183,7 +138,7 @@ thicklines_ SE: Project( rectht/2, rectwid*0.75,0) NE: Project(-rectht/2, rectwid*0.75,0) - shadedpolygon(NW:NE:SE:SW,,-90, + ShadedPolygon(NW:NE:SE:SW,,-90, 0,0.25,0.25,0.25, 1,1,1,1) with .Start at NW diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4 index 8a3c99b66f6..f1eb9ae9aba 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4 @@ -283,18 +283,18 @@ define(`DIP_chip_outline', 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,.*:))', + Loopover_(`Z',`pushkey_(`$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)', + Loopover_(`Z',`pushkey_(`$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) + arcs = ifelse(m4_dir_,right,90,m4_dir_,up,180,m4_dir_,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 diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4 index 3e77ad1694e..c4ddb20122f 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4 @@ -1,4 +1,5 @@ .PS # Pic input begins with .PS +# quickSVG.m4 cct_init # Set defaults elen = 0.75 # Variables are allowed; default units are inches @@ -6,7 +7,7 @@ move right 0.4 Origin: Here # Position names are capitalized svgLink(SourcesSVG.svg,source(up_ elen)) llabel(-,svg_it(v`'svg_sub(s)),+) - svgLink(CctTableSVG.svg,resistor(right_ elen)); rlabel(,svg_it(R),) + svgLink(ResistorsSVG.svg,resistor(right_ elen)); rlabel(,svg_it(R),) dot { # Save current position and direction capacitor(down_ to (Here,Origin)) #(Here,Origin) = (Here.x,Origin.y) diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/slddiagsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/slddiagsSVG.m4 new file mode 100644 index 00000000000..ce213358d0d --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/slddiagsSVG.m4 @@ -0,0 +1,100 @@ +.PS +# slddiagsSVG.m4 +cct_init(svg_font(sans-serif,10bp__)) +include(libSLD.m4) + +Pic1: [ +define(`TrDeltaWye', + `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: TrDeltaWye(from Bus1.P3); arrow down_ dimen_/3 + TRF2: TrDeltaWye(from Bus1.P4); arrow down_ dimen_/3 + TRF3: TrDeltaWye(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: TrDeltaWye(from Bus2.P1) + S4: switch(from Bus2.P3+(0,-elen_) to Bus2.P3) +] + +Pic2: [ +# 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(right_ dimen_ from B3.P3, + text="A/C";circle=shaded ```rgbstring(.2,.8,.2)''';diam=dimen_*3/4) + sl_disk(right_ dimen_ from B3.P4, + text="M";circle=shaded ```rgbstring(.21,.47,.86)''';diam=dimen_*3/4) + sl_disk(right_ dimen_ from B3.P5, + text="M";circle=shaded ```rgbstring(.2,.6,.8)''';diam=dimen_*3/4) + sl_disk(right_ dimen_ from B3.P6, + text="M";circle=shaded ```rgbstring(.2,.63,.8)''';diam=dimen_*3/4) + sl_disk(left_ dimen_ from 1/2 between B3.P1 and B3.P2, + 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__) + +Pic3: [ +define(`shadedb',`shaded "CornflowerBlue"') +Loopover_(`LR', # loop to take advantage of symmetry + `define(`opposite',`ifelse(LR,left,right,left)')dnl + ifelse(LR,left,L,R)`'side: [ + sl_generator(LR dimen_/2,type=B;name=G1;circle=shadedb,box=shadedb) + T1: sl_transformer(opposite dimen_*3/2) + Bus1: sl_busbar(up_ dimen_*3/2,3,) with .P2 at Here + Br1: sl_breaker(from Bus1.P3 opposite elen_,box=shadedb) + line opposite dimen_ + Br2: sl_breaker(from Bus1.P1 opposite elen_,box=shadedb) + Br3: sl_breaker(down_ dimen_,box=shadedb) + Bus2: sl_busbar(opposite dimen_,3) with .P2 at Here + T2: sl_transformer(down_ dimen_ from Bus2.P2,name=X2) + sl_disk(down_ dimen_/2,type=B;text="SM";name=SM1;circle=shadedb,box=shadedb) + ground(at last circle.s,dimen_/2) + ]', + left,right) + "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,-37bp__) + "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 "" +.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sldtestsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sldtestsSVG.m4 deleted file mode 100644 index 658af488d66..00000000000 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sldtestsSVG.m4 +++ /dev/null @@ -1,104 +0,0 @@ -.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 "" -.PE diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/worm.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/worm.m4 index f7efc1c2e65..333ad78ee07 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/worm.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/worm.m4 @@ -54,7 +54,7 @@ Worm: [ setrgb(r,g,b,tmpcolor) line shaded "tmpcolor" outlined "tmpcolor" \ from C to Rect_(C.rad-0.05,90-(t-0.5)/90*360) \ - then to Rect_(C.rad-0.05,90-(t+0.5)/90*360) \ + then to Rect_(C.rad-0.05,90-(t+0.5)/90*360) \ then to C resetrgb } diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.fig b/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.fig index 521b4d03076..c9c51e70972 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.fig +++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.fig @@ -6,7 +6,7 @@ Letter 100.00 Single -2 -# dpic version 2021.08.01 option -x for Fig 3.2 +# dpic version 2021.11.01 option -x for Fig 3.2 1200 2 6 0 0 3975 5025 6 0 0 3975 5025 @@ -30,7 +30,7 @@ Single 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 211 525 86 + 525 199 525 75 -6 6 750 75 975 675 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 @@ -46,12 +46,12 @@ Single 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 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 752 551 752 199 +2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 + 900 199 900 75 -6 6 1125 75 1200 675 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 @@ -74,12 +74,12 @@ Single 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 1437 525 1438 225 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 1400 525 1400 225 +2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 + 1500 225 1500 75 -6 6 1650 75 1800 675 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 @@ -194,9 +194,9 @@ Single 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 1125 1425 1125 1275 1 3 0 1 0 -1 0 -1 -1 0 1 0.0 1125 1125 150 150 1275 1125 1275 1125 -6 1025 1075 1225 1175 -5 1 0 1 0 -1 0 -1 -1 0 0 1 0 0 1075 1125 1125 1125 1075 1075 1025 1125 -5 1 0 1 0 -1 0 -1 -1 0 0 1 0 0 1175 1125 1125 1125 1175 1175 1225 1125 +6 1025 1089 1225 1161 +5 1 0 1 0 -1 0 -1 -1 0 0 1 0 0 1075 1142 1125 1125 1075 1089 1025 1125 +5 1 0 1 0 -1 0 -1 -1 0 0 1 0 0 1175 1108 1125 1125 1175 1161 1225 1125 -6 2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2 1125 975 1125 825 @@ -328,8 +328,8 @@ Single -6 -6 6 2850 1575 3300 2025 -6 2850 1583 3300 2017 -1 3 0 1 0 -1 0 -1 -1 0 1 0.0 3075 1800 217 217 3292 1800 3292 1800 +6 2850 1583 3300 2018 +1 3 0 1 0 -1 0 -1 -1 0 1 0.0 3075 1800 218 218 3293 1800 3293 1800 -6 -6 6 1275 2250 1650 2550 diff --git a/Master/texmf-dist/doc/latex/circuit-macros/gpic.m4 b/Master/texmf-dist/doc/latex/circuit-macros/gpic.m4 index d04f0bde25e..d1a151d759e 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/gpic.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/gpic.m4 @@ -1,7 +1,7 @@ divert(-1) gpic.m4 Initialization for gpic. -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/lib3D.m4 b/Master/texmf-dist/doc/latex/circuit-macros/lib3D.m4 index 7cf33f6c042..df80c32b28e 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/lib3D.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/lib3D.m4 @@ -3,7 +3,7 @@ lib3D.m4 Macros for rotation, projection, and other operations on argument triples representing 3D vectors or colors. -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/libSLD.m4 b/Master/texmf-dist/doc/latex/circuit-macros/libSLD.m4 new file mode 100644 index 00000000000..015fd0cf3f7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuit-macros/libSLD.m4 @@ -0,0 +1,689 @@ +divert(-1) + + libSLD.m4 Draft macros for single-line diagram elements + +* Circuit_macros Version 9.8, copyright (c) 2022 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 * +* marked to distinguish them from this distribution. There is no warranty * +* whatsoever for these files. * + +========================================================================== + +# These *DRAFT* definitions are for single-line diagram (SLD) elements +# with or without attached circuit breakers or slashes. Many other elements +# applicable to SLD drawings are already in libcct.m4. The contributions +# and suggestions of Benjamin Vilmann are acknowledged with thanks. + +# The line +# include(libSLD.m4) +# loads these definitions for use in a diagram. + +# Notes for 1-terminal SLD elements: +# Argument 1 is normally the linespec of the stem to set the element direction +# and length.; e.g., D1: sl_disk draws a default disk with stem named D1. +# For a 0-length stem (which has undefined direction): +# arg1 can also be U, D, L, R (for up, down, left, right), +# or a number to set the direction in degrees, optionally followed by +# `at position' to set the position (Here by default). +# Zero-length stem examples: sl_box(U), sl_box(45 at Here+(1,0)) +# Argument 2 contains semicolon (;)-separated key-value attributes +# of the element head as applicable: e.g., name=Carol; text="Stop"; lgth=expr +# If argument 3 is blank then a plain stem is drawn. A non-blank argument 3 +# is C for a default closed breaker in the stem, O for an open breaker, +# or X, /, or \ to put these symbols in the box; otherwise, key-value +# pairs specify breaker details. If argument 3 begins with S: or Sn: +# (where n is an integer) then an n-line slash symbol is drawn. +# The element body (head) can be named with name= . The default name is Head. +# It is overlaid with or contained in a [] block. + +# Notes for 2-terminal SLD elements: +# These obey the normal Circuit_macro two-terminal conventions. +# They can be labelled using rlabel() or llabel() as well as directly. +# Argument 2 contains key-value pairs to customize the element body, +# e.g., name=Name; text="text"; wdth=expr; ... +# Except for sl_drawout and sl_breaker which do not have series breakers +# or slashes, nonblank arguments 3 and 4 put a breaker slash symbol +# in the input and output respectively. + +# Notes for attached breakers: +# Nonblank arguments 3 and 4 of the two-terminal elements and argument 3 of +# the 1-terminal elements specify a breaker in the input, output, and stem +# respectivlely. An O creates a default-size open breaker, C a closed +# breaker; and an X, /, or \ inserts the corresponding mark in the box; +# otherwise, the argument contains key-value pairs to specify the +# details of the box; e.g., box=dotted 2bp__ shaded "green" +# The separation of the breaker from the element body or head is given +# by parameter sl_breakersep_ or the key sep=expr. +# Arguments 3 and 4 of the two-terminal elements that begin with S: or Sn: +# (where n is an integer) and argument 3 of the 1-terminal elements +# specify an n-slash symbol rather than a breaker. + +# Notes for composite elements within a [ ] block: +# The current transformer macro sl_ct is composite, with internal +# labels defined as appropriate to the element. The macro sl_transormer3 +# is composite, with 3 principal termianls and other defined points. +# Macro sl_busbar is also composite, with internal labels P1 to Pnp, +# Start, and End. + +define(`sldlib_') +ifdef(`libcct_',,`include(libcct.m4)divert(-1)') + +# Default size parameters. These can be redefined in a diagram source. + +define(`sl_breakersize_',`dimen_*3/16') # breaker box size +define(`sl_breakersep_',`dimen_/2') # breaker separation from body +define(`sl_ttboxlen_',`dimen_*3/4') # inline box length +define(`sl_ttboxwid_',`dimen_*3/4') # inline box width +define(`sl_sboxlen_',`dimen_*2/3') # stem box length +define(`sl_sboxwid_',`dimen_*2/3') # stem box wid +define(`sl_diskdia_',`dimen_*2/3') # sl_disk diam +define(`sl_chevronsiz_',`dimen_/4') # sl_drawout (chevron) size +define(`sl_loadwid_',`dimen_*0.32') # load width +define(`sl_loadlen_',`dimen_*0.45') # load length +define(`sl_transcale_',1) # transformer body scale factor +define(`sl_busthick_',linethick*2) # sl_bus line thickness +define(`sl_busindent_',`min(dimen_/5,rp_len/5)') # bus end extension + +# One-terminal elements ################################################### + + `sl_disk( stem linespec, keys, breaker or Sn:slash) + keys: name=Name; + text="text"; + diam=expr; + circle=other circle attributes; eg shade' + `default breaker name Br' +define(`sl_disk', +`sl_eleminit_(`$1') + pushkeys_(`$2',`name:Head:N; circle::N; text::N; diam:sl_diskdia_')dnl + ifelse(`$3',, + `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', + `m4_one(`sl_disk',$@)') dnl + popdef(`m4name', `m4circle', `m4text', `m4diam') ') + + `sl_box( stem linespec, keys, breaker or Sn:slash) + keys: name=Name; lgth=expr; wdth=expr; + text="text"; + box= box attributes; (e.g. shade "red")' + `default breaker name Br' +define(`sl_box', +`sl_eleminit_(`$1') + pushkeys_(`$2',`name:Head:N; wdth:sl_sboxwid_; lgth:sl_sboxlen_; box::N; + text::N')dnl + ifelse(`$3',, + `line from last line.end to last line.start + { m4name: [S:Here; lbox(m4lgth,m4wdth,m4box)] \ + with .S at last line.start } + ifelse(m4text,,,`{m4text at last []}')', + `m4_one(`sl_box',$@)') dnl + popdef(`m4name', `m4wdth', `m4lgth', `m4box', `m4text') ') + + `sl_grid( stem linespec, keys, breaker or Sn:slash) + keys: name=Name; lgth=expr; wdth=expr;' + `default breaker name Br' +define(`sl_grid', +`sl_eleminit_(`$1') + pushkeys_(`$2',`name:Head:N; wdth:sl_sboxwid_; lgth:sl_sboxlen_; box::N')dnl + ifelse(`$3',, + `line from last line.end to last line.start + { m4name: [ S:Here + { 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_(m4lgth/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 } ', + `m4_one(`sl_grid',$@)') dnl + popdef(`m4name', `m4wdth', `m4lgth', `m4box') ') + + `sl_load( stem linespec, keys, breaker or Sn:slash) + keys: name=Name; lgth=expr; wdth=expr; + head= arrowhead attributes; + default breaker name is Br' +define(`sl_load', +`sl_eleminit_(`$1') + pushkeys_(`$2',`name:Head:N; wdth:sl_loadwid_; lgth:sl_loadlen_; head::N')dnl + ifelse(`$3',, + `line from last line.end to last line.start + { 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 } ', + `m4_one(`sl_load',$@)') dnl + popdef(`m4name', `m4wdth', `m4lgth', `m4head') ') + + `sl_meterbox( stem linespec, keys, breaker or Sn:slash) + keys: sl_box attributes + default breaker name is Br' +define(`sl_meterbox', +`sl_eleminit_(`$1') + pushkeys_(`$2',`name:Head:N; wdth:sl_ttboxwid_; lgth:sl_ttboxlen_; box::N; + text::N')dnl + ifelse(`$3',, + `line from last line.end to last line.start + {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}', + `m4_one(`sl_meterbox',$@)') dnl + popdef(`m4name', `m4wdth', `m4lgth', `m4box', `m4text') ') + + `sl_generator( stem linespec, keys, + breaker or Sn:slash) + keys: + name= head name; + type=AC|WT|BS|StatG|PV|Y|Delta; + (type PV): sl_box keys name, lgth, wdth, + text,box; + (otherwise): sl_disk body keys name, + text, diam, circle; + default breaker name is Br + Arg5 can be Y;name=Name with default + name headname_Y, + or Delta;name=Name with + default name headname_D' +define(`sl_generator', +`pushkeys_(`$2',`type:AC:N; name:Head:N; lgth:sl_sboxlen_; wdth:m4lgth/2; + box::N; text::N')dnl + ifelse(m4type,PV, + `sl_box(`$1',wdth=m4lgth*0.6;`$2',`$3') + {line from m4name.S+vec_(0,m4wdth*0.45) \ + to m4name.S+vec_(m4wdth/2,0) \ + then to m4name.S+vec_(0,-m4wdth*0.45)}', +`sl_disk($@) + m4lcd = last circle.diam + { ifinstr(m4type,AC, + `{ ACsymbol(at last circle,,,R) }', + m4type,Y, + `pushkey_(`$3',name,m4name`'_Y,N)dnl + {m4name:Ysymbol(with .N at last circle,size=m4lcd/4) } popdef(`m4name')', + m4type,Delta, + `pushkey_(`$3',name,m4name`'_Y,N)dnl + {m4name:Deltasymbol(with .N at last circle,size=m4lcd/4) }dnl + popdef(`m4name')', + m4type,WT, + `{ Windturbine(with .N at last circle.c,size=m4lcd*0.9) }', + m4type,BS, + `{ m4angt = rp_ang; battery(up_ m4lcd*3/4 with .c at m4name.c) + cross(at m4name.c+(m4lcd/4,m4lcd/5),m4lcd/6) + line right_ m4lcd/6 with .c at m4name.c+(m4lcd/4,-m4lcd/6) + point_(m4angt) }', + m4type,StatG, + `{ m4angt= rp_ang; pushdef(`dimen_',m4lcd*2) + diode(right_ dimen_/6 with .c at m4name.c,DK) + popdef(`dimen_') point_(m4angt)}') + [ box invis wid_ m4lcd ht_ m4lcd ] at last circle }') dnl + popdef(`m4type',`m4name', `m4lgth', `m4wdth', `m4box', `m4text')') + + `sl_syncmeter( stem linespec, keys, breaker or Sn:slash)' + `default breaker name Br' +define(`sl_syncmeter',`sl_disk($@) + { Syncsymb(at last circle) + m4lcd = last circle.diam + [ box invis wid_ m4lcd ht_ m4lcd ] at last circle } popdef(`m4thype')') + + `sl_lamp( stem linespec, keys, breaker or Sn:slash)' + `default breaker name Br' +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')') + + + `Windturbine(at position, keys, U|D|L|R|degrees) + keys: size=expr; color="color string" + Arg3: drawing direction (default: Right)' +define(`Windturbine',`[ + pushkeys_(`$2',`size:sl_diskdia_:;color:"black":N')dnl + setdir_(`$3',R) + C: Here; N: C + circle diam m4size/18 at C colored m4color + for t = 30 to 360 by 120 do { + tr = t*dtor_ + spline 0.55 thick 0.2 shaded m4color outlined m4color \ + from M4wt(4,-0.8) to M4wt(1.810794,-0.921724) + Loopover_(`M4LO',`continue to M4LO', + M4wt(1.135237,-0.069654), M4wt(1.777783,1.339647), + M4wt(4.198063,2.031772), M4wt(5.033839,2.04), + M4wt(5.598904,2.029888), M4wt(17.372737,0.390951), + M4wt(18.164674,0.024408), M4wt(17.639221,-0.537401), M4wt(4,-0.8)) } + `$4'; resetdir_ popdef(`m4color',`m4size') ] ifelse(`$1',,`at Here',`$1')') +define(`M4wt',`(vec_(rot_(`$1',`$2',tr))*m4size/36)') + + `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 + type S input circle inner object, + type S output circle inner object) + keys: + name=body name (default Body); + scale=expr; (body size factor: default 1) + type=I|S|A[R] + (type=I) cycles=n; (default 4) + core= A[ir]|M[n]|P[n]|K[n] + n=integer (default 2 lines) + (type=S) body=circle attributes; + Note arg5 and arg6 + (type=A) body=circle attributes ; + type AR means right orientation + (breaker default names are BrI, BrO) + Args 3 and 4 specify input and output stem objects + (breakers or slash symbols); + Args 5 and 6 for the input and output circles are + name=symbol name; (optional) + Y for a Y symbol + YN for a Y symbol with ground + Default name for a Y in arg5 is Body_Y1; in + arg6 it is Body_Y2 + Delta for a Delta symbol + Default name for arg5 is Body_D1; in + arg6 it is Body_D2 + otherwise other customization commands in + a {} pair. ' +define(`sl_transformer', +`pushkeys_(`$2',name:Body:N; type:I:N; cycles:4:N; core::N; body::N; + scale:sl_transcale_; )define(`m4scf',(m4scale*1.3))dnl + ifinstr(m4type,S, + `define(`m4blgth',sourcerad_*3.5*m4scf)', + m4type,A, + `define(`m4blgth',sourcerad_*3*m4scf)', + `ifelse(ifinstr(m4core,M,T,m4core,P,T,m4core,K,T),T, + `define(`m4nL',ifelse(len(m4core),1,2,substr(m4core,1)))dnl + define(`m4blgth',(dimen_/8 + dimen_/12 + (m4nL-1)*dimen_/16)*m4scf)',dnl + `define(`m4blgth',(dimen_/8 + dimen_/12)*m4scf)')')dnl + ifelse(`$3'`$4',, + `ifinstr(m4type,S, + `pushdef(`sourcerad_',sourcerad_*m4scf)dnl + source(`$1',G,,,m4body,m4name); C: last [].c popdef(`sourcerad_') + ifelse(`$5',,,`m4DY(`$5',, 1,m4name.C1,sl_diskdia_*0.18,rp_ang*rtod_)') + ifelse(`$6',,,`m4DY(`$6',-,2,m4name.C2,sl_diskdia_*0.18,rp_ang*rtod_)')', + m4type,A, + `eleminit_(`$1'); C: last line.c + { line to rvec_(rp_len/2-m4blgth/2,0); round + pushdef(`m4R',ifinstr(m4type,R,-))dnl + {m4name: [ C2: circle rad m4blgth/3 m4body at (0,0) + Arc: arc ifinstr(m4type,R,c)`'cw \ + from C2-vec_(m4blgth/3*2,0) to C2+vec_(0,m4R`'m4blgth/3) \ + with .c at C2-vec_(0,m4R`'m4blgth/2) ] \ + with .C2 at rvec_(m4blgth/3*2,0)} popdef(`m4R') + line from rvec_(m4blgth,0) to rvec_(rp_len/2+m4blgth/2,0) } + line invis to rvec_(rp_len,0)', + `eleminit_(`$1'); C: last line.c; m4atmp = rp_ang; m4slen = rp_len + { line to rvec_((m4slen-m4blgth)/2,0) + {m4name: [ linewid = linewid*m4scf + {L1: inductor(to vec_(0,-m4cycles*dimen_/8),,m4cycles,m4core)} + point_(m4atmp) + L2: inductor(from vec_(m4blgth/m4scf,-m4cycles*dimen_/8) \ + to vec_(m4blgth/m4scf,0),,m4cycles) + point_(m4atmp) ] with .L1.c at Here} + line from rvec_(m4blgth,0) to rvec_((m4slen+m4blgth)/2,0) } + line invis to rvec_(rp_len,0)')', + `m4_two(`sl_transformer',m4blgth,$@)') + popdef(`m4name', `m4type', `m4cycles', `m4core', `m4body', `m4scale') ') +define(`m4trground', +`if pmod(drawdir_(`$1'),180)==0 then { + line from `$2' to `$2'+(0,-sourcerad_*5/4*m4scf); ground(,T) } \ + else { + line from `$2' to `$2'+(sourcerad_*3/2*m4scf,0); corner; ground } ') + + `sl_transformer3(linespec, + keys, + breaker1:breaker2:breaker3, + symbol1:symbol2:symbol3) + keys: + name=Name; + type=S|C; (default S) + scale=expr; + direct=L|R; + body=circle attributes; ' +define(`sl_transformer3', +`[ pushkeys_(`$2',name:Body:N; scale:sl_transcale_; direct:L:N; body::N; + type:S:N )dnl + ifelse(m4type,S, + `m4trAr(`m4Br',patsubst(`$3',:,`,'))m4trAr(`m4Sy',patsubst(`$4',:,`,'))dnl + pushdef(`sl_breakersep_',sl_breakersep_*2/3)dnl + sl_transformer($1,type=S;name=m4name;scale=m4scale;$2, + m4Br1,m4Br2,m4Sy1,m4Sy2) + Tstart: last line.start; C1: m4name.C1; m4atmp = rp_ang + Tend: last line.end; C2: m4name.C2 + define(`m4R',`ifinstr(m4direct,R,-)')dnl + C3: m4name.C1+vec_(Rect_(m4name.C1.rad*3/2,m4R`'60)) + move to C3+vec_(0,m4R`'m4name.C1.rad) + Tc: rvec_(0,m4R`'m4name.C1.diam`'ifelse(m4Br3,,/3)) + sl_disk(from Tc to Here, + diam=m4name.C1.diam;name=C3;circle=m4body;`$2',m4Br3) + m4DY(m4Sy3,,3,C3,C3.diam*0.18,rp_ang*rtod_); popdef(`sl_breakersep_') + point_(m4atmp)', + `pushdef(`m4rad',`sl_diskdia_/6*m4scale')dnl + eleminit_(`$1',m4rad*8) + Tstart: Here + line to rvec_(rp_len/2-m4rad*2,0); round + Arc: arc cw to rvec_(m4rad*4,0) with .c at rvec_(m4rad*2,0) + round; line to rvec_(rp_len/2-m4rad*2,0) + Tend: Here + C: circle rad m4rad at Arc.c + line from C+vec_(0,-m4rad) to C+vec_(0,-m4rad*3) + Tc: Here popdef(`m4rad') ') + popdef(`m4name',`m4scale',`m4direct',`m4body',`m4type') ]') +define(`m4trAr',`define(`$1'`1',$2)define(`$1'`2',$3)define(`$1'`3',$4)') + + `m4DY(symbol,neg,number,loc,size,angle) + Insert Delta or Y symbol' +define(`m4DY', +`pushkey_(`$1',name,m4name`'_`'ifinstr(`$1',Delta,D,Y)`$3',N)dnl + define(`m4ang',``$6'`'ifelse(`$2',-,+180)')dnl + define(`m4sn',m4name)popdef(`m4name')dnl + ifinstr(`$1',Delta, + `{m4sn: Deltasymbol(with .N at `$4',size=`$5',m4ang-180)} ', + `$1',Y, + `{m4sn: Ysymbol(with .N at `$4',size=`$5',m4ang)} + ifinstr(`$1',N,`{m4trground(m4ang,m4sn.N)}') ', + `{`$1'}')') + + `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 (default Body); + text="text"; + (breaker default names BrI, BrO)' +define(`sl_ttbox', +`pushkeys_(`$2',`lgth:sl_ttboxlen_; wdth:sl_ttboxwid_; + name:Body:N; box::N; text::N; supp::N')dnl + ifelse(`$3'`$4',, + `eleminit_(`$1') + {line to rvec_((rp_len-m4lgth)/2,0) + {m4name: rotbox(m4lgth,m4wdth,m4box,,m4supp) \ + with .W at Here } + ifelse(m4text,,,`{m4text at rvec_(m4lgth/2,0)};') dnl + line from rvec_(m4lgth,0) to rvec_((rp_len+m4lgth)/2,0)} + line invis to rvec_(rp_len,0) ', + `m4_two(`sl_ttbox',m4lgth,$@)') dnl + popdef(`m4lgth', `m4wdth', `m4name', `m4box', `m4text', `m4supp') ') + + `sl_rectifier(ttbox args)' +define(`sl_rectifier', +`pushkeys_(`$2',`lgth:sl_ttboxlen_; wdth:sl_ttboxwid_; name:Body:N')dnl + sl_ttbox($@) + { line from m4name.ne to m4name.sw + AC: ACsymbol(at m4name.c+(-m4lgth/6, m4wdth/4),,,R) + DC: DCsymbol(at m4name.c+( m4lgth/6,-m4wdth/4),,,R) } dnl + popdef(`m4lgth',`m4wdth',`m4name') ') + + `sl_inverter(ttbox args)' +define(`sl_inverter', +`pushkeys_(`$2',`lgth:sl_ttboxlen_; wdth:sl_ttboxwid_; name:Body:N')dnl + sl_ttbox($@) + { line from m4name.ne to m4name.sw + DC: DCsymbol(at m4name.c+(-m4lgth/6, m4wdth/4),,,R) + AC: ACsymbol(at m4name.c+( m4lgth/6,-m4wdth/4),,,R) } dnl + popdef(`m4lgth',`m4wdth',`m4name') ') + + `m4_one( `elementname', + linespec (placeholder not used), + body keys, + breaker keys or S[n]: keys )' + `Draw the breaker slash in the element stem' +define(`m4_one', +`pushkeys_(`$4',lgth:sl_breakersize_; sep:sl_breakersep_)dnl + M4end: last line.end + {ifelse(regexp(`$4',^ *S),-1, + `ifelse(`$4',,, + `line to last line.end-vec_(m4lgth+m4sep,0) + pushdef(`m4bri',`ifelse(`$4',C,,`$4',O,`box=fill_(0)')')dnl + sl_breaker(to rvec_(m4lgth,0),`$4';m4bri;name=Br) popdef(`m4bri')') + $1(to M4end,`$3')', + `{ $1(to M4end,`$3') } + ifelse(`$4',,, + `define(`m4in',`ifelse(`$4',S,1,`$4',S:,1, + `patsubst(`$4',.*S\([0-9][0-9]*\):?.*,\1)')')dnl + define(`m4inkey',`patsubst(`$4',^ *S[0-9]*:?)') pushkey_(m4inkey,name,SL,N) + sl_slash(at M4end-vec_(m4lgth+m4sep*2/3,0), + m4inkey;name=m4name,m4in:) popdef(`m4name')')')} + popdef(`m4lgth',`m4sep')') + + `sl_breaker(linespec, type=[A|C][D]; ttbox keys) + C is for curved breaker + D is for sl_drawout with two chevrons + Default body name is Br' +define(`sl_breaker', +`pushkeys_(`$2',`lgth:sl_breakersize_; wdth:sl_breakersize_; + name:Br:N; type:A:N')dnl + ifinstr(ifinstr(m4type,CD,T,m4type,DC,T),T, + `m4ch_two(`cbreaker',`$1',,,m4name)', + m4type,C, + `cbreaker(`$1',,,m4name)', + m4type,D, + `m4ch_two(`sl_ttbox',`$1', + lgth=m4lgth;wdth=m4wdth;`$2'ifinstr(`$2',name=,;name=m4name))', + `$2',X;, + `sl_ttbox(`$1',supp=line from NW to SE + line from NE to SW;lgth=m4lgth;wdth=m4wdth;`$2';name=m4name)', + `$2',/;, + `sl_ttbox(`$1', + supp=line from SE to NW;lgth=m4lgth;wdth=m4wdth;`$2';name=m4name)', + `$2',\;, + `sl_ttbox(`$1', + supp=line from NE to SW;lgth=m4lgth;wdth=m4wdth;`$2';name=m4name)', + `sl_ttbox(`$1',lgth=m4lgth;wdth=m4wdth;`$2')' ) dnl + popdef(`m4lgth', `m4wdth', `m4name', `m4type') ') + + `sl_reactor(linespec,keys,breaker keys,breaker keys) + keys= + name=Name (body name, default Body); + diam=expr; + Default breakers BrI, BrO' +define(`sl_reactor', +`pushkeys_(`$2',`diam:sl_diskdia_*2/3;name:Body: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) } + {m4name: [ box invis ht m4diam wid m4diam ] at rvec_(rp_len/2,0)} + line invis to rvec_(rp_len,0) ', + `m4_two(`sl_reactor',m4diam,$@)') dnl + popdef(`m4diam',`m4name') ') + + `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', +`pushkeys_(`$2',`lgth:sl_chevronsiz_; wdth:sl_chevronsiz_; type::N; + name:Body: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) + 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) dnl + popdef(`m4lgth', `m4wdth', `m4type', `m4name', `m4line') ') + +# Two-terminal utilities ################################################## + + `Breakers or slashes in the input and output lines: + `m4_two(`2-term element macroname in quotes', + body length, + linespec, + body keys, + [Sn:] input breaker or slash keys, + [Sn:] output breaker or slash keys)' + In args 5 and 6 a prefix S: or Sn: draws slashes + (Default breaker names are BrI and BrO) + (Default slash names are SLI and SLO)' +define(`m4_two', +`pushkeys_(`$4',lgth:ifelse(`$2',,sl_ttboxlen_*2,`$2'); sep:sl_breakersep_)dnl + ifelse(regexp(`$5',^ *S),-1, + `define(`m4il',`ifelse(`$5',,0, + `pushkey_(`$5',lgth,sl_breakersize_) m4lgth popdef(`m4lgth')')')dnl + define(`m4ol',`ifelse(`$6',,0, + `pushkey_(`$6',lgth,sl_breakersize_) m4lgth popdef(`m4lgth')')')dnl + eleminit_(`$3',max(elen_,m4lgth+m4il*3.5+m4ol*3.5+m4sep*2)) + M4end: last line.end + { line to last line.c-vec_((m4lgth + m4il + m4ol + m4sep*2)/2,0) + pushdef(`m4bri',`ifelse(`$5',,,`$5',C,,`$5',O,`box=fill_(0)')')dnl + ifelse(`$5',,,`sl_breaker(to rvec_(m4il,0),`$5';m4bri;name=BrI) + line to rvec_(m4sep,0)') + $1(to rvec_(m4lgth,0),`$4',,,`$7',`$8') + pushdef(`m4bro',`ifelse(`$6',,,`$6',C,,`$6',O,`box=fill_(0)')')dnl + ifelse(`$6',,,`line to rvec_(m4sep,0) + sl_breaker(to rvec_(m4ol,0),`$6';m4bro;name=BrO)') + line to M4end popdef(`m4bri', `m4bro') }', + `eleminit_(`$3',max(elen_,m4lgth+m4sep*4)) ; dnl slashes + M4end: last line.end + { $1(to M4end,`$4',,,`$7',`$8') } + ifelse(`$5',,,`define(`m4in',`ifelse(`$5',S,1,`$5',S:,1, + `patsubst(`$5',.*S\([0-9][0-9]*\):?.*,\1)')')dnl + define(`m4inkey',`patsubst(`$5',^ *S[0-9]*:?)')dnl + pushkey_(m4inkey,name,SLI,N)dnl + {sl_slash(at rvec_(rp_len/2-m4lgth/2-m4sep,0), + m4inkey;name=m4name,m4in:)} popdef(`m4name')') + ifelse(`$6',,,`define(`m4on',`ifelse(`$6',S,1,`$6',S:,1, + `patsubst(`$6',.*S\([0-9][0-9]*\):*.*,\1)')')dnl + define(`m4onkey',`patsubst(`$6',^ *S[0-9]*:?)')dnl + pushkey_(m4onkey,name,SLO,N)dnl + {sl_slash(at rvec_(rp_len/2+m4lgth/2+m4sep,0), + m4onkey;name=m4name,m4on:)} popdef(`m4name')') ') + line invis to M4end popdef(`m4lgth', `m4sep') ') + + `Chevrons in the input and output lines:' + `m4ch_two(`2-term element macroname in quotes', + linespec, + body keys)' +define(`m4ch_two', +`define(`m4bl',`setkey_(`$3',lgth,dimen_*3/8) m4lgth')popdef(`m4lgth')dnl + eleminit_(`$2',dimen_*2) + M4start: Here; M4end: last line.end + M4elem: $1(to rvec_(m4bl+2*sl_chevronsiz_,0) with .c at last line.c,`$3') + sl_drawout(from last line.start-vec_(sl_chevronsiz_,0) to last line.start, + type=T,R) + line from last line.start to M4start + sl_drawout(from M4elem.end to M4elem.end+vec_(sl_chevronsiz_,0),type=T) + line to M4end + line invis from M4start to M4end') + +# Composite elements ################################################### + + `sl_ct( at position, keys, R|L|U|D|degrees ) + keys: + type=L|N|S[n] (default L; + Sn draws n slashes, default 2) + scale=expr (default 1); + grnd=degrees (type S or N); + stemlgth=expr (type L or S); + type=N omits the stem and slashes + type=Sn draws n slashes, e.g., type=S2 + Arg3 sets the stem direction' +define(`sl_ct',`[ Origin: Here + pushkeys_(`$2', type:L:N; scale:1; grnd::N ) dnl + define(`m4scf',`(m4scale*1.2)')dnl + setdir_(`$3',R) + ifinstr(m4type,L, + `L: inductor(to vec_(2*dimen_/8*m4scf,0) with .c at Origin,,2); C: L.c + pushkey_(`$2',stemlgth,dimen_/5)dnl + line from L.start to L.start+vec_(0,-m4stemlgth) + Tstart: Here + line from L.end to L.end+vec_(0,-m4stemlgth) + Tend: Here + line from L.c to L.c+vec_(0,-m4stemlgth) + Tc: Here popdef(`m4stemlgth')', + m4type,S, + `C: circle rad sourcerad_*m4scale at Origin + pushkey_(`$2',stemlgth,C.rad*4)dnl + Stem: line from C to C+vec_(m4stemlgth,0) chop C.rad chop 0; Tc: Here + ifelse(m4grnd,,,`ground(at C+(Rect_(C.rad,m4grnd)),,,m4grnd)'); \ + pushdef(`m4n',`ifelse(m4type,S,2,`eval(patsubst(m4type,.*S))')')dnl + sl_slash(at C+vec_(C.rad*2.5,0),,m4n:rp_ang*rtod_) + popdef(`m4stemlgth',`m4n')', + m4type,N, + `C: circle rad sourcerad_*m4scale at Origin + ifelse(m4grnd,,,`ground(at C+(Rect_(C.rad,m4grnd)),,,m4grnd)') ') + resetdir_ popdef(`m4type', `m4scale', `m4grnd' ) + ] with .Origin ifelse(`$1',,at Here,`$1') ') + + `sl_busbar( linespec, np, keys ) + Labels P1, P2 ... Pnp are defined on the line. + keys: line=line attributes; + port=D; (dotted ports) + indent=expr; + (distance of points from Start and End) + The bus extends beyond the first and last points + by the indent value (default) sl_busindent_' +define(`sl_busbar', + `define(`m4npoints',`ifelse(`$2',,2,`$2')')dnl + pushkeys_(`$3',`line:thick sl_busthick_:N; port::N; indent:sl_busindent_')dnl + [ tmp_ang = rp_ang + eleminit_(`$1',(m4npoints-1)*dimen_) + Start: last line.start; End: last line.end + M: move from Start to End chop m4indent + for_(1,m4npoints,1, + `P`'m4x: (m4x-1)/(m4npoints-1) between M.start and M.end dnl + ifinstr(m4port,D,` ;dot(at P`'m4x)')') + Line: line from Start to End m4line; C: Line.c + point_(tmp_ang) ] popdef(`m4line', `m4port', `m4indent') ') + + `sl_slash( at position, keys, [n:]R|L|U|D|degrees) + keys: + lines=line attributes; + size=expr (default ht dimen_/3); ' +define(`sl_slash',`[ C: Here + pushkeys_(`$2',lines::N; size:dimen_/3 )dnl + define(`m4nsl',`ifelse(`$3',,1,`ifinstr(`$3',:,patsubst(`$3',:.*),1)')')dnl + pushdef(`m4ACd',`ifinstr(`$3',:,`patsubst(`$3',.*:)',`$3')')dnl + setdir_(ifelse(m4ACd,,`ifdef(`m4a_',rp_ang*rtod_,0)',m4ACd)) + dx = m4size/2.5 + for_(1,m4nsl,1, `{ line to vec_(m4size/sqrt(3),m4size) m4lines \ + with .c at C+vec_((m4x-(1+m4nsl)/2)*dx,0) } ') + resetdir_ popdef(`m4lines', `m4size',`m4ACd') + `$8' ] ifelse(`$1',,at Here,`$1')') + +# ####################################################################### + +divert(0)dnl diff --git a/Master/texmf-dist/doc/latex/circuit-macros/libcct.m4 b/Master/texmf-dist/doc/latex/circuit-macros/libcct.m4 index d607c524fed..3c4128b6d34 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/libcct.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/libcct.m4 @@ -1,7 +1,7 @@ divert(-1) libcct.m4 -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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 * @@ -33,6 +33,7 @@ TWO-TERMINAL ELEMENTS are constructed as follows, with variations: # The invisible body block: {[box invis ht_ m4v wid_ m4h ] at rvec_(rp_len/2,0)} + # Some elements omit this block but draw the visible lines within a block. # The final invisible line: line to rvec_(rp_len,0) invis @@ -52,6 +53,14 @@ NON-TWO-TERMINAL ELEMENTS are usually constructed within a block: but not the placement of the element, since [] blocks are placed as if they were boxes. +============================================================================== + +DEBUGGING: The statement + print "`$0'($@)" ; + inserted into a macro will display the macro name and current arguments + provided the arguments do not contain double quotes. Similarly, the + m4 macro m4msg( text ) will display the text during m4 processing. + ============================================================================== CUSTOMIZATIONS: @@ -66,14 +75,6 @@ CUSTOMIZATIONS: from the first and the third argument is expanded, otherwise the fourth argument (which may be null) is expanded. -============================================================================== - -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. ==============================================================================' @@ -233,7 +234,7 @@ define(`resistor', `ebox(`$1') { ACsymbol(at last [],m4h*3.5,m4h*2,R) [] wid 2nd last [].wid ht 2nd last [].ht at 2nd last [] }', - `define(`dna_',ifelse(`$3',,N,`$3',R,N,`$3'))dnl + `define(`dna_',ifelse(`$3',,N,`$3',R,N,`$3')`')dnl eleminit_(`$1') sc_draw(`dna_',N, `define(`m4n',`ifelse(`$2',,6,`eval(2*($2))')')dnl Default resistor: @@ -379,7 +380,7 @@ define(`addtaps',` ifelse(`$2',,`undefine(`m4tap_x')popdef(`m4type',`m4name')', `ifdef(`m4tap_x',`define(`m4tap_x',incr(m4tap_x))', `define(`m4tap_x',1) M4tap_w: last [].w_; M4tap_e: last [].e_ - setkeys_(`$1',type::N; name:Tap:N)dnl + pushkeys_(`$1',type::N; name:Tap:N)dnl ifelse(m4type,,`ifinstr(`$1',=,,`define(`m4type',`$1')')')dnl M4tap_xy: (last [].wid_,last [].ht_)') {define(`m4tapl',`ifelse(`$3',,`dimen_/3',`$3')')dnl @@ -460,58 +461,53 @@ define(`inductor',`eleminit_(`$1') define(`m4n',`ifelse(`$3',,4,`$3')')dnl ifelse(`$2',W, `define(`m4wd',((2*m4n-2)*m4c2t+2)*m4hlw)', `$2',L, `define(`m4wd',(m4n+1)*m4hlw)', - `define(`m4ht',`ifelse(`$5',,`dimen_/16',(`$5')/2)')dnl + `define(`m4ht',`ifelse(`$5',,`dimen_/16',(`$5')/2)')dnl half other loop wid define(`m4wd',m4n*m4ht*2)')dnl { 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 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 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; 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 - [ 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 ] ') + {M4coil: [ S: Here; + ifelse(`$2',W,`define(`m4ht',`(1+m4st)*m4hlw')dnl + define(`m4dp',`(m4s2t-m4st)*m4hlw') 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 ', + `$2',L,`define(`m4ht',`m4hlw*10/8')define(`m4dp',`m4hlw/2')dnl + 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 ', + `define(`m4dp',0)dnl + ifelse(ifpstricks(T)`'ifmpost(T)`'ifpgf(T)`'ifsvg(T),T, + `define(`m4y')',`undefine(`m4y')')dnl + 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)}') } ') ] with .S at Here } + 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(M4coil.S+vec_(m4wd/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 wid M4coil.wid ht M4coil.ht at M4coil + M: move from M4Core`'m4nL.start to M4Core`'m4nL.end ] \ + with .M.c at M4Core`'m4nL.c }') + line from rvec_(m4wd,0) to rvec_((rp_len+m4wd)/2,0) } + line to rvec_(rp_len,0) invis ') `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''})') +define(`m4ct',`Cos(25)')define(`m4st',`Sin(25)') +define(`m4c2t',`Cos(50)')define(`m4s2t',`Sin(50)') `transformer( linespec, L|R, np, [A|M[n]|P[n]|K[n]][W|L][D1|D2|D12|D21], ns ) @@ -526,8 +522,8 @@ define(`m4m_core',`for_(1,`$6',1,`{M4Core`'m4x: line \ D1: phase dots at P1 and S1 ends; D2: dots at P2 and S2 ends; D12: dots at P1 and S2 ends; D21: dots at P2 and S1 ends' -define(`transformer', `[ P1: Here define(`m4drt',m4dir) - define(`m4WL',`ifinstr(`$4',W,W,`ifinstr(`$4',L,L)')')dnl +define(`transformer', `[ P1: Here define(`m4drt',m4_dir_) + define(`m4WL',`ifinstr(`$4',W,W,`$4',L,L)')dnl define(`m4np',`ifelse(`$3',,4,(`$3'))')dnl define(`m4ns',`ifelse(`$5',,4,(`$5'))')dnl ifelse(`$1',,`mvw = max(\ @@ -594,10 +590,10 @@ define(`delay',`eleminit_(`$1') innerdiam=expr; outer= outer circle attributes; (dotted ...) inner= inner circle attributes; (shaded ...)' -define(`xtal',`eleminit_(`$1') setkey_(`$2',type,N,N) - ifelse(m4type,R,`setkeys_(`$2',`outerdiam:dimen_/3; innerdiam:m4outerdiam*0.4; +define(`xtal',`eleminit_(`$1') pushkey_(`$2',type,N,N) + ifelse(m4type,R,`pushkeys_(`$2',`outerdiam:dimen_/3; innerdiam:m4outerdiam*0.4; outer::N; inner::N') define(`m4wd',m4outerdiam) ', - `setkeys_(`$2',`wdth:dimen_/4; lgth:m4wdth*2/3; bxwd:m4lgth/2; box::N;')dnl + `pushkeys_(`$2',`wdth:dimen_/4; lgth:m4wdth*2/3; bxwd:m4lgth/2; box::N;')dnl define(`m4wd',m4lgth) ') { line to rvec_(rp_len/2-m4wd/2,0) {[ Orig: Here; ifelse(m4type,R, @@ -621,7 +617,7 @@ define(`xtal',`eleminit_(`$1') setkey_(`$2',type,N,N) `source( linespec, V|v|I|i|AC|B|F|G|H|Q|L|N|P|R|S[C[r]|E[r]]]|T|X|U|other, - diameter, R, fill) + diameter, R, attributes,body name) V = voltage source; v = alternate voltage source; I = current source; i = alternate current source; AC = AC source; B = bulb; F = fluorescent; G = @@ -631,14 +627,15 @@ define(`xtal',`eleminit_(`$1') setkey_(`$2',type,N,N) 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' + arg 5 modifies the circle with e.g., color or fill + arg 6 names the body [] block' define(`source',`ifelse(`$4',R, `reversed(`source',`$1',`$2',`$3',,shift(shift(shift(shift($@)))))', `eleminit_(`$1') define(`m4h',ifelse(`$3',,`sourcerad_',`($3)/2'))dnl ifelse( - `$2',G,`m4_sourceGQ($@)', - `$2',Q,`m4_sourceGQ($@)', + `$2',G,`m4_sourceGQ(`$6',$@)', + `$2',Q,`m4_sourceGQ(`$6',$@)', `{ line to rvec_(rp_len/2-m4h,0) move to rvec_(m4h,0) { Src_C: circle rad m4h `$5' at Here } @@ -733,24 +730,24 @@ define(`source',`ifelse(`$4',R, `{$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) } ') + {ifelse(`$6',,,`$6':)[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', - `m4sv = m4h*2/3 - m4sh = sqrt((m4h)^2-m4sv^2) + `m4sh = m4h*3/4 + m4sv = sqrt((m4h)^2-m4sh^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}') + {ifelse(`$1',,,`$1':)[ Cx: rvec_(m4h,0) + ifelse(`$6',,, + `{circle invis rad m4h `$6' with .c at Cx} + {circle invis rad m4h `$6' with .c at Cx+vec_(m4sh*2,0)}') 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)}') + M1: Cx-vec_(m4h/6,0) C1: circle rad m4h with .c at Cx - C2: ifelse(`$2',G,`circle rad m4h',`arc rad m4h from R to L') \ + C2: ifelse(`$3',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) + M2: C2+vec_(m4h/6,0) ] at rvec_(m4h+m4sh,0)} line from rvec_((m4h+m4sh)*2,0) \ to rvec_(rp_len/2+(m4h+m4sh),0) } ') @@ -876,7 +873,7 @@ define(`battery',`ifelse(`$3',R, box=box attributes, e.g. shaded "green"' define(`ebox',`eleminit_(`$1') {ifinstr(`$2',=, - `setkeys_(`$2',`lgth:dimen_/2; wdth:dimen_/5; text::N; box::N;') + `pushkeys_(`$2',`lgth:dimen_/2; wdth:dimen_/5; text::N; box::N;') line to rvec_(max(0,rp_len/2-m4lgth/2),0); M4ebC: rvec_(m4lgth/2,0) lbox(m4lgth,m4wdth,m4box) ifelse(m4text,,,`{m4text at M4ebC};')', @@ -963,33 +960,30 @@ define(`arrester', ifelse(m4rdna,,`define(`m4rdna',G)')dnl define(`m4rL',ifinstr(`$2',L,-))dnl define(`m4rR',ifinstr(`$2',R,-))dnl - define(`m4aht',`m4Rightstr(`$3',arrowht*2/3)')dnl define(`m4awd',`m4Rightstr(`$3',arrowwid*4/3)')dnl - define(`m4wd', `ifinstr(m4rdna,C,`m4Leftstr(`$3',dimen_/3)', m4rdna,F,`m4Leftstr(`$3',dimen_/3)', m4rdna,s,`m4Leftstr(`$3',dimen_/4)', m4rdna,E,`m4Leftstr(`$3',dimen_*5/8)', `m4Leftstr(`$3',dimen_/2)')')dnl - define(`m4ht', `ifinstr(Loopover_(`Z',`ifinstr(m4rdna,Z,T)',C,A,s),T, `m4Leftstr(`$4',dimen_/4)', ifinstr(m4rdna,F,T),T,`m4Leftstr(`$4',dimen_/3)', `m4Leftstr(`$4',dimen_/5)')')dnl - ifinstr(`$2',D, `[ define(`m4LL',m4rL)dnl ifinstr(m4rdna,S, `R: arrester(ifelse(`$1',,`to rvec_(dimen_,0)'),m4rdna,shift(shift($@))) - Gb: line from R.c+vec_(0,m4LL m4ht/2) to R.c+vec_(0,m4LL (-m4ht*3/2)) ', + Gb: line from R.c+vec_(0,m4LL m4ht/2) to R.c+vec_(0,m4LL (-m4ht*3/2)) + A: R.start; B: R.end; C: R.c; G: Here ', m4rdna,E, `R: arrester(ifelse(`$1',,`to rvec_(dimen_,0)'),m4rdna,shift(shift($@))) - Gb: line from R.c+vec_(0,m4LL m4wd/8) to R.c+vec_(0,m4LL (-m4wd*3/4)) ') - A: R.start; B: R.end; C: R.c; G: Here ]', - + Gb: line from R.c+vec_(0,m4LL m4wd/8) to R.c+vec_(0,m4LL (-m4wd*3/4)) + A: R.start; B: R.end; C: R.c; G: Here ', + `M4ErrorMsg(`D argument of Arrester() applies to types S, E only!') ') ]', `eleminit_(`$1',elen_) {line to rvec_(max(0,rp_len/2-m4wd/2),0) {[ Orig: Here @@ -1044,8 +1038,7 @@ define(`arrester', dot(at rvec_(m4wd*6/8,m4wd/4),dotrad_*2/3) ') ] with .Orig at Here } line from rvec_(m4wd,0) to rvec_(max(0,rp_len/2+m4wd/2),0) } - line invis to rvec_(rp_len,0)') - ') + line invis to rvec_(rp_len,0)') ') `memristor( linespec, wid, ht )' define(`memristor',`eleminit_(`$1') @@ -1124,9 +1117,10 @@ eleminit_(`$1') { [ circle rad dimen_/5 ] at rvec_(rp_len/2,m4ng`'dimen_/3.2) } line invis to rvec_(rp_len,0) ') - `cbreaker( linespec, L|R, D|Th|TS ) + `cbreaker( linespec, L|R, D|Th|TS, body name ) circuit breaker to left or right of linespec, - D=with dots; Th=thermal; TS=squared thermal' + D=with dots; Th=thermal; TS=squared thermal + Default body bounding box name is Br' define(`cbreaker',`ifinstr(`$3',T, `tbreaker($@)', `mbreaker($@)')') @@ -1150,7 +1144,7 @@ define(`tbreaker',`eleminit_(`$1') define(`m4ho',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) } + {ifelse(`$4',,Br,`$4'):[box invis ht_ m4v wid_ m4h ] at rvec_(rp_len/2,ifelse(`$2',R,-)m4ho) } line to rvec_(rp_len,0) invis ') define(`mbreaker',`eleminit_(`$1') define(`m4R',`ifelse(`$2',R,-)') @@ -1165,8 +1159,8 @@ define(`mbreaker',`eleminit_(`$1') define(`m4R',`ifelse(`$2',R,-)') {line from rvec_(m4h,0) \ to rvec_(m4h+max(0,rp_len/2-m4h/2),0) ifelse(`$3',D,`dot(at last line.start,,1)') } - [box invis ht_ m4ht ifelse(`$3',D,`+2*dotrad_') wid_ m4h+dimen_/16] \ - at rvec_(m4h/2,m4R`'(m4ht/2)) } + ifelse(`$4',,Br,`$4'): [box invis ht_ m4ht ifelse(`$3',D,`+2*dotrad_') \ + wid_ m4h+dimen_/16] at rvec_(m4h/2,m4R`'(m4ht/2)) } line to rvec_(rp_len,0) invis ') `gap( linespec,fill,A ) @@ -1313,7 +1307,7 @@ define(`antenna',`[ T: Here `$5'; resetdir_ ] with .T ifelse(`$1',,`at Here',`$1') move to last [].T') - `switch( linespec,L|R,[O|C][D],L|B|D ) + `switch( linespec,L|R,[O|C][D],L|B|D,attribs ) Wrapper for bswitch, lswitch, dswitch R=right orientation (default L=left) if arg4=blank or L: @@ -1324,15 +1318,16 @@ define(`antenna',`[ T: Here A=arrowhead on switch blade; O=opening arrow; C=closing arrow if arg4=B (button switch): arg3 = O|C - O=normally open; C=normally closed - if arg4=D: arg3 = same as for dswitch' + O=normally open; C=normally closed; + if arg4=D: arg3 = same as for dswitch and + arg5 is arg4 of dswitch GC or GX' define(`switch',`ifelse( `$4',, `lswitch(`$1',`$2',`$3')', `$4',L,`lswitch(`$1',`$2',`$3')', `$4',B,`bswitch(`$1',`$2',`$3')', `$4',D,`define(`m4qna_',`$3')dnl define(`m4rna_',W`'ifinstr(`$2',C,dBK,B)`'m4qna_)dnl - dswitch(`$1',`$2',m4rna_)')') + dswitch(`$1',`$2',m4rna_,`$5')')') `bswitch( linespec,L|R,chars ) pushbutton switch R=right orientation (default L=left) @@ -1396,18 +1391,17 @@ define(`lswitch',`eleminit_(`$1') dnl arrowht = m4t1 ; arrowwid = m4t2; ifelse(`$4',,,`{`$4'}') line to rvec_(rp_len,0) invis ') - `dswitch(linespec,R,W[ud]B[K] chars) + `dswitch(linespec,R,W[ud]B chars,text) Comprehensive IEEE-IEC single-pole switch: arg2=R: orient to the right of drawing dir + arg 4 is text for GC and GX options arg 3: blank means WB by default - W=baseline - B=contact blade + B=contact blade open + Bc=contact blade closed Bm= mirror blade Bo=contact blade more widely open dB=contact blade to the right of direction - K=vertical closing contact line - use WdBK for a normally-closed switch Cb = circuit breaker function (IEC S00219) Co = contactor function (IEC S00218) C = external operating mechanism @@ -1418,10 +1412,15 @@ define(`lswitch',`eleminit_(`$1') dnl EL = early close (or late open) LE = late close (or early open) F = fused + GC = disk control mechanism, attribs: + diam=expr;circle=circle attribs; text=char; + GX = box control mechanism, attribs: + lgth=expr;wdth=expr;box=box attr; text=char; H = time delay closing uH = time delay opening HH = time delay opening and closing - K = vertical closing contact + K=vertical closing contact line + use WdBK for a normally-closed switch L = limit M = maintained (latched) MM = momentary contact on make @@ -1435,172 +1434,178 @@ define(`lswitch',`eleminit_(`$1') dnl Sd = Switch-disconnector Th = thermal control linkage Tr = tripping + W = baseline with gap Y = pull switch Z = turn switch' define(`dswitch',`eleminit_(`$1') -define(`dna_',ifelse(`$3',,WB,`$3'))dnl +define(`dna_',ifelse(`$3',,WB,`$3')`')dnl define(`m4R',`ifelse(`$2',R,-)')define(`m4sc',`dimen_/24')dnl - tr_xy_init(last line.c,m4sc,m4R) - M4T: M4_xyO; M4B: M4T - { line to tr_xy(-4,0) - line from tr_xy(4,0) \ - to 2nd last line.end + M4CC: last line.c + sc_draw(`dna_',W, + `{ line from M4CC+vec_( 4*m4sc,0) to last line.end } + { line to M4CC+vec_(-4*m4sc,0) }') + {[ tr_xy_init(,m4sc,m4R) + T: M4_xyO; B: T sc_draw(`dna_',Bm, `define(`m4c',ifelse(m4a,d,-))dnl - M4B: line from tr_xy(-4,0) \ + B: line from tr_xy(-4,0) \ to tr_xy(5.0,m4c`'4.5) - line invis from M4B.start to M4B.end chop 0 chop -m4_xyU*5/4 - m4fshade(0,circle rad m4_xyU*5/4 at last line .end) - M4Q: 2 between M4_xyO and M4B.c') + line invis from B.start to B.end chop 0 chop -m4_xyU*5/4 + m4fshade(0,circle rad m4_xyU*5/4 at last line .end)') sc_draw(`dna_',Bo, `define(`m4c',ifelse(m4a,d,-))dnl - M4B: line from tr_xy(-4,0) \ - to tr_xy(4,m4c`'13/sqrt(3)) - M4Q: 2 between M4_xyO and M4B.c') + B: line from tr_xy(-4,0) \ + to tr_xy(4,m4c`'13/sqrt(3))') + sc_draw(`dna_',Bc, + `B: line from tr_xy(-4,0) \ + to tr_xy( 4,0)') sc_draw(`dna_',B, `define(`m4c',ifelse(m4a,d,-))dnl - M4B: line from tr_xy(-4,0) \ - to tr_xy(5.0,m4c`'4.5) - M4Q: 2 between M4_xyO and M4B.c') + B: line from tr_xy(-4,0) \ + to tr_xy(5.0,m4c`'4.5)') sc_draw(`dna_',Cb, `line from tr_xy(2,-2) to tr_xy(6, 2) - line from tr_xy(2, 2) to tr_xy(6,-2) - M4Q: tr_xy(0,-2) ') + line from tr_xy(2, 2) to tr_xy(6,-2)') sc_draw(`dna_',Co,`ifelse(m4R,-, - `M4Arc: arc ifelse(m4c,-,,c)cw from tr_xy(4,0) \ + `arc ifelse(m4c,-,,c)cw from tr_xy(4,0) \ to tr_xy(8,0) with .c at tr_xy(6,0)', - `M4Arc: arc ifelse(m4c,-,c)cw from tr_xy(4,0) \ + `arc ifelse(m4c,-,c)cw from tr_xy(4,0) \ to tr_xy(8,0) with .c at tr_xy(6,0)') ') - sc_draw(`dna_',MMR, - `line from tr_xy(6,1.16) \ - to tr_xy(4,0) \ - then to tr_xy(6,-1.16)') - sc_draw(`dna_',MM, - `line from tr_xy(5,0) \ - to tr_xy(4,0) \ - then to tr_xy(6,1.16)') - sc_draw(`dna_',MR, - `line from tr_xy(5,0) \ - to tr_xy(4,0) \ - then to tr_xy(6,-1.16)') + sc_draw(`dna_',GC, + `pushkeys_(`$4',`diam:12*m4sc;circle::N;text::N')dnl + line from B.c to B.c+ta_xy(0,4) + GC: circle diam m4diam m4circle dnl + ifelse(m4text,,,`m4lstring(m4text,"m4text")') \ + at Here+ta_xy(0,m4diam/2/(m4sc)) popdef(`m4diam',`m4circle',`m4text')') + sc_draw(`dna_',GX, + `pushkeys_(`$4',`lgth:10*m4sc;wdth:10*m4sc;box::N;text::N')dnl + line from B.c to B.c+ta_xy(0,4) + GX: rotbox(m4lgth,m4wdth,ifelse(m4box,,,type=m4box)) \ + at Here+ta_xy(0,m4lgth/2/(m4sc)) + ifelse(m4text,,,`m4lstring(m4text,"m4text") at GX.C') dnl + popdef(`m4lgth',`m4wdth',`m4box',`m4text')') + sc_draw(`dna_',C, + `T: B.c+ta_xy(0,ifelse(m4a,d,-)12) + C: line dashed from B.c to T ') sc_draw(`dna_',DI, - `line from tr_xy(4,2) to tr_xy(4,-2) - M4Q: tr_xy(0,-2) ') + `DI: line from tr_xy(4,2) to tr_xy(4,-2)') sc_draw(`dna_',D, `ifelse(m4a,u,,`dot(at tr_xy(-4,0),,1)') ifelse(m4a,d,,`dot(at tr_xy(4,0),,1)')') sc_draw(`dna_',EL, - `line from 0.99 along_(M4B) \ - to M4B.end \ - then to M4B.end + ta_xy(vperp(M4B,m4c`'2.5,R))') + `EL: line from 0.99 along_(B) to B.end \ + then to B.end + ta_xy(vperp(B,m4c`'2.5,R))') sc_draw(`dna_',LE, - `line from 0.99 along_(M4B) \ - to M4B.end \ - then to M4B.end + ta_xy(vperp(M4B,m4c`'2.5))') + `LE: line from 0.99 along_(B) \ + to B.end \ + then to B.end + ta_xy(vperp(B,m4c`'2.5))') sc_draw(`dna_',K, - `line from tr_xy(4,0) \ + `K: line from tr_xy(4,0) \ to tr_xy(4,m4c`'5)') sc_draw(`dna_',F, - `M4dT: 1/8 along_(M4B); M4dQ: 5/8 along_(M4B) - line from M4dT to M4dT + ta_xy(neg_(m4c)1/2,1) \ - then to M4dQ + ta_xy(neg_(m4c)1/2,1) \ - then to M4dQ + ta_xy(m4c`'1/2,-1) \ - then to M4dT + ta_xy(m4c`'1/2,-1) \ - then to M4dT ') + `DT: 1/8 along_(B); DQ: 5/8 along_(B) + F: line from DT to DT + ta_xy(neg_(m4c)1/2,1) \ + then to DQ + ta_xy(neg_(m4c)1/2,1) \ + then to DQ + ta_xy(m4c`'1/2,-1) \ + then to DT + ta_xy(m4c`'1/2,-1) \ + then to DT ') sc_draw(`dna_',L, - `M4dT: 11/16 along_(M4B) define(`m4e',ifelse(m4a,d,-)) - line from 5/16 along_(M4B) \ - to M4dT + ta_xy(neg_(m4e)1,ifelse(m4c,m4e,,-)2) \ - then to M4dT') + `DT: 11/16 along_(B) define(`m4e',ifelse(m4a,d,-)) + line from 5/16 along_(B) \ + to DT + ta_xy(neg_(m4e)1,ifelse(m4c,m4e,,-)2) \ + then to DT') sc_draw(`dna_',Sd, `dot(at tr_xy(4,0),m4_xyU*3/2,1) line from tr_xy(4,2)+vec_(m4_xyU*3/2,0) \ - to tr_xy(4,-2)+vec_(m4_xyU*3/2,0) - M4Q: tr_xy(0,-2) ') + to tr_xy(4,-2)+vec_(m4_xyU*3/2,0)') sc_draw(`dna_',Th, `define(`m4t',ifelse(m4a,d,-))dnl - M4T: M4B.c+ta_xy(0,m4t`'12) - line from M4B.c to M4B.c+ta_xy(0,m4t`'4.5) \ - then to M4B.c+ta_xy(3,m4t`'4.5) \ - then to M4B.c+ta_xy(3,m4t`'7.5) \ - then to M4B.c+ta_xy(0,m4t`'7.5) \ - then to M4T ') + T: B.c+ta_xy(0,m4t`'12) + line from B.c to B.c+ta_xy(0,m4t`'4.5) \ + then to B.c+ta_xy(3,m4t`'4.5) \ + then to B.c+ta_xy(3,m4t`'7.5) \ + then to B.c+ta_xy(0,m4t`'7.5) \ + then to T ') sc_draw(`dna_',Tr, - `m4angtmp = rp_ang; point_(lin_ang(M4B)) - M4dT1: 0.4 along_(M4B); M4dT2: 0.65 along_(M4B) - m4dTr = distance(M4dT1,M4dT2) - move to M4dT1+vec_(0,m4c`'m4dTr/2) + `m4angtmp = rp_ang; point_(lin_ang(B)) + DT1: 0.4 along_(B); DT2: 0.65 along_(B) + m4dTr = distance(DT1,DT2) + move to DT1+vec_(0,m4c`'m4dTr/2) m4fshade(0,lbox(m4dTr,m4dTr)) point_(m4angtmp) ') sc_draw(`dna_',PrM, - `M4T: Proxim(dimen_/3) at M4B.c+ta_xy(0,ifelse(m4a,d,-)8) - line dashed dimen_/16 from M4B.c to M4T chop 0 chop dimen_/6 - Magn(dimen_/3,dimen_/6) at M4T+vec_(0,ifelse(m4a,d,-)dimen_/4)') + `T: Proxim(dimen_/3) at B.c+ta_xy(0,ifelse(m4a,d,-)8) + line dashed dimen_/16 from B.c to T chop 0 chop dimen_/6 + Magn(dimen_/3,dimen_/6) at T+vec_(0,ifelse(m4a,d,-)dimen_/4)') + sc_draw(`dna_',MMR, + `line from tr_xy(6,1.16) \ + to tr_xy(4,0) \ + then to tr_xy(6,-1.16)') + sc_draw(`dna_',MM, + `MM: line from tr_xy(5,0) \ + to tr_xy(4,0) \ + then to tr_xy(6,1.16)') + sc_draw(`dna_',MR, + `MR: line from tr_xy(5,0) \ + to tr_xy(4,0) \ + then to tr_xy(6,-1.16)') sc_draw(`dna_',M, `define(`m4t',ifelse(m4a,d,-))dnl - M4T: M4B.c+ta_xy(0,m4t`'12) - line dashed 1.5*m4sc from M4B.c to M4B.c+ta_xy(0,m4t`'4.5) - line to M4B.c+ta_xy(-3,m4t`'6) \ - then to M4B.c+ta_xy(0,m4t`'7.5) - line dashed 1.5*m4sc to M4T ') - sc_draw(`dna_',C, - `M4T: M4B.c+ta_xy(0,ifelse(m4a,d,-)12) - line dashed from M4B.c to M4T ') + T: B.c+ta_xy(0,m4t`'12) + line dashed 1.5*m4sc from B.c to B.c+ta_xy(0,m4t`'4.5) + line to B.c+ta_xy(-3,m4t`'6) \ + then to B.c+ta_xy(0,m4t`'7.5) + line dashed 1.5*m4sc to T ') sc_draw(`dna_',O, - `line from M4T + ta_xy(-2.5,0) \ - to M4T + ta_xy(2.5,0) ') + `line from T + ta_xy(-2.5,0) \ + to T + ta_xy(2.5,0) ') sc_draw(`dna_',PrT, - `M4T: Proxim(dimen_/3) at M4B.c+ta_xy(0,ifelse(m4a,d,-)8) - line dashed dimen_/16 from M4B.c to M4T chop 0 chop dimen_/6 - line to rvec_(dimen_/4,0) with .c at M4T+vec_(0,ifelse(m4a,d,-)dimen_/6)') + `T: Proxim(dimen_/3) at B.c+ta_xy(0,ifelse(m4a,d,-)8) + line dashed dimen_/16 from B.c to T chop 0 chop dimen_/6 + line to rvec_(dimen_/4,0) with .c at T+vec_(0,ifelse(m4a,d,-)dimen_/6)') sc_draw(`dna_',Pr, - `M4T: Proxim(dimen_/3) at M4B.c+ta_xy(0,ifelse(m4a,d,-)8) - line dashed dimen_/16 from M4B.c to M4T chop 0 chop dimen_/6 ') + `T: Proxim(dimen_/3) at B.c+ta_xy(0,ifelse(m4a,d,-)8) + line dashed dimen_/16 from B.c to T chop 0 chop dimen_/6 ') sc_draw(`dna_',P, - `line from M4T + ta_xy(-2.5,-2.5) \ - to M4T + ta_xy(-2.5,0) \ - then to M4T + ta_xy(2.5,0) \ - then to M4T + ta_xy(2.5,-2.5) ') + `line from T + ta_xy(-2.5,-2.5) \ + to T + ta_xy(-2.5,0) \ + then to T + ta_xy(2.5,0) \ + then to T + ta_xy(2.5,-2.5) ') sc_draw(`dna_',Y, - `line from M4T + ta_xy(-2.5,2.5) \ - to M4T + ta_xy(-2.5,0) \ - then to M4T + ta_xy(2.5,0) \ - then to M4T + ta_xy(2.5,2.5) ') + `line from T + ta_xy(-2.5,2.5) \ + to T + ta_xy(-2.5,0) \ + then to T + ta_xy(2.5,0) \ + then to T + ta_xy(2.5,2.5) ') sc_draw(`dna_',Z, - `line from M4T + ta_xy(-2.5,-2.5) \ - to M4T + ta_xy(-2.5,0) \ - then to M4T + ta_xy(2.5,0) \ - then to M4T + ta_xy(2.5,2.5) ') + `line from T + ta_xy(-2.5,-2.5) \ + to T + ta_xy(-2.5,0) \ + then to T + ta_xy(2.5,0) \ + then to T + ta_xy(2.5,2.5) ') sc_draw(`dna_',R, `define(`m4t',ifelse(m4a,d,-))dnl - M4dT: 5/12 along_(M4B); M4dQ: 7/12 along_(M4B) - line from M4dT to M4dT + ta_xy(0,m4t`'12) - line from M4dQ to M4dQ + ta_xy(0,m4t`'(neg_(m4c)sqrt(3)/2+12)) - M4T: 1/2 between Here and 2nd last line.end ') + DT: 5/12 along_(B); DQ: 7/12 along_(B) + line from DT to DT + ta_xy(0,m4t`'12) + line from DQ to DQ + ta_xy(0,m4t`'(neg_(m4c)sqrt(3)/2+12)) + T: 1/2 between Here and 2nd last line.end ') sc_draw(`dna_',HH, `arc ifelse(m4R,-,c)cw \ - from M4T+ta_xy(3,3/2) \ - to M4T+ta_xy(-3,3/2) with .c at M4T+ta_xy(0,4.0) + from T+ta_xy(3,3/2) \ + to T+ta_xy(-3,3/2) with .c at T+ta_xy(0,4.0) arc ifelse(m4R,,c)cw \ - from M4T+ta_xy(3,-3/2) \ - to M4T+ta_xy(-3,-3/2) \ - with .c at M4T+ta_xy(0,-4.0) ') + from T+ta_xy(3,-3/2) \ + to T+ta_xy(-3,-3/2) \ + with .c at T+ta_xy(0,-4.0) ') sc_draw(`dna_',H, `define(`m4t',ifelse(m4a,d,-))dnl arc ifelse(m4t,m4R,,c)cw \ - from M4T+ta_xy(3,m4t`'3/2) \ - to M4T+ta_xy(-3,m4t`'3/2) \ - with .c at M4T + ta_xy(0,m4t`'4.0) ') + from T+ta_xy(3,m4t`'3/2) \ + to T+ta_xy(-3,m4t`'3/2) \ + with .c at T + ta_xy(0,m4t`'4.0) ') sc_draw(`dna_',E, - `line from M4T + ta_xy(-2.5,0) \ - to M4T + ta_xy(2.5,0) - arc ifelse(m4R,-,,c)cw to last line.start with .c at M4T + ta_xy(0,-1.5) ') - M4dQ: M4Q - (M4_xyO.x,M4_xyO.y) - M4dT: M4T - (M4_xyO.x,M4_xyO.y) - if M4dQ.x*M4dT.x + M4dQ.y*M4dT.y > 0 then { M4Q: M4_xyO } - [ box invis ht_ distance(M4T,M4Q) wid_ 8*m4sc ] \ - with .c at 0.5 between M4T and M4Q - } + `line from T + ta_xy(-2.5,0) \ + to T + ta_xy(2.5,0) + arc ifelse(m4R,-,,c)cw to last line.start with .c at T + ta_xy(0,-1.5) ') + ] with .M4_xyO at M4CC } line to rvec_(rp_len,0) invis ') `amp( linespec,size ) @@ -1635,30 +1640,33 @@ define(`integrator',`eleminit_(`$1') drawn as a []: defined positions: W, N, E, S, Out, E1, E2, In1, In2 + size: expr (default lgth equals wdth) + or wdth=expr; lgth=expr; chars: P: power connections V1,V2 R: labels at In1,In2 swapped T: truncated point ' define(`opamp', -`[define(`m4v',`ifelse(`$4',,`dimen_',`($4)')')define(`m4h',`m4v')dnl +`[ ifinstr(`$4',=,`pushkeys_(`$4',wdth:dimen_;lgth:m4wdth)',`pushdef(`m4wdth', + `ifelse(`$4',,`dimen_',`($4)')')pushdef(`m4lgth',m4wdth)')dnl define(`dna_',`$5')dnl - eleminit_(`$1',max(elen_-m4h/4,m4h)) + eleminit_(`$1',max(elen_-m4lgth/4,m4lgth)) W: Here - N: vec_(0,m4v/2) - S: vec_(0,-m4v/2) - E: vec_(m4h,0) - C: vec_(m4h/2,0) + N: vec_(0,m4wdth/2) + S: vec_(0,-m4wdth/2) + E: vec_(m4lgth,0) + C: vec_(m4lgth/2,0) { sc_draw(`dna_',T, `line to N then to 0.75 between N and E \ then to 0.75 between S and E then to S then to W line from 0.75 between W and E to E', `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) } + if rp_len > m4lgth then { line to rvec_(rp_len-m4lgth,0) } Out: Here } - 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) + NE: vec_(m4lgth/2,m4wdth/4); E1: NE + SE: vec_(m4lgth/2,-m4wdth/4); E2: SE + In1: vec_(0,m4wdth/4) + In2: vec_(0,-m4wdth/4) { move to In`'ifinstr(dna_,R,2,1) ifelse(`$2',,"ifsvg(-,`{\scriptsize$-$}')" \ at rvec_(4pt__,0) ifsvg(+(0,textht/10)),m4lstring(`$2',"`$2'"))} @@ -1666,9 +1674,9 @@ define(`dna_',`$5')dnl ifelse(`$3',,"ifsvg(+,`{\scriptsize$+$}')" \ at rvec_(4pt__,0) ifsvg(+(0,textht/10)),m4lstring(`$3',"`$3'"))} sc_draw(`dna_',P, - `{line from E1 to (vec_(m4h/2,m4v/4+m4v/8)); V1: Here} - {line from E2 to (vec_(m4h/2,-(m4v/4+m4v/8))); V2: Here}') - `$6' ] ') + `{line from E1 to (vec_(m4lgth/2,m4wdth/4+m4wdth/8)); V1: Here} + {line from E2 to (vec_(m4lgth/2,-(m4wdth/4+m4wdth/8))); V2: Here}') + `$6' popdef(`m4lgth',`m4wdth')] ') `dac(width,height,nIn,nN,nOut,nS)' define(`dac',`[ @@ -1719,37 +1727,47 @@ SW: rvec_(adc_ht/2,-adc_ht/2) `$7']') `diode(linespec, - B|CR|D|F|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars, + B|CR|D|F|G|L|LE[R]|P[R]|S|Sh|T|U|V|v|w|Z|chars, [R][E]) Adding K to arg2 draws open arrowheads + Adding M draws a mid-arrowhead crossbar Arg 3: R=reversed polarity, E=enclosure' define(`diode', -`define(`m4dtype',`$3')sc_draw(`m4dtype',R, - `reversed(`diode',`$1',`$2',m4dtype,shift(shift(shift($@))))', - `eleminit_(`$1')dnl - define(`dma_',`$2') ifelse(dma_,K,, - `sc_draw(`dma_',K,`define(`m4ahd')',`define(`m4ahd',f)')')dnl - ifelse(dma_,, `m4gen_d(LACR,m4ahd)', - dma_,B,`m4gen_d(uLAZQuR,m4ahd)define(`m4dh',2*m4dh)', - dma_,CR,`m4gen_d(LACRrb,m4ahd)', - dma_,D,`m4gen_d(LuAHdQR,m4ahd)define(`m4dv',2*m4dv)', - dma_,F,`m4gen_d(LFR,m4ahd)', - dma_,G,`m4gen_d(uLAQuR,m4ahd)define(`m4dh',2*m4dh)', - dma_,K,`m4gen_d(LACR)', - dma_,L,`m4gen_d(LAcCR)', - dma_,LE,`m4gen_d(LuEACR,m4ahd)', - dma_,LER,`m4gen_d(LdEACR,m4ahd)', - dma_,P,`m4gen_d(LuPACR,m4ahd)', - dma_,PR,`m4gen_d(LdPACR,m4ahd)', - dma_,S,`m4gen_d(LASR,m4ahd)', - dma_,Sh,`m4gen_d(LFcCR,)', - dma_,T,`m4gen_d(LATR,m4ahd)', - dma_,V,`m4gen_d(LACXdR,m4ahd)', - dma_,v,`m4gen_d(LACvdR,m4ahd)', - dma_,w,`m4gen_d(LAdvXdR,m4ahd)', - dma_,Z,`m4gen_d(LAZR,m4ahd)', - `m4gen_d(patsubst(dma_,f),xtract(dma_,f,R,E))') - sc_draw(`m4dtype',E,`define(`m4dh',`dimen_*0.7')define(`m4dv',`m4dh')dnl +`ifinstr(`$3',R, + `reversed(`diode',`$1',`$2',patsubst(`$3',R),shift(shift(shift($@))))', + `define(`dma_',`$2')dnl + define(`m4ahd',ifinstr(dma_,K,,f))dnl + ifinstr(dma_,M,`define(`m4ahd',m4ahd`'M)')dnl + define(`dma_',patsubst(dma_,`K\|M'))dnl + define(`m4cts',`ifelse( + dma_,,LACR, + dma_,B,uLAZQuR, + dma_,CR,LACRrb, + dma_,D,LuAHdQR, + dma_,F,LFR, + dma_,G,uLAQuR, + dma_,LER,LdEACR, + dma_,LE,LuEACR, + dma_,L,LAcCR, + dma_,P,LuPACR, + dma_,PR,LdPACR, + dma_,Sh,LFcCR, + dma_,S,LASR, + dma_,T,LATR, + dma_,U,LA`'ifinstr(`$3',R,d,u)`'CR, + dma_,V,LACXdR, + dma_,v,LACvdR, + dma_,w,LAdvXdR, + dma_,Z,LAZR, + dma_)') + ifelse(dma_,B,`define(`m4dh',2*m4dh)', + dma_,D,`define(`m4dv',2*m4dv)', + dma_,G,`define(`m4dh',2*m4dh)', + dma_,Sh,`define(`m4ahd')', + dma_,L,`define(`m4ahd',xtract(m4ahd,M))') + eleminit_(`$1') + m4gen_d(m4cts,m4ahd) + ifinstr(`$3',E,`define(`m4dh',`dimen_*0.7')define(`m4dv',`m4dh')dnl { Diode_Env: circle diam m4dh at rvec_(rp_len/2,0) }') define(`m4dm', `ifelse(dma_,S,`m4dv/4', @@ -1759,36 +1777,39 @@ define(`diode', 0)')dnl { [ box invis ht_ m4dv+linethick pt__*sqrt(3) wid_ m4dh+linethick pt__ + m4dm ] at rvec_(rp_len/2+m4dm/2,0) } - line invis to rvec_(rp_len,0)')') - - `m4gen_d(chars,[f][R][E]): - *This is an internal macro, subject to change* - *General: [u|d] for shift, R for orientation* - [u|d]A[c] arrowhead shifted up, down, or 0 - [u|d]F[c] arrowhead open-sided (Shockley) - [u|d]B bar (gate) at arrowhead centre - [u|d]BB long bar (gate) at arrowhead centre - C vertical bar at right of arrowhead - [u|d]E em_arrows out - [u|d]F half arrowhead shifted - G gate for scr(,B), label G - rb current regulator bars - H double-length vertical bars - [u]L left stem, uL = shortened - N thyristor gate at anode, label Ga - [u|d]P em_arrows - [u|d]Q[c] shifted left arrowhead [centerline] - [u]R right stem, uR = shortened - S S-shape vertical bar - T T-diode vertical bar - W Thyristor gate from cathode, label G - X varicap diode-capacitor - [u|d]v varicap diode-capacitor curved plate - Y bilateral core - Z zener bar - arg 2: f= fill the arrowhead - R=right orientation - E=envelope flag ' + line invis to rvec_(rp_len,0) +')') + `m4gen_d(chars,[f][R][M][E]): + *This is an internal macro, subject to change* + *General: [u|d] for shift, R for orientation* + [u|d]A[c] arrowhead shifted up, down, or 0 + [u|d]F[c] arrowhead open-sided (Shockley) + [u|d]B bar (gate) at arrowhead centre + [u|d]BB long bar (gate) at arrowhead centre + [u|d]C vertical bar at right of arrowhead + u: with limiter bar on left; d on right + [u|d]E em_arrows out + [u|d]F half arrowhead shifted + G gate for scr(,B), label G + rb current regulator bars + H double-length vertical bars + [u]L left stem, uL = shortened + M mid-arrow crossbar + N thyristor gate at anode, label Ga + [u|d]P em_arrows + [u|d]Q[c] shifted left arrowhead [centerline] + [u]R right stem, uR = shortened + S S-shape vertical bar + T T-diode vertical bar + W Thyristor gate from cathode, label G + X varicap diode-capacitor + [u|d]v varicap diode-capacitor curved plate + Y bilateral core + Z zener bar + arg 2: f= fill the arrowhead + M=arrowhead crossbar + R=right orientation + E=envelope flag ' define(`m4gen_d',`{dnl define(`m4dv',`dimen_/6')define(`m4dh',sqrt(3)*m4dv/2)dnl define(`ddna_',`ifelse(`$1',,`LACR',`$1')')dnl @@ -1837,6 +1858,8 @@ define(`m4gen_d',`{dnl then to rvec_(0,m4dn)') { ifinstr(ddf_,f,`m4fshade(m4fill,m4dFline)',`m4dFline')} ifdef(`m4Ac',`{line from rvec_(0,m4dn) to rvec_(m4dh,m4dn)}') + ifinstr(`$2',M,`{line from rvec_(m4dh/2,m4dn+m4dv/2) \ + to rvec_(m4dh/2,m4dn-m4dv/2)}') move to rvec_(m4dh,0) ') sc_draw(`ddna_',B,dnl Perp bar at arrowhead centre `{ifelse(m4a,u,dnl from arrow edge or across the centre line @@ -1852,8 +1875,10 @@ define(`m4gen_d',`{dnl G: Gm.c') ifelse(m4a,,,G: last line.end) }') sc_draw(`ddna_',C,dnl Vertical bar - `{line from rvec_(0,-m4dv/2-m4dy) \ - to rvec_(0, m4dv/2+m4dy)}') + `{ line from ifelse(m4a,d,`rvec_(m4dh/2,-m4dv/2-m4dy-m4dh/2) to')dnl + rvec_(0,-m4dv/2-m4dy) \ + to rvec_(0, m4dv/2+m4dy) ifelse(m4a,u, + `to rvec_(m4dh/2, m4dv/2+m4dy+m4dh/2)') }') m4gen_d2($@)dnl m4gen_d3($@)dnl }') dnl macro split to keep within m4 buffer size @@ -1997,7 +2022,7 @@ define(`thyristor', `define(`m4tharg',ifelse(`$2',,SCR,`$2')) dnl default define(`m4thtype',xtract(m4tharg,SCR,SCS,SUS,SBS,IEC))dnl ifelse(m4thtype,,`define(`m4thtype',xtract(m4tharg,B))')dnl - define(`m4thx',`patsubst(m4tharg,m4thtype)')dnl delete the type code + define(`m4thx',`patsubst(m4tharg,m4thtype)')dnl delete the type code sc_draw(`m4thx',R,`define(`m4thf',R)',`define(`m4thf')')dnl orientation sc_draw(`m4thx',E,`define(`m4thf',m4thf`'E)')dnl envelope define(`m4thAc',xtract(m4thx,F,A))define(`m4thAc',patsubst(m4thAc,F,Fc))dnl @@ -2057,7 +2082,7 @@ define(`tgate',`[ eleminit_(`$1') define(`m4tgm',ifinstr(`$2',L,-)) C: last line.center ifinstr(`$2',B, `ebox(from A to B) - Gb: C+vec_(0,m4tgm`'m4ht/2) + Gb: C+vec_(0,m4tgm`'m4wdth/2) L1: line from 2 between Gb and C to 4 between Gb and C', `m4gen_d(uLAQuR) Circle: circle thick max(4pt__,linethick/2) rad m4dh/4 \ @@ -2405,7 +2430,7 @@ define(`Fe_fet',`mosfet(`$1',`$2',ifelse(`$3',,SDFT,`$3'),, arg 4: envelope' define(`mosfet', `define(`m4R',`ifelse(`$2',R,-)')dnl right orientation flag - define(`dna_',`ifelse(`$3',,DSEdMuBQ,`$3')')dnl + 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 @@ -2666,7 +2691,7 @@ define(`parallel_', define(`m4br',0) define(`m4parsep',`m4sepdefault')dnl stackdo_(`m4parS', `define(`m4pel',m4parS) - setkey_(m4pel,Sep,m4parsep)dnl + pushkey_(m4pel,Sep,m4parsep)dnl ifelse(m4br,0,`define(`m4parsep',m4Sep)')dnl ifinstr(m4pel,Sep=,`define(`m4pel',substr(m4pel,eval(index(m4pel,;)+1)))') E`'eval(m4br+1): [ @@ -2781,7 +2806,7 @@ define(`resized',`define(`m4resiztmp',dimen_)define(`dimen_',(dimen_)*(`$1'))dnl drawing angle. If arg5 is blank the symbol is placed over the last []' define(`variable',`$1 - {[ define(`dna_',ifelse($2,,A,$2))define(`m4sgn',regexp(`$3',^ *[+-]))dnl + {[ 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 @@ -2806,24 +2831,26 @@ define(`variable',`$1 line up dimen_*0.06 then right dimen_*0.12 then up dimen_*0.06') `$6'] with .C ifelse(`$5',,at last [].c,`$5') } ') - `Line hopping over named lines, + `Line hopping over named ordered lines, diverting left or right: - crossover(linespec,L|R,line_name,line_name,...)' -define(`hoprad_',`dimen_/12') -define(`crossover',`eleminit_(`$1')dnl - M4_Tmp: last line.end - m4_xover_(shift($@))dnl - line to M4_Tmp') -define(`m4_xover_', - `define(`m4_lt2',`ifelse(ifpstricks(T)`'ifmpost(T)`'ifpgf(T)`'ifsvg(T),T, + crossover(linespec, + [L|R][:line attributes], + line_name,line_name,...) + attributes are outlined "color" dotted ... + #define(`hoprad_',`dimen_/12')' +define(`crossover',`eleminit_(`$1') + define(`m4attribs',ifinstr(`$2',:,`patsubst(`$2',^.*:)'))dnl + define(`m4divert',`patsubst(`$2',:.*)')dnl + define(`m4_lt2',`ifelse(ifpstricks(T)`'ifmpost(T)`'ifpgf(T)`'ifsvg(T),T, `hlth',0)')dnl - ifelse(`$2',,, - `line to intersect_(last line.start,M4_Tmp,`$2'.start,`$2'.end)\ + M4Start: last line.start; M4End: last line.end + Loopover_(`M4',`line m4attribs to intersect_(M4Start,M4End,M4.start,M4.end) \ chop 0 chop hoprad_-m4_lt2 ifelse(`m4_lt2',0,,`move to rvec_(-m4_lt2,0)') - arc ifelse(`$1',R,c)cw to rvec_(2*hoprad_,0) with .c at rvec_(hoprad_,0) - ifelse(`m4_lt2',0,,`move to rvec_(-m4_lt2,0)') - m4_xover_(`$1',shift(shift($@)))')') + arc m4attribs ifelse(m4divert,R,c)cw to rvec_(2*hoprad_,0) \ + with .c at rvec_(hoprad_,0) + ifelse(`m4_lt2',0,,`move to rvec_(-m4_lt2,0)')', shift(shift($@))) + line m4attribs to M4End ') `NPDT(npoles,chars) Double throw switch chars: @@ -3362,7 +3389,7 @@ define(`m4portpins',`for_(1,m4n,1, Gyrator two-port wrapper for nport e.g. gyrator(ht boxwid invis,,0,N)' define(`gyrator', - `define(`m4dna_',ifelse(xtract(`$4',V)`'xtract(`$4',H),,H`$4',`$4'))dnl + `define(`m4dna_',ifelse(xtract(`$4',V)`'xtract(`$4',H),,H`$4',`$4')`')dnl sc_draw(`m4dna_',H, `nport(ifelse(`$1',,wid boxht,`$1'),1,,1,,`$2',`$3',`$4', line from (Box,W1a)+(-Box.wid/2,0) \ @@ -3421,61 +3448,80 @@ define(`norator',`eleminit_(`$1') {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)} line to rvec_(rp_len,0) invis ') - `ACsymbol(at position, len, ht, [A]U|D|L|R|degrees) + `ACsymbol(at position, len, ht, [n:][A]U|D|L|R|degrees) Arg4: drawing direction (default: current direction) Arg4 contains A: use arcs instead of sinusoid - A convenience for drawing a 1-cycle sinusoid, + A convenience for drawing a stack of n 1-cycle + sinusoids (default 1) e.g. source; ACsymbol(at last [])' define(`ACsymbol',`[ Origin: Here - define(`m4range',`ifelse(`$2',,(dimen_/3),`($2)')')dnl - define(`m4ACd',patsubst(`$4',A))dnl + pushdef(`m4range',`ifelse(`$2',,(dimen_/3),`($2)')')dnl + pushdef(`m4ACd',`patsubst(ifinstr(`$4',:,`patsubst(`$4',.*:)',`$4'),A)')dnl setdir_(ifelse(m4ACd,,`ifdef(`m4a_',rp_ang*rtod_,0)',m4ACd)) Start: rvec_(-m4range/2,0) End: rvec_( m4range/2,0) - define(`m4amp',`ifelse(`$3',,`m4range/3',`($3)/2')') - ifinstr(ifgpic(A)`$4',A, - `{ arc ccw to Start with .c at rvec_(-m4range/4,-max(m4range/4-m4amp,0)) } - { arc ccw to End with .c at rvec_( m4range/4, max(m4range/4-m4amp,0)) }', - `{ sinusoid(m4amp,twopi_/m4range,pi_/2,-m4range/2,m4range/2) \ - with .Origin at Origin } ') - `$5'; resetdir_ ] with .Origin ifelse(`$1',,`at Here',`$1')') + pushdef(`m4n',`ifinstr(`$4',:,`eval(patsubst(`$4',:.*))',1)')dnl + pushdef(`m4amp',`ifelse(`$3',,`m4range/6',`($3)/2')')dnl + for_(1,m4n,1,`move to Origin+vec_(0,((m4n+1)/2-m4x)*m4range/3) + ifinstr(ifgpic(A,`$4'),A, + `{ arc ccw to rvec_(-m4range/2,0) \ + with .c at rvec_(-m4range/4,-max(m4range/4-m4amp,0)) } + { arc ccw to rvec_( m4range/2,0) \ + with .c at rvec_( m4range/4, max(m4range/4-m4amp,0)) }', + `{ sinusoid(m4amp,twopi_/m4range,pi_/2,-m4range/2,m4range/2) \ + with .Origin at Here } ')') + `$5'; resetdir_ popdef(`m4amp',`m4n',`m4ACd',`m4range')] \ + with .Origin ifelse(`$1',,`at Here',`$1')') `Deltasymbol(at position, keys, U|D|L|R|degrees) keys: size=expr; - Arg4: drawing direction (default: Up)' + type=C|O (default C for Closed, O means open); + Arg3: drawing direction (default: Up) + An O (not 0) in arg3 draws an open symbol' define(`Deltasymbol',`[ sq3 = sqrt(3) - setkey_(`$2',size,dimen_/10)dnl + pushkeys_(`$2',size:dimen_/10; type:C:N )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')') + ifinstr(m4type,C, + `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))', + `line from vec_(vscal_(m4size,-sq3/2,-1/2)) \ + to vec_(vscal_(m4size,-sq3,-1)) \ + then to vec_(vscal_(m4size,-sq3,1)) \ + then to vec_(vscal_(m4size,-sq3/2,1/2)) ') + C: vec_(vscal_(m4size,-(sq3+1/sq3)/2,0)); N: C + `$4'; resetdir_ popdef(`m4size',`m4type') ] 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)' + keys: size=expr; type=G[L] (grounded, + L puts the ground on the left); + Arg3: drawing direction (default: Up)' define(`Ysymbol',`[ sq3 = sqrt(3) - setkeys_(`$2',`size:dimen_/10:; type::N')dnl + pushkeys_(`$2',`size:dimen_/10:; type::N')dnl setdir_(`$3',U) - C: Here + C: Here; N: C 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 + ifelse(m4type,,,`line ifinstr(m4type,L,left_,right_) m4size*3/2; corner pushdef(`dimen_',m4size*4) ground popdef(`dimen_') ') `$4'; resetdir_ popdef(`m4size',`m4type') ] ifelse(`$1',,`at Here',`$1')') + `Wyesymbol(at position, keys, U|D|L|R|degrees) + Synonym for Ysymbol' +define(`Wyesymbol',`Ysymbol($@)') `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)')') + pushdef(`m4wid',`ifelse(`$2',,(dimen_/3),`($2)')')dnl + pushdef(`m4ht',`ifelse(`$3',,`(m4wid/5)',`($3)')') setdir_(ifelse(`$4',,`ifdef(`m4a_',rp_ang*rtod_,0)',`$4')) Origin: rvec_(m4wid/2, m4ht/2) {line to rvec_(m4wid,0)} dashline(from rvec_(0, m4ht) to rvec_(m4wid, m4ht),,m4wid/4,m4wid/8) - `$5'; resetdir_ ] with .Origin ifelse(`$1',,`at Here',`$1')') + `$5'; resetdir_ popdef(`m4ht',`m4wid') ] \ + with .Origin ifelse(`$1',,`at Here',`$1')') `n-terminal box nterm(box specs; other commands, @@ -3739,8 +3785,7 @@ define(`m4sfgselfcurve',`spline `$2' m4c_l from rvec_(Rect_(sfg_rad,`$1'30)) \ overwritten with the background color (default white). Arg 1 contains R for right-handed winding. Arg 4 must be an integer. - Arg 6 must be compatible with the postprocessor. - Requires a recent version of dpic or gpic' + Arg 6 must be compatible with the postprocessor.' define(`winding',`[ define(`m4rt',`ifinstr(`$1',R,-)') d = ifelse(`$2',,`dimen_',`$2') p = ifelse(`$3',,d/4,`$3') @@ -3779,8 +3824,8 @@ define(`winding',`[ define(`m4rt',`ifinstr(`$1',R,-)') define(`tstrip',`[ setdir_(`$1') define(`m4n',`ifelse(`$2',,4,`eval($2)')')dnl ifelse(eval(m4n<1),1,`define(`m4n',1)')dnl - setkey_(`$3',ht,dimen_/2)dnl - setkey_(`$3',wid,m4n*m4ht*0.6)dnl + pushkey_(`$3',ht,dimen_/2)dnl + pushkey_(`$3',wid,m4n*m4ht*0.6)dnl {Box: [shade(1,lbox(m4wid,m4ht))] } bw = m4wid/(m4n) ifinstr(`$3',O,,`for i=1 to m4n-1 do { @@ -3788,7 +3833,7 @@ define(`tstrip',`[ setdir_(`$1') for_(1,m4n,1,`{T`'m4x: ifinstr(`$3',I,`rvec_((m4x-0.5)*bw,0)', `dot(at rvec_((m4x-0.5)*bw,0),,ifinstr(`$3',D,0,1))') {L`'m4x: T`'m4x+vec_(0,m4ht/2)}; {R`'m4x: T`'m4x+vec_(0,-m4ht/2)} }') - `$4' popdef(`m4ht')popdef(`m4ht') + `$4' popdef(`m4wid',`m4ht') resetdir_ ]') `jack(U|D|L|R|degrees, chars) @@ -3899,17 +3944,18 @@ define(`SQUID', tweaked, and the cct_init macro modified.' Size and style parameters: -define(`dimen_',`linewid') Default element body size unit - -define(`sourcerad_',`(0.25*dimen_)') Source element default radius -define(`csdim_',`(0.3*dimen_)') Controlled Source width/2 -define(`elen_',`(1.5*dimen_)') Default element length -define(`delay_rad_',`(0.35*dimen_)') Delay elements -define(`dotrad_',`(0.04*dimen_)') Redefine dot size for circuits -define(`m4fill',0) Default fill for diode, fuse, ... -define(`em_arrowwid',`(dimen_/9)') `em_arrows arrowhead width' -define(`em_arrowht',`(dimen_/7)') `em_arrows arrowhead ht' -define(`em_arrowhead',1) `em_arrows arrowhead style' +define(`dimen_',`linewid') `Default element body size unit' + +define(`sourcerad_',`(0.25*dimen_)') `Source element default radius' +define(`csdim_',`(0.3*dimen_)') `Controlled Source width/2' +define(`elen_',`(1.5*dimen_)') `Default element length' +define(`delay_rad_',`(0.35*dimen_)') `Delay elements' +define(`dotrad_',`(0.04*dimen_)') `Redefine dot size for circuits' +define(`m4fill',0) `Default fill for diode, fuse, ...' +define(`em_arrowwid',`(dimen_/9)') `em_arrows arrowhead width' +define(`em_arrowht',`(dimen_/7)') `em_arrows arrowhead ht' +define(`em_arrowhead',1) `em_arrows arrowhead style' +define(`hoprad_',`dimen_/12') `arc radius for crossover macro' right_ divert(0)dnl diff --git a/Master/texmf-dist/doc/latex/circuit-macros/libgen.m4 b/Master/texmf-dist/doc/latex/circuit-macros/libgen.m4 index d9ed56f066c..7862d04bb46 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/libgen.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/libgen.m4 @@ -2,7 +2,7 @@ divert(-1) libgen.m4 Base macros for dpic and gpic diagrams -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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 * @@ -44,7 +44,7 @@ dnl define(`HOMELIB_',`D:\Dwight\lib') `NeedDpicTools( path ) If path is empty then HOMELIB_ is used e.g. NeedDpicTools or NeedDpicTools(/home/lib/)' -define(`NeedDpicTools',`if "dpictools" != "1" then { copy dnl +define(`NeedDpicTools',`if "dpictools_" != "1" then { copy dnl ifelse(`$1',,`"HOMELIB_`'dpictools.pic"',`"`$1'dpictools.pic"') }') Processor shortcuts @@ -184,7 +184,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.7: ifelse(m4picprocessor,gpic,`Gpic', +`#' `$1' Version 9.8: ifelse(m4picprocessor,gpic,`Gpic', m4postprocessor,pstricks,`PSTricks', m4postprocessor,pgf,`TikZ PGF', m4postprocessor,mfpic,`Mfpic', @@ -197,22 +197,22 @@ define(`m4announceprocessor',`dnl Do not change the format of the next line: `#' WARNING: Default m4 configuration file gpic.m4 assumed')') Set environment direction -define(`right_',`define(`m4dir',right)define(`m4rp_ang',0)dnl -define(`m4a_',1)define(`m4b_',0)define(`m4c_',0)define(`m4d_',1) m4dir') +define(`right_',`define(`m4_dir_',right)define(`m4rp_ang',0)dnl +define(`m4a_',1)define(`m4b_',0)define(`m4c_',0)define(`m4d_',1) m4_dir_') -define(`left_',`define(`m4dir',left)define(`m4rp_ang',pi_)dnl -define(`m4a_',(-1))define(`m4b_',0)define(`m4c_',0)define(`m4d_',(-1)) m4dir') +define(`left_',`define(`m4_dir_',left)define(`m4rp_ang',pi_)dnl +define(`m4a_',(-1))define(`m4b_',0)define(`m4c_',0)define(`m4d_',(-1)) m4_dir_') -define(`up_',`define(`m4dir',up)define(`m4rp_ang',(pi_/2))dnl -define(`m4a_',0)define(`m4b_',1)define(`m4c_',(-1))define(`m4d_',0) m4dir') +define(`up_',`define(`m4_dir_',up)define(`m4rp_ang',(pi_/2))dnl +define(`m4a_',0)define(`m4b_',1)define(`m4c_',(-1))define(`m4d_',0) m4_dir_') -define(`down_',`define(`m4dir',down)define(`m4rp_ang',(-pi_/2))dnl -define(`m4a_',0)define(`m4b_',(-1))define(`m4c_',1)define(`m4d_',0) m4dir') +define(`down_',`define(`m4_dir_',down)define(`m4rp_ang',(-pi_/2))dnl +define(`m4a_',0)define(`m4b_',(-1))define(`m4c_',1)define(`m4d_',0) m4_dir_') `savem4dir([`stackname']) Save the current m4 direction parameters' define(`savem4dir',`define(`m4ss_',`ifelse(`$1',,savm4dir`'_,`$1')') -pushdef(m4ss_`'_,m4dir)dnl +pushdef(m4ss_`'_,m4_dir_)dnl pushdef(m4ss_`'_,m4a_)dnl pushdef(m4ss_`'_,m4b_)dnl pushdef(m4ss_`'_,m4c_)dnl @@ -224,12 +224,12 @@ define(`m4d_',m4xpand(m4ss_`'_))popdef(m4ss_`'_)dnl define(`m4c_',m4xpand(m4ss_`'_))popdef(m4ss_`'_)dnl define(`m4b_',m4xpand(m4ss_`'_))popdef(m4ss_`'_)dnl define(`m4a_',m4xpand(m4ss_`'_))popdef(m4ss_`'_)dnl -define(`m4dir',m4xpand(m4ss_`'_))popdef(m4ss_`'_)') +define(`m4_dir_',m4xpand(m4ss_`'_))popdef(m4ss_`'_)') Manhattan direction cosines define(`manhattan',`dnl -define(`m4a_',`ifelse(m4dir,left,-1,m4dir,up,0,m4dir,down,0,1)')dnl -define(`m4b_',`ifelse(m4dir,left,0,m4dir,up,1,m4dir,down,-1,0)')dnl +define(`m4a_',`ifelse(m4_dir_,left,-1,m4_dir_,up,0,m4_dir_,down,0,1)')dnl +define(`m4b_',`ifelse(m4_dir_,left,0,m4_dir_,up,1,m4_dir_,down,-1,0)')dnl define(`m4c_',`neg_(m4b_)')dnl define(`m4d_',`m4a_')') Default current coordinates @@ -261,7 +261,7 @@ define(`m4c_',(-sin(rp_ang)))define(`m4d_',cos(rp_ang))')') define(`setdir_', `pushdef(`m4sdir',`ifelse(`$1',, `ifelse(`$2',,`ifdef(`m4rp_ang',m4rp_ang*rtod_,R)',`$2')',`$1')')dnl - m4sd_ang = rp_ang; pushdef(`m4tdir',m4dir)dnl + m4sd_ang = rp_ang; pushdef(`m4tdir',m4_dir_)dnl ifinstr( m4sdir,R,`rp_ang = 0; right_', m4sdir,L,`rp_ang = pi_; left_', @@ -310,8 +310,14 @@ define(`Rect_',`vscal_(`$1',cosd(`$2'),sind(`$2'))') `Rectangular to polar coords, returning a pair polar_(x,y)' define(`polar_',`vlength(`$1',`$2'),atan2(`$2',`$1')') - `Polar_(x,y)' returns degrees + `Polar_(x,y)' returns degrees define(`Polar_',`vlength(`$1',`$2'),rtod_*atan2(`$2',`$1')') + `quadrant_(degrees) returns 1, 2, 3, or 4' +define(`quadrant_',`(int(pmod(`$1',360)/90)+1)') + `drawdir_(degrees,sector angle) + Nearest multiple of {sector angle, default 90)' +define(`drawdir_',`define(`m4sectang',`ifelse(`$2',,90,(`$2'))')dnl + (int(pmod(`$1'+m4sectang/2,360)/m4sectang)*m4sectang)') `arcr( position, radius, start radians, end radians, @@ -368,8 +374,8 @@ define(`arca',`[Chord: line invis `$1' `Integer "for" loop with index variable m4x: for_(initial,final,incr,`actions') eg for_(0,10,2,`print m4x') ' -define(`for_',`ifelse(eval(`$1'!=(`$2'+(`$3'))),1,`pushdef(`m4x',`$1') $4 - popdef(`m4x')for_(eval(`$1'+(`$3')),`$2',`$3',`$4')')') +define(`for_',`ifelse(eval(`$1'!=(`$2'+(`$3'))),1,`pushdef(`m4x',`$1')$4 +popdef(`m4x')for_(eval(`$1'+(`$3')),`$2',`$3',`$4')')') `Integer m4 while loop: while_(`test',`actions') eg define(`i',5) @@ -382,7 +388,7 @@ define(`while_',`ifelse(eval($1),1,`$2`'while_(`$1',`$2')')') macro m4Lx to 1, 2, ...; e.g. Loopover_(`x',`print "m4Lx. x"',Tom,Dick,Mary)' define(`Loopover_',`ifelse(`$3',,, -`pushdef(`$1',`$3')pushdef(`m4Lx',ifdef(`m4Lx',`incr(m4Lx)',1)) $2 +`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 @@ -419,7 +425,9 @@ define(`m4msg',`syscmd(echo "$@" >/dev/stderr)') define(`m4stackmsg',`stackexec_(`$1',`m4Btmp', `syscmd(echo $1 >/dev/console)')dnl stackexec_(`m4Btmp',`$1')') - + `Macro error message to the terminal' +define(`M4ErrorMsg',`m4msg(*** Macro ERROR: + $@)') `Copy m4 stack stackcopy_(`Source',`Dest',[`count'])' define(`stackcopy_',`undefine(`$2')ifelse(`$3',,,`define(`$3',0)')dnl @@ -568,6 +576,7 @@ define(`centerline_',`rpoint_(`$1') `m4xtract(str1,str2) Return value 1 if str2 present in str1 else 0, delete str2 from str1' + `Danger: if str1==str2 then str2 becomes null' define(`m4xtract',`define(`m4I',index($1,`$2'))dnl define(`$1',substr($1,0,m4I)`'substr($1,ifelse(m4I,-1,0,eval(m4I+len($2)))))dnl ifelse(m4I,-1,0,1)') @@ -579,28 +588,28 @@ ifelse(m4I,-1,0,1)') direction of right, say. String attributes, default right -define(`above_',`ifelse(m4dir,right,above,m4dir,left,below,m4dir,up,rjust,ljust)') -define(`below_',`ifelse(m4dir,right,below,m4dir,left,above,m4dir,up,ljust,rjust)') -define(`ljust_',`ifelse(m4dir,right,ljust,m4dir,left,rjust,m4dir,up,above,below)') -define(`rjust_',`ifelse(m4dir,right,rjust,m4dir,left,ljust,m4dir,up,below,above)') +define(`above_',`ifelse(m4_dir_,right,above,m4_dir_,left,below,m4_dir_,up,rjust,ljust)') +define(`below_',`ifelse(m4_dir_,right,below,m4_dir_,left,above,m4_dir_,up,ljust,rjust)') +define(`ljust_',`ifelse(m4_dir_,right,ljust,m4_dir_,left,rjust,m4_dir_,up,above,below)') +define(`rjust_',`ifelse(m4_dir_,right,rjust,m4_dir_,left,ljust,m4_dir_,up,below,above)') Dimensions: wid, ht -define(`wid_',`ifelse(m4dir,right,wid,m4dir,left,wid,m4dir,up,ht,ht)') -define(`ht_',`ifelse(m4dir,right,ht,m4dir,left,ht,m4dir,up,wid,wid)') +define(`wid_',`ifelse(m4_dir_,right,wid,m4_dir_,left,wid,m4_dir_,up,ht,ht)') +define(`ht_',`ifelse(m4_dir_,right,ht,m4_dir_,left,ht,m4_dir_,up,wid,wid)') Compass corners -define(`n_',`ifelse(m4dir,right,n,m4dir,left,s,m4dir,up,w,e)') -define(`s_',`ifelse(m4dir,right,s,m4dir,left,t,m4dir,up,r,l)') -define(`w_',`ifelse(m4dir,right,w,m4dir,left,e,m4dir,up,s,n)') -define(`e_',`ifelse(m4dir,right,e,m4dir,left,w,m4dir,up,n,s)') -define(`ne_',`ifelse(m4dir,right,ne,m4dir,left,sw,m4dir,up,nw,se)') -define(`nw_',`ifelse(m4dir,right,nw,m4dir,left,se,m4dir,up,sw,ne)') -define(`sw_',`ifelse(m4dir,right,sw,m4dir,left,ne,m4dir,up,se,nw)') -define(`se_',`ifelse(m4dir,right,se,m4dir,left,nw,m4dir,up,ne,sw)') -define(`loc_',`ifelse(m4dir,right,($1,$2),m4dir,left,($1,$2),($2,$1))') +define(`n_',`ifelse(m4_dir_,right,n,m4_dir_,left,s,m4_dir_,up,w,e)') +define(`s_',`ifelse(m4_dir_,right,s,m4_dir_,left,t,m4_dir_,up,r,l)') +define(`w_',`ifelse(m4_dir_,right,w,m4_dir_,left,e,m4_dir_,up,s,n)') +define(`e_',`ifelse(m4_dir_,right,e,m4_dir_,left,w,m4_dir_,up,n,s)') +define(`ne_',`ifelse(m4_dir_,right,ne,m4_dir_,left,sw,m4_dir_,up,nw,se)') +define(`nw_',`ifelse(m4_dir_,right,nw,m4_dir_,left,se,m4_dir_,up,sw,ne)') +define(`sw_',`ifelse(m4_dir_,right,sw,m4_dir_,left,ne,m4_dir_,up,se,nw)') +define(`se_',`ifelse(m4_dir_,right,se,m4_dir_,left,nw,m4_dir_,up,ne,sw)') +define(`loc_',`ifelse(m4_dir_,right,($1,$2),m4_dir_,left,($1,$2),($2,$1))') Directions -define(`rt_',`ifelse(m4dir,right,right,m4dir,left,left,m4dir,up,up,down)') -define(`dn_',`ifelse(m4dir,right,down,m4dir,left,up,m4dir,up,right,left)') -define(`lt_',`ifelse(m4dir,right,left,m4dir,left,right,m4dir,up,down,up)') -define(`up__',`ifelse(m4dir,right,up,m4dir,left,down,m4dir,up,left,right)') +define(`rt_',`ifelse(m4_dir_,right,right,m4_dir_,left,left,m4_dir_,up,up,down)') +define(`dn_',`ifelse(m4_dir_,right,down,m4_dir_,left,up,m4_dir_,up,right,left)') +define(`lt_',`ifelse(m4_dir_,right,left,m4_dir_,left,right,m4_dir_,up,down,up)') +define(`up__',`ifelse(m4_dir_,right,up,m4_dir_,left,down,m4_dir_,up,left,right)') Binary operations giving simplified readable expressions for obvious cases. @@ -805,14 +814,16 @@ define(`m4dupstr',`define(`$3',)for_(1,ifelse(`$2',,1,`$2'),1, define(`m4Delch', `ifelse(substr(`$1',0,1),ifelse(`$2',,_,`$2'),`substr(`$1',1)',`$1')') - `setkey_(string,key,default,[N]) + `pushkey_(string,key,default,[N]) + setkey_(string,key,default,[N]) string contains semicolon-separated terms of the form key=val If string contains abc=expr; then pushdef(`m4abc',(expr)) otherwise pushdef(`m4abc',(default)). + setkey_ uses define() instead of pushdef{}. Nonblank arg4 omits the parentheses.' -define(`setkey_', +define(`pushkey_', `pushdef(`m4xt',index(`$1',`$2'=))ifelse(m4xt,-1, `pushdef(key_prefix`'$2,`ifelse(`$3',,,ifelse(`$4',,(`$3'),`$3'))')', `define(`m4sktmp',substr(`$1',eval(m4xt+len(`$2')+1)))dnl m4sktmp used later @@ -822,15 +833,29 @@ define(`setkey_', substr(m4sktmp,0,index(m4sktmp,;))))')')dnl popdef(`m4xt')') +define(`setkey_', + `define(`m4xt',index(`$1',`$2'=))ifelse(m4xt,-1, + `define(key_prefix`'$2,`ifelse(`$3',,,ifelse(`$4',,(`$3'),`$3'))')', + `define(`m4sktmp',substr(`$1',eval(m4xt+len(`$2')+1)))dnl m4sktmp used later + ifelse(index(m4sktmp,;),-1, + `define(key_prefix`'$2,ifelse(`$4',,(m4sktmp),m4sktmp))', + `define(key_prefix`'$2,ifelse(`$4',,(substr(m4sktmp,0,index(m4sktmp,;))), + substr(m4sktmp,0,index(m4sktmp,;))))')')dnl +popdef(`m4xt')') + 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 + `pushkeys_(string,keysequence) + Invoke pushkey_ on a sequence of terms. + setkeys_(string,keysequence) + Invoke setkey_ on a sequence of terms. + Arg 2 is a sequence of semicolon (;)-separated + terms of the form identifier:default value:N - containing 3 fields separated by : ' -define(`setkeys_',`Loopover_(`M4Z',`setkey_(`$1',patsubst(M4Z,:,`,')) dnl', + containing up to 3 fields separated by : ' +define(`pushkeys_',`Loopover_(`M4Z',`pushkey_(`$1',patsubst(M4Z,:,`,'))dnl', + patsubst(`$2',;,`,'))') +define(`setkeys_',`Loopover_(`M4Z',`setkey_(`$1',patsubst(M4Z,:,`,'))dnl', patsubst(`$2',;,`,'))') `String with exact typeset dimensions: @@ -848,7 +873,6 @@ ifelse(index(`$1',"),0,`substr(`$1',1,eval(len(`$1')-2))',`$1')}dnl "ifelse(`$2',,,`,shift($@))') \ wid s_wd(,`textwid') ht s_ht(,`textht')+s_dp')') -define(`text_ang',90) `r_text(text,degrees) (requires PSTricks, pgf, or svg)' define(`r_text',`define(`m4txt', @@ -859,6 +883,7 @@ ifsvg(`svg_rot(m4rtang,"m4txt")')dnl ifpstricks(`"\rput[c]{m4rtang}(0,0){m4txt}"')dnl ifpgf(`"\pgftext[rotate=m4rtang]{m4txt}"')',"m4txt")') +define(`text_ang',90) `Like s_box but text is rotated text_ang degrees (requires PSTricks or pgf)' define(`rs_box', @@ -903,9 +928,9 @@ define(`dot',`[define(`m4ft',`ifelse(`$3',,0,(`$3'))')dnl move to last [].c') `cross(at location,size); assumes that a cross always has manhattan directions' -define(`crosswd_',`ifelse(`$2',,`(0.05*scale)',`($2)')') -define(`cross',`[{line from Here+(0,neg_(crosswd_)) to Here+(0,crosswd_)} - line from Here+(neg_(crosswd_),0) to Here+(crosswd_,0) +define(`cross',`define(`crosswd_',`ifelse(`$2',,`(0.05*scale)',(`$2')/2)')dnl + [{line from Here+(0,neg_(crosswd_)) to Here+(0,crosswd_)} + line from Here+(neg_(crosswd_),0) to Here+(crosswd_,0) `$3'] with .c ifelse(`$1',,`at Here',`$1'); move to last [].c') `boxcoord(name,xfraction,yfraction) @@ -936,7 +961,7 @@ define(`shadebox',`ifelse(`$1',,box,`$1') shadowed(box shaded "yellow" rad 0.1 "Text", shadowthick=3bp__;shadowcolor="lightgray")' define(`shadowed',`define(`m4object',`ifelse(`$1',,box,`$1')')dnl - setkeys_(`$3',attrib::N; rad:; + pushkeys_(`$3',attrib::N; rad:; shadowthick:lthick*5/4; shadowcolor:"gray":N; shadowangle:-45 )dnl ifelse(m4object,box,`box m4attrib ifelse(m4rad,,,`rad m4rad invis') `$2' if last box.thick < 0 then { m4shv = (m4shadowthick+lthick)/2 } \ @@ -954,7 +979,8 @@ define(`shadowed',`define(`m4object',`ifelse(`$1',,box,`$1')')dnl else { m4shv=(m4shadowthick+last m4object.thick bp__)/2 } { m4object m4attrib thick m4shadowthick/(1bp__) outlined m4shadowcolor \ solid at M4C+(Rect_(m4shv,m4shadowangle)) } - m4object ifelse(m4object,line,,fill_(1)) m4attrib at M4C ') ') + m4object ifelse(m4object,line,,fill_(1)) m4attrib at M4C ')dnl + popdef(`m4attrib',`m4rad',`m4shadowthick',`m4shadowcolor',`m4shadowangle') ') `hatchbox(boxspec,hashsep,hatchspec,ang)' `manhattan box with hatching at ang degrees' @@ -966,7 +992,7 @@ define(`hatchbox',`[ a = pmod((ifelse(`$4',,45,`$4')+90),180)-90 ca = cosd(a); sa = sind(a) if abs(a) < 0.1 then { for y = ds to B.ht by ds do { line from B.nw-(0,y) to B.ne-(0,y) } } \ - else { if abs(a-90) < 0.1 then { for x = ds to B.wid by ds do { + else { if abs(abs(a)-90) < 0.1 then { for x = ds to B.wid by ds do { line from B.nw+(x,0) to B.sw+(x,0) } } \ else { d = min(B.wid,B.ht)/5 if a>=0 then { T: B.nw @@ -1028,9 +1054,9 @@ define(`rotbox',`[ S: vec_(0,-m4bh2) E: vec_( m4bw2,0) W: vec_(-m4bw2,0) - ifinstr(`$4',`r=', - `setkey_(`$4',r,0)dnl - brad = Min(m4r,m4bh2,m4bw2) + ifinstr(`$4',r=, + `pushkey_(`$4',r,0)dnl + brad = Min(m4r,m4bh2,m4bw2) popdef(`m4r') sectors = 9 C[0]: (m4bw2-brad,m4bh2-brad) C[1]: (-m4bw2+brad,m4bh2-brad) @@ -1042,21 +1068,20 @@ define(`rotbox',`[ fitpoints(P,sectors,0,Pf,j*(sectors+1)) } spline ctension_ `$3' from Pf[0] to Pf[1] for i=2 to 4*(sectors+1)-1 do { continue to Pf[i] } - continue to Pf[0] -', - `$4',`t=', - `setkey_(`$4',t,0)dnl + continue to Pf[0] ', + `$4',t=, + `pushkey_(`$4',t,0)dnl spline ifdpic(m4t) from E to vec_(m4bw2,m4bh2) \ then to vec_(-m4bw2,m4bh2) \ then to ifgpic(W `$3'; spline to) vec_(-m4bw2,-m4bh2) \ then to vec_( m4bw2,-m4bh2) \ - then to E `$3' ', - `NE: vec_( m4bw2,m4bh2) + then to E `$3' popdef(`m4t') ', + `NE: vec_( m4bw2, m4bh2) SE: vec_( m4bw2,-m4bh2) - NW: vec_(-m4bw2,m4bh2) + NW: vec_(-m4bw2, m4bh2) SW: vec_(-m4bw2,-m4bh2) - 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' ]') + Line: line from E to NE then to NW then to SW then to SE then to E `$3' ') + popdef(`m4bw2',`m4bh2') `$5' ]') `rotellipse(wid,ht,type) ellipse oriented in current direction and @@ -1253,7 +1278,7 @@ define ShadedPline { with .Origin at Origin Midpt: 0.5 between V[1] and V[nverts] line `$2' \ - from Midpt to for_(1,m4vx,1,`V[m4x] then to\') Midpt + from Midpt to for_(1,m4vx,1,`V[m4x] then to \') Midpt Start: V[p0]; End: V[pm] ]') define(`m4shadedpverts',` @@ -1352,7 +1377,7 @@ m4postprocessor,svg, shaft= attributes (dashed etc) head= attributes (shaded etc)' define(`sarrow',`arrow invis `$1' ; M4_E: Here - setkeys_(`$2',type:O:N;head::N;shaft::N;wdth:arrowwid;lgth:arrowht) + pushkeys_(`$2',type:O:N;head::N;shaft::N;wdth:arrowwid;lgth:arrowht) line from last arrow.start to last arrow.end chop 0 chop m4lgth m4shaft M4_X: Here; M4_P: Vperp(M4_E,M4_X,m4wdth/2) ifinstr(m4type,O, @@ -1371,6 +1396,7 @@ define(`sarrow',`arrow invis `$1' ; M4_E: Here then to M4_E-M4_P', `spline from M4_E+(M4_P.x,M4_P.y) to M4_X+(M4_P.x,M4_P.y) \ then to M4_X-(M4_P.x,M4_P.y) then to M4_E-(M4_P.x,M4_P.y)') m4head') + popdef(`m4type',`m4head',`m4shaft',`m4wdth',`m4lgth')dnl move to M4_E') `open_arrow(linespec, ht, wid, head attribs) @@ -1535,8 +1561,8 @@ define(`langle', 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') - ifelse(`$6',,,`move to `$2'+ (rect_(ifelse(`$4',,arcrad,`$4')+textoffset, + langle(`$2',`$1'),langle(`$2',`$3'),`$5') dnl + 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) @@ -1836,10 +1862,9 @@ ifsvg( `define(`m4c_l',)') Adjust fill value if gpic is used -define(`fill_',`dnl - fill ifgpic(`1-(')ifelse(`$1',,fillval,`$1') ifgpic(`)')') +define(`fill_',`fill ifgpic(`1-(')ifelse(`$1',,fillval,`$1') ifgpic(`)')') -define(`m4dir',right) +define(`m4_dir_',right) define(`m4_k',0) Define m4x_ etc for horiz and vert lines diff --git a/Master/texmf-dist/doc/latex/circuit-macros/liblog.m4 b/Master/texmf-dist/doc/latex/circuit-macros/liblog.m4 index 8f6dad87146..3e0397b73ac 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/liblog.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/liblog.m4 @@ -1,7 +1,7 @@ divert(-1) liblog.m4 Logic gates -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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 * @@ -76,8 +76,8 @@ define(`NOT_circle',`circle diam N_diam*L_unit') `LH_symbol([U|D|L|R|degrees][I]) I=inverted logical hysteresis symbol' -define(`LH_symbol',`[ define(`m4LH',`$1') dnl - sc_draw(`m4LH',I,`define(`m4Hs',-H_ht)',`define(`m4Hs',H_ht)')setdir_(m4LH,R) +define(`LH_symbol',`[ define(`m4LH',patsubst(`$1',I))dnl + define(`m4Hs',ifinstr(`$1',I,-)H_ht)setdir_(m4LH,R)dnl line to svec_(H_ht,0) \ then to svec_(1.1*H_ht,m4Hs) line from rsvec_(0.4*H_ht,0) \ @@ -678,7 +678,7 @@ define(`autovsep',`L_unit') # vertical separation between input gates Draw the gate with input sublayer Sg containing gates G1, G2, ... define(`AutoGate',`[ pushdef(`m4nargs',0)dnl - lu = L_unit define(`m4dirt',m4dir) + lu = L_unit define(`m4dirt',m4_dir_) dnl Count the arguments (inputs) (could use $# ) Loopover_(`arg',`define(`m4nargs',incr(m4nargs))',shift($@))dnl `#' m4Delch(`$1') gate(m4nargs) @@ -745,28 +745,28 @@ define(`m4stackdump',`ifdef(`$1',`ifelse($1,,`popdef(`$1')', define(`DrawIn',` # Draw and label input $1 PrevInput: PrevInput-ifdef(`m4LI',`(0,autoinputsep)', - `(ifelse(m4dir,left,-)autoinputsep,0)') - In`'$1: PrevInput define(`m4dirt',m4dir) + `(ifelse(m4_dir_,left,-)autoinputsep,0)') + In`'$1: PrevInput define(`m4dirt',m4_dir_) ifinstr(`$2',N, -` line thick lineth from PrevInput ifdef(`m4LI',m4dir`'_,down_) dimen_/2 +` line thick lineth from PrevInput ifdef(`m4LI',m4_dir_`'_,down_) dimen_/2 linethick = gatelineth NOT_gate linethick = lineth InNt`'$1: Here', - `line thick lineth from PrevInput ifdef(`m4LI',m4dir,down) dimen_/4 + `line thick lineth from PrevInput ifdef(`m4LI',m4_dir_,down) dimen_/4 Int`'$1: Here') m4xpand(m4dirt`'_) ') define(`DrawInNotIn',` # Draw and label input $1 inverted and uninverted. PrevInput: PrevInput-ifdef(`m4LI',`(0,autoinputsep)', - `(ifelse(m4dir,left,-)autoinputsep*2,0)') - In`'$1: PrevInput define(`m4dirt',m4dir) - line thick lineth from PrevInput ifdef(`m4LI',m4dir,down) dimen_/4 + `(ifelse(m4_dir_,left,-)autoinputsep*2,0)') + In`'$1: PrevInput define(`m4dirt',m4_dir_) + line thick lineth from PrevInput ifdef(`m4LI',m4_dir_,down) dimen_/4 ifdef(`m4LI',`PrevInput: PrevInput-(0,autoinputsep)') Int`'$1: dot - line thick lineth ifdef(`m4LI',down,m4dir) autoinputsep \ - then ifdef(`m4LI',m4dir`'_,down_) dimen_/4 + line thick lineth ifdef(`m4LI',down,m4_dir_) autoinputsep \ + then ifdef(`m4LI',m4_dir_`'_,down_) dimen_/4 linethick = gatelineth NOT_gate linethick = lineth @@ -915,7 +915,7 @@ dnl dnl Optional reverse of bare name order ifinstr(`$2',R,`stackreverse_(`m4f')') dnl Get the offset=value if any - setkey_($2,offset,0)dnl + pushkey_($2,offset,0)dnl dnl Place reference for row or column of inputs PrevInput: ifdef(`m4LI',dnl `ifinstr(`$2',M, @@ -926,7 +926,7 @@ PrevInput: ifdef(`m4LI',dnl `ifinstr(`$2',M, `Fx.ne+(-(autoinputsep/2+dimen_/4+m4offset),dimen_`'ifdef(`m4N_',,/4))', `Fx.nw+( autoinputsep/2+dimen_/4+m4offset, dimen_`'ifdef(`m4N_',,/4))')') -dnl + popdef(`m4offset') dnl # Draw inputs right to left or top to bottom stackexec_(`m4f',`m4r',`ifinstr(`$2',N,,`ifdef(X_`'m4f, `ifdef(N_`'m4f,`DrawInNotIn(m4f)',`DrawIn(m4f)')',`DrawIn(m4f,N)')')') diff --git a/Master/texmf-dist/doc/latex/circuit-macros/mfpic.m4 b/Master/texmf-dist/doc/latex/circuit-macros/mfpic.m4 index 28f22ccfea5..7776a7fdcef 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/mfpic.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/mfpic.m4 @@ -1,7 +1,7 @@ divert(-1) mfpic.m4 Initialization for mfpic. -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/mpost.m4 b/Master/texmf-dist/doc/latex/circuit-macros/mpost.m4 index 3cd7821d4e6..843b1b0b955 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/mpost.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/mpost.m4 @@ -1,7 +1,7 @@ divert(-1) mpost.m4 Initialization for metapost. -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/pgf.m4 b/Master/texmf-dist/doc/latex/circuit-macros/pgf.m4 index 2d2db809724..e794a15e3e3 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/pgf.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/pgf.m4 @@ -1,7 +1,7 @@ divert(-1) pgf.m4 Initialization for Tikz-pgf. -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/postscript.m4 b/Master/texmf-dist/doc/latex/circuit-macros/postscript.m4 index d1fddeb9fad..606cc96258a 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/postscript.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/postscript.m4 @@ -1,7 +1,7 @@ divert(-1) postscript.m4 Initialization for Postscript output. -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/psfrag.m4 b/Master/texmf-dist/doc/latex/circuit-macros/psfrag.m4 index 0e387434311..5af564a3166 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/psfrag.m4 +++ b/Master/texmf-dist/doc/latex/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.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/pstricks.m4 b/Master/texmf-dist/doc/latex/circuit-macros/pstricks.m4 index b3c0631b3a6..728194721ca 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/pstricks.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/pstricks.m4 @@ -1,7 +1,7 @@ divert(-1) pstricks.m4 Initialization for PSTricks. -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/svg.m4 b/Master/texmf-dist/doc/latex/circuit-macros/svg.m4 index ad0f6540d4e..dfa968891fe 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/svg.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/svg.m4 @@ -1,7 +1,7 @@ divert(-1) svg.m4 Initialization for SVG output. -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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/Master/texmf-dist/doc/latex/circuit-macros/xfig.m4 b/Master/texmf-dist/doc/latex/circuit-macros/xfig.m4 index 8d3d24ed738..04c998eb3cf 100644 --- a/Master/texmf-dist/doc/latex/circuit-macros/xfig.m4 +++ b/Master/texmf-dist/doc/latex/circuit-macros/xfig.m4 @@ -1,7 +1,7 @@ divert(-1) xfig.m4 Initialization for xfig. -* Circuit_macros Version 9.7, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.8, copyright (c) 2022 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 * -- cgit v1.2.3