summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-09-05 22:33:48 +0000
committerKarl Berry <karl@freefriends.org>2019-09-05 22:33:48 +0000
commite25c6ee4ea5169bf31ab28ebddcc94c8b4992453 (patch)
tree855a21705c8e75ed71066d3e6215752d04dd43ba /Master
parent1047c66359c02d8f8852e0dbdd69f5cf1cd1a76b (diff)
circuit-macros (all except boxdims.sty in doc due to generic file names)
git-svn-id: svn://tug.org/texlive/trunk@52035 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/CHANGES181
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/Copying6
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/Makefile50
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/README415
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/darrow.m4304
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/AmpTable.m422
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Antennas.m440
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Audio.m494
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Axes.m45
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/BigResistor.m420
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Bip.m460
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Buffer.m450
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Capture.JPGbin0 -> 25460 bytes
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/CctTable.m490
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.bib155
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.pdfbin0 -> 909464 bytes
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.tex88
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Composite.m458
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigA.m438
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigB.m442
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigC.m443
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Conn.m469
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Corners.m473
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Dac.m469
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Darlington.m436
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Demultiplexer.m444
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Diodes.m448
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Emarrows.m430
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/FF.m411
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/FlipFlop.m432
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Flowdiag.m433
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Fuses.m432
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Grounds.m439
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Headers.m437
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/HybridPi.m454
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Jack.m478
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Logic.m462
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Loop.m410
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Makefile142
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Multiplexer.m443
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/NLG.m419
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/NPDT.m435
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Nport.m443
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Oblique.m425
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Opamp.m445
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Opto.m429
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/ParSeries.m456
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Pconn.m450
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Potentiometers.m427
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Relay.m484
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Series.m424
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/ShiftR.m449
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Sinus.m418
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Sources.m456
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Switches.m499
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Taps.m443
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Tgate.m450
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Thermal.m48
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Tline.m423
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Ttree.m456
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Variable.m428
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Version.tex1
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Windings.m4113
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Workflow.m494
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/Xform.m439
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/bi_trans.m465
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/bistable.m435
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/bitr.m45
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/bitrbody.m44
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/body.tex3342
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/currents.m452
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/defines.tex1892
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/eboxdims.m414
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/fbfilter.m439
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/fet.m4170
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/lrarrows.m416
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/md.tex59
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/mplex.m449
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/oax.m45
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/oaxbody.m44
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/quick.m416
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/stringdims.m410
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/test.tex1
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/thyristor.m4118
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/tran.m45
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/tran.tex76
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/tranbody.m46
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/ujt.m428
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/doc/woodchips.m424
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic385
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ABlogix.m451
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Adder.m475
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Alogix.m4115
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Autologix.m457
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Ball.m4140
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Blogix.m487
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Btree.m432
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Buttons.m4114
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Byte.m440
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/CSlight.m4173
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/CanLogic.m4158
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Ccurve.m413
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Chuck.m4263
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Counting.m426
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Crossbar.m453
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Crow.m473
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Cruller.m467
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Csource.m4170
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Decoder.m424
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Drive.m474
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Escher.m477
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Euro.m4138
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Floor.m425
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Flow.m4108
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/FlowchartDefs.m4128
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/GnuMakefile119
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Heathkit.m4353
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/I2L.m477
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/IC10107.m448
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.eps.bb1
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.eps.gzbin0 -> 45323 bytes
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.pdf553
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Incleps.m421
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Inclpdf.m422
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Koch.m432
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Loglog.m485
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/MC.m435
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Makefile269
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Mixer.m4102
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/MosfetElements.m478
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/MotorControl.m457
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/OpAmpFilter.m472
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Optoiso.m463
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Orbits.m474
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/PPA.m440
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/PushPull.m4107
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Quantum.m431
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/README-examples58
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Rectifiers.m4186
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Resolver.m449
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Rotbox.m417
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/SPM.m459
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/SQUID.m422
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Schottky.m451
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Shaky.m4141
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Sierpinski.m427
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Sixpole.m425
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/TTLnand.m450
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Three.m444
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Timer.m452
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Ttree.m456
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/Wheat.m420
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/XOR.m466
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/birds.m434
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/bistable.m435
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/brace.m480
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/chaos.m439
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/clock.m420
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/control.m4142
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/csc.m476
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/darrows.m461
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/debug1.tex15
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/debug2.m448
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/diamond.m438
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex00.m491
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex01.m421
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex02.m454
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex03.m430
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex04.m459
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex05.m465
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex06.m467
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex07.m469
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex08.m481
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex09.m4135
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex10.m456
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex11.m474
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex12.m4133
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex15.m440
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex16.m467
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex17.m443
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex18.m437
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ex21.m464
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/examples.pdfbin0 -> 1068937 bytes
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/examples.tex34
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/exp.m4258
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/files.tex668
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/graysurf.m4189
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/header.tex54
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/ics.m484
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/keyval.m474
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/lcct.m4193
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/mf/Makefile55
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/mf/cct.mf5732
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/mf/cct.tfmbin0 -> 776 bytes
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/mf/font.m4424
-rwxr-xr-xMaster/texmf-dist/doc/latex/circuit-macros/examples/mf/mftest43
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/mode.tex1
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/Makefile133
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/README-mpost13
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/examplesmpost.tex21
-rwxr-xr-xMaster/texmf-dist/doc/latex/circuit-macros/examples/mpost/mptest27
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/tstmpost.tex18
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/person.m443
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/Makefile160
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/README-pgf9
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/examplespgf.tex28
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/tstpgf.tex9
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/Makefile147
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/README-psfrag.txt7
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/examplespsfrag.tex30
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/tstpsfrag.tex14
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/pwrsupply.m475
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/random.m4101
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/recycle.m4128
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/rose.m4130
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/rotate.tex9
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/rotatetext.m450
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/rotellipse.m420
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/sfg.m493
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/shapes.m4202
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/snake.m421
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/squiggle.m425
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ABlogixSVG.m453
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AdderSVG.m476
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AlogixSVG.m4116
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AmpTableSVG.m425
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AntennasSVG.m440
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AudioSVG.m493
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.m459
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.txt54
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BipSVG.m468
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BtreeSVG.m433
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ButtonsSVG.m4115
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ByteSVG.m438
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CanLogicSVG.m4159
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m479
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ConnSVG.m467
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CountingSVG.m432
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrossbarSVG.m454
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrowSVG.m474
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrullerSVG.m467
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CsourceSVG.m4197
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DecoderSVG.m425
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DemultiplexerSVG.m437
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m450
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DriveSVG.m474
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EmarrowsSVG.m431
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4254
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FontsSVG.m428
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FusesSVG.m433
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GroundsSVG.m440
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeadersSVG.m438
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeathkitSVG.m4343
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/I2LSVG.m478
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Incl.jpgbin0 -> 21384 bytes
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/InclepsSVG.m490
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/JackSVG.m475
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LgateSVG.m4153
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LogicSVG.m459
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m481
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MCSVG.m444
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile91
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MixerSVG.m498
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MotorControlSVG.m458
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MultiplexerSVG.m443
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NLGSVG.m421
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NPDTSVG.m441
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Np.m420
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NportSVG.m447
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OpampSVG.m435
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OptoisoSVG.m464
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PconnSVG.m451
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PushPullSVG.m4108
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/QuantumSVG.m431
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RectifiersSVG.m4189
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RelaySVG.m480
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RotboxSVG.m420
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SQUIDSVG.m419
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SVGconfig.m470
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SchottkySVG.m454
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ShiftRSVG.m451
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SierpinskiSVG.m426
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SixpoleSVG.m425
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SourcesSVG.m447
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4103
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TTLnandSVG.m455
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TgateSVG.m453
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ThreeSVG.m447
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TimerSVG.m451
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TtreeSVG.m470
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/VariableSVG.m436
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/WindingsSVG.m4102
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XORSVG.m467
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XformSVG.m441
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m497
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m479
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/diamondSVG.m434
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex00SVG.m494
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex01SVG.m428
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex02SVG.m451
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex03SVG.m437
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex04SVG.m461
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex05SVG.m469
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex06SVG.m464
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex08SVG.m483
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex09SVG.m4129
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex10SVG.m462
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex11SVG.m475
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex12SVG.m4136
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex15SVG.m440
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex16SVG.m470
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex17SVG.m444
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex18SVG.m440
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex21SVG.m471
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx358
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4303
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/fetSVG.m4152
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/graysurfSVG.m4190
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4122
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/lcctSVG.m4195
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/local_init.m42
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/paletteSVG.m4340
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/pwrsupplySVG.m442
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m420
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/randomSVG.m498
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/recycleSVG.m4128
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/roseSVG.m4131
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sfgSVG.m4102
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/shapesSVG.m4202
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/thyristorSVG.m4119
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/tstSVG.htmx212
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ujtSVG.m431
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/wormSVG.m4123
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/svg/xx.html11
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/test.m416
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/testpdf.tex15
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/tikz.tex15
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/tst.tex21
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/tst1.tex12
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/windows.m48
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/worm.m499
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/Makefile24
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.fig755
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.m4161
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/gpic.m426
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/lib3D.m4237
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/libcct.m43254
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/libgen.m41680
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/liblog.m41053
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/mfpic.m426
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/mpost.m443
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/pgf.m444
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/postscript.m474
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/psfrag.m415
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/pstricks.m447
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/svg.m4169
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/xfig.m424
-rw-r--r--Master/texmf-dist/tex/latex/circuit-macros/boxdims.sty33
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds6
-rw-r--r--Master/tlpkg/tlpsrc/circuit-macros.tlpsrc0
-rw-r--r--Master/tlpkg/tlpsrc/collection-pictures.tlpsrc1
362 files changed, 43823 insertions, 4 deletions
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/CHANGES b/Master/texmf-dist/doc/latex/circuit-macros/CHANGES
new file mode 100644
index 00000000000..a7aec66e54f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/CHANGES
@@ -0,0 +1,181 @@
+CHANGES
+ (The stable CTAN version will be nn.n; intermediate versions nn.n.n):
+
+Version 9.0: Tweaked svg_sub, svg_sup, lamp. New macros cm__, px__.
+ New option for source. Obsolete Autologic and stackpromote_ removed.
+Version 8.9: Tweaked lswitch, contact, rotbox, parallel_, darrow.
+ Uniform open-arrowhead option for diode, thyristor. New macros reed, lamp.
+Version 8.8: Tweaks for source macro. Change to svg.m4 for
+ compatibility with dpic Version 2018.05.15 or later. Macros for
+ embedding pic diagrams into Tikz pictures. Changed the name of the
+ manual from CMman.pdf to Circuit_macros.pdf. Option for dswitch.
+Version 8.7: Fixes for more robust nested macros and SVG color. Options for
+ the source macro.
+Version 8.6: Options for switch, lswitch. Simplified Quick Start section
+ of the manual. Added WARNING to m4 output for default configuration
+ file gpic.m4. Macro pconnex tweaked for tikz.
+Version 8.5: SVG macro tweaks for generality. Options for Mux, Demux,
+ hatchbox. Fixed arcr, vperp, fitcurve, setdir_ rs_box. New macros
+ LEintersect, LEtangent, sqrta, arcdimension_.
+Version 8.4: Tweaked Autologix inputs. Options for NOT_gate, LH_symbol,
+ arcr, arcd. New macros tbox, thermocouple. Fixed a problem setting
+ defaults using the top-level Makefile on some systems.
+Version 8.3: A simpler CTAN distribution and several examples reworked for
+ use with multiple postprocessors. New macros NeedDpicTools, iflatex,
+ latexcommand, ifpsfrag, hlth, Mitre_. Tweaked potentiometer, pconnex,
+ corner, svg text. Option for mosfet.
+Version 8.2: Tweaks to round, bi_tr, bi_trans, Darlington, along_. New
+ Along_, lin_ang, mitre_.
+Version 8.1: Additions to dpictools.pic. New macros parallel_, rgbstring,
+ series_, stackdo_, Vsprod, sbs, scs, sus. Options for diode.
+ Thyristor options and minor changes of functionality. Bugfix in winding macro.
+Version 8.0: New options for capacitor, cbreaker, diode, inductor, lswitch, Mux,
+ resistor, rotbox, transformer. New macros addtaps, binary_, Demux, Header,
+ HeaderPin, hex_digit, hexadecimal_, Pr_xy, Pr_xz, Pr_yz, SQUID, KelvinR,
+ FTcap, tconn, and tapped.
+ Tweaked setrgb for svg output. Generalized setview in lib3D.
+Version 7.9: Added accessibility features to the documentation.
+ Replaced Autologic with Autologix to allow multiple outputs and
+ simplified expressions. New macros savem4dir, restorem4dir. Options for
+ vperp and Vperp. Bug fix in source macro. Tweaked stacksplit_. Removed
+ a name clash between libcct and liblog.
+Version 7.8: Logic gate options for arbitrary negated inputs; lg_pin options.
+ New macro FlipFlopX for simplicity and generality; new macros Cintersect,
+ LCintersect, LCtangent, stacksplit_; modified Loopover_.
+Version 7.7: SVG macro tweaks. Tweaked BOX_gate and bugfix in IOdefs in
+ liblog.m4.
+Version 7.6: New macro NPDT; new option for contact and relay; Autologic
+ tweaks. Changed the Point_ simplification to require specific activation
+ because of rare interaction with dpic loops.
+Version 7.5: Usage has been simplified by making the initialization macros
+ cct_init, gen_init, log_init, darrow_init, and threeD_init read the
+ appropriate libraries automatically. New macros: jack, plug, tstrip,
+ ccoax, pconnex, basename_, Autologic and associated wrappers for
+ automatic Boolean functions, stack macros stackexec_, stackcopy_,
+ stackprint_, stackreverse_. Simplified setting of drawing direction
+ in composite macros. Bugfix in calls to BUFFER_gen. Tweaked Point_
+ for simpler output for common arguments. Reordered the arguments of
+ round for consistency.
+Version 7.4: New macro lthick. Simplified shadebox. The ifroff macro renamed
+ to iftpic. New configuration file m4defaults.m4. Reworked darrow library
+ for consistency with solid lines and arrows; new macro darc and wrappers
+ Darc, Darrow, Dline; old version included in olddarrow.m4 to ease transition.
+ Macros and examples fixed and made more robust for gpic (where possible).
+Version 7.3: Options for sinusoid. Bug fix for switch(,,D). Heater macro.
+ Modified Loopover_
+Version 7.2: Tweaked crossover macro. Size options for inductor, resistor,
+ capacitor; dlabel alignment options; new options for source, capacitor.
+Version 7.1: Eliminated the HOMELIB_ macro for easier package installation
+ and use (requires m4 -I <path> or the M4PATH environment variable).
+Version 7.0: New options and wrapper macro scr for thyristor. Generalized
+ ifinstr. Macros corner, round, resized. Options for mosfet. Tweaked
+ b_current and color macros. Simplified \psbezier workaround assuming
+ recent PSTricks.
+Version 6.9: New workaround for \psbezier. Fixed round_. Default
+ postprocessor reset to gpic. Style parameters for em_arrows. Tweaks to
+ winding, dimension_, fitcurve, distance. New macro rot_.
+Version 6.8: New configuration file svg.m4 and other changes to support
+ dpic svg output. Inkscape-aware changes. Opamp option. New macros
+ ptrans and tgate. Tweaks to switch macros, color, variable, centerline,
+ intersect_, inductor(,W), inductor(,L).
+Version 6.7: Fixed source(,S) and ttmotor to work correctly with labels.
+ Simplified several 2-terminal macros by using the reversed macro.
+Version 6.6: New macros memristor, centerline. Revised PSTricks patch.
+ Options in mosfet, capacitor. Opamp .C defined. Tweaks to avoid
+ potential name conflicts. Fix for dashline.
+Version 6.5: New macros Loopover_, m4xpand, showbox_, gyrator, norator,
+ nullator, nterm, rotellipse, rotbox. Logic gate examples.
+ Customization arguments for non-2-terminal elements. Signal
+ flow-graph macros tuned to allow large nodes; bug fix in sfgarc. A
+ patch for PSTricks to work around the context dependency of \psbezier
+ within \pscustom.
+Version 6.4: New macros Equidist3, f_box, rs_box, Darlington, View3D.
+ Options for diode, inductor, transformer, consource. Moved arrowhead
+ initialization in pstricks.m4 and libcct.m4 for for more flexibility
+ with diagrams embedded in latex files.
+Version 6.3: New options for mosfet, diode, earphone. Better color support.
+ Fixed system-dependent OR_gate problems. New macro cintersect.
+Version 6.2: Replaced scr with a variant of thyristor. Bug fix in
+ bi_trans. Options for source.
+Version 6.1: New macros ttmotor, thyristor. Options for source, bi_trans,
+ transformer. More robust arcd, arcr.
+Version 6.0: TikZ PGF compatibility. Added transformer labels, optional
+ FlipFlop labels. New macros dswitch, winding. Tweaked nport, source,
+ bi_trans, AND_gen, OR_gen, sinusoid, resistor.
+Version 5.9: Simplified internal flags for pic processor and postprocessor.
+ New antenna, cbreaker, dturn, and lbox macros. Several changes to
+ allow sprintf string arguments. New options for buzzer, capacitor,
+ dimension_, ebox, fuse, mosfet, source, and switch. Fix of drjust.
+ Better compatibility with pic macros. Numerous changes to documentation.
+Version 5.8: Simplified installation. Revised and augmented logic-gate library.
+ Cleaner libgen macro output. Improved b_current, bi_trans, ground, dtee.
+ Dline and darrow corrected for gpic. New macros dashline, m4xtract.
+Version 5.7: Psfrag examples. Improved dline. Added option and label in
+ igbt. Bug fix in tr_xy. Multiple-emitter option in bi_trans.
+Version 5.6: Better MetaPost, PDFLaTeX, and xfig support. PDF examples.
+ Reworked diode for easier customization and more options. Improved
+ shade, sfgline, dline, darrow, gap, point_, Point_, opamp, bi_trans,
+ variable, em_arrows, larrow, rarrow, FlipFlop6. New speaker, bell,
+ microphone, buzzer. Negated logic gate inputs and IEEE box logic gates.
+Version 5.5: New macros potentiometer, variable, igbt, tline. Optional
+ negated logic gate inputs. Options for diode, source.
+Version 5.4: New Mux, for_, arca. Reworked gate macros FlipFlop, AND_gate,
+ OR_gate, NOT_gate. Improved lg_pintxt, boxdim, s_box, s_ht, s_wd,
+ s_dp, nport, resistor, opamp. Completely reworked bi_tr, mosfet;
+ deleted smosfet. Minor additions and changes to the manual.
+Version 5.3: New macros arcr, arcd, beginshade, endshade, larrow, rarrow,
+ s_sp, s_ht, s_wd, Max, Min, sfgself. Improved ground, sfgnode, diode,
+ resistor.
+Version 5.2: New macros arrowline, nport, vlength, boxcoord, reversed.
+ Improved s_box, sfg_init, cross, fitcurve, sinusoid, transformer, darrow,
+ mosfet, psset_, battery, diode, capacitor.
+Version 5.1: Signal-flow graph (directed graph) macros. More consistent
+ rot3Dz. Work-around for a bug in some pic processors invoked by the
+ battery macro and for an arc instability invoked by the fuse macro.
+ Modified ground, dimension_, par_, label macros, b_current, diode,
+ transformer. New macros gpar_, ujt, scr, contact, relay.
+ Document fixes and additions. Changes to examples for portability.
+Version 5.0: Macros fuse, lpop, sinc; dpic-only sinusoid and fitcurve macros.
+ More robust mosfet, smosfet, b_current, bi_tr, j_fet, intersect_.
+ Editorial changes to the manual. Examples in Xfig version 3.2 format.
+ Web-based examples and updated links.
+Version 4.9: More robust NOT_gate. Function pmod(), macro shade(). Tweaks
+ to diode, dend, crossover. Newer manual and web references. Binary
+ tree and flowchart macros.
+Version 4.8: More robust ebox, source, shadebox, gap. Modified d_fet and
+ e_fet. Macros mosfet and smosfet. More examples in the manual. Bug
+ fixes in Fector, transformer, BUFFER_gate and in sum_, abs_, neg_, sign_ (!).
+Version 4.7: Fixed the excess-space bug in boxdims.sty. Added Macros s_box,
+ s_init, scale changes to make the package more metric-friendly. Reworked
+ amp, integrator, opamp, diode, battery and a few other macros for robustness
+ and clarity. Minor document changes.
+Version 4.6: Percent-signs at the end of pstricks-generated lines.
+ Index in the manual. New copyright notices.
+Version 4.5: Options for several 2-terminal macros. Minor bug fixes and
+ better robustness. Documents edited for friendlier PC installation and use.
+Version 4.3: Macros pt__ and boxdim. Additions to the manual. More robust
+ dimension_, tuned FlipFlop for xfig. PC installation information.
+Version 4.2: Friendlier manual. New Xfig prototype file to allow correct
+ scaling. Cleaned up b_current, added line_leng. Changes and additions
+ to logic gates.
+Version 4.1: Xfig prototype file included. Minor document changes. Fixed
+ recursive call bug and blank line bug. Changed argument for dend
+ macro. Better arrowheads in circuit elements.
+Version 4: Simplified library use. Added capabilities and flexibility to
+ several devices, added _init macros, modified b_current. Updated
+ font.m4, cosmetic changes to inductor. Made gamp, amp, opamp,
+ integrator more robust. Deleted edel_ macro. Fixed elen_ bug in
+ darrow.m4. Removed Capacitor, Inductor and others in favour of
+ parameterized macros. Iron-core inductors. Re-worked use of arcs in
+ basic elements for better robustness. Edited examples document and
+ the manual.
+Version 3: Document changes, minor changes to dimension_, switch,
+ ground, battery. Added flexibility for several elements. New
+ diodes, Capacitor, transistors, hop, transformer. Experimental
+ Metafont version of basic elements.
+Version 2.2: Replaced definitions of two-terminal elements
+ with current arrow by an arrow-labelling macro.
+Version 2.1: one or two examples simplified, and logic gates added.
+Version 2: considerable added flexibility and robustness,
+ bug fixes, a few new constructs, a manual, and a complex logic-gate
+ example.
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/Copying b/Master/texmf-dist/doc/latex/circuit-macros/Copying
new file mode 100644
index 00000000000..0eec8c2ed3b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/Copying
@@ -0,0 +1,6 @@
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/Makefile
new file mode 100644
index 00000000000..d1881d44874
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/Makefile
@@ -0,0 +1,50 @@
+# The default postprocessor can be changed automatically as described below.
+# This default can be overridden by reading the appropriate configuration file
+# as the first file read by m4.
+
+# Some of the steps could be simplified on many systems.
+
+default:
+ @echo "Usage:"
+ @echo " make psdefault"
+ @echo " make pgfdefault"
+ @echo " make gpicdefault"
+ @echo " make clean"
+ @echo " make clobber"
+
+SH = sh
+# SH = bash
+
+# To set the default postprocessor to
+# dpic -p with pstricks, type "make psdefault"
+psdefault:
+ @sed -e '/m4picprocessor/s/include([a-z][a-z]*\.m4)/include(pstricks.m4)/' \
+ libgen.m4 > tmplibgen
+ mv tmplibgen libgen.m4; chmod 644 libgen.m4
+ @grep 'include.*divert' libgen.m4
+
+# To set the default postprocessor to
+# dpic -g with TikZ PGF, type "make pgfdefault"
+pgfdefault:
+ @sed -e '/m4picprocessor/s/include([a-z][a-z]*\.m4)/include(pgf.m4)/' \
+ libgen.m4 > tmplibgen
+ mv tmplibgen libgen.m4; chmod 644 libgen.m4
+ @grep 'include.*divert' libgen.m4
+
+# To set the default postprocessor to
+# gpic -t type "make gpicdefault"
+gpicdefault:
+ @sed -e '/m4picprocessor/s/include([a-z][a-z]*\.m4)/include(gpic.m4)/' \
+ libgen.m4 > tmplibgen
+ mv tmplibgen libgen.m4; chmod 644 libgen.m4
+ @grep 'include.*divert' libgen.m4
+
+clean:
+ rm -f `find . -name \*~ -print` tmplibgen
+ (cd doc; make clean)
+ (cd examples; make clean)
+
+clobber:
+ rm -f `find . -name \*~ -print`
+ (cd doc; make clobber)
+ (cd examples; make clobber)
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/README b/Master/texmf-dist/doc/latex/circuit-macros/README
new file mode 100644
index 00000000000..c20ea3d4a3c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/README
@@ -0,0 +1,415 @@
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+ This is a set of macros for drawing high-quality line diagrams to
+ include in LaTeX, web, or similar documents, with support for SVG
+ (including Inkscape) and other formats. Fundamental electric circuit
+ elements and basic logic gates based on IEEE and European standards are
+ included with several tools and examples of other types of diagrams.
+ Elements can be scaled or drawn in any orientation and are easy
+ to modify. The advantages and disadvantages of such a system in its
+ basic form are similar to those of TeX itself, which is macro-based and
+ non-WYSIWYG; however, graphical interfaces are available for specific
+ operating systems as mentioned below.
+
+ The macros are to be processed by an m4 macro processor, and evaluate to
+ drawing commands in the pic "little language," which is easy to read and
+ learn. The diagram is then automatically translated into TiKZ, PSTricks,
+ or other formats for processing by LaTeX or other applications. Pic
+ is well suited to line drawings requiring parametric or conditional
+ components, fine adjustment, geometric calculations, repetition, or
+ recursion. Arbitrary text for formatting by LaTeX can be included.
+ Free interpreters for m4 and pic are readily available.
+
+REQUIRED SOFTWARE:
+Preferred setup:
+ GNU m4, dpic (see below), LaTeX, PSTricks, dvips
+ or
+ m4, dpic, LaTeX or PDFLaTeX, TikZ-PGF
+
+ 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.
+
+ The dpic interpreter can translate pic input into several forms,
+ typically a .tex file for processing by latex with pgf/Tikz or PSTicks.
+
+Alternative:
+ m4, GNU pic (gpic), TeX or LaTeX, and a driver recognizing tpic specials
+ (eg dvips)
+
+ The GNU pic interpreter with option -t produces tpic special commands.
+
+Also possible for some diagrams:
+ m4 and dpic with output in the following formats:
+ LaTeX graphics or LaTeX eepic (for simple diagrams), mfpic, xfig,
+ MetaPost, SVG, PDF, or Postscript.
+
+USAGE
+ First-time users should read the Quick Start section of Circuit_macros.pdf.
+
+ The following describes the most common basic usage to produce tikz
+ 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.
+
+ Suppose that a source file, cct.m4 say, has been created and the top
+ two lines are
+ .PS
+ cct_init
+ ...
+
+ The file is processed by feeding a configuration file followed by the
+ diagram source to m4, and routing the output to dpic. If you have set
+ the M4PATH environment variable as described in the INSTAllATION
+ instructions, the command for Tikz processing is
+
+ m4 pgf.m4 cct.m4 | dpic -g > cct.tex
+
+ NOTE: The order in which the files are given to m4 is important.
+ A configuration file (pgf.m4 in this example) must ALWAYS appear first.
+
+ If you have not set the M4PATH environmental variable then the command is
+
+ m4 -I <path> pgf.m4 cct.m4 | dpic -g > cct.tex
+
+ where <path> is the absolute path to the directory containing the library
+ macros.
+
+ If the first line of cct.m4 is
+ include(pgf.m4)
+ and M4PATH is defined, then this command can be simplified to
+
+ m4 cct.m4 | dpic -g > cct.tex
+
+ In each case, the resulting file cct.tex is normally inserted into
+ a document to be processed by LaTeX. The -g option of dpic produces
+ Tikz-pgf graphics commands in cct.tex so the LaTeX document must have
+ \usepackage{tikz} in the preamble.
+
+ To produce postscript output, the LaTeX preamble must contain
+ \usepackage{pstricks}, pstricks.m4 is read instead of pgf.m4, and the dpic
+ option is -p, so the command is
+
+ m4 pstricks.m4 cct.m4 | dpic -p > cct.tex
+
+ or, if include(pstricks.m4) is the first line of cct.m4,
+
+ m4 cct.m4 | dpic -p > cct.tex
+
+ Read Section 2 of the manual to see how to process the diagram source
+ from within the main .tex source file.
+
+ To use the GNU gpic processor (called pic on some systems) instead of dpic,
+ the command is
+
+ m4 gpic.m4 cct.m4 | gpic -t > cct.tex
+
+ with the -I <path> option added if M4PATH has not been defined.
+
+INSTALLATION:
+ 1. Decide where you will be installing the .m4 library files. In
+ principle, they can go anywhere, for example, $HOME/Circuit_macros,
+ c:\localtexmf\Circuit_macros, /usr/local/share/Circuit_macros,
+ or ~/texmf/tex/latex/Circuit_macros. Copy the files from the
+ top-level directory of the distribution to the installation
+ directory, or simply expand the .tar.gz or .zip distribution file
+ and rename the result to create the installation directory, which
+ will then include the doc and examples subdirectories.
+
+ 2. Copy boxdims.sty (see Section 9 of the manual) from the top
+ distribution directory to where LaTeX will find it; directory
+ ~/texmf/tex/latex/boxdims for example, and refresh the LaTeX
+ filename database (the exact command depends on your LaTeX
+ distribution and may not be necessary).
+
+ 3. Define the environment variable M4PATH to point to the installation
+ directory determined in Step 1. For the bash shell, for
+ example, add the following to your .bashrc file:
+ export M4PATH='.:~/texmf/tex/latex/Circuit_macros:'
+ but modify the path to the installation directory as necessary.
+
+ 4. This is optional. For historical reasons, the default configuration file
+ as distributed is gpic.m4. You can change it to pgf.m4 or pstricks.m4
+ for use with dpic by editing the include command near the top of
+ libgen.m4. To do this automatically, go to the installation directory
+ and type
+ "make pgfdefault" to set the default processor to dpic with Tikz pgf
+ "make psdefault" to set the default processor to dpic with PSTricks
+ "make gpicdefault" to restore gpic as the default.
+
+ In case of difficulty, go to the examples directory, look at debug1.tex
+ and debug2.m4, and follow instructions.
+
+WORKFLOW: The basic commands given above suffice for documents of moderate
+ size and complexity; otherwise, a "make" facility or equivalent should be
+ used or, for modest documents, diagram processing can be controlled from
+ within the tex document source as described in the manual. For near-immediate
+ viewing, three windows can be kept open: one in which to edit the source, one
+ to process the source and produce postscript or pdf, and GSview 5.0, which
+ updates when clicked. The Okular viewer also re-loads automatically.
+
+ Special-purpose editors and GUI-based project tools such as TeXnicCenter
+ can also be employed, or a scripting language can automate the steps as
+ done by Latexmk or several other similar tools; see, for example,
+ http://tex.stackexchange.com/questions/64/tools-for-automating-document-compilation
+
+ NOTE: One of the configuration files (gpic.m4, pstricks.m4, pgf.m4,
+ pdf.m4, postscript.m4, psfrag.m4, mpost.m4, mfpic.m4, svg.m4, or
+ xfig.m4) must be read by m4 before (or at the beginning of) the diagram
+ source file, depending on the required form of pic output. Otherwise,
+ libgen.m4 can be read first but it will invoke the default configuration
+ file, which is gpic.m4 in the distribution unless it has been changed
+ during installation.
+
+TESTING:
+ To test your installation, go to the examples directory (or copy the
+ files Makefile, tst.tex, and any .m4 sources you might like to test
+ to a working directory) and create a test circuit in the
+ file test.m4. Copy ex01.m4, for example, or quick.m4 from the doc
+ directory into test.m4.
+
+ On a system with a "make" facility, first check the definitions at
+ the top of the Makefile, and then type "make tst1" to produce the
+ file tst.ps. If the source requires processing twice, type "make
+ tst" instead. To process one of the example .m4 files in the
+ examples directory, simply type "make name.ps" to process name.m4.
+ If these tests work to your satisfaction, try typing simply "make" to
+ produce examples.ps. To test .pdf files, go to the pgf directory,
+ copy name.m4 there, and type either "make name.ps" or "make name.pdf"
+ to test the file under pdflatex and TikZ PGF.
+
+ The .m4 files in the examples directory can serve as models for your
+ diagrams but keep in mind that some of them contain details that allow
+ the source to be used with a variety of postprocessors. Sticking to
+ one postprocessor such as tikz or PStricks allows for the simplest
+ source. You might wish to browse some of the files that are not
+ included to produce examples.ps.
+
+ No "make" facility? You have to test by hand (but see below for
+ diagram production software). Copy a test file as above into
+ test.m4. Assuming you have dpic installed, type the following:
+
+ m4 -I <path> pstricks.m4 test.m4 > test.pic
+ dpic -p test.pic > test.tex
+ latex tst
+ dvips tst -o tst.ps
+
+SOURCES AND MANUALS:
+ View or print Circuit_macros.pdf in the doc directory.
+
+ M4 is widely available on Unix systems. PC source and executables are
+ also available: http://gnuwin32.sourceforge.net/packages/m4.htm
+ A large set of Unix-like Windows tools, including m4, is available via
+ http://www.cygwin.com/
+ DJGPP versions are available as m4-NNb.zip (where NN is the current
+ release number) on web archives and at
+ http://www.delorie.com/djgpp/dl/ofc/dlfiles.cgi/current/v2gnu/
+
+ There are several sources of hints on m4 usage; some places to look are
+ http://gnuwin32.sourceforge.net/packages/m4.htm (m4 for Windows)
+ http://www.gnu.org/software/m4/manual/ (GNU m4 manual)
+ https://mbreen.com/m4.html (m4 by example)
+ https://www.seindal.dk/rene/gnu/ (development site)
+ The m4 (computer language) article in Wikipedia gives a concise overview.
+ An academic discussion of the language can be found in
+ http://www.cs.stir.ac.uk/~kjt/research/pdf/expl-m4.pdf.
+ The GNU Autoconf manual contains a chapter on M4 programming:
+ http://www.gnu.org/software/autoconf/manual/index.html
+ (Do not read this manual first). Autoconf uses quote characters [ and ]
+ instead of the default ` and ' which work well with the pic language.
+
+ A video "Drawing Circuit Diagrams with Circuits Macros" by James Green
+ showing how to use Circuit_macros with his setup is at
+ https://www.youtube.com/watch?time_continue=53&v=pFRIBvUJHS4
+
+ 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
+ https://gitlab.com/aplevich/dpic
+
+ The dpic distribution includes a manual dpic-doc.pdf containing a summary
+ of the pic language and descriptions of features unique to dpic.
+
+EXAMPLES AND INTEGRATION WITH OTHER TOOLS:
+ 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.ps in the examples directory. There are a few other source
+ files in the examples directory that are not shown in examples.ps.
+ For the possibly unstable development version of these macros, try
+ http://ece.uwaterloo.ca/~aplevich/Circuit_macros/
+
+ The examples directory Makefile automates the generation of .ps, .eps,
+ .png, and .pdf files for individual diagrams. Subdirectories of the
+ examples directory are for testing metafont, metapost, pgf, psfrag,
+ pdf, and xfig examples.
+
+ Installation and usage of the macros have evolved a little since the
+ beginning so archived instructions on the net may be slightly more
+ complicated than currently necessary. However, a number of people
+ have developed tools that simplify workflow for their circumstances,
+ which are beyond the scope of this distribution. The following may
+ be of interest:
+
+ Fabrice Salvaire provides a brief introduction at
+ https://www.fabrice-salvaire.fr/en/blog/electronic-circuit-diagrams/
+
+ A set of examples and hints intended for his colleagues has been
+ produced by Alan Robert Clark at http://ytdp.ee.wits.ac.za/cct.html
+
+ A KDE interface created by Matteo Agostinelli can be found at
+ http://wwwu.uni-klu.ac.at/magostin/cirkuit.html
+ A git repository of a newer version of cirkuit by Andrew G. for Linux is at
+ https://github.com/ag-ckt/cirkuit/tree/V0.5.0
+
+ The GUI front end PyCirkuit at https://github.com/orestesmas/pycirkuit
+ is Python-based and inspired by Cirkuit.
+
+ 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.
+
+ Mac users:
+ 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/
+
+ For more examples in the context of a textbook, have a look at
+ Aplevich, J.D., "The Essentials of Linear State-Space Systems," New
+ York: John Wiley & Sons Inc., 2000. In Canada, look at Andrews,
+ G.C., Aplevich, J.D., Fraser, and R.A., MacGregor, C.G.,
+ "Introduction to Professional Engineering in Canada," (fifth edition)
+ Toronto: Pearson Education Canada, Inc., 2018. Some samples from these
+ books can be found at
+ http://ece.uwaterloo.ca/~aplevich/
+
+ For an example of the use of dpic in a wiki (thanks to Jason Grout), see
+ http://jasongrout.org/software/dokuwiki/format-plugin
+
+ A Windows batch file for Circuit_macros is found at
+ http://someonehasdonethis.blogspot.ca/2012/12/a-solution-for-drawing-circuit-diagrams.html
+
+ The examples in the current distribution include some flowchart elements
+ in Flow.m4. For a pic-only version that does not require m4, look at
+ http://web.ing.puc.cl/~mtorrest/downloads.htm#TeX
+
+ 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.
+
+ Pic macros for drawing graphs are described at
+ http://www.math.uiuc.edu/~west/gpic.html
+ After minor adaptation to dpic syntax, many of them can be simplified.
+
+ A collection of pic resources and related material is available at
+ http://www.kohala.com/start/troff/troff.html In particular, W. Richard
+ Stevens illustrated his books on Unix and TCP/IP using pic macros. Some
+ of the sources found there need minor tuning to work under dpic.
+
+TikZ-PGF: Check the Makefile in the examples/pgf directory as described
+ in the README file, and type "make" or "make examples.pdf".
+
+MetaPost examples: Go to the examples/mpost directory. Check the
+ Makefile as described in the README file, type "make", and stand well back.
+
+Postscript with embedded psfrag strings:
+ Type "make" in the examples/psfrag directory to process examples
+ using dpic -f for creating .eps files with embedded psfrag strings.
+
+Postscript, CorelDraw, Adobe Illustrator:
+ Circuits and other diagrams not requiring LaTeX-formatted text can be
+ processed through m4 and dpic -r to produce encapsulated Postscript
+ output. This output can also be imported into CorelDraw or Adobe
+ Illustrator. However, Postscript is not a word processor, so any
+ 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.
+
+ If SVG is the ultimate goal, then it may be advisable to use the tool
+ dvisvgm to convert dvi to svg. An alternative on some systems is to
+ produce pdf and then use pdf2svg, since the font selection and formatting
+ problems associated with direct production of svg are eliminated.
+
+ 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 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.
+
+ Recent Inkscape versions can export graphics to eps or pdf format
+ and text to tex format, so that labels can be formatted by LaTeX and
+ overlaid on the graphics file. This process allows the use of Inkscape
+ to place and embellish circuit elements.
+
+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
+ be of interest to persons who cannot otherwise implement the macros.
+ To see the elements (assuming a typical installation), type "make"
+ in the mf directory.
+
+Xfig:
+ The file examples/xfig/xfiglib.fig contains circuit elements in xfig
+ 3.2 format produced by dpic. The file is a prototype because many
+ more elements could be included. Logic gates often have many labels,
+ and xfig is not a word processor, so some fine tuning of labels is in
+ order. Translation between languages always involves a loss of
+ information and idiom, but Xfig can store diagrams in pic format, so
+ it is possible to alternate between xfig and dpic.
+
+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.
+
+MODIFICATIONS:
+ Macros such as these inevitably will be modified to suit individual
+ needs and taste. They continue to evolve in my own library as I use
+ 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.
+
+Feel free to contact me with comments or questions. I have retired
+from full-time work but continue the hobby of maintaining these files.
+I may now be able to spend more time on individual requests but I may
+not reply instantly to email.
+
+
+Dwight Aplevich
+aplevich (AT) uwaterloo (DOT) ca
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/darrow.m4 b/Master/texmf-dist/doc/latex/circuit-macros/darrow.m4
new file mode 100644
index 00000000000..7721842da09
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/darrow.m4
@@ -0,0 +1,304 @@
+divert(-1)
+ darrow.m4 Macros for double lines and arrows
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+
+`Notes: these macros have been reworked (Jan 2013) so that dlthick is the
+ total outside width, consistent with solid lines and arrows, and to add
+ the !- and -! half-linethick line caps to simplify butting to boxes.
+
+ Some of these macros have uncomfortably many arguments for specifying
+ options, so wrappers beginning with upper-case letters (Dline, Darrow, Darc)
+ are provided and implement key=val;key=val... option specifications.
+'
+
+=============================================================================
+define(`darrow_')
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')
+
+ Default width (thickness) of double lines
+define(`dlthick',`(0.08*scale+lthick)')
+#efine(`dlinewid',`dlthick') Obsolete, keep for a while for compatibility.
+
+ `ELement fill color (default white)
+ e.g. define(`dfillcolor',`1,0.84,0')
+ Obsolete:
+ command "\definecolor{gold}{rgb}{1,0.84,0}"
+ define(`dfillcolor',gold)'
+define(`dfillcolor',`1,1,1')
+
+define(`dfillgrey',1) `fill shade for gpic'
+define(`darcrad',`dlthick*2') `default darc radius'
+
+ `Default length:'
+ifdef(`elen_',,`define(`elen_',linewid*3/2)')
+=============================================================================
+
+ `deleminit_(linespec,len,dlinethick)
+ dline initialization'
+define(`deleminit_',`define(`m4dlthk',ifelse(`$3',,dlthick,`$3'))dnl
+ rpoint_(ifelse(`$1',,`to rvec_(ifelse(`$2',,linewid,`$2'),0)',`$1')) ')
+
+
+ `above, below, ljust, rjust but displaced
+ by dlthick/2 eg "string" dabove(at position)'
+define(`dabove',`above ifelse(`$1',,`at Here',`$1')+(0,dlthick/2)')
+define(`dbelow',`below ifelse(`$1',,`at Here',`$1')-(0,dlthick/2)')
+define(`dljust',`ljust ifelse(`$1',,`at Here',`$1')+(dlthick/2,0)')
+define(`drjust',`rjust ifelse(`$1',,`at Here',`$1')-(dlthick/2,0)')
+
+ `dline(linespec,start truncation,end truncation,dlthick, ends )
+ ends= blank, x-x, -x, x-, where x means ! or |'
+define(`dline',`deleminit_(`$1',,`$4')
+ M4DL: line from last line.start to last line.end \
+ chop ifelse(`$2',,0,m4dlthk/2) chop ifelse(`$3',,0,m4dlthk/2)
+ ifelse(rgbstring(1,1,1),"",,
+ `{line thick m4dlthk/(1bp__) from M4DL.start to M4DL.end }
+ {line thick m4dlthk/(1bp__)-2*linethick outlined rgbstring(dfillcolor) \
+ from M4DL.start \
+ ifinstr(`$5',|-,`+vec_(lthick,0)',`$5',!-,`+vec_(lthick/2,0)') \
+ to M4DL.end \
+ ifinstr(`$5',-|,`-vec_(lthick,0)',`$5',-!,`-vec_(lthick/2,0)') }')
+ ifgpic(`M4dV: vec_(0,m4dlthk/2-lthick/2); shade(dfillgrey,
+ {line from M4DL.start+(M4dV.x,M4dV.y) to M4DL.end+(M4dV.x,M4dV.y)}
+ {line from M4DL.start-(M4dV.x,M4dV.y) to M4DL.end-(M4dV.x,M4dV.y)})')
+ line invis from M4DL.start to M4DL.end')
+
+ `Dline(linespec,params)
+ params is a semicolon-separated list of items:
+ S truncate at start by dline thickness/2
+ E truncate at end by dline thickness/2
+ thick=val (total thicknes, ie width)
+ ends= x-x or -x or x- where x is ! or |
+ |- closed end with full-width line
+ !- 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)))
+ dline(`$1',ifinstr(`$2',S,t),ifinstr(`$2',E,t),m4thick,m4ends)
+ popdef(`m4ends')popdef(`m4ends')popdef(`m4thick')
+ ')
+
+ `dleft(at position,dlthick) Turn left,
+ leaving current location at exit of corner'
+define(`dleft',`deleminit_(,ifelse(`$2',,dlthick,`$2'),`$2')
+ ifelse(`$1',,,`move to substr(`$1',eval(index(`$1',t)+1))-vec_(m4dlthk/2,0)')
+ { line thick m4dlthk/(1bp__) to rvec_(m4dlthk,0) }
+ ifelse(rgbstring(1,1,1),"",,
+ `line thick m4dlthk/(1bp__)-2*linethick outlined rgbstring(dfillcolor) \
+ to rvec_(m4dlthk/2,0) then to rvec_(m4dlthk/2,m4dlthk/2)')
+ ifgpic(`{line from rvec_(0,m4dlthk/2-lthick/2) to rvec_(0,m4dlthk/2-lthick/2)}
+ {line from rvec_(m4dlthk-lthick/2,m4dlthk/2) \
+ to rvec_(m4dlthk-lthick/2,-m4dlthk/2+lthick/2) then \
+ to rvec_(0,-m4dlthk/2+lthick/2)}
+ move to rvec_(m4dlthk/2,m4dlthk/2)')
+ rp_ang = rp_ang+pi__/2')
+ `dright(at position,dlthick) Turn right,
+ leaving current location at exit of corner'
+define(`dright',`deleminit_(,ifelse(`$2',,dlthick,`$2'),`$2')
+ ifelse(`$1',,,`move to substr(`$1',eval(index(`$1',t)+1))-vec_(m4dlthk/2,0)')
+ { line thick m4dlthk/(1bp__) to rvec_(m4dlthk,0) }
+ ifelse(rgbstring(1,1,1),"",,
+ `line thick m4dlthk/(1bp__)-2*linethick outlined rgbstring(dfillcolor) \
+ to rvec_(m4dlthk/2,0) then to rvec_(m4dlthk/2,-m4dlthk/2)')
+ ifgpic(`{line from rvec_(0,-m4dlthk/2+lthick/2) \
+ to rvec_(0,-m4dlthk/2+lthick/2)}
+ {line from rvec_(m4dlthk-lthick/2,-m4dlthk/2) \
+ to rvec_(m4dlthk-lthick/2,m4dlthk/2-lthick/2) then \
+ to rvec_(0,m4dlthk/2-lthick/2)}
+ move to rvec_(m4dlthk/2,-m4dlthk/2)')
+ rp_ang = rp_ang-pi__/2')
+
+ `dturn(arg,dlthick)
+ Turn arg relative degrees ccw'
+define(`dturn',`deleminit_(,ifelse(`$2',,dlthick,`$2'),`$2')
+[S: Here
+ deg = ifelse(`$1',,0,`$1')
+ c = cosd(deg); s = sind(deg); sgn = sign(deg); r = (dlthick-lthick)/2
+ A: S+vec_(lthick/2*abs(s),sgn*r)
+ B: A+vec_(vscal_(lthick/2*abs(s),c,s))
+ C: S+vec_(0, sgn*r)
+ if deg==0 then {t = 0} else { t = (1-c)/s } # t = tan(deg/2)
+ D: A+vec_(vscal_(r*2,sgn*t,-sgn))
+ E: B+vec_(vscal_(r*2,sgn*s,-sgn*c))
+ F: S+vec_(0,-sgn*r)
+ T: 0.5 between A and D
+ X: 0.5 between B and E
+ ifelse(rgbstring(1,1,1),"",,
+ `line thick r*2/(1bp__) outlined rgbstring(dfillcolor) \
+ from S to T then to X')
+ ifgpic(`m4tmpth = linethick; linethick=0
+ shade(dfillgrey,`line from C to A then to B; line from E to D then to F')
+ linethick = m4tmpth')
+ line from C to A then to B
+ line from E to D then to F
+#{"A" at A;"B" at B;"C" at C;"D" at D;"E" at E; "F" at F;"T" at T;"X" at X}
+ `$3'] with .S at Here
+ move to last [].X
+ ifelse(`$1',,,`Point_(`$1'+rp_ang*rtod_)') ')
+
+ `darrow(linespec, start truncation, end truncation, dlthick,
+ arrow wid, arrow ht, terminals)
+ terminals is blank or x-, ->, x->, <-, <-x, <-> where x is
+ ! for closed end with half-width line or
+ | for closed end with full-width line'
+define(`darrow',`deleminit_(`$1',,`$4')
+ ifelse(ifinstr(`$7',<->,,`$7',<-,T),T,
+ `define(`m4dx',`ifinstr(`$7',|,|,`$7',!,!)'->)dnl
+ M4DA: line invis from last line.end to last line.start \
+ chop ifelse(`$3',,0,m4dlthk/2) chop ifelse(`$2',,0,m4dlthk/2)
+ rp_ang = rp_ang+pi__',
+ `define(`m4dx',`$7')dnl
+ M4DA: line invis from last line.start to last line.end \
+ chop ifelse(`$2',,0,m4dlthk/2) chop ifelse(`$3',,0,m4dlthk/2)')
+ [ C: M4DA.c; S: M4DA.start; E: M4DA.end
+ w = ifelse(`$5',,m4dlthk*3/2,`$5')
+ h = ifelse(`$6',,m4dlthk,`$6')
+ d = sqrt((w/2)^2+h^2)
+ p = d/w*lthick
+ V: vec_(0,m4dlthk/2-lthick/2)
+ T: vec_(h-lthick/2,0)
+ P: vec_(p,0)
+ Vt: vec_(0,w/2/h * (h-lthick/2-p))
+ W: vec_(lthick/2,0)
+ X: ifinstr(`$7',<->,C,m4dx,!,S,m4dx,|,S+(W.x,W.y),S)
+ ifgpic(`shade(dfillgrey,') line dnl
+ ifelse(rgbstring(1,1,1),"",,`shaded rgbstring(dfillcolor)') from dnl
+ ifinstr(m4dx,|,`X to X+(V.x,V.y) then',`X+(V.x,V.y)') to \
+ E-(T.x,T.y)+(V.x,V.y) then to E-(T.x,T.y)+(Vt.x,Vt.y) \
+ then to E-(P.x,P.y) \
+ then to E-(T.x,T.y)-(Vt.x,Vt.y) then to E-(T.x,T.y)-(V.x,V.y) \
+ then to dnl
+ ifinstr(m4dx,<-,
+ `S+(T.x,T.y)-(V.x,V.y) then to S+(T.x,T.y)-(Vt.x,Vt.y) \
+ then to S+(P.x,P.y) \
+ then to S+(T.x,T.y)+(Vt.x,Vt.y) then to S+(T.x,T.y)+(V.x,V.y) \
+ then to X+(V.x,V.y)',
+ m4dx,|,
+ `X-(V.x,V.y) then to X',
+ m4dx,!,
+ `S-(V.x,V.y); line thick linethick/2 from S+(W.x/2,W.y/2)-(V.x,V.y) \
+ to S+(W.x/2,W.y/2)+(V.x,V.y)
+ line from S+(V.x,V.y) to X+(V.x,V.y)',
+ `X-(V.x,V.y)') ifgpic(`)')
+ ] with .C at M4DA.c
+ ifelse(ifinstr(`$7',<->,,`$7',<-,T),T,
+ `rp_ang = rp_ang-pi__
+ arrow invis from M4DA.end to M4DA.start',
+ `arrow invis from M4DA.start to M4DA.end')
+')
+
+ `Darrow(linespec,params)
+ params is a semicolon-separated list of items:
+ S truncate at start by dline thickness/2
+ E truncate at end by dline thickness/2
+ thick=val (total thicknes, ie width)
+ wid=val (arrowhead width)
+ ht=val (arrowhead height)
+ ends= -> or x-> or <- or <-x or <-> where x is | or !
+ |- closed end with full-width line
+ !- 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')')
+
+ `dtee([L|R],dlthick) Construct tee with tail right,
+ left, or back along current direction, leaving
+ current location at tee centre; eg
+ dline(right_,,t); dtee(R);
+ { darrow(down_,t) }; darrow(right_,t)'
+define(`dtee',`deleminit_(,ifelse(`$2',,dlthick,`$2'),`$2')
+ move to last line.c
+ ifelse(`$1',L,`rp_ang = rp_ang-pi_/2',`$1',R,`rp_ang = rp_ang+pi_/2')
+ ifelse(rgbstring(1,1,1),"",,
+ `{line thick dlthick/(1bp__) from rvec_(-m4dlthk/2,0) to rvec_(m4dlthk/2,0)}
+ {line thick dlthick/(1bp__)-2*linethick outlined rgbstring(dfillcolor) \
+ to rvec_(-m4dlthk/2,0) }
+ {line thick dlthick/(1bp__)-2*linethick outlined rgbstring(dfillcolor) \
+ from rvec_(0,-m4dlthk/2) to rvec_(0,m4dlthk/2) } ')
+ ifgpic(`m4tmpth = linethick; linethick=0; shade(dfillgrey,
+ {line from rvec_(-m4dlthk/2, m4dlthk/2) to rvec_( m4dlthk/2, m4dlthk/2)}
+ {line from rvec_( m4dlthk/2,-m4dlthk/2) to rvec_(-m4dlthk/2,-m4dlthk/2)})
+ linethick = m4tmpth') ')
+
+ Close off line end: `dend([at position])'
+define(`dend',`deleminit_(,lthick)
+ ifelse(`$1',,,`move to substr(`$1',eval(index(`$1',at)+2))')
+ {line from rvec_(0,-dlthick/2) to rvec_(0,dlthick/2)}
+ move to rvec_(lthick/2,0) ')
+
+ `darc(center pos, radius, start radians, end radians, dlthick,
+ arrow wid, arrow ht, symbols ) draw CCW arc
+ symbols= x-, -x, x-x, ->, x->, <-, <-x, <->
+ where x is | or ! ; arrowheads for dpic only '
+define(`darc',`[ C: (0,0)
+ dlth=ifelse(`$5',,dlthick,`$5')
+ w = ifelse(`$6',,dlth*1.75,(`$6'))
+ h = ifelse(`$7',,dlth,(`$7'))
+ r = ifelse(`$2',,darcrad,`($2)')
+ p = sqrt((w/2)^2+h^2)/(w/2)*lthick
+ as = ifelse(`$3',,rp_ang-pi__/2,`$3')
+ tas = as ifinstr(`$8',<-,`+ p/r')
+ ae = ifelse(`$4',,as+pi__/2,`$4')
+ tae = ae ifinstr(`$8',<-,`- p/r')
+ S: (rect_(r,as)); TS: (rect_(r,tas))
+ E: (rect_(r,ae)); TE: (rect_(r,tae))
+ arc thick dlth/(1bp__) wid w ht h dnl
+ ifinstr(`$8',<-,<-`'ifinstr(`$8',->,>),`$8',->,->) from S to E with .c at C
+ ifelse(rgbstring(1,1,1),"",,
+ `arc thick dlth/(1bp__)-linethick*2 wid (h-p-lthick)/h*w ht h-p-lthick \
+ colored rgbstring(dfillcolor) \
+ ifinstr(`$8',<-,<-`'ifinstr(`$8',->,>),`$8',->,->) \
+ from TS to TE rad r with .c at C')
+ ifinstr(`$8',|-,`X: (vscal_(lthick/2,-sin(as),cos(as)))
+ line from C+(rect_(r+dlthick/2-lthick/2,as))+(X.x,X.y) to \
+ C+(rect_(r-dlthick/2+lthick/2,as))+(X.x,X.y)',
+ `$8',!-,`X: (vscal_(lthick/4,-sin(as),cos(as)))
+ line thick linethick/2 \
+ from C+(rect_(r+dlthick/2-lthick/4,as))+(X.x,X.y) to \
+ C+(rect_(r-dlthick/2+lthick/4,as))+(X.x,X.y)')
+ ifinstr(`$8',-|,`X: (vscal_(lthick/2,-sin(ae),cos(ae)))
+ line from C+(rect_(r+dlthick/2-lthick/2,ae))-(X.x,X.y) to \
+ C+(rect_(r-dlthick/2+lthick/2,ae))-(X.x,X.y)',
+ `$8',!-,`X: (vscal_(lthick/4,-sin(ae),cos(ae)))
+ line thick linethick/2 \
+ from C+(rect_(r+dlthick/2-lthick/4,ae))-(X.x,X.y) to \
+ C+(rect_(r-dlthick/2+lthick/4,ae))-(X.x,X.y)')
+# { "S" at S; "E" at E; "C" at C; "TS" at TS; "TE" at TE }
+ rp_ang := ae+pi__/2
+ ] with ifelse(`$1',,.S at Here,.C at `$1')
+ move to last [].E
+ ')
+
+ `Darc(center pos, radius, start radians, end radians, params)
+ draw CCW arc
+ params is a semicolon-separated list of items:
+ thick=val (total thicknes, ie width)
+ wid=val (arrowhead width)
+ ht=val (arrowhead height)
+ ends= x-, -x, x-x, ->, x->, <-, <-x, <-> where x is ! or |
+ < and > work for dpic only
+ |- closed end with full-width line
+ !- 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')')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/AmpTable.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/AmpTable.m4
new file mode 100644
index 00000000000..c94f682cbcb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/AmpTable.m4
@@ -0,0 +1,22 @@
+.PS
+# `Amptable.m4'
+cct_init
+movewid = 2pt__
+{
+ {amp ; move ; "{\tt `amp'}" ljust}
+ move down 0.4; right_
+ {amp(,0.3) ; move ; "{\tt `amp'(,0.3)}" ljust}
+ }
+ move right_ 2.0
+{ {delay ; move ; "{\tt `delay'}" ljust}
+ move down 0.4; right_
+ {delay(,0.2) ; move ; "{\tt `delay'(,0.2)}" ljust}
+ }
+
+ move right_ 2.0
+{ {integrator ; move ; "{\tt `integrator'}" ljust}
+ move down 0.5; right_
+ {integrator(,0.3) ; move ; "{\tt `integrator'(,0.3)}" wid 82pt__ ljust}
+ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Antennas.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Antennas.m4
new file mode 100644
index 00000000000..6053cd2e3f0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Antennas.m4
@@ -0,0 +1,40 @@
+.PS
+# `Antennas.m4'
+cct_init
+s_init(Antennas)
+sinclude(Circuit_macros.dim)
+
+ define(`elen_',elen_*0.9)
+ B: Here
+ A: antenna
+ s_box(T) below at A.T
+ s_box(`\tt an`'tenna') at A.n above
+ A: antenna(at A.T+(elen_,0),T)
+ s_box(T) below at A.T
+ s_box(`\tt (,T)') at A.n above
+ A: antenna(at A.T+(elen_,0),,L)
+ s_box(T1) below rjust at A.T1
+ s_box(T2) below ljust at A.T2
+ s_box(`\tt (,{,}L)') at A.n above
+ A: antenna(at A.T+(elen_,0),T,L)
+ s_box(T1) below rjust at A.T1
+ s_box(T2) below ljust at A.T2
+ s_box(`\tt (,T,L)') at A.n above
+ A: antenna(at A.T+(elen_,0),,T)
+ s_box(T) below at A.T
+ s_box(`\tt (,{,}T)') at A.n above
+ A: antenna(at A.T+(elen_,0),,S)
+ s_box(T1) below rjust at A.T1
+ s_box(T2) below ljust at A.T2
+ s_box(`\tt (,{,}S)') at A.n above
+ A: antenna(at A.T+(elen_,0),,D)
+ s_box(T1) below rjust at A.T1
+ s_box(T2) below ljust at A.T2
+ s_box(`\tt (,{,}D)') at A.n above
+ A: antenna(at A.T+(elen_,0),,P)
+ s_box(T) below at A.T
+ s_box(`\tt (,{,}P)') at A.n above
+ A: antenna(at A.T+(elen_,0),,F)
+ s_box(T) below at A.T
+ s_box(`\tt (,{,}F)') at A.n above
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Audio.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Audio.m4
new file mode 100644
index 00000000000..722a2434d8a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Audio.m4
@@ -0,0 +1,94 @@
+.PS
+# `Audio.m4'
+cct_init
+
+define(`In123',`
+thinlines_
+ arrow <- from `$1'.In1 up 0.05 left 0.15
+ "{\sl In1}sp_" rjust above
+ arrow <- left 0.15 from `$1'.In2
+ "{\sl In2}sp_" wid 0.2 rjust
+ arrow <- from `$1'.In3 down 0.05 left 0.15
+ "{\sl In3}sp_" rjust below
+thicklines_ ')
+
+L:[
+ [
+ S: speaker
+ `"\tt speaker"' at S.s+(0,-0.2) #below
+ In123(S)
+ thinlines_
+ arrow <- from S.In4 left 0.05 up 0.15
+ "{\sl In4}" above rjust
+ arrow <- from S.In5 right 0.05 up 0.15
+ "{\sl In5}" above
+ arrow <- from S.In6 left 0.05 down 0.15
+ "{\sl In6}" below rjust
+ arrow <- from S.In7 right 0.05 down 0.15
+ "{\sl In7}" below
+ spline <- from S.Box.e+(0,0.05) right 0.27 up 0.10 \
+ then right 0.1 up 0.2
+ "\sl Box" above
+ thicklines_
+ ]
+[
+ H: speaker(,,H)
+ `"\tt speaker(,{,}H)"' at H.s+(0,-0.30) #below
+ ] with .sw at last [].se+(0.25,-0.1)
+ ]
+[
+ B: bell
+ `"\tt bell"' at B.s+(0,-0.2) #below
+ In123(B)
+ thinlines_
+ arrow <- from B.Box.n+(-0.1,0) up 0.15 left 0.1 ; "\sl Box" above
+ arrow <- from B.Circle.n up 0.15 ; "\sl Circle" above
+ thicklines_
+ ] with .w at last [].e+(0.0,0.5)
+[
+ M: microphone
+ `"\tt microphone"' at M.s+(0,-0.2) #below
+ In123(M)
+ thinlines_
+ arrow <- from M.Circle.n up 0.15 ; "\sl Circle" above
+ thicklines_
+ ] with .sw at last [].se+(0.4,0)
+[
+ Z: buzzer
+ `"\tt buzzer"' at Z.s+(0,-0.2) #below
+ In123(Z)
+ thinlines_
+ arrow <- from Z.Box.n up 0.15 ; "\sl Box" above
+ thicklines_
+ ] with .sw at last [].se+(0.4,0)
+R:[
+ Z: buzzer(,,C)
+ `"\tt buzzer(,{,}C)"' at Z.s+(0,-0.2) #below
+ In123(Z)
+ thinlines_
+ spline <- from 0.8<Z.Face.s,Z.Face.n> right 2*arrowht up 0.5*arrowht \
+ then up 0.15 right 0.05
+ "\sl Face" above
+ thicklines_
+ ] with .sw at last [].se+(0.4,0)
+[[
+ E: earphone
+ `"\tt earphone"' at E.s+(0,-0.2) #below
+ In123(E)
+ thinlines_
+ arrow <- from E.Box.n up 0.15 left 0.15 ; "\sl Box" above
+ thicklines_
+ ]
+ [
+ E: earphone(,,C)
+ `"\tt earphone(,{,}C)"' at E.s+(0,-0.2) #below
+ thinlines_
+ arrow <- from E.L up 0.15 left 0.15; "\sl L" rjust
+ arrow <- from E.R up 0.15 right 0.15; "\sl R" ljust
+ "\sl N" at E.N above
+ "\sl C" at E.C
+ thicklines_
+ ] with .sw at last [].se+(0.6,0)
+] with .n at (0.6 between L and R, R.s)+(0,0.1-ifdpic(0.2,0.25))
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Axes.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Axes.m4
new file mode 100644
index 00000000000..3d8986ce5cc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Axes.m4
@@ -0,0 +1,5 @@
+.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
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/BigResistor.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/BigResistor.m4
new file mode 100644
index 00000000000..9599c9c9d2f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/BigResistor.m4
@@ -0,0 +1,20 @@
+.PS
+ cct_init
+ linewid = 2.0
+ linethick_(2.0)
+
+R1: resistor
+
+ 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
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Bip.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Bip.m4
new file mode 100644
index 00000000000..121517d16d8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Bip.m4
@@ -0,0 +1,60 @@
+.PS
+# `Bip.m4'
+cct_init
+
+ up_
+Q1: bi_tr(up_ dimen_)
+ thinlines_
+ showbox_(,dotted)
+ thicklines_
+ "\hbox{\sl E}" at Q1.E-(0,0.05) below
+ "\hbox{\sl B}sp_" at Q1.B rjust
+ "\hbox{\sl C}" at Q1.C above
+ "`{\tt bi\_tr(up\_ dimen\_)}'" wid 1.2 at Q1.s + (0,-0.35) below
+
+Q2: bi_tr(,R) with .E at Q1.E+(0.25,0)
+ thinlines_
+ showbox_(,dotted)
+ thicklines_
+ "\hbox{\sl E}" at Q2.E-(0,0.05) below
+ "sp_\hbox{\sl B}" at Q2.B ljust
+ "\hbox{\sl C}" at Q2.C above
+ "`{\tt bi\_tr(,R)}'" at Q2.s + (0,-0.2) below
+
+Q3: bi_tr(,,P) with .C at Q2.C+(1.15,0)
+ thinlines_
+ showbox_(,dotted)
+ thicklines_
+ "\hbox{\sl E}" at Q3.E-(0,0.05) below
+ "\hbox{\sl B}sp_" at Q3.B rjust
+ "\hbox{\sl C}" at Q3.C above
+ "`{\tt bi\_tr(,{,}P)}'" at Q3.s + (0,-0.35) below
+
+Q4: bi_tr(,,,E) with .C at Q3.C+(0.9,0)
+ thinlines_
+ showbox_(,dotted)
+ thicklines_
+ "\hbox{\sl E}" at Q4.E-(0,0.05) below
+ "\hbox{\sl B}sp_" at Q4.B rjust
+ "\hbox{\sl C}" at Q4.C above
+ "`{\tt bi\_tr(,{,},E)}'" at (Q4.s,Q4.E) + (0,-0.2) below
+
+Q5: igbt(,,) with .E at Q4.E+(0.65,0)
+ thinlines_
+ showbox_(,dotted)
+ thicklines_
+ "\hbox{\sl E}" at Q5.E-(0,0.05) below
+ "\hbox{\sl G}sp_" at Q5.G rjust
+ "\hbox{\sl C}" at Q5.C above
+ "`{\tt igbt}'" at Q5.s + (0,-0.35) below
+
+Q6: igbt(,,LD) with .E at Q5.E+(0.55,0)
+ thinlines_
+ showbox_(,dotted)
+ thicklines_
+ "\hbox{\sl E}" at Q6.E-(0,0.05) below
+ "\hbox{\sl G}sp_" at Q6.G rjust
+ "\hbox{\sl C}" at Q6.C above
+ "`{\tt igbt(,{,}LD)}'" at (Q6.s,Q6.E) + (0,-0.2) below
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Buffer.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Buffer.m4
new file mode 100644
index 00000000000..545875fe327
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Buffer.m4
@@ -0,0 +1,50 @@
+.PS
+# `Buffer.m4'
+log_init
+
+ bd = dimen_*3/4
+ esep = dimen_*3
+[
+ B1: BUFFER_gate(,,bd,bd)
+ thinlines_
+ { arrow <- left 0.2 up 0.2 from B1.In1; "\sl In1" wid 18bp__ rjust
+ move left 18bp__
+ `"\tt bd = dimen\_*3/4" ljust "\tt BUFFER\_gate(,{,}bd,bd)"' ljust \
+ at (last "".w,B1.s +(0,-25bp__))
+ arrow <- up 0.2 from B1.NE; "\sl NE" rjust
+ arrow <- up 0.15 right 0.15 from B1.Out; "\sl Out" above
+ arrow <- down 0.2 from B1.SE; "\sl SE" rjust
+ arrow <- right 0.3 down 0.2 from B1.C; "\sl C" ljust }
+ thicklines_
+ B2: BUFFER_gate(,N,bd,bd,NN) with .sw at B1.se+(esep,0)
+ thinlines_
+ { arrow <- left 0.2 up 0.2 from B2.In1; "\sl In1" rjust
+ arrow <- right 0.2 up 0.2 from B2.N_NE1 ; "\sl N\_NE1" ljust ht 11bp__
+ arrow <- right 0.15 up 0.15 from B2.N_NE2 ; "\sl N\_NE2" ljust
+ arrow <- down 0.15 right 0.15 from B2.Out; "\sl Out" ljust
+ `"\tt BUFFER\_gate(,N,bd,bd,NN)"' at B2.s+(0,-18bp__) }
+ thicklines_
+
+ B3: BUFFER_gen(ITNOC,bd,bd,PN,,N,LH_symbol at C) \
+ with .sw at last [].se+(esep,0)
+ { `"\tt BUFFER\_gen(ITNOC,bd,bd,PN,{,}N,"' ljust \
+ `"\tt $\;\;$LH\_symbol at C)"' ljust at B3.s+(-60bp__,-30bp__) }
+ thinlines_
+ { arrow <- left 0.2 up 0.2 from B3.In1; "\sl In1" rjust
+ arrow <- left 0.2 up 0.2 from B3.In2; "\sl In2" rjust
+ arrow <- up 0.15 right 0.15 from B3.Out; "\sl Out" above
+ arrow <- down 0.2 from B3.N_SE1; "\sl N\_SE1" rjust
+ arrow <- right 0.3 down 0.2 from B3.C; "\sl C" ljust }
+ thicklines_
+]
+
+ B4: BUFFER_gate(right_ elen_ from last [].sw+(0,-0.35),,bd,bd)
+ { `"\tt BUFFER\_gate(right\_ elen\_,{,}bd,bd)"' ljust at B4.end }
+ move to B4.start+(0,-dimen_)
+ B6: BUFFER_gate(right_ elen_,N,bd,bd,,N,LH_symbol(I) at C)
+ line down dimen_/4 from last [].N_SE1.s then left dimen_*2/3
+ {`"\tt BUFFER\_gate(right\_ elen\_,N,bd,bd,{,}N,LH\_symbol(I) at C)"' ljust \
+ `"\tt line down dimen\_/3 from last [].N\_SE1.s then left dimen\_*2/3"' \
+ ljust at B6.end }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Capture.JPG b/Master/texmf-dist/doc/latex/circuit-macros/doc/Capture.JPG
new file mode 100644
index 00000000000..8819dece9c2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Capture.JPG
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/CctTable.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/CctTable.m4
new file mode 100644
index 00000000000..4fa5405689b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/CctTable.m4
@@ -0,0 +1,90 @@
+.PS
+# `CctTable.m4'
+cct_init
+divert(-1)
+
+divert(0)dnl
+
+movewid = 2 pt__
+hm = 2.05
+vm = 0.28
+{ {resistor ; move ;"`{\tt resistor}'" ljust}
+ move right_ hm
+ {resistor(,,Q) ; move ;"`\tt resistor(,{,}Q) '" ljust}
+ move right_ hm
+ {resistor(,,E) ; move
+ "`\shortstack[l]{\tt resistor(,{,}E)\\ {\tt $\equiv$ ebox}}'" ljust}
+}
+ move down vm; right_
+{ {resistor(,,ES) ; move ;"`\tt resistor(,{,}ES) '" ljust}
+ move right_ hm
+ {resistor(,,H) ; move ;"`\tt resistor(,{,}H) '" ljust}
+ move right_ hm
+ {ebox(,,,0.5) ; move ;"`{\tt ebox(,{,},0.5)}'" ljust}
+}
+ move down vm; right_
+{ {resistor(,,V) ; move ;"`{\tt resistor(,{,}V)}'" ljust}
+ move right_ hm
+ {move down_ 0.05; right_
+ thermocouple ; move;"`{\tt thermocouple}'" ljust; move up_ 0.05}
+ move right_ hm
+ {ebox(,0.5,0.3) ; move ;"`{\tt ebox(,0.5,0.3)}'" ljust}
+}
+ move down vm; right_
+{ {inductor ; move ;"`{\tt inductor}'" ljust}
+ move right_ hm
+ {inductor(,W); move ;"`{\tt inductor(,W)}'" ljust}
+ move right_ hm
+ {inductor(,L); move ;"`{\tt inductor(,L)}'" ljust}
+}
+ move down vm; right_
+{ {inductor(,,,M) ; move ;"`{\tt inductor(,{,},M)}'" ljust}
+ move right_ hm
+ {inductor(,W,6,P); move ;"`{\tt inductor(,W,6,P)}'" ljust}
+ move right_ hm
+ {move right_ 0.2; ttmotor(,G) ; move ;"`{\tt ttmotor(,G)}'" ljust}
+}
+ move down vm; right_
+{ {capacitor ; move ;"`{\tt capacitor}'" ljust}
+ move right_ hm
+ {capacitor(,C); move ;"`{\tt capacitor(,C)}'" ljust}
+ move right_ hm
+ {capacitor(,C+); move ;"`{\tt capacitor(,C+)}'" ljust}
+}
+ move down vm; right_
+{ {capacitor(,P); move ;"`{\tt capacitor(,P)}'" ljust}
+ move right_ hm
+ {capacitor(,E); move ;"`{\tt capacitor(,E)}'" ljust}
+ move right_ hm
+ {capacitor(,K); move ;"`{\tt capacitor(,K)}'" ljust}
+}
+ move down 0.25; right_
+{ {capacitor(,M); move ;"`{\tt capacitor(,M)}'" ljust}
+ move right_ hm
+ {capacitor(,N); move ;"`{\tt capacitor(,N)}'" ljust}
+ move right_ hm
+ {xtal ; move ;"`{\tt xtal}'" ljust}
+}
+ move down 0.25; right_
+{ {memristor ; move;"`{\tt memristor}'" ljust}
+ move right_ hm
+ {heater; move;"`{\tt heater}'" ljust}
+ move right_ hm
+ {tline ; move;"`{\tt tline}'" ljust}
+}
+ move down 0.25; right_
+{ {move up_ 0.05; right_; gap ; move ;"`{\tt gap}'" ljust}
+ move right_ hm
+ {gap(,,A) ; move ;"`{\tt gap(,{,}A)}'" ljust}
+ move right_ hm
+ {arrowline ; move;"`{\tt arrowline}'" ljust}
+}
+ move down 0.25; right_
+{ {lamp ; move;"`{\tt lamp}'" ljust}
+ move right_ hm
+ {reed ; move ;"`{\tt reed}'" ljust}
+ move right_ hm
+ {reed(,,,fill_(0.9),CR) ; move ;"`{\tt reed(,{,},fill\_(0.9),CR)}'" ljust}
+}
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.bib b/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.bib
new file mode 100644
index 00000000000..a918b18bb90
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.bib
@@ -0,0 +1,155 @@
+
+@misc{Aplevich2011,
+author={Aplevich, J. D.},
+title={Drawing with dpic},
+note={In the dpic source distribution.},
+year={2015}}
+
+@book{Bentley88,
+author={Bentley, J.},
+title={More Programming Pearls},
+address={Reading, Massachusetts},
+publisher={Addison-Wesley},
+year={1988}}
+
+@misc{Bentley2010,
+author={Bentley, J. and Yepez, A.},
+title={Little Languages},
+publisher={Mississippi State University},
+note={\url{www.cse.msstate.edu/~niu/courses/CSE8990/slides/Alejandra-0210.pdf}},
+year={2010}}
+
+@misc{Clark99,
+author={Clark, A. R.},
+title={Using Circuit Macros},
+note={Courtesy of Alan Robert Clark at
+ \url{http://ytdp.ee.wits.ac.za/cct.html}},
+year={1999}}
+
+@article{Girou94,
+author={Girou, D.},
+title={Pr\'esentation de {PST}ricks},
+journal={Cahiers {GUT}enberg},
+volume={16},
+note={%
+ \url{http://cahiers.gutenberg.eu.org/cg-bin/article/CG_1994___16_21_0.pdf}},
+year={1994}}
+
+@book{Goossens97,
+author={Goossens, M. and Rahtz, S. and Mittelbach, F.},
+title={The \LaTeX Graphics Companion},
+address={Reading, Massachusetts},
+publisher={Addison-Wesley},
+year={1997}}
+
+@misc{IEEEstd,
+author={IEEE},
+title={Graphic Symbols for Electrical and Electronic Diagrams},
+note={Std 315-1975, 315A-1986, reaffirmed 1993.},
+institution={IEEE},
+year={1975}}
+
+@misc{Johnstone92,
+author={Johnstone, A.},
+title={Electronic symbols for \protect{\LaTeX}\ picture mode},
+institution={Royal Holloway, University of London},
+note={Email:{\tt adrean@cs.rhbnc.ac.uk}},
+year={1992}}
+
+@misc{KDEApps2009,
+author={KDE-Apps.org},
+title={Cirkuit},
+note={KDE application:
+ \url{http://kde-apps.org/content/show.php/Cirkuit?content=107098}
+ and later version at
+ \url{https://github.com/ag-ckt/cirkuit/tree/V0.5.0}},
+year={2009}}
+
+@techreport{KRm4,
+author={Kernighan, B. W. and Richie, D. M.},
+title={The {M4} Macro Processor},
+institution={Bell Laboratories},
+year={1977}}
+
+@techreport{KRpic,
+author={Kernighan, B. W.},
+title={{PIC}---{A} Graphics Language for Typesetting, User Manual},
+institution={AT\&T Bell Laboratories},
+series={Computing Science Technical Report},
+number={116},
+note={\url{http://doc.cat-v.org/unix/v10/10thEdMan/pic.pdf}},
+year={1991}}
+
+@book{Landauer95,
+author={Landauer, Thomas K.},
+title={The Trouble with Computers},
+address={Cambridge},
+publisher={MIT Press},
+year={1995}}
+
+@misc{Raymond95,
+author={Raymond, E. S.},
+title={Making Pictures With {GNU} {PIC}},
+note={In {GNU} groff source distribution, also in the dpic package and
+at \url{http://www.kohala.com/start/troff/gpic.raymond.ps}},
+year={1995}}
+
+@book{Sedra97,
+author={Sedra, A. S. and Smith, K. C.},
+title={Microelectronic Circuits},
+address={Oxford},
+publisher={Oxford University Press},
+year={1997}}
+
+@misc{Seindal94,
+author={Seindal {\sl et al}, R.},
+title={{GNU} m4},
+note={\url{http://www.gnu.org/software/m4/manual/m4.html}},
+institution={GNU},
+year={1994}}
+
+@misc{Verwer92,
+author={Verwer, N.},
+title={Readme for {L}oggates},
+institution={Utrecht, Dept. of Computer Science},
+note={Email:{\tt nico@cs.ruu.nl}},
+year={1992}}
+
+@techreport{dvips,
+author={Rokicki, T.},
+title={{DVIPS:} {A} {\TeX\ } Driver},
+institution={Stanford},
+year={1994}}
+
+@misc{gpic,
+author={Lemberg, W.},
+institution={The Free Software Foundation},
+title={Gpic man page},
+note={\url{http://www.manpagez.com/man/1/groff/}},
+year={2005}}
+
+@misc{metapost,
+author={Hobby, J. D.},
+title={A User's Manual for {M}eta{P}ost},
+institution={Bell Laboratories},
+year={1990}}
+
+@misc{mfpic,
+author={Leathrum, T. and Tobin, G.},
+title={Pictures in {\TeX\ }with Metafont},
+note={Mfpic manual},
+year={1996}}
+
+@misc{pstricks,
+author={Van Zandt, T.},
+title={{PST}ricks: Postscript Macros for Generic TeX},
+institution={CTAN.org},
+note={\url{http://mirrors.ctan.org/graphics/pstricks/base/doc/pst-user.pdf}},
+year={2007}}
+
+@misc{tikz,
+author={Tantau, T.},
+title={TiKz \& PGF},
+institution={CTAN.org},
+note={\url{http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf}},
+year={2013}}
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
new file mode 100644
index 00000000000..95830643bda
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.pdf
Binary files 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
new file mode 100644
index 00000000000..d1be7bc1e7f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Circuit_macros.tex
@@ -0,0 +1,88 @@
+% Circuit_macros.tex
+\documentclass{article}
+\usepackage{verbatim,url}
+\usepackage{amssymb}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\usepackage{boxdims}
+\usepackage{multicol}
+\usepackage{xspace}
+\input mode
+\usepackage{ifpdf}
+\usepackage{bookmark}
+\usepackage{pdfcomment}
+% The followowing seems to cure the problem of missing underscores:
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+%\usepackage{textcomp}
+%\usepackage{microtype}
+%\DisableLigatures{encoding=T1,family=tt*}
+%
+\addtolength{\textwidth}{3cm}
+\addtolength{\hoffset}{-1.5cm}
+\addtolength{\textheight}{4cm}
+\addtolength{\voffset}{-1in}
+\setcounter{topnumber}{3}
+
+% Exdented captions
+\makeatletter
+\long\def\@makecaption#1#2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{\hskip-3em{\bf #1:} #2}%
+ \ifdim \wd\@tempboxa >\hsize
+ \hskip-3em{\bf #1:} #2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}
+
+%%\@startsection {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE}
+%% optional * [ALTHEADING]{HEADING}
+
+\renewcommand\section{\@startsection {section}{1}{\z@}%
+ {-3.5ex \@plus -1ex \@minus -.2ex}%
+ {2.3ex \@plus.2ex}%
+ {\normalfont\Large\bfseries%
+\let\@@tmp\@svsec\def\@svsec{\llap{\@@tmp}}%
+}}
+\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
+ {-3.25ex\@plus -1ex \@minus -.2ex}%
+ {1.5ex \@plus .2ex}%
+ {\normalfont\large\bfseries%
+\let\@@tmp\@svsec\def\@svsec{\llap{\@@tmp}}%
+}}
+\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
+ {-3.25ex\@plus -1ex \@minus -.2ex}%
+ {1.5ex \@plus .2ex}%
+ {\normalfont\normalsize\bfseries%
+\let\@@tmp\@svsec\def\@svsec{\llap{\@@tmp}}%
+}}
+
+\makeatother
+
+\hypersetup{
+ pdflang=English,
+ unicode=true,
+ colorlinks=true,
+ linkcolor=purple,
+ citecolor=purple}
+
+\begin{document}
+\title{M4 Macros for Electric Circuit Diagrams in \LaTeX\ Documents}
+\author{Dwight Aplevich}
+\date{%
+\input Version
+\vspace*{-\baselineskip}
+}
+\maketitle
+
+\input body
+
+%\pdfbookmark[section]{\refname}{refs}
+\bibliographystyle{plain}
+\makeatletter
+\addcontentsline{toc}{section}{References\ \unhbox \voidb@x
+ \cleaders \hbox to.44em{\hss .\hss }\hfill \kern \z@ }
+\makeatother
+\bibliography{Circuit_macros}
+ \end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Composite.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Composite.m4
new file mode 100644
index 00000000000..c77f8c89b96
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Composite.m4
@@ -0,0 +1,58 @@
+.PS
+# Composite.m4
+log_init
+
+divert(-1)
+
+divert(0)dnl
+
+ command "{\tt"
+[
+ K1: KelvinR
+ { "`KelvinR'" at last [].C +(0,-0.25)
+ "\sl T1" at K1.T1 above
+ "\sl T2" at K1.T2 above
+ arrow <- up 0.1 left 0.1 from last [].Start ; `"\sl Start"' above
+ arrow <- up 0.1 right 0.1 from last [].End ; `"\sl End"' above }
+ K2: KelvinR(,R) with .Start at K1.End+(0.25,0.1)
+ { "`KelvinR(,R)'" at last [].C +(0,-0.25)
+ "\sl T1" at K2.T1 rjust
+ "\sl T2" at K2.T2 ljust }
+]
+
+[
+ FTcap
+ { thinlines_
+ `"FTcap"' at last [].s +(0,-0.2)
+ arrow <- up 0.1 left 0.1 from last [].Start ; `"\sl Start"' above
+ arrow <- up 0.1 right 0.1 from last [].End ; `"\sl End"' above
+ arrow <- up 0.15 left 0.1 from last [].T1 ; `"\sl T1"' rjust
+ arrow <- right 0.1 from last [].T2 ; `"\sl T2"' ljust
+ thicklines_ }
+ FTcap(B) with .w at last [].e+(0.65,0)
+ { thinlines_
+ `"FTcap(B)"' at last [].s +(0,-0.2)
+ arrow <- up 0.1 left 0.1 from last [].Start ; `"\sl Start"' above
+ arrow <- up 0.1 right 0.1 from last [].End ; `"\sl End"' above
+ arrow <- up 0.15 left 0.1 from last [].T1 ; `"\sl T1"' rjust
+ arrow <- left 0.1 from last [].T2 ; `"\sl T2"' rjust
+ thicklines_ }
+ FTcap(C) with .w at last [].e+(0.65,0)
+ { thinlines_
+ `"FTcap(C)"' at last [].s +(0,-0.2)
+ arrow <- up 0.1 left 0.1 from last [].Start ; `"\sl Start"' above
+ arrow <- up 0.1 right 0.1 from last [].End ; `"\sl End"' above
+ arrow <- left 0.1 from last [].T ; `"\sl T"' rjust
+ thicklines_ }
+ FTcap(D) with .w at last [].e+(0.65,0)
+ { thinlines_
+ `"FTcap(D)"' at last [].s +(0,-0.2)
+ arrow <- up 0.1 left 0.1 from last [].Start ; `"\sl Start"' above
+ arrow <- up 0.1 right 0.1 from last [].End ; `"\sl End"' above
+ arrow <- left 0.1 from last [].T ; `"\sl T"' rjust
+ thicklines_ }
+
+] with .sw at last [].se+(0.1,0)
+
+ command "}"
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigA.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigA.m4
new file mode 100644
index 00000000000..56fd5fe54f0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigA.m4
@@ -0,0 +1,38 @@
+.PS
+# ConfigA.m4
+sinclude(Circuit_macros.dim)
+s_init(ConfigA)
+gen_init
+ "{\tt .pic}" above
+ arrow <-
+ M4: shadebox(box wid boxht "{\tt m4}")
+
+ arrow <-
+ Conf: shadebox(box wid boxwid*2 "Configuration file")
+ s_box(\tt pstricks.m4) at Conf.nw above ljust
+
+ arrow <- from Conf.e
+ Gen: shadebox(box wid boxwid*2.25)
+ s_box(\tt libgen.m4) at Gen.nw above ljust
+ s_box(\tt\small\shortstack[l]{%
+ $\;\cdots$ \\
+ ``define(\char96cct\_init\char39,...)'' \\
+ $\;\cdots$}) with .w at 0.05 between Gen.w and Gen.e
+
+ Src: shadebox(box ht Gen.ht wid Conf.wid with .nw at Conf.sw+(0,-0.25))
+ s_box(Diagram source {\tt quick.m4}) at Src.nw above ljust
+ s_box(\tt\small\shortstack[l]{%
+ .PS \\
+ cct\_init \\
+ $\;\cdots$}) with .w at 0.05 between Src.w and Src.e
+ arrow from Src.w left linewid/2 then up M4.y-Src.y-M4.ht/4 then left linewid/2
+
+ arrow <- right from Src.e
+ Cct: shadebox(box wid boxwid*2.25)
+ s_box(\tt libcct.m4) at Cct.nw above ljust
+ s_box(\tt\small\shortstack[l]{%
+ $\;\cdots$ \\
+ ``define(\char96resistor\char39,...)'' \\
+ $\;\cdots$}) with .w at 0.05 between Cct.w and Cct.e
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigB.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigB.m4
new file mode 100644
index 00000000000..a33e57b86b8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigB.m4
@@ -0,0 +1,42 @@
+.PS
+# ConfigB.m4
+sinclude(Circuit_macros.dim)
+s_init(ConfigB)
+gen_init
+ aw = linewid/2
+ linewid = linewid*2/3
+ "{\tt .pic}" above
+ arrow <- right aw
+ M4: shadebox(box wid boxht "{\tt m4}")
+
+ arrow <- right aw
+ Src: shadebox(box wid boxwid*1.85)
+ s_box(Diagram source) at Src.nw above ljust
+ s_box(\tt\small\shortstack[l]{%
+ .PS \\
+ ``include(pstricks.m4)'' \\
+ cct\_init \\
+ $\;\cdots$}) with .w at 0.05 between Src.w and Src.e
+
+ arrow <- right aw from 0.35 between Src.ne and Src.se
+ Conf: shadebox(box wid boxwid*2 "Configuration file" with .nw at (Here,Src.n))
+ { s_box(\tt pstricks.m4) at Conf.nw above ljust }
+
+ arrow <- right aw from Conf.e
+ Gen: shadebox(box wid Conf.wid)
+ s_box(\tt libgen.m4) at Gen.nw above ljust
+ s_box(\tt\small\shortstack[l]{%
+ $\;\cdots$ \\
+ ``define(\char96cct\_init\char39,...)'' \\
+ $\;\cdots$}) with .w at 0.05 between Gen.w and Gen.e
+
+ Cct: shadebox(box wid Conf.wid with .nw at Conf.sw+(0,-0.25))
+ s_box(\tt libcct.m4) at Cct.nw above ljust
+ s_box(\tt\small\shortstack[l]{%
+ $\;\cdots$ \\
+ ``define(\char96resistor\char39,...)'' \\
+ $\;\cdots$}) with .w at 0.05 between Cct.w and Cct.e
+ dw =(Conf.w.x-Src.e.x)/2
+ arrow from Cct.w left dw then up Src.y-Cct.y-0.05 then left dw
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigC.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigC.m4
new file mode 100644
index 00000000000..ccf8bae2d77
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/ConfigC.m4
@@ -0,0 +1,43 @@
+.PS
+# ConfigC.m4
+sinclude(Circuit_macros.dim)
+s_init(ConfigC)
+gen_init
+ aw = linewid/2
+ linewid = linewid*2/3
+ "{\tt .pic}" above
+ arrow <- right aw
+ M4: shadebox(box wid boxht "{\tt m4}")
+
+ arrow <- right aw
+ Src: shadebox(box wid boxwid*1.85)
+ s_box(Diagram source) at Src.nw above ljust
+ s_box(\tt\small\shortstack[l]{%
+ .PS \\
+ ``include(libgen.m4)'' \\
+ cct\_init \\
+ $\;\cdots$}) with .w at 0.05 between Src.w and Src.e
+
+ arrow <- right aw from 0.35 between Src.ne and Src.se
+ Gen: shadebox(box wid boxwid*2.25 with .nw at (Here,Src.n))
+ s_box(\tt libgen.m4) at Gen.nw above ljust
+ s_box(\tt\small\shortstack[l]{%
+ ``if..include(pstricks.m4)'' \\
+ $\;\cdots$ \\
+ ``define(\char96cct\_init\char39,...)'' \\
+ $\;\cdots$}) with .w at 0.05 between Gen.w and Gen.e
+ arrow <- right aw from Gen.e
+ Conf: shadebox(box wid boxwid*1.8 "Configuration file")
+ { s_box(\tt pstricks.m4) at Conf.nw above ljust }
+
+
+ Cct: shadebox(box wid Gen.wid with .nw at Gen.sw+(0,-0.25))
+ s_box(\tt libcct.m4) at Cct.nw above ljust
+ s_box(\tt\small\shortstack[l]{%
+ $\;\cdots$ \\
+ ``define(\char96resistor\char39,...)'' \\
+ $\;\cdots$}) with .w at 0.05 between Cct.w and Cct.e
+ dw =(Cct.w.x-Src.e.x)/2
+ arrow from Cct.w left dw then up Src.y-Cct.y-0.05 then left dw
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Conn.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Conn.m4
new file mode 100644
index 00000000000..7253d2b313e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Conn.m4
@@ -0,0 +1,69 @@
+.PS
+# `Conn.m4'
+cct_init
+
+T:[
+ ifelse(ifmpost(T)`'ifpostscript(T),,`command "{\sf"')
+ S1: tstrip(U)
+ thinlines_
+ arrow <- left 0.15 from S1.L1; "L1" rjust
+ arrow <- left 0.15 from S1.L4; "L4" wid 0.2 rjust
+ "$\vdots$" at (0.5 between last "" and 2nd last "")+(-0.15,0.02)
+ arrow <- right 0.25 from S1.R1; "R1" ljust
+ arrow <- right 0.25 from S1.R4; "R4" ljust
+ "$\vdots$" at (0.5 between last "" and 2nd last "")+(0.15,0.02)
+ arrow <- right 0.15 up 0.10 from S1.T1; "T1" ljust
+ arrow <- right 0.15 up 0.10 from S1.T4; "T4" ht 11 pt__ ljust
+ "$\vdots$" at (0.5 between last "" and 2nd last "")+(0.15,0.02)
+ thicklines_
+ CS1: "`\tt tstrip(U)'" at S1.s+(0,-0.15)
+ S2: tstrip(R,5,DO;wid=1.0;ht=0.25) with .sw at S1.se+(0.7,0.15)
+ thinlines_
+ arrow <- up 0.2 right 0.1 from S2.T1; "T1" above
+ arrow <- up 0.2 right 0.1 from S2.T5; "T5" above
+ "$\cdots$" at 0.5 between last "" and 2nd last "" above
+ CS2: `"\tt tstrip(R,5,"' ht 0.1 ljust \
+ `"\tt $\;\;$DO;wid=1.0;ht=0.25)"' ljust at S2.sw+(-0.1,-0.2)
+ ifelse(ifmpost(T)`'ifpostscript(T),,`command "}"')
+]
+
+C: [
+ C1: ccoax
+ `"\tt ccoax\vphantom{(}"' ht 11 pt__ at C1.s below
+ thinlines_
+ arrow <- up 0.1 right 0.1 from C1.C.ne; "C" ljust
+ arrow <- down 0.05 right 0.1 from C1.S.e; "S" wid 0.1 ht 11pt__ ljust
+ thicklines_
+ C2: ccoax(at C1+(0,0.3),F)
+ `"\tt ccoax(,F)"' ht 11 pt__ wid 0.65 at C2.ne ljust
+ ] with .C1.sw at T.S2.se+(0.5,0.0)
+
+Y: [
+ tconn(,O)
+ {`"\tt tconn(,O)"' at last line.c+(0,-0.2) wid 43 pt__ }
+ move to Here+(0.3,0)
+ P1: tconn(,>)
+ {`"\tt (,>)"' at last line.c+(0,-0.2)}
+ move to P1.end+(0.3,0)
+ tconn(,>>)
+ {`"\tt (,>>)"' at last line.c+(0,-0.2)}
+ move to P1.start+(0,linewid)
+ P3: tconn(,<)
+ {`"\tt tconn(,<)"' at last line.c+(0,-0.2)}
+ move to P3.end+(0.3,0)
+ tconn(,<<)
+ {`"\tt (,<<)"' at last line.c+(0,-0.2)}
+
+] with .sw at (C.e.x-0.4,T.s.y)
+
+B: [
+ tbox(V_2)
+ `"\tt tbox(V\_2)"' at last [].sw below ljust
+ [ left_;
+ tbox(V_1,,,<>) ] with .nw at last [].sw+(0,-0.25)
+ `"\tt tbox(V\_1,{,},<>)"' at last [].sw below ljust
+# `"\tt left\_"' at last [].sw +(0,-0.2) ljust `"\tt tbox(V\_1)"' ljust
+] with .nw at Y.ne+(0.2,0)
+
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Corners.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Corners.m4
new file mode 100644
index 00000000000..4873af1fa94
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Corners.m4
@@ -0,0 +1,73 @@
+.PS
+# `Corners.m4'
+cct_init
+s_init(Corners)
+sinclude(Circuit_macros.dim)
+
+linethick = 4
+[
+ [ [ line up 0.2
+ line from Here+(0.2,0) left 0.2 ]
+ s_box(`\tt\shortstack[l]{line up 0.2\\ line right 0.2}') \
+ with .n at last [].s +(0,-0.1)
+ ]
+
+ [ [ line up 0.2 then right 0.2 ]
+ s_box(`\tt\shortstack[l]{line up 0.2 \bsl\\ \enskip then right 0.2}') \
+ with .n at last [].s +(0,-0.1)
+ ] with .nw at last [].ne+(0.25,0)
+
+ [ [ line up 0.2
+ line right 0.2 chop -hlth chop 0 ]
+ s_box(`\tt\shortstack[l]{%
+ line up 0.2\\ line right 0.2 \bsl\\ \enskip chop `-hlth' chop 0}') \
+ with .n at last [].s +(0,-0.1)
+ ] with .nw at last [].ne+(0.25,0)
+
+ [ [ line up 0.2
+ round
+ line right 0.2 ]
+ s_box(`\tt\shortstack[l]{%
+ line up 0.2\\`\smash{round}\vphantom{r}'\\ line right 0.2}') \
+ with .n at last [].s +(0,-0.1)
+ ] with .nw at last [].ne+(0.25,0)
+ ]
+
+[
+ [ [ line up 0.15 left 0.15
+ corner
+ line up 0.1 right 0.1 ]
+ s_box(`\tt\shortstack[l]{%
+ line up 0.15 left 0.15\\`corner'\\ line up 0.1 right 0.1}') \
+ with .n at last [].s +(0,-0.1)
+ ]
+
+ [ [ A: Here
+ corner(,at A)
+ s_box(`\sl A') at A below ]
+ s_box(`\tt c`'orner(,at A)') with .n at last [].s +(0,-0.1)
+ ] with .nw at last [].ne+(0.2,0)
+
+ [ [ L: line right 0.2 down 0.3 outlined "lightgray"
+ M: line up 0.2 right 0.1 outlined "lightgray"
+ s_box(\sl L) at L.c+(-0.1,-0.05)
+ s_box(\sl M) at M.c+( 0.13,0)
+ Mitre_(L,M,5 bp__) ]
+ s_box(`\tt Mitre\_(L,M,5 bp\_\_)') with .n at last [].s +(0,-0.1)
+ ] with .nw at last [].ne+(0.2,0)
+
+ [ [ A: (0,0)
+ B: (0.3,0.2)
+ C: (0.5,0.1)
+ line outlined "lightgray" from A to B
+ line outlined "lightgray" from C to B
+ s_box(\sl A) at A rjust
+ s_box(\sl B) at B+(0,2pt__) above
+ s_box(\sl C) at C ljust
+ mitre_(A,B,C) ]
+ s_box(\tt mitre\_(A,B,C)) with .n at last [].s +(0,-0.1)
+ ] with .nw at last [].ne+(0.2,0)
+
+ ] with .nw at last [].sw+(0,-0.1)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Dac.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Dac.m4
new file mode 100644
index 00000000000..77dda3cf557
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Dac.m4
@@ -0,0 +1,69 @@
+.PS
+# Dac.m4
+cct_init
+s_init(Dacx)
+
+ ar = 0.15
+
+Q: dac
+thinlines_
+ arrow <- left ar from last [].In1; { move left 0.15 }
+ "In1" above rjust at Here+(0.1,0)
+ "\sl NW" at Q.NW above rjust
+ "\sl SW" at Q.SW below rjust
+ "\sl SE" at Q.SE below ljust
+ "\sl NE" at Q.NE above ljust
+ arrow <- up ar from Q.N1; "\sl N1" above
+ arrow <- down ar from Q.S1; "\sl S1" below
+ arrow <- right ar from Q.Out1; "\sl Out1" above ljust at Here-(0.1,0)
+ arrow <- right ar down ar/2 from Q.C; "\sl C" ljust
+ s_box(`\tt d`'ac') at Q.s+(0,-0.3) below
+thicklines_
+
+Q:dac(,,2,2,3,3) with .w at last [].e+(0.9,0)
+thinlines_
+ "DAC" at Q.C
+ arrow <- left ar from Q.In1; "\sl In1" rjust
+ arrow <- left ar from Q.In2; "\sl In2" rjust
+ arrow <- up ar from Q.N1; "\sl N1" above rjust
+ arrow <- up ar from Q.N2; "\sl N2" above ljust
+ arrow <- right ar from Q.Out1; "\sl Out1" ljust
+ arrow <- right ar from Q.Out2; "\sl Out2" ljust
+ arrow <- right ar from Q.Out3; "\sl Out3" ljust
+ arrow <- down ar left ar/2 from Q.S1; "\sl S1" below rjust
+ arrow <- down ar from Q.S2; "\sl S2" below
+ arrow <- down ar right ar/2 from Q.S3; "\sl S3" below ljust
+ s_box(
+ `\tt Q: d`'ac(,{,}2,2,3,3); \"DAC\" \"2\" at Q.C') at Q.s+(0,-0.3) below
+thicklines_
+
+Q: adc with .nw at last [].ne + (0.9,0)
+thinlines_
+ "\sl NW" at Q.NW above rjust
+ "\sl SW" at Q.SW below rjust
+ "\sl SE" at Q.SE below ljust
+ "\sl NE" at Q.NE above ljust
+ arrow <- left ar from Q.In1; "\sl In1" rjust above at Here+(0.1,0)
+ arrow <- up ar from Q.N1; "\sl N1" above
+ arrow <- down ar from Q.S1; "\sl S1" below
+ arrow <- right ar from Q.Out1; "\sl Out1" ljust above at Here-(0.1,0)
+ arrow <- left ar down ar/2 from Q.C; "\sl C" rjust
+ s_box(`\tt a`'dc') at Q.s+(0,-0.3) below
+thicklines_
+
+Q:adc(,,2,2,3,3) with .w at last [].e+(0.8,0)
+thinlines_
+ "ADC" at Q.C
+ arrow <- left ar from Q.In1; "\sl In1" rjust
+ arrow <- left ar from Q.In2; "\sl In2" rjust
+ arrow <- up ar from Q.N1; "\sl N1" above rjust
+ arrow <- up ar from Q.N2; "\sl N2" above ljust
+ arrow <- right ar from Q.Out1; "\sl Out1" ljust
+ arrow <- right ar from Q.Out2; "\sl Out2" ljust
+ arrow <- right ar from Q.Out3; "\sl Out3" ljust
+ arrow <- down ar left ar/2 from Q.S1; "\sl S1" below rjust
+ arrow <- down ar from Q.S2; "\sl S2" below
+ arrow <- down ar right ar/2 from Q.S3; "\sl S3" below ljust
+ s_box(`\tt a`'dc(,{,}2,2,3,3)') at Q.s+(0,-0.3) below
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Darlington.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Darlington.m4
new file mode 100644
index 00000000000..234c86e558a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Darlington.m4
@@ -0,0 +1,36 @@
+.PS
+# `Darlington.m4'
+cct_init
+
+up_
+Darlington
+{ "\sl E" at last [].E below ljust
+ "\sl B" at last [].B rjust
+ "\sl C" at last [].C above ljust
+ `"\tt Darlington"' at last [].s+(0,-10bp__) below }
+Darlington(R,DZB1) with .sw at last [].se+(0.5,0)
+{ "\sl E" at last [].E below rjust
+ "\sl B" at last [].B ljust
+ "\sl B1" at last [].B1 below
+ "\sl C" at last [].C above rjust
+ `"\tt (R,DZB1)"' at last [].s+(0,-10bp__) below }
+Darlington(,EB1) with .sw at last [].se+(0.5,0)
+{ "\sl E" at last [].E below ljust
+ "\sl B" at last [].B rjust
+ "\sl B1" at last [].B1 rjust
+ "\sl C" at last [].C above ljust
+ `"\tt (,EB1)"' at last [].s+(0,-10bp__) below }
+Darlington(,EB1DZR1) with .sw at last [].se+(0.5,0)
+{ "\sl E" at last [].E below ljust
+ "\sl B" at last [].B rjust
+ "\sl B1" at last [].B1 below rjust
+ "\sl C" at last [].C above ljust
+ `"\tt (,EB1DZR1)"' at last [].s+(0,-10bp__) below }
+Darlington(,EB1DE1E2) with .sw at last [].se+(0.5,0)
+{ "\sl E" at last [].E below ljust
+ "\sl B" at last [].B rjust
+ "\sl B1" at last [].B1 below rjust
+ "\sl C" at last [].C above ljust
+ `"\tt (,EB1DE1E2)"' at last [].s+(0,-10bp__) below }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Demultiplexer.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Demultiplexer.m4
new file mode 100644
index 00000000000..210b6434412
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Demultiplexer.m4
@@ -0,0 +1,44 @@
+.PS
+# `Demultiplexer.m4'
+log_init
+
+ ifmpost(`command "verbatimtex {\sf etex"',
+ `ifpostscript(,
+ `command "{\sf"')')
+
+ right_
+
+ Demux(4,DM1)
+ `"\tt Demux(4,DM1)"' at last [].s below
+ `"\sl Out0"' at last [].Out0.end +(6bp__,6bp__)
+ `"\sl Out3"' at last [].Out3.end +(6bp__,-6bp__)
+ `"\sl In"' at last [].In.end rjust wid 11bp__
+ `"\sl Sel"' at last [].Sel.end ljust above
+ left_; Demux(4,,LOE) with .c at last [].c+(1.2,0)
+ `"\tt left\_; Demux(4,{,}LOE)"' at last [].s + (0,-20bp__) ht 10bp__
+ `"\sl Sel"' at last [].Sel.end rjust
+ `"\sl Out0"' at last [].Out0.end +(-6bp__,6bp__)
+ `"\sl OE"' at last [].OE.end ljust
+ `"\sl In"' at last [].In.end+(0,5bp__) ljust
+ right_; Demux(4,,NOEBN2) with .c at last [].c+(1.2,0)
+ `"\tt (4,{,}NOEBN2)"' at last [].s below
+ `"\sl Sel0"' at last [].Sel0.end rjust
+ `"\sl Sel1"' at last [].Sel1.end ljust
+ `"\sl Out0"' at last [].Out0.end +(5bp__,6bp__)
+ `"\sl Out3"' at last [].Out3.end +(5bp__,6bp__)
+ `"\sl NOE"' at last [].NOE.end rjust
+ `"\sl In"' at last [].In.end above
+ down_; Demux(8,,L3,,28*L_unit) with .c at last [].c+(1.8,0)
+ `"\tt down\_; Demux(8,{,}L3,{,}28*L\_unit)"' at last [].s+(0,-15bp__) \
+ ht 10bp__ wid 170bp__
+ `"\sl Sel0"' at last [].Sel0.end rjust
+ `"\sl Sel2"' at last [].Sel2.end rjust below
+ `"\sl Out0"' at last [].Out0.end rjust
+ `"\sl Out7"' at last [].Out7.end ljust
+ `"\sl In"' at last [].In.end rjust
+
+ifmpost(`command "verbatimtex } etex"',
+`ifpostscript(,
+`command "}"')')
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Diodes.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Diodes.m4
new file mode 100644
index 00000000000..360d8e9d9e0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Diodes.m4
@@ -0,0 +1,48 @@
+.PS
+# `Diodes.m4'
+cct_init
+movewid = 2pt__
+{ {diode ; move ; "`{\tt diode}'" ljust}
+ move down 0.2; right_
+ {diode(,S) ; move ; "`{\tt diode(,S)}'" ljust}
+ move down 0.2; right_
+ {diode(,V) ; move ; "`{\tt diode(,V)}'" ljust}
+ move down 0.2; right_
+ {diode(,v) ; move ; "`{\tt diode(,v)}'" ljust}
+ move down 0.2; right_
+ {diode(,w) ; move ; "`{\tt diode(,w)}'" ljust}
+ move down 0.2; right_
+ {diode(,B) ; move ; "`{\tt diode(,B)}'" ljust}
+ move down 0.2; right_
+ {diode(,G) ; move ; "`{\tt diode(,G)}'" ljust}
+ }
+
+ move right_ 2.0
+{ {diode(,K) ; move ; "`{\tt diode(,K)}'" ljust}
+ move down 0.2; right_
+ {diode(,ZK) ; move ; "`{\tt diode(,ZK)}'" ljust}
+ move down 0.2; right_
+ {diode(,CR) ; move ; "`{\tt diode(,CR)}'" ljust}
+ move down 0.2; right_
+ {diode(,L) ; move ; "`{\tt diode(,L)}'" ljust}
+ move down 0.2; right_
+ {diode(,F) ; move ; "`{\tt diode(,F)}'" ljust}
+ move down 0.2; right_
+ {diode(,Sh) ; move ; "`{\tt diode(,Sh)}'" ljust}
+ move down 0.2; right_
+ {diode(,D) ; move ; "`{\tt diode(,D)}'" ljust}
+ }
+
+ move right_ 2.0
+{ {diode(,Z,RE) ; move ; "`{\tt diode(,Z,RE)}'" ljust}
+ move down 0.25; right_
+ {diode(,T) ; move ; "`{\tt diode(,T)}'" ljust}
+ move down 0.30; right_
+ {diode(,P) ; move ; "`{\tt diode(,P)}'" ljust}
+ move down 0.30; right_
+ {diode(,LE) ; move ; "`{\tt diode(,LE)}'" ljust}
+ move down 0.15; right_
+ {diode(,LER) ; move ; "`{\tt diode(,LER)}'" ljust}
+ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Emarrows.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Emarrows.m4
new file mode 100644
index 00000000000..c4b21319023
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Emarrows.m4
@@ -0,0 +1,30 @@
+.PS
+# `Emarrows.m4'
+cct_init
+ hskip = 0.6
+[
+ { em_arrows(N)
+ box dotted wid last [].wid ht last [].ht at last [].c
+ thinlines_
+ arrow <- left 0.15 from last [].Head; "\sl Head" wid 0.31 rjust
+ arrow <- down 0.12 from last [].Tail; "\sl Tail" below
+ "\sl A1" rjust below at last [].A1.c
+ "\sl A2" ljust above at last [].A2.c
+ thicklines_
+ move down 0.25 from last [].s
+ move up 0.2 from last [].n
+ "\tt em\_arrows(N)" at last [].s+(0,-0.20) below }
+ { em_arrows(ND,45) with .sw at last [].se+(hskip*1.5,0)
+ "\tt em\_arrows(ND,45)" at last [].s below }
+ { em_arrows(I) with .sw at last [].se+(hskip,0)
+ "\tt $\ldots$(I)" at last [].s below }
+ { em_arrows(ID) with .sw at last [].se+(hskip,0)
+ "\tt $\ldots$(ID)" at last [].s below }
+ { em_arrows(E) with .sw at last [].se+(hskip,0)
+ "\tt $\ldots$(E)" at last [].s below }
+ { em_arrows(ED) with .sw at last [].se+(hskip,0)
+ "\tt $\ldots$(ED)" at last [].s below }
+ ]
+#showbox_
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/FF.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/FF.m4
new file mode 100644
index 00000000000..e8bdafe2398
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/FF.m4
@@ -0,0 +1,11 @@
+.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
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/FlipFlop.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/FlipFlop.m4
new file mode 100644
index 00000000000..c04ca6ba896
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/FlipFlop.m4
@@ -0,0 +1,32 @@
+.PS
+# `FlipFlop.m4'
+log_init
+iflatex(`textoffset = 1bp__; ifpsfrag(,`latexcommand({\sf)') ')
+s_init(Flipflop)
+sinclude(Circuit_macros.dim)
+right_
+ { Q1: FlipFlop(D,Q1)
+ s_box(``\tt FlipFlop(D,Q1)'') at last [].Chip.s below
+ h1 = L_unit*20
+ w1 = L_unit*12
+ FlipFlop(T,Q2,ht h1 wid w1 fill_(0.9)) with .w at last [].e+(0.25,0)
+ s_box(``\tt FlipFlop(T,Q2,ht h1 wid w1 fill\_(0.9))'') \
+ at (last [].Chip,2nd last [].Chip.s)+(0,-0.25)
+ FlipFlop(RS) with .w at last [].e+(0.25,0)
+ s_box(``\tt FlipFlop(RS)'') at last [].Chip.s below
+ FlipFlop(JK) with .w at last [].e+(0.25,0)
+ s_box(``\tt FlipFlop(JK)'') with .n at last [].PinPR.end
+ }
+ move down 1.5; right_
+ { FlipFlopX(,,:D;E:CK,,:Q;:lg_bartxt(Q))
+ s_box(``\shortstack[l]{\tt FlipFlopX(,{,}\\
+ \tt\quad:D;E:CK,{,}:Q;:lg\_bartxt(Q))}'') at last [].Chip.s below
+ FlipFlopX(,,:T;E:CK,,:Q;) with .Chip.c at last [].e+(1.25,0)
+ s_box(``\shortstack[l]{\tt FlipFlopX(,{,}\\
+ \tt\quad:T;E:CK,{,}:Q;)}'') at last [].Chip.s below
+ FlipFlopX(,,:J;E:CK;:K,N:CLR,:Q;) with .Chip.c at last [].e+(1.25,0)
+ s_box(``\shortstack[l]{\tt FlipFlopX(,{,} \\
+ \tt\quad:J;E:CK;:K,N:CLR,:Q;)}'') at last [].Chip.s below
+ }
+ iflatex(ifpsfrag(,`latexcommand(})'))
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Flowdiag.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Flowdiag.m4
new file mode 100644
index 00000000000..5af78953f0e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Flowdiag.m4
@@ -0,0 +1,33 @@
+.PS
+# `Flowdiag.m4'
+define(`shadellipse',`{ellipse $1 fill invis
+ define(`m4h',`1.0 pt__')dnl
+ ellipse invis fill 0.5 wid last ellipse .wid+linethick pt__ \
+ ht last ellipse .ht + linethick pt__ at last ellipse+(m4h,-m4h)}
+ ellipse fill 1 $1')
+
+ shadellipse "{\tt .m4}" "diagram"
+ arrow right linewid*2/3
+
+ {shadellipse(with .b at Here+(-linewid*0.5,boxht/3+linewid/3)) \
+ "{\tt .m4}" "macros"}
+ arrow from last ellipse.b down linewid/3 then right linewid*0.5
+ move down boxht/6; right
+
+ shadebox(box wid boxht "{\bf m4}")
+ arrow right linewid/2
+
+ shadebox(box "{\bf pic}" "interpreter")
+ arrow right from Here-(0,boxht/6)
+
+ {shadellipse(with .b at Here+(-linewid*0.5,boxht/3+linewid/3)) \
+ "{\tt .tex}" "files"}
+ {arrow from last ellipse.b down linewid/3 then right linewid*0.5}
+ move up boxht/6; right
+
+ shadebox(box "\LaTeX" "or" "PDFlatex")
+ arrow right linewid*2/3
+
+ shadebox(box wid boxht "{\tt .dvi}" "or" "{\tt .pdf}")
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Fuses.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Fuses.m4
new file mode 100644
index 00000000000..b308e5aadbd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Fuses.m4
@@ -0,0 +1,32 @@
+.PS
+# `Fuses.m4'
+cct_init
+
+movewid = 0.25
+
+ {fuse ; {"`{\tt fuse}'" at last line.c+(0,-0.2)}
+ move
+ fuse(,D) ; {"`{\tt fuse(,D)}'" at last line.c+(0,-0.2)}
+ move
+ fuse(,B) ; {"`{\tt fuse(,B)}'" at last line.c+(0,-0.2)}
+ move
+ fuse(,C) ; {"`{\tt fuse(,C)}'" at last line.c+(0,-0.2)}
+ move
+ fuse(,S) ; {"`{\tt fuse(,S)}'" at last line.c+(0,-0.2)}
+ move
+ fuse(,HB) ; {"`{\tt fuse(,HB)}'" at last line.c+(0,-0.2)}
+ }
+ move down; right_
+ fuse(,HC,0.5,0.3) ; {"`{\tt (,HC,0.5,0.3)}'" at last line.c+(0,-0.25)}
+ move
+ cbreaker; {"`{\tt cbreaker}'" at last line.c+(0,-0.25)}
+ move
+ cbreaker(,R); {"`{\tt cbreaker(,R)}'" at last line.c+(0,-0.25)}
+ move
+ cbreaker(,{,}D); {"`{\tt $\ldots$(,{,}D)}'" at last line.c+(0,-0.25)}
+ move
+ cbreaker(,{,}T); {"`{\tt $\ldots$(,{,}T)}'" at last line.c+(0,-0.25)}
+ move
+ cbreaker(,{,}TS); {"`{\tt $\ldots$(,{,}TS)}'" at last line.c+(0,-0.25)}
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Grounds.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Grounds.m4
new file mode 100644
index 00000000000..13b4730b801
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Grounds.m4
@@ -0,0 +1,39 @@
+.PS
+# `Grounds.m4'
+cct_init
+
+sep = 0.65
+Ground: ground
+ move right sep
+GT: ground(,T)
+ move right sep
+GF: ground(,,F)
+ move right sep
+GE: ground(,,E)
+ move right sep
+
+B: Here+(0,-0.5) ; {
+ "{\tt `ground'}" wid 32bp__ at (Ground,B)
+ "{\tt `ground'(,T)}" at (GT,B)+(0,7bp__)
+ "{\tt (,{,}F)}" at (GF,B)
+ "{\tt (,{,}E)}" at (GE,B)}
+
+
+GS: ground(,,S)
+ move right sep
+GS90: [ground(,,S,90) ] with .n at Here
+ move right sep from GS90.n
+GQ: ground(,,Q)
+ move right sep
+GL: ground(,,L)
+ move right sep
+GP: ground(,,P)
+
+C: Here+(0,-0.5)
+ "{\tt (,{,}S)}" at (GS,C)
+ "{\tt (,{,}S,90)}" at (GS90,C)
+ "{\tt (,{,}Q)}" at (GQ,C)
+ "{\tt (,{,}L)}" at (GL,C)
+ "{\tt (,{,}P)}" at (GP,C)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Headers.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Headers.m4
new file mode 100644
index 00000000000..a4e1abce3b8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Headers.m4
@@ -0,0 +1,37 @@
+.PS
+# Headers.m4
+log_init
+
+ Header
+ {"\sl P1" at last [].P1 rjust
+ `"\tt Header"' at last [].s+(0,-10pt__)
+ "\sl P2" at last [].P2 rjust}
+
+ Header(2,3,8mm__,10mm__) with .nw at last [].ne+(0.75,-0.05)
+ {"\sl P1" at last [].P1 rjust
+ `"\tt Header(2,3,8mm\_\_,10mm\_\_)"' at last [].s+(0,-10pt__)
+ "\sl P2" at last [].P2 ljust
+ "\sl P5" at last [].P5 rjust
+ "\sl P6" at last [].P6 ljust}
+
+ left_
+ Header(2,4,,,fill_(0.9)) with .sw at last [].se+(0.75,0)
+ {"\sl P1" at last [].P1 rjust_
+ `"\tt left\_; Header(2,4,{,},fill\_(0.9))"' at last [].s+(0,-20pt__)
+ "\sl P8" at last [].P8 ljust_}
+
+ down_
+ Header(2,8) with .nw at last [].ne+(0.75,0)
+ {"\sl P1" at last [].P1 ljust
+ "\sl P2" at last [].P2 ljust
+ `"\tt down\_; Header(2,8)" ' at last [].s+(0,-10pt__)
+ "\sl P15" at last [].P15 rjust
+ "\sl P16" at last [].P16 rjust}
+ {thinlines_
+ arrow <- right 0.15 from last [].PinP1.e
+ `"\sl PinP1"' ljust
+ arrow <- right 0.15 from last [].PinP2.e
+ `"\sl PinP2"' ljust
+ thicklines_ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/HybridPi.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/HybridPi.m4
new file mode 100644
index 00000000000..3b89b5ddda2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/HybridPi.m4
@@ -0,0 +1,54 @@
+.PS
+cct_init
+linewid = linewid*6/6.2435
+command "{\sf"
+# `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
+
+ 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' ] ')
+
+[
+Q: hybrid_PI_BJT
+ "Base" at Q.Base +(0.15,0.1)
+ "Emitter" ht 0.1 wid 0.5 at Q.Emitter.w rjust
+ "Collector" ht 0.1 at Q.Collector +(-0.2,0.1)
+ `"hybrid\_PI\_BJT"' ht 0.1 at Q.s+(0,-0.2)
+ hybrid_PI_BJT(M) with .Collector at last [].Collector+(0.15,0)
+ `"hybrid\_PI\_BJT(M)"' ht 0.1 at last [].s+(0,-0.2)
+ hybrid_PI_BJT(LM) with .w at last [].e
+ `"hybrid\_PI\_BJT(LM)"' ht 0.1 at last [].s+(0,-0.2)
+Point_(45)
+ hybrid_PI_BJT with .Emitter at last [].Base+(elen_*1.75,0.1)
+ `"\shortstack[l]{Point\_(45)\\ hybrid\_PI\_BJT}"' \
+ ht 0.25 at last [].s+(0.2,-0.2)
+]
+#print last [].wid
+
+command "}%"
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Jack.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Jack.m4
new file mode 100644
index 00000000000..3c56061e674
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Jack.m4
@@ -0,0 +1,78 @@
+.PS
+# `Jack.m4'
+cct_init
+
+P: [
+ P1: plug
+ "\sl A" wid 0.1 at P1.A rjust
+ "\sl B" at P1.B rjust
+ "\sl TB" at P1.TB ljust above
+ "\sl TA" at P1.TA ljust below
+ P2: plug(,R) with .B at P1.A+(0.85,0)
+ "\sl A" wid 0.1 at P2.A rjust
+ "\sl B" at P2.B rjust
+# P3: plug(L) with .A at P2.A+(1,0)
+# "\sl A" wid 0.1 at P3.A ljust
+# "\sl B" at P3.B ljust
+ P4: plug(,3) with .A at P2.B+(0.85,0)
+ "\sl A" at P4.A rjust
+ "\sl B" at P4.B rjust
+ "\sl C" at P4.C rjust
+ P5: plug(L,3R) with .A at P4.A+(1,0)
+ "\sl A" wid 0.1 at P5.A ljust
+ "\sl B" at P5.B ljust
+ "\sl C" at P5.C ljust
+ `"\tt plug"' below at P1.s+(0,-0.1)
+ `"\tt plug(,R)"' below at P2.s+(0,-0.1)
+# `"\tt plug(L)"' below at P3.s+(0,-0.1)
+ `"\tt plug(,3)"' below at P4.s+(-0.1,-0.1)
+ `"\tt plug(L,3R)"' below at P5.s+(0.1,-0.1)
+]
+
+L: [ right_
+ J1: jack
+ thinlines_
+ "\sl L" wid 0.1 rjust at J1.L
+ arrow <- right 0.1 from J1.F; "\sl F" ljust
+ arrow <- down 0.1 from J1.G then left 0.1 ; "\sl G" rjust
+ thicklines_
+ J2:[K2: jack(,LMBS) #with .F at J1.F+(1.2,0)
+ thinlines_
+ "\sl L" rjust at K2.L
+ arrow <- from K2.LM left 0.25; "\sl LM" wid 0.18 rjust
+ arrow <- from K2.LB left 0.25; "\sl LB" rjust
+ "\sl S" rjust at K2.S
+ thicklines_ ] with .K2.F at J1.F+(1.2,0)
+ J3: jack(L,RLS) with .F at J2.K2.F+(0.4,0)
+ thinlines_
+ "\sl L" ljust at J3.L
+ "\sl S" ljust at J3.S
+ thicklines_
+ J4: jack(L,RLBLMLMS) with .F at J3.F+(1.1,0)
+ thinlines_
+ "\sl L1" ljust at J4.L1
+ arrow <- right 0.3 from J4.LM1; "\sl LM1" ljust
+ "\sl L2" ljust at J4.L2
+ arrow <- right 0.3 from J4.LM2; "\sl LM2" wid 0.2 ht 11pt__ ljust
+ "\sl S" ljust at J4.S
+ "\sl L" ljust at J4.L
+ arrow <- right 0.2 from J4.LB ; "\sl LB" ljust
+ right_
+ J5: jack(,RSBSMLB) with .F at J4.F+(1.95,0)
+ thinlines_
+ "\sl L" rjust at J5.L
+ "\sl S" rjust at J5.S
+ "\sl S1" rjust at J5.S1
+ arrow <- left 0.3 from J5.SM1; "\sl SM1" rjust
+ spline 0.5 <- left 0.25 then left 0.1 down 0.05 from J5.LB; "\sl LB" rjust
+ spline 0.5 <- left 0.25 then left 0.1 up 0.05 from J5.SB; "\sl SB" rjust
+ thicklines_
+
+ `"\tt jack"' ht 0.15 below at J1.s+(0,-0.15)
+ `"\tt jack(,LMBS)"' below at (J2,last "")
+ `"\tt ..(L,RLS)"' below at (J3,last "")
+ `"\tt ..(L,RLBLMLMS)"' below at (J4,last "")
+ `"\tt ..(,RSBSMLB)"' below at (J5,last "")
+] with .nw at P.sw + (0,0.1)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Logic.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Logic.m4
new file mode 100644
index 00000000000..d42e02768eb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Logic.m4
@@ -0,0 +1,62 @@
+.PS
+# Logic.m4
+cct_init
+ifdef(`AND_gate',,`include(liblog.m4)')
+xgap = 0.6
+[ dmov = 0.4
+{ {AND_gate ; "{\tt AND\_gate}" ljust at last [].w + (xgap,0)}
+ move down dmov; right_
+ {OR_gate ; "{\tt OR\_gate}" ljust at last [].w + (xgap,0)}
+ move down dmov; right_
+ {BUFFER_gate ; "{\tt BUFFER\_gate}" ljust at last [].w + (xgap,0)}
+ move down dmov; right_
+ {XOR_gate ; "{\tt XOR\_gate}" ljust at last [].w + (xgap,0)}
+ }
+
+ move right_ 140pt__
+{ { NAND_gate; "{\tt NAND\_gate}" ljust at last [].w + (xgap,0) }
+ move down dmov; right_
+ { Gate: NOR_gate(3)
+ "{\tt NOR\_gate(3)}" ljust at last [].w + (xgap,0)
+ thinlines_
+ spline <- from Gate.Out right arrowht*2.0 \
+ then up 0.15 then right 0.05
+ "{\tt Out}" ljust
+ spline <- from Gate.N_Out down arrowht*2.0 \
+ then right 0.1+arrowht*1.5+NOT_rad down 0.15-arrowht*2.0
+ "{\tt N\_Out}" ljust
+ for_(1,3,1,
+ `arrow <- left 0.2 down 0.05 from Gate.In`'m4x
+ "{\tt In`'m4x\/}" rjust at Here+(0,(2-m4x)*0.02)')
+ }
+ thicklines_
+ move down dmov; right_
+ { NOT_gate ; "{\tt NOT\_gate}" ljust at last [].w + (xgap,0) }
+ move down dmov; right_
+ {Gate: NXOR_gate(NPN); "{\tt NXOR\_gate(NPN)}" ljust at last [].w + (xgap,0)
+ for_(1,3,1,
+ `arrow <- left 0.2 up 0.05 from Gate.In`'m4x
+ "{\tt In`'m4x\/}" rjust at Here+(0,(2-m4x)*0.02)')
+ }
+}
+ move right_ 140pt__
+{ {NAND_gate(,B) ; "{\tt NAND\_gate(,B)}" ljust at last [].w + (xgap,0)}
+ { line invis right 1.6 from last [].se then down 1}
+ move down dmov; right_
+ move left N_diam*L_unit; right_
+ {NOR_gate(3,NB) ; "{\tt NOR\_gate(3,NB)}" ljust at (last "",last []) }
+ move down dmov; right_
+ {BOX_gate(PN,N,,,=1)
+ "{\tt BOX\_gate(PN,N,{,},=1)}" ljust at (last "",last [])
+ line left 0.15 from last [].In1
+ line left 0.15-NOT_rad*2 from last [].In2
+ line right 0.15 from last [].Out }
+ move down dmov; move right_ N_diam*L_unit
+ {BOX_gate(PP,N,,,=)
+ "{\tt BOX\_gate(PP,N,{,},=)}" ljust at (last "",last [])
+ line left 0.15 from last [].In1
+ line left 0.15 from last [].In2
+ line right 0.15 from last [].Out }
+}
+]
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Loop.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Loop.m4
new file mode 100644
index 00000000000..379d19f299a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Loop.m4
@@ -0,0 +1,10 @@
+.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
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/doc/Makefile
new file mode 100644
index 00000000000..a934e20bba4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Makefile
@@ -0,0 +1,142 @@
+# The installed library directory, change this if necessary:
+LIBDIR = ..
+
+DOC = Circuit_macros
+DOCSRC = Circuit_macros.tex body.tex defines.tex
+
+PICTEX = \
+ AmpTable.tex Antennas.tex Audio.tex Axes.tex \
+ Buffer.tex BigResistor.tex Bip.tex \
+ CctTable.tex Composite.tex ConfigA.tex ConfigB.tex ConfigC.tex Conn.tex \
+ Corners.tex \
+ Dac.tex Darlington.tex Demultiplexer.tex Diodes.tex \
+ Emarrows.tex FF.tex FlipFlop.tex \
+ Flowdiag.tex Fuses.tex Grounds.tex \
+ Headers.tex HybridPi.tex Jack.tex \
+ Logic.tex Loop.tex Multiplexer.tex NPDT.tex NLG.tex Nport.tex \
+ Oblique.tex Opamp.tex Opto.tex \
+ ParSeries.tex Pconn.tex Potentiometers.tex Relay.tex \
+ Series.tex ShiftR.tex Sinus.tex Sources.tex Switches.tex \
+ Taps.tex Tgate.tex Thermal.tex Tline.tex Ttree.tex \
+ Variable.tex Xform.tex Windings.tex Workflow.tex \
+ bitr.tex bi_trans.tex \
+ bistable.tex currents.tex eboxdims.tex fbfilter.tex fet.tex \
+ lrarrows.tex mplex.tex oax.tex \
+ quick.tex stringdims.tex thyristor.tex ujt.tex woodchips.tex
+
+VERBATIM = BigResistor2.verb eboxdims.verb
+BOXDIMS = Antennas.tex bi_trans.tex ConfigA.tex ConfigB.tex ConfigC.tex \
+ Corners.tex \
+ Dac.tex eboxdims.tex FlipFlop.tex \
+ Opamp.tex ParSeries.tex Sinus.tex stringdims.tex Ttree.tex \
+ Windings.tex woodchips.tex
+# BOXDIMS = $(PICTEX)
+
+LATEX = latex
+M4 = m4 -I $(LIBDIR)
+# If M4PATH has been set:
+M4 = m4
+
+# For gpic
+MODE = gpic
+PIC = gpic -t
+PRE =
+POST = ;printf '\\centerline{\\box\\graph}\n'
+PST =
+
+# For dpic; comment these to stick with gpic.
+MODE = pstricks
+PIC = dpic -p
+# PIC = $$HOME/dpic/test/dpic -p
+# PIC = $$HOME/dpic/p2c/ftp/dpic -p
+PRE =
+POST =
+#POST = ;printf '}%%'
+PST = ;printf '\\usepackage{pstricks}\n' >> heading.tex
+# PST = ;printf '\\usepackage{tikz}\n' >> heading.tex
+
+SFX = dvi
+
+M4LIBS = $(MODE).m4
+.SUFFIXES: .tex .m4
+.m4.tex: $*.m4
+ touch $(DOC).dim
+ $(M4) $(M4LIBS) $(DOC).dim $*.m4 > $*.pic
+ ($(PRE) $(PIC) $*.pic $(POST)) > $*.tex
+
+CMpdf:
+ touch mode.tex
+ -if grep -q tikz mode.tex ; then true ; else \
+ make clean ; printf "\\usepackage{tikz}\n" > mode.tex ; fi
+ make MODE=pgf PIC="dpic -g" LATEX=pdflatex SFX=pdf \
+ POST="; printf '\\\\vspace*{-0.5\\\\baselineskip}\\n'" \
+ $(DOC).pdf
+ chmod 644 $(DOC).pdf
+
+$(DOC).ps:
+ printf "\n $(DOC).ps:\n\n"
+ make MODE=pstricks PIC="dpic -p" LATEX=latex SFX=dvi POST="" $(DOC).dvi
+ dvips -t letter $(DOC) -o
+
+$(DOC).$(SFX): mode.tex citations $(PICTEX)
+ @printf "\n $(DOC).SFX=$(DOC).$(SFX):\n\n"
+ $(LATEX) $(DOC) ; bibtex $(DOC)
+ -@if grep -s "Warning: Reference " $(DOC).log ; then \
+ @printf "\n Warning:\n\n" ; \
+ $(LATEX) $(DOC) ; bibtex $(DOC) ; \
+ elif test ! -f $(DOC).$(SFX) ; then\
+ @printf "\n No file $(DOC).$(SFX)\n\n" ; \
+ $(LATEX) $(DOC) ; bibtex $(DOC) ; fi
+
+citations: mode.tex $(DOC).bbl $(PICTEX)
+ @printf "\n citations:\n\n"
+ $(LATEX) $(DOC) ; bibtex $(DOC)
+ touch citations
+
+$(DOC).bbl: $(DOC).bib $(DOC).aux
+ bibtex $(DOC)
+
+$(DOC).aux: mode.tex $(DOCSRC) heading.tex $(VERBATIM) $(PICTEX)
+ @printf "\n $(DOC).aux:\n\n"
+ $(LATEX) $(DOC) ; bibtex $(DOC)
+ rm -f $(BOXDIMS)
+ make $(BOXDIMS)
+
+mode.tex:
+ -if test "$(MODE)" = "pstricks" ; then \
+ printf "\\usepackage{pstricks}\n" > mode.tex ; else \
+ printf "\\usepackage{tikz}\n" > mode.tex ; fi
+
+heading.tex:
+ printf '\\documentclass{article}\n' > heading.tex
+ printf '\\usepackage{verbatim,url}\n' >> heading.tex
+ printf '\\usepackage{multicol}\n' >> heading.tex
+ printf '\\usepackage{amssymb,boxdims}\n' >> heading.tex $(PST)
+
+oax.tex tran.tex bitr.tex: oax.m4
+ $(M4) $(M4LIBS) $*.m4 > $*.pic
+ $(PIC) $*.pic > $*.tex
+
+pics: $(PICTEX)
+
+BigResistor2.verb: BigResistor.m4
+ ( printf '\\begin{verbatim}\n'; \
+ sed -n '/thinlines/,/PE/p' BigResistor.m4 ;\
+ printf '\\end{verbatim}\n' ) > BigResistor2.verb
+
+eboxdims.verb: eboxdims.m4
+ ( printf '\\begin{verbatim}\n' ; \
+ sed -e '/thinlines/,$$d' eboxdims.m4 ; \
+ printf '.PE\n\\end{verbatim}\n' ) > eboxdims.verb
+
+ex08.m4: ../examples/ex08.m4
+ cp ../examples/ex08.m4 ex08.m4
+
+clobber: clean
+ rm -f *.dvi Circuit_macros.pdf
+# rm -f Circuit_macros.pdf
+
+clean:
+ rm -f *.bbl *.log *.aux *.blg *.toc citations *.verb ex08.m4
+ rm -f *.pic $(PICTEX) heading.tex *.dim *.uu Circuit_macros.ps Circuit_macros.dvi
+ rm -f mode.tex Circuit_macros.out *.upa *.upb *.brf
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Multiplexer.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Multiplexer.m4
new file mode 100644
index 00000000000..f4b72154a4d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Multiplexer.m4
@@ -0,0 +1,43 @@
+.PS
+# `Multiplexer.m4'
+log_init
+
+ ifmpost(`command "verbatimtex {\sf etex"',
+ `ifpostscript(,
+ `command "{\sf"')')
+
+ right_
+
+ Mux(4,M1)
+ `"\tt Mux(4,M1)"' at last [].s below
+ `"\sl In0"' at last [].In0.end rjust wid 14bp__
+ `"\sl In1"' at last [].In1.end rjust
+ `"\sl In2"' at last [].In2.end rjust
+ `"\sl In3"' at last [].In3.end rjust
+ `"\sl Out"' at last [].Out.end above
+ `"\sl Sel"' at last [].Sel.end ljust above
+ left_; Mux(4,,LNOE) with .c at last [].c+(0.9,0)
+ `"\tt left\_; Mux(4,{,}LNOE)"' at last [].s +(0,-20bp__) ht 10bp__
+ `"\sl In0"' at last [].In0.end above
+ `"\sl NOE"' at last [].NOE.end +(4bp__,0) below
+ `"\sl Out"' at last [].Out.end below
+ `"\sl Sel"' at last [].Sel.end rjust below
+ right_; Mux(4,,OEBN2) with .c at last [].c+(1.4,0)
+ `"\tt Mux(4,{,}OEBN2)"' at last [].s below
+ `"\sl Sel0"' at last [].Sel0.end rjust
+ `"\sl Sel1"' at last [].Sel1.end ljust
+ `"\sl In0"' at last [].In0.end rjust
+ `"\sl In3"' at last [].In3.end rjust
+ `"\sl OE"' at last [].OE.end rjust
+ down_; Mux(8,,L3,,28*L_unit) with .c at last [].c+(1.7,0)
+ `"\tt down\_; Mux(8,{,}L3,{,}28*L\_unit)"' at last [].s below
+ `"\sl Sel0"' at last [].Sel0.end rjust
+ `"\sl Sel2"' at last [].Sel2.end rjust below
+ `"\sl In0"' at last [].In0.end rjust
+ `"\sl In7"' at last [].In7.end ljust wid 14bp__
+
+ifmpost(`command "verbatimtex } etex"',
+`ifpostscript(,
+`command "}"')')
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/NLG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/NLG.m4
new file mode 100644
index 00000000000..2b9a39f86e4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/NLG.m4
@@ -0,0 +1,19 @@
+.PS
+# NLG.m4
+cct_init
+
+ define(`nullor',`nport(`$1'
+ {`"${}0$"' at Box.w ljust
+ `"$\infty$"' at Box.e rjust},shift($@))')
+
+N: nullor
+`"\tt nullor"' at last [].s+(0,-3pt__) below
+G: gyrator with .sw at N.se+(0.5,0)
+`"\tt gyrator"' at G.s+(0,-3pt__) below
+I: gyrator(invis,,0,N) with .w at G.e+(0.5,0)
+`"\tt gyrator(invis,{,}0,N)"' at I.s
+V: gyrator(invis wid boxht,,0,NV) with .w at I.e+(1,0)
+`"\tt gyrator(invis wid boxht,{,}0,NV)"' at V.s+(0,-3pt__) below
+
+ move right 0.9
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/NPDT.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/NPDT.m4
new file mode 100644
index 00000000000..17f4ef26b15
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/NPDT.m4
@@ -0,0 +1,35 @@
+.PS
+# `NPDT.m4'
+cct_init
+ linewid = linewid*1.2
+ movewid = 1.0
+
+ NPDT
+ { `"\sl R" at last [].R.s below
+ "\sl T" at last [].T.s below
+ "\sl L" at last [].L.s below' }
+ { `"\tt NPDT"' at last [].s +(0,-0.22) }
+ up_; NPDT with .L at last[].R+(0.75,0)
+ { `"\sl R"' wid 8pt__ at last [].R.e ljust
+ "\sl T" at last [].T.e ljust
+ "\sl L" at last [].L.e ljust }
+ { `"\tt up\_; NPDT\strut"' at last [].s +(0.1,-0.15) }
+ right_
+ NPDT(2) with .L1 at last [].L+(0.75,0)
+ { for_(1,2,1,
+ `"\sl R`'m4x" at last [].R`'m4x.e ljust
+ "\sl L`'m4x" wid 11pt__ at last [].L`'m4x.w rjust') }
+ { `"\tt NPDT(2)\strut"' at last [].s +(0,-0.15) }
+ move
+ NPDT(3,R) with .L3 at last [].R1+(0.75,0)
+ { for_(1,3,1,
+ `"\sl R`'m4x" at last [].R`'m4x.e ljust
+ "\sl L`'m4x" wid 11pt__ at last [].L`'m4x.w rjust') }
+ { `"\tt NPDT(3,R)\strut"' at last [].s below }
+ left_; NPDT(2,R) with .R1 at last [].R3+(0.75,0)
+ { for_(1,2,1,
+ `"\sl R`'m4x" at last [].R`'m4x.w rjust
+ "\sl L`'m4x" wid 11pt__ at last [].L`'m4x.e ljust') }
+ { `"\tt left\_; NPDT(2,R)\strut"' at last [].s +(0,-0.15) }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Nport.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Nport.m4
new file mode 100644
index 00000000000..37dbffeaccf
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Nport.m4
@@ -0,0 +1,43 @@
+.PS
+# `Nport.m4'
+cct_init
+textoffset = 5bp__
+
+Twoport: nport
+
+ "\sl W1a" above rjust at Twoport.W1a
+ "\sl W1b" below rjust at Twoport.W1b wid 0.25
+ "\sl E1a" above ljust at Twoport.E1a
+ "\sl E1b" below ljust at Twoport.E1b
+
+Nport: nport(wid 2.0 ht 1 fill_(0.9) "n-port",1,2,3,4) \
+ with .Box.w at Twoport.Box.e+(1.0,0)
+
+ "\sl W1a" rjust at Nport.W1a
+ "\sl W1b" rjust at Nport.W1b
+
+ "\sl E1a" ljust at Nport.E1a
+ "\sl E3b" ljust at Nport.E3b
+
+ "\sl N1a" above at Nport.N1a
+ "\sl N1b$\;\;$" above at Nport.N1b
+ "\sl $\;\;$N2a" above at Nport.N2a
+ "\sl N2b" above at Nport.N2b
+
+ "\sl S1a" below at Nport.S1a
+ "\sl S4b" below at Nport.S4b
+
+ "$\cdots$" at 0.5<Nport.S1a,Nport.S4b>+(0,-0.10)
+ "$\vdots$" at 0.5<Nport.E1a,Nport.E3b>+(0.15,0.05)
+
+Nterm: nterm with .Box.w at Nport.Box.e+(1.0,0)
+ "\sl W1" rjust at Nterm.W1
+ "\sl E1" ljust at Nterm.E1
+ "\sl S1" below at Nterm.S1
+
+ `"\tt nport"' at Twoport.s+(0,-0.3)
+ `"\tt nport(wid 2.0 ht 1 fill\_(0.9) \"n-port\",1,2,3,4)"' \
+ at Nport.s+(0,-0.25)
+ `"\tt nterm"' at Nterm.s+(0,-0.3)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Oblique.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Oblique.m4
new file mode 100644
index 00000000000..c8dfd5fa7ab
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Oblique.m4
@@ -0,0 +1,25 @@
+.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.07,,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
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Opamp.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Opamp.m4
new file mode 100644
index 00000000000..5bdb8ac2082
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Opamp.m4
@@ -0,0 +1,45 @@
+.PS
+# Opamp.m4
+sinclude(FOpamp.dim)
+sinclude(Circuit_macros.dim)
+s_init(Opamp)
+cct_init
+
+ A: opamp
+ thinlines_
+ s_box(`\tt opam{}p') at A.s-(0,0.35)
+ s_box(\tt Out) below at A.Out
+ spline <- from A.In1 left 0.1 then up 0.1 left 0.1
+ s_box(\tt In1) rjust above
+ spline <- from A.In2 left 0.1 then down 0.1 left 0.1
+ s_box(\tt In2) rjust below
+ arrow <- up 0.1 right 0.1 from A.N
+ s_box(\tt N) ljust above
+ arrow <- up 0.1 right 0.1 from A.E1
+ s_box(\tt E1) ljust above
+ arrow <- up 0.1 right 0.1 from A.E
+ s_box(\tt E) ljust above
+ arrow <- down 0.1 right 0.1 from A.E2
+ s_box(\tt E2) ljust below
+ arrow <- down 0.1 right 0.1 from A.S
+ s_box(\tt S) ljust below
+ arrow <- left 0.2 from A.W
+ s_box(\tt W) rjust
+ thicklines_
+ Point_(15)
+ B: opamp(,,,,PR) with .sw at A.se+(0.65,0)
+ thinlines_
+ s_box(`\tt Point\_(15); opam{}p(,{,},{,}PR)') at B.s-(0,0.20)
+ spline <- right arrowht up arrowht from B.V1 then right 0.1
+ s_box(\tt V1) ljust
+ spline <- right arrowht down arrowht from B.V2 then right 0.1
+ s_box(\tt V2) ljust
+ thicklines_
+ Point_(90)
+ C: opamp with .sw at B.se+(1.05,0)
+ s_box(`\tt Point\_(90); opam{}p') at C.s-(0,0.35)
+ right_
+ D: opamp(,,,,T) with .sw at C.se+(0.65,0)
+ s_box(`\tt opam{}p(,{,},{,}T)') at D.s-(0,0.20)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Opto.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Opto.m4
new file mode 100644
index 00000000000..7cbc4abf085
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Opto.m4
@@ -0,0 +1,29 @@
+.PS
+cct_init
+# `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' }]')
+
+Q1: opto
+Q2: opto(type=B;orientation=Rightleft) with .w at Q1.e+(dimen_,0)
+
+{"\sl C" at Q1.C above}
+{"\sl C" at Q2.C above}
+{"\sl A" at Q1.A above}
+{"\sl A" at Q2.A above}
+{"\sl E" at Q1.E below}
+{"\sl E" at Q2.E below}
+{"\sl K" at Q1.K below}
+{"\sl K" at Q2.K below}
+{"\sl B" at Q2.B below}
+
+.PE
+
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/ParSeries.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/ParSeries.m4
new file mode 100644
index 00000000000..7becb985289
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/ParSeries.m4
@@ -0,0 +1,56 @@
+.PS
+# ParSeries.m4
+sinclude(tst.dim)
+sinclude(Circuit_macros.dim)
+s_init(ParSeries)
+cct_init
+
+command "\newcommand{\X}{\enskip}"
+
+setdir_(R)
+Ex1: [
+P:parallel_(
+ `L:inductor(,W); llabel(+,L,-)',
+ series_(`R1:resistor; llabel(,R1)',`R2:resistor; llabel(,R2)'),
+ `C:capacitor; llabel(,C)' )
+ dot(at P.Start); "{\small\sl Start}" at rvec_(0,-3pt__) below ljust
+ dot(at P.End); "{\small\sl End}" below ljust
+ ]
+#showbox_
+
+s_box(``\shortstack[l]{
+\tt parallel\_( \char96 L:inductor(,W); llabel(+,L,-)\char39,\\
+\X\tt series\_(\char96 R1:resistor; llabel(,R1)\char39,
+\char96 R2:resistor; llabel(,R2)\char39),\\
+\X\tt \char96 C:capacitor; llabel(,C)\char39\ )}'') with .nw at Ex1.sw+(0,-0.2)
+#showbox_(last "")
+
+setdir_(Down)
+Ex2: [
+P: 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,-)' )
+ dot(at P.Start); "{\small\sl Start}" below
+ dot(at P.End); "{\small\sl End}" below
+ ] with .sw at Ex1.se+(0.3,0)
+#showbox_
+
+s_box(``\shortstack[l]{\tt setdir\_(Down)\\
+\tt parallel\_(\\
+\X\tt series\_(\char96 R1:resistor; rlabel(,R\_1)\char39,\\
+\X\X\tt parallel\_(\\
+\X\X\X\tt series\_(\char96 resistor; rlabel(,R\_2)\char39,\\
+\X\X\X\tt\hphantom{\tt series\_(}%
+\char96{}inductor(,W); rlabel(,L)\char39),\\
+\X\X\X\tt \char96 capacitor(,C); rlabel(,C)\char39\ ),\\
+\X\X\tt line down dimen\_/2),\\
+\X\tt \char96 Sep=linewid*3/2; V:source; rlabel(+,V,-)\char39)}
+'') with .nw at Ex2.ne+(0.15,0)
+#showbox_(last "")
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Pconn.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Pconn.m4
new file mode 100644
index 00000000000..946ec0fda65
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Pconn.m4
@@ -0,0 +1,50 @@
+.PS
+# `Pconn.m4'
+cct_init
+
+P1: [
+ C1: pconnex(,A)
+ thinlines_
+ arrow <- left 0.2 from C1.H.w; `"\sl H"' rjust
+ thicklines_
+ `"\tt pconnex(,A)"' at last [].s below
+ C2: pconnex(,AF) with .w at C1.e+(0.3,0)
+ thinlines_
+ arrow <- right 0.2 up 0.1 from C2.H.e; `"\sl H"' ljust
+ N: box invis wid (C2.w.x-C1.e.x)/2 ht C1.N.ht \
+ with .n at 0.5 between C1.ne and C2.nw "\sl N"
+ arrow from N.w to C1.N.e
+ arrow from N.e to C2.N.w
+ G: box invis wid N.wid ht N.ht with .n at (N,C1.N.s) "\sl G"
+ arrow from G.w to C1.G.e
+ arrow from G.e to C2.G.w
+ `"\tt (,AF)"' at last [].s below
+ C03: pconnex(,AC) with .w at C2.e+(0.2,0)
+ `"\tt (,AC)"' at last [].s below
+ C3: pconnex(,ACF) with .w at last [].e+(0.2,0)
+ `"\tt (,ACF)"' at last [].s below
+
+ C4: pconnex(,P) with .w at last [].e+(0.2,0)
+ `"\tt (,P)"' at (C4,last "") below
+ C5: pconnex(U,D) with .w at last [].e+(0.2,0)
+ `"\tt (U,D)"' at last [].s below
+ C6: pconnex(U,DF) with .w at last [].e+(0.2,0)
+ `"\tt (U,DF)"' at last [].s below
+ C7: pconnex(U,J) with .w at last [].e+(0.2,0)
+ `"\tt (U,J)"' at last [].s below
+ C8: pconnex(U,JF) with .w at last [].e+(0.2,0)
+ `"\tt (U,JF)"' at last [].s below
+ ]
+
+P2: [
+ C9: pconnex(,G)
+ `"\tt (,G)"' at last [].s below
+ C91: pconnex(,GF) with .w at last [].e+(0.2,0)
+ `"\tt (,GF)"' at last [].s below
+ C92: pconnex(L,GF) with .w at last [].e+(0.2,0)
+ `"\tt (L,GF)"' at last [].s below
+ C10: pconnex(,GC) with .w at last [].e + (0.2,0)
+ `"\tt (,GC)"' ht 11pt__ at last [].s below
+] with .nw at P1.C1.sw + (0,-0.25)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Potentiometers.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Potentiometers.m4
new file mode 100644
index 00000000000..99a6b1fdace
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Potentiometers.m4
@@ -0,0 +1,27 @@
+.PS
+# `Potentiometers.m4'
+cct_init
+
+ down_
+ P: potentiometer(down_ dimen_)
+ "\tt `potentiometer'(down\_ dimen\_)" wid 1.9 at P.End +(0,-0.30)
+ "\sl Start" ljust at P.Start
+ "\sl End" ljust at P.End
+ "\sl T1" below ljust at P.T1
+
+ R: potentiometer(down_ dimen_,,0.5,-5mm__) \
+ with .Start at P.Start + (1.7,0)
+ "\tt ...(down\_ dimen\_,{,}0.5,-5mm\_\_)" at R.End +(0,-0.12)
+ "\sl Start" ljust at R.Start
+ "\sl End" ljust at R.End
+ "\sl T1" below rjust at R.T1
+
+ Q: potentiometer(down_ dimen_,,0.25,-5mm__,0.75,5mm__) \
+ with .Start at R.Start + (1.7,0)
+ "\tt ...(down\_ dimen\_,{,}0.25,-5mm\_\_,0.75,5mm\_\_)" at Q.End+(0,-0.30)
+ "\sl Start" ljust at Q.Start
+ "\sl End" ljust at Q.End
+ "\sl T1" below rjust at Q.T1
+ "\sl T2" below ljust at Q.T2
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Relay.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Relay.m4
new file mode 100644
index 00000000000..ee52fa49943
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Relay.m4
@@ -0,0 +1,84 @@
+.PS
+# Relay.m4
+cct_init
+
+movw = 0.85
+{contact
+ {`"\tt contact"' at last [].s+(0,-0.2)
+ "\sl P" rjust at last [].P.w
+ "\sl O" ljust at last [].O
+ "\sl C" ljust at last [].C }
+ move right_ movw; contact(R,)
+ {`"\tt contact(,R)"' at last [].s+(0,-0.2)
+ "\sl P" rjust at last [].P.w
+ "\sl O" ljust at last [].O
+ "\sl C" ljust at last [].C }
+ move right_ movw; contact(P)
+ {`"\tt contact(P)"' at last [].s+(0,-0.2)
+ "\sl P" rjust at last [].P.w
+ "\sl O" ljust at last [].O
+ "\sl C" ljust at last [].C }
+ move right_ movw; contact(O,); {`"\tt contact(O,)"' at last [].s+(0,-0.2)}
+ move right_ movw; contact(C,); {`"\tt contact(C,)"' at last [].s+(0,-0.2)}
+#move right_ movw; reed; {`"\tt reed"' at last [].s+(0,-0.2)}
+}
+move down 0.8
+right_
+{contact(I)
+ {`"\tt contact(I)"' at last [].s+(0,-0.2)
+ "\sl P" rjust at last [].P.w
+ "\sl O" ljust at last [].O.e
+ "\sl C" ljust at last [].C.e }
+ move right_ movw; contact(RI)
+ {`"\tt contact(RI)"' at last [].s+(0,-0.2)
+ "\sl P" rjust at last [].P.w
+ "\sl O" ljust at last [].O.e
+ "\sl C" ljust at last [].C.e }
+ move right_ movw; contact(PI)
+ {`"\tt contact(PI)"' at last [].s+(0,-0.2)
+ "\sl P" rjust at last [].P.w
+ "\sl O" ljust at last [].O.e
+ "\sl C" ljust at last [].C.e }
+ move right_ movw; contact(OI); {`"\tt contact(OI)"' at last [].s+(0,-0.2)}
+ move right_ movw; contact(CI); {`"\tt contact(CI)"' at last [].s+(0,-0.2)}
+#move right_ movw; reed(,,,fill_(0.9),CR);
+# {`"\shortstack[l]{\tt reed(\\\tt$\;\;$,{,},fill\_(0.9),CR)}"' \
+# at last [].s+(0,-0.2)}
+}
+move down 1.2
+right_
+{
+relay
+ {"\sl V1" wid 0.16 rjust at last [].V1
+ "\sl V2" ljust at last [].V2
+ "\sl P1" rjust at last [].P1.w
+ "\sl O1" ljust at last [].O1
+ "\sl C1" ljust at last [].C1 }
+`"\tt relay"' at last [].s+(0,-0.2)
+relay(2) with .sw at last [].sw+(1.2,0)
+ {"\sl V1" rjust at last [].V1
+ "\sl V2" ljust at last [].V2
+ "\sl P1" rjust at last [].P1.w
+ "\sl O1" ljust at last [].O1
+ "\sl C1" ljust below at last [].C1
+ "\sl P2" rjust at last [].P2.w
+ "\sl O2" ljust at last [].O2
+ "\sl C2" ljust at last [].C2 }
+`"\tt relay(2)"' at last [].s+(0,-0.2)
+relay(2,RPI) with .sw at last [].sw+(1.2,0)
+ {"\sl V1" rjust at last [].V1
+ "\sl V2" ljust at last [].V2
+ "\sl P1" rjust at last [].P1.w
+ "\sl O1" ljust at last [].O1
+ "\sl C1" ljust at last [].C1+(0,2pt__)
+ "\sl P2" rjust at last [].P2.w
+ "\sl O2" ljust at last [].O2+(0,-2pt__)
+ "\sl C2" ljust at last [].C2 }
+`"\tt relay(2,RIP)"' at last [].s+(0,-0.2)
+relay(2,O) with .sw at last [].sw+(1.2,0)
+`"\tt relay(2,O)"' at last [].s+(0,-0.2)
+relay(2,CT) with .sw at last [].sw+(1.2,0)
+`"\tt relay(2,CT)"' at last [].s+(0,-0.2)
+}
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Series.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Series.m4
new file mode 100644
index 00000000000..6fb5321dd26
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Series.m4
@@ -0,0 +1,24 @@
+.PS
+# Series.m4
+cct_init
+
+[
+ setdir_(Right)
+ resistor; llabel(,R); capacitor; llabel(,C);
+ inductor; llabel(,L)
+]
+[
+
+ pushdef(`elen_',dimen_)
+ resistor; llabel(,R); capacitor; llabel(,C);
+ inductor; llabel(,L)
+ popdef(`elen_')
+] with .nw at last [].sw + (0,-0.15)
+
+[
+ resistor; llabel(,R)
+ capacitor( right_ dimen_/4); llabel(,C)
+ inductor; llabel(,L)
+] with .nw at last [].sw + (0,-0.15)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/ShiftR.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/ShiftR.m4
new file mode 100644
index 00000000000..e7bf1f0c5c5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/ShiftR.m4
@@ -0,0 +1,49 @@
+.PS
+# ShiftR.m4
+log_init
+
+ iflatex(`textoffset = 1bp__; ifpsfrag(,`latexcommand({\sf)') ')
+
+define(`lg_plen',3)
+
+define(`customFF',`FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,,
+ :S;NE:CK;:R, N:PR, :Q;;ifelse(`$1',1,:lg_bartxt(Q)), N:CLR) ')
+
+ F0: customFF(1)
+
+ BUFFER_gate(,N) with .Out at F0.W1.end
+ line left 2*L_unit from last [].In1
+ T: dot
+ reversed(`NOT_gate',left 10*L_unit)
+ Serial: "\scriptsize\shortstack[r]{SERIAL\\ INPUT}" rjust
+ line from T to (T,F0.W3) then to F0.W3.end
+
+ NCLR: NOT_gate(right T.x-Serial.x from (Serial,F0.S1.end),N)
+ "$\overline{\hbox{\scriptsize CLEAR}}$" at NCLR.start rjust
+
+ CLK: NOT_gate(right T.x-Serial.x from NCLR.start+(0,-BUF_ht*3/2*L_unit))
+ "\scriptsize CLOCK" at CLK.start rjust
+
+for_(1,4,1,`
+ F`'m4x: customFF(eval(m4x!=4)) with .W3.end at F`'eval(m4x-1).E3.end
+ ')
+
+ "\scriptsize OUTPUT" at F4.E1.end ljust
+ line from NCLR.end to F4.S1.end
+
+ down_
+for_(0,4,1,`
+ line from F`'m4x.W2.end down F0.W2.y-CLK.y
+ ifelse(eval(m4x!=4),1,`dot',`line to CLK.end')
+ N`'m4x: NAND_gate with .Out at F`'m4x.N1.end
+ line up 2*L_unit from N`'m4x.In2
+ { line up 6*L_unit from N`'m4x.In1
+ "\scriptsize PR`'eval(4-m4x)" rjust }
+ ifelse(eval(m4x!=4),1,
+ `dot; dot(at F`'m4x.S1.end)',
+ `line to (Serial,Here)
+ "\scriptsize\shortstack[r]{PRESET\\ ENABLE}" wid 0.4 rjust ')
+ ')
+
+ iflatex(ifpsfrag(,`latexcommand(})'))
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Sinus.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Sinus.m4
new file mode 100644
index 00000000000..242707d112b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Sinus.m4
@@ -0,0 +1,18 @@
+.PS
+# Sinus.m4
+cct_init
+s_init(Sinus)
+sinclude(tst.dim)
+sinclude(Circuit_macros.dim)
+
+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*2*pi_+')pi_/2,-m4h/2,m4h/2) with .Origin at Here
+ rp_ang = m4smp_ang,
+$3,$4,$5)')
+
+phsource(,120)
+s_box(`{\tt phsourc{}e(,120)}') with .e at last line.end+(0,-0.2)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Sources.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Sources.m4
new file mode 100644
index 00000000000..a70cea11137
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Sources.m4
@@ -0,0 +1,56 @@
+.PS
+# `Sources.m4'
+cct_init
+divert(-1)
+
+divert(0)dnl
+
+iflatex(`ifpsfrag(,`latexcommand({\sf)') ')
+
+movewid = 2pt__
+moveht = 0.275
+define(`NL',`; move down $1; right_')
+{
+ {source ; move ; "`source'" ljust} NL
+ {source(,I) ; move ; "`source(,I)'" ljust} NL
+ {source(,i) ; move ; "`source(,i)'" ljust} NL
+ {source(,V) ; move ; "`source(,V)'" ljust} NL
+ {source(,v) ; move ; "`source(,v)'" ljust} NL
+ {source(,SC) ; move ; "`source(,SC)'" ljust} NL
+ {source(,AC); move ; "`source(,AC)'" ljust} NL
+ {source(,X) ; move ; "`source(,X)'" ljust} NL
+ {source(,F) ; move ; "`source(,F)'" ljust} NL
+ {source(,G) ; move ; "`source(,G)'" ljust} NL
+ {source(,Q) ; move ; "`source(,Q)'" ljust}
+}
+ move right_ 2.0
+{
+ {source(,,0.4) ; move ; "`source(,{,}0.4)'" ljust} NL(0.35)
+ {source(,P) ; move ; "`source(,P)'" ljust} NL
+ {source(,U) ; move ; "`source(,U)'" ljust} NL
+ {source(,H) ; move ; "`source(,H)'" ljust} NL
+ {source(,R) ; move ; "`source(,R)'" ljust} NL
+ {source(,S) ; move ; "`source(,S)'" ljust} NL
+ {source(,SCr) ; move ; "`source(,SCr)'" ljust} NL
+ {source(,T) ; move ; "`source(,T)'" ljust} NL
+ {source(,L) ; move ; "`source(,L)'" ljust} NL
+ {source(,B) ; move ; "`source(,B)'" ljust} NL(moveht*0.8)
+ {nullator ; move ; "`nullator'" ljust} NL(moveht*0.6)
+ {norator ; move ; "`norator'" ljust}
+}
+ move right_ 2.0
+ {source(,N) ; move ; "`source(,N)'" ljust} NL
+ {source(,"\rm mA");move; "`source(,\"mA\")'" ljust} NL(0.31)
+# {source(,"mA");move; "`source(,'" ljust \
+# "`\enskip \"mA\")'" ljust} NL(0.31)
+ {consource ; move ; "`consource'" ljust} NL(0.32)
+ {consource(,I) ; move ; "`consource(,I)'" ljust} NL(0.32)
+ {consource(,i) ; move ; "`consource(,i)'" ljust} NL(0.32)
+ {source(,SE) ; move ; "`source(,SE)'" ljust} NL
+ {consource(,V) ; move ; "`consource(,V)'" ljust} NL(0.32)
+ {consource(,v) ; move ; "`consource(,v)'" ljust} NL(0.3)
+ {battery ; move ; "`battery'" ljust} NL
+ {battery(,3,R) ; move ; "`battery(,3,R)'" ljust}
+
+iflatex(`ifpsfrag(,`latexcommand(})')')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Switches.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Switches.m4
new file mode 100644
index 00000000000..03218d4ab52
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Switches.m4
@@ -0,0 +1,99 @@
+.PS
+# Switches.m4
+cct_init
+movewid = 0.25
+moveht = moveht*1.25
+ right_; {
+ lswitch; rlabel(,`\hbox{\tt `lswitch'}')
+ move right_
+ lswitch(,,O); rlabel(,`\hbox{\tt (,{,}O)}')
+ move right_
+ lswitch(,,C); rlabel(,`\hbox{\tt (,{,}C)}')
+ move right_
+ lswitch(,,DA); rlabel(,`\hbox{\tt (,{,}DA)}')
+ move right_
+ lswitch(,,DO); rlabel(,`\hbox{\tt (,{,}DO)}')
+ move right_
+ lswitch(,,DC); rlabel(,`\hbox{\tt (,{,}DC)}')
+ }
+ move down; right_; {
+ lswitch(,,K); rlabel(,`\hbox{\tt (,{,}K)}')
+ move right_
+ lswitch(,,KD); rlabel(,`\hbox{\tt (,{,}KD)}')
+ move right_
+ lswitch(,,KOD); rlabel(,`\hbox{\tt (,{,}KOD)}')
+ move right_
+ lswitch(,,KCD); rlabel(,`\hbox{\tt (,{,}KCD)}')
+ move right_
+ bswitch; rlabel(,`\hbox{\tt `bswitch'}')
+ move right_
+ bswitch(,,C); rlabel(,`\hbox{\tt (,{,}C)}')
+ }
+ move down; right_; {
+ S: dswitch(,,)
+ ifgpic(`{[line invis] at S.c+(0,-0.2)}')
+ rlabel(,`\hbox{\tt \shortstack{`dswitch'=\\`switch'(,{,},D)}}')
+ thinlines_
+ { spline <- from 0.25 along_(S) up 0.1 then up 0.05 left 0.1
+ "\tt W" rjust
+ spline <- from S.c+(0,m4sc*2) up 0.1 then up 0.05 left 0.1
+ "\tt B" rjust }
+ thicklines_
+ move right_
+ S: dswitch(,,WdBK); rlabel(,`\hbox{\tt (,{,}WdBK)}')
+ 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
+ "\tt K" above }
+ thicklines_
+ move right_
+ dswitch(,,WBuD); rlabel(,`\hbox{\tt (,{,}WBuD)}')
+ move right_
+ dswitch(,,WdBKF); rlabel(,`\hbox{\tt (,{,}WdBKF)}')
+ move right_
+ dswitch(,,WBL); rlabel(,`\hbox{\tt (,{,}WBL)}')
+ move right_
+ dswitch(,,WdBKL); rlabel(,`\hbox{\tt (,{,}WdBKL)}')
+ }
+ move down; right_; {
+ dswitch(,,WBT); rlabel(,`\hbox{\tt (,{,}WBT)}')
+ move right_
+ dswitch(,,WdBKC); rlabel(,`\hbox{\tt (,{,}WdBKC)}')
+ move right_
+ dswitch(,,WBM); rlabel(,`\hbox{\tt (,{,}WBM)}')
+ move right_
+ dswitch(,,WBCO); rlabel(,`\hbox{\tt (,{,}WBCO)}')
+ move right_
+ dswitch(,,WBMP); rlabel(,`\hbox{\tt (,{,}WBMP)}')
+ move right_
+ dswitch(,,WBoKCP); rlabel(,`\hbox{\tt (,{,}WBoKCP)}')
+ }
+ move down; right_; {
+ dswitch(,,WBCY); rlabel(,`\hbox{\tt (,{,}WBCY)}')
+ move right_
+ dswitch(,,WBCZ); rlabel(,`\hbox{\tt (,{,}WBCZ)}')
+ move right_
+ dswitch(,,WBCE); rlabel(,`\hbox{\tt (,{,}WBCE)}')
+ move right_
+ dswitch(,,WBRH); rlabel(,`\hbox{\tt (,{,}WBRH)}')
+ move right_
+ dswitch(,,WBRdH); rlabel(,`\hbox{\tt (,{,}WBRdH)}')
+ move right_
+ dswitch(,,WBRHH); rlabel(,`\hbox{\tt (,{,}WBRHH)}')
+ }
+ move down; right_; {
+ dswitch(,,WBMMR); rlabel(,`\hbox{\tt (,{,}WBMMR)}')
+ move right_
+ dswitch(,,WBMM); rlabel(,`\hbox{\tt (,{,}WBMM)}')
+ move right_
+ dswitch(,,WBMR); rlabel(,`\hbox{\tt (,{,}WBMR)}')
+ move right_
+ dswitch(,,WBEL); rlabel(,`\hbox{\tt (,{,}WBEL)}')
+ move right_
+ dswitch(,,WBLE); rlabel(,`\hbox{\tt (,{,}WBLE)}')
+ move right_
+ dswitch(,,WdBoKEL); rlabel(,`\hbox{\tt (,{,}WdBoKEL)}')
+ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Taps.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Taps.m4
new file mode 100644
index 00000000000..7b8797d035d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Taps.m4
@@ -0,0 +1,43 @@
+.PS
+# `Taps.m4'
+cct_init
+
+ t = 0.2 in__
+ right_
+ R1: resistor(,,E); addtaps(<-,0.2,-t,0.8,t)
+ "\sl R1.start" wid 0.5 ht 11pt__ at R1.start above
+ "\sl R1.end" at R1.end above
+ "\sl Tap1" at Tap1 rjust
+ "\sl Tap2" at Tap2 ljust
+ `"\tt right\_; t = 0.2in\_\_" ljust \
+ "\tt R1:$\;$resistor(,{,}E)" ljust \
+ "\tt addtaps(<-,0.2,-t,0.8,t)" ljust' at R1.end+(0.3,0)
+
+ move to R1.end+(2.25,0.1); right_
+ R2: ebox(,elen_*0.6,)
+ addtaps(type=-;name=Tx,0.2,-t,0.5,-t,0.8,-t)
+ "\sl Tx1" at Tx1 rjust
+ "\sl Tx3" at Tx3 ljust
+ `"\tt R2:$\;$ebox(,elen\_*0.6)" ljust \
+ "\tt addtaps(type=-;name=Tx," ljust \
+ "\tt \hspace*{0.2in}0.2,-t,0.5,-t,0.8,-t)" ljust ' at R2.end+(0.1,-0.15)
+
+ R3: tapped(`ebox(,elen_*0.6,)',->,0.2,-t,0.5,-t,0.8,-t) \
+ with .Start at R1.start+(0.25in__,-0.6in__)
+ "\sl R3.Start" at R3.Start rjust
+ "\sl R3.End" at R3.End ljust
+ "\sl R3.Tap1" at R3.Tap1 rjust
+ "\sl R3.Tap3" at R3.Tap3 ljust
+ `"\tt \
+ R3:$\;$tapped(`ebox(,elen\_*0.6,)',->,0.2,-t,0.5,-t,0.8,-t) \char92" ljust \
+ "\tt $\;$ with .Start at R1.start+(0.25in\_\_,-0.6in\_\_)" ljust' \
+ at R3.End+(0.5,0)
+
+ L1: tapped(`inductor(right_ 9*dimen_/8,,9)',
+ -,0,-t,3/9,-t/2,6/9,-t/2,1,-t) at R3+(0,-0.6)
+ `"\tt L1:$\;$tapped(`inductor(right\_ 9*dimen\_/8,{,}9)'," ljust' \
+ `"\hspace*{0.5in}\tt -,0,-t,3/9,-t/2,6/9,-t/2,1,-t)" ljust' at (last "",L1)
+ "\sl L1.Tap1" at L1.Tap1-(10pt__,0) below
+ "\sl L1.Tap4" at L1.Tap4+(10pt__,0) below
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Tgate.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Tgate.m4
new file mode 100644
index 00000000000..ff42cecb8de
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Tgate.m4
@@ -0,0 +1,50 @@
+.PS
+# Tgate.m4
+cct_init
+right_
+
+[ { Q: tgate
+ "$A$" at Q.A rjust
+ "$B$" at Q.B ljust
+ "$G$" at Q.G ljust below
+ "$Gb$" at Q.Gb ljust above
+ `"\tt tgate"' at Q.A-(0.25,0) rjust
+ }
+
+ move down_ linewid; right_
+ { Q: tgate(,L)
+ "$A$" at Q.A rjust
+ "$B$" at Q.B ljust
+ "$G$" at Q.G ljust above
+ "$Gb$" at Q.Gb ljust below
+ `"\tt tgate(,L)"' wid 0.65 at Q.A-(0.25,0) rjust
+ }
+ ]
+
+[ { Q: tgate(,B)
+ "$A$" at Q.A rjust
+ "$B$" at Q.B ljust
+ "$G$" at Q.G ljust
+ `"\tt tgate(,B)"' at Q.G-(0,10bp__) below
+ }
+ ] with .Q.A at last [].Q.B+(0.5,linewid/2)
+
+[ { Q: ptrans
+ "$A$" at Q.A rjust
+ "$B$" at Q.B ljust
+ "$G$" at Q.G rjust below
+ "$Gb$" at Q.Gb rjust
+ `"\tt ptrans"' at Q.B+(0.25,0) ljust
+ }
+
+ move down_ linewid; right_
+ { Q: ptrans(,L)
+ "$A$" at Q.A rjust
+ "$B$" at Q.B ljust
+ "$G$" at Q.G ljust above
+ "$Gb$" at Q.Gb ljust below
+ `"\tt ptrans(,L)"' at Q.B+(0.25,0) ljust
+ }
+ ] with .Q.Gb at (last [].e.x+elen_/2+0.5,1st [].Q.Gb.y)
+
+.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
new file mode 100644
index 00000000000..6feffc36808
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Thermal.m4
@@ -0,0 +1,8 @@
+.PS
+# Thermal.m4
+cct_init
+define(`thermalsw',
+ `dswitch(`$1',`$2',WDdBT)
+ circle rad distance(M4T,last line.c) at last line.c')
+thermalsw
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Tline.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Tline.m4
new file mode 100644
index 00000000000..eed6106c074
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Tline.m4
@@ -0,0 +1,23 @@
+.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)',
+ `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
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Ttree.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Ttree.m4
new file mode 100644
index 00000000000..6cf9203b006
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Ttree.m4
@@ -0,0 +1,56 @@
+.PS
+# Ttree.m4
+# A binary tree using m4
+gen_init
+sinclude(tst.dim)
+s_init(Ttree)
+
+# `Node(no in row, head [location],
+# displacement of top of body (.n) wrt head,
+# body Node 1, body Node 2, ...) '
+define(`Node',`
+ Head`$1': `$2'
+ ifelse(`$3',,,`Body`$1': [
+ Loopover_(`v',`v; define(`m4ct',m4Lx)',shift(shift(shift($@))))
+ ] with .n at Head`$1' + `$3'
+ connect(`$1',m4ct)')')
+
+define(`connect',`Bot: move from Head$1.sw to Head$1.se
+for_(1,`$2',1,
+ `Top: move from Body$1.Head`'m4x.nw to Body$1.Head`'m4x.ne
+ Move: move from Head$1 to Body$1.Head`'m4x
+ if Bot.len*Top.len*Move.len > 0 then {
+ line from Intersect_(Move,Top) to Intersect_(Move,Bot)}')')
+
+ vsep = 0.75
+
+ Node(1,s_box($`h(h(h(x_1,x_2),h(x_3,x_4)),h(h(x_5,x_6),h(x_7,x_8)))'$),
+ (0,-vsep),
+ Node(1,s_box($`h(h(x_1,x_2),h(x_3,x_4))'$),
+ (0,-vsep),
+ Node(1,s_box($`h(x_1,x_2)'$),
+ (0,-vsep),
+ Node(1,s_box($`x_1:=((A,pk_A),h_1)'$)),
+ Node(2,s_box($`x_2:=((B,pk_B),h_2)'$) \
+ with .n at last "".ne+(0.2,-vsep*2/3))),
+ Node(2,s_box($`h(x_3,x_4)'$) with .nw at Head1.ne+(Body1.wid/2+0.1,0),
+ (0,-vsep),
+ Node(1,s_box($`x_3:=((A,pk_A^\prime),h_3)'$)),
+ Node(2,s_box($`x_4:=((D,pk_D),h_4)'$) \
+ with .n at last "".ne+(0.2,-vsep*2/3)))),
+ Node(2,s_box($`h(h(x_5,x_6),h(x_7,x_8))'$) \
+ with .nw at Head1.ne+(Body1.wid/2,0),
+ (0,-vsep),
+ Node(1,s_box($`h(x_5,x_6)'$),
+ (0,-vsep*5/4),
+ Node(1,s_box($`x_5:=((E,pk_E),h_5)'$)),
+ Node(2,s_box($`x_6:=((H,pk_H),h_6)'$) \
+ with .n at last "".ne+(0.2,-vsep*2/3))),
+ Node(2,s_box($`h(x_7,x_8)'$) with .nw at Head1.ne+(Body1.wid/2+0.1,0),
+ (0,-vsep*5/4),
+ Node(1,s_box($`x_7:=((D,pk_D^\prime),h_7)'$)),
+ Node(2,s_box($`x_8:=((K,pk_K),h_8)'$) \
+ with .n at last "".ne+(0.2,-vsep*2/3))),
+ Node(3,s_box($`h(x_9)'$) at 0.5 between Head1 and Head2)))
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Variable.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Variable.m4
new file mode 100644
index 00000000000..6fac01e1648
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Variable.m4
@@ -0,0 +1,28 @@
+.PS
+# `Variable.m4'
+cct_init
+
+define(`elen_',dimen_); down_
+[ { variable(`capacitor') }; move right
+ { variable(`resistor',uN) }; move right
+ { variable(`capacitor(,C)') }; move right
+ { variable(`inductor') }; move right
+ { variable(`inductor(,W)') }
+ ]
+[
+ skp = 0.4
+ hskip = linewid*0.5
+ cskip = hskip
+Orig: Here
+ { move right cskip+elen_+hskip
+ line invis right_ elen_ "\tt C"; move right_ hskip
+ line invis right_ elen_ "\tt S" }
+ Loopover_(`char',
+ `move down skp ifelse(char,A,*0.5)
+ { line invis right_ cskip "\tt char"
+ variable(`capacitor(,C)',char); move right_ hskip
+ variable(`capacitor(,C)',char`'C); move right_ hskip
+ variable(`capacitor(,C)',char`'S) }',
+ A,P,L,N)
+ ] with .w at last [].e+(0.4,0)
+.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
new file mode 100644
index 00000000000..aee229c54bb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Version.tex
@@ -0,0 +1 @@
+Version 9.0
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Windings.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Windings.m4
new file mode 100644
index 00000000000..0c1ff4b87b7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Windings.m4
@@ -0,0 +1,113 @@
+.PS
+cct_init
+# Windings.m4
+ ifelse(xtract(m4postprocessor,pstricks,pgf,mpost,pdf,postscript,svg),,
+ `print "
+ `pstricks, pgf, mpost, pdf, postscript, or svg required for Windings.m4'"
+ "`pstricks, pgf, mpost, pdf, postscript, or svg required for Windings.m4'"',
+`
+ s_init(Windings)
+ ifdef(`Windings_1',,`sinclude(FWindings.dim)')
+ sinclude(Circuit_macros.dim)
+ ifdef(`Windings_1',,`sinclude(tst.dim)')
+
+define(`vlight',`rgbstring(0.9,0.9,0.9)')
+define(`lightgray',`rgbstring(0.7,0.7,0.7)')
+
+[ W: winding ]
+ s_box(\tt w{}inding) at last [].s below
+
+[ winding(R) ] with .n at last "".s+(0,-0.1)
+ s_box(\tt w{}inding(R)) at last [].s below
+
+[ sk = 0.75
+ d = 1.5*sk
+ p = 0.4*sk
+ w = 1*sk
+
+W: winding(L,d,p,4,w,vlight)
+
+thinlines_
+ dimension_(from W.nw+(p/4,0) right p,0.1,s_box(\tt pitch\strut) above,W)
+ dimension_(from W.sw to W.nw,0.2,s_box(\tt diam),H)
+ dimension_(from W.e+(-p/2,-w/2) up w,-0.3,,s_ht)
+ s_box(\tt\hfill core wid) at W.e ljust
+ arrow <- up d-w+0.1 left d/10 from W.ne+(-p/2,-(d-w))
+ s_box(\tt core color) at Here+(-0.2,0) ljust above
+thicklines_
+] with .sw at last [].se+(0.25,0)
+ "\tt T1" at last [].W.T1 below
+ "\tt T2" at last [].W.T2 below
+
+[
+#`winding(L|R, diam, pitch, nturns, core wid, core color )'
+boxwid = 0.3
+boxht = 0.4
+ down_
+B1: box
+ winding(,boxwid*1.3,boxht/5,3,boxwid) at B1
+ "Left pins" "cw" at B1.s+(0,-0.15)
+ for_(1,2,1,`"\sl\small T`'m4x" at last [].T`'m4x rjust')
+B2: box at B1.e + (0.5,0)
+ winding(R,boxwid*1.3,boxht/5,3,boxwid) at B2
+ "Left pins" "ccw" at B2.s+(0,-0.15)
+ for_(1,2,1,`"\sl\small T`'m4x" at last [].T`'m4x rjust')
+ up_
+B3: box at B1.s + (0,-0.55)
+ winding(,boxwid*1.3,boxht/5,3,boxwid) at B3
+ "Right pins" "cw" at B3.s+(0,-0.15)
+ for_(1,2,1,`"\sl\small T`'m4x" at last [].T`'m4x ljust')
+B4: box at (B2,B3)
+ winding(R,boxwid*1.3,boxht/5,3,boxwid) at B4
+ "Right pins" "ccw" at B4.s+(0,-0.15)
+ for_(1,2,1,`"\sl\small T`'m4x" at last [].T`'m4x ljust')
+] with .sw at last [].se+(0.1,0)
+
+[
+ Q: box invis ht 1 wid 5/4
+ g = Q.wid/12
+ ironwid = Q.wid/4.5
+
+ line thick ironwid/(1bp__)+linethick from Q.n+(g/2-linethick/2 bp__,0) \
+ to Q.ne then to Q.se then to Q.sw then to Q.nw \
+ then to Q.n+(-g/2+linethick/2 bp__,0)
+ ifmpost(`rgbdraw(0.7,0.7,0.7,')
+ line thick ironwid/(1bp__)-linethick outlined lightgray \
+ from Q.n+(g/2+linethick/2 bp__,0) \
+ to Q.ne then to Q.se then to Q.sw then to Q.nw \
+ then to Q.n+(-g/2-linethick/2 bp__,0)
+ ifmpost(`)')
+
+thinlines_
+ dimension_(from Q.n+(-g/2,-ironwid/2) right g,-ironwid/4,
+ "$g$" below,1,2pt__)
+thicklines_
+
+ down_
+ P: winding(R,ironwid*5/4,ironwid/2,4,ironwid,lightgray) at Q.w
+ line left ironwid*2/3 from P.T1
+ arrow right to P.T1 "$i_1$" above
+ line left ironwid*2/3 from P.T2
+ gap(up_ to 2nd last line.end)
+ llabel(-,s_box($v_1$),+)
+ "$N_1$" at P.e ljust
+
+ up_
+ S: winding(L,ironwid*5/4,ironwid/2,4,ironwid,lightgray) at Q.e
+ line right ironwid*2/3 from S.T2
+ arrow left to S.T2 "$i_2$" above
+ line right ironwid*2/3 from S.T1
+ gap(up_ to 2nd last line.end)
+ rlabel(-,s_box($v_2$),+)
+ "$N_2$" at S.w rjust
+
+ box dashed rad ironwid/4 wid Q.wid ht Q.ht at Q
+ arrow right arrowht from 0.5 between Q.n and Q.ne
+ "$\phi$" ljust at Here+(0,5pt__)
+
+ move up ironwid/2 from Q.n
+ move down ironwid/2 from Q.s
+] with .sw at last [].se+(0.15,0)
+
+')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Workflow.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Workflow.m4
new file mode 100644
index 00000000000..b4c0bea1a02
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Workflow.m4
@@ -0,0 +1,94 @@
+.PS
+# Workflow.m4
+gen_init
+command "{\small\sf"
+
+boxwid = boxwid*0.8
+
+B:[
+define(`fbox',`box fill_(0.95)')
+define(`lbx',`"\setbox0=\hbox{$1}\parbox{\wd0}{\raggedleft $2}" rjust')
+
+ boxwid = 0.58
+ boxht = 0.4
+ linethick_(1.0)
+ arrowwid = 0.05
+ arrowht = 0.1
+ fillval = 0.8
+ hsep = 0.06
+ vsep = 0.15
+
+ arlen = 0.5*1.25
+
+Tpic: fbox "\LaTeX"
+Pict2e: fbox "\LaTeX" "pict2e" with .w at Tpic.e+(boxwid*3/4,0)
+PDF: arrow <- up arlen from 0.5 between Tpic.n and Pict2e.n lbx(PDF,PDF\\ .pdf)
+ "\tt -d" rjust above
+
+ arrow <- up arlen from Pict2e.n lbx(\LaTeX,\LaTeX\\ .tex)
+E: Here
+ "\tt -e" rjust above
+
+ arrow <- up arlen from Tpic.n lbx(tpic,tpic\\ .tex)
+
+Psfrag: fbox "\LaTeX" "psfrag" with .w at Pict2e.e+(hsep,0)
+ arrow <- up arlen from Psfrag.n lbx(Postscript,Postscript\\ psfrag\\ .eps)
+ "\tt -f" rjust above
+ boxstep = Psfrag.x-Pict2e.x
+PGF: fbox "\LaTeX" "or" "PDFlatex" "tikz" ht 1.6*boxht \
+ with .nw at Psfrag.ne+(hsep,0)
+ arrow <- up arlen from PGF.n lbx(PGF,PGF\\ .tex)
+ "\tt -g" rjust above
+Mfpic: fbox "\LaTeX" "Mfpic" with .nw at PGF.ne+(hsep,0)
+MetaFont: fbox "Metafont" with .n at Mfpic.s+(0,-vsep)
+ arrow from Mfpic.s to MetaFont.n
+ arrow from MetaFont.s down vsep/2 then right boxwid/2+hsep/2 \
+ then up Mfpic.n.y-MetaFont.s.y+vsep*3/2 \
+ then left hsep/2+boxwid/4 then down vsep
+ arrow <- up arlen from Mfpic.n lbx(mfpic,mfpic\\ .tex)
+ "\tt -m" rjust above
+PSTricks: fbox "\LaTeX" "PSTricks" with .w at Mfpic.e+(hsep,0)
+ arrow <- up arlen from PSTricks.n lbx(PSTricks,PSTricks\\ .tex)
+ "\tt -p" rjust above
+
+ arrow <- up vsep from (0.5<PSTricks,Mfpic>,E)
+Dpic: fbox "dpic" with .s at Here
+
+MetaPost: fbox "MetaPost" with .w at PSTricks.e+(boxwid*3/4,0)
+ arrow <- up arlen from MetaPost.n lbx(Meta-,Meta-\\ Post\\ .mp)
+ "\tt -s" rjust above
+ arrow <- up arlen from 0.5 between PSTricks.n and MetaPost.n \
+ lbx(Post-,Post-\\ script\\ .eps)
+ "\tt -r" rjust above
+MPLaTeX: fbox ht boxht + vsep/2 "\LaTeX" "or" "PDFlatex" \
+ with .n at MetaPost.s+(0,-vsep)
+ arrow from MetaPost.s to MPLaTeX.n
+
+ arrow <- up arlen from MetaPost.n+(boxstep,0) lbx(SVG,SVG\\ .svg)
+ "\tt -v" rjust above
+Inkscape: fbox "Inkscape" "or" "HTML" with .n at last arrow.start
+ arrow <- up arlen from Inkscape.n+(boxstep,0) lbx(Xfig,Xfig\\ .fig)
+ "\tt -x" rjust above
+Xfig: fbox "Xfig" with .n at last arrow.start
+
+IsLaTeX: fbox ht boxht + vsep/2 "\LaTeX" "or" "PDFlatex" \
+ with .n at Inkscape.s+(0,-vsep)
+ arrow from Inkscape.s to IsLaTeX.n
+
+ line from (PDF,E) to (Xfig,E)
+
+Gpic: fbox "gpic -t" at (Tpic,Dpic)
+ line down vsep from Gpic.s
+M4: fbox "m4" at 0.5<Gpic,Dpic>
+ arrow from M4.e to Dpic.w ".pic" above
+ arrow from M4.w to Gpic.e ".pic" above
+ arrow <- up vsep from 1/3<M4.nw,M4.ne>
+ `"\setbox0=\hbox{Diagram source}\raisebox{-\dp0}{\box0}"' rjust
+ arrow <- up vsep from 2/3<M4.nw,M4.ne>
+ `"Macro libraries"' ljust
+]
+
+# print last [].wid
+
+command "}%"
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/Xform.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/Xform.m4
new file mode 100644
index 00000000000..697d87fafa8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/Xform.m4
@@ -0,0 +1,39 @@
+.PS
+# `Xform.m4'
+cct_init
+
+divert(-1)
+define(`trlabels',
+ `{ thinlines_
+ ifelse(`$1',R,
+ `arrow from `$3'.P1 <- right 0.12 up 0.072 chop 1pt__ ; "\sl P1" ljust
+ arrow from `$3'.P2 <- right 0.12 down 0.072 chop 1pt__ ; "\sl P2" ljust
+ arrow from `$3'.TP <- right 0.12 chop 1pt__ ; "\sl TP" wid 0.2 ljust
+ arrow from `$3'.S1 <- left 0.12 up 0.072 chop 1pt__ ; "\sl S1" rjust
+ arrow from `$3'.S2 <- left 0.12 down 0.072 chop 1pt__ ; "\sl S2" rjust
+ arrow from `$3'.TS <- left 0.12 chop 1pt__ ; "\sl TS" rjust
+ ',`
+ arrow from `$3'.P1 <- left 0.12 up 0.072 chop 1pt__ ; "\sl P1" rjust
+ arrow from `$3'.P2 <- left 0.12 down 0.072 chop 1pt__ ; "\sl P2" rjust
+ arrow from `$3'.TP <- left 0.12 chop 1pt__ ; "\sl TP" wid 0.2 rjust
+ arrow from `$3'.S1 <- right 0.12 up 0.072 chop 1pt__ ; "\sl S1" ljust
+ arrow from `$3'.S2 <- right 0.12 down 0.072 chop 1pt__ ; "\sl S2" ljust
+ arrow from `$3'.TS <- right 0.12 chop 1pt__ ; "\sl TS" ljust
+ ')
+ `"'\tt `$2'`"' at `$3'.s+(0,-(`$4'))
+ thicklines_ } ')
+divert(0)dnl
+
+ down_
+ T1: transformer
+ trlabels(,`transformer',T1,0.3)
+ T2: transformer(down_ 0.6,,2,P,8) with .w at T1.e+(1,0)
+ trlabels(,`...(down\_ 0.6,,2,P,8)',T2,0.3)
+ T3: transformer(,,8,WD12,4) with .w at T2.e+(1,0)
+ trlabels(,`...(,,8,WD12,4)',T3,0.21)
+ T4: transformer(,,9,AL) with .sw at T3.se+(1,0)
+ trlabels(,`...(,,9,AL)',T4,0.3)
+ T5: transformer(,R,8,AW) with .sw at T4.se+(1,0)
+ trlabels(R,`...(,R,8,AW)',T5,0.3)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/bi_trans.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/bi_trans.m4
new file mode 100644
index 00000000000..9884a14007b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/bi_trans.m4
@@ -0,0 +1,65 @@
+.PS
+# `bi_trans.m4'
+sinclude(Circuit_macros.dim)
+s_init(bitrans)
+ifdef(`bitrans_1',,`sinclude(tst.dim)')
+
+cct_init
+
+[[
+Q: bi_trans(,,BCuEBUS)
+ s_box($C$) at Q.C below
+ s_box($B$) at Q.B above
+ s_box($E$) at Q.E below
+
+thinlines_
+M4_xyO: Q.M4_xyO
+ spline <- from tr_xy(0,5.25) left 0.1 then up 0.15 left 0.15
+ s_box(\tt B) above
+ spline <- from 0.5<tr_xy(3,0),tr_xy(1.2,4)> right 0.1 then right 0.15 up 0.15
+ s_box(\tt C) ljust
+ spline <- from 0.7<tr_xy(-2,4),tr_xy(2,4)> up 0.1 then right 0.15 up 0.15
+ s_box(\tt BU) above
+ spline <- from 0.7<tr_xy(-3,0),tr_xy(-1.2,4)> left 0.1 then left 0.15 up 0.15
+ s_box(\tt uE) rjust
+ arrow <- from Q.Bulk.start+vec_(vscal_(m4_U,0,0.5)) up 0.15 left 0.15
+ s_box(\tt S) above rjust
+ arrow <- from Q.Bulk.end up 0.1 right 0.1
+ s_box($\;\;$\tt S) above
+ ]
+ s_box(\tt bi\_trans(,{,}BCuEBUS)) at last [].s below
+]
+
+[[
+Q2: bi_trans(,,BCdE2BU)
+ s_box($C$) at Q2.C below
+ s_box($B$) at Q2.B above
+
+thinlines_
+M4_xyO: Q2.M4_xyO
+ arrow <- from Q2.E0 down 0.1 right 0.1; s_box($\;\;E0$) below
+ arrow <- from Q2.E2 down 0.1 left 0.1; s_box($E2\;\;$) below
+ arrow <- from Q2.E1 down 0.1 ; s_box($E1$) below
+ spline <- from 0.4<Q2.Em2.start,Q2.Em2.end> left 0.1 then up 0.15 left 0.15
+ s_box($Em2\;\;$) above
+ ]
+ s_box(\tt bi\_trans(,{,}BCdE2BU)) at last [].s below
+] with .nw at last [].ne+(0.5,0)
+
+[[
+Q2: bi_trans(,,BC2dEBU)
+ s_box($E$) at Q2.E below
+ s_box($B$) at Q2.B above
+
+thinlines_
+M4_xyO: Q2.M4_xyO
+ arrow <- from Q2.C0 down 0.1 left 0.1; s_box($C0\;\;$) below
+ arrow <- from Q2.C2 down 0.1 right 0.1; s_box($\;\;C2$) below
+ arrow <- from Q2.C1 down 0.1 ; s_box($C1$) below
+ spline <- from 0.4<Q2.Cm2.start,Q2.Cm2.end> right 0.1 then up 0.15 right 0.15
+ s_box($Cm2\;\;$) above
+ ]
+ s_box(\tt bi\_trans(,{,}BC2dEBU)) at last [].s below
+] with .nw at last [].ne+(0.5,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/bistable.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/bistable.m4
new file mode 100644
index 00000000000..d158e10a041
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/bistable.m4
@@ -0,0 +1,35 @@
+.PS
+# `bistable.m4'
+cct_init # Default initialization
+
+ up_
+rgbdraw(1,0,0,
+Q1: bi_tr(,R) # Q1 upward with base to the right
+ llabel(,Q_1) ) # Label to left of last []
+rgbdraw(0,0,1,
+Q2: bi_tr with .C at Q1.C+(elen_*7/4,0) # Q2 with base to left
+ rlabel(,Q_2) )
+
+ ground(at Q1.E)
+ ground(at Q2.E)
+
+ line right_ dimen_/3 from Q1.B # Extend the base conductors
+B1: Here
+ line left_ dimen_/3 from Q2.B
+B2: Here
+
+ resistor(up_ elen_*0.75 from Q1.C); llabel(,"$R_L$" wid 0.16) #Load resistors
+ line to (Q2.C,Here) "$V_{\hbox{cc}}$" below
+ resistor(down_ to Q2.C); llabel(,R_L)
+
+ move to Q1.C+(0,dimen_/5)
+ { resistor(right_ to (B1,Here)); llabel(,R_1)
+X: line to B2 } # Label the line to be jumped
+ resistor(from (Q2.C,Here) left_ to (B2,Here)); rlabel(,R_1)
+ crossover(to B1,R,X)
+
+ resistor(down_ elen_*0.75); rlabel(,R_2) # Bias resistors
+ {"$-V_{\hbox{cc}}$" rjust}
+ line to (B2,Here)
+ resistor(up_ to B2); rlabel(,R_2)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/bitr.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/bitr.m4
new file mode 100644
index 00000000000..d5dd735ee65
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/bitr.m4
@@ -0,0 +1,5 @@
+.PS
+# `bitr.m4'
+cct_init
+include(bitrbody.m4)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/bitrbody.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/bitrbody.m4
new file mode 100644
index 00000000000..597b83a0cb4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/bitrbody.m4
@@ -0,0 +1,4 @@
+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
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/body.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/body.tex
new file mode 100644
index 00000000000..d1fb66d6261
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/body.tex
@@ -0,0 +1,3342 @@
+% body.tex
+\newcommand{\bq}{}
+\newcommand{\dpic}{{\bq dpic}\xspace}
+\newcommand{\Dpic}{{\bq Dpic}\xspace}
+\newcommand{\dvips}{{\bq dvips}\xspace}
+\newcommand{\gpic}{{\bq gpic}\xspace}
+\newcommand{\Gpic}{{\bq Gpic}\xspace}
+\newcommand{\groff}{{\bq groff}\xspace}
+\newcommand{\latex}{\LaTeX\xspace}
+\newcommand{\linespec}{{\sl linespec}\xspace}
+\newcommand{\MetaPost}{{\bq MetaPost}\xspace}
+\newcommand{\Mfour}{{\bq m4}\xspace}
+\newcommand{\mfpic}{{\bq mfpic}\xspace}
+\newcommand{\PDF}{{\bq PDF}\xspace}
+\newcommand{\pic}{{\bq pic}\xspace}
+\newcommand{\Pic}{{\bq Pic}\xspace}
+\newcommand{\Postscript}{{\bq Postscript}\xspace}
+\newcommand{\PSTricks}{{\bq PSTricks}\xspace}
+\newcommand{\SVG}{{\bq SVG}\xspace}
+\newcommand{\tex}{\TeX\xspace}
+\newcommand{\Textregistered}{\textregistered\xspace}
+\newcommand{\TPGF}{{\bq Ti{\it k}z~PGF}\xspace}
+\newcommand{\Tikz}{{\bq Ti{\it k}z}\xspace}
+\newcommand{\tpic}{{\bq tpic}\xspace}
+\newcommand{\xfig}{{\bq xfig}\xspace}
+\newcommand{\Xfig}{{\bq Xfig}\xspace}
+%
+\newcommand{\xection}[1]{\section[\texorpdfstring{#1\ \dotfill}{#1}]{#1}}
+\newcommand{\NVL}{\\\hspace*{\parindent}}
+\newcommand{\brtt}{\hfill\break\hspace*\parindent}
+\newcommand{\lbr}{{\tt\char123}}
+\newcommand{\rbr}{{\tt\char125}}
+\newcommand{\bsl}{{\tt\char92}}
+\newcommand{\SR}[1]{\hyperref[#1]{Section~\ref*{#1}}}
+\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{\REF}[1]{\hyperref[#1]{\ref*{#1}}}
+\newcommand{\LQ}{\char96}
+\newcommand{\RQ}{\char39}
+%
+\newcommand{\Example}[1]{\vspace{\parsep}\noindent {\bf Example #1:}}
+%
+ \pdfbookmark[section]{\contentsname}{toc}
+\begin{multicols}{2}
+ \tableofcontents
+\end{multicols}
+%\enlargethispage{\baselineskip}
+%
+\xection{Introduction\label{Introduction:}}
+ \begin{quotation}\noindent
+% Before every conference, I find Ph.D.s in on weekends running back
+% and forth from their offices to the printer.
+ It appears that people
+ who are unable to execute pretty pictures with pen and paper find it
+ gratifying to try with a computer~\cite{Landauer95}.
+ \end{quotation}
+
+This manual
+%\footnote{%
+%This manual is best viewed with a reader that shows bookmarks
+%for easy navigation and for exploring the list of defined macros.}%
+describes a method for drawing electric circuits and
+other diagrams in \latex and web documents.
+The diagrams are defined in the simple \pic drawing language~\cite{KRpic}
+augmented with \Mfour macros~\cite{KRm4}, and are
+processed by \Mfour and a \pic processor to
+convert them to \TPGF, \PSTricks, other \latex-compatible code, or \SVG.
+In its basic form, the method has the advantages and disadvantages of
+\tex 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 IEEE
+standards~\cite{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.
+
+\xection{Using the macros\label{Using:}}
+This section describes the basic process of adding circuit diagrams to
+\latex documents to produce postscript or pdf files. On some operating
+systems, project management software with graphical interfaces can be used
+to automate the process,
+but the steps can also be performed by a script,
+makefile, or by hand for simple documents as described in~\SR{Quickstart:}.
+
+The diagram source file is preprocessed as illustrated in
+\FR{Flowdiag}. A configuration file is read by \Mfour,
+followed by the diagram source.
+The result is passed through a
+\pic interpreter to produce {\tt .tex} output that can be inserted
+into a {\tt .tex} document using the \verb|\input| command.
+
+\begin{figure}[hbt]
+ \pdftooltip{\input Flowdiag }{Flow diagram for the inclusion of figures}
+ \caption{Inclusion of figures and macros in the \latex document.
+ \label{Flowdiag}}
+ \end{figure}
+
+\noindent
+The interpreter output contains
+\TPGF~\cite{tikz} commands,
+\PSTricks~\cite{pstricks} commands,
+basic \latex graphics,
+\tpic specials, or other formats,
+depending on the chosen options.
+These variations are described in \SR{Alternative:}.
+
+There are two principal choices of \pic interpreter. One is~\dpic,
+described later in this document. A partial alternative is
+GNU {\bq gpic -t} (sometimes simply named \pic)~\cite{gpic}
+together with a printer driver
+that understands \tpic specials, typically {\bq dvips}~\cite{dvips}.
+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 \Mfour.
+
+\subsection{Quick start\label{Quickstart:}}
+The contents of file {\tt quick.m4} and resulting diagram are shown in
+\FR{quick} to illustrate the language
+% 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!]
+ \parbox{\textwidth}{\small\verbatiminput{quick.m4}}%
+ \hfill\llap{\raise-1.15in\hbox{\input quick }}%
+% \hfill\llap{\raise-1.15in\hbox{\pdftooltip{\input quick }%
+% {The file {\tt quick.m4} and resulting diagram.
+% There are several ways of drawing the same picture; for example,
+% nodes (such as {\tt Origin}) can be defined and circuit branches
+% drawn between them; or absolute coordinates can be used (e.g.,
+% {\tt source(up\_ from (0,0) to (0,0.75))} ). Element sizes and styles
+% can be varied as described in later sections.}}}%
+ \vspace*{-\baselineskip}%
+ \caption{The file {\tt quick.m4} and resulting diagram.
+ There are several ways of drawing the same picture; for example,
+ nodes (such as {\tt Origin}) can be defined and circuit branches
+ drawn between them; or absolute coordinates can be used (e.g.,
+ {\tt source(up\_ from (0,0) to (0,0.75))} ). Element sizes and styles
+ can be varied as described in later sections.\label{quick}}%
+ \end{figure}
+
+\subsubsection{\protect{Using \Mfour}%
+\label{Usingmfour:}}
+The command
+
+ {\vspace*\parsep\tt
+ m4 {\sl filename \ldots}
+ \vspace*\parsep}
+
+\noindent
+causes \Mfour\ to search for the named
+files in the current directory and directories specified
+by environmental variable {\tt M4PATH}.
+Set {\tt M4PATH} to the full name (i.e., the path) of the directory containing
+{\tt libcct.m4} and the other circuit library {\tt .m4} files; otherwise
+invoke \Mfour\ as {\tt m4 -I} {\sl installdir}
+where {\sl 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 \SR{Simplifications:} for simplified use.
+
+\subsubsection{\protect{Processing with \dpic and \PSTricks or \TPGF}%
+\label{Processingwithpstricks:}}
+If you are using \dpic with \PSTricks,
+put \verb|\usepackage{pstricks}| in the main \latex source file header and
+type the following commands or put them into a script:
+
+ {\vspace*\parsep\tt
+ m4 pstricks.m4 quick.m4 > quick.pic
+ \brtt
+ dpic -p quick.pic > quick.tex
+ \vspace*\parsep}
+
+
+\noindent
+To produce \TPGF code,
+the \latex header should contain \verb|\usepackage{tikz}|.
+The commands are modified to read \verb|pgf.m4|
+and invoke the {\tt-g} option of \dpic as follows:
+
+ {\vspace*\parsep\tt
+% {\tt
+ m4 pgf.m4 quick.m4 > quick.pic
+ \brtt
+ dpic -g quick.pic > quick.tex
+ \vspace*\parsep}
+
+A configuration file ({\tt pstricks.m4} and {\tt pgf.m4} in the
+above examples) is {\em always} the first file to be given to \Mfour.
+Put the following or its equivalent in the document body:
+\begin{verbatim}
+\begin{figure}[hbt]
+ \centering
+ \input quick
+ \caption{Customized caption for the figure.}
+ \label{Symbolic_label}
+\end{figure}
+\end{verbatim}
+Then for \PSTricks,
+the commands ``{\tt latex} {\sl file}{\tt;} {\tt dvips} {\sl file}''
+produce {\sl file}{\tt.ps},
+which can be printed or viewed using {\tt gsview}, for example.
+For \TPGF,
+Invoking PDFlatex on the source produces {\tt .pdf} output directly.
+%Whether or not the figure environment is used,
+%the essential line in all cases is \verb|\input quick|.
+The essential line is \verb|\input quick| whether or not the figure
+environment is used.
+
+The effect of the \Mfour command above is shown in \FR{ConfigA}.
+Configuration files {\tt pstricks.m4} or {\tt pgf.m4}
+cause library {\tt libgen.m4}
+to be read, thereby defining the macro {\tt cct\_init}.
+The diagram source file is then read and
+the circuit-element macros in {\tt libcct.m4} are defined during
+expansion of {\tt cct\_init}.
+\begin{figure}[hbt]
+ \input ConfigA
+ \caption{The command
+ {\tt m4 pstricks.m4 quick.m4 > quick.pic}.
+ \label{ConfigA}}
+ \end{figure}
+
+\subsubsection{Processing with \gpic\label{Processingwithgpic:}}
+If your printer driver understands \tpic specials and
+you are using \gpic (on some systems the \gpic command is {\tt pic}),
+the commands are
+
+ {\tt
+ m4 gpic.m4 quick.m4 > quick.pic
+ \brtt
+ gpic -t quick.pic > quick.tex
+ \vspace*\parsep}
+
+\noindent
+and the figure inclusion statements are as shown:
+\begin{verbatim}
+\begin{figure}[hbt]
+ \input quick
+ \centerline{\box\graph}
+ \caption{Customized caption for the figure.}
+ \label{Symbolic_label}
+ \end{figure}
+\end{verbatim}
+
+\subsubsection{Simplifications\label{Simplifications:}}
+M4 must read a configuration file before any other files,
+%followed by the macro definitions in one or more library files,
+either before reading the diagram source file or at the beginning of it.
+There are several ways to control the process, as follows:
+\begin{enumerate}
+\item
+The macros can be processed by \latex-specific
+project software and by graphic applications such as Cirkuit~\cite{KDEApps2009}.
+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.
+
+\item
+The \Mfour commands illustrated above can be shortened to
+
+\verb|m4 quick.m4 > quick.pic|
+
+\noindent
+by inserting {\tt include(pstricks.m4)} (assuming \PSTricks processing)
+%or {\tt include(libgen.m4)} (assuming the default processor is to be used)
+{\em immediately} after the {\tt .PS} line, the effect of which
+%The effect of the first include statement
+is shown in \FR{ConfigB}.
+However, if you then want to use \TPGF,
+the line must be changed to {\tt include(pgf.m4)}.
+%and the second in \FR{ConfigC}.
+\begin{figure}[h!]
+ \input{ConfigB}
+ \caption{The command {\tt m4 quick.m4 > quick.pic},
+ with {\tt include(pstricks.m4)} preceding {\tt cct\_init}.}
+ \label{ConfigB}
+ \end{figure}
+%\begin{figure}[h!]
+% \input{ConfigC}
+% \caption{The command {\tt m4 quick.m4 > quick.pic},
+% with {\tt include(libgen.m4)} preceding {\tt cct\_init}, causing
+% the default configuration file to be read.}
+% \label{ConfigC}
+% \end{figure}
+
+%\item
+%On some systems, setting the environment variable {\tt M4PATH} to {\sl
+%installdir} allows the {\tt -I} {\sl installdir} option of \Mfour to
+%be omitted, but it will be kept in following examples.
+
+\item
+In the absence of a need to examine the file {\tt quick.pic},
+the commands for producing the {\tt .tex} file can be reduced
+(provided the above inclusions have been made) to
+
+\verb%m4 quick.m4 | dpic -p > quick.tex%
+
+\item
+It may be desirable to invoke \Mfour and \dpic automatically from the
+document file as shown:
+
+{\tt \verb^\documentclass{article}^ \brtt
+\verb^\usepackage{tikz}^ \brtt
+\verb^\newcommand\mtotex[2]{\immediate\write18{m4 ^%-I^ {\sl installdir}
+\verb^#2.m4 | dpic -#1 > #2.tex}}%^\break
+\verb^\begin{document}^ \brtt
+\verb^\mtotex{g}{FileA} % Generate FileA.tex^ \brtt
+\verb^\input{FileA.tex} \par^ \brtt
+\verb^\mtotex{g}{FileB} % Generate FileB.tex^ \brtt
+\verb^\input{FileB.tex}^ \brtt
+\verb^\end{document}^
+ \vspace*\parsep}
+
+The first argument of \verb|\mtotex| is a {\tt p} for pstricks or
+{\tt g} for pgf.
+Sources \verb|FileA.m4| and \verb|FileB.m4| must contain any required
+\verb|include| statements,
+and the main document should be processed using
+the latex or pdflatex option \verb|-shell-escape|.
+If the {\tt M4PATH} environment variable is not set then insert
+{\tt -I }{\sl installdir} after {\tt m4} in the command definition,
+where {\sl installdir} is the absolute path to the installation directory.
+This method processes the picture source each time \latex is run, so for
+large documents containing many diagrams, the \verb|\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 \SR{Tikzwithpic:}.
+
+\item
+You can put several diagrams into a single source file.
+Make each diagram the body of a \latex macro, as shown:
+
+%\enlargethispage{\baselineskip}
+\par
+\verb|\newcommand{\diaA}{%|\NVL
+\verb|.PS|\NVL
+{\sl drawing commands}\NVL
+\verb|.PE|\NVL
+\verb|\box\graph }% \box\graph not required for dpic|\NVL
+\verb|\newcommand{\diaB}{%|\NVL
+\verb|.PS|\NVL
+{\sl drawing commands}\NVL
+\verb|.PE|\NVL
+\verb|\box\graph }% \box\graph not required for dpic|\NVL
+Produce a {\tt .tex} file using \verb|\mtotex|
+or \Mfour and \dpic or \gpic,
+insert the {\tt .tex} into the \latex source, and
+invoke the macros \verb^\diaA^ and \verb^\diaB^ at the appropriate places.
+\end{enumerate}
+
+\subsection{Including the libraries\label{Libraries:}}
+The configuration files for \dpic are as follows,
+depending on the output format (see \SR{Alternative:}):
+{\tt pstricks.m4, pgf.m4, mfpic.m4, mpost.m4, postscript.m4, psfrag.m4, svg.m4,
+ gpic.m4,} or {\tt xfig.m4}.
+The file {\tt psfrag.m4} simply defines the macro {\tt psfrag\_} and
+then reads {\tt postscript.m4}.
+For \gpic, the configuration file is {\tt gpic.m4}.
+The usual case for producing circuit diagrams is to read
+{\tt pstricks.m4} or {\tt 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,
+
+{\tt cct\_init, log\_init, sfg\_init, darrow\_init, threeD\_init}
+
+\noindent
+or, for diagrams not requiring specialized macros, {\tt gen\_init}.
+As shown in \FRS{ConfigA} and~\REF{ConfigB},
+each initialization command reads in the appropriate macro
+library if it hasn't already been read;
+for example, {\tt cct\_init} tests whether {\tt 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
+{\tt Flow.m4} or {\tt 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 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 {\tt m4}.
+
+\xection{\Pic essentials\label{Pic:}}
+
+\Pic source is a sequence of lines in a file.
+The first line of a diagram begins with {\tt .PS} with optional following
+arguments, and the last line is normally {\tt .PE}.
+Lines outside of these pass through the \pic processor unchanged.
+
+The visible objects can be divided conveniently into two classes, the
+{\em linear} objects {\tt line, arrow, spline, arc,} and the
+{\em planar} objects {\tt box, circle, ellipse.}
+
+The object {\tt move} is linear but draws nothing. A compound object,
+or {\tt block,} is planar and consists of a pair of square brackets enclosing
+other objects, as described in \SR{Compoundobjects:}.
+Objects can be placed using absolute coordinates or relative to other objects.
+
+\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.
+
+\subsection{Manuals\label{Manuals:}}
+The classic \pic manual~\cite{KRpic} is still a good introduction to \pic, but
+a more complete manual~\cite{Raymond95} can be found in the GNU \groff\
+package, and both are available on the web~\cite{KRpic,Raymond95}. Reading
+either will give you competence with \pic in an hour or two. Explicit mention
+of {\tt *roff} string and font constructs in these manuals should be replaced by
+their equivalents in the \latex context. A man-page language summary is
+appended to the \dpic manual~\cite{Aplevich2011}.
+
+A web search will yield good discussions of ``little languages'';
+for \pic in particular, see Chapter~9 of~\cite{Bentley88}.
+Chapter~1 of reference~\cite{Goossens97} also contains a brief
+discussion of this and other languages.
+
+\subsection{The linear objects: {\tt line, arrow, spline, arc}%
+\label{Linearobjects:}}
+A line can be drawn as follows:
+
+{\tt line from} {\sl position} {\tt to} {\sl position}
+
+\noindent
+where {\sl position} is defined below or
+
+{\tt line} {\sl direction} {\sl distance}
+
+\noindent
+where {\sl direction} is one of {\tt up,} {\tt down,} {\tt left,}
+{\tt right.} When used with the \Mfour macros described here, it is
+preferable to add an underscore: {\tt up\_,} {\tt down\_,} {\tt left\_,}
+{\tt right\_.} The {\sl distance} is a number or expression
+and the units are inches, but the assignment
+
+{\tt scale = 25.4}
+
+\noindent
+has the effect of changing the units to millimetres,
+as described in \SR{Scaling:}.
+
+Lines can also be drawn to any distance in any direction. The example,
+
+{\tt line up\_ 3/sqrt(2) right\_ 3/sqrt(2) dashed}
+
+\noindent
+draws a line 3 units long from the current location,
+at a $45^\circ$ angle above horizontal.
+Lines (and other objects) can be specified as {\tt dotted,} {\tt dashed,} or
+{\tt invisible,} as above.
+
+The construction
+
+{\tt line from A to B chop x}
+
+\noindent
+truncates the line at each end by {\tt x} (which may be negative)
+or, if {\tt x} is omitted, by
+the current circle radius, which is convenient when A and B are
+circular graph nodes, for example. Otherwise
+
+{\tt line from A to B chop x chop y}
+
+\noindent
+truncates the line by {\tt x} at the start and {\tt 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:
+
+{\tt line up\_ sqrt(3) right\_ 1 then down\_ sqrt(3) right\_ 1 then left\_ 2}
+
+\subsection{Positions\label{Positions:}}
+A {\sl position} can be defined by a coordinate pair, e.g. {\tt 3,2.5},
+more generally using parentheses by {\tt (}{\sl expression, expression}{\tt )},
+as a sum or difference as
+{\tt{\sl position} $+$ ({\sl expression, expression})},
+or by the construction {\tt (}{\sl position, position}{\tt )},
+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. {\tt Top:~(0.5,4.5)}. Such a definition does not affect the calculated
+figure boundaries. The current position {\tt 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. {\tt Top.x} and
+{\tt 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:
+
+{\tt 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:
+
+{\tt Bus23: line up right}
+
+\noindent
+after which, positions associated with the object can be referenced using the
+name; for example:
+
+{\tt 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
+
+{\tt arc cw from Bus23.start to Bus23.end}
+
+\noindent
+does {\em not} define the arc uniquely; there are two arcs that satisfy this
+specification.
+This distribution includes the \Mfour macros
+
+{\tt arcr( {\sl position, radius, start radians, end radians, modifiers, ht})
+\hfill\break\indent
+ arcd( {\sl position, radius, start degrees, end degrees, modifiers, ht})
+\hfill\break\indent
+ arca( {\sl chord linespec,} ccw|cw, {\sl radius, modifiers})
+}
+
+\noindent to draw uniquely defined arcs.
+If the fifth argument of {\tt arcr} or {\tt arcd} contains {\tt ->} or {\tt <-}
+then a midpoint arrowhead of height specified by arg6 is added.
+For example,
+
+{\tt arcd((1,-1),{},0,-90,<- outlined "red") dotted}
+
+\noindent draws a red dotted arc with midpoint arrowhead,
+ centre at $(1,-1),$ and default radius.
+ The example
+
+{\tt arca(from (1,1) to (2,2),{,}1,->)}
+
+\noindent 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:
+
+{\tt line dashed <- right 0.5\hfill\break
+\hspace*{\parindent}%
+arc <-> height 0.06 width 0.03 ccw from Here to Here+(0.5,0)
+ \char92\hfill\break
+\hspace*{2\parindent}%
+ with .center at Here+(0.25,0)\hfill\break
+\hspace*{\parindent}%
+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
+{\tt height} and {\tt width} parameters.
+
+\subsection{The planar objects: {\tt box, circle, ellipse}, and text%
+\label{Planarobjects:}}
+Planar objects are drawn by specifying the width, height, and position, thus:
+
+{\tt A: box ht 0.6 wid 0.8 at (1,1)}
+
+\noindent
+after which, in this example, the position {\tt A.center} is defined,
+and can be referenced simply as {\tt A}.
+The compass points {\tt A.n,} {\tt A.s,} {\tt A.e,} {\tt A.w,} {\tt A.ne,}
+{\tt A.se,} {\tt A.sw,} {\tt A.nw} are automatically defined, as are
+the dimensions {\tt A.height} and {\tt 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:
+
+{\tt circle radius 0.2\hfill\break
+\hspace*{\parindent}%
+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
+
+{\tt box dashed fill\_({\sl number})}\quad or\quad
+ {\tt box dashed outlined "{\sl color}" shaded "{\sl color}"}
+
+\noindent
+produces a dashed box. The first case has a gray fill determined by
+{\sl 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
+{\tt rgbstring({\sl red fraction, green fraction, blue fraction})};
+to produce an orange fill for example:
+
+{\tt ... shaded rgbstring( 1, 0.645, 0)}
+
+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
+%by inserting postprocessor commands using
+%{\tt \char92 special} commands or
+%other lines beginning with a backslash in the drawing code. In fact,
+%arbitrary lines can be inserted into the output using
+
+{\tt command "}{\sl string}{\tt "}
+
+\noindent where {\sl string} is one or more postprocessor command lines.
+
+Arbitrary text strings, typically meant to be typeset by \latex, are
+delimited by double-quote characters and occur in two ways. The first
+way is illustrated by
+
+\verb|"\large Resonances of $C_{20}H_{42}$"|
+ \verb|wid |{\sl x}\verb| ht |{\sl y}\verb| at |{\sl position}
+
+\noindent
+which writes the typeset result, like a box, at {\sl position} and tells
+\pic its size. The default size assumed by \pic is given by parameters
+{\tt textwid} and {\tt textht} if it is not specified as above.
+The exact typeset size of formatted text can be obtained
+as described in \SR{Interaction:}. 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:
+%\enlargethispage{\baselineskip}
+
+\verb|ellipse "\bf Stop" "\bf here"|
+
+\noindent
+The C-like \pic function
+ {\tt sprintf("{\sl format string}",{\sl numerical arguments})}
+is equivalent to a string.
+
+\subsection{Compound objects\label{Compoundobjects:}}
+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:
+
+\noindent%
+\verb| Ands: [ right_|\\
+\verb| And1: AND_gate|\\
+\verb| And2: AND_gate at And1 - (0,And1.ht*3/2)|\\
+\verb| |$\ldots$\\
+\verb| ] with .And2.In1 at| {\sl position} % (K.x,IC5.Pin9.y)|
+
+The two gate macros evaluate to compound objects containing {\tt Out},
+{\tt 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 {\tt In1} of gate {\tt And2}.
+
+\subsection{Other language facilities\label{Otherlanguage:}}
+
+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
+
+{\sl expression} {\tt between} {\sl position}
+ {\tt and} {\sl position}
+
+\noindent%
+which means
+
+$\hbox{\sl 1st position} + \hbox{\sl expression} \times
+ (\hbox{\sl 2nd position} - \hbox{\sl 1st position})$
+
+\noindent and which can be abbreviated as
+
+{\sl expression} {\tt <} {\sl position} {\tt ,} {\sl position} {\tt >}
+
+\noindent%
+Care has to be used in processing the latter construction with \Mfour,
+since the comma may have to be put within quotes, {\tt `,'}
+to distinguish it from the {\tt m4} argument separator.
+
+Positions can be calculated using expressions containing variables.
+The scope of a position is the current block. Thus, for example,
+
+{\tt
+ 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 {\tt scale,} variables,
+horizontal or vertical coordinates of terms such as
+{\sl position}{\tt.x} or {\sl position}{\tt.y},
+dimensions of \pic objects, e.g. {\tt last circle.rad}.
+The elementary algebraic operators are
+{\tt +, -, *, /, \%, =, +=, -=, *=, /=,} and {\tt \%=,}
+similar to the C language.
+
+The logical operators {\tt ==, !=, <=, >=, >,} and {\tt <} apply to
+expressions and strings. A modest selection of numerical functions is
+also provided: the single-argument functions {\tt sin, cos, log, exp,
+sqrt, int}, where {\tt log} and {\tt exp} are base-10, the two-argument
+functions {\tt atan2, max, min,} and the random-number generator {\tt
+rand()}. Other functions are also provided using macros.
+
+A \pic manual should be consulted for details, more examples, and
+other facilities, such as the branching facility
+
+\verb|if |{\sl expression}\verb| then { |{\sl anything}
+ \verb|} else { |{\sl anything}\verb| }|,
+
+\noindent%
+the looping facility
+
+\verb|for |{\sl variable}\verb| = |{\sl expression}\verb| to |%
+{\sl expression}\verb| by |{\sl expression}\verb| do { |%
+{\sl anything}\verb| }|,
+
+\noindent%
+%\enlargethispage{\baselineskip}
+operating-system commands, \pic macros, and external file inclusion.
+
+\xection{Two-terminal circuit elements\label{Basictwo:}}
+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 \SR{Compoundobjects:}. The two-terminal element macros follow a
+set of conventions described in this section, and other elements will
+be described in \SR{Composite:}.
+
+\subsection{Circuit and element basics\label{Basics:}}
+A list of the library macros and their arguments is in
+\SR{defines}. The arguments have default values, so that only
+those that differ from defaults need be specified.
+
+\FR{BigResistor}, which shows a resistor, also serves as
+an example of \pic commands.
+%Consider the resistor shown in \FR{BigResistor},
+%which also serves as an example of \pic commands.
+The first part of the source file for this figure is
+%as follows:
+on the left:
+
+\begin{figure}[hbt]
+ \parbox{2in}{\tt .PS\\ \hbox{}\quad cct\_init\\ \hbox{}\quad linewid = 2.0\\
+ \hbox{}\quad linethick\_(2.0)\\ R1: resistor}
+ \raisebox{-0.3in}{\hbox{\input{BigResistor.tex}}}
+ \caption{Resistor named {\tt R1}, showing the size parameters,
+ enclosing block, and predefined positions.}
+ \label{BigResistor}
+ \end{figure}
+The lines of \FR{BigResistor}
+and the remaining source lines of the file are explained below:
+\begin{itemize}
+\item The first line invokes the macro {\tt cct\_init} that
+ loads the library {\tt libcct.m4}
+ and initializes local variables needed by some circuit-element macros.
+
+\item
+ The sizes of circuit elements are proportional to the \pic environmental
+ variable {\tt linewid}, so redefining this variable changes element
+ sizes. The element body is drawn in proportion to {\tt dimen\_},
+ a macro that evaluates to {\tt linewid} unless redefined, and the default
+ element length is {\tt elen\_}, which evaluates to
+ {\tt dimen\_*3/2} unless redefined.
+ Setting {\tt 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 {\tt dimen\_/2,} and the
+ width is {\tt dimen\_/6.} All of these values can be customized.
+ Element scaling and the use of SI units is discussed further in
+ \SR{Scaling:}.
+
+\item The macro {\tt 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 \Mfour 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.
+\item The two-terminal element macros expand to sequences of drawing commands
+ that begin with {\tt `line invis \linespec'},
+ where \linespec is the first argument of the macro if it
+ is non-blank, otherwise the line is drawn a distance
+ {\tt elen\_} in the current direction, which is to the right by
+ default.
+% All this is handled by the macro {\tt eleminit\_}, which also
+% calculates the length and angle of the invisible line for later use.
+ 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, {\tt R1} in the example, so that positions
+ {\tt R1.start}, {\tt R1.centre}, and {\tt R1.end} are automatically
+ defined as shown.
+\item 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.
+\item 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.
+% This might be over-kill.
+ If you create your own macros, you might choose simplicity over generality,
+ and include only visible lines.
+ \end{itemize}
+
+To produce \FR{BigResistor}, the following embellishments
+were added after the previously shown source:
+{\small \input BigResistor2.verb }
+
+\begin{itemize}
+\item The line thickness is set to the default thin value of \hbox{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.
+\item 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 {\tt ljust} are {\tt rjust,}
+ {\tt above,} and {\tt below.}
+
+\item The last paragraph invokes a macro for dimensioning diagrams.
+ \end{itemize}
+
+\subsection{The two-terminal elements\label{Twoterminal:}}
+The two-terminal elements are shown in \FRS{CctTable} to~\REF{Diodes}
+and \FRS{Fuses} to~\REF{Switches}.
+Several elements are included more than once to illustrate
+some of their arguments, which are listed in \SR{defines}.
+\begin{figure}[h!]
+ \input CctTable
+ \ifpdf\vspace*{-0.5\baselineskip}\fi%
+ \caption{Basic two-terminal elements, showing some variations.}
+ \label{CctTable}
+ \end{figure}
+
+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.
+\begin{figure}[t!]
+ \input Sources
+ \ifpdf\vspace*{-0.5\baselineskip}\fi%
+ \caption{Sources and source-like elements.}
+ \label{Sources}
+ \end{figure}
+\begin{figure}[t!]
+ \input Diodes
+ \caption{The macro
+ {\tt diode(\linespec,B|CR|D|L|LE[R]|P[R]|S|T|V|v|w|Z|{\sl chars},[R][E])}.
+ Appending {\tt K} to the second argument draws an open arrowhead.}
+ \label{Diodes}
+ \end{figure}
+Thus, for example,
+
+{\tt resistor(up\_ 1.25,7)}
+
+\noindent%
+draws a resistor 1.25 units long up from the current position, with $7$
+vertices per side.
+The macro {\tt up\_} evaluates to {\tt up} but also resets the current
+directional parameters to point up.
+
+\FR{Emarrows} contains radiation-effect arrows for embellishing two-terminal
+and other macros.
+The arrow stems are named {\sl A1}, {\sl A2},
+and each pair is drawn in a \verb|[]| block, with
+the names {\sl Head} and {\sl Tail} defined to
+aid placement near another device. The second argument specifies
+absolute angle in degrees (default 135 degrees).
+\begin{figure}[h!t]
+ \input Emarrows
+ \caption{Radiation arrows: {\tt em\_arrows({\sl type, angle, length})}}
+ \label{Emarrows}
+ \end{figure}
+The arrows are drawn relative to the diode direction by the {\tt LE}
+option in \FR{Diodes}. For absolute arrow directions, one can
+define a wrapper (see \SR{Writing:}) for the {\tt diode} macro to draw arrows
+at 45 degrees, for example:
+
+{\tt define(`myLED',`diode(`\$1'); em\_arrows(N,45)
+ with .Tail at last [].ne')}
+
+\begin{figure}[t!]
+ \input Fuses
+ \caption{Variations of the macros
+ {\tt fuse(\linespec, A|dA|B|C|D|E|S|HB|HC, {\sl wid}, {\sl ht})}
+ and {\tt cbreaker(\linespec,L|R,D|T|TS)}.}
+ \label{Fuses}
+ \end{figure}
+\begin{figure}[t!]
+ \input AmpTable
+ \caption{Amplifier, delay, and integrator.}
+ \label{AmpTable}
+ \end{figure}
+\begin{figure}[t!]
+ \input Switches
+ \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.}
+ \label{Switches}
+ \end{figure}
+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
+
+{\tt reversed(`}{\sl macro name}{\tt',}{\sl macro arguments}{\tt )}
+
+\noindent
+is the name of a two-terminal element in quotes, followed by the
+element arguments. The element is drawn with reversed direction.
+Thus,
+
+{\tt diode(right\_ 0.4); reversed(`diode',right\_ 0.4)}
+
+\noindent
+draws two diodes to the right, but the second one points left.
+
+Similarly, the macro
+
+{\tt resized(}{\sl factor},`{\sl macro name}',{\sl macro arguments}{\tt )}
+
+\noindent
+can be used to resize the body of an element by temporarily multiplying
+the {\tt dimen\_} macro by {\sl factor}. More general resizing should be
+done by redefining {\tt dimen\_} as described in \SR{Circuitscaling:}.
+These two macros can be nested; the following scales the above example
+by 1.8, for example
+
+{\tt resized(1.8,`diode',right\_ 0.4);}
+{\tt resized(1.8,`reversed',`diode',right\_ 0.4)}
+
+\FR{Variable} shows some two-terminal elements with
+arrows or lines overlaid to indicate variability using the macro
+
+{\tt variable(`}{\sl element}{\tt',{\sl type},{\sl angle},{\sl length})},
+
+\noindent
+where {\sl type} is one of {\tt A, P, L, N,} with {\tt C} or {\tt S}
+optionally appended to indicate continuous or stepwise variation.
+Alternatively, this macro
+can be invoked similarly to the label macros in
+\SR{Labels:} by specifying an empty first argument;
+thus, the following line draws the resistor in \FR{Variable}:
+
+ {\tt resistor(down\_ dimen\_); variable(,uN)}
+
+\begin{figure}[h!t]
+\vspace*{-\baselineskip}
+ \input Variable
+ \caption{Illustrating
+{\tt variable(`{\sl element}',%
+[A|P|L|[u]N][C|S],{\sl angle},{\sl length})}.
+ For example,\break {\tt variable(`capacitor(down\_ dimen\_)')} draws
+ the leftmost capacitor shown above, and {\tt variable(`resistor(down\_
+ dimen\_)',uN)} draws the resistor. The default angle is
+ 45${}^{\circ}$, regardless of the direction of the element. The array
+ on the right shows the effect of the second argument.}
+ \label{Variable}
+ \end{figure}
+
+\subsection{Branch-current arrows\label{Branchcurrent:}}
+Arrowheads and labels can be added to conductors using basic
+\pic statements. For example, the following line adds a labeled
+arrowhead at a distance {\tt alpha} along a horizontal line that has
+just been drawn. Many variations of this are possible:
+
+ \verb|arrow right arrowht from last line.start+(alpha,0) "$i_1$" above|
+
+%\enlargethispage{\baselineskip}
+Macros have been defined to simplify labelling two-terminal
+elements, as shown in \FR{currents}.
+The macro
+
+ {\tt b\_current({\sl label,} above\_|below\_, In|O[ut], Start|E[nd],
+ {\sl frac})}
+
+\noindent
+draws an arrow from the start of the last-drawn two-terminal element
+{\sl frac} of the way toward the body.
+\begin{figure}[h!t]
+ \ifpdf\vspace*{-0.5\baselineskip}\fi%
+ \input currents
+ \caption{Illustrating {\tt b\_current, larrow,} and {\tt rarrow}.
+ The drawing direction is to the right.}
+ \label{currents}
+ \end{figure}
+
+If the fourth argument is {\tt End}, the arrow is drawn from the end
+toward the body.
+If the third element is {\tt Out}, the arrow is drawn outward from the body.
+The first argument is the desired label, of which the default position is
+the macro {\tt above\_,} which evaluates to {\tt above} if the current
+direction is right or to {\tt 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 {\tt 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
+{\tt below\_,} which places the label below with respect to the current
+direction. Absolute positions, for example {\tt below} or {\tt ljust},
+also can be specified.
+
+For those who prefer a separate arrow to indicate the reference
+direction for current, the macros {\tt larrow({\sl label}, ->|<-,{\sl dist})}
+and {\tt rarrow({\sl label}, ->|<-,{\sl dist})} are provided. The label is
+placed outside the arrow as shown in \FR{currents}. The first
+argument is assumed to be in math mode unless
+it begins with {\tt sprintf} or a double
+quote, in which case the argument is copied literally. The third argument
+specifies the separation from the element.
+%\begin{figure}[hbt]
+% \input lrarrows
+% \caption{The {\tt larrow} and {\tt rarrow} macros draw
+% reference-direction arrows adjacent to the element.}
+% \label{lrarrows}
+% \end{figure}
+
+\pagebreak%
+\subsection{Labels\label{Labels:}}
+ Special macros for labeling two-terminal elements are included:
+\par
+{\tt
+ llabel(} {\sl arg1,arg2,arg3} {\tt )
+ \hfill\break\hspace*{\parindent}%
+ clabel(} {\sl arg1,arg2,arg3} {\tt )
+ \hfill\break\hspace*{\parindent}%
+ rlabel(} {\sl arg1,arg2,arg3} {\tt )
+ \hfill\break\hspace*{\parindent}%
+ dlabel(} {\sl long,lat,arg1,arg2,arg3,}{\tt[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 {\em with respect to the
+current direction:} {\tt up, down, left, right.}
+The second places the arguments along the centre, and the third along the
+right side.
+A simple circuit example with labels is shown in \FR{Loop}.
+The macro {\tt dlabel} performs these functions for an
+obliquely drawn element, placing the three macro arguments at
+{\tt vec\_(-long,lat),} {\tt vec\_(0,lat),} and {\tt vec\_(long,lat)}
+respectively relative to the centre of the element.
+In the fourth argument, an {\tt X} aligns the labels with respect to the line
+joining the two terminals rather than the element body, and
+{\tt A, B, L, R} use absolute {\tt above, below, left,} or {\tt right} alignment
+respectively for the labels.
+Labels beginning
+with {\tt sprintf} or a double quote are copied literally rather than
+assumed to be in math mode.
+
+ Arbitrary \latex including {\bsl\tt includegraphics,} for example,
+ can also be placed on a diagram using
+
+ {\tt "}{\sl \latex text}{\tt" wid {\sl width} ht {\sl height}
+ at {\sl position}}
+
+\begin{figure}[ht]
+ \vspace*{-\baselineskip}
+ \parbox{4in}{\small \verbatiminput{Loop.m4}}%
+ \hfill\raise-0.5in\hbox{\input Loop }
+ \vspace*{-\baselineskip}
+ \caption{A loop containing labeled elements, with its source code.}
+ \label{Loop}
+ \end{figure}
+
+\xection{Placing two-terminal elements\label{Placing:}}
+The length and position of a two-terminal element
+are defined by a straight-line segment and, possibly, a direction, so
+four numbers are required to place the element as in the following example:
+
+{\tt resistor(from (1,1) to (2,1))}.
+
+\noindent
+However, \pic has a very useful concept of the current point (explicitly
+named {\tt Here}); thus,
+
+{\tt resistor(to (2,1))}
+
+\noindent
+is equivalent to
+
+{\tt resistor(from Here to (2,1)).}
+
+Any defined position can be used; for example, if {\sl C1} and {\sl L2}
+are names of previously defined two-terminal elements,
+then, for example, the following places the resistor:
+
+{\tt 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:
+
+{\tt resistor(up\_ d)}
+
+\noindent
+\Pic stores the current drawing direction,
+the latter unfortunately limited to {\tt up, down, left, right,}
+which is assumed when necessary.
+The circuit macros need to know the current direction, so
+whenever {\tt up, down, left, right} are used they should be written
+respectively as the macros {\tt up\_, down\_, left\_, right\_} as in
+the above example.
+
+To allow drawing circuit objects in other than the standard four directions,
+a transformation matrix
+is applied at the macro level to generate the required \pic code.
+Potentially, the matrix can be used for other transformations.
+The macro
+
+{\tt setdir\_({\sl direction, default direction})}
+
+\noindent
+is preferred when setting drawing direction. The {\sl direction} arguments
+are of the form
+
+{\tt R[ight] | L[eft] | U[p] | D[own] | {\sl degrees}},
+
+\noindent
+but the macros
+{\tt Point\_(}{\sl degrees}{\tt ),}
+{\tt point\_(}{\sl radians}{\tt ),}
+and {\tt rpoint\_(}{\sl relative linespec}{\tt )} are employed in many macros
+to re-define the entries
+of the matrix
+(named {\tt m4a\_}, {\tt m4b\_}, {\tt m4c\_}, and {\tt m4d\_})
+for the required rotation.
+The macro {\tt eleminit\_} in the two-terminal elements invokes
+{\tt rpoint\_} with a specified or default {\sl linespec}
+to establish element length and direction.
+
+As shown in \FR{Oblique},
+``{\tt Point\_(-30); resistor}'' draws a resistor
+along a line with slope of~-30 degrees, and ``{\tt rpoint\_(to Z)}'' sets
+the current direction cosines to point from the current location to location Z.
+Macro {\tt vec\_(x,y)}
+evaluates to the position {\tt (x,y)} rotated as defined by the
+argument of the previous
+{\tt setdir\_, Point\_, point\_} or {\tt rpoint\_} command.
+The principal device used to define relative locations in the circuit macros
+is {\tt rvec\_(x,y)}, which evaluates to position {\tt Here + vec\_(x,y)}.
+Thus, {\tt line to rvec\_(x,0)} draws a line of length {\tt x} in the current
+direction.
+
+\FR{Oblique} illustrates that some hand placement of labels
+using {\tt dlabel} may be useful when elements are drawn obliquely.
+The figure also illustrates that any commas within \Mfour arguments must
+be treated specially because the arguments are separated by commas.
+Argument commas are protected either by parentheses as in
+{\tt inductor(from Cr to Cr+vec\_(elen\_,0))}, or by multiple single quotes
+as in {\tt ``,'',} as necessary.
+Commas also may be avoided by writing
+{\tt 0.5 between L and T} instead of {\tt 0.5<L,T>.}
+\begin{figure}[h!t]
+\vspace{-\baselineskip}
+ \parbox{4.5in}{\small \verbatiminput{Oblique.m4}}%
+ \hfill\raise-0.7in\llap{\hbox{\input Oblique }}%
+ \vspace{-\baselineskip}
+ \caption{Illustrating elements drawn at oblique angles.}
+ \label{Oblique}
+ \end{figure}
+
+\subsection{Series and parallel circuits\label{Seriesandparallel:}}
+
+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,
+
+{\tt setdir\_(Right)\\ \hspace*{\parindent}%
+ resistor; llabel(,R); capacitor; llabel(,C);
+ inductor; llabel(,L)}
+
+\noindent
+draws three elements in series
+as shown in the top line of \FR{Series}.
+\begin{figure}[h!t]
+\vspace{-\baselineskip}
+ \input Series
+ \caption{Three ways of drawing basic elements in series.}
+ \label{Series}
+ \end{figure}
+However, the default length {\tt elen\_}
+appears too long for some diagrams. It can be redefined temporarily
+(to {\tt dimen\_}, say),
+by enclosing the above line in the pair
+
+{\tt pushdef(`elen\_',dimen\_)
+ resistor$\ldots$ popdef(`elen\_')}
+
+\noindent
+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 \FR{Series}:
+
+{\tt resistor; llabel(,R)\\
+ \hspace*{\parindent}%
+ capacitor(right\_ dimen\_/4); llabel(,C)\\
+ \hspace*{\parindent}%
+ inductor; llabel(,L)}
+
+If a macro that takes care of common cases automatically is to be preferred,
+you can use the macro {\tt series\_({\sl elementspec, elementspec, $\ldots$})}.
+This macro draws elements of length {\tt dimen\_} from the current
+position in the current drawing
+direction, enclosed in a {\tt [ ]} block. The internal names
+{\tt Start}, {\tt End}, and {\tt C} (for centre) are defined, along with
+any element labels. An {\sl elementspec} is of the form
+{\tt[{\sl Label}:] {\sl element}; [{\sl attributes}]},
+where an attribute is zero or more of
+ {\tt llabel($\ldots$), rlabel($\ldots$)}, or {\tt b\_current($\ldots$)}.
+
+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 \FR{ParSeries}:
+\begin{verbatim}
+ 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
+\end{verbatim}
+
+\begin{figure}[h!t]
+% \vspace*{-\baselineskip}
+ \input ParSeries
+ \vspace*{-\baselineskip}
+ \caption{Illustrating the macros {\tt parallel\_} and {\tt series\_},
+ with {\tt Start} and {\tt End} points marked.}
+ \label{ParSeries}
+ \end{figure}
+
+A macro that produces the same effect automatically is
+
+{\tt parallel\_({\LQ {\sl elementspec}\RQ, \LQ {\sl elementspec}\RQ,}
+ $\ldots$)}
+
+The arguments {\em must be quoted} to delay expansion, unless an argument
+is a nested {\tt parallel\_} or {\tt series\_} macro,
+in which case it is not quoted.
+The elements are drawn in a {\tt [ ]} block with defined points
+{\tt Start}, {\tt End}, and {\tt C}.
+An {\sl elementspec} is of the form
+
+{\tt [Sep={\sl val};][{\sl Label}:] {\sl element}; [{\sl attributes}]}
+
+\noindent
+where an {\sl attribute} is of the form
+
+{\tt [llabel($\ldots$);] | [rlabel($\ldots$)] | [b\_current($\ldots$);]}
+
+Putting {\tt Sep={\sl val};} in the first branch sets the default
+separation of all branches to {\sl val}; in a later
+element, {\tt Sep={\sl val}}; applies only to that branch.
+An element may have normal arguments but should
+not change the drawing direction.
+
+%\pagebreak%
+\xection{Composite circuit elements\label{Composite:}}
+Many basic elements are not two-terminal. These elements are usually enclosed in
+a \verb|[ ]| \pic block, and contain named interior locations and components.
+The block must be placed by using its compass corners, thus:
+ {\sl element} {\tt with} {\sl corner} {\tt at} {\sl position}
+or, when the block contains a predefined location, thus:
+ {\sl element} {\tt with} {\sl location} {\tt at} {\sl position}.
+A few macros are positioned with the first argument;
+the {\tt ground} macro, for example:
+ {\tt ground(}{\tt at} {\sl position}{\tt ).}
+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.
+
+The macro {\tt
+ potentiometer(\linespec,{\sl cycles},{\sl fractional pos},{\sl length},
+ $\ldots$)},
+shown in \FR{Potentiometers},
+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.
+\begin{figure}[h!t]
+ \input Potentiometers
+ \caption{Default and multiple-tap potentiometer.}
+ \label{Potentiometers}
+ \end{figure}
+
+The macro {\tt
+ addtaps([{\sl arrowhd} | type={\sl arrowhd};name={\sl Name}],
+ {\sl fraction, length, fraction, length,}
+ $\ldots$)},
+shown in \FR{Taps}, will add taps to the
+immediately preceding two-terminal element.
+\begin{figure}[h!t]
+ \input Taps
+ \caption{Macros for adding taps to two-terminal elements.}
+ \label{Taps}
+ \end{figure}
+However, the default names
+{\tt Tap1, Tap2} $\ldots$ 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 {\tt
+ tapped(`{\sl two-terminal element}',
+ [{\sl arrowhd} | type={\sl arrowhd};name={\sl Name}],
+ {\sl fraction, length, fraction, length,} $\ldots$)}.
+ Internal names {\tt .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 \FR{Composite}.
+\begin{figure}[h!t]
+ \vspace*{-0.5ex}
+ \input Composite
+ \vspace*{-0.5ex}
+ \caption{Composite elements {\tt KelvinR({\sl cycles},[R],{\sl cycle wid})}
+ and {\tt FTcap({\sl chars})} .}
+ \label{Composite}
+ \end{figure}
+
+The ground symbol is shown in \FR{Grounds}.
+The first argument specifies position; for example, the two lines shown
+have identical effect:
+
+{\tt move to (1.5,2); ground
+
+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,
+with D (down) the default.
+This macro is one of several in which a temporary drawing direction
+is set using the
+ {\tt setdir\_( U|D|L|R|{\sl degrees, default} R|L|U|D|{\sl degrees} )}
+macro and reset at the end using {\tt resetdir\_}.
+\begin{figure}[ht!]
+ \input Grounds
+ \caption{The
+ {\tt ground( at }{\sl position}{\tt,
+ T, N|F|S|L|P|E, U|D|L|R|{\sl degrees} )}
+ macro.}
+ \label{Grounds}
+ \end{figure}
+
+The arguments of the macro
+{\tt antenna( at }{\sl position}{\tt,
+ T, A|L|T|S|D|P|F, U|D|L|R|{\sl degrees} )}
+shown in \FR{Antennas} are similar to those of {\tt ground}.
+\begin{figure}[h!t]
+ \input Antennas
+ \caption{Antenna symbols, with macro arguments shown above and
+ terminal names below.}
+ \label{Antennas}
+ \end{figure}
+
+\FR{Opamp} illustrates the macro
+{\tt opamp({\sl\linespec, - label, + label, size, chars})\label{OPAMP}}.
+\begin{figure}[b!t]
+ \ifpdf\vspace*{-0.5\baselineskip}\fi%
+ \input Opamp
+ \caption{Operational amplifiers. The {\tt P} option adds
+ power connections. The second and third arguments can be used
+ to place and rotate arbitrary text at {\tt In1} and {\tt In2}.}
+ \label{Opamp}
+ \end{figure}
+The element is enclosed in a block
+containing the predefined internal locations shown.
+These locations can be referenced in later
+commands, for example as ``{\tt 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 ``{\tt opamp with .In1 at Here}'', which places
+the internal position {\sl In1} at the specified location.
+There are optional second and third arguments for which the defaults
+are {\tt \char92{}scriptsize\$-\$} and {\tt \char92{}scriptsize\$+\$}
+respectively, and the fourth argument changes the size of the opamp.
+The fifth argument is a string of characters. {\tt P}
+adds a power connection, {\tt R} exchanges the second and
+third entries, and {\tt 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 \FR{Opamp}.
+The {\tt opamp} labels can be rotated if necessary by
+using postprocessor commands (for example \PSTricks \verb|\rput|)
+as second and third arguments.
+
+The code in \FR{oax} places an opamp with three connections.
+\begin{figure}[h!t]
+ \parbox{4in}{\small \verbatiminput{oaxbody.m4}}%
+ \quad\raise-0.2in\hbox{\input oax }%
+ \vspace{-\baselineskip}
+ \caption{A code fragment invoking the
+ {\tt opamp(\linespec,-,+,{\sl size},[R][P])} macro.}
+ \label{oax}
+ \end{figure}
+
+\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.}
+The first argument
+specifies the direction and distance from {\sl P1} to {\sl 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 argument string contains an {\tt A}, the iron core
+is omitted;
+if a {\tt P}, the core is dashed (powder);
+and if it contains a {\tt W}, wide windings are drawn.
+A {\tt D1} puts phase dots at the {\sl P1, S1} end, {\tt D2} at the
+{\sl P2, S2} ends, and {\tt D12} or {\tt D21} puts dots at opposite ends.
+\begin{figure}[h!t]
+ \ifpdf\vspace*{-\baselineskip}\fi%
+ \input Xform
+ \vspace{-\baselineskip}
+ \caption{The {\tt transformer(\linespec,L|R,{\sl np},%
+[A|P][W|L][D1|D2|D12|D21],{\sl ns})}
+ macro (drawing direction {\tt down}), showing predefined terminal
+ and centre-tap points.}
+ \label{Xform}
+ \end{figure}
+\iffalse
+A transformer with four connections is illustrated
+in \FR{tran}.
+\begin{figure}[hbt]
+ \parbox{4in}{\small \verbatiminput{tranbody.m4}}%
+ \quad\raise-0.2in\hbox{\input tran }%
+ \vspace{-\baselineskip}
+ \caption{Showing the
+ {\tt transformer(\linespec,L|R,np,A,ns)} macro.}
+ \label{tran}
+ \end{figure}
+\fi
+
+%\enlargethispage{\baselineskip}
+\FR{Audio} shows some audio devices, defined in {\tt []} blocks,
+with predefined internal locations as shown.
+\begin{figure}[h!t]
+ \ifpdf\vspace*{-\baselineskip}\fi%
+ \input Audio
+ \ifpdf\vspace*{-\baselineskip}\fi%
+ \caption{Audio components:
+ {\tt speaker(U|D|L|R|{\sl degrees},{\sl size},{\sl type}),
+ bell, microphone, buzzer,
+ earphone}, with their internally named positions and components.}
+ \label{Audio}
+ \end{figure}
+The first argument specifies the device orientation.
+
+Thus,
+
+{\tt S: speaker(U) with .In2 at Here}
+
+\noindent
+%\enlargethispage{\baselineskip}
+places an upward-facing speaker with input {\sl In2} at the
+current location.
+
+The {\tt nport({\sl box specs {\tt[;} other commands{\tt]},
+ nw, nn, ne, ns, space ratio, pin lgth, style})}
+macro is shown in \FR{Nport}.
+\begin{figure}[h!t]
+ \ifpdf\vspace*{-\baselineskip}\fi
+ \input Nport
+ \ifpdf\vspace*{-\baselineskip}\fi
+ \caption{The {\tt 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 {\tt nterm} macro draws single pins instead of pin pairs.}
+ \label{Nport}
+ \end{figure}
+The macro begins with the line
+ \verb|define(`nport',`[Box: box `$1'|,
+so the 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 pin length, and setting the eighth argument to {\tt N} omits the pin
+dots.
+The macro ends with \verb|`$9']')|, so that a ninth argument can be used
+to add further customizations within the enclosing block.
+
+The {\tt nterm({\sl box specs, nw, nn, ne, ns, pin lgth, style})} macro
+illustrated in \FR{Nport} is similar to the {\tt 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\label{Nports:}. These elements can be added using the first
+argument and the ninth of the {\tt nport} macro.
+For example, the following code adds a pair of labels to the box
+immediately after drawing it but within the enclosing block:
+
+{\tt nport(; {`"${}0$"'\ at Box.w ljust; `"$\infty$"'\ 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
+{\tt nport}:
+
+\begin{verbatim}
+define(`nullor',`nport(`$1'
+ {`"${}0$"' at Box.w ljust
+ `"$\infty$"' at Box.e rjust},shift($@))')
+\end{verbatim}
+
+The above example and the related gyrator macro are illustrated in
+\FR{NLG}.
+\begin{figure}[h!t]
+ \input NLG
+ \ifpdf\vspace*{-1.5\baselineskip}\fi%
+ \caption{The {\tt nullor} example and the {\tt gyrator}
+ macro are customizations of the {\tt nport} macro.}
+ \label{NLG}
+ \end{figure}
+
+A basic winding macro for magnetic-circuit sketches and similar figures
+is shown in \FR{Windings}.
+\begin{figure}[h!t]
+ \vspace*{-\baselineskip}%
+% \ifpdf\vspace*{-2\baselineskip}\else \vspace{-\baselineskip}\fi
+ \input Windings
+ \ifpdf\vspace*{-\baselineskip}\else\vspace*{-1ex}\fi
+ \caption{The {\tt winding(L|R, diam, pitch, turns, core wid, core color)}
+ macro draws a coil with axis along the current drawing direction.
+ Terminals {\tt T1} and {\tt T2} are defined.
+ Setting the first argument to {\tt R} draws a right-hand winding.}
+ \label{Windings}
+ \end{figure}
+For simplicity, the complete spline
+is first drawn and then blanked in appropriate places using the background
+(core) color (\verb!lightgray! for example, default \verb!white!).
+
+\FR{Relay} shows the macro {\tt contact({\sl chars})},
+which contains predefined locations {\sl P, C, O}
+for the armature and normally closed and normally
+open terminals.
+An {\tt I} in the first argument draws open circles for contacts.
+The macro {\tt relay({\sl poles, chars})}
+defines coil terminals {\sl V1, V2} and contact
+terminals {\sl P$_i$, C$_i$, O$_i$.}
+\begin{figure}[ht]
+ \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi%
+ \input Relay
+ \vspace{-1ex}
+ \caption{The {\tt contact({\sl chars})}
+ and {\tt relay({\sl poles, chars})}
+ macros (default direction right).}
+ \label{Relay}
+ \end{figure}
+
+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*{-0.5\baselineskip}\fi%
+ \input NPDT
+ \ifpdf\vspace*{-0.5\baselineskip}\fi%
+ \caption{Multipole double-throw switches drawn by
+ {\tt NPDT({\sl npoles}, [R])}.}
+ \label{NPDT}
+ \end{figure}
+
+The {\tt jack} and {\tt plug} macros and their defined points are
+ illustrated in \FR{Jack}.
+\begin{figure}[h!t]
+ \input Jack
+ \vspace{-1ex}
+ \caption{The {\tt jack(U|D|L|R|{\sl degrees}, {\sl chars})}
+ and {\tt plug(U|D|L|R|{\sl degrees},[2|3][R])} components
+ and their defined points.}
+ \label{Jack}
+ \end{figure}
+ The first 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.
+ The two principal terminals of
+ the jack are included by putting \hbox{{\tt L} {\tt S}}
+%
+% This is a kludge to put a blank line on the bottom
+\phantom{or both into the string with associated make ({\tt M})
+or break ({\tt B}) points. Thus, {\tt LMB} within the third}\hfill\break
+\phantom{or both into the string with associated make ({\tt M})
+or break ({\tt B}) points. Thus, {\tt LMB} within the third}\hfill\break
+%
+%
+ or both into the string with associated make ({\tt M})
+ or break ({\tt B}) points. Thus, {\tt LMB} within the third
+ argument draws the {\tt L} contact with
+ associated make and break points. Repeated {\tt L[M|B]}
+ or {\tt S[M|B]} substrings add auxiliary contacts with
+ specified make or break points.
+
+%\pagebreak
+A macro for drawing headers is in \FR{Headers},
+and some experimental connectors are shown in \FR{Conn} and \FR{Pconn}.
+The {\tt tstrip} macro allows {\sl key}{\tt =}{\sl value}{\tt ;} arguments
+\begin{figure}[h!t]
+ \ifpdf\vspace*{-0.5\baselineskip}\fi%
+ \input Headers
+ \ifpdf{\vspace*{-0.5ex}}\fi%
+ \caption{Macro {\tt Header(1|2, {\sl rows, wid, ht, type})}.}
+ \label{Headers}
+ \end{figure}
+for width and height.
+\begin{figure}[h!t]
+ \input Conn
+ \ifpdf{\vspace*{-0.5ex}}\fi%
+ \caption{Macros {\tt tstrip(R|L|U|D|{\sl degrees}, {\sl chars})},
+ {\tt ccoax(at} {\sl location}, {\tt M|F, {\sl diameter})},
+ {\tt tconn(\linespec, >|>>|<|<<|O[F], {\sl wid})}, and
+ {\tt tbox({\sl text, wid, ht}, <|>|<>,{\sl type})}. }
+ \label{Conn}
+ \ifpdf{\vspace*{-1ex}}\fi%
+ \end{figure}
+\begin{figure}[h!t]
+ \ifpdf{\vspace*{-1ex}}\fi%
+ \input Pconn
+ \ifpdf{\vspace*{-0.5ex}}\fi%
+ \caption{A small set of power connectors drawn by
+ {\tt pconnex(R|L|U|D|}{\sl degrees, chars}{\tt)}. Each connector has
+ an internal {\tt H}, {\tt N}, and where applicable, a {\tt G} shape.}
+ \label{Pconn}
+ \end{figure}
+
+\subsection{Semiconductors\label{Semiconductors:}}%
+\FR{Bip} shows the variants of bipolar transistor macro
+{\tt bi\_tr(\linespec,L|R,P,E)}
+which contains predefined internal locations {\sl E},
+{\sl B}, {\sl C}.
+The first argument defines the distance and direction
+from {\sl E} to {\sl C,} with location determined by the enclosing
+block as for other elements, and the base placed
+\begin{figure}[h!b]
+ \ifpdf\vspace*{-0.5\baselineskip}\fi%
+ \input Bip
+ \ifpdf\vspace*{-0.5\baselineskip}\fi%
+ \caption{Bipolar transistor variants (current direction upward).}
+ \label{Bip}
+ \end{figure}
+to the left or right of the
+current drawing direction according to the second argument. Setting the third
+argument to {\tt P} creates a PNP device instead of NPN, and setting the
+fourth to {\tt E} draws an envelope around the device.
+\FR{Darlington} shows a composite macro with several optional internal elements.
+\begin{figure}[h!t]
+ \input Darlington
+ \caption{Macro {\tt Darlington(L|R,[E][P][B1][E1|R1][E2|R2][D][Z])},
+ drawing direction {\tt up\_}.}
+ \label{Darlington}
+ \end{figure}
+
+The code fragment example in \FR{bitr} places a bipolar transistor,
+connects a ground to the emitter, and connects a resistor to the collector.
+\begin{figure}[h!t]
+\vspace*{-\baselineskip}
+ \quad\quad\parbox{4in}{\small \verbatiminput{bitrbody.m4}}%
+ \quad\raise-0.4in\hbox{\input bitr }%
+ \vspace{-\baselineskip}
+ \caption{The {\tt bi\_tr(\linespec,L|R,P,E)} macro.}
+ \label{bitr}
+ \end{figure}
+
+The {\tt bi\_tr} and {\tt igbt} macros are wrappers for
+the macro {\tt bi\_trans(\linespec, L|R, {\sl chars}, E)}, which
+draws the components of the transistor according to the characters in its
+third argument. For example, multiple emitters and collectors can be
+specified as shown in \FR{bitrans}.
+\begin{figure}[h!t]
+\vspace*{-0.5\baselineskip}
+ \input bi_trans
+ \caption{The {\tt bi\_trans(\linespec,L|R,{\sl chars},E)} macro.
+ The sub-elements are specified by the third argument. The substring
+ {\tt E}{\sl n} creates multiple emitters {\sl E0} to {\sl En}.
+ Collectors are similar.}
+ \label{bitrans}
+ \end{figure}
+
+A UJT macro with predefined internal locations {\sl B1,} {\sl B2,}
+and {\sl E} is shown in \FR{ujt},
+and a thyristor macro with predefined internal locations
+ {\sl G} and {\sl T1,} {\sl T2,} or
+ {\sl A,} {\sl K} is in \FR{thyristor}.
+Except for the {\sl G} terminal, a thyristor (the {\tt IEC} variant excluded)
+\begin{figure}[h!t]
+ \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi%
+ \input ujt
+ \ifpdf\vspace*{-0.5\baselineskip}\fi%
+ \caption{UJT devices, with current drawing direction {\tt up\_}. }
+ \label{ujt}
+ \end{figure}
+\begin{figure}[h!t]
+ \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi%
+ \input thyristor
+ \vspace*{-1ex}
+ \caption{The top two rows illustrate use of the
+ {\tt thyristor({\sl linespec, chars})} macro,
+ drawing direction {\tt down\_}, and the bottom row shows wrapper
+ macros (drawing direction {\tt right\_}) that place
+ the thyristor like a two-terminal element. Append {\tt K}
+ to the second argument to draw open arrowheads.}
+ \label{thyristor}
+ \end{figure}
+is much like an 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,
+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}
+
+\noindent
+draws the element from position {\sl A} to position {\sl B} with label
+{\sl Q3}, and draws a line from {\sl G}.
+
+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}.
+In all cases the first argument is a linespec,
+and entering
+{\tt R} as the second argument orients the {\sl 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 {\tt mosfet(\linespec,R,{\sl characters},E)}.
+The third argument of this macro is a subset of the characters
+$\{${\tt BDEFGLMQRSTXZ}$\}$, each letter corresponding to
+a diagram component as shown in the bottom row of the figure.
+Preceding the characters {\tt B}, {\tt G}, and {\tt S} by {\tt u} or {\tt d}
+adds an up or down arrowhead to the pin, preceding {\tt T} by {\tt d}
+negates the pin, and preceding {\tt M} by {\tt u} or {\tt d} puts the pin
+at the drain or source end respectively of the gate.
+The obsolete letter {\tt L} is equivalent to {\tt dM} and has been kept
+temporarily for compatibility.
+This system allows considerable freedom in choosing or customizing components,
+as illustrated in \FR{fet}.
+\begin{figure}[h!t]
+ \ifpdf\vspace*{-\baselineskip}\fi%
+ \input fet
+ \ifpdf\vspace*{-\baselineskip}\fi%
+ \caption{JFET, insulated-gate enhancement and depletion MOSFETs,
+ and simplified versions.
+ These macros are wrappers that invoke the {\tt mosfet}
+ macro as shown in the middle and bottom rows.
+ The two lower-right examples show custom devices, the first
+ defined by omitting the substrate connection, and the second
+ defined using a wrapper macro.}
+ \label{fet}
+ \end{figure}
+
+\pagebreak
+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.
+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%
+ \input Tgate
+ \caption{The {\tt tgate({\sl linespec,} [B][R|L])} element, derived from
+ a customized diode and {\tt ebox}, and the
+ {\tt ptrans(\linespec, [R|L])} macro.
+ These are not two-terminal elements, so the {\sl linespec} argument
+ defines the direction and length of the line from $A$ to $B$ but not
+ the element position.}
+ \label{Tgate}
+ \end{figure}
+
+Some other non-two-terminal macros are {\tt dot}, which has an
+optional argument ``{\tt at} {\sl location}'', the line-thickness
+macros, the {\tt fill\_} macro, and {\tt crossover}, which is a useful if
+archaic method to show non-touching conductor crossovers, as in
+\FR{bistable}.
+\begin{figure}[h!t]
+ \input bistable
+ \vspace{-1ex}
+ \caption{Bipolar transistor circuit, illustrating {\tt crossover}
+ and colored elements.}
+ \label{bistable}
+ \end{figure}
+
+This figure also illustrates how elements and labels can be colored
+using the macro
+
+{\tt rgbdraw({\sl r}, {\sl g}, {\sl b}, {\sl drawing commands})}
+
+\noindent
+where the {\sl 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:
+
+ {\tt setrgb({\sl r}, {\sl g}, {\sl b})}
+ \hfill\break\hspace*{\parindent}%
+ {\sl drawing commands}
+ \hfill\break\hspace*{\parindent}%
+ {\tt resetrgb}
+
+A macro is also provided for colored fills:
+
+{\tt rgbfill({\sl r}, {\sl g}, {\sl b}, {\sl drawing commands})}
+
+\noindent%
+These macros depend heavily on the postprocessor and are intended only for
+\PSTricks, \TPGF, \MetaPost, \SVG, and the Postscript or PDF output of \dpic.
+
+\xection{Corners\label{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 \FR{Corners}.
+\begin{figure}[ht]
+ \input Corners
+ \caption{Producing mitred angles and corners.}
+ \label{Corners}
+ \end{figure}
+This 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 {\tt round} and {\tt corner}.
+The macros
+{\tt mitre\_({\sl Position1,Position2,Position3,length,attributes})}
+and
+{\tt Mitre\_({\sl Line1,Line2,length,attributes})}
+may assist as shown.
+Otherwise, a right-angle line can be extended
+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.
+
+\xection{Looping\label{Looping:}}
+Sequential actions can be performed using either the
+ \dpic command
+
+{\tt for {\sl variable}={\sl expression} to {\sl expression}
+ [by {\sl expression}] do $\lbrace$ {\sl actions} $\rbrace$}
+
+\noindent
+or at the
+\Mfour processing stage. The {\tt libgen} library defines the macro
+
+{\tt for\_({\sl start}, {\sl end}, {\sl increment}, `{\sl actions}')}
+
+\noindent
+for this and other purposes. Nested loops are allowed and the innermost loop
+index variable is {\tt m4x.}
+The first three arguments must be
+integers and the {\sl end} value must be reached exactly; for example,
+\verb|for_(1,3,2,`print In`'m4x')| prints locations {\sl In1} and {\sl In3},
+but \verb|for_(1,4,2,`print In`'m4x')| does not terminate since the
+index takes on values 1, 3, 5, $\ldots$.
+
+Repetitive actions can also be performed with the {\tt libgen} macro
+
+{\tt Loopover\_(`{\sl variable}', {\sl actions}, {\sl value1},
+ {\sl value2}, $\ldots$)}
+
+\noindent
+which evaluates {\sl actions} for each instance of {\sl variable} set
+to {\sl value1, value2, $\ldots$}.
+
+\xection{Logic gates\label{Logicgates:}}
+\FR{Logic} shows the basic logic gates included in
+library {\tt liblog.m4}.
+The first argument of the gate macros can be an integer $N$ from $0$ to $16,$
+specifying the number of input
+locations {\tt In1,} $\ldots$ {\tt In}$N,$ as illustrated for
+the NOR gate in the figure.
+By default, $N=2$ except for macros {\tt NOT\_gate} and {\tt BUFFER\_gate},
+which have one input {\tt In1} unless they are given a
+first argument, which is treated as the line specification of a
+two-terminal element.
+\begin{figure}[h!t]
+ \input Logic
+ \caption{Basic logic gates. The input and output locations of
+ a three-input NOR gate are shown. Inputs are negated by
+ including an {\tt N} in the second argument letter sequence. A {\tt 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.}
+ \label{Logic}
+ \end{figure}
+
+Input locations retain their positions relative to the gate body
+regardless of gate orientation, as in \FR{FF}.
+\begin{figure}[h!t]
+ \vspace*{-\baselineskip}
+ \parbox{4.75in}{\small \verbatiminput{FF.m4}}%
+ \input FF
+ \vspace*{-\baselineskip}
+ \caption{$SR$ flip-flop.}
+ \label{FF}
+ \end{figure}
+\begin{figure}[h!t]
+ \input mplex
+ \caption{Eight-input multiplexer, showing a gate with wings.}
+ \label{exVIII}
+ \end{figure}
+Beyond a default number (6) of inputs, the
+gates are given wings as in \FR{exVIII}.
+\pagebreak
+Negated inputs or outputs are marked by circles drawn using the
+\verb|NOT_circle| macro. The name marks the point at the outer edge of the
+circle and the circle itself has the same name prefixed by~{\tt N\_}.
+For example, the output circle of a nand gate is named
+{\tt N\_Out} and the outermost point of the circle is named {\tt Out.}
+Instead of a number, the first argument can be a sequence of letters {\tt P}
+or {\tt N} to define normal or negated inputs; thus for example,
+{\tt NXOR\_gate(NPN)} defines a 3-input nxor gate with not-circle
+inputs {\tt In1} and {\tt In3} and normal input {\tt In2}
+as shown in the figure.
+The macro {\tt 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. {\tt Point\_({\sl degrees})}).
+Each gate is contained in a
+block of typical height {\tt 6*L\_unit} where {\tt L\_unit} is a macro
+intended to establish line separation for an imaginary grid on which
+the elements are superimposed.
+
+Including an \verb|N| in the second
+argument character sequence of any gate negates the inputs, and including
+\verb|B| in the second argument invokes the
+general macro {\tt BOX\_gate([P|N]...,[P|N],{\sl horiz size},{\sl
+vert size},{\sl label})}, which draws box gates. Thus, {\tt
+BOX\_gate(PNP,N,,8,\char92 geq 1)} creates a gate of default width,
+eight {\tt L\_unit}s height, negated output, three inputs with the
+second negated, and internal label ``$\geq1$''.
+If the fifth argument begins with {\tt sprintf} or a double quote then
+the argument is copied literally; otherwise it is treated as scriptsize
+mathematics.
+
+The macro {\tt BUFFER\_gate(\linespec,[N|B],{\sl wid},{\sl ht},%
+ [N|P]\char42,[N|P]\char42)}
+is a wrapper for the composite element {\tt BUFFER\_gen}.
+If the second argument is {\tt 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 {\tt 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
+{\tt last []}, as shown in \FR{Buffer}.
+\begin{figure}[h!t]
+ \input Buffer
+ \caption{The {\tt BUFFER\_gate} and {\tt BUFFER\_gen} macros.
+ The bottom two examples show how the gate can be drawn as a two-terminal
+ macro but internal block locations must be referenced using
+ {\tt last []}.}
+ \label{Buffer}
+ \end{figure}
+
+\pagebreak
+A good strategy for drawing complex logic circuits might be summarized
+as follows:
+\begin{itemize}\itemsep=0pt
+\item Establish the absolute locations of gates and other major components
+ (e.g. chips) relative to a grid of mesh size commensurate with
+ {\tt L\_unit}, which is an absolute length.
+\item Draw minor components or blocks relative to the major ones, using
+ parameterized relative distances.
+\item Draw connecting lines relative to the components and previously drawn
+ lines.
+\item Write macros for repeated objects.
+\item 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
+ {\tt L\_unit}:
+ \begin{itemize}
+ \item[] {\tt AND\_ht, AND\_wd}: the height and width of basic AND and
+ OR gates
+ \item[] {\tt BUF\_ht, BUF\_wd}: the height and width of basic buffers
+ \item[] {\tt N\_diam}: the diameter of NOT circles
+ \end{itemize}
+ \end{itemize}
+
+\FR{Multiplexer} shows a multiplexer block with variations, and
+ \FR{Demultiplexer} shows
+the very similar demultiplexer.
+\begin{figure}[h!t]
+ \input Multiplexer
+ \caption{The {\tt Mux({\sl input count}, {\sl label},
+ [L][B|H|X][N[$n$]|S[$n$]][[N]OE],{\sl wid},{\sl ht})} macro.}
+ \label{Multiplexer}
+ \end{figure}
+\begin{figure}[h!t]
+ \input Demultiplexer
+ \caption{The {\tt Demux({\sl input count}, {\sl label},
+ [L][B|H|X][N[$n$]|S[$n$]][[N]OE],{\sl wid},{\sl ht})} macro.}
+ \label{Demultiplexer}
+ \end{figure}
+
+\FR{FlipFlops} shows
+the macro {\tt FlipFlop(D|T|RS|JK, {\sl label, boxspec})}, which is a
+wrapper for the more general macro {\tt FlipFlopX(}{\sl boxspec, label,
+leftpins, toppins, rightpins, bottompins}{\tt )}.
+\begin{figure}[h!t]
+ \input FlipFlop
+ \caption{The {\tt FlipFlop} and {\tt FlipFlopX} macros, with variations.}
+ \label{FlipFlops}
+ \end{figure}
+Each of arguments 3 to 6 is null or a string of {\sl pinspecs} separated
+by semicolons ({\tt;}). {\sl Pinspecs} are either empty (null) or of the form
+{\tt[}{\sl pinopts}{\tt]:[}{\sl label}{\tt[:}{\sl Picname}{\tt]]}.
+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 {\tt W1, W2, ..., N1, N2, ..., E1, ..., S1, ...} ; however,
+if {\tt:}{\sl Picname} is present in a {\sl pinspec} then {\sl Picname}
+replaces the default name. A {\sl pinspec} label is text placed at the pin
+base. Semicolons are
+not allowed in labels; use eg \verb|\char59{}| instead, and to put a bar over
+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.
+
+Customized gates can be defined simply.
+For example, the following code defines the custom flipflops in \FR{ShiftR}.
+\begin{figure}[h!t]
+ \input ShiftR
+ \caption{A 5-bit shift register.}
+ \label{ShiftR}
+ \end{figure}
+\begin{verbatim}
+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) ')
+\end{verbatim}
+This definition makes use of macros \verb|L_unit| and
+\verb|FF_ht| that predefine dimensions.
+There are three pins on the right side; the centre pin is null and
+the bottom is null if the first macro argument is 1.
+
+For hybrid applications, the \verb|dac| and \verb|adc| macros are
+illustrated in \FR{Dac}.
+The figure shows the default and predefined internal locations, the number
+of which can be specified as macro arguments.
+\begin{figure}[h!t]
+ \ifpdf\vspace*{-\baselineskip}\fi%
+ \input Dac
+ \ifpdf\vspace*{-\baselineskip}\fi%
+ \caption{The {\tt dac({\sl width,height},nIn,nN,nOut,nS)}
+ and {\tt adc({\sl width,height},nIn,nN,nOut,nS)} macros.}
+ \label{Dac}
+ \end{figure}
+
+In addition to the logic gates described here, some experimental
+IC chip diagrams are included with the distributed example files.
+
+\pagebreak
+\xection{Element and diagram scaling\label{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 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.
+
+The scaling of circuit elements will be described first, then
+the \pic scaling facilities.
+
+\subsection{Circuit scaling\label{Circuitscaling:}}
+The circuit elements all have default dimensions
+that are multiples of the \pic environmental parameter {\tt linewid,}
+so changing this parameter changes default element dimensions.
+The scope of a \pic variable is the current block; therefore, a sequence
+such as
+
+\begin{verbatim}
+ 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)
+\end{verbatim}
+
+\noindent%
+connects two resistors and a ground to an enlarged transistor.
+Alternatively, you may redefine the default length {\tt elen\_}
+or the body-size parameter {\tt dimen\_.} For example, adding the line
+
+{\tt define(`dimen\_',(dimen\_*1.2))}
+
+\noindent%
+after the {\tt cct\_init} line of {\tt quick.m4} produces slightly
+larger body sizes for all circuit elements. For logic elements, the
+equivalent to the {\tt dimen\_} macro is {\tt L\_unit}, which has
+default value {\tt (linewid/10)}.
+
+The macros {\tt capacitor, inductor,} and {\tt resistor} have arguments
+that allow the body sizes to be adjusted individually. The macro
+{\tt resized} mentioned previously can also be used.
+
+\subsection{Pic scaling\label{Picscaling:}}
+There are at least three kinds of graphical elements to be considered:
+\begin{enumerate}
+\item When generating final output after reading the {\tt.PE} line,
+ \pic processors divide distances and sizes by the value of the
+ environmental parameter {\tt scale}, which is 1 by default. Therefore,
+ the effect of assigning a value to {\tt scale} at the beginning of the
+ diagram is to change the drawing unit (initially 1 inch) throughout
+ the figure. For example, the file {\tt quick.m4} can be modified to
+ use millimetres as follows:
+ \begin{verbatim}
+ .PS # Pic input begins with .PS
+ scale = 25.4 # mm
+ cct_init # Set defaults
+
+ elen = 19 # Variables are allowed
+ ...
+ \end{verbatim}
+\vspace*{-1.5\baselineskip}
+ The default sizes of \pic objects
+ are redefined by assigning new values to the environmental parameters
+ {\tt arcrad,} {\tt arrowht,} {\tt arrowwid,} {\tt boxht,} {\tt boxrad,}
+ {\tt boxwid,} {\tt circlerad,} {\tt dashwid,} {\tt ellipseht,}
+ {\tt ellipsewid,} {\tt lineht,} {\tt linewid,} {\tt moveht,}
+ {\tt movewid,}
+ {\tt textht,} and {\tt textwid.}
+ The $\ldots${\tt ht} and $\ldots${\tt wid} parameters refer to the
+ default sizes of vertical and horizontal lines, moves, etc., except for
+ {\tt arrowht} and {\tt arrowwid}, which are arrowhead dimensions.
+ The {\tt boxrad} parameter can be used to put rounded corners on boxes.
+ Assigning a new value to {\tt scale} also multiplies all of these
+ parameters except {\tt arrowht,} {\tt arrowwid,} {\tt textht,} and
+ {\tt textwid} by the new value of {\tt scale} (\gpic multiplies them all).
+ Therefore, objects drawn to default sizes are unaffected by changing
+ {\tt scale} at the beginning of the diagram.
+ To change default sizes, redefine the appropriate parameters explicitly.
+
+\item The {\tt .PS} line can be used to scale the entire drawing, regardless
+ of its interior. Thus, for example, the line {\tt.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.
+
+ If the final picture width exceeds {\tt maxpswid}, which
+ has a default value of 8.5, then the picture is scaled to this size.
+ Similarly, if the height exceeds {\tt 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.
+
+\item The finished size of typeset text is independent of \pic variables,
+ but can be determined as in \SR{Interaction:}. Then,
+ {\tt "text" wid $x$ ht $y$} tells \pic the size of {\tt text},
+ once the printed width $x$ and height $y$ have been found.
+
+\item Line widths are independent of diagram and text scaling, and have
+ to be set explicitly. For example,
+ the assignment {\tt linethick = 1.2} sets the default line width to 1.2\,pt.
+ The macro {\tt linethick\_({\sl points})} is also provided, together
+ with default macros {\tt thicklines\_} and {\tt thinlines\_}.
+
+\end{enumerate}
+
+\xection{Writing macros\label{Writing:}}
+The \Mfour language is quite simple and is
+described in numerous documents such as the original reference~\cite{KRm4}
+or in later manuals~\cite{Seindal94}. 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
+{\tt 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 \SR{Basictwo:} can be dropped.
+If you develop a library of custom macros in the installation
+directory then the statement {\tt include(}{\sl mylibrary}{\tt.m4)}
+can bring its definitions into play.
+
+It may not be necessary to define your own macro if all that is needed is
+a small addition to an existing element that is defined in an enclosing
+\verb|[ ]| block. After the element arguments are expanded,
+one argument beyond the normal list is automatically expanded before
+exiting the block, as mentioned near the beginning of \SR{Composite:}.
+This extra argument can be used to embellish the element.
+
+A macro is defined using quoted name and replacement text as follows:
+
+{\tt define(`}{\sl name}{\tt',`}{\sl replacement text}{\tt ')}
+
+After this line is read by the \Mfour processor, then whenever {\sl 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 {\tt \$1} refers to the first argument.
+A few examples will be given.
+
+%\enlargethispage{\baselineskip}
+%\noindent\hbox{}\\ {\bf Example 1:}
+%\par\noindent {\bf Example 1:}
+\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 \FR{Thermal}.
+\begin{figure}[h!]
+ \parbox{4.2in}{\tt define(`thermalsw',\hfill\break
+ \hbox{}\space`dswitch(`\$1',`\$2',WDdBT)\hfill\break
+ \hbox{}\space\space circle rad distance(M4T,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.}
+ \label{Thermal}
+ \end{figure}
+
+%\par\noindent {\bf Example 2:}
+\Example{2}
+In the following,
+two macros are defined to simplify the repeated drawing
+of a series resistor and series inductor, and the macro {\tt tsection} defines
+a subcircuit that is replicated several times to generate \FR{Tline}.
+{\small \verbatiminput{Tline.m4}}
+\begin{figure}[h!]
+ \ifpdf\vspace*{-\baselineskip}\fi%
+ \input Tline
+ \caption{A lumped model of a transmission line, illustrating the
+ use of custom macros.}
+ \label{Tline}
+ \end{figure}
+
+\Example{3}
+%\par\noindent {\bf Example 3:}
+Composite elements containing several basic elements may be
+required. \FR{HybridPi} shows a circuit that can be drawn in
+any reference direction prespecified by {\tt Point\_({\sl degrees})},
+containing labels that always appear in their natural horizontal orientation.
+\begin{figure}[h!t]
+ \vspace*{-0.5ex}
+ \input HybridPi
+ \vspace*{-0.5ex}
+ \caption{A composite element containing several basic elements}
+ \label{HybridPi}
+ \end{figure}
+Two flags in the argument determine the circuit orientation with respect to
+the current drawing direction and whether a mirrored circuit is drawn.
+The key to writing such a macro is to observe that the \pic language
+allows two-terminal elements to change the current drawing direction,
+so the value of {\tt 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:
+\begin{verbatim}
+# `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
+
+ 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' ] ')
+\end{verbatim}
+
+\pagebreak
+\Example{4}
+%\par\noindent {\bf Example 4:}
+A number of elements have arguments meant explicitly for customization.
+\FR{Sinus} customizes the {\tt source} macro to show a cycle of a horizontal
+sinusoid with adjustable phase given by argument 2 in degrees,
+as might be wanted for a 3-phase circuit:
+\begin{figure}[ht]
+\hfill\input Sinus
+ \vspace*{-0.5in}
+\begin{verbatim}
+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)')
+\end{verbatim}
+\vspace*{-\baselineskip}
+ \caption{A source element customized using its second argument.}
+ \label{Sinus}
+ \end{figure}
+
+\Example{5}
+%\par\noindent {\bf Example 5:}
+Repeated subcircuits might have different orientations
+% but the potential orientations often
+that
+include only the element and its mirror image, for example, so the
+power of the \verb|vec_()| and \verb|rvec_()| macros is not required.
+Suppose that an optoisolator is to be drawn with left-right or right-left
+orientation as shown in \FR{Opto}.
+%\vspace*{-0.5em}
+\begin{figure}[h!t]
+ \input Opto
+ \caption{Showing {\tt opto} and {\tt opto(BR)} with defined labels.}
+ \label{Opto}
+ \end{figure}
+
+The macro interface could be something like the following:
+
+{\tt opto( [L|R][A|B] )},
+
+\noindent where an {\tt R} in the argument string signifies a right-left
+(mirrored) orientation and the element is of either {\tt A} or {\tt 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
+
+{\tt opto(orientation=Rightleft;type=B)},
+
+\noindent
+which includes semantic sugar surrounding the {\tt R} and {\tt B} characters
+for readability; this usage is made possible by testing the argument string
+using the {\tt ifinstr()} macro rather than requiring an exact match.
+A draft of the macro follows, and the file {\tt Optoiso.m4} in the examples
+directory adds a third type option.
+\begin{verbatim}
+# `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' }]')
+\end{verbatim}
+Two instances of this subcircuit are
+drawn and placed by the following code, with the result
+shown in \FR{Opto}.
+\begin{verbatim}
+Q1: opto
+Q2: opto(type=B;orientation=Rightleft) with .w at Q1.e+(dimen_,0)
+\end{verbatim}
+
+
+\iffalse
+\noindent {\bf Example 4:}
+Repeated subcircuits might have different orientations.
+Suppose that a simple opamp subcircuit might have to be drawn in any direction.
+The subcircuit will be placed in a {\tt [} {\tt ]} block, with
+internal points {\sl In}, {\sl Out}, and {\sl G}.
+The macro interface could be something like the following:
+
+{\tt fbfilter( U|D|L|R|{\sl degrees}, [L|R], {\sl opamp label},
+ {\sl C label}, {\sl R label} )}
+
+\noindent The first argument specifies the drawing direction as for the
+{\tt antenna} macro, for example. Setting the second argument to {\tt
+R} specifies right orientation with respect to the drawing direction,
+and the last three arguments are labels
+for three internal elements. Two instances of this subcircuit are
+drawn and placed by the following code, with the result
+shown in \FR{fbfilter}.
+\begin{verbatim}
+F1: fbfilter(,,K_3,C_{24},R_4)
+ ground(at F1.G)
+ dot(at F1.In); line up_ elen_/4
+F2: fbfilter(L,R,K_2,C_{23},R_3) with .In at F1.In
+ ground(at F2.G)
+\end{verbatim}
+\vspace*{-0.5em}
+\begin{figure}[h!t]
+ \input fbfilter
+ \caption{Showing the result of two invocations of the {\tt fbfilter} macro,
+ with labels.}
+ \label{fbfilter}
+ \end{figure}
+A draft macro for the subcircuit follows:
+\begin{verbatim}
+define(`fbfilter',
+`[ setdir_(ifelse(`$1',,0,`$1')) # Process arg 1, default to the right
+ eleminit_ # Assign rp_ang, rp_len
+ tmpang = rp_ang # Save rp_ang
+ hunit = elen_ # Dimension parameters
+ vunit = ifinstr(`$2',R,-)elen_/2
+ K: opamp(,,,,`$2')
+ move to K.In`'ifinstr(`$2',R,2,1); line to rvec_(-hunit/4,0)
+ J: dot
+ R: resistor(to rvec_(-elen_,0)); point_(tmpang) # Reset rp_ang
+ In: Here
+ move to K.In`'ifinstr(`$2',R,1,2); line to rvec_(-hunit/4,0)
+ G: Here
+ dot(at K.Out)
+ { line to rvec_(hunit/4,0)
+ Out: Here }
+ line to rvec_(0,vunit)
+ C: capacitor(to rvec_(-distance(K.Out,0.5 between J and G),0)); point_(tmpang)
+ line to J
+ ifelse(`$3',,,"$`$3'$" at K.C) # Add the labels if non-blank.
+ ifelse(`$4',,,"$`$4'$" at C+vec_(0,-vunit/3))
+ ifelse(`$5',,,"$`$5'$" at R+vec_(0,-vunit/4))
+ resetdir_
+ ]')
+\end{verbatim}
+The drawing direction is unknown when the macro is defined, so the
+macros {\tt vec\_} and {\tt rvec\_} are used for drawing lines and
+elements.
+Thus, {\tt (vec\_({\sl x,y}))} is position {\tt ({\sl x,y})} rotated
+by angle {\tt rp\_ang}.
+A side effect of drawing a two-terminal element is to change the
+drawing direction (in conformity with the \pic language), so the angle must
+be saved and reset as needed. Normally, the {\tt fbfilter} block will be
+placed by specifying the position of one of its defined points; by
+default it will be placed as if it were a box.
+\fi
+
+\xection{Interaction with \latex\label{Interaction:}}
+The sizes of typeset labels and other \tex boxes are generally unknown
+prior to processing the diagram by \latex.
+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:
+
+\begin{verbatim}
+.PS
+B: box
+ "Left text" at B.w rjust
+ "Right text: $x^2$" at B.e ljust
+.PE
+\end{verbatim}
+
+The \pic interpreter cannot know the size of the text to the left
+and right of the box, and the diagram is generated using
+default text values. One solution to this problem is to measure the
+text sizes by hand and include them literally, thus:\hfill\break
+\hbox{}\quad%
+\verb|"Left text" wid 38.47pt__ ht 7pt__ at B.w rjust|\hfill\break
+but this is tedious.
+
+Often, a better solution is to process the diagram twice. The
+diagram source is processed as usual by \Mfour and a \pic processor, and the
+main document source is \latex{}ed to input the diagram and format the
+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 \latex{}ing. This hackery is summarized below, with an example
+in \FR{stringdim}.
+\begin{itemize}
+\item Put \verb|\usepackage{boxdims}| into the document source.
+\item Insert the following at the beginning of the diagram source,
+ where {\sl jobname} is the name of the main \latex file:\hfill\break
+ \quad{\tt sinclude({\sl jobname}.dim)\hfill\break
+ \quad s\_init({\sl unique name})}
+\item Use the macro {\tt s\_box({\sl text})} to produce
+ typeset text of known size, or alternatively, invoke the macros
+ \verb|\boxdims| and \verb|boxdim| described later.
+ The argument of {\tt s\_box} need not be text exclusively; it can
+ be anything that produces a \TeX\ box.
+\end{itemize}
+\begin{figure}[h!t]
+ \parbox{3.5in}{\small\tt.PS\\
+ gen\_init\\
+ sinclude(Circuit\_macros.dim)\\
+ s\_init(stringdims)\\
+ B: box\\
+ \hbox{}\quad s\_box(Left text) at B.w rjust\\
+ \hbox{}\quad s\_box(Right text: \$x\^{}{\%g}\$,2) at B.e ljust\\
+ .PE}%
+ \hfill\llap{\raise-0.25in\hbox{\input stringdims }}%
+ \caption{The macro {\tt s\_box} sets string dimensions automatically
+ when processed twice. If two or more arguments are
+ given to {\tt s\_box}, they
+ are passed through {\tt sprintf}. The dots show the figure bounding box.}
+ \label{stringdim}
+ \end{figure}
+
+\noindent The macro \verb|s_box(|{\sl text}\verb|)| evaluates initially to
+
+ \verb|"\boxdims{|{\sl name}\verb|}{|{\sl text}\verb|}"|
+ \verb|wid boxdim(|{\sl name}\verb|,w) ht boxdim(|{\sl name}\verb|,v)|
+
+\noindent
+On the second pass, this is equivalent to
+
+ {\tt "{\sl text}" wid {\sl x} ht {\sl y}}
+
+ \noindent
+ where {\sl x} and {\sl y} are the typeset dimensions of the
+ \latex input text. If {\tt s\_box} is given two or more arguments
+ as in \FR{stringdim}
+ then they are processed by {\tt sprintf}.
+
+The argument of {\tt s\_init}, which should be unique within {\tt{\sl
+jobname}.dim}, is used to generate a unique \verb|\boxdims| first
+argument for each invocation of \verb|s_box| in the current file. If
+\verb|s_init| has been omitted, the symbols ``{\bf !!}'' are inserted
+into the text as a warning. Be sure to quote any commas in the
+arguments. Since the first argument of {\tt s\_box} is \latex source,
+make a rule of quoting it to avoid comma and name-clash problems. For
+convenience, the macros {\tt s\_ht}, {\tt s\_wd}, and {\tt s\_dp}
+evaluate to the dimensions of the most recent {\tt s\_box} string or to
+the dimensions of their argument names, if present.
+
+The file \verb|boxdims.sty| distributed with this package should be installed
+where \latex can find it.
+The essential idea is to define a two-argument \latex macro
+\verb|\boxdims| that writes out definitions for the width, height and
+depth of its typeset second argument into file {\sl jobname.}\verb|dim|,
+where {\sl jobname} is the name of the main source file.
+The first argument of \verb|\boxdims| is used to construct unique symbolic
+names for these dimensions.
+Thus, the line
+
+{\tt box \verb|"\boxdims{Q}{\Huge Hi there!}"| }
+
+\noindent has the same effect as
+
+{\tt box \verb|"\Huge Hi there!"|}
+
+\noindent except that the line
+
+{\tt define(`Q\_w',77.6077pt\_\_)define(`Q\_h',17.27779pt\_\_)%
+define(`Q\_d',0.0pt\_\_)dnl}
+
+\noindent is written into file {\sl jobname.}\verb|dim|
+(and the numerical values depend on the current font).
+These definitions are required by the \verb|boxdim| macro
+described below.
+
+The \latex macro
+
+\verb|\boxdimfile{|{\sl dimension file}\verb|}|
+
+\noindent is used to specify an alternative to {\sl jobname.}\verb|dim| as the
+dimension file to be written. This simplifies cases where {\sl jobname}
+is not known in advance or where an absolute path name is required.
+
+Another simplification is available. Instead of the
+{\tt sinclude({\sl dimension file})} line
+above, the dimension file can be read by \Mfour before reprocessing the source
+for the second time:
+
+{\tt m4 {\sl library files} {\sl dimension file} {\sl diagram source file} ...}
+
+Here is a second small example. Suppose that the file {\tt tsbox.m4} contains
+the following:
+\begin{verbatim}
+\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}
+\end{verbatim}
+The file is processed twice as follows:
+
+{\tt m4 pgf.m4 tsbox.m4 | dpic -g > tsbox.tex; pdflatex tsbox}
+\par
+{\tt m4 pgf.m4 tsbox.m4 | dpic -g > tsbox.tex; pdflatex tsbox}
+
+\noindent
+The first command line produces a file {\tt tsbox.pdf} with
+incorrect bounding box. The second command reads the data in {\tt tsbox.dim}
+to size the label correctly. The equivalent pstricks commands (note
+the {\tt ifpstricks} macro in the second source line) are
+
+{\tt m4 pstricks.m4 tsbox.m4 | dpic -p > tsbox.tex; latex tsbox}
+\par
+{\tt m4 pstricks.m4 tsbox.m4 | dpic -p > tsbox.tex; latex tsbox; dvips tsbox}
+
+\hbox{}
+
+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,
+produces the box in the figure.
+%\vspace*{-\baselineskip}%
+\begin{figure}[h!t]
+ \parbox{4.2in}{\small \input eboxdims.verb }%
+ \hfill\llap{\raise-0.35in\hbox{\input eboxdims }}%
+ \vspace{-\baselineskip}
+ \caption{Fitting a box to typeset text.}
+ \label{boxdims}
+ \end{figure}
+
+The figure is processed twice, as described previously.
+The line \verb|sinclude(|{\sl jobname}\verb|.dim)| reads the named file
+if it exists. The macro \verb|boxdim(|{\sl
+name,suffix,default}\verb|)| from {\tt libgen.m4} expands the
+expression \verb|boxdim(Q,w)| to the value of \verb|Q_w| if it is
+defined, else to its third argument if defined, else to 0, the latter
+two cases applying if {\sl jobname.}\verb|dim| doesn't exist yet. The
+values of \verb|boxdim(Q,h)| and \verb|boxdim(Q,d)| are similarly
+defined and, for convenience, \verb|boxdim(Q,v)| evaluates to the sum
+of these. Macro \verb|pt__| is defined as \verb|*scale/72.27| in {\tt
+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 \FR{fbox}.
+The technique illustrated in \FR{boxdims} is automated by the
+macro
+{\tt f\_box(}{\sl boxspecs}, {\sl label arguments}{\tt )}.
+For the special case of only one argument,
+e.g., {\tt 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
+
+{\tt box }{\sl boxspecs} {\tt s\_box(}{\sl label arguments}{\tt)}.
+
+\noindent%
+For example, the result of the following command
+is shown on the right of \FR{fbox}.
+
+\verb|f_box(color "lightgray" thickness 2 rad 2pt__,"\huge$n^{%g}$",4-1)|
+\begin{figure}[h!b]
+%\begin{figure}[b!]
+ \input woodchips
+ \vspace{-0.5\baselineskip}
+ \caption{Illustrating the {\tt f\_box} macro.}
+ \label{fbox}
+ \end{figure}
+
+More tricks can be played. The example
+
+\verb|Picture: s_box(`\includegraphics{|{\it file}\verb|.eps}') with .sw at|
+{\sl location}
+
+\noindent shows a nice way of including eps graphics in a diagram. The
+included picture (named {\tt 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 {\tt boxcoord(}{\sl
+object name, x-fraction, y-fraction}{\tt)} evaluates to a position,
+with {\tt boxcoord(}{\sl object name}{\tt,0,0)} at the lower left
+corner of the object, and {\tt boxcoord(}{\sl object name}{\tt,1,1)} at
+its upper right.
+
+\xection{\PSTricks and other tricks\label{Pstricks:}}
+This section applies only to a \pic processor (\dpic) that is
+capable of producing output compatible with
+\PSTricks, \TPGF, or in principle, other graphics postprocessors.
+
+By using {\tt command} lines,
+or simply by inserting \latex graphics directives along with strings to
+be formatted, one can mix
+arbitrary \PSTricks (or other) commands with \Mfour 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
+
+{\small \verbatiminput{Axes.m4}}
+
+\noindent%
+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
+to {\tt s\_box} but rotates its text 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
+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.
+
+Another common requirement is the filling of arbitrary shapes, as
+illustrated by the following lines within a {\tt .m4} file:
+
+\vspace{\parsep}
+\noindent%
+\verb|command "`\pscustom[fillstyle=solid,fillcolor=lightgray]{'"|
+\hfill\break
+{\sl drawing commands for an arbitrary closed curve}
+\hfill\break
+\verb|command "`}%'"|
+\vspace{\parsep}
+
+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
+
+\vspace{\parsep}
+\noindent\verb|command "`\psset{|{\sl option=value,}$\;\ldots$\verb|}'"|
+\vspace{\parsep}
+
+\noindent%
+in the drawing commands or by using the macro
+{\tt psset\_(}{\sl PSTricks options}{\tt )}.
+
+The macros
+ {\tt shade(}{\sl gray value},{\sl closed line specs}{\tt )}
+and
+ {\tt rgbfill(}{\sl red value, green value, blue value, closed line specs}%
+ {\tt )}
+can be invoked to accomplish the same effect as the above fill example, but
+are not confined to use only with \PSTricks.
+
+Since arbitrary \latex can be output, either in ordinary strings or by
+use of {\tt command} output, complex examples such as found in
+reference~\cite{Girou94},
+for example, can be included. The complications
+are twofold: \latex 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 {\tt rs\_box}, {\tt shade}, and {\tt rgbfill} mentioned
+previously can be used to hide code differences.
+
+\subsection{\Tikz\ with pic}\label{Tikzwithpic:}
+%The line
+%
+%\vspace{\parsep}
+%\noindent{\tt command "}{\sl string}{\tt "}
+%\vspace{\parsep}
+%
+%\noindent
+%allows arbitrary postprocessor code to be embedded in \pic output. However,
+%one can also embed
+Arbitrary \pic output can be inserted into a {\tt \bsl{}tikzpicture}
+environment. The trick is to keep the \pic and \Tikz coordinate systems
+the same.
+The lines
+
+\vspace{\parsep}
+\noindent\verb|\begin{tikzpicture}[scale=2.54]|\\
+\noindent\verb|\end{tikzpicture}|
+\vspace{\parsep}
+
+\noindent in the {\tt dpic -g} output must be changed to
+
+\vspace{\parsep}
+\noindent\verb|\begin{scope}[scale=2.54]|\\
+\noindent\verb|\end{scope}|
+\vspace{\parsep}
+
+This is accomplished, for example, by adapting the {\tt \bsl{}mtotex}
+macro of \SR{Simplifications:} as follows:
+
+\vspace{\parsep}
+\noindent
+\verb^\newcommand\mtotikz[1]{\immediate\write18{m4 pgf.m4 #1.m4 | dpic -g^\\
+\verb^ | sed -e "/begin{tikzpicture}/s/tikzpicture/scope/"^\\
+\verb^ -e "/end{tikzpicture}/s/tikzpicture/scope/" > #1.tex}\input{./#1.tex}}%^\break
+%\verb^ -e "/end{tikzpicture}/s/tikzpicture/scope/"^\\
+%\verb^ > #1.tex}\input{./#1.tex}}%^\break
+
+Then, from within a \Tikz pictdure,
+{\tt \bsl{}mtotikz\lbr{}{\sl filename}\rbr}
+will create {\sl filename}{\tt .tex} from {\sl filename}{\tt .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 \Mfour macro
+{\tt tikznode(}{\sl tikz node name,[position],[string]}{\tt)}
+defines a zero-size \Tikz node at the given \pic position, which is
+{\tt Here} by default.
+This macro must be
+invoked in the outermost scope of a pic diagram, and the
+{\tt .PS} {\sl value} scaling construct may not be used.
+
+\xection{Web documents, {\ttfamily pdf}, and alternative output formats%
+\label{Alternative:}}
+
+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\ {\tt -t} generates output
+containing \tpic \verb|\special| commands, which must be converted
+to the desired output, whereas \dpic can generate several alternative
+formats, as shown in \FR{Workflow}.
+One of the easiest methods
+for producing web documents is to generate postscript as usual and to
+convert the result to pdf format with Adobe
+Distiller
+%\Textregistered
+or equivalent.
+
+PDFlatex produces pdf without first creating a postscript file
+but does not handle \tpic \verb|\special|s, so \dpic must be
+installed.
+
+%\enlargethispage{\baselineskip}
+Most PDFLatex distributions are not directly compatible with \PSTricks, but
+the \TPGF output of \dpic is compatible with both \latex and PDFLatex.
+Several alternative \dpic output formats such as
+\mfpic and \MetaPost also work well.
+To test \MetaPost, create a file {\sl filename}{\tt .mp}
+containing appropriate header lines, for example:
+%\pagebreak
+\begin{verbatim}
+ verbatimtex
+ \documentclass[11pt]{article}
+ \usepackage{times,boxdims,graphicx}
+ \boxdimfile{tmp.dim}
+ \begin{document} etex
+\end{verbatim}
+Then append one or more diagrams by using the equivalent of
+
+{\tt m4 <}{\sl installdir}{\tt >mpost.m4 {\sl library files}
+ {\sl diagram}.m4 | dpic -s >> {\sl filename}.mp}
+
+The command ``{\tt mpost --tex=latex } {\sl filename}{\tt .mp end}''
+processes this file, formatting the diagram text by creating a
+temporary {\tt .tex} file, \latex{}ing it, and recovering the {\tt .dvi}
+output to create {\sl filename}{\tt .1} and other files. If the {\tt boxdims}
+macros are being invoked, this process must be repeated to handle
+formatted text correctly as described in \SR{Interaction:}.
+In this case, either put {\tt sinclude(tmp.dim)} in the diagram {\tt .m4}
+source or read the {\tt .dim} file at the second invocation of
+\Mfour as follows:
+
+{\tt m4 <}{\sl installdir}{\tt >mpost.m4 {\sl library files} tmp.dim
+ {\sl diagram}.m4 | dpic -s >> {\sl filename}.mp}
+
+On some operating systems, the absolute path name for {\tt tmp.dim} has
+to be used to ensure that the correct dimension file is written and
+read. This distribution includes a {\tt Makefile} that simplifies the
+process; otherwise a script can automate it.
+
+Having produced {\sl filename}{\tt .1}, rename it to {\sl filename}{\tt .mps}
+and, {\it voil\`a,} you can now run PDFlatex on a {\tt .tex} source
+that includes the diagram using
+\verb|\includegraphics{|{\sl filename}\verb|.mps}|
+as usual.
+
+The \dpic processor is capable of other output formats, as illustrated in
+\FR{Workflow} and in example files included with the distribution.
+The \latex drawing commands alone or with {\tt eepic} or {\tt pict2e}
+extensions are suitable only for simple diagrams.
+\begin{figure}[h!b]
+% \ifpdf\vspace*{-\baselineskip}\fi%
+ \input Workflow
+ \ifpdf\vspace*{-\baselineskip}\fi%
+ \caption{Output formats produced by \gpic {\tt -t} and \dpic.
+ SVG output can be read by Inkscape or used directly in web documents.}
+ \label{Workflow}
+ \end{figure}
+
+\xection{Developer's notes\label{Developersnotes:}}
+Years ago in the course of writing a book, I took a few days off to
+write a \pic-like interpreter (\dpic) to automate the tedious
+coordinate calculations required by \latex picture objects. The
+macros in this distribution and the interpreter are the result of that
+effort, drawings I have had to produce since, and suggestions received from
+others. The interpreter has been upgraded over time to generate
+\mfpic, \MetaPost~\cite{metapost}, raw \Postscript, \Postscript with
+{\tt psfrag} tags, raw PDF, \PSTricks, and
+Ti{\it k}Z PGF output, the latter two my preference
+because of their quality and flexibility, including facilities for colour
+and rotations, together with simple font selection.
+\Xfig{}-compatible output was introduced early on to allow the creation of
+diagrams both by programming and by interactive graphics.
+\SVG output was added relatively recently, and seems suitable for
+producing web diagrams directly and for further editing by the
+Inkscape interactive graphics editor. The latest addition
+is raw PDF output, which has very basic text capability and is most
+suitable for creating diagrams without labels, but on which sophisticated
+text can be overlaid. \Dpic can write the coordinates of selected
+locations to an external file to be used in overlaying text or other
+items on the diagram.
+
+Instead of using \pic macros, I preferred the equally simple
+but more powerful \Mfour macro processor, and therefore \Mfour is
+required here, although \dpic now supports \pic-like macros. Free
+versions of \Mfour are available for Unix, Windows, and other
+operating systems.
+
+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 \TPGF, for example, remains available,
+as arbitrary postprocessor code can be included with \pic code.
+
+The main value of this distribution is not in the use of a specific
+language but in the element data encoded in the macros, which have been
+developed with reference to standards and refined over two decades.
+Some of them have become less readable as more options and flexibility
+have been added, and if starting over today, perhaps I would change
+some details. Compromises have been made in order to retain reasonable
+compatibility with the variety of postprocessors. No choice of tool
+is without compromise, and producing good graphics seems to be time
+consuming, no matter how it is done, especially for circuits
+or other diagrams that contain random detail.
+
+The \dpic interpreter has several output-format options that may be
+useful. The {\tt eepicemu} and {\tt pict2e} extensions of the
+primitive \latex picture objects are supported. The \mfpic output
+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 \tex 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
+%\Textregistered
+and Adobe Illustrator
+%\Textregistered
+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.
+
+\xection{Bugs\label{Bugs:}}
+This section provides hints and a list of common errors.
+
+The distributed macros are not written for maximum robustness.
+Arguments could be entered in a key--value style (for example, {\tt
+resistor(up\_ elen\_,style=N;cycles=8}) instead of by positional
+parameters, but it was decided early on
+to keep macro usage as close as possible to \pic\ conventions.
+Macro arguments could be tested for correctness and
+explanatory error messages could be written as necessary, but that
+would make the macros more difficult to read and to write. You will
+have to read them when unexpected results are obtained or when you wish
+to modify them.
+
+Maintaining reasonable compatibility with both \gpic\ and \dpic
+and, especially, for different postprocessors, has
+resulted in some macros becoming more complicated than is preferable.
+
+Here are some hints, gleaned from experience and from comments I have
+received.
+\newcommand{%
+ \bflistitem}[2]{\phantomsection\pdfbookmark[subsection]{#1}{#2}{\bf #1: }}
+\begin{enumerate}
+
+%\item {\bf Misconfiguration:}
+\item
+\bflistitem{Misconfiguration}{misconfig}%
+ One of the configuration files
+ listed in \SR{Libraries:} and {\tt libgen.m4}
+ {\em must} be read by \Mfour before any other library macros.
+ Otherwise, the macros assume default configuration.
+ To aid in detecting the default condition, a {\tt WARNING}
+ comment line is inserted into the {\tt 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 {\tt gpic} to {\tt pstricks}
+ near the top of {\tt libgen.m4}.
+ Similarly if only \TPGF will be used, change {\tt gpic} to {\tt pgf}
+ using the Makefile.
+ The package default is to read {\tt gpic.m4} for historical compatibility.
+ The processor options must be chosen correspondingly,
+ {\tt gpic -t} for {\tt gpic.m4} and, most often,
+ {\tt dpic -p} or {\tt dpic -g} when \dpic is employed.
+ For example, the pipeline for \PSTricks output from file {\tt quick.m4} is
+
+ {\tt m4 -I {\sl installdir} pstricks.m4 quick.m4 | dpic -p > quick.tex}
+
+ \noindent%
+ but for \TPGF processing, the configuration file and \dpic option have to
+ be changed:
+
+ {\tt m4 -I {\sl installdir} pgf.m4 quick.m4 | dpic -g > quick.tex}
+
+ Any non-default configuration file must appear explicitly in the command
+ line or in an {\tt include()} statement.
+
+\iffalse
+\item
+\bflistitem{Initialization}{initialization}
+If the first element macro evaluated is not two-terminal or is within a
+\Pic block, then later macros evaluated outside the block may produce
+the error message
+
+{\tt there is no variable `rp\_ang'}
+
+\noindent because {\tt rp\_ang} is not defined in the outermost scope of the
+diagram. To cure this problem, make sure that the line
+
+{\tt cct\_init}
+
+\noindent appears immediately after the .PS line or prior to the first block.
+It is entirely permissible to modify {\tt cct\_init} to include customized
+diagram initializations such as the {\tt thicklines\_} statement.
+One way to do this is to define a macro {\tt local\_init} in
+{\tt libgen.m4}.
+\fi
+
+\item
+\bflistitem{Pic objects versus macros}{objects}%
+ A common error is to write something like
+
+{\tt line from A to B; resistor from B to C; ground at D}
+
+\noindent when it should be
+
+{\tt line from A to B; resistor(from B to C); ground(at D)}
+
+\noindent This error is caused by an unfortunate inconsistency between
+\pic object attributes and the way \Mfour and \pic pass macro arguments.
+
+\item
+\bflistitem{Commas}{commas}
+Macro arguments are separated by commas, so any comma that is
+part of an argument must be protected by parentheses or quotes. Thus,
+
+{\tt shadebox(box with .n at w,h)}
+
+\noindent produces an error, whereas
+
+{\tt shadebox(box with .n at w`,'h)}
+
+\noindent and
+
+{\tt shadebox(box with .n at (w,h))}
+
+\noindent do not. The parentheses are preferred.
+For example,
+a macro invoked by circuit elements contained the line
+
+\verb|command "\pscustom[fillstyle=solid`,'fillcolor=m4fillv]{%"|
+
+\noindent 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
+
+\verb|command sprintf("\pscustom[fillstyle=solid,fillcolor=m4fillv]{%%")|
+
+\noindent
+cured the problem because the protecting parentheses are not stripped away.
+
+\item
+\bflistitem{Default directions and lengths}{defaultdir}
+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
+
+{\tt source(up\_)}
+
+\noindent draws a source up a distance equal to the current
+{\tt lineht} value, which may cause confusion.
+Writing
+
+{\tt source(0.5)}
+
+\noindent draws a source of length 0.5 units
+in the current \pic default direction, which is one of
+{\tt right,} {\tt left,} {\tt up,} or {\tt down.}
+The best practice is
+to specify both the direction and length of an element, thus:
+
+{\tt source(up\_ elen\_).}
+
+The effect of a \linespec argument is independent of any direction
+set using the {\tt Point\_} or similar macros.
+To draw an element at an obtuse angle (see \SR{Corners:}) try,
+for example,
+
+{\tt Point\_(45); source(to rvec\_(0.5,0))}
+
+\item
+\bflistitem{Processing sequence}{sequence}
+It is easy to forget that \Mfour finishes before \pic processing
+begins. Consequently, it may be puzzling that the following mix of
+a \pic loop and the \Mfour macro {\tt s\_box} does not appear to produce
+the required result:
+
+{\tt for i=1 to 5 do \lbr s\_box(A[i]); move \rbr}
+
+\noindent In this example, the {\tt s\_box} macro is expanded only once
+and the index {\tt i} is not a number. This particular example can be
+repaired by using an \Mfour loop:
+
+{\tt for\_(1,5,1,`s\_box(A[m4x]); move')}
+
+\item
+\bflistitem{Quotes}{quotes}
+ Single quote characters are stripped in pairs by \Mfour, so the string
+
+{\tt "{`}{`}inverse{'}{'}"}
+
+\noindent will become
+
+{\tt "{`}inverse{'}".}
+
+\noindent The cure is to add single quotes in pairs as necessary.
+
+ The only subtlety required in writing
+ \Mfour 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 {\tt parallel\_} macro.
+
+\item
+\bflistitem{Dollar signs}{dollarsigns}
+The $i$-th argument of an \Mfour macro is {\tt \$}$i,$ where $i$ is
+an integer, so the following construction can cause an error when it
+is part of a macro,
+
+{\tt "\$0\$" rjust below}
+
+\noindent since {\tt \$0} expands to the name of the macro itself.
+To avoid this problem, put the string in quotes or write
+ {\tt "\$`'0\$".}
+
+\item
+\bflistitem{Name conflicts}{conflicts}
+ Using the name of a macro as part of a comment or string is a
+ simple and common error. Thus,
+
+{\tt arrow right \verb|"$\dot x$"| above}
+
+\noindent produces an error message because {\tt dot} is a macro
+name. Macro expansion can be avoided by adding quotes, as follows:
+
+{\tt arrow right `\verb|"$\dot x$"|'\ above}
+
+Library macros intended only for internal use have names that begin
+with {\tt m4} or {\tt M4} to avoid name clashes, but in addition,
+a good rule is to quote all \latex 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 \latex, for example
+the diagram
+
+{\tt
+.PS\hfill\break
+ \hspace*{\parindent} box \verb|"\stringA"|\hfill\break
+.PE
+}
+
+\noindent with the \latex macro
+
+{\tt
+ \verb|\newcommand{\stringA}{|%
+
+ \verb|Circuit containing planar inductor and capacitor}|
+}
+
+\item
+\bflistitem{Current direction}{currdir}
+ Some macros, particularly those for labels, do
+unexpected things if care is not taken to preset the current direction
+using macros {\tt right\_,} {\tt left\_,} {\tt up\_,} {\tt down\_,}
+or {\tt rpoint\_($\cdot$).}
+Thus for two-terminal macros it is good practice to write, e.g.
+
+{\tt resistor(up\_ from A to B); rlabel(,R\_1)}
+
+\noindent%
+rather than
+
+{\tt resistor(from A to B); rlabel(,R\_1),}
+
+\noindent%
+which produce different results if the last-defined drawing direction is not
+{\tt up}. It might be possible to change the label macros to avoid this problem
+without sacrificing ease of use.
+
+\item
+\bflistitem{Position of elements that are not 2-terminal}{nottwoterm}
+ The \linespec argument of elements defined in {\tt[} {\tt]}
+ 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
+ default {\em 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 \SR{Composite:} on
+ \PR{Composite:}, for example
+
+{\tt igbt(up\_ elen\_) with .E at (1,0)}
+
+\item
+\bflistitem{Pic error messages}{errormessages}
+ 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.
+
+\item
+\bflistitem{Line continuation}{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 {\tt \#} character.
+ A blank after the backslash, for example, produces a \pic error.
+
+\item
+\bflistitem{Scaling}{scaling}
+ \Pic and these macros provide several ways to scale
+ diagrams and elements within them, but subtle unanticipated effects
+ may appear. The line {\tt.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 {\tt scale} parameter for
+ global scaling unless the primary objective is to specify overall
+ dimensions.
+
+\item
+\bflistitem{Buffer overflow}{overflow}
+ For some \Mfour implementations,
+ the error message {\tt 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 {\tt
+ -B16000} enlarges the buffer size to 16000 bytes. However, this
+ error message could also result from a syntax error.
+
+\item
+\bflistitem{\PSTricks anomaly}{anomaly}
+ If you are using \PSTricks and
+ you get the error message {\tt Graphics parameter `noCurrentPoint'
+ not defined..} then your version of \PSTricks is older than
+ August 2010. You can do the following:
+\begin{enumerate}
+\item Update your \PSTricks package.
+\item Instead, comment out the second definition of {\tt M4PatchPSTricks} in
+ {\tt pstricks.m4}. The first definition works for some older
+ \PSTricks distributions.
+\item Insert {\tt define(`M4PatchPSTricks',)} immediately after the
+ {\tt .PS} line of your diagram.
+ This change prevents the line
+ \verb|\psset{noCurrentPoint}| from being added to the {\tt .tex}
+ code for the diagram. This line is a workaround for a ``feature''
+ of the current \PSTricks \verb|\psbezier| command that changes its
+ behaviour within the \verb|\pscustom| environment. This situation
+ occurs rarely and so the line is unnecessary for many diagrams.
+\item For very old versions of \PSTricks such as pstricks97, disable the
+ workaround totally by changing the second definition in {\tt pstricks.m4}
+ to {\tt define(`M4PatchPSTricks',)}. Undo the change if you later update
+ \PSTricks.
+ \end{enumerate}
+
+\item
+\bflistitem{m4 {\tt -I} error}{mfourerror}\label{Mfourerror:}
+ Some old versions of m4 may not implement
+ the {\tt -I} option or the {\tt 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 {\tt include({\sl filename})} statements in the libraries and
+ calling commands have to be given absolute {\sl filename} paths.
+ You can define the {\tt HOMELIB\_} macro in {\tt libgen.m4} to the
+ path of the installation directory and change the library
+ include statements to the form {\tt include(HOMELIB\_`'{\sl filename})}.
+
+\end{enumerate}
+
+\xection{List of macros\label{Listofmacros:}}
+\label{defines}
+The following table lists macros in the libraries, configuration
+files, and selected macros from example diagrams. Some of the sources
+in the {\tt 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.
+\input defines
+\endinput
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ I think you want the pdfcomment package. This includes a \pdftooltip command.
+
+ This lets you add a tool tip to the PDF using
+ \pdftooltip{item}{tooltip},
+ where the item can be almost anything
+ (e.g. \pdftooltip{\includegraphics[]{}}{description of my figure}).
+
+ In your case, you could use
+
+ \pdftooltip{abbreviation}{what that TLA means}
+
+ But with pdfcomment, the tool tip cannot be anything but plain,
+ unformatted text.
+
+ Try the \pdfcomment package. There's an option to add a tool tip to
+ the PDF using \pdftooltip{item}{tooltip}, where the item can be a float
+ (e.g. \pdftooltip{\includegraphics[]{}}{description of my figure}).
+
+ The overall process that I've settled on to produce 508-compliant
+ documents is to
+
+ Produce a high-quality PDF from \latex which includes all of the tooltips
+ Run the PDF through the tagging tool that is provided by Adobe Acrobat X
+ (Adobe how-to).
+
+
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/currents.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/currents.m4
new file mode 100644
index 00000000000..5b2e20fa547
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/currents.m4
@@ -0,0 +1,52 @@
+.PS
+# `currents.m4'
+cct_init
+ del = 0.75
+[
+ {right_
+ resistor; b_current(i)
+ {"\tt b\_current(i)" at last line + (0,-0.20)}
+ move right_ del
+ resistor; b_current(i,below_)
+ {"\tt $\ldots$(i,below\_)" at last line + (0,-0.20)}
+ move right_ del
+ resistor; b_current(i,,O)
+ {"\tt $\ldots$(i,{,}O)" at last line + (0,-0.20)}
+ move right_ del
+ resistor; b_current(i,below_,O)
+ {"\tt $\ldots$(i,below\_,O)" at last line + (0,-0.20)}
+ }
+
+ move down_ 0.60
+ {right_
+ resistor; b_current(i,,,E)
+ {"\tt b\_current(i,{,},E)" wid 1.2 at last line + (0,-0.20)}
+ move right_ del
+ resistor; b_current(i,below_,,E)
+ {"\tt $\ldots$(i,below\_,{,}E)" at last line + (0,-0.20)}
+ move right_ del
+ resistor; b_current(i,,O,E,0.2)
+ {"\tt $\ldots$(i,{,}O,E,0.2)" at last line + (0,-0.20)}
+ move right_ del
+ resistor; b_current(i,below_,O,E)
+ {"\tt $\ldots$(i,below\_,O,E)" at last line + (0,-0.20)}
+ }
+
+ move down_ 0.60
+ {right_
+ del = 0.55
+ inductor; larrow(i)
+ {"`\tt larrow(i)'" at last line + (0,-0.20)}
+ move up 0.1 right_ del
+ inductor; rarrow(i)
+ {"`\tt rarrow(i)'" at last line + (0,-0.30)}
+ move down 0.1 right_ del
+ inductor; larrow(i,<-)
+ {"`\tt larrow(i,<-)'" at last line + (0,-0.20)}
+ move up 0.1 right_ del
+ inductor; rarrow(i,<-)
+ {"`\tt rarrow(i,<-)'" at last line + (0,-0.30)}
+ }
+]
+#showbox_
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/defines.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/defines.tex
new file mode 100644
index 00000000000..84634c5862d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/defines.tex
@@ -0,0 +1,1892 @@
+%
+\newdimen{\leftwid}\setlength{\leftwid}{2in}
+\newdimen{\libwid}\setlength{\libwid}{0.5in}
+\newdimen\rightwid
+\setlength{\rightwid}{\textwidth}
+\addtolength{\rightwid}{-\leftwid}
+\addtolength{\rightwid}{-\libwid}
+%
+\newbox\Defbox
+
+\newcommand{\macx}[2]{%
+ \phantomsection\pdfbookmark[subsection]{#1}{#2}#1}
+
+\newcommand{\macrodef}[5]{%\begin{samepage}%
+\phantomsection\pdfbookmark[subsection]{#1}{#2}%
+\setbox\Defbox=\hbox{\tt #1#3}%
+ \ifdim\wd\Defbox>\textwidth%
+ \setbox\Defbox=\hbox{\parbox{\textwidth}{\tt #1#3}}\fi
+ \ifdim\wd\Defbox>\leftwid%
+ \box\Defbox\hfill\break\hspace*{\leftwid}%
+ \else\hbox to \leftwid{\box\Defbox\hfill}\fi%
+ \hbox to \libwid{#4\hfill}\parbox[t]{\rightwid}%
+ {\raggedright #5}%
+% \end{samepage}%
+ \vspace{\parsep}\\}
+
+\newcommand{\seesect}[1]{ (\SR{#1})}
+
+\vspace{\abovedisplayskip}
+\noindent
+\macrodef{above\_}{above_}{}
+ {gen}
+ {string position above relative to current direction}
+\macrodef{abs\_}{abs_}{({\sl number})}
+ {gen}
+ {absolute value function}
+\macrodef{adc}{adc}{({\sl width,height,nIn,nN,nOut,nS})}
+ {cct}
+ {ADC with defined width, height, and number of inputs {\tt In$i$},
+ top terminals {\tt N$i$}, ouputs {\tt Out$i$},
+ and bottom terminals~{\tt S$i$}}
+\macrodef{addtaps}{addtaps}{[{\sl arrowhd}
+ | type={\sl arrowhd};name={\sl Name}],
+ {\sl fraction, length, fraction, length,} $\cdots$)}
+ {cct}
+ {Add taps to the previous two-terminal element.
+ {\sl arrowhd} = blank or one of {\tt . - <- -> <->}.
+ Each fraction determines the position along the element body of the tap.
+ A negative length draws the tap to the right of the current
+ direction; positive length to the left.
+ Tap names are Tap1, Tap2, $\cdots$ by default or
+ Name1, Name2, $\cdots$ if specified
+ \seesect{Composite:}}
+\macrodef{along\_}{along_}{({\sl linear object name})}
+ {gen}
+ {short for {\tt between {\sl name}.start and {\sl name}.end}}
+\macrodef{Along\_}{Along_}{({\sl LinearObj,distance,}[R])}
+ {gen}
+ {Position arg2 (default all the way) along a linear object
+ from {\tt .start} to {\tt .end}
+ (from {\tt .end} to {\tt .start} if arg3={\tt R}) }
+\macrodef{amp}{amp}{(\linespec,{\sl size})}
+ {cct}
+ {amplifier\seesect{Twoterminal:}}
+\macrodef{And, Or, Not, Nand, Nor, Xor, Nxor, Buffer}%
+ {And, Or, Not, Nand, Nor, Xor, Nxor, Buffer}{}
+ {log}
+ {Wrappers of {\tt AND\_gate}, $\ldots$ for use in the {\tt Autologix}
+ macro}
+\macrodef{AND\_gate}{AND_gate}{({\sl n},N)}
+ {log}
+ {basic `and' gate, 2 or {\sl n\/} inputs; {\tt N}=negated input.
+ Otherwise, arg1 can be a sequence of letters {\tt P|N}
+ to define normal or negated inputs
+ \seesect{Logicgates:}}
+\macrodef{AND\_gen}{AND_gen}{($n$,{\sl chars},[{\sl wid},[{\sl ht}]])}
+ {log}
+ {general AND gate: $n$=number of inputs $(0\leq n\leq 16)$;
+ {\sl 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 {\tt P|N}
+ to define normal or negated inputs.}
+\macrodef{AND\_ht}{AND_ht}{}
+ {log}
+ {height of basic `and' and `or' gates in {\tt L\_unit}s}
+\macrodef{AND\_wd}{AND_wd}{}
+ {log}
+ {width of basic `and' and `or' gates in {\tt L\_unit}s}
+\macrodef{antenna}{antenna}{%
+ (at {\sl location}, T, A|L|T|S|D|P|F, U|D|L|R|{\sl degrees})}
+ {cct}
+ {antenna, without stem for nonblank 2nd arg; {\tt A}=aerial,
+ {\tt L}=loop, {\tt T}=triangle, {\tt S}=diamond, {\tt D}=dipole,
+ {\tt P}=phased, {\tt F}=fork;
+ up, down, left, right, or angle from horizontal (default 90)
+ \seesect{Composite:}}
+\macrodef{arca}{arca}{({\sl absolute chord linespec}, ccw|cw, {\sl radius},
+ {\sl modifiers}) }
+ {gen}
+ {arc with acute angle (obtuse if radius is negative), drawn in a [ ] block}
+\macrodef{arcd}{arcd}{({\sl center},
+ {\sl radius},{\sl start degrees},{\sl end degrees}) }
+ {gen}
+ {Arc definition (see {\tt arcr}), angles in degrees
+ \seesect{Positions:}}
+\macrodef{arcdimension\_}{arcdimension_}{({\sl arcspec},{\sl offset},%
+{\sl label},
+ D|H|W|{\sl blank width},{\sl tic offset},{\sl arrowhead })}
+ {gen}
+ {like {\tt dimension\_}, for drawing arcs for dimensioning diagrams;
+ {\sl arrowhead=}{\tt -> | <-}. Uses the first argument as the attributes
+ of an invisible arc: {\tt arc invis }{\sl arg1}. {\sl Arg2} is the
+ radial displacement (possibly negative) of the dimension arrows.
+ If {\sl arg3} is {\tt s\_box(\ldots)} or {\sl rs\_box(\ldots)} and
+ {\sl arg4=}{\tt D|H|W} then {\sl arg4} means:
+ {\tt D:} blank width is the diagonal length of {\sl arg3};
+ {\tt H:} blank width is the height of {\sl arg3} + {\tt textoffset*2};
+ {\tt W:} blank width is the width of {\sl arg3} + {\tt textoffset*2};
+ otherwise {\sl arg4} is the absolute blank width}
+\macrodef{arcr}{arcr}{({\sl center},{\sl radius},{\sl start angle},{\sl
+ end angle,modifiers,ht}) }
+ {gen}
+ {Arc definition. If arg5 contains {\tt <-} or {\tt ->} 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., {\tt arcr(A,r,0,pi\_/2,->) dotted ->}
+ \seesect{Positions:}}
+\macrodef{arcto}{arcto}{({\sl position 1},{\sl position 2},{\sl
+ radius},[dashed|dotted])}
+ {gen}
+ {line toward position 1 with rounded corner toward position 2}
+\macrodef{arrowline}{arrowline}{(\linespec)}
+ {cct}
+ {line (dotted, dashed permissible) with centred arrowhead
+ \seesect{Twoterminal:}}
+\macrodef{AutoGate}{AutoGate}{}
+ {log}
+ {Draw the tree for a gate as in the {\tt Autologix} macro. No inputs
+ or external connections are drawn. The names of the internal gate
+ inputs are stacked in {\tt `AutoInNames'}}
+\macrodef{Autologix}{Autologix}%
+ {({\sl Boolean function sequence},%
+ [N[oconnect]][L[eftinputs]][R][V][M][;offset={\sl value}]}
+ {log}
+ {Draw the Boolean expressions defined in function notation
+ using {\tt And, Or, Not, Buffer, Xor, Nand, Nor, Nxor}
+ and variables, e.g.,
+ {\tt Autologix(And(Or(x1,~x2),Or(~x1,x2)));}.
+ The Boolean functions are separated by semicolons (;). Function
+ outputs are aligned vertically but appending
+ {\tt:}{\sl location attribute} to a function can be used to place it.
+ Each unique variable {\sl var} causes an input point {\tt In}{\sl var}
+ to be defined. Preceding the variable by a {\tt \~{}} causes a not gate
+ to be drawn at the input.
+ The inputs are drawn in a row at the upper left by default.
+ An {\tt L} in arg2 draws the inputs in a column at the left;
+ {\tt R} reverses the order of the drawn inputs;
+ {\tt V} scans the expression from right to left
+ when listing inputs;
+ {\tt M} draws the left-right mirror image of the diagram;
+ and {\tt N} draws only the function tree without the input array.
+ The inputs are labelled {\tt In1}, {In2}, \ldots and the function
+ outputs are {\tt Out1}, {Out2}, \dots.
+ Each variable {\sl var} corresponds also to one of the input array
+ points with label {\tt In}{\sl var}.
+ Setting {\tt offset=}{\sl value} displaces the
+ drawn input list in order to disambiguate the input connections when {\tt L}
+ is used}
+\macrodef{b\_}{b_}{}
+ {gen}
+ {blue color value}
+\macrodef{b\_current}{b_current}{({\sl label},{\sl pos},In|Out,Start|End,{\sl
+ frac})}
+ {cct}
+ {labelled branch-current arrow to {\sl frac} between branch end and body
+ \seesect{Branchcurrent:}}
+\macrodef{basename\_}{basename_}{({\sl string sequence, separator})}
+ {gen}
+ {Extract the rightmost name from a sequence of names separated by arg2
+ (default dot ``.'')}
+\macrodef{battery}{battery}{(\linespec,{\sl n},R)}
+ {cct}
+ {n-cell battery: default 1 cell,
+ R=reversed polarity\seesect{Twoterminal:}}
+\macrodef{beginshade}{beginshade}{({\sl gray value})}
+ {gen}
+ {begin gray shading, see {\tt shade}
+ e.g., {\tt beginshade(.5);} {\sl closed line specs}; {\tt endshade}}
+\macrodef{bell}{bell}{( U|D|L|R|{\sl degrees}, {\sl size})}
+ {cct}
+ {bell, {\sl In1} to {\sl In3} defined
+ \seesect{Composite:}}
+\macrodef{below\_}{below_}{}
+ {gen}
+ {string position relative to current direction}
+\macrodef{bi\_tr}{bi_tr}{(\linespec,L|R,P,E)}
+ {cct}
+ {left or right, N- or P-type bipolar transistor, without or with envelope
+ \seesect{Semiconductors:}}
+\macrodef{bi\_trans}{bi_trans}{(\linespec,L|R,{\sl chars},E)}
+ {cct}
+ { bipolar transistor, core left or right; chars:
+ {\tt BU}=bulk line,
+ {\tt B}=base line and label,
+ {\tt S}=Schottky base hooks,
+ {\tt uEn|dEn}=emitters E0 to En,
+ {\tt uE|dE}=single emitter,
+ {\tt Cn|uCn|dCn}=collectors C0 to Cn; {\tt u} or {\tt d} add an arrow,
+ {\tt C}=single collector; {\tt u} or {\tt d} add an arrow,
+ {\tt G}=gate line and location,
+ {\tt H}=gate line; {\tt L}=L-gate line and location,
+ {\tt [d]D}=named parallel diode,
+ {\tt d}=dotted connection,
+ {\tt [u]T}=thyristor trigger line;
+ arg 4 = E: envelope
+ \seesect{Semiconductors:}}
+\macrodef{binary\_}{binary_}{($n$, [$m$])}
+ {gen}
+ {binary representation of $n,$ left padded to $m$ digits if the second
+ argument is nonblank}
+\macrodef{BOX\_gate}{BOX_gate}{({\sl inputs,output,swid,sht,label})}
+ {log}
+ {output=[{\tt P|N}], inputs=[{\tt P|N}]$\ldots$, sizes swid and sht
+ in {\tt L\_unit}s (default {\tt AND\_wd} = 7)
+ \seesect{Logicgates:}}
+\macrodef{boxcoord}{boxcoord}{({\sl planar obj},{\sl x fraction},{\sl y
+ fraction})}
+ {gen}
+ {internal point in a planar object}
+\macrodef{boxdim}{boxdim}{({\sl name},h|w|d|v,{\sl default})}
+ {gen}
+ {evaluate, e.g.\ {\sl name}{\tt \_w} if defined, else {\sl default\/}
+ if given, else 0 {\tt v} gives sum of {\tt d} and {\tt h} values
+ \seesect{Interaction:}}
+\macrodef{bp\_\_}{bp__}{}
+ {gen}
+ {big-point-size factor, in scaled inches, ({\tt *scale/72})}
+\macrodef{bswitch}{bswitch}{(\linespec, [L|R],chars)}
+ {cct}
+ {pushbutton switch R=right orientation (default L=left);
+ chars: O= normally open, C=normally closed }
+\macrodef{BUF\_ht}{BUF_ht}{}
+ {log}
+ {basic buffer gate height in {\tt L\_unit}s}
+\macrodef{BUF\_wd}{BUF_wd}{}
+ {log}
+ {basic buffer gate width in {\tt L\_unit}s}
+\macrodef{BUFFER\_gate}{BUFFER_gate}{(\linespec, [N|B],
+ {\sl wid, ht,} [N|P]\char42, [N|P]\char42, [N|P]\char42)}
+ {log}
+ {basic buffer, dfault 1 input or as a 2-terminal element,
+ arg2: {\tt N}=negated input, {\tt B}=box gate; arg 5:
+ normal ({\tt P}) or negated {\tt N}) inputs labeled In1
+ \seesect{Logicgates:}}
+\macrodef{BUFFER\_gen}{BUFFER_gen}{({\sl chars,wd,ht},[N|P]*,[N|P]*,[N|P]*)}
+ {log}
+ {general buffer, {\sl chars:} {\tt T}=triangle,
+ {\tt [N]O}=output location {\tt Out}
+ ({\tt NO} draws circle {\tt N\_Out});
+ {\tt [N]I, [N]N, [N]S, [N]NE, [N]SE}
+ input locations; {\tt C}=centre location.
+ Args 4-6 allow alternative
+ definitions of respective {\tt In, NE,}
+ and {\tt SE} argument sequences }
+\macrodef{buzzer}{buzzer}{( U|D|L|R|{\sl degrees, size,}[C])}
+ {cct}
+ {buzzer, {\sl In1} to {\sl In3} defined, C=curved
+ \seesect{Composite:}}
+\macrodef{c\_fet}{c_fet}{(\linespec,L|R,P)}
+ {cct}
+ {left or right, plain or negated pin simplified MOSFET}
+\macrodef{capacitor}{capacitor}{(\linespec,{\sl char}[+[L]],R,
+ {\sl height}, {\sl wid})}
+ {cct}
+ {capacitor, {\sl char}: F or none=flat plate, C=curved-plate,
+ E=polarized boxed plates,
+ K=filled boxed plates,
+ M=unfilled boxes,
+ M=one rectangular plate,
+ P=alternate polarized; + adds a polarity sign;
+ +L polarity sign to the left of drawing direction;
+ arg3: R=reversed polarity,
+ arg4 = height (defaults F: {\tt dimen\_}$/3$,
+ C,P: {\tt dimen\_}$/4$, E,K: {\tt dimen\_}$/5$)
+ arg5 = wid (defaults F: {\sl height}*0.3,
+ C,P: {\sl height}*0.4, E,K: {\sl height}) \seesect{Twoterminal:}}
+\macrodef{cbreaker}{cbreaker}{(\linespec,L|R,D|T|TS)}
+ {cct}
+ {circuit breaker to left or right, {\tt D}=with dots; {\tt T}=thermal;
+ {\tt TS}=squared thermal\seesect{Twoterminal:}}
+\macrodef{ccoax}{ccoax}{(at {\sl location}, M|F, {\sl diameter})}
+ {cct}
+ {coax connector, {\tt M}=male, {\tt F}=female
+ \seesect{Composite:}}
+\macrodef{cct\_init}{cct_init}{}
+ {cct}
+ {initialize circuit-diagram environment (reads {\tt libcct.m4})}
+\macrodef{centerline\_}{centerline_}{({\sl linespec, thickness{\tt|}color,
+ minimum long dash len, short dash len, gap len}}
+ {gen}
+ {Technical drawing centerline}
+\macrodef{Cintersect}{Cintersect}{({\sl Pos1, Pos2, rad1, rad2,} [R])}
+ {gen}
+ {Upper (lower if arg5={\tt R}) intersection of circles at
+ {\sl Pos1} and {\sl Pos2}, radius {\sl rad1} and {\sl rad2}}
+\macrodef{clabel}{clabel}{({\sl label},{\sl label},{\sl label})}
+ {cct}
+ {centre triple label \seesect{Labels:}}
+\macrodef{cm\_\_}{cm__}{}
+ {gen}
+ {absolute centiimetres}
+\macrodef{consource}{consource}{(\linespec,V|I|v|i,R)}
+ {cct}
+ {voltage or current controlled source with alternate forms;
+ {\tt R}=reversed polarity\seesect{Twoterminal:}}
+\macrodef{contact}{contact}{({\sl chars})}
+ {cct}
+ {single-pole contact: {\tt P}= three position, {\tt O}= normally open,
+ {\tt C}= normally closed, {\tt I}= circle contacts, {\tt R}= right
+ orientation
+ \seesect{Composite:}}
+\macrodef{contline}{contline}{({\sl line})}
+ {gen}
+ {evaluates to {\tt continue}
+ if processor is {\bf dpic}, otherwise to first arg (default {\tt line})}
+\macrodef{corner}{corner}{({\sl 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. {\tt outlined} {\sl string}; if arg2 starts with
+ {\tt at} {\sl position} then a manhattan (right-left-up-down) corner
+ is drawn;
+ arg3= radians (turn angle, +ve is ccw, default $\pi/2$).
+ The corner is enclosed in braces
+ in order to leave {\tt Here} unchanged unless arg2 begins with {\tt at}
+ \seesect{Corners:}}
+\macrodef{Cos}{Cos}{({\sl integer})}
+ {gen}
+ {cosine function, {\sl integer\/} degrees}
+\macrodef{cosd}{cosd}{({\sl arg})}
+ {gen}
+ {cosine of an expression in degrees}
+\macrodef{Cosine}{Cosine}{( {\sl amplitude}, {\sl freq}, {\sl time},
+ {\sl phase} )}
+ {gen}
+ {function $a\times\cos(\omega t + \phi)$ }
+\macrodef{cross}{cross}{(at {\sl location})}
+ {gen}
+ {plots a small cross}
+\macrodef{cross3D}{cross3D}{({\sl x1,y1,z1,x2,y2,z2})}
+ {3D}
+ {cross product of two triples}
+\macrodef{crossover}{crossover}{(\linespec, L|R, Line1, ...)}
+ {cct}
+ {line jumping left or right over named lines\seesect{Semiconductors:}}
+\macrodef{crosswd\_}{crosswd_}{}
+ {gen}
+ {cross dimension}
+\macrodef{csdim\_}{csdim_}{}
+ {cct}
+ {controlled-source width}
+\macrodef{d\_fet}{d_fet}{(\linespec,L|R,P,S,E|S)}
+ {cct}
+ {left or right, N or P depletion MOSFET, normal or simplified,
+ without or with envelope or thick channel
+ \seesect{Semiconductors:}}
+\macrodef{dabove}{dabove}{(at {\sl location})}
+ {darrow}
+ {above (displaced dlinewid/2)}
+\macrodef{dac}{dac}{({\sl width,height,nIn,nN,nOut,nS})}
+ {cct}
+ {DAC with defined width, height, and number of inputs {\tt In$i$},
+ top terminals {\tt N$i$}, ouputs {\tt Out$i$},
+ and bottom terminals~{\tt S$i$} \seesect{Logicgates:}}
+\macrodef{darc}{darc}{({\sl center position},
+ {\sl radius}, {\sl start radians}, {\sl end radians}, {\sl dline thickness},
+ {\sl arrowhead wid}, {\sl arrowhead ht},
+ {\sl terminals})}
+ {darrow}
+ {See also {\tt Darc}.
+ CCW arc in {\tt dline} style, with closed ends or (dpic only) arrowheads.
+ Permissible {\sl terminals}:
+ {\sl x}{\tt -},
+ {\tt -}{\sl x}, {\sl x}{\tt -}{\sl x}, {\tt ->}, {\sl x}{\tt ->},
+ {\tt <-}, {\tt <-}{\sl x}, {\tt <->}
+ where {\sl x} means {\tt |} or (half-thickness line) {\tt !}.}
+\macrodef{Darc}{Darc}{({\sl center position},
+ {\sl radius}, {\sl start radians}, {\sl end radians},
+ {\sl parameters})}
+ {darrow}
+ {Wrapper for {\tt darc}.
+ CCW arc in {\tt dline} style, with closed ends or (dpic only) arrowheads.
+ Semicolon-separated {\sl parameters}:
+ {\tt thick=}{\sl value}, {\tt wid=}{\sl value}, {\tt ends=}
+ {\sl x}{\tt -},
+ {\tt -}{\sl x}, {\sl x}{\tt -}{\sl x}, {\tt ->}, {\sl x}{\tt ->},
+ {\tt <-}, {\tt <-}{\sl x}, {\tt <->}
+ where {\sl x} means {\tt |} or (half-thickness line) {\tt !}.}
+\macrodef{Darlington}{Darlington}{(L|R,{\sl chars})}
+ {cct}
+ {Composite Darlington pair Q1 and Q2 with internal locations E, B, C;
+ Characters in {\sl 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
+ \seesect{Semiconductors:}}
+\macrodef{darrow\_init}{darrow_init}{}
+ {darrow}
+ {initialize darrow drawing parameters (reads {\tt darrow.m4})}
+\macrodef{Darrow}{Darrow}{(\linespec, {\sl parameters})}
+ {darrow}
+ {Wrapper for {\tt darrow}.
+ Semicolon-separated {\sl parameters}:
+ {\tt S}, {\tt E} truncate at start or end by dline thickness/2;
+ {\tt thick=}{\sl val} (total thicknes, ie width);
+ {\tt wid=}{\sl val} (arrowhead width);
+ {\tt ht=}{\sl val} (arrowhead height);
+ {\tt ends=}
+ {\sl x}{\tt -}{\sl x} or
+ {\tt -}{\sl x} or
+ {\sl x}{\tt -} where {\sl x} is {\tt !} (half-width line)
+ or {\tt |} (full-width line).}
+\macrodef{darrow}{darrow}{(\linespec,
+ t,t,{\sl width},{\sl arrowhd wd},{\sl arrowhd ht},{\sl parameters})}
+ {darrow}
+ {See also {\tt Darrow}.
+ double arrow, truncated at beginning or end, specified sizes,
+ with arrowhead or closed stem.
+ {\sl parameters=}
+ {\tt {\sl x}-} or {\tt ->} or {\tt {\sl x}->} or {\tt <-} or {\tt <-{\sl x}}
+ or {\tt <->} where {\sl x} is {\tt |} or {\tt !}.
+ The {\tt !-} or {\tt -!} parameters close
+ the stem with half-thickness lines to simplify butting to other objects. }
+\macrodef{dashline}{dashline}{(\linespec,{\sl thickness}|{\sl color}|<->,
+ {\sl dash len, gap len},G)}
+ {gen}
+ {dashed line with dash at end ({\tt G} ends with gap)}
+\macrodef{dbelow}{dbelow}{(at {\sl location})}
+ {darrow}
+ {below (displaced dlinewid/2)}
+\macrodef{dcosine3D}{dcosine3D}{({\sl i,x,y,z})}
+ {3D}
+ {extract i-th entry of triple x,y,z}
+\macrodef{delay\_rad\_}{delay_rad_}{}
+ {cct}
+ {delay radius}
+\macrodef{delay}{delay}{(\linespec,{\sl size})}
+ {cct}
+ {delay element\seesect{Twoterminal:}}
+\macrodef{deleminit\_}{deleminit_}{}
+ {darrow}
+ {sets drawing direction for dlines}
+\macrodef{Demux}{Demux}{({\sl n},{\sl label},
+ {\tt [L][B|H|X][N[{\sl n}]|S[{\sl n}]][[N]OE],
+ {\sl wid},{\sl ht}})}
+ {log}
+ {binary multiplexer, $n$ inputs,
+ {\tt L} reverses input pin numbers,
+ {\tt B} displays binary pin numbers,
+ {\tt H} displays hexadecimal pin numbers,
+ {\tt X} do not print pin numbers,
+ {\tt N[{\sl n}]} puts Sel or Sel$0$ .. Sel$n$ at the top
+ (i.e., to the left of the drawing direction),
+ {\tt S[{\sl n}]} puts the Sel inputs at the bottom (default)
+ {\tt OE} ({\tt N=}negated) {\tt OE} pin
+ \seesect{Logicgates:}}
+\macrodef{dend}{dend}{(at {\sl location})}
+ {darrow}
+ {close (or start) double line}
+\macrodef{dfillcolor}{dfillcolor}{}
+ {darrow}
+ {dline fill color (default white)}
+\macrodef{diff\_}{diff_}{({\sl a},{\sl b})}
+ {gen}
+ {difference function}
+\macrodef{diff3D}{diff3D}{({\sl x1,y1,z1,x2,y2,z2})}
+ {3D}
+ {difference of two triples}
+\macrodef{dimen\_}{dimen_}{}
+ {cct}
+ {size parameter for circuit elements \seesect{Circuitscaling:}}
+\macrodef{dimension\_}{dimension_}{(\linespec,{\sl offset},{\sl label},
+ D|H|W|{\sl blank width},{\sl tic offset},{\sl arrowhead })}
+ {gen}
+ {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,%
+[R][E])}
+ {cct}
+ {diode:
+ {\tt B}=bi-directional,
+ {\tt CR}=current regulator,
+ {\tt D}=diac,
+ {\tt G}=Gunn,
+ {\tt L}=open form with centre line,
+ {\tt LE[R]}=LED [right],
+ {\tt P[R]}=photodiode [right],
+ {\tt S}=Schottky,
+ {\tt Sh}=Shockley,
+ {\tt T}=tunnel,
+ {\tt V}=varicap,
+ {\tt v}=varicap (curved plate),
+ {\tt w}=varicap (reversed polarity),
+ {\tt Z}=zener;
+ appending {\tt K} to arg 2 draws open arrowheads;
+ arg 3: {\tt R}=reversed polarity, {\tt E}=enclosure \seesect{Twoterminal:}}
+\macrodef{dir\_}{dir_}{}
+ {darrow}
+ {used for temporary storage of direction by darrow macros}
+\macrodef{distance}{distance_}{({\sl Position 1}, {\sl Position2})}
+ {gen}
+ {distance between named positions}
+\macrodef{distance}{distance}{({\sl position}, {\sl position})}
+ {gen}
+ {distance between positions}
+\macrodef{dlabel}{dlabel}{({\sl long},{\sl lat},{\sl label},{\sl
+ label},{\sl label},{\sl chars})}
+ {cct}
+ {general triple label; {\sl chars:}
+ X displacement is from the centre of the last
+ line rather than the centre of the last {\tt [ ]};
+ L,R,A,B align labels ljust, rjust, above,
+ or below (absolute) respectively \seesect{Labels:}}
+\macrodef{dleft}{dleft}{}
+ {darrow}
+ {double line left turn}
+\macrodef{Dline}{Dline}{(\linespec, {\sl parameters})}
+ {darrow}
+ {Wrapper for {\tt dline}.
+ Semicolon-separated {\sl parameters}:
+ {\tt S}, {\tt E} truncate at start or end by dline thickness/2;
+ {\tt thick=}{\sl val} (total thicknes, ie width);
+ {\tt ends=}
+ {\sl x}{\tt -}{\sl x} or
+ {\tt -}{\sl x} or
+ {\sl x}{\tt -} where {\sl x} is {\tt !} (half-width line)
+ or {\tt |} (full-width line).}
+\macrodef{dline}{dline}{(\linespec,t,t,{\sl width},{\sl parameters})}
+ {darrow}
+ {See also {\tt Dline}.
+ Double line, truncated by half width at either end, closed
+ at either or both ends.
+ {\sl parameters=}
+ {\sl x}{\tt -}{\sl x} or
+ {\tt -}{\sl x} or
+ {\sl x}{\tt -} where {\sl x} is {\tt !} (half-width line)
+ or {\tt |} (full-width line).}
+\macrodef{dlinewid}{dlinewid}{}
+ {darrow}
+ {width of double lines}
+\macrodef{dljust}{dljust}{(at {\sl location})}
+ {darrow}
+ {ljust (displaced dlinewid/2)}
+\macrodef{dn\_}{dnx}{}
+ {gen}
+ {down with respect to current direction}
+\macrodef{dna\_}{dna_}{}
+ {cct}
+ {internal character sequence that specifies which subcomponents are drawn}
+%\macrodef{dnm\_}{dnm_}{}
+% {cct}
+% {similar to dna\_}
+\macrodef{dot}{dot}{(at {\sl location},{\sl radius},{\sl fill})}
+ {gen}
+ {filled circle (third arg= gray value: 0=black, 1=white)}
+\macrodef{dot3D}{dot3D}{({\sl x1,y1,z1,x2,y2,z2})}
+ {3D}
+ {dot product of two triples}
+\macrodef{dotrad\_}{dotrad_}{}
+ {gen}
+ {dot radius}
+\macrodef{down\_}{down_}{}
+ {gen}
+ {sets current direction to down \seesect{Placing:}}
+\macrodef{dright}{dright}{}
+ {darrow}
+ {double arrow right turn}
+\macrodef{drjust}{drjust}{(at {\sl location})}
+ {darrow}
+ {rjust (displaced dlinewid/2)}
+\macrodef{dswitch}{dswitch}{(\linespec,L|R,W[ud]B[K]{\sl chars})}
+ {cct}
+ {SPST switch left or right, W=baseline, B=contact blade,
+ dB=contact blade to the right of drawing direction,
+ K=vertical closing contact line,
+ 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,
+ 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,
+ T = thermal control linkage,
+ Y = pull switch,
+ Z = turn switch
+ \seesect{Twoterminal:}}
+\macrodef{dtee}{dtee}{([L|R])}
+ {darrow}
+ {double arrow tee junction with tail to left,
+ right, or (default) back along current direction }
+\macrodef{dtor\_}{dtor_}{}
+ {gen}
+ {degrees to radians conversion constant}
+\macrodef{dturn}{dturn}{({\sl degrees ccw})}
+ {darrow}
+ {turn dline arg1 degrees left (ccw)}
+\macrodef{E\_\_}{E__}{}
+ {gen}
+ {the constant $e$}
+\macrodef{e\_}{e_}{}
+ {gen}
+ {.e relative to current direction}
+\macrodef{e\_fet}{e_fet}{(\linespec,L|R,P,S,E|S)}
+ {cct}
+ {left or right, N or P enhancement MOSFET, normal
+ or simplified, without or with envelope or thick channel
+ \seesect{Semiconductors:}}
+\macrodef{earphone}{earphone}{( U|D|L|R|{\sl degrees, size})}
+ {cct}
+ {earphone, {\sl In1} to {\sl In3} defined
+ \seesect{Composite:}}
+\macrodef{ebox}{ebox}{(\linespec,{\sl length},{\sl ht},{\sl fill value})}
+ {cct}
+ { two-terminal box element with adjustable dimensions and fill
+ value 0 (black) to 1 (white). {\sl length} and {\sl ht} are relative
+ to the direction of \linespec\seesect{Twoterminal:}}
+\macrodef{elchop}{elchop}{({\sl Name1,Name2})}
+ {gen}
+ {{\tt chop} for ellipses: evaluates to {\tt 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., {\tt line from A to E elchop(E,A)}}
+\macrodef{eleminit\_}{eleminit_}{(\linespec)}
+ {cct}
+ {internal line initialization}
+\macrodef{elen\_}{elen_}{}
+ {cct}
+ {default element length}
+\macrodef{em\_arrows}{em_arrows}{([N|I|E][D],{\sl angle,length})}
+ {cct}
+ {radiation arrows, N=nonionizing, I=ionizing, E=simple;
+ D=dot\seesect{Twoterminal:}}
+\macrodef{endshade}{endshade}{}
+ {gen}
+ {end gray shading, see {\tt beginshade}}
+\macrodef{Equidist3}{Equidist3}{({\sl Pos1, Pos2, Pos3, Result})}
+ {gen}
+ {Calculates location named {\sl Result} equidistant from the first three
+ positions, i.e.\ the centre of the circle passing through the three
+ positions}
+\macrodef{expe}{expe}{}
+ {gen}
+ {exponential, base $e$}
+\macrodef{f\_box}{f_box}{({\sl boxspecs},{\sl text},{\sl expr1},$\cdots$)}
+ {gen}
+ {like {\tt 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
+ \seesect{Interaction:}}
+\macrodef{Fector}{Fector}{({\sl 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 }
+\macrodef{FF\_ht}{FF_ht}{}
+ {cct}
+ {flipflop height parameter in {\tt L\_unit}s}
+\macrodef{FF\_wid}{FF_wid}{}
+ {cct}
+ {flipflop width parameter in {\tt L\_unit}s}
+\macrodef{fill\_}{fill_}{({\sl number})}
+ {gen}
+ {fill macro, 0=black, 1=white\seesect{Semiconductors:}}
+\macrodef{fitcurve}{fitcurve}{(V,n,[e.g. dotted],m (default 0))}
+ {gen}
+ {Draw a spline through positions V[m], $ldots$ V[n]: Works only with dpic.}
+\macrodef{FlipFlop}{FlipFlop}{(D|T|RS|JK,{\sl label},{\sl boxspec})}
+ {log}
+ {flip-flops,
+ {\sl boxspec}=e.g.\ ht x wid y \seesect{Logicgates:}}
+\macrodef{FlipFlop6}{FlipFlop6}{({\sl label},{\sl spec},{\sl boxspec})}
+ {log}
+ {{\em This macro (6-input flip-flops)
+ has been superseded by {\tt FlipFlopX} and may be deleted
+ in future}.
+ {\sl spec}={\tt [[n]NQ][[n]Q][[n]CK][[n]PR][lb]}
+ {\tt [[n]CLR][[n]S][[n].|D|T|R]} to include and negate pins,
+ {\tt lb} to print labels }
+\macrodef{FlipFlopJK}{FlipFlopJK}{({\sl label}, {\sl spec},{\sl boxspec})}
+ {log}
+ {{\em This macro (JK flip-flop)
+ has been superseded by {\tt FlipFlopX} and may be deleted
+ in future}.
+ Similar to {\tt FlipFlop6}.}
+\macrodef{FlipFlopX}{FlipFlopX}{({\sl boxspec, label, leftpins, toppins,
+ rightpins, bottompins})}
+ {log}
+ {General flipflop. Each of args 3 to 6 is null or a string of {\sl pinspecs}
+ separated by semicolons ({\tt;}). {\sl Pinspecs} are either empty
+ or of the form
+ {\tt[}{\sl pinopts}{\tt]:[}{\sl label}{\tt[:}{\sl Picname}{\tt]]}.
+ The first colon draws the pin.
+ Pins are placed top to bottom or left to right along the box edges with
+ null {\sl pinspecs} counted for placement. Pins are named by side and number
+ by default; eg {\tt W1, W2, ..., N1, N2, ..., E1, ..., S1, ...} ; however,
+ if {\tt:}{\sl Picname} is present in a {\sl pinspec} then {\sl Picname}
+ replaces the default name.
+ A {\sl pinspec} label is text placed at the pin base. Semicolons are
+ not allowed in labels; use, e.g., {\tt \char92{}char59\char123\char125}
+ instead,
+ and to put a bar over a label, use {\tt lg\_bartxt(}{\sl label}{\tt)}.
+ The {\sl pinopts} are {\tt[N|L|M][E]};
+ {\tt N}=pin with not circle;
+ {\tt L}=active low out; {\tt M}=active low in;
+ {\tt E}=edge trigger \seesect{Logicgates:}}
+\macrodef{for\_}{for_}{({\sl start},{\sl end},{\sl increment},`{\sl actions}')}
+ {gen}
+ {integer for loop with index variable {\tt m4x} \seesect{Looping:}}
+\macrodef{FTcap}{FTcap}{({\sl chars})}
+ {cct}
+ {Feed-through capacitor; example of a composite element derived from
+ a two-terminal element. Defined points: {\sl .Start, .End, .C .T1 .T2 T}
+ Arg 1: (default) {\tt A}= type A, {\tt B}= type B, {\tt C}= type C
+ \seesect{Composite:}}
+\macrodef{fuse}{fuse}{({\sl linespec, type, wid, ht})}
+ {cct}
+ {fuse symbol, type$=$
+ {\tt A|B|C|D|S|HB|HC} or {\tt dA=D}\seesect{Twoterminal:}}
+\macrodef{g\_}{g_}{}
+ {gen}
+ {green color value}
+\macrodef{G\_hht}{G_hht}{}
+ {log}
+ {gate half-height in {\tt L\_unit}s}
+\macrodef{gap}{gap}{(\linespec,{\sl fill},A)}
+ {cct}
+ {gap with (filled) dots, A=chopped arrow between dots\seesect{Twoterminal:}}
+\macrodef{gen\_init}{gen_init}{}
+ {gen}
+ {initialize environment for general diagrams
+ (customizable, reads {\tt libgen.m4})}
+\macrodef{glabel\_}{glabel_}{}
+ {cct}
+ {internal general labeller}
+%\macrodef{gpar\_}{gpar_}{({\sl element},{\sl element},{\sl separation})}
+% {cct}
+% {two same-direction elements in parallel}
+\macrodef{gpolyline\_}{gpolyline_}{({\sl fraction},{\sl location}, ...)}
+ {gen}
+ {internal to {\tt gshade}}
+\macrodef{graystring}{graystring}{({\sl gray value})}
+ {gen}
+ {evaluates to a string compatible with the postprocessor in use
+ to go with {\tt colored}, {\tt shaded}, or {\tt outlined} attributes.
+ (PSTricks, metapost, pgf-tikz, pdf, postscript, svg).
+ The argument is a fraction in the range $[0,1]$; see {\tt rgbstring}}
+\macrodef{grid\_}{grid_}{({\sl x},{\sl y})}
+ {log}
+ {absolute grid location}
+\macrodef{ground}{ground}{(at {\sl location}, T, N|F|S|L|P|E, U|D|L|R|{\sl
+ degrees})}
+ {cct}
+ { ground, without stem for nonblank 2nd arg;
+ {\tt N}=normal, {\tt F}=frame, {\tt S}=signal, {\tt L}=low-noise,
+ {\tt P}=protective, {\tt E}=European; up, down, left, right, or angle
+ from horizontal (default -90)
+ \seesect{Composite:}}
+\macrodef{gshade}{gshade}{({\sl gray value},A,B,...,Z,A,B)}
+ {gen}
+ {(Note last two arguments). Shade a polygon with named
+ vertices, attempting to avoid sharp corners}
+\macrodef{gyrator}{gyrator}{({\sl box specs,space ratio,pin lgth,}[N][V])}
+ {cct}
+ {Gyrator two-port wrapper for {\tt nport}, {\tt N} omits pin dots; {\tt V}
+ gives a vertical orientation
+ \seesect{Composite:}}
+\macrodef{H\_ht}{H_ht}{}
+ {log}
+ {hysteresis symbol dimension in {\tt L\_unit}s}
+\macrodef{Header}{Header}{(1|2,{\sl rows,wid,ht,type})}
+ {log}
+ {Header block with 1 or 2 columns and square Pin 1
+ \seesect{Composite:}}
+\macrodef{HeaderPin}{HeaderPin}{({\sl location, type, Picname},%
+n|e|s|w,{\sl length})}
+ {log}
+ {General pin for {\tt Header} macro; arg 4 specifies pin direction
+ with respect to the current drawing direction)}
+\macrodef{hatchbox}{hatchbox}{({\sl boxspec,hashsep,hatchspec})}
+ {gen}
+ {Manhattan box with 45 degree hatching, e.g.,
+ {\tt hatchbox(outlined "blue",,dashed outlined "green" thick 0.4)}}
+\macrodef{heater}{heater}{({\sl linespec, ndivisions, wid, ht})}
+ {cct}
+ {heater element\seesect{Twoterminal:}}
+\macrodef{hex\_digit}{hex_digit}{($n$)}
+ {gen}
+ {hexadecimal digit for $0 \leq n < 16$}
+\macrodef{hexadecimal\_}{hexadecimal_}{($n$, [$m$])}
+ {gen}
+ {hexadecimal representation of $n,$ left padded to $m$ digits if the second
+ argument is nonblank}
+\macrodef{hlth}{hlth}{}
+ {gen}
+ {current line half thickness in drawing units}
+\macrodef{hoprad\_}{hoprad_}{}
+ {cct}
+ {hop radius in crossover macro}
+\macrodef{ht\_}{ht_}{}
+ {gen}
+ {height relative to current direction}
+\macrodef{ifdpic}{ifdpic}{({\sl if true},{\sl if false})}
+ {gen}
+ {test if dpic has been specified as pic processor}
+\macrodef{ifgpic}{ifgpic}{({\sl if true},{\sl if false})}
+ {gen}
+ {test if gpic has been specified as pic processor}
+\macrodef{ifinstr}{ifinstr}{({\sl string},{\sl string},{\sl if true},{\sl
+ if false})}
+ {gen}
+ {test if the second argument is a substring of the first; also
+ {\tt ifinstr({\sl string},{\sl string},{\sl if true},{\sl
+ string},{\sl string},{\sl if true}, $\ldots$ {\sl if false})}
+ }
+\macrodef{ifmfpic}{ifmfpic}{({\sl if true},{\sl if false})}
+ {gen}
+ {test if mfpic has been specified as pic post-processor}
+\macrodef{ifmpost}{ifmpost}{({\sl if true},{\sl if false})}
+ {gen}
+ {test if MetaPost has been specified as pic post-processor}
+\macrodef{ifpgf}{ifpgf}{({\sl if true},{\sl if false})}
+ {gen}
+ {test if \TPGF~has been specified as pic post-processor}
+\macrodef{ifpostscript}{ifpostscript}{({\sl if true},{\sl if false})}
+ {gen}
+ {test if Postscript ({\tt dpic -r}) has been specified as pic output format}
+\macrodef{ifpsfrag}{ifpsfrag}{({\sl if true},{\sl if false})}
+ {gen}
+ {Test if either {\tt psfrag} or {\tt 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}
+\macrodef{ifpstricks}{ifpstricks}{({\sl if true},{\sl if false})}
+ {gen}
+ {test if \PSTricks~has been specified as post-processor}
+\macrodef{ifroff}{ifroff}{({\sl if true},{\sl if false})}
+ {gen}
+ {test if {\bf troff} or {\bf groff} has been specified as post-processor}
+\macrodef{ifxfig}{ifxfig}{({\sl if true},{\sl if false})}
+ {gen}
+ {test if Fig 3.2 ({\tt dpic -x}) has been specified as pic output format}
+\macrodef{igbt}{igbt}{(\linespec,L|R,[L][[d]D])}
+ {cct}
+ {left or right IGBT, L=alternate gate type, D=parallel diode,
+ dD=dotted connections }
+\macrodef{in\_\_}{in__}{}
+ {gen}
+ {absolute inches}
+\macrodef{inductor}{inductor}{(\linespec,W|L,{\sl n},[M|P],{\sl loop wid})}
+ {cct}
+ {inductor, arg2: narrow (default), W=wide, L=looped;
+ arg3: {\sl n} arcs (default 4);
+ arg4: M=magnetic core, P=powder (dashed) core,
+ arg5: loop width (default L,W: {\tt dimen\_}/5; other: {\tt dimen\_}/8)
+ \seesect{Twoterminal:}}
+\macrodef{inner\_prod}{inner_prod}{({\sl linear obj},{\sl linear obj})}
+ {gen}
+ {inner product of (x,y) dimensions of two linear objects}
+\macrodef{Int\_}{Int_}{}
+ {gen}
+ {corrected (old) gpic $int()$ function}
+\macrodef{integrator}{integrator}{(\linespec,{\sl size})}
+ {cct}
+ {integrating amplifier\seesect{Twoterminal:}}
+\macrodef{intersect\_}{intersect_}{({\sl line1}.start,{\sl line1}.end,
+{\sl line2}.start,{\sl line2}.end)}
+ {gen}
+ {intersection of two lines}
+\macrodef{Intersect\_}{Intersect_}{({\sl Name1},{\sl Name2})}
+ {gen}
+ {intersection of two named lines}
+\macrodef{IOdefs}{IOdefs}{(\linespec,{\sl label},[P|N]*,L|R) }
+ {log}
+ {Define locations {\sl label}{\tt 1}, $\ldots$ {\sl label}{\tt n}
+ along the line; {\tt P}= label only;
+ {\tt N}=with {\tt NOT\_circle};
+ {\tt R}=circle to right of current direction }
+\macrodef{j\_fet}{j_fet}{(\linespec,L|R,P,E)}
+ {cct}
+ {left or right, N or P JFET, without or with envelope
+ \seesect{Semiconductors:}}
+\macrodef{jack}{jack}{(U|D|L|R|{\sl degrees},{\sl chars})}
+ {cct}
+ {arg1: drawing direction; string arg2: {\tt R}=right orientation,
+ one or more {\tt L[M][B]} for L and auxiliary contacts with make or break
+ points; {\tt S[M][B]} for S and auxiliary contacts
+ \seesect{Composite:}}
+\macrodef{KelvinR}{KelvinR}{({\sl cycles},[R],{\sl cycle wid})}
+ {cct}
+ {IEEE resistor in a {\tt [ ]} block with Kelvin taps {\sl T1} and {\sl T2}
+ \seesect{Composite:}}
+\macrodef{L\_unit}{L_unit}{}
+ {log}
+ {logic-element grid size}
+\macrodef{lamp}{lamp}{(\linespec, [R])}
+ {cct}
+ {Two-terminal incandescent lamp
+ \seesect{Twoterminal:}}
+\macrodef{larrow}{larrow}{({\sl label},{\tt ->|<-},{\sl dist})}
+ {cct}
+ {arrow {\sl dist} to left of last-drawn 2-terminal element
+ \seesect{Branchcurrent:}}
+\macrodef{lbox}{lbox}{({\sl wid}, {\sl ht}, {\sl type})}
+ {gen}
+ {box oriented in current direction, type= e.g.\ dotted}
+\macrodef{LCintersect}{LCintersect}{({\sl line name, Centre, rad,} [R])}
+ {gen}
+ { First (second if arg4 is R) intersection of a line with a circle}
+\macrodef{LCtangent}{LCtangent}{({\sl Pos1, Centre, rad,} [R])}
+ {gen}
+ { Left (right if arg4=R) tangent point of line
+ from Pos1 to circle at Centre with radius arg3}
+\macrodef{left\_}{left_}{}
+ {gen}
+ {left with respect to current direction \seesect{Placing:}}
+\macrodef{length3D}{length3D}{(x,y,z)}
+ {3D}
+ {Euclidean length of triple x,y,z}
+\macrodef{LEintersect}{LEintersect}{({\sl line name, Centre, ellipse wid,
+ ellipse ht}, [R])}
+ {gen}
+ { First (second if arg5 is R) intersection of a line with an ellipse}
+\macrodef{LEtangent}{LEtangent}{({\sl 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}
+\macrodef{lg\_bartxt}{lg_bartxt}{}
+ {log}
+ {draws an overline over logic-pin text (except for xfig)}
+\macrodef{lg\_pin}{lg_pin}{({\sl location, logical name, pin label},
+ n|e|s|w[L|M|I|O][N][E], {\sl pinno, optlen})}
+ {log}
+ {comprehensive logic pin; {\tt n|e|s|w}=direction,
+ {\tt L}=active low out, {\tt M}=active low in,
+ {\tt I}=inward arrow, {\tt O}=outward arrow,
+ {\tt N}=negated, {\tt E}=edge trigger}
+\macrodef{lg\_pintxt}{lg_pintxt}{}
+ {log}
+ {reduced-size text for logic pins}
+\macrodef{lg\_plen}{lg_plen}{}
+ {log}
+ {logic pin length in in {\tt L\_unit}s}
+\macrodef{LH\_symbol}{LH_symbol}{([U|D|L|R|{\sl degrees}][I])}
+ {log}
+ {logic-gate hysteresis symbol; {\tt I=}inverted}
+\macrodef{lin\_ang}{lin_ang}{({\sl line-reference})}
+ {gen}
+ {the angle from {\tt .start} to {\tt .end} of a line or move}
+\macrodef{lin\_leng}{lin_leng}{({\sl line-reference})}
+ {gen}
+ {length of a line, equivalent to {\sl line-reference}{\tt .len}
+ with dpic}
+\macrodef{linethick\_}{linethick_}{({\sl number})}
+ {gen}
+ {set line thickness in points}
+\macrodef{ljust\_}{ljust_}{}
+ {gen}
+ {ljust with respect to current direction}
+\macrodef{llabel}{llabel}{({\sl label},{\sl label},{\sl label})}
+ {cct}
+ {triple label on left side of the element \seesect{Labels:}}
+\macrodef{loc\_}{loc_}{({\sl x}, {\sl y})}
+ {gen}
+ {location adjusted for current direction}
+\macrodef{log\_init}{log_init}{}
+ {log}
+ {initialize environment for logic diagrams
+ (customizable, reads {\tt liblog.m4})}
+\macrodef{log10E\_}{log10E_}{}
+ {gen}
+ {constant $\log_{10}(e)$}
+\macrodef{loge}{loge}{}
+ {gen}
+ {logarithm, base $e$}
+\macrodef{Loopover\_}{Loopover_}{(`{\sl variable}',{\sl actions},{\sl value1,
+ value2, $\ldots$})}
+ {gen}
+ {Repeat {\sl actions} with {\sl variable} set successively to
+ {\sl value1, value2, $\ldots$}, setting macro {\tt m4Lx} to 1, 2, $\ldots$}
+\macrodef{lp\_xy}{lp_xy}{}
+ {log}
+ {coordinates used by {\tt lg\_pin}}
+\macrodef{lpop}{lpop}{({\sl xcoord}, {\sl ycoord}, {\sl radius}, {\sl fill},
+ {\sl zero ht})}
+ {gen}
+ {for lollipop graphs: filled circle with stem to (xcoord,zeroht)}
+\macrodef{lswitch}{lswitch}{( \linespec, L|R, {\sl chars} )}
+ {cct}
+ {knife switch R=right orientation (default L=left);
+ {\sl chars}=[O{\tt|}C][D][K][A] O=opening arrow; C=closing arrow; D=dots;
+ K=closed switch; A=blade arrowhead \seesect{Twoterminal:}}
+\macrodef{lt\_}{lt_}{}
+ {gen}
+ {left with respect to current direction}
+\macrodef{LT\_symbol}{LT_symbol}{(U|D|L|R|{\sl degrees})}
+ {log}
+ {logic-gate triangle symbol}
+\macrodef{lthick}{lthick}{}
+ {gen}
+ {current line thickness in drawing units}
+\macrodef{m4\_arrow}{m4_arrow}{(\linespec,{\sl ht},{\sl wid})}
+ {gen}
+ {arrow with adjustable head, filled when possible}
+\macrodef{m4dupstr}{m4dupstr}{({\sl string},{\sl n},`{\sl name}')}
+ {gen}
+ {Defines {\sl name} as {\sl n} concatenated copies of {\sl string}.}
+\macrodef{m4lstring}{m4lstring}{({\sl arg1},{\sl arg2})}
+ {gen}
+ {expand {\sl arg1} if it begins
+ with {\tt sprintf} or {\tt "}, otherwise {\sl arg2}}
+\macrodef{m4xpand}{m4xpand}{({\sl arg})}
+ {gen}
+ {Evaluate the argument as a macro}
+\macrodef{m4xtract}{m4xtract}{(`{\sl string1}',{\sl string2})}
+ {gen}
+ {delete {\sl string2} from {\sl string1}, return 1 if present}
+\macrodef{manhattan}{manhattan}{}
+ {gen}
+ {sets direction cosines for left, right, up, down}
+\macrodef{Max}{Max}{({\sl arg, arg, $\ldots$})}
+ {gen}
+ {Max of an arbitrary number of inputs}
+\macrodef{memristor}{memristor}{({\sl linespec, wid, ht})}
+ {cct}
+ {memristor element\seesect{Twoterminal:}}
+\macrodef{microphone}{microphone}{( U|D|L|R|{\sl degrees, size})}
+ {cct}
+ {microphone, {\sl In1} to {\sl In3} defined
+ \seesect{Composite:}}
+\macrodef{Min}{Min}{({\sl arg, arg, $\ldots$})}
+ {gen}
+ {Min of an arbitrary number of inputs}
+\macrodef{Mitre\_}{Mitre_}{%
+ ({\sl Line1,Line2,length,line attributes})}
+ {gen}
+ {e.g., {\tt Mitre\_(L,M)} draws angle at intersection of lines
+ L and M with legs of length arg3 (default {\tt linethick bp\_\_/2});
+ sets {\tt Here} to intersection
+ \seesect{Corners:}}
+\macrodef{mitre\_}{mitre_}{%
+ ({\sl Position1,Position2,Position3,length,line attributes})}
+ {gen}
+ {e.g., {\tt mitre\_(A,B,C)} draws angle ABC with legs
+ of length arg4 (default {\tt linethick bp\_\_/2});
+ sets {\tt Here} to Position2
+ \seesect{Corners:}}
+\macrodef{mm\_\_}{mm__}{}
+ {gen}
+ {absolute millimetres}
+\macrodef{mosfet}{mosfet}{(\linespec,L|R,{\sl chars},E)}
+ {cct}
+ {MOSFET left or right, included components defined by characters, envelope.
+ arg 3 chars:
+ {\tt [u][d]B:} center bulk connection pin;
+ {\tt D:} D pin and lead;
+ {\tt E:} dashed substrate;
+ {\tt F:} solid-line substrate;
+ {\tt [u][d]G:} G pin to substrate at source;
+ {\tt [u][d]H:} G pin to substrate at center;
+ {\tt L:} G pin to channel (obsolete);
+ {\tt [u][d]M:} G pin to channel; u: at drain end; d: at source end
+ {\tt [u][d]M{\sl n}:} multiple gates G0 to G{\sl n}
+ {\tt Pz:} parallel zener diode;
+ {\tt Q:} connect B pin to S pin;
+ {\tt R:} thick channel;
+ {\tt [u][d]S:} S pin and lead u: arrow up; d: arrow down;
+ {\tt [d]T:} G pin to center of channel d: not circle;
+ {\tt X:} XMOSFET terminal;
+ {\tt Z:} simplified complementary MOS
+ \seesect{Semiconductors:}}
+\macrodef{Mux\_ht}{Mux_ht}{}
+ {cct}
+ {Mux height parameter in {\tt L\_unit}s}
+\macrodef{Mux\_wid}{Mux_wid}{}
+ {cct}
+ {Mux width parameter in {\tt L\_unit}s}
+\macrodef{Mux}{Mux}{({\sl n},{\sl label},
+ {\tt [L][B|H|X][N[{\sl n}]|S[{\sl n}]][[N]OE],
+ {\sl wid},{\sl ht}})}
+ {log}
+ {binary multiplexer, $n$ inputs,
+ {\tt L} reverses input pin numbers,
+ {\tt B} display binary pin numbers,
+ {\tt H} display hexadecimal pin numbers,
+ {\tt X} do not print pin numbers,
+ {\tt N[{\sl n}]} puts Sel or Sel$0$ .. Sel$n$ at the top
+ (i.e., to the left of the drawing direction),
+ {\tt S[{\sl n}]} puts the Sel inputs at the bottom (default)
+ {\tt OE} ({\tt N=}negated) {\tt OE} pin
+ \seesect{Logicgates:}}
+\macrodef{Mx\_pins}{Mx_pins}{}
+ {log}
+ {max number of gate inputs without wings}
+\macrodef{n\_}{n_}{}
+ {gen}
+ {.n with respect to current direction}
+\macrodef{N\_diam}{N_diam}{}
+ {log}
+ {diameter of `not' circles in {\tt L\_unit}s}
+\macrodef{N\_rad}{N_rad}{}
+ {log}
+ {radius of `not' circles in {\tt L\_unit}s}
+\macrodef{NAND\_gate}{NAND_gate}{({\sl n},N)}
+ {log}
+ {`nand' gate, 2 or {\sl n\/} inputs; N=negated input.
+ Otherwise, arg1 can be a sequence of letters {\tt P|N}
+ to define normal or negated inputs.
+ \seesect{Logicgates:}}
+\macrodef{ne\_}{ne_}{}
+ {gen}
+ {.ne with respect to current direction}
+\macrodef{NeedDpicTools}{NeedDpicTools}{}
+ {gen}
+ {executes {\tt copy "HOMELIB\_/dpictools.pic"} if the file has not been read}
+\macrodef{neg\_}{neg_}{}
+ {gen}
+ {unary negation}
+\macrodef{NOR\_gate}{NOR_gate}{({\sl n},N)}
+ {log}
+ {`nor' gate, 2 or {\sl n\/} inputs; N=negated input.
+ Otherwise, arg1 can be a sequence of letters {\tt P|N}
+ to define normal or negated inputs.
+ \seesect{Logicgates:}}
+\macrodef{norator}{norator}{(\linespec,{\sl width},{\sl ht})}
+ {cct}
+ { norator two-terminal element \seesect{Twoterminal:}}
+\macrodef{NOT\_circle}{NOT_circle}{}
+ {log}
+ {`not' circle}
+\macrodef{NOT\_gate}{NOT_gate}{(\linespec,[B][N|n],{\sl wid},{\sl height})}
+ {log}
+ {`not' gate.
+ When {\sl linespec} is blank then the element is composite and In1,
+ Out, C, NE, and SE are defined; otherwise the element is drawn as
+ a two-terminal element. arg2: {\tt B}=box gate, {\tt N}=not circle at input
+ and output, {\tt n}=not circle at input only
+ \seesect{Logicgates:}}
+\macrodef{NOT\_rad}{NOT_rad}{}
+ {log}
+ {`not' radius in absolute units}
+\macrodef{NPDT}{NPDT}{({\sl npoles,}[R])}
+ {cct}
+ {Double-throw switch; {\sl npoles:} number of poles;
+ {\tt R}= right orientation with respect to drawing direction
+ \seesect{Composite:}}
+\macrodef{nport}{nport}{({\sl box spec{\tt ;}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, $\ldots$
+ Arg 6 specifies the ratio of port width to interport space (default 2),
+ and arg 7 is the pin length. Set arg 8 to N to omit the dots on
+ the port pins. Arguments 1 and 9 allow customizations
+ \seesect{Composite:}}
+\macrodef{nterm}{nterm}{({\sl box spec{\tt ;}other commands,
+nw,nn,ne,ns,pin lgth,style, other commands})}
+ {cct}
+ {n-terminal box macro (default three pins).
+ Args 2 to 5 are the number of pins to be drawn on W, N, E, S sides.
+ The pins are named by side and number, e.g. W1, W2, N1, $\ldots$
+ Arg 6 is the pin length. Set arg 7 to N to omit the dots
+ on the pins. Arguments 1 and 8 allow customizations, e.g.
+ {\tt nterm(,{,},{,},{,}N,"\$a\$" at Box.w ljust,"\$b\$" at Box.e rjust,
+ "\$c\$" at Box.s above)} }
+\macrodef{nullator}{nullator}{(\linespec,{\sl width},{\sl ht})}
+ {cct}
+ { nullator two-terminal element \seesect{Twoterminal:}}
+\macrodef{nw\_}{nw_}{}
+ {gen}
+ {.nw with respect to current direction}
+\macrodef{NXOR\_gate}{NXOR_gate}{({\sl n},N)}
+ {log}
+ {`nxor' gate, 2 or {\sl n\/} inputs; N=negated input.
+ Otherwise, arg1 can be a sequence of letters {\tt P|N}
+ to define normal or negated inputs.
+ \seesect{Logicgates:}}
+\macrodef{opamp}{opamp}{(\linespec,{\sl label},{\sl label},{\sl size},{\sl
+ chars}, other commands)}
+ {cct}
+ {operational amplifier with $-,$ $+$ or other internal labels,
+ specified size. {\sl chars:} {\tt P=} add power connections,
+ {\tt R=} swap In1, In2 labels,
+ {\tt T=} truncated point.
+ The first and last arguments allow added customizations
+ \seesect{Composite:}}
+\macrodef{open\_arrow}{open_arrow}{(\linespec,{\sl ht},{\sl wid})}
+ {gen}
+ {arrow with adjustable open head}
+\macrodef{OR\_gate}{OR_gate}{({\sl n},N)}
+ {log}
+ {`or' gate, 2 or {\sl n\/} inputs; N=negated input.
+ Otherwise, arg1 can be a sequence of letters {\tt P|N}
+ to define normal or negated inputs.
+ \seesect{Logicgates:}}
+\macrodef{OR\_gen}{OR_gen}{($n$,{\sl chars},[{\sl wid},[{\sl ht}]])}
+ {log}
+ {general OR gate: $n$=number of inputs $(0\leq n\leq 16)$;
+ {\sl chars:} B=base and straight sides; A=Arcs;
+ [N]NE,[N]SE,[N]I,[N]N,[N]S=inputs or circles;
+ [N]P=XOR arc; [N]O=output; C=center.
+ Otherwise, arg1 can be a sequence of letters {\tt P|N}
+ to define normal or negated inputs.}
+\macrodef{OR\_rad}{OR_rad}{}
+ {log}
+ {radius of OR input face in {\tt L\_unit}s}
+\macrodef{parallel\_}{parallel_}{(\char96{\sl elementspec}\char39,%
+ \char96{\sl elementspec}\char39 $\ldots$)}
+ {cct}
+ { Parallel combination of two-terminal elements in a {\tt [ ]} block.
+ Each argument is a {\em quoted} elementspec of the form
+ {\tt[Sep={\sl val};][{\sl Label}:] {\sl element}; [{\sl attributes}]}
+ where an {\sl attribute} is of the form
+ {\tt[llabel($\ldots$);] | [rlabel($\ldots$);] | [b\_current($\ldots$);]}.
+ An argument may also be {\tt series\_($\ldots$)} or
+ {\tt parallel\_($\ldots$)} {\em without} attributes or quotes.
+ Sep={\sl val}; in the first branch sets the default
+ separation of all branches to {\sl val}; in a later
+ element Sep={\sl val}; applies only to that branch.
+ An element may have normal arguments but should
+ not change the drawing direction.
+ \seesect{Seriesandparallel:}}
+%\macrodef{par\_}{par_}{({\sl element},{\sl element},{\sl separation})}
+% {cct}
+% {two same-direction, same-length elements in parallel}
+\macrodef{pc\_\_}{pc__}{}
+ {gen}
+ {absolute points}
+\macrodef{px\_\_}{px__}{}
+ {gen}
+ {absolute SVG screen pixels}
+\macrodef{pconnex}{pconnex}{(R|L|U|D|{\sl degrees},{\sl chars})}
+ {cct}
+ {power connectors, arg 1: drawing direction; {\sl chars:}
+ {\tt R}=right orientation,
+ {\tt M|F}= male, female,
+ {\tt A|AC}=115V, 3 prong, B=box, C=circle,
+ {\tt P}= PC connector,
+ {\tt D}= 2-pin connector,
+ {\tt G|GC}= GB 3-pin,
+ {\tt J}= 110V 2-pin
+ \seesect{Composite:}}
+\macrodef{pi\_}{pi_}{}
+ {gen}
+ {$\pi$}
+\macrodef{plug}{plug}{(U|D|L|R|{\sl degrees},[2|3][R])}
+ {cct}
+ {arg1: drawing direction; string arg2: {\tt R} right orientation,
+ {\tt 2|3} number of conductors
+ \seesect{Composite:}}
+\macrodef{pmod}{pmod}{({\sl integer}, {\sl integer})}
+ {gen}
+ {+ve $\hbox{mod}(M,N)$ e.g., $\hbox{\tt pmod}(-3,5)=2$}
+\macrodef{point\_}{point_}{({\sl angle})}
+ {gen}
+ {(radians) set direction cosines}
+\macrodef{Point\_}{Point_}{({\sl integer})}
+ {gen}
+ {sets direction cosines in degrees \seesect{Placing:}}
+\macrodef{polar\_}{polar_}{({\sl x},{\sl y})}
+ {gen}
+ {rectangular-to polar conversion}
+\macrodef{potentiometer}{potentiometer}{(\linespec,%
+ {\sl cycles},{\sl fractional pos},{\sl length},$\cdots$)}
+ {cct}
+ {resistor with taps T1, T2, $\ldots$
+ with specified fractional positions and lengths (possibly neg)
+ \seesect{Composite:}}
+\macrodef{print3D}{print3D}{(x,y,z)}
+ {3D}
+ {write out triple for debugging}
+\macrodef{prod\_}{prod_}{({\sl a},{\sl b})}
+ {gen}
+ {binary multiplication}
+\macrodef{project}{project}{({\sl x},({\sl y},({\sl z})}
+ {3D}
+ {3D to 2D projection onto the plane perpendicular to the view vector with
+ angles defined by {\tt setview({\sl azim, elev})}}
+\macrodef{psset\_}{psset_}{({\sl PSTricks settings})}
+ {gen}
+ {set PSTricks parameters}
+\macrodef{pt\_\_}{pt__}{}
+ {gen}
+ {\TeX\ point-size factor, in scaled inches, ({\tt *scale/72.27})}
+\macrodef{ptrans}{ptrans}{(\linespec, [R|L])}
+ {cct}
+ {pass transistor; {\tt L=} left orientation
+ \seesect{Semiconductors:}}
+\macrodef{r\_}{r_}{}
+ {gen}
+ {red color value}
+\macrodef{rarrow}{rarrow}{({\sl label,{\tt ->|<-},{\sl dist}})}
+ {cct}
+ {arrow {\sl dist} to right of last-drawn 2-terminal element
+ \seesect{Branchcurrent:}}
+\macrodef{Rect\_}{Rect_}{({\sl radius},{\sl angle})}
+ {gen}
+ {(deg) polar-to-rectangular conversion}
+\macrodef{rect\_}{rect_}{({\sl radius},{\sl angle})}
+ {gen}
+ {(radians) polar-rectangular conversion}
+\macrodef{reed}{reed}{({\sl linespec, width, height, box attribues}, [R][C])}
+ {cct}
+ {Enclosed reed two-terminal contact;
+ {\tt R}=right orientation; {\tt C}=closed contact;
+ e.g., {\tt reed(,,dimen\_/5,shaded "lightgreen"}
+ \seesect{Composite:}}
+ {cct}
+ {relay: n poles (default 1), {\sl chars:} {\tt O}=normally open,
+ {\tt C}=normally closed, {\tt P}=three position, default double throw,
+ {\tt L}=drawn left (default),
+ {\tt R}=drawn right, {\tt T}=thermal.
+ Argument 3={\tt [L|R]} is deprecated but works for
+ backward compatibility
+ \seesect{Composite:}}
+\macrodef{resetdir\_)}{resetdir_)}{}
+ {gen}
+ {resets direction set by {\tt setdir\_}}
+\macrodef{resetrgb}{resetrgb}{}
+ {gen}
+ {cancel {\tt r\_, g\_, b\_} color definitions}
+\macrodef{resistor}{resistor}{(\linespec,n|E,{\sl chars}, {\sl
+ cycle wid})}
+ {cct}
+ {resistor, n cycles (default 3), {\sl chars:}
+ {\tt E}={\tt ebox},
+ {\tt ES}={\tt ebox} with slash,
+ {\tt Q}=offset,
+ {\tt H}=squared,
+ {\tt N}=IEEE,
+ {\tt V}=varistor variant,
+ {\tt R}=right-oriented,
+ {\sl cycle width} (default {\tt dimen\_}$/6$) \seesect{Twoterminal:}}
+\macrodef{resized}{resized}{({\sl factor},`{\sl macro name}',args)}
+ {cct}
+ {scale the element body size by {\sl factor}}
+\macrodef{restorem4dir}{restorem4dir}{([`{\sl stack name}'])}
+ {gen}
+ {Restore m4 direction parameters from the named stack;
+ default {\tt `savm4dir\_'}}
+\macrodef{reversed}{reversed}{(`{\sl macro name}',args)}
+ {cct}
+ {reverse polarity of 2-terminal element}
+\macrodef{rgbdraw}{rgbdraw}{({\sl color triple}, {\sl 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 {\tt setrgb} \seesect{Semiconductors:}}
+\macrodef{rgbfill}{rgbfill}{({\sl color triple}, {\sl closed path})}
+ {gen}
+ {fill with arbitrary color (color entries are 0 to 1 except
+ SVG entries which are 0 to 255); see {\tt setrgb}\seesect{Semiconductors:}}
+\macrodef{rgbstring}{rgbstring}{({\sl color triple or color name})}
+ {gen}
+ {evaluates to a string compatible with the postprocessor in use
+ to go with {\tt colored}, {\tt shaded}, or {\tt outlined} attributes.
+ (PSTricks, metapost, pgf-tikz, pdf, postscript, svg).
+ The arguments are fractions
+ in the range $[0,1]$; For example,
+ {\tt box outlined rgbstring(0.1,0.2,0.7) shaded rgbstring(0.75,0.5,0.25)}.
+ For those postprocessors that allow it,
+ there can be one argument which is the name of a defined color}
+\macrodef{right\_}{right_}{}
+ {gen}
+ {set current direction right \seesect{Placing:}}
+\macrodef{rjust\_}{rjust_}{}
+ {gen}
+ {right justify with respect to current direction}
+\macrodef{rlabel}{rlabel}{({\sl label},{\sl label},{\sl label})}
+ {cct}
+ {triple label on right side of the element \seesect{Labels:}}
+\macrodef{rot3Dx}{rot3Dx}{({\sl radians,x,y,z})}
+ {3D}
+ {rotates x,y,z about x axis}
+\macrodef{rot3Dy}{rot3Dy}{({\sl radians,x,y,z})}
+ {3D}
+ {rotates x,y,z about y axis}
+\macrodef{rot3Dz}{rot3Dz}{({\sl radians,x,y,z})}
+ {3D}
+ {rotates x,y,z about z axis}
+\macrodef{rotbox}{rotbox}{({\sl wid,ht,type},[r|t={\sl val}])}
+ {gen}
+ {box oriented in current direction in {\tt [ ]} block;
+ {\sl type}= e.g. {\tt dotted shaded "green".} Defined
+ internal locations: N, E, S, W (and NE, SE, NW, SW if arg4 is blank).
+ If arg4 is {\tt r=}{\sl val} then corners have radius {\sl val}.
+ If arg4 is {\tt t=}{\sl val} then a spline with tension {\sl val}
+ is used to draw a ``superellipse,'' and the bounding box is then
+ only approximate. }
+\macrodef{rotellipse}{rotellipse}{({\sl wid,ht,type})}
+ {gen}
+ {ellipse oriented in current direction in {\tt [ ]} block;
+ e.g. {\tt Point\_(45); rotellipse(,{},dotted fill\_(0.9)).} Defined internal
+ locations: N, S, E, W.}
+\macrodef{round}{round}{(at {\sl location,line thickness,attributes})}
+ {gen}
+ {filled circle for rounded corners; attributes={\tt colored "gray"}
+ for example; leaves {\tt Here} unchanged if arg1 is blank
+ \seesect{Corners:}}
+\macrodef{rpoint\_}{rpoint_}{(\linespec)}
+ {gen}
+ {set direction cosines}
+\macrodef{rpos\_}{rpos_}{({\sl position})}
+ {gen}
+ {Here + {\sl position}}
+\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$)}
+ {gen}
+ {like {\tt s\_box} but the text is rotated by {\tt text\_ang}
+ (default 90) degrees \seesect{Interaction:}, \seesect{Pstricks:}}
+\macrodef{rsvec\_}{rsvec_}{({\sl position})}
+ {gen}
+ {Here + {\sl position}}
+\macrodef{rt\_}{rt_}{}
+ {gen}
+ {right with respect to current direction}
+\macrodef{rtod\_\_}{rtod__}{}
+ {gen}
+ {constant, degrees/radian}
+\macrodef{rtod\_}{rtod_}{}
+ {gen}
+ {constant, degrees/radian}
+\macrodef{rvec\_}{rvec_}{({\sl x},{\sl y})}
+ {gen}
+ {location relative to current direction}
+\macrodef{s\_}{s_}{}
+ {gen}
+ {.s with respect to current direction}
+\macrodef{s\_box}{s_box}{({\sl text},{\sl expr1},$\cdots$)}
+ {gen}
+ {generate dimensioned text string using {\tt\char92{}boxdims} from
+ {\tt boxdims.sty}. Two or more args are passed to {\tt sprintf()}
+ (default 90) degrees \seesect{Interaction:}}
+\macrodef{s\_dp}{s_dp}{({\sl name},{\sl default})}
+ {gen}
+ {depth of the most recent (or named) {\tt s\_box}
+ \seesect{Interaction:}}
+\macrodef{s\_ht}{s_ht}{({\sl name},{\sl default})}
+ {gen}
+ {height of the most recent (or named) {\tt s\_box}
+ \seesect{Interaction:}}
+\macrodef{s\_init}{s_init}{({\sl name})}
+ {gen}
+ {initialize {\tt s\_box} string label to {\sl name} which should be unique
+ \seesect{Interaction:}}
+\macrodef{s\_name}{s_name}{}
+ {gen}
+ {the value of the last {\tt s\_init} argument
+ \seesect{Interaction:}}
+\macrodef{s\_wd}{s_wd}{({\sl name},{\sl default})}
+ {gen}
+ {width of the most recent (or named) {\tt s\_box}
+ \seesect{Interaction:}}
+\macrodef{savem4dir}{savem4dir}{([`{\sl stack name}'])}
+ {gen}
+ {Stack m4 direction parameters in the named stack
+ (default {\tt `savm4dir\_'})}
+\macrodef{sbs}{sbs}{({\sl linespec, chars, label})}
+ {cct}
+ {Wrapper to place an SBS thyristor as a two-terminal element with
+ {\tt [ ]} block label given by the third argument
+ \seesect{Semiconductors:}}
+\macrodef{sc\_draw}{sc_draw}{({\sl dna string, chars, iftrue, iffalse})}
+ {cct}
+ {test if chars are in string, deleting chars from string}
+\macrodef{scr}{scr}{({\sl linespec, chars, label})}
+ {cct}
+ {Wrapper to place an SCR thyristor as a two-terminal element with
+ {\tt [ ]} block label given by the third argument
+ \seesect{Semiconductors:}}
+\macrodef{scs}{scs}{({\sl linespec, chars, label})}
+ {cct}
+ {Wrapper to place an SCS thyristor as a two-terminal element with
+ {\tt [ ]} block label given by the third argument
+ \seesect{Semiconductors:}}
+\macrodef{se\_}{se_}{}
+ {gen}
+ {.se with respect to current direction}
+\macrodef{series\_}{series_}{({\sl elementspec}, {\sl elementspec}, $\ldots$)}
+ {cct}
+ { Series combination in a {\tt []} block of elements
+ with shortened default length. An {\sl elementspec} is of the form
+ {\tt [{\sl Label}:] {\sl element}; [{\sl attributes}]},
+ where an {\sl attribute} is of the form
+ {\tt [llabel($\ldots$);] | [rlabel($\ldots$);] [b\_current($\ldots$);]}.
+ Internal points {\tt Start}, {\tt End}, and {\tt C} are defined
+ \seesect{Seriesandparallel:} }
+\macrodef{setdir\_}{setdir_}{(R|L|U|D|{\sl degrees}, {\sl default} U|D|R|L|{\sl degrees})}
+ {gen}
+ {store drawing direction and set it to
+ up, down, left, right, or angle in degrees (reset by {\tt resetdir\_}).
+ The directions may be spelled out, i.e., Right, Left, $\ldots$
+ \seesect{Seriesandparallel:}}
+\macrodef{setrgb}{setrgb}{({\sl red value, green value, blue value},[{\sl
+ name}])}
+ {gen}
+ {define colour for lines and text, optionally named (default {\tt lcspec});
+ svg values are integers from 0 to 255\seesect{Semiconductors:}}
+\macrodef{setview}{setview}{({\sl azimuth degrees},{\sl elevation degrees})}
+ {3D}
+ {set projection viewpoint}
+\macrodef{sfg\_init}{sfg_init}{({\sl default line len, node rad, arrowhd len,
+ arrowhd wid}), (reads {\tt libcct.m4})}
+ {cct}
+ {initialization of signal flow graph macros}
+\macrodef{sfgabove}{sfgabove}{}
+ {cct}
+ {like above but with extra space}
+\macrodef{sfgarc}{sfgarc}{(\linespec,{\sl text},{\sl text justification},cw|ccw,
+ {\sl height scale factor})}
+ {cct}
+ {directed arc drawn between nodes, with text label
+ and a height-adjustment parameter }
+\macrodef{sfgbelow}{sfgbelow}{}
+ {cct}
+ {like below but with extra space}
+\macrodef{sfgline}{sfgline}{(\linespec,{\sl text},{\sl text justification})}
+ {cct}
+ {directed straight line chopped by node radius, with text label}
+\macrodef{sfgnode}{sfgnode}{(at {\sl location},{\sl text},above|below,{\sl
+ circle options})}
+ {cct}
+ {small circle default white interior, with text label. The default label
+ position is inside if the diameter is bigger than {\tt textht} and
+ {\tt textwid}; otherwise it is {\tt sfgabove.} Options such as fill or
+ line thickness can be given.}
+\macrodef{sfgself}{sfgself}{(at {\sl location}, U|D|L|R|{\sl degrees},
+ {\sl text}, {\sl text justification}, cw|ccw, {\sl scale factor})}
+ {cct}
+ {self-loop drawn at angle {\sl angle} from a node,
+ with text label and a size-adjustment parameter }
+\macrodef{shade}{shade}{({\sl gray value},{\sl closed line specs})}
+ {gen}
+ {fill arbitrary closed curve}
+\macrodef{shadebox}{shadebox}{({\sl box specification})}
+ {gen}
+ {box with edge shading}
+\macrodef{ShadedPolygon}{ShadedPolygon}{({\sl vertexseq, line attributes,
+ degrees, colorseq})}
+ {gen}
+ {Draws the polygon specified in arg1 and shades the interior according
+ to arg4 by drawing lines perpendicular to the angle in arg3.
+ The {\sl vertexseq} is a colon ({\tt:}) separated sequence of vertex
+ positions (or names) of the polygon in cw or ccw order. A {\sl colorseq}
+ is of the form 0, r0,g0,b0, {\sl frac1},r1,g1,b1, {\sl frac2},r2,g2,b2,
+ \ldots 1,rn,gn,bn with $0 < \hbox{\sl frac1} < \hbox{\sl frac2} \ldots 1$
+}
+\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,
+ arcrad = 6, circlerad = 6, boxht = 12, boxwid = 18, ellipseht = 12,
+ ellipsewid = 18, dashwid = 2, arrowht = 3, arrowwid = arrowht/2,}}
+\macrodef{sign\_}{sign_}{({\sl number})}
+ {gen}
+ {sign function}
+\macrodef{Sin}{Sin}{({\sl integer})}
+ {gen}
+ {sine function, {\sl integer\/} degrees}
+\macrodef{sinc}{sinc}{({\sl number})}
+ {gen}
+ {the $\hbox{sinc}(x)$ function}
+\macrodef{sind}{sind}{({\sl arg})}
+ {gen}
+ {sine of an expression in degrees}
+\macrodef{sinusoid}{sinusoid}{({\sl amplitude, frequency, phase, tmin, tmax,
+ linetype})}
+ {gen}
+ {draws a sinusoid over the interval
+ $(t_{\hbox{\scriptsize min}}, t_{\hbox{\scriptsize max}})$;
+ e.g., to draw a dashed sine curve, amplitude {\sl a}, of {\sl n} cycles
+ of length {\sl x} from {\sl A},
+ {\tt sinusoid(a,twopi\_*n/x,-pi\_/2,0,x,dashed) with .Start at A}}
+\macrodef{source}{source}{(\linespec,V|v|I|i|AC|B|F|G|H|Q|L|N|P|S|T|X|U|{\sl
+ other},{\sl diameter},R)}
+ {cct}
+ {source, blank or voltage (2 types), current (2 types), AC,
+ or type F, G, Q, B, L, N, X or labelled,
+ H = step (Heaviside),
+ P = pulse, U = square, R = ramp,
+ S = sinusoid, T = triangle; other = custom interior label or waveform,
+ R = reversed polarity \seesect{Twoterminal:}}
+\macrodef{sourcerad\_}{sourcerad_}{}
+ {cct}
+ {default source radius}
+\macrodef{sp\_}{sp_}{}
+ {gen}
+ {evaluates to medium space for gpic strings}
+\macrodef{speaker}{speaker}{( U|D|L|R|{\sl degrees},{\sl size},H)}
+ {cct}
+ {speaker, {\sl In1} to {\sl In7} defined; {\tt H}=horn
+ \seesect{Composite:}}
+\macrodef{sprod3D}{sprod3D}{(a,x,y,z)}
+ {3D}
+ {scalar product of triple x,y,z by a}
+\macrodef{sqrta}{sqrta}{({\sl arg})}
+ {gen}
+ {square root of the absolute value of {\sl arg}; i.e.,
+ {\tt sqrt(abs({\sl arg}))}}
+\macrodef{SQUID}{SQUID}{({\sl n, diameter, initial angle}, {\tt ccw|cw})}
+ {cct}
+ {Superconducting quantum interface device
+ with {\sl }n junctions labeled {\tt J1, ... J}{\sl n}
+ placed around a circle with initial
+ angle -90 deg (by default) with respect
+ to the current drawing direction. The
+ default diameter is {\tt dimen\_} }
+\macrodef{stackargs\_}{stackargs}{(`{\sl stackname}',{\sl args})}
+ {gen}
+ {Stack arg 2, arg 3, ... onto the named stack up to a blank arg}
+\macrodef{stackcopy\_}{stackcopy_}{(`{\sl name 1}',`{\sl name 2}')}
+ {gen}
+ {Copy stack 1 into stack 2, preserving the order of pushed elements}
+\macrodef{stackdo\_}{stackdo}{(`{\sl stackname}',{\sl commands})}
+ {gen}
+ {Empty the stack to the first blank entry, performing arg 2}
+\macrodef{stackexec\_}{stackexec_}{(`{\sl name 1}',`{\sl name 2}',%
+ {\sl commands})}
+ {gen}
+ {Copy stack 1 into stack 2, performing arg3 for each nonblank entry}
+\macrodef{stackprint\_}{stackprint_}{(`{\sl stack name}')}
+ {gen}
+ {Print the contents of the stack to the terminal}
+%\macrodef{stackpromote\_}{stackpromote_}{({\sl prefix},%
+% `{\sl stack name}',{\sl In name})}
+% {gen}
+% {Define locations {\tt In1} or {\sl In name }{\tt 1}, $\ldots$ corresponding
+% to the locations in stack {\sl stack name}, as created by the
+% {\tt AutoGate} and {\tt Autologic} macros. Each location is prefixed
+% by argument 1 ``.''}
+\macrodef{stackreverse\_}{stackreverse_}{(`{\sl stack name}')}
+ {gen}
+ {Reverse the order of elements in a stack, preserving the name}
+\macrodef{stacksplit\_}{stacksplit_}{(`{\sl stack name}',{\sl string},{\sl
+ separator})}
+ {gen}
+ {Stack the fields of {\sl string} left to right separated by nonblank
+ {\sl separator} (default .). White space preceding the fields is ignored.}
+\macrodef{sum\_}{sum_}{({\sl a},{\sl b})}
+ {gen}
+ {binary sum}
+\macrodef{sum3D}{sum3D}{({\sl x1,y1,z1,x2,y2,z2})}
+ {3D}
+ {sum of two triples}
+\macrodef{sus}{sus}{({\sl linespec, chars, label})}
+ {cct}
+ {Wrapper to place an SUS thyristor as a two-terminal element with
+ {\tt [ ]} block label given by the third argument
+ \seesect{Semiconductors:}}
+\macrodef{svec\_}{svec_}{({\sl x},{\sl y})}
+ {log}
+ {scaled and rotated grid coordinate vector}
+\macrodef{sw\_}{sw_}{}
+ {gen}
+ {.sw with respect to current direction}
+\macrodef{switch}{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{\tt|}C][D][A]
+ O= opening, C=closing, D=dots, A=blade arrowhead;
+ if arg4=B (button switch): arg3 = O{\tt|}C
+ O=normally open, C=normally closed,
+ if arg4=D: arg3 = same as for dswitch \seesect{Twoterminal:}}
+\macrodef{ta\_xy}{ta_xy}{({\sl x, y})}
+ {cct}
+ {macro-internal coordinates adjusted for {\tt L|R}}
+\macrodef{tapped}{tapped}{(`{\sl two-terminal element}',
+ [{\sl arrowhd} | type={\sl arrowhd};name={\sl Name}],
+ {\sl fraction, length, fraction, length,} $\cdots$)}
+ {cct}
+ {Draw the two-terminal element with taps in a [ ] block (see {\tt addtaps}).
+ {\sl arrowhd} = blank or one of {\tt . - <- -> <->}.
+ Each fraction determines the position along the element body of the tap.
+ A negative length draws the tap to the right of the current
+ direction; positive length to the left.
+ Tap names are Tap1, Tap2, $\cdots$ by default or
+ Name1, Name2, $\cdots$ if specified.
+ Internal block names are {\tt .Start, .End,} and {.C} corresponding to the
+ drawn element, and the tap names
+ \seesect{Composite:} }
+\macrodef{tbox}{tbox}{({\sl text,wid,ht},<|>|<>,{\sl type})}
+ {cct}
+ {Pointed terminal box. The {\sl text} is placed at the rectangular center
+ in math mode unless the text begins with {\tt "} or {\tt sprintf} in which
+ case the arument is used literally. Arg 4 determines whether the point is
+ forward, backward, or both with respect to the current drawing direction.
+ \seesect{Composite:}}
+\macrodef{tconn}{tconn}{({\sl linespec,}>|>>|<|<<|O[F],{\sl wid})}
+ {cct}
+ {Terminal connector, {\tt O}=circle; {\tt OF}=filled circle;
+ {\tt > or >>} output connector
+ (default {\tt >}) ;
+ {\tt < or << input connector}; arg3 is arrowhead width or circle diameter
+ \seesect{Composite:}}
+\macrodef{tgate}{tgate}{({\sl linespec,} [B][R|L])}
+ {cct}
+ {transmission gate, {\tt B=} ebox type; {\tt L=} oriented left
+ \seesect{Semiconductors:}}
+\macrodef{thermocouple}{thermocouple}{({\sl linespec, wid, ht,} L|R)}
+ {cct}
+ { Thermocouple drawn to the left (by default) of the {\sl linespec}
+ line. If the {\sl linespec} length equals {\sl wid}
+ (default {\tt dimen\_/5}), then only the two branches appear.
+ {\tt R=} right orientation.
+ \seesect{Twoterminal:}}
+\macrodef{thicklines\_}{thicklines_}{({\sl number})}
+ {gen}
+ {set line thickness in points}
+\macrodef{thinlines\_}{thinlines_}{({\sl number})}
+ {gen}
+ {set line thickness in points}
+\macrodef{threeD\_init}{threeD_init}{}
+ {3D}
+ {initialize 3D transformations (reads {\tt lib3D.m4})}
+\macrodef{thyristor}{thyristor}{(\linespec,%
+ {\tt [SCR|SCS|SUS|SBS|IEC][{\sl chars}]})}
+ {cct}
+ {Composite thyristor element in {\tt []}block:
+ types
+ SCR: silicon controlled rectifier (default),
+ SCS: silicon controlled switch,
+ SUS: silicon unilateral switch,
+ SBS: silicon bilateral switch,
+ IEC: type IEC.
+ {\sl Chars} to modify or define the element:
+ K: open arrowheads,
+ A: arrowhead,
+ F: half arrowhead,
+ B: bidirectional diode,
+ E: adds envelope,
+ H: perpendicular gate (endpoint G),
+ N: anode gate (endpoint Ga),
+ U: centre line in diodes
+ V: perpendicular gate across arrowhead centre,
+ R=right orientation,
+ E=envelope
+ \seesect{Semiconductors:}}
+\macrodef{tikznode}{tikznode}{({\sl \Tikz node name, position}) }
+ {pgf}
+ {insert \Tikz code to define a zero-size \Tikz node at {\sl location}
+ (default {\tt Here}) to assist with inclusion of \pic code output in
+ \Tikz diagrams. This macro must be invoked in the outermost \pic scope.
+ \seesect{Tikzwithpic:}}
+\macrodef{tline}{tline}{(\linespec,{\sl wid},{\sl ht}) }
+ {cct}
+ {transmission line, manhattan direction\seesect{Twoterminal:}}
+\macrodef{tr\_xy\_init}{tr_xy_init}{({\sl origin, unit size, sign })}
+ {cct}
+ {initialize {\tt tr\_xy}}
+\macrodef{tr\_xy}{tr_xy}{({\sl x, y})}
+ {cct}
+ {relative macro internal coordinates adjusted for {\tt L|R}}
+\macrodef{transformer}{transformer}{(\linespec,L|R,{\sl np},%
+[A|P][W|L][D1|D2|D12|D21],{\sl ns})}
+ {cct}
+ {2-winding transformer or choke with terminals P1, P2, TP, S1, S2, TS:
+ arg2: L = left, R = right,
+ arg3: np primary arcs,
+ arg5: ns secondary arcs,
+ arg4: A = air core, P = powder (dashed) core,
+ W = wide windings, L = looped windings,
+ D1: phase dots at P1 and S1 end; D2 at P2 and S2 end; D12 at P1 and S2 end;
+ D21 at P2 and S1 end
+ \seesect{Composite:}}
+\macrodef{tstrip}{tstrip}{(R|L|U|D|{\sl degrees, nterms, chars})}
+ {cct}
+ {terminal strip, chars:
+ I=invisible terminals,
+ C=circle terminals (default),
+ D=dot terminals,
+ O=omitted separator lines,
+ {\tt wid=}value{\tt ;} total strip width,
+ {\tt ht=}value{\tt ;} strip height
+ \seesect{Composite:}}
+\macrodef{ttmotor}{ttmotor}{({\sl linespec, string, diameter, brushwid, brushht})}
+ {cct}
+ {motor with label\seesect{Twoterminal:}}
+\macrodef{twopi\_}{twopi_}{}
+ {gen}
+ {$2\pi$}
+\macrodef{ujt}{ujt}{(\linespec,R,P,E)}
+ {cct}
+ {unijunction transistor, right, P-channel, envelope
+ \seesect{Semiconductors:}}
+\macrodef{unit3D}{unit3D}{(x,y,z)}
+ {3D}
+ {unit triple in the direction of triple x,y,z}
+\macrodef{up\_\_}{up__}{}
+ {gen}
+ {up with respect to current direction}
+\macrodef{up\_}{up_}{}
+ {gen}
+ {set current direction up \seesect{Placing:}}
+\macrodef{variable}{variable}{(`{\sl element}',
+ {\tt [A|P|L|[u]N][C|S]},{\sl angle},{\sl length})}
+ {cct}
+ {overlaid arrow or line to indicate variable 2-terminal element:
+ {\tt A}=arrow, {\tt P}=preset,
+ {\tt L}=linear, {\tt N}=nonlinear, {\tt C}=continuous, {\tt S}=setpwise
+ \seesect{Twoterminal:}}
+\macrodef{vec\_}{vec_}{({\sl x},{\sl y})}
+ {gen}
+ {position rotated with respect to current direction}
+\macrodef{View3D}{View3D}{}
+ {3D}
+ {The view vector (triple) defined by {\tt setview({\sl azim, elev})}. The
+ {\tt project}
+ macro projects onto the plane perpendicular to this vector}
+\macrodef{vlength}{vlength}{({\sl x},{\sl y})}
+ {gen}
+ {vector length $\sqrt{x^2+y^2}$}
+\macrodef{vperp}{vperp}{({\sl linear object})}
+ {gen}
+ {unit-vector pair CCW-perpendicular to linear object}
+\macrodef{Vperp}{Vperp}{({\sl position name}, {\sl position name})}
+ {gen}
+ {unit-vector pair CCW-perpendicular to line joining two named positions}
+\macrodef{vrot\_}{vrot_}{({\sl x},{\sl y},{\sl xcosine},{\sl ycosine})}
+ {gen}
+ {rotation operator}
+\macrodef{vscal\_}{vscal_}{({\sl number},{\sl x},{\sl y})}
+ {gen}
+ {vector scale operator}
+\macrodef{Vsprod\_}{Vsprod_}{({\sl position}, {\sl expression})}
+ {gen}
+ {The vector in arg 1 multiplied by the scalar in arg 2}
+\macrodef{w\_}{w_}{}
+ {gen}
+ {.w with respect to current direction}
+\macrodef{while\_}{while_}{(`{\sl test}',`{\sl actions}')}
+ {gen}
+ {Integer m4 while loop}
+\macrodef{wid\_}{wid_}{}
+ {gen}
+ {width with respect to current direction}
+\macrodef{winding}{winding}{(L|R, {\sl diam, pitch, turns, core wid,
+ core color})}
+ {cct}
+ {core winding drawn in the current direction; {\tt R}=right-handed
+ \seesect{Composite:}}
+\macrodef{XOR\_gate}{XOR_gate}{({\sl n},N)}
+ {log}
+ {`xor' gate, 2 or {\sl n\/} inputs; N=negated input.
+ Otherwise, arg1 can be a sequence of letters {\tt P|N}
+ to define normal or negated inputs.
+ \seesect{Logicgates:}}
+\macrodef{XOR\_off}{XOR_off}{}
+ {log}
+ {XOR and NXOR offset of input face}
+\macrodef{xtal}{xtal}{(\linespec)}
+ {cct}
+ {quartz crystal\seesect{Twoterminal:}}
+\macrodef{xtract}{xtract}{({\sl string, substr1, substr2, $\ldots$})}
+ {gen}
+ {returns substrings if present}
+% \end{tabbing}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/eboxdims.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/eboxdims.m4
new file mode 100644
index 00000000000..024d017c488
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/eboxdims.m4
@@ -0,0 +1,14 @@
+.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$}"
+thinlines_
+ s_init(eboxdims)
+ d2 = 5pt__/2
+ textoffset = 2 pt__
+ dimension_(from last box.sw to last box.se chop d2, -0.1,
+ s_box(\tt Q\_w),W,2pt__)
+ dimension_(from last box.se to last box.ne chop d2, -0.1,
+ s_box($\!\!\!$\tt Q\_h${+}$Q\_d) ljust,H,2pt__)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/fbfilter.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/fbfilter.m4
new file mode 100644
index 00000000000..fdae23938e5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/fbfilter.m4
@@ -0,0 +1,39 @@
+.PS
+# fbfilter.m4
+cct_init
+# `fbfilter( U|D|L|R|degrees, [R|L],
+# amp label, C label, R label )'
+define(`fbfilter',
+`[
+ setdir_(ifelse(`$1',,0,`$1')) # Process arg 1
+ eleminit_ # Assign rp_ang, rp_len
+ tmpang = rp_ang # Save rp_ang
+ hunit = elen_ # Dimension parameters
+ vunit = ifinstr(`$2',R,-)dimen_
+ Q: opamp(,,,,`$2')
+ move to Q.In`'ifinstr(`$2',R,2,1); line to rvec_(-hunit/4,0)
+ J: dot
+ R: resistor(to rvec_(-elen_,0)) # Two-term elements change rp_ang
+ point_(tmpang) # so reset it.
+ In: Here
+ move to Q.In`'ifinstr(`$2',R,1,2); line to rvec_(-hunit/4,0)
+ G: Here
+ dot(at Q.Out)
+ { line to rvec_(hunit/4,0)
+ Out: Here }
+ line to rvec_(0,vunit)
+ C: capacitor(to rvec_(-distance(Q.Out,0.5 between J and G),0)); point_(tmpang)
+ line to J
+ ifelse(`$3',,,"$`$3'$" at Q.C)
+ ifelse(`$4',,,"$`$4'$" at C+vec_(0,-vunit/3))
+ ifelse(`$5',,,"$`$5'$" at R+vec_(0,-vunit/4))
+ ]')
+
+F1: fbfilter(,,K_3,C_{24},R_4)
+ ground(at F1.G)
+ dot(at F1.In); line up_ elen_/4
+F2: fbfilter(L,R,K_2,C_{23},R_3) with .In at F1.In
+ ground(at F2.G)
+ resetdir_
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/fet.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/fet.m4
new file mode 100644
index 00000000000..08498ef83d8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/fet.m4
@@ -0,0 +1,170 @@
+.PS
+# `fet.m4'
+cct_init
+
+dwn = 0.9
+dwn = 1.0
+rgt = 0.9
+textht = 0.1
+
+dnl `IRF4905(linespec,R)'
+define(`IRF4905',
+ `[ ifelse(`$1',,,`eleminit_(`$1')')
+ Q: mosfet(,`$2',dMdPzEDSQdB,) ifelse(`$1',,`
+ S: Q.tr_xy(-4,-2); line from Q.tr_xy(-2,-2) to S
+ D: Q.tr_xy( 4,-2); line from Q.tr_xy(2,-2) to D',
+ `with .Diode.c at last line.c
+ S: last line.start; D: last line.end; line from S to D ')
+ G: Q.G
+ circle rad 5*dimen_/10 at Q.tr_xy(0,1) ]')
+
+define(`rmove',0.75)
+define(`dir_',`right_')
+
+Orig: Here
+dir_
+ { move left 0.2 }
+ {J: j_fet(right_ dimen_,,,E)
+ "{\tt j\_fet(right\_ dimen\_,{,},E)}" wid 1.75 \
+ with .nw at last [].sw+(0.0,-0.25)
+ "$G$" at last [].G rjust above
+ "$S$" at last [].S rjust
+ "$D$" at last [].D ljust
+ }
+
+ move right_ 0.9; dir_
+ {j_fet(,,P,)
+ "{\tt j\_fet(,{,}P,)}" at last [].s+(0,-0.05) below
+ "$G$" at last [].G rjust
+ "$S$" at last [].S rjust
+ "$D$" at last [].D ljust
+ }
+
+ move right_ 0.9; dir_
+ {e_fet(,R,,)
+ "{\tt e\_fet(,R,{,})}" at last [].s+(0,-0.05) below
+ "$G$" at last [].G rjust
+ "$S$" at last [].S rjust
+ "$D$" at last [].D ljust
+ }
+
+ {move down_ dwn; dir_
+ e_fet(,,P)
+ "{\tt e\_fet(,{,}P)}" at last [].s+(0.1,-0.2) below}
+
+ move right_ 0.9; dir_
+ {d_fet(,,,)
+ "{\tt d\_fet(,{,},)}" at last [].s+(0,-0.05) below}
+
+ {move down_ dwn; dir_
+ d_fet(,,P)
+ "{\tt d\_fet(,{,}P)}" at last [].s+(0,-0.05) below}
+
+ move right_ 0.9; dir_
+ {e_fet(,,,S)
+ "{\tt e\_fet(,{,},S)}" at last [].s+(0,-0.05) below}
+
+ {move down_ dwn; dir_
+ e_fet(,,P,S)
+ "{\tt e\_fet(,{,}P,S)}" at last [].s+(0,-0.2) below}
+
+ move right_ 0.9; dir_
+ {d_fet(,,,S)
+ "{\tt d\_fet(,{,},S)}" at last [].s+(0,-0.2) below}
+
+ {move down_ dwn; dir_
+ d_fet(,,P,S)
+ "{\tt d\_fet(,{,}P,S)}" at last [].s+(0,-0.05) below}
+
+ move right_ 0.9; dir_
+ {c_fet(,,,)
+ "{\tt `c\_fet'(,{,},)}" at last [].s+(0,-0.05) below}
+
+ {move down_ dwn; dir_
+ c_fet(,,P)
+ "{\tt `c\_fet'(,{,}P)}" at last [].s+(0,-0.2) below}
+
+move down 1; right_
+ [
+ linewid = linewid*1.2
+
+ Q1: mosfet(,,dGSDF,)
+ {"\tt `mosfet'(,{,}dGSDF,)" wid 1.25 \
+ with .nw at last [].sw+(-0.2,-0.05)
+ thinlines_
+ arrow <- down .05 left .15 from (Q1.G.x,Q1.G.y-0.05)
+ "\tt dG" rjust
+ arrow <- down .10 left .30 from Q1.Channel.start+(.15,0)
+ "\tt F" rjust
+ arrow <- down .05 left .15 from (Q1.S.x,Q1.S.y+0.05)
+ "\tt S" rjust
+ arrow <- down .05 right .15 from (Q1.D.x,Q1.D.y+0.05)
+ "\tt D" ljust
+ thicklines_ }
+
+ move right_ rmove
+ Q2: mosfet(,,uHSDF,)
+ {"\tt `$\ldots$'(,{,}uHSDF,)" at last [].s+(0,-0.15) below
+ thinlines_
+ arrow <- down .05 left .15 from (Q2.G.x,Q2.G.y-0.05)
+ "\tt uH" rjust
+ thicklines_ }
+
+ move right_ rmove
+ Q3: mosfet(,,dMEDSQuB,)
+ {"\tt `$\ldots$'(,{,}dMEDSQuB,)" at last [].s+(0,-0.05) below
+ thinlines_
+ arrow <- down .05 left .15 from (Q3.G.x,Q3.G.y-0.05)
+ "\tt dM" rjust
+ arrow <- down .13 left .30 from Q3.Channel.start+(.12,0)
+ "\tt E" rjust
+ arrow <- down .05 left .10 from Q3.S+(.06,0)
+ "\tt Q" rjust
+ arrow <- down .08 right .24 from (Q3.B.x,Q3.B.y+0.175)
+ "\tt uB" ljust
+ thicklines_ }
+
+ move right_ rmove
+ Q4: mosfet(,,uMEDSuB)
+ {`"{\tt $\ldots$(,{,}uMEDSuB)}"' at last [].s+(0,-0.15) below
+ "$G$" at last [].G rjust
+ "$S$" at last [].S rjust
+ "$D$" at last [].D ljust
+ "$B$" at last [].B below
+ }
+
+ move right_ rmove
+ Q5: mosfet(,,ZSDFdT,)
+ {"\tt `$\ldots$'(,{,}ZSDFdT,)" at last [].s+(0,-0.05) below
+ thinlines_
+ arrow <- down .08 left .08 from (Q5.S.x,Q5.S.y+0.12)
+ "\tt Z" rjust
+ arrow from last arrow.end to Q5.Channel.c+(0.05,0)
+ arrow from last arrow.start to (Q5.D.x,Q5.D.y+.05)
+ arrow <- down .08 right .24 from (Q5.G.x,Q5.G.y-0.02)
+ "\tt dT" ljust
+ thicklines_ }
+
+ move right_ rmove
+ up_
+ Q6: IRF4905 with .c at Here
+ {`"\tt IRF4905"' at Q6.s+(0,-0.15) below
+ "$G$" at Q6.G rjust
+ "$D$" at Q6.D ljust above
+ "$S$" at Q6.S ljust below
+ }
+ ] with .nw at J.sw+(0,-1.35) #Orig+(-0.26,-1.2)
+
+ right_
+ M1: mosfet(,,dBSDFQM1,E) with .nw at J.nw+(0,-dwn)
+ "$G0$" at M1.G0 above rjust
+ "$G1$" at M1.G1 above ljust
+ {"\tt `mosfet'(,{,}dBSDFQM1,E)" wid 1.45 \
+ with .nw at last [].sw+(0,-0.23) }
+ M2: mosfet(,,dBSDFQuM1) with .nw at M1.ne+(0.5,0)
+ "$G0$" at M2.G0 above ljust
+ "$G1$" at M2.G1 above rjust
+ {"\tt ...(,{,}dBSDFQuM1)" wid 1.25 \
+ with .n at last [].s+(0,-0.05) }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/lrarrows.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/lrarrows.m4
new file mode 100644
index 00000000000..e0a54222e37
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/lrarrows.m4
@@ -0,0 +1,16 @@
+.PS
+# `lrarrows.m4'
+cct_init
+ del = 0.55
+ inductor; larrow(i)
+ {"`\tt larrow(i)'" at last line + (0,-0.25)}
+ move right_ del
+ inductor; rarrow(i)
+ {"`\tt rarrow(i)'" at last line + (0,-0.25)}
+ move right_ del
+ inductor; larrow(i,<-)
+ {"`\tt larrow(i,<-)'" at last line + (0,-0.25)}
+ move right_ del
+ inductor; rarrow(i,<-)
+ {"`\tt rarrow(i,<-)'" at last line + (0,-0.25)}
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/md.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/md.tex
new file mode 100644
index 00000000000..7d195339e1f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/md.tex
@@ -0,0 +1,59 @@
+%
+\newdimen{\leftwid}\setlength{\leftwid}{2in}
+\newdimen{\libwid}\setlength{\libwid}{0.5in}
+\newdimen\rightwid
+\setlength{\rightwid}{\textwidth}
+\addtolength{\rightwid}{-\leftwid}
+\addtolength{\rightwid}{-\libwid}
+%
+\newbox\Defbox
+%\iffalse% original macrodef:
+%\newcommand{\macrodef}[3]{\setbox\Defbox=\hbox{\tt #1}%
+% \ifdim\wd\Defbox>\textwidth%
+% \setbox\Defbox=\hbox{\parbox{\textwidth}{\tt #1}}\fi
+% \ifdim\wd\Defbox>\leftwid%
+% \box\Defbox\hfill\break\hspace*{\leftwid}%
+% \else\hbox to \leftwid{\box\Defbox\hfill}\fi%
+% \hbox to \libwid{#2\hfill}\parbox[t]{\rightwid}%
+% {\raggedright #3}\vspace{\parsep}\\}
+%\fi
+
+\newcommand{\macx}[2]{%
+ \phantomsection\pdfbookmark[subsection]{#1}{#2}#1}
+
+\newcommand{\macrodef}[5]{\begin{samepage}%
+\phantomsection\pdfbookmark[subsection]{#1}{#2}%
+\setbox\Defbox=\hbox{\tt #1#3}%
+ \ifdim\wd\Defbox>\textwidth%
+ \setbox\Defbox=\hbox{\parbox{\textwidth}{\tt #1#3}}\fi
+ \ifdim\wd\Defbox>\leftwid%
+ \box\Defbox\hfill\break\hspace*{\leftwid}%
+ \else\hbox to \leftwid{\box\Defbox\hfill}\fi%
+ \hbox to \libwid{#4\hfill}\parbox[t]{\rightwid}%
+ {\raggedright #5}\end{samepage}\vspace{\parsep}\\}
+
+\newcommand{\seesect}[1]{ (see \SR{#1})}
+
+
+\vspace{\abovedisplayskip}
+\noindent
+\macrodef{Along\_}{Along_}{({\sl LinearObj,distance,}[R])}
+ {gen}
+ {Distance arg2 (default all the way) along a linear object
+ from {\tt .start} to {\tt .end}
+ (from {\tt .end} to {\tt .start} if arg3={\tt R}) }
+\macrodef{AND\_gate}{AND_gate}{({\sl n},N)}
+ {log}
+ {basic `and' gate, 2 or {\sl n\/} inputs; {\tt N}=negated input.
+ Otherwise, arg1 can be a sequence of letters {\tt P|N}
+ to define normal or negated inputs
+ \seesect{Logicgates:}}
+\macrodef{AND\_gen}{AND_gen}{($n$,{\sl chars},[{\sl wid},[{\sl ht}]])}
+ {log}
+ {general AND gate: $n$=number of inputs $(0\leq n\leq 16)$;
+ {\sl 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 {\tt P|N}
+ to define normal or negated inputs.}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/mplex.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/mplex.m4
new file mode 100644
index 00000000000..926a3654386
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/mplex.m4
@@ -0,0 +1,49 @@
+.PS
+# mplex.m4
+ log_init
+ linewid = linewid*0.9
+
+ define(`short',elen_*2/3)
+ del = BUF_ht*L_unit
+down_
+P: NOR_gate(8)
+B: P.In3+(0,del/2)
+ dx = P.In1.x-P.In2.x
+ line down del/2 from P.Out then right 2*del; dot
+ {line up del*1.5; right_; BUFFER_gate(right_ short); "$\bar{Y}$" ljust }
+# BUFFER_gate(right_ short,N) ; "$Y$" ljust
+ NOT_gate(right_ short,n) ; "$Y$" ljust
+ for_(0,7,1,
+ `line from P.In`'eval(8-m4x) \
+ up B.y-P.In`'eval(8-m4x).y + (3.5-abs(m4x-3.5)) * dx \
+ then left (3.5-m4x)*AND_wd*L_unit then up (0.5+abs(m4x-3.5))*dx; down_
+ A`'m4x: AND_gate(5) with .Out at Here ')
+
+Eb: "$\bar{E}$" rjust at (A0.In5.x-2*short-dx/2,A0.n.y+del/2)
+# BUFFER_gate(from Eb right_ short,N); line to (A7.In1,Here) then to A7.In1
+ NOT_gate(from Eb right_ short,n); line to (A7.In1,Here) then to A7.In1
+ for_(0,6,1,
+ `line from A`'m4x.In1 to (A`'m4x.In1,Eb) ; dot')
+
+ for_(0,2,1,
+ `"`$S_'m4x$" wid 0.17 with .e at (Eb.x-textoffset,Eb.y+(1+m4x)*del*2)
+ NOT_gate(right_ short)
+ V1`'m4x: Here+(N_diam*L_unit/2,-del); {dot(at (V1`'m4x,Here))}
+# NOT_gate(right_ short)
+ NOT_gate(right_ short,n)
+ V0`'m4x: Here')
+
+ for_(0,7,1,`define(`i',m4x)dnl
+ for_(0,2,1,`define(`j',m4x)define(`k',`eval(((i+2**j)/2**j)%2)')dnl
+ move to A`'i.In`'eval(j+2)
+ line up V`'k`'j.y - Here.y dnl
+ ifelse(eval((i==7)|(i==(7-2**j))),1,
+ `then to V`'k`'j ifelse(eval(k==1),1,`then up del')',
+ `; dot')
+ ')
+ move to A`'i.In5; line to (Here,V02)
+ reversed(`BUFFER_gate',up_ short)
+ "$`I_'i$" at last line.end rjust
+ ')
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/oax.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/oax.m4
new file mode 100644
index 00000000000..d2396d6cedd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/oax.m4
@@ -0,0 +1,5 @@
+.PS
+# `oax.m4'
+cct_init
+include(oaxbody.m4)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/oaxbody.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/oaxbody.m4
new file mode 100644
index 00000000000..983b816cf5d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/oaxbody.m4
@@ -0,0 +1,4 @@
+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
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/quick.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/quick.m4
new file mode 100644
index 00000000000..7de2399601e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/quick.m4
@@ -0,0 +1,16 @@
+.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
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/stringdims.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/stringdims.m4
new file mode 100644
index 00000000000..279ce24be1e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/stringdims.m4
@@ -0,0 +1,10 @@
+.PS
+# stringdims.m4
+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
+ ]
+ box dotted ht last [].ht wid last [].wid at last []
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/test.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/test.tex
new file mode 100644
index 00000000000..44d486d0c53
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/test.tex
@@ -0,0 +1 @@
+\centering
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/thyristor.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/thyristor.m4
new file mode 100644
index 00000000000..ecc6448bf39
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/thyristor.m4
@@ -0,0 +1,118 @@
+.PS
+# `thyristor.m4'
+cct_init
+
+define labels { {
+ "\sl $1" ht 11 pt__ $2 at last[].$1
+ "\sl $3" $4 at last[].$3
+ "\sl $5" $6 at last[].$5
+ "\tt $7" ht 11 pt__ $9 at (last[].s+(0,$8)) } }
+
+down_
+Row1: [
+ {thyristor
+ labels(A,above,K,below,G,ljust,`thyristor',-0.25,wid 0.75) }
+
+ move right 0.50 ; down_
+ {thyristor(,B)
+ labels(T1,above,T2,below,G,below ljust,`...(,B)',-0.35) }
+
+ move right 0.50 ; down_
+ {thyristor(down_ dimen_*0.8,BRK)
+ labels(T1,above,T2,below,G,below rjust,`...(,BRK)',-0.22) }
+
+ move right 0.60 ; down_
+ {thyristor(,BE)
+ labels(T1,above,T2,below,G,below ljust,`...(,BE)',-0.35) }
+
+ move right 0.50 ; down_
+ {thyristor(,A) at (Here,last [])
+ labels(A,above,K,below,G,ljust,`...(,A)',-0.35) }
+
+ move right 0.50 ; down_
+ {thyristor(,F) at (Here,last [])
+ labels(A,above,K,below,G,ljust,`...(,F)',-0.22) }
+
+ move right 0.65 ; down_
+ {thyristor(,BRE)
+ labels(T1,above,T2,below,G,below rjust,`...(,BRE)',-0.35) }
+
+ move right 0.75 ; down_
+ {thyristor(,UARE) at (Here,last [])
+ labels(A,above,K,below,G,rjust below,`...(,UARE)',-0.22) }
+
+ move right 0.50 ; down_
+ {thyristor(,AV,G: G+(0.1,0.1)) at (Here,last [])
+ thinlines_
+ spline -> from last[].G left 0.05 then left 0.05 down 0.1
+ thicklines_
+ labels(A,above,K,below,G,ljust,`...(,AV)',-0.35) }
+
+ move right 0.50 ; down_
+ {thyristor(,IEC)
+ labels(A,above ljust,K,below ljust,G,ljust,`...(,IEC)',-0.22) }
+ ]
+Row2: [
+ down_
+ {thyristor(,UAH)
+ labels(A,rjust above,K,rjust below,G,ljust,`...(,UAH)',-0.35,wid 0.65) }
+
+ move right 0.55 ; down_
+ {thyristor(,N) at (Here,last [])
+ labels(A,above,K,below,Ga,rjust,`...(,N)',-0.22) }
+
+ move right 0.55 ; down_
+ {thyristor(,UANRE) at (Here,last [])
+ labels(A,above,K,below,Ga,ljust above,`...(,UANRE)',-0.35) }
+ move right 0.55 ; down_
+ {thyristor(,SCR) at (Here,last [])
+ labels(A,above,K,below rjust,G,below ljust,`...(,SCR)',-0.22) }
+
+ move right 0.55 ; down_
+ {thyristor(,SCRE) at (Here,last [])
+ labels(A,above,K,below,G,ljust below,`...(SCRE)',-0.35) }
+
+ move right 0.65 ; down_
+ {thyristor(,SCRRE) at (Here,last [])
+ labels(A,above,K,below,G,rjust below,`...(SCRRE)',-0.22) }
+
+ move right 0.55 ; down_
+ {thyristor(,SCS) at (Here,last [])
+ labels(A,above,K,below,G,ljust,`...(SCS)',-0.35) }
+ { "\sl Ga" rjust above at last[].Ga }
+
+ move right 0.55 ; down_
+ {thyristor(,SCSE) at (Here,last [])
+ labels(A,above,K,below,G,ljust below,`...(SCSE)',-0.22) }
+ { "\sl Ga" rjust above at last[].Ga }
+
+ move right 0.65 ; down_
+ {thyristor(,SUSE) at (Here,last [])
+ labels(A,above,K,below,G,rjust,`...(SUSE)',-0.35) }
+
+ move right 0.65 ; down_
+ {thyristor(,SBSE) at (Here,last [])
+ labels(T1,above,T2,below,G,rjust,`...(SBSE)',-0.22) }
+
+ ] with .nw at Row1.sw + (0,-0.20)
+
+Twoterms: [ right_
+ { scr(,,Q) ; `"\tt scr(,{,}Q)"' at last [].e ljust}
+ { "\sl Q.G" at Q.G above }
+
+ move down 0.4; right_
+ { scs(,,Q2) ; `"\tt scs(,{,}Q2)"' at last [].e ljust }
+ { "\sl Q2.G" at Q2.G above }
+ { "\sl Q2.Ga" at Q2.Ga below }
+ ] with .nw at Row2.sw+(0,-0.2)
+
+ [ right_
+ { sus(,RE,Q3) ; `"\tt sus(,RE,Q3)"' at last [].e ljust}
+ { "\sl Q3.G" at Q3.G above }
+
+ move right_ 1.2 from last line.end
+ { sbs(,E,Q4) ; `"\tt sbs(,E,Q4)"' at last [].e ljust}
+ { "\sl Q4.G" at Q4.G below }
+ ] with .w at last [].e+(1.0,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/tran.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/tran.m4
new file mode 100644
index 00000000000..3314be47e0f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/tran.m4
@@ -0,0 +1,5 @@
+.PS
+# `tran.m4'
+cct_init
+include(tranbody.m4)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/tran.tex b/Master/texmf-dist/doc/latex/circuit-macros/doc/tran.tex
new file mode 100644
index 00000000000..a894de26d59
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/tran.tex
@@ -0,0 +1,76 @@
+% tran.m4
+\begin{tikzpicture}[scale=2.54]
+% dpic version 2014.03.24 option -g for TikZ and PGF 1.01
+\ifx\dpiclw\undefined\newdimen\dpiclw\fi
+\global\def\dpicdraw{\draw[line width=\dpiclw]}
+\global\def\dpicstop{;}
+\dpiclw=0.8bp
+\dpiclw=0.8bp
+\dpicdraw (0,0)
+ --(0.2,0)\dpicstop
+\dpicdraw (0.2,0.333333)
+ --(0.2,0.291667)\dpicstop
+\dpicdraw (0.2,0.291667)
+ --(0.194444,0.291667)\dpicstop
+\dpicdraw (0.2,0.291667)
+ ..controls (0.217259,0.291667) and (0.23125,0.277676)
+ ..(0.23125,0.260417)
+ ..controls (0.23125,0.243158) and (0.217259,0.229167)
+ ..(0.2,0.229167)\dpicstop
+\dpicdraw (0.2,0.229167)
+ --(0.194444,0.229167)\dpicstop
+\dpicdraw (0.2,0.229167)
+ ..controls (0.217259,0.229167) and (0.23125,0.215176)
+ ..(0.23125,0.197917)
+ ..controls (0.23125,0.180658) and (0.217259,0.166667)
+ ..(0.2,0.166667)\dpicstop
+\dpicdraw (0.2,0.166667)
+ --(0.194444,0.166667)\dpicstop
+\dpicdraw (0.2,0.166667)
+ ..controls (0.241667,0.166667) and (0.241667,0.104167)
+ ..(0.2,0.104167)\dpicstop
+\dpicdraw (0.2,0.104167)
+ --(0.194444,0.104167)\dpicstop
+\dpicdraw (0.2,0.104167)
+ ..controls (0.241667,0.104167) and (0.241667,0.041667)
+ ..(0.2,0.041667)\dpicstop
+\dpicdraw (0.2,0.041667)
+ --(0.194444,0.041667)\dpicstop
+\dpicdraw (0.2,0.041667)
+ --(0.2,-0)\dpicstop
+\dpicdraw (0.272917,0.291667)
+ --(0.272917,0.041667)\dpicstop
+\dpicdraw (0.335417,0.291667)
+ --(0.335417,0.041667)\dpicstop
+\dpicdraw (0.408333,0.072917)
+ --(0.408333,0.072917)\dpicstop
+\dpicdraw (0.408333,0.072917)
+ --(0.413889,0.072917)\dpicstop
+\dpicdraw (0.408333,0.072917)
+ ..controls (0.366667,0.072917) and (0.366667,0.135417)
+ ..(0.408333,0.135417)\dpicstop
+\dpicdraw (0.408333,0.135417)
+ --(0.413889,0.135417)\dpicstop
+\dpicdraw (0.408333,0.135417)
+ ..controls (0.391074,0.135417) and (0.377083,0.149408)
+ ..(0.377083,0.166667)
+ ..controls (0.377083,0.183926) and (0.391074,0.197917)
+ ..(0.408333,0.197917)\dpicstop
+\dpicdraw (0.408333,0.197917)
+ --(0.413889,0.197917)\dpicstop
+\dpicdraw (0.408333,0.197917)
+ ..controls (0.366667,0.197917) and (0.366667,0.260417)
+ ..(0.408333,0.260417)\dpicstop
+\dpicdraw (0.408333,0.260417)
+ --(0.413889,0.260417)\dpicstop
+\dpicdraw (0.408333,0.260417)
+ --(0.408333,0.260417)\dpicstop
+\dpicdraw (0.2,0.333333)
+ --(0,0.333333)\dpicstop
+\dpicdraw (0.408333,0.260417)
+ --(0.608333,0.260417)
+ --(0.608333,0.360417)\dpicstop
+\dpicdraw (0.408333,0.072917)
+ --(0.608333,0.072917)
+ --(0.608333,-0.027083)\dpicstop
+\end{tikzpicture}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/tranbody.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/tranbody.m4
new file mode 100644
index 00000000000..bf16300cf0d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/tranbody.m4
@@ -0,0 +1,6 @@
+line right 0.2
+up_
+A: transformer(,R,,,3) with .P1 at Here
+ line left 0.2 from A.P2
+ line right 0.2 from A.S2 then up 0.1
+ line right 0.2 from A.S1 then down 0.1
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/ujt.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/ujt.m4
new file mode 100644
index 00000000000..aa4e7084628
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/ujt.m4
@@ -0,0 +1,28 @@
+.PS
+# `ujt.m4'
+cct_init
+dwn = 1.0
+dsep = 0.15
+
+define(`demo_ujt',`Q: ujt(`$1',`$2',`$3',`$4')
+ "\sl B1" ifelse(`$5',,below,ljust) at last [].B1
+ "{\sl E}sp_" at 1.5 between last [].Bulk.c and last [].E
+ "\sl B2" ifelse(`$5',,above,ljust) at last [].B2
+ ')
+
+[demo_ujt(up_ dimen_,,,E,A)
+`"{\tt ujt(up\_ dimen\_,{,},E)}"' wid 1.45 ht 0.1 at Q.s+(0,-0.15) ]
+
+[demo_ujt(,,P,)
+`"{\tt ujt(,{,}P,)}"' at Q.s+(0.1,-dsep) below ] \
+with .Q.w at last [].Q.e+(0.85,0)
+
+[demo_ujt(,R,,)
+`"{\tt ujt(,R,{,})}"' at Q.s+(0,-dsep) below] \
+with .Q.w at last [].Q.e+(0.8,0)
+
+[demo_ujt(,R,P,)
+`"{\tt ujt(,R,P,)}"' at Q.s+(0,-dsep) below] \
+with .Q.w at last [].Q.e+(0.8,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/doc/woodchips.m4 b/Master/texmf-dist/doc/latex/circuit-macros/doc/woodchips.m4
new file mode 100644
index 00000000000..e792c135085
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/doc/woodchips.m4
@@ -0,0 +1,24 @@
+divert(-1)
+# `woodchips.m4'
+
+define(`grid',`[
+ psset_(linecolor=lightgray)
+ B: box invis wid 1.0 ht 0.3
+ d = 0.08
+ for x=B.ht to B.wid by d do {
+ line from B.nw+(x,0) thick 0.4 down B.ht left B.ht }
+ psset_(linecolor=black)
+ ]')
+
+divert(0)dnl
+.PS
+sinclude(Circuit_macros.dim)
+s_init(woodchips)
+
+ G: grid
+ f_box(Wood chips) with .w at G
+
+ f_box(color "lightgray" thickness 2 rad 2pt__,"\huge$n^{%g}$",4-1) \
+ with .w at G.e+(1.2,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic b/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic
new file mode 100644
index 00000000000..00c7c71c151
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic
@@ -0,0 +1,385 @@
+# dpictools.pic
+# General-purpose pic macros. Input this file using the m4 macro NeedDpicTools
+# or the pic statement copy "HOMELIB_/dpictools.pic" when HOMELIB_ is defined
+# or, generically, copy "<path>dpictools.pic"
+
+# Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under #
+# the LaTeX Project Public License. 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. #
+
+# findroot(function,left bound,right bound,tolerance,var name)
+# Solve function(x)=0 by the method of bisection
+# e.g. define parabola { $2 = ($1)^2 - 1 }
+# findroot( parabola, 0, 2, 1e-8, x )
+define findroot {$5 = 0; [ x_m = $2; x_M = $3
+ loop( $1(x_m,f_m);, abs(x_M-x_m)>$4,,
+ x_c = (x_m+x_M)/2
+ $1(x_c,f_c)
+ if sign(f_c)==sign(f_m) then {x_m=x_c} else {x_M=x_c};)
+ $5 := (x_m+x_M)/2 ] ; }
+
+# bisect(function,left bound,right bound, tolerance, var name)
+# Like findroot but uses recursion and without a [] box
+define bisect { x_m_$1 = $2; x_M_$1 = $3
+ x_c_$1 = (x_m_$1+x_M_$1)/2
+ if (abs(x_m_$1-x_M_$1) <= $4) then { $5 = x_c_$1 } else {
+ $1(x_m_$1,f_m_$1)
+ $1(x_c_$1,f_c_$1)
+ if (sign(f_c_$1)==sign(f_m_$1)) then { bisect($1,x_c_$1,x_M_$1,$4,$5) } \
+ else { bisect($1,x_m_$1,x_c_$1,$4,$5) } } }
+
+# case(i, alt1, alt2, ... ),
+# Case statement: execute alternative i
+# e.g., case(2, x=5, x=10, x=15) sets x to 10
+define case { exec sprintf("$%g",floor($1+0.5)+1); }
+
+# testexpr(i, expr1, expr2, ... )
+# Set i to index of the first true alternative
+# in a sequence of logical expressions, e.g.,
+# testexpr(i, 1>2, 1<2 ) sets i to 2; to 0
+# if no test is true.
+define testexpr { $1 = 0; [for i_testexpr=2 to $+ do {
+ exec sprintf("if $%g then {$1 := i_testexpr-1; i_testexpr=$+}",i_testexpr)
+ }] ; }
+
+# loop(initial,test,loopend,statements)
+# C-like loop. Commas in arg3 and arg4 must
+# be in quotes or parentheses, e.g.,
+# loop(i=1, i<=3, i+=1, print i) prints 1, 2, 3
+ld__ = 0
+define loop {ld__+=1
+ $1
+ for lx__[ld__]=0 to 1 do {
+ if $2 then { lx__[ld__]=0; $4; $3; } else { lx__[ld__]=1 }}
+ ld__-=1; }
+
+# array(var,expr1,expr2,...)
+# var[1]=expr1; var[2]=expr2,...
+define array {
+ for i_array=2 to $+ do { exec sprintf("$1[%g] = $%g",i_array-1,i_array); }}
+
+# posarray(Var,position1,position2,...)
+# Var[1]:position1; Var[2]:Position2,...
+define posarray {
+ for i_array=2 to $+ do { exec sprintf("$1[%g] : $%g",i_array-1,i_array); }}
+
+# slantbox(wid,ht,xslant,yslant,attributes)
+define slantbox { [
+ if "$1"=="" then { w = boxwid } else { w = $1 }
+ if "$2"=="" then { h = boxht } else { h = $2 }
+ if "$3"=="" then { xs = 0 } else { xs = $3 }
+ if "$4"=="" then { ys = 0 } else { ys = $4 }
+ NE: (w+xs,h+ys)/2 ; SE: (w-xs,-h+ys)/2
+ SW: (-w-xs,-h-ys)/2 ; NW: (-w+xs,h-ys)/2
+ N: 0.5 between NW and NE ; E: 0.5 between NE and SE
+ S: 0.5 between SE and SW ; W: 0.5 between SW and NW
+ C: 0.5 between SW and NE
+ line $5 from N to NE then to SE then to SW then to NW then to N
+ ] }
+# arraymax( data array, n, index name, value)
+# Find the index in array[1:n] of the first
+# occurrence of the max value. The value is
+# assigned if arg4 is non-blank. eg.,
+# array(x,4,9,8,6); arraymax( x,4,i )
+# assigns 2 to i, and arraymax( x,4,i,m )
+# assigns 2 to i and 9 to m
+define arraymax { { $3 = -1; if "$4" != "" then { $4 = 0 }; m_arrm = -1e25
+ for i_arrm=1 to $2 do { if $1[i_arrm] > m_arrm then {
+ $3 := i_arrm; m_arrm = $1[i_arrm] }}
+ if "$4" != "" then { $4 := m_arrm } } }
+
+# arraymin( data array, n, index name, value)
+# Like arraymax
+define arraymin { { $3 = -1; if "$4" != "" then { $4 = 0 }; m_arrm = 1e25
+ for i_arrm=1 to $2 do { if $1[i_arrm] < m_arrm then {
+ $3 := i_arrm; m_arrm = $1[i_arrm] }}
+ if "$4" != "" then { $4 := m_arrm } } }
+
+# copythru(macro_name,"datafile")
+# See the GNU pic manual
+# Implements "copy datafile thru macro_name"
+# for data separated by comma, spaces, or tabs
+define copythru {
+ sh "sed -e 's/^[ ]*/$1(/' -e 's/[ ]*$/)/' -e 's/[, ][ ]*/,/g' $2 \
+ > copy_tmp__"
+ copy "copy_tmp__"
+ sh "rm -f copy_tmp__";}
+
+# randn(array_name,n,mean,stddev)
+# Assign n Gaussian random numbers
+# in array_name[1] ... array_name[n]
+define randn {
+ if "$2"=="" then { n_randn = 1 } else { n_randn = $2 }
+ if "$3"=="" then { m_randn = 0 } else { m_randn = $3 }
+ if "$4"=="" then { s_randn = 1 } else { s_randn = $4 }
+ for i_randn=1 to n_randn by 2 do {
+ loop( t_randn=2, t_randn >= 1, u_randn = 2*rand()-1; v_randn = 2*rand()-1
+ t_randn = u_randn^2+v_randn^2 )
+ t_randn = sqrt( -2*loge(t_randn)/t_randn )
+ $1[i_randn] = u_randn*t_randn*s_randn+m_randn
+ if i_randn < n_randn then {
+ $1[i_randn+1] = v_randn*t_randn*s_randn+m_randn }
+ }
+ }
+
+# dfitpoints(V,n,m,P,mP)
+# Compute the controls in P[mP], P[mP+1]... for
+# the spline passing throught points V[m]...V[n]
+define dfitpoints {
+ if "$3"=="" then { m_dfit=0 } else { m_dfit=$3 }
+ if "$5"=="" then { mP_dfit=0 } else { mP_dfit=$5 }
+ n_dfit = $2; np_dfit = n_dfit-m_dfit
+ $4[mP_dfit]: $1[m_dfit]
+ for i_dfit=m_dfit+1 to n_dfit-1 do {
+ $4[mP_dfit+i_dfit-m_dfit]: $1[i_dfit]*(4/3) }
+ $4[mP_dfit+np_dfit]: $1[n_dfit]
+ $4[mP_dfit+1]: $4[mP_dfit+1]-$4[mP_dfit+0]/6 # forward substitution
+ d_dfit[1] = 1
+ for i_dfit = 2 to np_dfit-1 do { $4[mP_dfit+i_dfit]: \
+ $4[mP_dfit+i_dfit]-$4[mP_dfit+i_dfit-1]/d_dfit[i_dfit-1]/6
+ d_dfit[i_dfit] = 1-1/d_dfit[i_dfit-1]/36 }
+ for i_dfit= np_dfit-1 to 1 by -1 do { # backward substitution
+ $4[mP_dfit+i_dfit]: \
+ ($4[mP_dfit+i_dfit]-$4[mP_dfit+i_dfit+1]/6)/d_dfit[i_dfit] } }
+
+# dfitcurve(V,n,linetype,m (default 0))
+# Draw a spline through V[m],...V[n]
+# linetype=eg dotted. Works only with dpic.
+# The calculated control points P[i] satisfy
+# approximately:
+# P[0] = V[0]
+# P[i-1]/8 + P[i]*3/4 + P[i+1]/8 = V[i]
+# P[n] = V[n]
+# Like m4 macro fitcurve
+define dfitcurve { if "$4"=="" then { m_dfit=0 } else { m_dfit=$4 }
+ n_dfit = $2; np_dfit = n_dfit-m_dfit
+ M4P_[0]: $1[m_dfit]
+ case( min(max(np_dfit,-1),3)+1,
+ spline 0.551784 $3 from M4P_[0] to M4P_[0],
+ spline 0.551784 $3 from M4P_[0] to $1[n_dfit],
+ M4P_[3]: $1[n_dfit]; Q_dfit: (M4P_[3]-M4P_[0])/4
+ M4P_[1]: $1[m_dfit+1]-Q_dfit; M4P_[2]: $1[m_dfit+1]+Q_dfit
+ spline 0.551784 $3 from M4P_[0] to M4P_[1] then to M4P_[2] then to M4P_[3],
+ dfitpoints($1,$2,$4,M4P_,0) # draw using computed control points
+ spline 0.551784 $3 from M4P_[0] to 11/32 between M4P_[0] and M4P_[1] \
+ then to 5/32 between M4P_[1] and M4P_[2]
+ for i_dfit=2 to np_dfit-2 do { continue to M4P_[i_dfit] }
+ continue to 27/32 between M4P_[np_dfit-2] and M4P_[np_dfit-1] \
+ then to 21/32 between M4P_[np_dfit-1] and M4P_[np_dfit] \
+ then to M4P_[np_dfit]) }
+
+# histbins { data array name, n, [min], [max],
+# nbins, bin array name )
+# Generate the distribution of n values in
+# dataarray. If given, arg3 and arg4 specify
+# maximum and minimum data values, otherwise they
+# are calculated. Bins have index 0 to arg5-1
+define histbins { # dataarray, n, [min], [max], nbins, binarray
+{ if "$3" == "" then { arraymin($1,$2,mn_histb,n_histb)} else { n_histb = $3 }
+ if "$4" == "" then { arraymax($1,$2,mx_histb,m_histb)} else { m_histb = $4 }
+ f_histb = ($5-0.001)/(m_histb-n_histb)
+ for i_histb=0 to $5-1 do { $6[i_histb] = 0 }
+ for i_histb=1 to $2 do {
+ x_histb = floor(($1[i_histb]-n_histb)*f_histb)
+ if (x_histb >= 0) && (x_histb < $5) then { $6[x_histb] += 1 } }
+} }
+
+# dpquicksort(a,lo,hi,ix)
+# Given array a[lo:hi] and index
+# array ix[lo:hi] = lo,lo+1,lo+2,...hi,
+# sort a[lo:hi] and do identical exchanges on ix
+define dpquicksort { [ if $3 > $2 then {
+ pivot = $1[($2+($3))/2]
+ loop(lo = $2; hi = $3, lo <= hi,
+ loop(,$1[lo] < pivot, lo += 1 )
+ loop(,$1[hi] > pivot, hi -= 1 )
+ if lo < hi then {
+ tmp = $1[lo]; $1[lo] := $1[hi]; $1[hi] := tmp
+ tmp = $4[lo]; $4[lo] := $4[hi]; $4[hi] := tmp }
+ if lo <= hi then { lo += 1; hi -= 1 } )
+ if hi > $2 then { exec sprintf("dpquicksort($1,%g,%g,$4)",$2,hi) }
+ if lo < $3 then { exec sprintf("dpquicksort($1,%g,%g,$4)",lo,$3) }
+ } ] }
+
+# dprot(radians,x,y)
+# Evaluates to a rotated pair (like m4 rot_ )
+define dprot { cos($1)*($2)-sin($1)*($3),sin($1)*($2)+cos($1)*($3) }
+
+# 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
+ [r = $1; g = $2; b = $3
+ maxc = max(max(r,g),b)
+ minc = min(min(r,g),b)
+ if maxc==minc then { $4 := 0 } \
+ else {if maxc == r then {
+ $4 := pmod(60*((g-b)/(maxc-minc)),360) } \
+ else {if maxc == g then {
+ $4 := 60*((b-r)/(maxc-minc)) + 120 } \
+ else { $4 := 60*((r-g)/(maxc-minc)) + 240 }}}
+ if maxc == 0 then { $5 := 0 } else { $5 := 1 - (minc/maxc) }
+ $6 := maxc
+ ] }
+
+# hsvtorgb(h,s,v,r,g,b)
+# hsv color triple to rgb, h has range 0 to 360
+define hsvtorgb { $4 = 0; $5 = 0; $6 = 0
+ [h = pmod($1,360)/60; s = $2; v = $3
+ i = floor(h)
+ f = h-i
+ m = v*(1-s)
+ n = v*(1-s*f)
+ k = v*(1-s*(1-f))
+ case(i+1,
+ $4 := v; $5 := k; $6 := m,
+ $4 := n; $5 := v; $6 := m,
+ $4 := m; $5 := v; $6 := k,
+ $4 := m; $5 := n; $6 := v,
+ $4 := k; $5 := m; $6 := v,
+ $4 := v; $5 := m; $6 := n)
+ ] }
+
+# cmyktorgb(c,m,y,k,r,g,b)
+# cmyk colors in percent to rgb
+define cmyktorgb {
+ $5 = 1-min(1,($1+$4)/100)
+ $6 = 1-min(1,($2+$4)/100)
+ $7 = 1-min(1,($3+$4)/100)
+ }
+
+# rgbtocmyk(r,g,b,c,m,y,k)
+# rgb to cmyk colors out of 100
+define rgbtocmyk {
+ $7 = min(1-$1,min(1-$2,1-$3))*100
+ $4 = (1-$7-$1)/(1-$7)*100
+ $5 = (1-$7-$2)/(1-$7)*100
+ $6 = (1-$7-$3)/(1-$7)*100 }
+
+# DefineRGBColor(colorname,r,g,b)
+# Arguments are in the range 0 to 1
+# Define dpic macro colorname according to the
+# postprocessor specified by dpic command-line
+# option; colorname then evaluates to a string
+define DefineRGBColor {
+case(dpicopt, # The order of the following is defined in dpic source:
+# MFpic:
+ command sprintf("\mfpdefinecolor{_$1__}{rgb}{%g,%g,%g}",$2,$3,$4)
+ define $1 {"_$1__"} ,
+# Mpost:
+ define $1 {sprintf("(%g,%g,%g)",$2,$3,$4)} ,
+# PDF:
+ define $1 {sprintf("%g %g %g",$2,$3,$4)} ,
+# PGF:
+ command sprintf("\definecolor{_$1__}{rgb}{%g,%g,%g}",$2,$3,$4)
+ define $1 {"_$1__"} ,
+# Pict2e:
+ command sprintf("\definecolor{_$1__}{rgb}{%g,%g,%g}",$2,$3,$4)
+ define $1 {"_$1__"} ,
+# PS:
+ define $1 {sprintf("%g %g %g",$2,$3,$4)} ,
+# PSfrag:
+ define $1 {sprintf("%g %g %g",$2,$3,$4)} ,
+# PSTricks:
+ command sprintf("\definecolor{_$1__}{rgb}{%g,%g,%g}",$2,$3,$4)
+ define $1 {"_$1__"} ,
+# SVG:
+ define $1 {sprintf("rgb(%g,%g,%g)",int($2*255),int($3*255),int($4*255))} ,
+# TeX:
+ command sprintf("\definecolor{_$1__}{rgb}{%g,%g,%g}",$2,$3,$4)
+ define $1 {"_$1__"} ,
+# tTeX:
+ command sprintf("\definecolor{_$1__}{rgb}{%g,%g,%g}",$2,$3,$4)
+ define $1 {"_$1__"} ,
+# xfig:
+ define $1 {"black"}
+ ) }
+
+# DefineHSVColor(colorname,h,s,v)
+# Like DefineRGBColor but takes arguments
+# h in [0,360], s in [0,1], and v in [0,1]
+define DefineHSVColor { hsvtorgb($2,$3,$4,r_HSVRGB,g_HSVRGB,b_HSVRGB)
+ DefineRGBColor($1,r_HSVRGB,g_HSVRGB,b_HSVRGB) }
+
+# DefineCMYKColor(colorname,c,m,y,k)
+# Like DefineRGBColor but arguments in percent
+define DefineCMYKColor { cmyktorgb($2,$3,$4,r_CMYKRGB,g_CMYKRGB,b_CMYKRGB)
+ DefineRGBColor($1,r_CMYKRGB,g_CMYKRGB,b_CMYKRGB) }
+
+# ShadeObject(DrawRoutineName, n, colorseq)
+# colorseq = 0,r0,g0,b0,
+# frac1,r1,g1,b1,
+# frac2,r2,g2,b2,
+# ...
+# 1,rn,gn,bn
+# with 0 < frac1 < frac2 < ... < 1
+#
+# calls DrawRoutineName(frac,r,g,b)
+# n+1 times for frac = 0, 1/n, 2/n, ... 1
+# with rgb args interpolated (in hsv space)
+# between colorseq points
+#
+# eg B: box; define HorizShade { line right B.wid thick B.ht/100/(1bp__) \
+# from (0,-($1)*B.ht) outlined rgbstring($2,$3,$4) }
+# ShadeObject(HorizShade, 100, 0,1,0,0, 1,0,0,1) at B
+#
+define ShadeObject { [ Origin: Here; nSteps = abs($2)
+ nextP = $3; nextR = $4; nextG = $5; nextB = $6
+ nextarg = 7
+ thisP = nextP
+# Creates [] wid 0 ht 0 at (0,0):
+ if $2 < 0 then { rgbtohsv(nextR,nextG,nextB,nextH,nextS,nextV) } \
+ else { rgbtohsv(nextR^2,nextG^2,nextB^2,nextH,nextS,nextV) }
+ if nextP*nSteps >= 1 then { nextP = 0 }
+ $1(nextP,nextR,nextG,nextB)
+ for stepnum = 1 to nSteps do {
+ if stepnum > nextP*nSteps then {
+ thisP = nextP; thisH = nextH; thisS = nextS; thisV = nextV
+ exec sprintf("nextP = $%g; nextR = $%g; nextG = $%g; nextB = $%g",\
+ nextarg,nextarg+1,nextarg+2,nextarg+3);
+ nextarg +=4 }
+ if nextP != thisP then {
+ rgbtohsv(nextR^2,nextG^2,nextB^2,nextH,nextS,nextV)
+ if thisS == 0 then { thisH = nextH }
+ if nextS == 0 then { nextH = thisH }
+ if thisH-nextH > 180 then { nextH += 360 } \
+ else { if nextH-thisH > 180 then { thisH +=360 } } }
+ if nextP > thisP then {
+ x = (stepnum/nSteps-thisP)/(nextP-thisP)
+ currP = thisP*(1-x) + nextP*x
+ currH = thisH*(1-x) + nextH*x
+ currS = thisS*(1-x) + nextS*x
+ currV = thisV*(1-x) + nextV*x
+ hsvtorgb(currH,currS,currV,cRsq,cGsq,cBsq)
+ if $2 < 0 then { $1(currP,cRsq,cGsq,cBsq) } \
+ else { $1(currP,sqrt(cRsq),sqrt(cGsq),sqrt(cBsq)) } }
+ }
+ exec sprintf("$%g",nextarg)
+ ] }
+
+# Useful for debugging:
+# Print Pos:(Pos.x,Pos.y)
+define prpos { { print sprintf("$1:(%g,%g)",($1).x,($1).y) } }
+
+define prval { print sprintf("$1=%g",$1) }
+define prval2 { print sprintf("$1=%g, $2=%g",$1,$2) }
+define prval3 { print sprintf("$1=%g, $2=%g, $3=%g",$1,$2,$3) }
+
+# prow(array name,lo,hi)
+# print array[lo:hi] as a row
+# eg array(x,6,4,5); prow(x,1,3)
+define prow {
+ sh "echo -n \"print \\"\" > $1_xxx"
+ for i=$2 to $3-1 do { sh sprintf("echo -n \"%g \" >> $1_xxx",$1[i]) }
+ sh sprintf("echo \"%g\\"\" >> $1_xxx",$1[$3])
+ copy "$1_xxx"
+ sh "rm $1_xxx"
+ }
+
+define rnd {int($1+sign($1)/2)} # round function
+
+# print " *** dpic: dpictools.pic processed"
+define dpictools {1}
+# dpictools end
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ABlogix.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ABlogix.m4
new file mode 100644
index 00000000000..0be66cb96d6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ABlogix.m4
@@ -0,0 +1,51 @@
+.PS
+# `ABlogix.m4'
+log_init
+
+linewid = 0.4
+
+# A more complex expression
+ F: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))))
+
+ Loopover_(`v_', `"$v_$" at F.In`'v_ above', x0,x1,x2,x3,x4)
+ "\sl Out" ljust at F.Out
+ `"{\tt \shortstack[l]{Autologix(And(Or(x3,x1,\~{}x0),\\
+ \quad Nor(Or(x3,Not(x2),\~{}x1,x0),And(x4,Or(x2,x1,\~{}x0),\
+ Xor(x2,\~{}x1)))))}}"' wid 440pt__ ht 20pt__ \
+ with .w at F.sw+(0,-0.25)
+# Inputs on the left with vert offset in L_units
+define(`Doff',LV;offset=25)
+ G: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))),
+ Doff*L_unit) \
+ with .sw at F.Out+(0.2,-0.7)
+
+ Loopover_(`v_', `"$v_$" wid 11pt__ at G.In`'v_ rjust ', x0,x1,x2,x3,x4)
+ "\sl Out" ljust at G.Out
+ "{\tt ...,Doff*L\_unit)}" at G.s+(0,-10pt__)
+
+# A more complex expression
+define(`Eoff',R)
+ E: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))),
+ Eoff) \
+ with .nw at F.sw+(0,-1.35)
+
+ Loopover_(`v_', `"$v_$" at E.In`'v_ above ', x0,x1,x2,x3,x4)
+ "\sl Out" ljust at E.Out
+ "{\tt ...,Eoff)}" at E.s+(0,-10pt__)
+
+# Inputs on the left with vert offset in L_units
+define(`Foff',LRV;offset=17.25)
+ D: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))),
+ Foff*L_unit) \
+ with .sw at E.Out1+(0.2,-0.51)
+
+ Loopover_(`v_', `"$v_$" wid 11pt__ at D.In`'v_ rjust ', x0,x1,x2,x3,x4)
+ "\sl Out" ljust at D.Out
+ "{\tt ...,Foff*L\_unit)}" at D.s+(0,-10pt__)
+
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Adder.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Adder.m4
new file mode 100644
index 00000000000..1dd2dccd2bc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Adder.m4
@@ -0,0 +1,75 @@
+.PS
+# Adder.m4
+log_init
+
+del = linewid/4
+
+[ # full adder using gates
+ A: dot; {"\sf A" rjust}; line right
+ Xor1: XOR_gate with .In1 at Here
+ dy = Xor1.In1.y-Xor1.In2.y
+ B: dot(at (A,Xor1.In2)); {"\sf B" rjust}; line to Xor1.In2
+ line from Xor1.Out right 2*del+dy
+ Xor2: XOR_gate with .In1 at Here
+
+ Co: Autologix(Or(And(X1,X2),And(A,B)),N) with .nw at Xor2.sw+(-del,-del/2)
+ line from Co.In1 to (Co.In1,Xor2.In2) then to Xor2.In2
+ dot(at (Xor1.Out+(del,0))); line to (Here,Co.In2) then to Co.In2
+ dot(at (Xor1.In1-(del,0))); line to (Here,Co.In3) then to Co.In3
+ dot(at (Xor1.In2-(del+dy,0))); line to (Here,Co.In4) then to Co.In4
+ line right del from Co.Out1; dot; {"\sf Co" ljust }
+ dot(at (Here,Xor2.Out)); {"\sf S" ljust}; line to Xor2.Out
+ Ci: dot(at (B,(0.5 between Xor2.s and Co.n))); line to (Co.In1,Here); dot
+ "\sf Ci" rjust at Ci
+ ]
+
+[ # truth table
+ griddim = linewid*0.4
+ define(`row',`T: (0,-(`$1')*griddim*0.8)
+ Loopover_(`v',`"\sf v" at T; T: T+(griddim,0)', shift($@))')
+
+ [row(0,A,B,Ci,Co,S)]
+ line thick 2 color "gray" right 4.5*griddim \
+ with .c at last [].c+(0,-griddim/2)
+
+ [row(1,0,0,0,0,0)
+ row(2,0,0,1,0,1)
+ row(3,0,1,0,0,1)
+ row(4,0,1,1,1,0)
+ row(5,1,0,0,0,1)
+ row(6,0,1,1,0,0)
+ row(7,1,1,0,1,0)
+ row(8,1,1,1,1,1) ] with .n at last [].c+(0,-griddim)
+
+ ] with .nw at 1st [].ne+(linewid,0)
+
+[ # cascade of n-bit adders
+define(`nbitadder',
+`FlipFlopX(wid 2*linewid fill_(0.9),
+ $n$-\sf\scriptsize bit" "\sf\scriptsize adder,
+ :, I:;I:;;;I:;I:, I:, O:;;;O: ) `$3'
+ `"\ldots"' at last [].Chip.n + (0,arrowht)
+ `"\ldots"' at last [].Chip.s - (0,arrowht)
+ ifelse(`$1',,,
+ `"$\;\;x_{$1}$" at last [].N6.end above
+ "$`s_'{$1}$" at last [].S4.end below
+ "$y_{$1}\;\;$" at last [].N5.end above')
+ ifelse(`$2',,,
+ `"$\quad{}x_{$2}$" at last [].N2.end above
+ "$y_{$2}\quad\;\;$" at last [].N1.end above
+ "$`s_'{$2}$" at last [].S1.end below ')
+ ')
+
+P: nbitadder(0,n{-}1)
+ {"$c_o$" at P.E1.end ljust }
+ {"$c_n$" at P.W1.end above }
+Q: nbitadder(n,2n{-}1, with .E1.end at P.W1.end)
+ arrow left arrowht from Q.W1.end ht arrowht*4/5 wid arrowwid*5/4
+ { "\ldots" at Here+(-10pt__,0) }
+R: nbitadder(,kn{-}1, with .E1.end at Here-(20bp__,0))
+ arrow left arrowht from R.W1.end ht arrowht*4/5 wid arrowwid*5/4
+ {"$c_{kn}$" rjust }
+
+ ] with .nw at 1st [].sw+(0,-0.5)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Alogix.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Alogix.m4
new file mode 100644
index 00000000000..1bafd90681f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Alogix.m4
@@ -0,0 +1,115 @@
+.PS
+# `Alogix.m4'
+log_init
+
+# A modest expression in default form
+A: Autologix(
+ Nand(And(Or(A,C),Or(B,~C),Or(~A,B,C)),Ck);
+ Nand(~A,B)@with .n at last [].s+(0,-2bp__))
+ move left 10bp__ from A.InCk
+ "\sl Out1" at A.Out1 ljust
+ "\sl Out2" at A.Out2 ljust
+ Loopover_(`v_', `"$v_$" at A.In`'v_ above ', A,B,C,Ck)
+ `"\shortstack[l]{
+ \tt Autologix( \\ \tt \quad
+ Nand(And(Or(A,C),Or(B,\~{}C),Or(\~{}A,B,C)),Ck);\\ \tt \quad
+ Nand(\~{}A,B))@with .n at last [].s+(0,-2bp\_\_))}"'\
+ wid 288bp__ ht 32bp__ with .nw at A.sw+(0,-0.10)
+
+# Draw a tree of gates only. The ~ has been
+# replaced by NOT gates.
+B: Autologix(Or(And(B,Not(C)),And(Not(A),B,C)),N) \
+ with .sw at A.e+(1.3,-0.5)
+ "{\sl Out}" at B.Out above ljust
+ `"\shortstack[l]{\tt B: Autologix( \\ \tt \
+ Or(And(B,Not(C)),And(Not(A),B,C)),N)}"' \
+ wid 242pt__ ht 20pt__ at B.s+(0,-0.2)
+ for_(1,4,1,`"{\sf\small\sl B.In`'m4x}" at B.In`'m4x rjust')
+ "{\sf\small\sl B.In5}" at B.In5+(0,-1.5bp__) rjust
+
+# Here is how to include an arbitrary circuit
+# that is not one of the standard gates.
+# First, define the circuit with a name ending
+# in _gate. Make sure its inputs are on the left
+# and named In1, In2, ... and the output Out
+# is on the right.
+define(`SR_gate',`[
+ S: NOR_gate
+ R: NOR_gate at S+(0,-L_unit*(AND_ht+4))
+ w = (S.Out.x-R.In1.x)/3
+ v = 2*L_unit
+ line right_ dimen_/2 from S.Out
+ Out: Here
+ TR: R.In1-(v,0)
+ line from S.Out+(v,0) down w*3/2 then left S.Out.x-TR.x+v down w \
+ then to TR then to R.In1
+ TS: S.In2-(v,0);
+ line from R.Out right v then up w*3/2 then left R.Out.x-TS.x+v up w \
+ then to TS then to S.In2
+ In1: S.In1
+ In2: R.In2 ]')
+# Now define the function by which the circuit
+# will be invoked:
+define(`SRff',`_AutoGate(SR,$@)')
+
+# You are done. Here is an example:
+G: [
+ F: Autologix(SRff(And(x,y),Nand(x,y)),LRV)
+
+ "$x$" at F.Inx rjust
+ "$y$" at F.Iny rjust
+ "\sl Out" at F.Out ljust
+ ] with .sw at A.n+(0.5,-0.25)
+ `"{\tt Autologix(SRff(And(x,y),Nand(x,y)),LRV)}"' wid 253pt__ ht 7pt__ \
+ with .w at last [].sw+(0,-10pt__)
+
+undefine(`extras')
+#efine(`extras')
+
+ifdef(`extras',`
+ Q1: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D))) \
+ with .nw at A.sw+(0,-61bp__)
+ Loopover_(`x',`"\sf x" at last [].In`'x above',A,B,C,D)
+
+ `"\shortstack[l]{%
+ \tt Q1: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),<options>)\\
+ \tt Loopover\_(`x',`\"\sf x\" at last [].In`'x above',A,B,C,D)}"' \
+ wid 350bp__ ht 20bp__ with .nw at Q1.sw+(0,-10pt__)
+
+ Q2: Autologix(Nor(Nor(A,And(B,~C)),Nand(Not(B),D)),V) \
+ with .nw at last "".sw+(0,-14bp__)
+ Loopover_(`x',`"\sf x" at last [].In`'x above',A,B,C,D)
+ "\sf V" at last [].se above rjust
+
+ Q3: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),R) \
+ with .nw at last [].sw+(0,-0.2)
+ Loopover_(`x',`"\sf x" at last [].In`'x above',A,B,C,D)
+ "\sf R" at last [].se above rjust
+
+ Q4: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),RV) \
+ with .nw at last [].sw+(0,-0.2)
+ Loopover_(`x',`"\sf x" at last [].In`'x above',A,B,C,D)
+ "\sf RV" at last [].se above rjust
+
+ Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),LRV) \
+ with .Out at Q4.Out+(3.5,0)
+ Loopover_(`x',`"\sf x" at last [].In`'x rjust',A,B,C,D)
+ "\sf LRV" at last [].se above rjust
+
+ Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),LR;offset=-L_unit*1.5) \
+ with .Out at Q3.Out+(3.5,0)
+ Loopover_(`x',`"\sf x" at last [].In`'x rjust',A,B,C,D)
+ "\sf LR" at last [].se above rjust
+
+ Autologix(Nor(Nor(A,And(B,~C)),Nand(Not(B),D)),LV;offset=L_unit*2) \
+ with .Out at Q2.Out+(3.5,0)
+ Loopover_(`x',`"\sf x" at last [].In`'x rjust',A,B,C,D)
+ "\sf LV" at last [].se above rjust
+
+ Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),L) \
+ with .Out at Q1.Out+(3.5,0)
+ Loopover_(`x',`"\sf x" at last [].In`'x rjust',A,B,C,D)
+ "\sf L" at last [].se above rjust
+')
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Autologix.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Autologix.m4
new file mode 100644
index 00000000000..1e4774d9e5c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Autologix.m4
@@ -0,0 +1,57 @@
+.PS
+# `Autologix.m4'
+log_init
+
+A: [
+F: Autologix(
+ And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(Or(x2,x1,~x0),Xor(x2,~x1))));
+ ~x0;
+ And(~x0,Nand(~x1,x3))@ with .nw at 2nd last [].sw+(0,-dimen_*2/3);
+ Not(x1))
+ for_(1,4,1,`"\sl Out`'m4x" at F.Out`'m4x ljust')
+ Loopover_(`v_', `"\sl In$v_$" at F.In`'v_ above ',x0,x1,x3)
+# for_(1,3,1,`"\sl In`'m4x=" at F.In`'m4x+(0,10pt__) above')
+ "\sl In$x2$" at F.Inx2 +(-10pt__,0) above
+# "\sl In4=" at F.In4+(-10pt__,10pt__) above
+ for_(1,3,1,`"\sl In`'m4x" at F.In`'m4x')
+ "\sl In17" at F.In17
+G: Autologix(
+ And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(Or(x2,x1,~x0),Xor(x2,~x1))));
+ ~x0;
+ And(~x0,Nand(~x1,x3))@ with .nw at 2nd last [].sw+(0,-dimen_*2/3);
+ Not(x1),
+ N) with .Out1 at F.Out1+(6*dimen_,0)
+ for_(1,4,1,`"\sl Out`'m4x" at G.Out`'m4x ljust')
+ "\sl In1" at G.In1 rjust
+ "\sl In2" at G.In2 rjust
+ "\sl In`'m4nargs" at G.In`'m4nargs rjust
+ "\tt\ldots ,N)" wid 0.25 at (G.Out2,G.Out4) rjust
+]
+
+S: `"\def\tld{\char126}\shortstack[l]{\tt Autologix(\\\tt
+ \tt\quad{}And(Or(x3,x1,\tld{}x0),Nor(Or(x3,Not(x2),\tld{}x1,x0),
+ And(Or(x2,x1,\tld{}x0),Xor(x2,\tld{}x1))));\\
+ \tt\quad{}\tld{}x0;\\
+ \tt\quad{}And(\tld{}x0,Nand(\tld{}x1,x3))@
+ with .nw at 2nd last [].sw+(0,-dimen\_*2/3);\\
+ \tt\quad{}Not(x1))}"' \
+ ht 58pt__ wid 520pt__ with .nw at A.sw+(0,-15pt__)
+
+B: [
+F: #utologix(
+ And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(Or(x2,x1,~x0),Xor(x2,~x1))));
+ ~x0;
+ And(~x0,Nand(~x1,x3))@ with .ne at 2nd last [].se+(0,-dimen_*2/3);
+ Not(x1),
+ M)
+ for_(1,4,1,`"\sl Out`'m4x" at F.Out`'m4x rjust')
+ Loopover_(`v_', `"\sl In$v_$" at F.In`'v_ above ',x0,x1,x3)
+ "\sl In$x2$" at F.Inx2 +(10pt__,0) above
+ `"\tt\ldots @ with .ne at 2nd last [].se+(0,-dimen\_*2/3);Not(x1),M)"'\
+ wid 200pt__ at F.s below
+] with .n at S.s+(0,-0.1)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Ball.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Ball.m4
new file mode 100644
index 00000000000..8c022223eff
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Ball.m4
@@ -0,0 +1,140 @@
+% Ball.m4 stand-alone (PDF)LaTeX example
+%
+% Usage: type
+% m4 pgf.m4 Ball.m4 | dpic -g > Ball.tex; pdflatex Ball
+% or:
+% m4 pstricks.m4 Ball.m4 | dpic -p > Ball.tex; latex Ball; dvips Ball
+%
+\documentclass{article}
+ifpgf(`\usepackage{tikz}',`\usepackage{pstricks,pst-grad}')
+\pagestyle{empty}
+\begin{document}
+%
+.PS
+threeD_init
+command "\small{"
+
+ viewazimuth = 15 # Set view angles in degrees
+ viewelevation = 35
+ setview(viewazimuth,viewelevation)
+
+#def_bisect # Bring in the equation solver
+ NeedDpicTools
+
+ rectwid = 3.2 # basic dimensions
+ rectht = 2
+ alpha = rectht/3
+
+ # Rectangle
+ ifpstricks(
+ `command "\pscustom[fillstyle=gradient,gradmidpoint=1.0,%"
+ command sprintf("gradbegin=gray,gradend=white,gradlines=%g]{",rectwid*200)')
+ line from project(-rectht/2,-rectwid*1/3,0) \
+ to project( rectht/2,-rectwid*1/3,0) \
+ then to project( rectht/2, rectwid*2/3,0) \
+ then to project(-rectht/2, rectwid*2/3,0) \
+ then to project(-rectht/2,-rectwid*1/3,0)
+ ifpstricks(command "}%")
+
+ define(`C3D',`0,0,alpha') # Centre of the sphere
+ C: project(C3D)
+
+ # Shaded sphere
+ ifelse(m4postprocessor,pstricks,
+ `Highlight: project(sum3D(C3D,rot3Dz(-15*dtor_,rot3Dy(-60*dtor_,alpha,0,0))))
+ command "\pscustom[fillstyle=gradient,gradmidpoint=0.0,%"
+ command sprintf("gradbegin=gray,gradend=white,gradlines=%g,%%",alpha*200)
+ command "GradientCircle=true,GradientScale=1.5,%"
+ command sprintf("GradientPos={(%g,%g)}]{",Highlight.x,Highlight.y)
+ circle rad alpha at C
+ command "}%"',
+ m4postprocessor,pgf,
+ `command sprintf(\# A little too dark, maybe
+ "\dpicdraw[ball color=white](%g,%g) circle (%gin)\dpicstop",\
+ C.x,C.y,alpha/2.54)',
+ `circle rad alpha at C fill_(1) ')
+
+ S: "$S$" at project(0,0,0) rjust # The sphere bottom touch point
+ "$\alpha$" at 0.5<S,C> rjust
+
+ define(`N3D',`0,0,2*alpha') # North pole
+ N: "N" at project(N3D) ljust above
+
+ phi = 65*dtor_
+ define(`Phat3D',`rot3Dz(phi,alpha*2.7,0,0)')
+ Phat: "$\hat{P}$" at project(Phat3D) ljust
+
+ X: project(rectht/2*0.8,0,0)
+ Y: project(0,rectwid/2*0.8,0)
+
+`define' linevis { # ratio # Visibility function for lines fom S to Xb
+ $2 = distance(($1 between S and Xb),C)-alpha }
+
+`define' invisline { # name # Draw dashed invisible part of line in
+ Xb: $1 # the plane
+ bisect( linevis, 0, 1, 1e-8, x )
+ line dashed from S to x between S and Xb chop 0 chop 0.05 }
+
+thinlines_ # axes
+ invisline(X)
+ arrow to X chop 0.05 chop 0; "$x,\:\xi$" at Here+(0,3pt__) below
+ invisline(Y)
+ arrow to Y chop 0.05 chop 0; "$y,\:\eta$" ljust
+ line dashed from S to N chop 0 chop 0.05
+ arrow up alpha*0.5 chop 0.05 chop 0 ; "$z,\:\zeta$" above ljust
+ invisline(Phat)
+ line to Phat chop 0.05 chop 0
+ arc ccw -> rad alpha from project(alpha/2,0,0) to \
+ project(rot3Dz(phi,alpha/2,0,0))
+ "$\phi$" below at 0.5 between last arc.start and last arc.end
+
+ # vector (ratio along (N to Phat))
+define(`ray',`sum3D(N3D,sprod3D($1,diff3D(Phat3D,N3D)))')
+`define' rayvis { # ratio
+ $2 = length3D(diff3D(ray($1),C3D))-alpha }
+
+ bisect( rayvis, 1e-3, 1, 1e-8, p ) # Find P
+ P: "$P$" at project(ray(p)) ljust above
+
+thicklines_
+ line dashed from N to P chop 0 chop 0.05
+ line to Phat chop 0.05 chop 0
+
+define(`meridian',`rot3Dz(phi,rot3Dy(-($1),alpha,0,0))')
+`define' meridianvis { # angle # Visibility function on the meridian
+ $2 = dot3D(meridian($1),View3D) }
+
+thinlines_ # Draw the meridian
+ bisect( meridianvis, 0, pi_, 1e-8, y )
+ n = 0
+ for ang = y-pi_ to y by pi_/20 do {
+ Q[n]: project(sum3D(C3D,meridian(ang))); n+=1 }
+ fitcurve(Q,n-1)
+ n = 0
+ for ang = y to y+pi_ by pi_/20 do {
+ Q[n]: project(sum3D(C3D,meridian(ang))); n+=1 }
+ fitcurve(Q,n-1,dashed)
+
+define(`equator',`rot3Dz($1,alpha,0,0)')
+`define' equatorvis { # angle # Visibility function on the equator
+ $2 = dot3D(View3D,equator($1)) }
+
+ bisect( equatorvis, 0, pi_, 1e-8, y )
+ n = 0
+ for ang = y-pi_ to y by pi_/20 do {
+ Q[n]: project(sum3D(C3D,equator(ang))); n+=1 }
+ fitcurve(Q,n-1)
+ n = 0
+ for ang = y to y+pi_ by pi_/20 do {
+ Q[n]: project(sum3D(C3D,equator(ang))); n+=1 }
+ fitcurve(Q,n-1,dashed)
+
+ line dashed from C to P # beta
+ line dashed from C to project(sum3D(C3D,equator(phi)))
+ arc ccw -> from 0.6 along_(last line) to 0.6 between C and P
+ "$\beta$" above
+
+command "}"
+.PE
+%
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Blogix.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Blogix.m4
new file mode 100644
index 00000000000..b2d44c5222f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Blogix.m4
@@ -0,0 +1,87 @@
+.PS
+# `Blogix.m4'
+log_init
+
+linewid = 0.4
+
+# A more complex expression
+ F: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))))
+
+ Loopover_(`v_', `"$v_$" at F.In`'v_ above', x0,x1,x2,x3,x4)
+ "\sl Out" ljust at F.Out
+ `"{\tt \shortstack[l]{Autologix(And(Or(x3,x1,\~{}x0),\\
+ \quad Nor(Or(x3,Not(x2),\~{}x1,x0),And(x4,Or(x2,x1,\~{}x0),%\
+ Xor(x2,\~{}x1)))))}}"' wid 440pt__ ht 20pt__ \
+ with .w at F.sw+(0,-0.25)
+# Inputs on the left with vert offset in L_units
+define(`Doff',LV;offset=25)
+ G: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))),
+ Doff*L_unit) \
+ with .sw at F.Out+(0.2,-0.7)
+
+ Loopover_(`v_', `"$v_$" wid 11pt__ at G.In`'v_ rjust ', x0,x1,x2,x3,x4)
+ "\sl Out" ljust at G.Out
+ "{\tt ...,Doff*L\_unit)}" at G.s+(0,-10pt__)
+
+# A more complex expression
+define(`Eoff',R)
+ E: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1))));
+ And(~x0,Nand(~x1,x3)),
+ Eoff) \
+ with .nw at F.sw+(0,-1.5)
+
+ Loopover_(`v_', `"$v_$" at E.In`'v_ above ', x0,x1,x2,x3,x4)
+ "\sl Out1" ljust at E.Out1
+ "\sl Out2" ljust at E.Out2
+ "{\tt ...,Eoff)}" at E.s+(0,-10pt__)
+
+# Inputs on the left with vert offset in L_units
+define(`Foff',LRV;offset=17)
+ D: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))),
+ Foff*L_unit) \
+ with .sw at E.Out1+(0.2,-0.5)
+
+ Loopover_(`v_', `"$v_$" wid 11pt__ at D.In`'v_ rjust ', x0,x1,x2,x3,x4)
+ "\sl Out" ljust at D.Out
+ "{\tt ...,Foff)}" at D.s+(0,-10pt__)
+
+# Here's how to include an arbitrary circuit
+# that isn't one of the standard gates.
+# First, define the circuit with a name ending
+# in _gate. Make sure its inputs are on the left
+# and named In1, In2, ... and the output Out
+# is on the right.
+define(`SR_gate',`[
+ S: NOR_gate
+ R: NOR_gate at S+(0,-L_unit*(AND_ht+4))
+ w = (S.Out.x-R.In1.x)/3
+ v = 2*L_unit
+ line right_ dimen_/2 from S.Out
+ Out: Here
+ TR: R.In1-(v,0)
+ line from S.Out+(v,0) down w*3/2 then left S.Out.x-TR.x+v down w \
+ then to TR then to R.In1
+ TS: S.In2-(v,0);
+ line from R.Out right v then up w*3/2 then left R.Out.x-TS.x+v up w \
+ then to TS then to S.In2
+ In1: S.In1
+ In2: R.In2 ]')
+# Now define the function by which the circuit
+# will be invoked, with a preceding _:
+define(`SRff',`_AutoGate(SR,$@)')
+
+# You're done. Here is an example:
+ F: Autologix(Or(y,SRff(And(x,y),Nand(x,y)))) \
+ with .nw at 2nd last [].sw+(0,-0.5)
+
+ "\sl Out" at F.Out ljust
+ "$x$" at F.Inx above
+ "$y$" at F.Iny above
+ `"{\tt Autologix(Or(y,SRff(And(x,y),Nand(x,y))))}"' wid 267pt__ ht 7pt__ \
+ with .w at last [].sw+(0,-10pt__)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Btree.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Btree.m4
new file mode 100644
index 00000000000..ebe09864331
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Btree.m4
@@ -0,0 +1,32 @@
+.PS
+# Btree.m4
+# One way to draw a binary tree using pic macros
+gen_init
+circlerad = 0.35
+
+define n { [C: circle fill_(0.9) $1
+ if "$2" != "" then {
+ L: $2 with .ne at C.s-(circlerad/20, circlerad/2)
+ line from C to L.C chop }
+ if "$3" != "" then {
+ R: $3 with .nw at C.s+(circlerad/20,-circlerad/2)
+ line from C to R.C chop }
+ ] }
+
+# Redrawn from T. A. Standish, "Data Structure Techniques," Addison-Wesley 1980.
+# Node data:
+define Sirius { n("Sirius",Canopus,Vega) }
+define Canopus { n("Canopus",AlphaCentauri,Capella) }
+define AlphaCentauri { n("Alpha" "Centauri",Achernar,Arcturus) }
+define Arcturus { n("Arcturus",Betelgeux) }
+define Betelgeux { n("Betelgeux",BetaCentauri) }
+define Capella { n("Capella",Rigel) }
+define Rigel { n("Rigel",Procyon) }
+define Achernar { n("Achernar") }
+define BetaCentauri { n("Beta" "Centauri") }
+define Procyon { n("Procyon") }
+define Vega { n("Vega") }
+
+# Build the tree from the root
+S: Sirius
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Buttons.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Buttons.m4
new file mode 100644
index 00000000000..1eab236249b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Buttons.m4
@@ -0,0 +1,114 @@
+.PS
+# Buttons.m4
+gen_init
+NeedDpicTools
+
+divert(-1)
+#################################################################
+
+ `RoundButton(diameter,hue,linedensity)
+ hue 0=red, 60=yellow, 120=green ...'
+define(`RoundButton',`[
+# Colors and radius:
+ hue = ifelse(`$2',,60,`$2')
+ crad = ifelse(`$1',,circlerad,(`$1')/2)
+ linedensity = ifelse(`$3',,150/scale,`$3') # default 150 lines per inch
+ hsvtorgb(hue, 1, 1, r1,g1,b1)
+ hsvtorgb(hue-5, 1,0.9, r2,g2,b2)
+ hsvtorgb(hue-10,1,0.5, r3,g3,b3)
+# Shaded main disk
+ define RBbackground {
+ circle rad crad*($`'1) thick lthk at C outlined rgbstring($`'2,$`'3,$`'4)
+ }
+ C: circle invis rad crad at (0,0)
+ nsteps = round_(crad*linedensity)
+ lthk = crad/nsteps/(1bp__)
+ ShadeObject(RBbackground,nsteps,
+ 0, r1,g1,b1,
+ 0.2, r1,g1,b1,
+ 0.8, r2,g2,b2,
+ 1, r3,g3,b3) at C
+# Highlight disk with arc shading
+ rad1 = crad*3/4
+ C1: C.n-(0,rad1+0.02*crad)
+ C2: C1+(0,2*rad1)
+ lthk = 2*rad1/nsteps/(1bp__)
+ define RBoverlay {
+ radx = rad1 + ($`'1)*2*rad1
+ if $`'1 < 1 then {
+ arc cw rad radx thick lthk outlined rgbstring($`'2,$`'3,$`'4) \
+ from Cintersect(C2,radx,C1,rad1) \
+ to Cintersect(C2,radx,C1,rad1,R) \
+ with .c at C2
+ } }
+ nsteps = round_(rad1*2*linedensity)
+ ShadeObject(RBoverlay,nsteps,
+ 0, 1, 1, 1,
+ 0.1, 1, 1, 1,
+ 0.33,(r1+r2)/2,(g1+g2)/2,(b1+b2)/2,
+ 0.67,r1,g1,b1,
+ 1, (r1+r2)/2,(g1+g2)/2,(b1+b2)/2) with .c at C1
+ `$4']')
+
+#################################################################
+
+ `BoxButton(wid,height,hue,linedensity)
+ hue 0=red, 60=yellow, 120=green ...'
+define(`BoxButton',`[
+# Size and Color
+ boxw = ifelse(`$1',,boxwid*4/3,`$1')
+ boxh = ifelse(`$2',,boxw/4,`$2')
+ hue = ifelse(`$3',,180,`$3')
+ hsvtorgb(hue, 1, 1, r1,g1,b1)
+ hsvtorgb(hue-5, 1,0.9, r2,g2,b2)
+ hsvtorgb(hue-10,1,0.5, r3,g3,b3)
+# Peripheral shading
+ linedensity = ifelse(`$4',,150/scale,`$4')
+ nsteps=10
+ define BxBshadow {
+ box ht boxh wid boxw rad boxh/2 \
+ outlined rgbstring($`'2,$`'3,$`'4) at (0,($`'1)*4*linethick bp__)
+ }
+ Q: ShadeObject(BxBshadow,nsteps,
+ 0, 1,1,1,
+ 1, r3,g3,b3)
+# Shaded body
+ lthk = boxh/nsteps/(1bp__)
+ define BxBshade {
+ v = boxh*(1-($`'1))
+ h = (boxw-boxh)/2+sqrt((boxh/2)^2-(v-boxh/2)^2)
+ line from (-h,v) to (h,v) thick lthk outlined rgbstring($`'2,$`'3,$`'4)
+ }
+ nsteps = boxh*linedensity
+ C: ShadeObject(BxBshade,nsteps,
+ 0, r1, g1, b1,
+ 0.45,r2, g2, b2,
+ 1, r3, g3, b3) with .n at Q.n
+# Shaded highlight
+ bh = boxh*0.4
+ bw = boxw*4/4.5
+ define BxBhighlight {
+ v = bh*(1-($`'1)); h = (bw-bh)/2+sqrt((bh/2)^2-(v-bh/2)^2)
+ line from (-h,v) to (h,v) thick lthk outlined rgbstring($`'2,$`'3,$`'4)
+ }
+ nsteps = bh*linedensity
+ ShadeObject(BxBhighlight,nsteps,
+ 0,1,1,1,
+ 8/nsteps,1,1,1,
+ 1, r2,g2,b2) with .n at Q.n+(0,-boxh/20)
+ `$5']')
+
+#################################################################
+divert(0)dnl
+
+for x=0 to 5 do {
+ B: RoundButton(0.6,x*60) at (x,0)
+ "Button" sprintf("%g",x+1) at B }
+
+[ for i=0 to 2 do {
+ BoxButton(1.5,,180+120*i) at (i*2,0)
+ "Button" at last [].C
+ }
+ ] with .nw at 1st [].sw+(0,-0.5)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Byte.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Byte.m4
new file mode 100644
index 00000000000..863e3145fd2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Byte.m4
@@ -0,0 +1,40 @@
+.PS
+# Byte.m4
+gen_init
+
+boxht = 0.2
+boxwid = 3.8
+
+define leftlabel { {"{\sf $1}" at last box.w ljust} }
+
+ifdpic(`
+down_
+Lab[0]: box; leftlabel( B0STDISBL (reset pin is enabled) )
+Lab[1]: box; leftlabel( WDTON (WDT not always on) )
+Lab[2]: box; leftlabel( SPIEN (allow serial programming) )
+Lab[3]: box; leftlabel( CKOPT (full output swing) )
+Lab[4]: box; leftlabel( EESAVE (don\char39{}t preserve EEPB0OM over chip erase))
+Lab[5]: box; leftlabel( BOOTSZ1 )
+Lab[6]: box; leftlabel( BOOTSZ0 )
+Lab[7]: box; leftlabel( BOOTB0ST (boot reset vector at 0x0000) )
+
+boxwid = boxht
+left_
+B0:box "\sf 1" with .e at Lab[0].nw + (0.75,0.5)
+ box "\sf 0"
+ box "\sf 0"
+ box "\sf 1"
+ box "\sf 0"
+ box "\sf 0"
+ box "\sf 1"
+ box "\sf 1"
+ box wid 2*boxht "\sf 0xc9"
+
+for i=0 to 7 do {
+ spline -> ht arrowht*0.7 from B0.s-(i*boxht,0) down boxht/4 \
+ then to Lab[0].nw-((i+1)*boxht/2,0) \
+ then down Lab[0].nw.y-Lab[i].y then to Lab[i].w
+ }',
+`box wid 1 ht 0.75 "Byte.m4" "requires" "dpic"')
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/CSlight.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/CSlight.m4
new file mode 100644
index 00000000000..720e74f9e2b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/CSlight.m4
@@ -0,0 +1,173 @@
+.PS
+# Csource.m4
+ ifmpost(command "verbatimtex")
+ command "\newcommand\scriptstack[2][c]{\hbox{\scriptsize\shortstack[#1]{#2}}}%"
+ command "{\scriptsize"
+ ifmpost(command "etex")
+define(`density',0.90)
+setrgb(density, density, density)
+
+cct_init
+ linewid = 0.4
+
+define(`npair',`[define(`m4lr',ifelse(`$1',,l,r))
+ J: mosfet(down_ dimen_,ifelse(`$1',,R,L),uHSDF,E)
+ "\scriptstack[l]{$Q_{`$2'}$\\ 2N5464}" at J.n+(0,8pt__)
+ G: J.G
+ line ifelse(`$1',,right,left) dimen_/4 from J.D
+ Q: bi_tr(up_ dimen_,ifelse(`$1',,L,R),,E) with .B at Here
+ ifelse(`$1',,r,l)label(,`\scriptstack[m4lr]{$Q_{`$3'}$\\ 2N4239}')
+ E: Q.E
+ S: dot(at (Q.C,J.S))
+ line from J.S to S then to Q.C ]')
+
+define(`ppair',`[define(`m4lr',ifelse(`$1',,l,r))
+ J: mosfet(down_ dimen_,ifelse(`$1',,R,L),dHSDF,E)
+ "\scriptstack[l]{$Q_{`$2'}$\\ 2N3819}" at J.s-(0,8pt__)
+ G: J.G
+ line ifelse(`$1',,right,left) dimen_/4 from J.S
+ Q: bi_tr(down_ dimen_,ifelse(`$1',,R,L),P,E) with .B at Here
+ ifelse(`$1',,l,r)label(,`\scriptstack[m4lr]{$Q_{`$3'}$\\ 2N4236}')
+ E: Q.E
+ S: dot(at (Q.C,J.D))
+ line from J.D to S then to Q.C ]')
+
+ R2: resistor(down_ dimen_)
+ llabel(,`\scriptstack[l]{$R_2$\\ 150}')
+ dot
+ Q13: bi_tr(down_ dimen_,,P,E) with .E at Here
+ rlabel(,`\scriptstack[r]{$Q_{13}$\\ 2N4236}')
+ line down 3.1*elen_ from Q13.C
+ Q14: bi_tr(up_ dimen_,R,,E) with .C at Here
+ llabel(,`\scriptstack[r]{$Q_{14}$\\ 2N4239}')
+ dot(at Q14.E)
+ { line left_ dimen_*1.3 then up_ dimen_
+ R1: potentiometer(up_ dimen_) with .Start at Here
+ rlabel(,`\scriptstack[l]{$R_1$\\ $20\,$K}')
+ { ground(at R1.T1) }
+ line from R1.End to (R1.End,Q13.E) then to Q13.E }
+ { dot(at Q13.C+(0,-elen_))
+ line to (R1.R,Here)+(-dimen_/2,0)
+ { arrowline(right_ dimen_/2); llabel(,i_1) }
+ V1: gap(down_ dimen_,1); rlabel(+,V_1,-)
+ line down_ dimen_/4 chop dotrad_ chop 0; ground(,T) }
+ R3: resistor(down_ dimen_)
+ llabel(,`\scriptstack[l]{$R_3$\\ 150}')
+ dot(at Q13.C+(0,-2*elen_))
+ line right_ dimen_/2
+ A1: opamp with .In2 at Here; "$A_1$" at A1.C
+ "`\scriptstack[l]{Nexus\\ SQ-10A}'" at A1.s below
+ line left_ dimen_/4 from A1.In1 then up_ dimen_/2 then right dimen_
+ dot
+ { resistor(up_ elen_)
+ llabel(,`\scriptstack[r]{$R_{14}$\\ $19\,$K}')
+ line to (Here,Q13.E) then to Q13.E }
+ line to (A1.Out,Here)
+ dot
+ { line to A1.Out
+ dot
+ resistor(down_ to (Here,Q14.E))
+ llabel(,`\scriptstack[l]{$R_{13}$\\ $91\,$K}')
+ line to Q14.E }
+ R6: resistor(right_ dimen_)
+ rlabel(,`\scriptstack[l]{$R_6$\\ $15\,$K}')
+ dot
+ line to (Here,A1.In1) then right_ dimen_/4
+ A2: opamp with .In1 at Here; "$A_2$" at A2.C
+ "`\scriptstack[l]{Nexus\\ SQ-10A}'" at A2.s below
+ line left_ dimen_/4 from A2.In2
+ ground
+
+ dot(at A2.Out)
+ DP1: npair(,3,4) with .E at (A2.Out,Q14.B)+(elen_*1.25,0)
+ line from A2.Out to (A2.Out,DP1.G) then to DP1.G
+ line from DP1.E to (DP1.E,R3.bottom); dot
+ D4: reversed(`diode',up_ dimen_/2 from DP1.S)
+ D3: reversed(`diode',up_ dimen_/2 from Here+(0,-dimen_/6))
+ llabel(,`\scriptstack[r]{$D_4$\\ OMC-V\\ $D_3$}')
+ DP2: ppair(,1,2) with .E at (DP1.E,Q13.B)
+ D1: diode(down_ dimen_/2 from DP2.S)
+ D2: diode(down_ dimen_/2 from Here+(0,dimen_/6))
+ rlabel(,`\raisebox{5pt}{\scriptstack[r]{$D_1$\\ $D_2$\\ OMC-V}}')
+ dot(at (Here,A2))
+ line to D2.bottom
+ line from DP2.G to (A2.Out,DP2.G) then to A2.Out
+ line from DP2.E to (DP2.E,R2.top); dot
+
+ T: dot(at (DP1.E,A2)+(dimen_,0))
+ DP3: npair(,7,8) with .G at (Here,DP1.G)+(dimen_/4,0)
+ dot(at DP3.E)
+ line to Q14.B
+ DP4: ppair(,5,6) with .G at (DP3.G,DP2.G)
+ dot(at DP4.E)
+ line to Q13.B
+ line from DP3.G to (T,DP3.G) then to (T,DP4.G) then to DP4.G
+ R11: resistor(down_ dimen_ from DP4.S)
+ rlabel(,`\scriptstack[r]{$R_{11}$\\ $20$}')
+ D5: diode(up_ from DP3.S to (DP3.S,A2),Z)
+ llabel(,`\scriptstack[r]{$D_5$\\ 1N4729$_{\vphantom{1}}$}')
+ line to R11.end
+ C4: capacitor(right_ dimen_*1.3 from DP3.S,C)
+ llabel(`C_4'); rlabel(,`0.68\,\mu\hbox{F}')
+ C3: capacitor(right_ dimen_*1.3 from DP4.S,C)
+ llabel(`C_3'); rlabel(,`0.68\,\mu\hbox{F}')
+ dot
+ dot(at (Here,R6))
+ C2: reversed(`capacitor',left_ dimen_*1.3,C)
+ rlabel(,,`C_2'); llabel(,`0.1\,\mu\hbox{F}')
+ line to R6.end
+
+ R5: resistor(up_ from R6.end to (R6.end,Q13.B))
+ rlabel(,`\scriptstack[l]{$R_5$\\ $100\,$K}')
+ dot(at R5.top-(0,dimen_/2))
+ line left_ dimen_/2
+ capacitor(down_ dimen_,C)
+ rlabel(,`\scriptstack[r]{$C_1$\\ $1\,\mu$F}')
+ ground(,T)
+
+ line from DP4.E to (DP4.E,R2.bottom)
+ resistor(up_ to (Here,R2.top))
+ rlabel(,`\scriptstack[l]{$R_9$\\ $910$}')
+ dot
+ resistor(down_ from DP3.E to (DP3.E,R3.bottom))
+ llabel(,`\scriptstack[l]{$R_{10}$\\ $910$}')
+ dot
+
+ line from R5.top to (R5,Q13.E)
+ resistor(right_ elen_)
+ llabel(,`\scriptstack[l]{$R_4$\\ $100\,$K}')
+ line to (C4.end,Here) then to C4.end
+
+ DP5: npair(L,11,10) with .E at (C4.end,DP1.E)+(elen_*0.8,0)
+ line from DP5.E to (DP5.E,R3.bottom); dot
+ line from R3.bottom to Here+(dimen_/2,0)
+ dot(,,1)
+ `"${}-E_{CC}$"' ljust
+ D6: diode(up_ from DP5.S to (DP5.S,A2),Z)
+ llabel(,`\scriptstack[r]{$D_6$\\ 1N4728}')
+ DP6: ppair(L,12,9) with .E at (DP5.E,DP2.E)
+ line from DP6.E to (DP6.E,R2.top); dot
+ line from R2.top to Here+(dimen_/2,0)
+ dot(,,1)
+ `"${}+E_{CC}$"' ljust
+ resistor(down_ from DP6.S to (DP6.S,C2))
+ rlabel(,`\scriptstack[r]{$R_{12}$\\ $20$}')
+ dot
+ { line to C2.e }
+ line to D6.end
+
+ Vr: dot(at (DP6.G,V1.top)+(dimen_/4,0))
+ line from DP6.G to (Vr,DP6.G) then to (Vr,DP5.G) then to DP5.G
+ reversed(`arrowline',right_ dimen_/2 from Vr); llabel(,i_2)
+ V2: gap(down_ dimen_,1); llabel(+,V_2,-)
+ line down_ dimen_/4 chop dotrad_ chop 0; ground(,T)
+
+ dot(at (Vr,T))
+ resistor(left_ to (DP6.E,Here))
+ rlabel(,`\scriptstack[l]{$R_{15}$\\ $200$}')
+ line to (DP1.E,Here)
+ dot
+
+ command "ifmpost(verbatimtex) }% ifmpost(etex)"
+resetrgb
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/CanLogic.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/CanLogic.m4
new file mode 100644
index 00000000000..88e26469282
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/CanLogic.m4
@@ -0,0 +1,158 @@
+.PS
+# CanLogic
+log_init
+divert(-1)
+###########################################################################
+ Macros for automatically drawing 2-layer
+ Boolean functions
+
+ Style parameters
+define(`dotrad_',(0.01*scale))
+define(`gatelineth',1)
+define(`lineth',0.5)
+define(`inputsep',`2*jog')
+define(`jog',`(AND_ht/2)*L_unit')
+
+ `CanLogic(layer gate type,[N],
+ output gate type,[N],
+ term,term,...)
+ This is the driver macro. Terms are
+ strings of variables or of variables
+ preceded by the ~ character. Each
+ variable is one letter e.g.
+ CanLogic(NAND,,OR,N,abcd,a~b,c,~ad)'
+define(`CanLogic',
+ `define(`terms',`shift(shift(shift(shift($@))))')
+# Determine required input variables and negated
+# variables
+ Loopover_(`t_',`varloop(`v_',`define(X`'v_)',`define(XN`'v_)',t_)',terms)
+# Draw the inputs with NOT gates as necessary
+ PrevInput: Here-(inputsep,0)
+ Loopover_(`t_',`varloop(`v_',
+ `ifdef(D`'v_,,`ifdef(XN`'v_,`DrawInNotIn(v_)',`DrawIn(v_)')')',
+ `ifdef(D`'v_,,`ifdef(X`'v_,`DrawInNotIn(v_)',`DrawNotIn(v_)')')', t_)',
+ terms)
+# Draw 2nd-layer gates
+ right_
+ LastGateSE: PrevInput+(5*jog,-(AND_wd*L_unit*1.5)) dnl
+ Loopover_(`t_',
+ `define(`termcount',m4Lx)DrawLayerGate(G`'termcount,$1,$2,t_)',
+ terms)
+# Draw output gate
+ linethick = gatelineth
+ OP: m4xpand(`$3'_gate(termcount,$4)) with .Out at \
+ 0.5<G1.Out,G`'termcount.Out> + (jog/2*(termcount+3)+AND_wd*L_unit,0)
+ Out: Here
+ linethick = lineth
+# Connect 2nd-layer gates to the output gate
+ VectorConnect(G,termcount,OP)
+# Connect the inputs and negated inputs to
+# 2nd-layer gates
+ Loopover_(`t_',`ConnectInputs(G`'m4Lx,t_)',terms)
+# Clean up
+ Loopover_(`t_',`DeleteLogDefs(t_)',terms)
+ ')
+ `VectorConnect(number of 2nd layer gates,
+ common 2nd layer gate name,
+ output gate name)
+ Connect the 2nd-layer gate outputs to the
+ output gate inputs'
+define(`VectorConnect',
+ `for_(1,`$2',1,
+ `line from `$1'm4x.Out right `$3'.In1.x-`$1'm4x.Out.x \
+ - jog/2*(`$2'+1-abs(2*m4x-`$2'-1)) \
+ then down `$1'm4x.Out.y - `$3'.In`'m4x.y then to `$3'.In`'m4x ')')
+
+ Draw and label a non-inverted input
+define(`DrawIn',
+ `PrevInput: PrevInput+(inputsep,0)
+ In`'$1: PrevInput
+ "$$1$" ljust at PrevInput # Maybe labels should be done externally
+ Int`'$1: PrevInput
+ define(D`'$1)')
+
+ Draw and label an inverted input
+define(`DrawNotIn',
+ `PrevInput: PrevInput+(inputsep,0)
+ In`'$1: PrevInput
+ "$$1$" ljust at PrevInput # Maybe labels should be done externally
+ line down_ 2*jog from PrevInput
+ linethick = gatelineth
+ NOT_gate
+ InNt`'$1: Here
+ linethick = lineth
+ define(D`'$1)')
+ Draw and label an input that is required both
+ inverted and uninverted.
+define(`DrawInNotIn',
+ `PrevInput: PrevInput+(inputsep,0)
+ In`'$1: PrevInput
+ "$$1$" ljust at PrevInput # Maybe labels should be done externally
+ line from PrevInput down jog
+ Int`'$1: dot
+ PrevInput: PrevInput+(inputsep,0)
+ line to (PrevInput,Here) then down_ jog
+ linethick = gatelineth
+ NOT_gate
+ linethick = lineth
+ InNt`'$1: Here
+ define(D`'$1)')
+ `varloop(`var',ifnotnegated,ifnegated,term)
+ Loop over term variables performing actions'
+define(`varloop',`ifelse(`$4',,,substr(`$4',0,1),~,
+ `define(`$1',substr($4,1,1)) $3
+ varloop(`$1',`$2',`$3',substr($4,2))',
+ `define(`$1',substr($4,0,1)) $2
+ varloop(`$1',`$2',`$3',substr($4,1))')')')
+
+ Count gate inputs and mark last appearance
+define(`Countinputs',`varloop(`v_',
+ `define(`incount',incr(incount)) define(Last`'v_,`$1')',
+ `define(`incount',incr(incount)) define(LastN`'v_,`$1')',$2)')
+
+ Draw a 2nd layer gate
+define(`DrawLayerGate',
+ `define(`incount',0) dnl
+ Countinputs($1,$4) dnl
+ ifelse(incount,1,
+ `LastGateSE: LastGateSE-(0,jog)
+ $1: [ In1:Here; line right AND_wd*L_unit; Out: Here] \
+ with .Out at LastGateSE',
+ `LastGateSE: LastGateSE-(0,jog+AND_ht*L_unit)
+ linethick = gatelineth
+ $1: m4xpand(`$2'_gate(incount,$3)) with .se at LastGateSE
+ linethick = lineth ')')
+
+ Connect this gate to its input lines
+define(`ConnectInputs',`define(`innum',0) varloop(`v_',
+ `define(`innum',incr(innum))
+ line from `$1'.In`'innum to (In`'v_,`$1'.In`'innum)dnl
+ ifelse(`$1',m4xpand(Last`'v_),`then to In`'v_',`; dot')',
+ `define(`innum',incr(innum))
+ line from `$1'.In`'innum to (InNt`'v_,`$1'.In`'innum)dnl
+ ifelse(`$1',m4xpand(LastN`'v_), `then to InNt`'v_', `; dot')',$2)')
+
+ Delete definitions to allow more than one
+ circuit per diagram
+define(`DeleteLogDefs',`varloop(`v_',
+ `undefine(Last`'v_) undefine(D`'v_) undefine(X`'v_)',
+ `undefine(LastN`'v_) undefine(D`'v_) undefine(XN`'v_)',$1)')
+
+ Thanks to Alexander Ray for suggesting the
+ need for something like these macros
+###########################################################################
+divert(0)dnl
+
+ linethick = lineth
+
+[ CanLogic(AND,,OR,,abcd,~ba,c,d~a) #; line right jog from Out "$f$" above
+ ]
+{`"\tt CanLogic(AND,,OR,,abcd,\char126{}ba,c,d\char126{}a)"' \
+ at last [].s -(0,11bp__)}
+
+[ CanLogic(OR,N,NAND,,ab~c,a~bc,ac,~d) #; line right jog from Out "$f$" above
+ ] with .sw at last [].se+(0.5,0)
+{`"\tt CanLogic(OR,N,NAND,,ab\char126{}c,a\char126{}bc,ac,\char126{}d)"' \
+ at last [].s - (0,11bp__)}
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Ccurve.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Ccurve.m4
new file mode 100644
index 00000000000..4aed3fb1ab2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Ccurve.m4
@@ -0,0 +1,13 @@
+.PS
+# Ccurve.m4
+gen_init
+# Gosper C curve
+
+`define' c_curve {if $3==0 then { continue by ($1,$2) } else {
+ c_curve( ($1-$2)/2, ($1+$2)/2, $3-1)
+ c_curve( ($1+$2)/2, ($2-$1)/2, $3-1)}}
+
+line from 0,4 to 0,4
+c_curve(0,4,10)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Chuck.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Chuck.m4
new file mode 100644
index 00000000000..152d4b87db1
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Chuck.m4
@@ -0,0 +1,263 @@
+.PS
+threeD_init s_init(Views) sinclude(tst.dim)
+#
+# Chuck.m4
+#
+divert(-1)
+ `Dimensioning for diagrams
+ dimension_(linespec,vert offset,
+ label,blank width,tic offset,<-|->,R)'
+define(`dimension_',`rpoint_(`$1') ; {
+ define(`m4h',`(rp_len ifelse((`$4'),(),,`-($4)'))')dnl
+ ifelse((`$2'),(),,`if (`$2') != 0 then {
+ {move to rvec_(0, ifelse(`$5',,`sign($2)*3.6bp__',`$5'))
+ line to rvec_(0,`$2')}
+ {move to rvec_(rp_len,ifelse(`$5',,`sign($2)*3.6bp__',`$5'))
+ line to rvec_(0,`$2')}
+ move to rvec_(0,`$2') }')
+ if m4h > 2*arrowht then {
+ { line ifelse(`$6',,<-,index($6,<),0,<-) to rvec_(m4h/2,0)
+ ifelse((`$4'),(),,`move to rvec_(($4),0)')
+ line ifelse(`$6',,->,eval(index($6,>)>0),1,->) to rvec_(m4h/2,0) }
+ } else {
+ { arrow from rvec_(-arrowht*1.5,0) to Here
+ arrow from rvec_(rp_len+arrowht*1.5,0) to rvec_(rp_len,0) }
+ }
+ define(`m4txt',`ifelse(`$7',,
+ `ifelse(index(`$3',"),0,`$3',"`$3'")',
+ `ifdef(`pstricks_',`sprintf("\rput{%g}(0,0){`$3'}",rp_ang*rtod_)',`"$3"')')')
+ ifelse(`$3',,,`m4txt at rvec_(rp_len/2,0)')
+ }')
+
+define(`rottxt',
+ `ifdef(`pstricks_',`sprintf("\rput{%g}(0,0){`$2'}",`$1')')')
+ `rotate(angle,at pos, objects at origin)'
+define(`rotate',
+ `ifdef(`pstricks_',`M4tmp: "" ifelse(`$2',,Here,`$2')
+ sprintf("\rput{%g}(%g,%g){`$3'}",`$1',M4tmp.x/scale,M4tmp.y/scale)')')
+ `r_box(angle,pos,string)'
+define(`crl',`int(`($1)'/scale*1000000)/1000000')
+define(`r_box',
+ `ifdef(`pstricks_',`M4tmp: ifelse(`$2',,Here,`$2')
+ command sprintf("\rput{%g}(%g,%g){",`$1',crl(M4tmp.x),crl(M4tmp.y))
+ w_box(`$3') at Orig
+ command "}%"')')
+ `r_dimen(linespec,offset,label,tic offset,<->,pos)'
+define(`r_dimen',
+ `M4tmp: dimension_(`$1',`$2',,,`$4',`$5')
+ r_box(rp_ang*rtod_,ifelse(`$6',,M4tmp+vec_(0,`$2'),`$6'),`$3')')
+
+ `ctrline(linespec,len)'
+define(`cdashl',0.1*scale)
+define(`cgapl',0.03*scale)
+define(`ctrline',`rpoint_(ifelse(`$1',,`to rvec_(linewid,0)',`$1'))
+ define(`m4h',ifelse(`$2',,1*scale,`$2'))dnl
+ m4n = int(rp_len/2/(m4h))*2+1
+ for i=1 to m4n do {
+ line to rvec_(rp_len/m4n/2-cdashl/2-cgapl,0)
+ move to rvec_(cgapl,0); line to rvec_(cdashl,0); move to rvec_(cgapl,0)
+ line thick dimensionth to rvec_(rp_len/m4n/2-cdashl/2-cgapl,0) } ')
+
+ `ctrarcr(pos,radius,startang,endang,len)'
+define(`ctrarcr',`dnl
+ define(`m5h',ifelse(`$5',,1*scale,`$5'))dnl
+ rp_len = abs((`$2')*(`$4'-(`$3')))
+ m5n = int(rp_len/2/(m5h))*2+1
+ m5a = (rp_len/m5n/2-cdashl/2-cgapl)/(`$2')
+ m5s = cdashl/(`$2')
+ m5sa = `$3'
+ for m4irr=1 to m5n do {
+ arc from `$1'+(rect_(`$2',m5sa)) to `$1'+(rect_(`$2',m5sa+m5a)) \
+ with .c at `$1'
+ m5sa = m5sa+m5a+cgapl/(`$2')
+ arc from `$1'+(rect_(`$2',m5sa)) to `$1'+(rect_(`$2',m5sa+m5s)) \
+ with .c at `$1'
+ m5sa = m5sa+m5s+cgapl/(`$2')
+ arc from `$1'+(rect_(`$2',m5sa)) to `$1'+(rect_(`$2',m5sa+m5a)) \
+ with .c at `$1'
+ m5sa = m5sa+m5a
+ } ')
+
+divert(0)dnl
+
+scale = 25.4*2
+tic = 3.6bp__
+
+command "{\sf"
+#psset_(linecolor=white)
+#command "\color{white}"
+
+#include(Lettering.m4)
+#Letter_init
+
+define(`visible',`linethick_(visibleth)')
+define(`hidden',`linethick_(hiddenth)')
+define(`dimension',`linethick_(dimensionth)
+ arrowwid = 1.5*arrowwid; arrowht = 1.5*arrowht; ')
+
+d1 = 230
+d2 = 204
+d3 = 140
+
+ visibleth = 1.2
+ dimensionth = 0.4
+ hiddenth = dimensionth
+
+Orig: Here
+visible
+ D3: circle diam d3 at Orig
+ D2: circle diam d2 at Orig
+
+ rr = d1/2
+ r = 40
+ h = 110/2
+ thet = asin((h+r)/(rr+r))
+ X1: rect_(rr,thet)
+ P1: rect_(rr+r,thet)
+
+dimension
+ cross(at (P1.x,-P1.y))
+ cross(at (-P1.x,P1.y))
+
+# Top outer visible line
+visible
+# arc ccw from (-P1.x,h) to (-X1.x,X1.y) rad r with .c at (-P1.x,P1.y)
+ arcs = atan2(P1.x-X1.x,P1.y-X1.y)
+ n = 0
+ nn = 8
+ for i = 0 to nn do {P[n]:(-P1.x,P1.y)+(rect_(r,-twopi_/4+i/nn*arcs)); n=n+1}
+ for i = 1 to nn do {P[n]:Orig+(rect_(rr,pi_-thet-i/nn/2*(pi_-2*thet))); n=n+1}
+ n = n-1
+ for i = 1 to n do { P[n+i]:(-P[n-i].x,P[n-i].y) }
+ fitcurve(P,2*n)
+# top arc
+# arc cw to X1 rad rr with .c at Orig
+# arc ccw from X1 to (P1.x,h) rad 4 with .c at P1
+# right end
+ line from (P1.x,h) to (305/2,h) then to (305/2,32/2) then left 40-3
+ arc ccw rad 3
+ line down 32-2*3
+ arc ccw rad 3
+dimension {
+ r_dimen(up 32 with .c at (305/2-5,0),0,32)
+ arrow <- up 8 right 8 then right 4 from last arc.sw
+ "3$\,$R" ljust
+ r_dimen(up h*2 at (305/2,0),-10,110)
+}; visible
+ line right 40-3 then to (305/2,-h) then to (P1.x,-h)
+# arc ccw to (X1.x,-X1.y) rad r with .c at P1.x,-P1.y
+# bottom arc
+ for i = 0 to 2*n do { P[i]: (-P[2*n-i].x,-P[i].y) }
+ fitcurve(P,2*n)
+# arc cw to (-X1.x,-X1.y) rad rr with .c at Orig
+# arc ccw to (-P1.x,-h) rad r with .c at (-P1.x,-P1.y)
+# left end
+ line from (-P1.x,-h) to (-305/2,-h) then to (-305/2,-25/2) then right 25
+ down; arc ccw rad 3
+ line right 40-25-2*3
+ arc ccw rad 3
+ line up 25
+ {R: line invis down 10 at (2nd last line,last line) }
+ arc ccw rad 3
+ line left 40-25-2*3
+ arc ccw rad 3
+ line to (-305/2,25/2) then to (-305/2,h) then to (-P1.x,h)
+
+dimension
+# centre
+ ctrline(right 305-30 with .c at Orig,60)
+ ctrline(up d1+10 with .c at Orig,)
+
+ {BX: box invis ht 25+2*3 wid 40-25 rad 3 with .w at (-305/2+25,0)}
+ Q: line invis from BX.n to BX.s; R: line invis from BX.se up 10 left 10
+ X: Intersect_(Q,R)
+ line <-> from BX.se to X then to (X.x,-X.y) then to BX.nw
+ r_box(90,BX,`3$\,$R')
+
+# Drill centres
+ D[1]: 35,sqrt(85^2-35^2)
+ D[2]: -D[1].x,D[1].y
+ D[3]: -D[1].x,-D[1].y
+ D[4]: D[1].x,-D[1].y
+ ctrline(from D[3] to D[1] chop 15)
+ ctrline(to rvec_(2*15,0))
+ ctrline(from D[3]+vec_(-15,0) to D[3]+vec_(15,0))
+ ctrline(from D[2] to D[4] chop 15)
+ ctrline(to rvec_(2*15,0))
+ ctrline(from D[2]+vec_(-15,0) to D[2]+vec_(15,0))
+visible
+ for i=1 to 4 do {
+ circle diam 16 at D[i]
+ for j = 0 to 7 do { arcr(D[i],23/2,j/8*twopi_,(j+3/4)/8*twopi_) ccw }
+ }
+
+hidden
+ for s=-1 to 1 by 2 do {
+ line dashed from (-305/2,s*h) to (305/2,s*h)
+ line dashed from (-305/2,s*30.6) to (305/2,s*30.6)
+ line dashed from (-305/2,s*21.1) to (305/2,s*21.1)
+ line dashed from (-305/2+25+2,s*21.1) to (305/2,s*21.1)
+ line dashed dashwid/2 from (-305/2+25,s*25/2) down -s*(40/2-25/2-2);
+ if s<0 then { arc dashed dashwid/4 ccw rad 2 } else { up; arc dashed dashwid/4 cw rad 2 }
+ line dashed to ((305/2,0),Here)
+ for k = -1 to 1 by 2 do {
+ move to (k*305/2,s*(30.6+10))
+ { dashline(from Here+(0,s*9.5/2) right -k*16,,dashwid/2)
+ dashline(right -k*9.5/2/2 up -s*9.5/2,,dashwid/3)
+ dashline(left -k*9.5/2/2 up -s*9.5/2,,dashwid/3)
+ dashline(left -k*16,,dashwid/2)
+ dashline(from Here+(-k*16,0) up s*9.5,,dashwid/2.5) }
+ { dashline(from Here+(0,s*11/2) right -k*36.5,,dashwid/2)
+ dashline(right -k*11/2/2 up -s*11/2,,dashwid/3)
+ dashline(left -k*11/2/2 up -s*11/2,,dashwid/3)
+ dashline(left -k*36.5,,dashwid/2)
+ dashline(from Here+(-k*36.5,0) up s*11,,dashwid/2.5) }
+ { dashline(from Here+(0,s*13/2) right -k*32,,dashwid/2)
+ dashline(down s*13,,dashwid/2)
+ dashline(left -k*32,,dashwid/2) }
+ ctrline(right -k*20 chop -3 chop 0); ctrline(right -k*20 chop 0 chop -3)
+ }
+ }
+
+dimension
+# bottom
+ dimension_(from (-305/2,-h) to (305/2,-h),-(rr*1.1-h),"305",20pt__)
+# outer radii
+ r_dimen(from (-P1.x,P1.y) down 40*cosd(30) right 40*sind(30),0,40,,->)
+ r_dimen(from (P1.x,-P1.y)+(Rect_(40,120)) \
+ down 40*cosd(30) right 40*sind(30),0,40,,<-)
+# main diameter
+ r_dimen(from (Rect_(rr,180+50)) to (Rect_(rr,50)),,230,,,(Rect_(50,50)))
+# inner circles
+ r_dimen(from (Rect_(d2/2,180+25)) to (Rect_(d2/2,25)),,204,,,(Rect_(25,25)))
+ r_dimen(from (Rect_(d3/2,180-12)) to (Rect_(d3/2,-12)),,140,,,(Rect_(25,-12)))
+
+# bolt hole placement diameter
+ r_dimen(from Orig to (Rect_(85,-43)),,`85$\,$R',,->,(Rect_(20,-43)))
+# left slot
+ r_dimen(from (-305/2+6,-25/2) up 25,0,25)
+ r_dimen(from (-305/2,-26) right 40,0,40)
+ line from last line.end to (last line.end.x,BX.s.y) chop -tic chop 0
+ r_dimen(from (-305/2,26) right 25,0,25)
+ line from last line.end to (last line.end.x,BX.n.y) chop -tic chop 0
+# right slot
+ r_dimen(from (305/2-40,-32/2-10) right 40,0,40)
+ line from (305/2-40,-32/2) down 10+tic
+# drill-holes
+ for i=1 to 4 do {
+ ctrarcr(Orig,85,atan2(D[i].y,D[i].x)-10*dtor_,atan2(D[i].y,D[i].x)+10*dtor_)
+ }
+ ctrarcr(Orig,85,atan2(D[4].y,D[4].x)+10*dtor_,atan2(D[4].y,D[4].x)+25*dtor_)
+ ctrline(up 30 at D[3])
+ ctrline(up 30 at D[4])
+ r_dimen(from D[3]+(0,-14) right 35,0,35)
+ r_dimen(from (0,D[3].y-14) right 35,0,35)
+
+# arrow <- down 30 left 30 from D[3] chop 16/2 chop 0 then left 5
+# "16 DRILL 23 CBORE" rjust "4 HOLES" rjust
+
+ arrow <- from (-305/2,30.6+10+2) up 5 left 5 then up 13
+ s_box(SEE (A)) with .sw at Here+(-5pt__,2pt__)
+
+command "}%"
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Counting.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Counting.m4
new file mode 100644
index 00000000000..18002ba99ff
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Counting.m4
@@ -0,0 +1,26 @@
+.PS
+# Counting.m4
+gen_init
+
+ g = 0.4 # grid size
+ define grid { (($2)*g,-($1)*g) }
+ circlerad = 0.1
+
+for i=1 to 4 do {
+ sprintf(`"$S_%g$:"',i) ljust at grid(i,-0.5)
+ for j=1 to 4 do { if i+j < 8 then {
+ sprintf(`"$s_{%g%g}$"',i,j) at grid(i,j) } } }
+
+"$\vdots$" at grid(4.75,0)
+for i=1 to 3 do { `"$\cdots$"' at grid(i,5) }
+"$\cdots$" at grid(4,4)
+
+P: grid(1,1)
+for k=3 to 5 do {
+ for i=1 to k-1 do { if (k%2==1) then { m=i; n=k-i } else { m=k-i; n=i }
+ Q: grid(m,n)
+ arrow from P to Q chop
+ P: Q }
+ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Crossbar.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Crossbar.m4
new file mode 100644
index 00000000000..b9706657eeb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Crossbar.m4
@@ -0,0 +1,53 @@
+.PS
+# Crossbar
+gen_init
+ circlerad = 0.12
+ boxwid = 0.18
+ boxht = 0.18
+ rathick = 1.5
+ rawd = rathick*4 bp__
+ raht = rawd*2
+ boxdist = boxwid*1.8
+
+define bcoord {($2,-($1))*boxdist}
+define redarrow { arrow ht raht wid rawd thick rathick color "red" }
+
+define cbx {
+ thinlines_
+ n = $+ - 1
+ for i=0 to n do {
+ line color "blue" from bcoord(i,0) to bcoord(i,n)
+ line color "blue" from bcoord(0,i) to bcoord(n,i)
+ C[i]: circle invis at bcoord(i,-1.5)
+ }
+ for i=0 to n do {
+ exec sprintf("col = $%g",i+1)
+ redarrow from C[i].e right 1.25*boxwid
+ redarrow from C[i].w+(-boxwid,0) right raht
+ for j=0 to n do {
+ B: box outlined "blue" shaded "yellow" at bcoord(i,j)
+ if j==col then {
+ line color "blue" from B.s to B.e
+ line thick rathick color "red" from C[i].e to B.w \
+ then to B.n then to (B.x,C[0].y+(2+j*2/3)*boxht)
+ continue to (C[j].x-(2+j*2/3)*boxht,Here.y)
+ continue to (Here,C[j]) then to C[j].w
+ } \
+ else {
+ line color "blue" from B.n to B.s
+ line color "blue" from B.w to B.e
+ }
+ }
+ }
+ thicklines_
+ for i=0 to n do {
+ circle thick 1.5 outlined "blue" shaded "yellow" at C[i] \
+ sprintf("iflatex(\large)%g",i)
+ }
+ }
+
+ifdpic(`
+ cbx(3,6,0,5,2,7,1,4)
+
+',`box wid 1 ht 0.75 "Crossbar.m4" "requires" "dpic"')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Crow.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Crow.m4
new file mode 100644
index 00000000000..61e2a3ce508
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Crow.m4
@@ -0,0 +1,73 @@
+.PS
+# Crow.m4
+#`Illustrates shadebox and custom crowfoot line termination; uses s_box'
+gen_init
+s_init(Crow)
+sinclude(tst.dim)
+
+# Custom macros --------------------------
+
+# `crowline(linespec,wid,ht)'
+define(`crowline',
+ `line `$1'
+ M4_E: last line.end
+ crow_wd = ifelse(`$2',,`(arrowwid*8/5)',`$2')
+ crow_ht = ifelse(`$3',,`(1.5*crow_wd)',`$3')
+ M4_P: vperp(last line,crow_wd)
+ M4_X: crow_ht/lin_leng(last line) between M4_E and last line.start
+ ifdpic(
+ `spline 0.4 from M4_E+M4_P to M4_X+M4_P then to M4_X-M4_P then to M4_E-M4_P',
+ `spline from M4_E+(M4_P.x,M4_P.y) to M4_X+(M4_P.x,M4_P.y) \
+ then to M4_X-(M4_P.x,M4_P.y) then to M4_E-(M4_P.x,M4_P.y)') ')
+
+define(`custombox',
+ ``$1': shadebox(box `$2',3)
+ s_box({\sf `$1'}) at last box.n above
+ boxtext(`$3')')
+
+define(`boxtext',`s_box(\parbox{%gpt}{\sf `$1'},int(last box.wid/(1pt__))) \
+ with .nw at last box.nw +(5pt__,-5pt__) ')
+
+# ----------------------------
+
+ boxwid = boxwid*1.15
+ boxsep = boxwid/2
+
+ custombox(Class,ht boxht*2.2,
+ `classkey\\ class\_type\\ class\_desc')
+
+ custombox(Product,ht Class.ht with .nw at Class.ne+(boxsep,0),
+ `classkey\\ prodkey\\ prod\_name\\ pkg\_type')
+
+ custombox(Sales,ht boxht*3.3 with .nw at Product.ne+(boxsep*2,15pt__),
+ `perkey\\ classkey\\ prodkey\\ storekey\\ promokey\\ quantity\\ dollars')
+
+ custombox(Period,ht Sales.ht with .nw at Sales.ne+(boxsep*2,0),
+ `perkey\\ date\\ day\\ week\\ month\\ qtr\\ year')
+
+ custombox(Market,ht Sales.ht with .nw at Class.sw+(0,-boxsep*2),
+ `perkey\\ date\\ day\\ week\\ month\\ qtr\\ year')
+
+ custombox(Store,ht boxht*3.6 with .sw at (Product.w,Market.s),
+ `storekey\\ mktkey\\ store\_type\\ store\_name\\ street\\ city\\ state\\ zip')
+
+ custombox(Promotion,ht Market.ht with .sw at (Period.w,Market.s),
+ `promokey\\ promo\_type\\ promo\_desc\\ value\\ start\_date\ end\_date')
+
+ move to Class.ne+(0,-10pt__); crowline(to (Product.w,Here))
+
+ move to Product.ne+(0,-10pt__); crowline(to (Sales.w,Here))
+ move to last line.start+(0,-crow_wd*2.5); crowline(to (Sales.w,Here))
+T: last line.c+(0,-crow_wd*2.5)
+
+ move to Period.nw+(0,-10pt__); crowline(to (Sales.e,Here),,1.75*crow_wd)
+Q: (last line.c,0.4 between Sales.se and Sales.ne)
+
+ move to Market.ne+(0,-10pt__); crowline(to (Store.w,Here))
+ move to Store.ne+(0,-10pt__); line to (T,Here) then to T
+ crowline(to (Sales.w,Here))
+
+ move to Promotion.nw+(0,-10pt__); line to (Q,Here) then to Q
+ crowline(to (Sales.e,Here),,1.75*crow_wd)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Cruller.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Cruller.m4
new file mode 100644
index 00000000000..dce4f3aa878
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Cruller.m4
@@ -0,0 +1,67 @@
+.PS
+# Cruller.m4
+threeD_init
+NeedDpicTools
+scale = 2.54
+
+define(`lobe',`(sind(6*(`$1'))+4)/5*2.25')
+
+ viewazimuth = 20 # Set view angles in degrees
+ viewelevation = 30
+ setview(viewazimuth,viewelevation,0)
+
+ dt = 3 # major angle degrees per facet
+ ds = 10 # minor angle degrees per facet
+
+ tradius = 6
+define(`cruller',`rot3Dz((`$1')*dtor_,
+ sum3D(0,tradius,0,0,Rect_(lobe(`$2'+2*(`$1')),`$2')))')
+
+define(`tvisible',`dot3D(View3D,
+ cross3D(diff3D(cruller(`$1'+dt/2,`$2'),cruller(`$1',`$2')),
+ diff3D(cruller(`$1',`$2'+ds/2),cruller(`$1',`$2'))))')
+
+ # create the arrays and sort
+ n = 0
+ for t = dt to 360+dt/2 by dt do {
+ for s=ds/2 to 360.1 by ds do {
+ if tvisible(t,s) > -0.01 then {
+ n +=1
+ t[n] = t
+ s[n] = s
+ d[n] = dot3D(cruller(t,s),view3D1,view3D2,view3D3) # view distance
+ ix[n] = n
+ }
+ } }
+# prval(n)
+ dpquicksort(d,1,n,ix)
+
+ # Background
+Bne: (9,6)
+Bsw: (-9,-6)
+B: 0.5 between Bne and Bsw
+iflatex(`line fill_(0.75) \
+ from (Bsw,Bne) to Bsw then to (Bne,Bsw) then to Bne then to (Bsw,Bne)',
+ `ShadedPolygon((Bsw,Bne):Bsw:(Bne,Bsw):Bne,,-30,
+ 0,1,1,1,
+ .5,.1,.4,0,
+ 1,0,0,0) at B')
+ # draw the facets
+thinlines_
+[
+ rgbtohsv(0.6,0.4,0,h,s,v)
+ for i = 1 to n do {
+ tc = t[ix[i]]; sc = s[ix[i]]
+ SE: (project(cruller(tc+dt/2,sc-ds/2)))
+ SW: (project(cruller(tc-dt/2,sc-ds/2)))
+ NW: (project(cruller(tc-dt/2,sc+ds/2)))
+ NE: (project(cruller(tc+dt/2,sc+ds/2)))
+ f = ((dcosine3D(3,cruller(tc,sc))/2.25+1)/2)^2
+ hsvtorgb(h,(1-f)*s,1,r,g,b)
+ line outlined rgbstring(r,g,b) shaded rgbstring(r,g,b) ifpdf( invis ) \
+ from SE to SW then to NW then to NE then to SE }
+ ] at B
+
+thicklines_
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Csource.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Csource.m4
new file mode 100644
index 00000000000..1441cfcb17b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Csource.m4
@@ -0,0 +1,170 @@
+.PS
+# Csource.m4
+cct_init
+
+ # Set small text size
+ iflatex(`textoffset = 1bp__; ifpsfrag(`textht = 9bp__',
+ `latexcommand({\scriptsize)') ')
+
+ linewid = 0.4 # Reduce element sizes
+
+define(`npair',`[define(`m4lr',ifelse(`$1',,ljust,rjust))
+ J: mosfet(down_ dimen_,ifelse(`$1',,R,L),uHSDF,E)
+ "$Q_{$2}$" ljust "`2N5464'" ljust at J.nw+(-4pt__,9pt__)
+ G: J.G
+ line ifelse(`$1',,right,left) dimen_/4 from J.D
+ Q: bi_tr(up_ dimen_,ifelse(`$1',,L,R),,E) with .B at Here
+ ifelse(`$1',,r,l)label(,"$Q_{`$3'}$" m4lr "2N4239")
+ E: Q.E
+ S: dot(at (Q.C,J.S))
+ line from J.S to S then to Q.C ]')
+
+define(`ppair',`[define(`m4lr',ifelse(`$1',,ljust,rjust))
+ J: mosfet(down_ dimen_,ifelse(`$1',,R,L),dHSDF,E)
+ "$Q_{$2}$" ljust "`2N3819'" ljust at J.sw+(0,-8pt__)
+ G: J.G
+ line ifelse(`$1',,right,left) dimen_/4 from J.S
+ Q: bi_tr(down_ dimen_,ifelse(`$1',,R,L),P,E) with .B at Here
+ ifelse(`$1',,l,r)label(,"$Q_{`$3'}$" m4lr "2N4236")
+ E: Q.E
+ S: dot(at (Q.C,J.D))
+ line from J.D to S then to Q.C ]')
+
+ R2: resistor(down_ dimen_)
+ llabel(,"$R_2$" ljust "\unit{150}{}")
+ dot
+ Q13: bi_tr(down_ dimen_,,P,E) with .E at Here
+ rlabel(,"$Q_{13}$" rjust "2N4236")
+ line down 3.1*elen_ from Q13.C
+ Q14: bi_tr(up_ dimen_,R,,E) with .C at Here
+ llabel(,"$Q_{14}$" rjust "2N4239")
+ dot(at Q14.E)
+ { line left_ dimen_*1.3 then up_ dimen_
+ R1: potentiometer(up_ dimen_) with .Start at Here
+ rlabel(,"$R_1$" ljust "\unit{20}{\kilo}")
+ { ground(at R1.T1) }
+ line from R1.End to (R1.End,Q13.E) then to Q13.E }
+ { dot(at Q13.C+(0,-elen_))
+ line to (R1.R,Here)+(-dimen_/2,0)
+ { arrowline(right_ dimen_/2); llabel(,i_1) }
+ V1: gap(down_ dimen_,1); rlabel(+,V_1,-)
+ line down_ dimen_/4 chop dotrad_ chop 0; ground(,T) }
+ R3: resistor(down_ dimen_)
+ llabel(,"$R_3$" ljust "\unit{150}{}")
+ dot(at Q13.C+(0,-2*elen_))
+ line right_ dimen_/2
+ A1: opamp with .In2 at Here; "A$_1$" at A1.C
+ "Nexus" ljust "`SQ-10A'" ljust at A1.sw+(0,-10pt__) below
+ line left_ dimen_/4 from A1.In1 then up_ dimen_/2 then right dimen_
+ dot
+ { resistor(up_ elen_)
+ llabel(,"$R_{14}$" rjust "\unit{19}{\kilo}")
+ line to (Here,Q13.E) then to Q13.E }
+ line to (A1.Out,Here)
+ dot
+ { line to A1.Out
+ dot
+ resistor(down_ to (Here,Q14.E))
+ llabel(,"$R_{13}$" ljust "\unit{91}{\kilo}")
+ line to Q14.E }
+ R6: resistor(right_ dimen_)
+ clabel(,"$R_6$" "\vphantom{x}" "\unit{15}{\kilo}")
+ dot
+ line to (Here,A1.In1) then right_ dimen_/4
+ A2: opamp with .In1 at Here; "A$_2$" at A2.C
+ "Nexus" ljust "`SQ-10A'" ljust at A2.sw+(0,-10pt__) below
+ line left_ dimen_/4 from A2.In2
+ ground
+
+ dot(at A2.Out)
+ DP1: npair(,3,4) with .E at (A2.Out,Q14.B)+(elen_*1.25,0)
+ line from A2.Out to (A2.Out,DP1.G) then to DP1.G
+ line from DP1.E to (DP1.E,R3.bottom); dot
+ D4: reversed(`diode',up_ dimen_/2 from DP1.S)
+ D3: reversed(`diode',up_ dimen_/2 from Here+(0,-dimen_/7))
+ llabel(,"`OMC-V'" rjust "$D_3$" rjust "$D_4$")
+ DP2: ppair(,1,2) with .E at (DP1.E,Q13.B)
+ D1: diode(down_ dimen_/2 from DP2.S)
+ D2: diode(down_ dimen_/2 from Here+(0,dimen_/6))
+ { "$D_1$" rjust "$D_2$" rjust "`OMC-V'" rjust at last [].nw }
+ dot(at (Here,A2))
+ line to D2.bottom
+ line from DP2.G to (A2.Out,DP2.G) then to A2.Out
+ line from DP2.E to (DP2.E,R2.top); dot
+
+ T: dot(at (DP1.E,A2)+(dimen_,0))
+ DP3: npair(,7,8) with .G at (Here,DP1.G)+(dimen_/4,0)
+ dot(at DP3.E)
+ line to Q14.B
+ DP4: ppair(,5,6) with .G at (DP3.G,DP2.G)
+ dot(at DP4.E)
+ line to Q13.B
+ line from DP3.G to (T,DP3.G) then to (T,DP4.G) then to DP4.G
+ R11: resistor(down_ dimen_ from DP4.S)
+ rlabel(,"$R_{11}$" rjust "\unit{20}{}")
+ D5: diode(up_ from DP3.S to (DP3.S,A2),Z)
+ llabel(,"$D_5$" rjust "1N4729$_{\strut}$")
+ line to R11.end
+ C4: capacitor(right_ dimen_*1.3 from DP3.S,C)
+ llabel(,C_4); rlabel(,\unit{0.68}{\micro\farad})
+ C3: capacitor(right_ dimen_*1.3 from DP4.S,C)
+ llabel(,C_3); rlabel(,\unit{0.68}{\micro\farad})
+ dot
+ dot(at (Here,R6))
+ C2: reversed(`capacitor',left_ dimen_*1.3,C)
+ rlabel(,C_2); llabel(,\unit{0.1}{\micro\farad})
+ line to R6.end
+
+ R5: resistor(up_ from R6.end to (R6.end,Q13.B))
+ rlabel(,"$R_5$" ljust "\unit{100}{\kilo}")
+ dot(at R5.top-(0,dimen_/2))
+ line left_ dimen_/2
+ capacitor(down_ dimen_,C)
+ rlabel(,"$C_1$" rjust "\unit{1}{\micro\farad}")
+ ground(,T)
+
+ line from DP4.E to (DP4.E,R2.bottom)
+ resistor(up_ to (Here,R2.top))
+ rlabel(,"$R_9$" ljust "\unit{910}{}")
+ dot
+ resistor(down_ from DP3.E to (DP3.E,R3.bottom))
+ llabel(,"$R_{10}$" ljust "\unit{910}{}")
+ dot
+
+ line from R5.top to (R5,Q13.E)
+ resistor(right_ elen_)
+ clabel(,"$R_4$" "\vphantom{x}" "\unit{100}{\kilo}")
+ line to (C4.end,Here) then to C4.end
+
+ DP5: npair(L,11,10) with .E at (C4.end,DP1.E)+(elen_*0.8,0)
+ line from DP5.E to (DP5.E,R3.bottom); dot
+ line from R3.bottom to Here+(dimen_/2,0)
+ dot(,,1)
+ `"$-E_{CC}$"' ljust at last [].e
+ D6: diode(up_ from DP5.S to (DP5.S,A2),Z)
+ llabel(,"$D_6$" rjust "1N4728")
+ DP6: ppair(L,12,9) with .E at (DP5.E,DP2.E)
+ line from DP6.E to (DP6.E,R2.top); dot
+ line from R2.top to Here+(dimen_/2,0)
+ dot(,,1)
+ `"$+E_{CC}$"' ljust at last [].e
+ resistor(down_ from DP6.S to (DP6.S,C2))
+ rlabel(,"$R_{12}$" rjust "\unit{20}{}")
+ dot
+ { line to C2.e }
+ line to D6.end
+
+ Vr: dot(at (DP6.G,V1.top)+(dimen_/4,0))
+ line from DP6.G to (Vr,DP6.G) then to (Vr,DP5.G) then to DP5.G
+ reversed(`arrowline',right_ dimen_/2 from Vr); llabel(,i_2)
+ V2: gap(down_ dimen_,1); llabel(+,V_2,-)
+ line down_ dimen_/4 chop dotrad_ chop 0; ground(,T)
+
+ dot(at (Vr,T))
+ resistor(left_ to (DP6.E,Here))
+ clabel("$R_{15}$" "" "\unit{200}{}" ljust)
+ line to (DP1.E,Here)
+ dot
+
+ iflatex(ifpsfrag(,`latexcommand(})'))
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Decoder.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Decoder.m4
new file mode 100644
index 00000000000..f6686bf139e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Decoder.m4
@@ -0,0 +1,24 @@
+.PS
+# Decoder.m4
+log_init
+
+ define(`nlines',3) # OK for nlines from 1 to approximately 4
+
+ define(`ndata',`eval(2**nlines-1)')
+ for_(0,nlines-1,1,
+ `{right_; A`'m4x: dot(at rsvec_(0,m4x*AND_ht))
+ "$A_{m4x}$" at last [].w rjust}')
+
+ for_(0,ndata,1,
+ `define(`m4y',m4x) down_
+ G`'m4y: AND_gate(nlines) \
+ at A0+svec_(AND_ht*3/2,(m4y+1/2)*AND_ht*3/2)
+ line down linewid/3; dot; "$\;D_{m4y}$" at last [].s below
+ for_(0,nlines-1,1,
+ `ifelse(eval(m4y/2**m4x%2),0,
+ `up_; NOT_circle with .s at',`move to') G`'m4y.In`'eval(nlines-m4x)
+ line to (Here,A`'m4x) ifelse(m4y,ndata,`then to A`'m4x',`; dot')
+ ')
+ ')
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Drive.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Drive.m4
new file mode 100644
index 00000000000..48a7165ff9f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Drive.m4
@@ -0,0 +1,74 @@
+.PS
+# `Drive.m4'
+cct_init
+
+define(`synchmachine',`[ r = ifelse(`$1',,`dimen_*3/4',(`$1')/2)
+ C: circle rad r
+ Point_(120)
+ line from C to C+vec_(r*2/9,0); reversed(`inductor',to rvec_(r*2/3,0))
+ W2: Here
+ Point_(240)
+ line from C to C+vec_(r*2/9,0); reversed(`inductor',to rvec_(r*2/3,0))
+ W3: Here
+ line from C right_ r*2/9; inductor(right_ r*2/3)
+ W1: Here ]')
+
+ bht = sourcerad_*10
+ dlen = dimen_*2/3
+define(`Diodepair',`[ diode(up_ dlen); line up bht-2*dlen; diode(up_ dlen) ]')
+
+define(`gbt',`bi_trans(`$1',`$2',CBUHdE`$3')')
+define(`dotrad_',dotrad_*0.5/linewid)
+define(`GBTpair',`[linewid = 0.5*3/4
+ Q1: gbt(up_ bht/2,,D)
+ Q2: gbt(up_ bht/2,,D) with .C at Q1.E
+ ]')
+
+SW: ground
+ line up
+W: Here
+ line right dimen_/3; dot
+ ssep = sourcerad_*2.5
+ { line up ssep; S1: source(right_ dimen_,AC) }
+ { S2: source(right_ dimen_,AC) }
+ { line down ssep; S3: source(right_ dimen_,AC) }
+
+ dsep = dimen_/2
+D1: Diodepair at S2.e
+D2: Diodepair at D1+(dsep,0); dot(at D2.n); dot(at D2.s)
+D3: Diodepair at D2+(dsep,0); dot(at D3.n); dot(at D3.s)
+ dot(at (D1,S1))
+ dot(at (D2,S2)); line to S2.e
+ dot(at (D3,S3)); line to S3.e
+
+ line from D1.n to D3.n
+ inductor(right_ dimen_)
+T: dot
+ capacitor(to (Here,D1.s),C)
+ dot
+
+ gsep = dimen_*1.25
+G1: GBTpair with .Q1.C at T+(dimen_,0)
+G2: GBTpair at G1+(gsep,0)
+G3: GBTpair at G2+(gsep,0)
+
+ line from G3.Q1.C to T
+ dot(at (G1.Q1.C,T))
+ dot(at (G2.Q1.C,T))
+ line from G3.Q2.E to D1.s
+ dot(at (G1.Q1.E,D1.s))
+ dot(at (G2.Q1.E,D1.s))
+
+M: synchmachine with .C at G3.e+(dimen_*2,0)
+ sg = dimen_/8
+L: (0.5<G3.e,M.w>,D1.s)-(sg,0)
+ line from M.W1 to (M.W1,L) then to L \
+ then up M.C.y-L.y-sg then to G3.Q2.C+(0,-sg); dot
+ line from M.W3 down M.W3.y-L.y-sg*2 then to L+(sg*2,sg*2)\
+ then up M.C.y-L.y-sg*2 then to G2.Q2.C; dot
+ line from M.W2 to (L,M.W2) \
+ then down M.W2.y-G1.Q2.C.y-sg then to G1.Q2.C+(0,sg); dot
+
+ line right dimen_/3 from M.e then down M.e.y-SW.y
+ ground
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Escher.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Escher.m4
new file mode 100644
index 00000000000..675fa2c00d5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Escher.m4
@@ -0,0 +1,77 @@
+.PS
+threeD_init
+ 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)
+
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Euro.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Euro.m4
new file mode 100644
index 00000000000..34058d91474
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Euro.m4
@@ -0,0 +1,138 @@
+% Euro symbol; process this file as follows:
+% m4 Euro.m4 > Euro.pic; dpic -p Euro.pic > Euro.tex ; latex Euro; dvips Euro
+\documentclass{article}
+\usepackage{pstricks}
+\usepackage{boxdims,xcolor}
+\pagestyle{empty}
+\thispagestyle{empty}
+\begin{document}
+\noindent\vspace{2ex}
+.PS
+include(pstricks.m4)
+gen_init
+divert(-1)
+ `euro_simple([height])
+ Basic euro symbol with round outer boundary
+ default height=10pt'
+define(`euro_simple',
+`[ linethick = 0
+ orad = ifelse(`$1',,`5bp__',(`$1')/2)
+ u = orad/6
+ irad = orad - u
+ C: (0,0)
+ D: C+(Rect_(irad,40))
+ CD: move from C+(0,-orad) to D
+ DK: move from D down u
+ Ubot: move from C+(0,u/2) right u
+ Utop: move from Ubot.start+(0,u) right u
+ Ltop: move from C+(0,-u/2) right u
+ Lbot: move from Ltop.start+(0,-u) right u
+ L_edge: C-(7.5*u,0)
+ Start: (C,Utop)
+ slope = (CD.end.y-CD.start.y)/(CD.end.x-CD.start.x)
+shade(0,
+ line from Start to Intersect_(Utop,CD) \
+ then to Intersect_(Ubot,CD) \
+ then to LCintersect(Ubot,C,irad)
+ arc to LCintersect(Ltop,C,irad) with .c at C
+ line to Intersect_(Ltop,CD) \
+ then to Intersect_(Lbot,CD) \
+ then to LCintersect(Lbot,C,irad)
+ arc to (D,C)-(0,D.y-C.y) with .c at C
+ line to LCintersect(DK,C,orad,R)
+ arc cw to LCintersect(Lbot,C,orad) with .c at C
+ line to (L_edge,Here) \
+ then right u/slope up u \
+ then to LCintersect(Ltop,C,orad)
+ arc cw to LCintersect(Ubot,C,orad) with .c at C
+ line to (L_edge,Here) \
+ then right u/slope up u \
+ then to LCintersect(Utop,C,orad)
+ arc cw to LCintersect(CD,C,orad,R) with .c at C
+ line to D
+ arc to LCintersect(Utop,C,irad) with .c at C
+ line to Start
+ ) ]')
+
+ `euro_symbol([ht=val; aspect=val; slant=degrees])
+ Euro symbol with variable aspect ratio and slant
+ defaults: ht=10pt, aspect=1, slant=0
+ e.g., euro_symbol(ht=14pt__; aspect=1.2)'
+
+define(`euro_symbol',`[
+ setkey_(`$1',ht,10pt__) setkey_(`$1',aspect,1) setkey_(`$1',slant,0)
+ linethick = 0
+ orad = m4ht/2
+ u = orad/6
+ irad = orad - u
+ if m4aspect==0 then { squeeze = 1 } else { squeeze = 1/m4aspect }
+ slant = sind(m4slant)
+ C: (0,0)
+ D: C+(Rect_(irad,40))
+ CD: move from C+(0,-orad) to D
+ DK: move from D down u
+ Ubot: move from C+(0,u/2) right u
+ Utop: move from Ubot.start+(0,u) right u
+ Ltop: move from C+(0,-u/2) right u
+ Lbot: move from Ltop.start+(0,-u) right u
+ L_edge: C-(7.5*u,0)
+ Start: (C,Utop)
+ slope = (CD.end.y-CD.start.y)/(CD.end.x-CD.start.x)
+
+shade(0,
+ S: LCintersect(Ubot,C,irad)
+ line from euro_tr(Start) to euro_tr(Intersect_(Utop,CD)) \
+ then to euro_tr(Intersect_(Ubot,CD)) \
+ then to euro_tr(S)
+ euro_arc(S,LCintersect(Ltop,C,irad),irad)
+ S: LCintersect(Lbot,C,irad)
+ line to euro_tr(Intersect_(Ltop,CD)) \
+ then to euro_tr(Intersect_(Lbot,CD)) \
+ then to euro_tr(S)
+ euro_arc(S,((D,C)-(0,D.y-C.y)),irad)
+ S: LCintersect(DK,C,orad,R)
+ line to euro_tr(S)
+ euro_arc(S,LCintersect(Lbot,C,orad),orad,cw)
+ S: LCintersect(Ltop,C,orad)
+ E: LCintersect(Lbot,C,orad)
+ line to euro_tr((L_edge,E)) \
+ then to euro_tr((L_edge,E)+(u/slope,u)) \
+ then to euro_tr(S)
+ E: LCintersect(Ubot,C,orad)
+ euro_arc(S,E,orad,cw)
+ S: LCintersect(Utop,C,orad)
+ line to euro_tr((L_edge,E)) \
+ then to euro_tr((L_edge,E)+(u/slope,u)) \
+ then to euro_tr(S)
+ euro_arc(S,LCintersect(CD,C,orad,R),orad,cw)
+ line to euro_tr(D)
+ euro_arc(D,LCintersect(Utop,C,irad),irad)
+ line to euro_tr(Start)
+) ]')
+
+ `aspect ratio and slant transformation'
+define(`euro_tr',`((`$1').x*squeeze+(`$1').y*slant,(`$1').y)')
+ `transformed arc, centre C'
+define(`euro_arc',
+`M4X: `$1'; as = atan2(M4X.y-C.y,M4X.x-C.x)
+ M4X: `$2'; ae = atan2(M4X.y-C.y,M4X.x-C.x)
+ ifelse(`$4',cw,`if ae > as then { ae -= twopi_ }',
+ `if ae < as then { ae += twopi_ }')
+ ax = ae-as
+ n = max(5,ceiling_(abs(ax)/(10*dtor_)))
+ for i=0 to n do { P[i]: euro_tr((rect_(`$3',as+i/n*ax))) }
+ fitcurve(P,n)
+ move to P[n] ')
+
+divert(0)dnl
+
+euro_simple
+move
+euro_symbol(slant=15)
+move
+euro_simple(72bp__)
+move
+euro_symbol(ht=72bp__*2; aspect=1.0; slant=15)
+
+.PE
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Floor.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Floor.m4
new file mode 100644
index 00000000000..0f3076174a3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Floor.m4
@@ -0,0 +1,25 @@
+.PS
+# Floor.m4
+gen_init
+ s = 0.25
+ s60 = s*sqrt(3)/2
+ c60 = s/2
+ ni = 9
+ nj = 6
+ cellw = 3*s
+ cellh = 2*s60
+ B:box wid nj*cellw ht ni*cellh shaded rgbstring(0,1,0)
+
+ for i=1 to ni do {
+ for j=1 to nj do {
+ line shaded rgbstring(0,0,1) \
+ from B.sw+((j-1)*cellw,(i-1)*cellh) \
+ right c60 up s60 then right 2*s then up s60 right c60 then left s \
+ then down cellh left 2*c60 then left s
+ line shaded rgbstring(1,0,0) \
+ from B.sw+((j-1)*cellw,i*cellh) \
+ right s then down cellh right 2*c60 then right s then up s60 left c60 \
+ then left 2*s then left c60 up s60
+ }
+ }
+.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
new file mode 100644
index 00000000000..f4fa766f1a9
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Flow.m4
@@ -0,0 +1,108 @@
+.PS
+# Flow.m4
+gen_init
+ifdef(`FlowchartDefs_',,`include(FlowchartDefs.m4)')
+
+# Could use xcolor with option dvipsnames but define color here for portability:
+define(`Thistle',`rgbstring(0.85,0.75,0.85)')dnl
+define(`RubineRed',`rgbstring(0.81,0,0.35)')dnl
+define(`YellowGreen',`rgbstring(0.68,1,0.18)')dnl
+define(`SeaGreen',`rgbstring(0.13,0.70,0.67)')dnl
+define(`Goldenrod',`rgbstring(0.85,0.65,0.13)')dnl
+
+ linethick_(1.0)
+ arrowwid = 0.05
+ arrowht = 0.1
+ fillval = 0.8
+ down
+
+Case: Fcase(,
+ "Test 1",[Fbox("Task 1",, shaded Thistle); W:last [].W; N:last [].N
+ arrow down linewid/3 from last [].S
+ Fbox("Task 1.5",, shaded Thistle) with .N at Here
+ E:last [].E; S:last [].S],
+ "Test 2",Fbox("Task 2" "is bigger", wid fboxwid*1.2 ht fboxht*3/2, \
+ shaded SeaGreen),
+ "Test 3",Fbox("Task 3",, shaded RubineRed)dnl
+ )
+
+ "\sl .N" at Case.N rjust above; "\sl .S" at Case.S rjust below
+ "\sl .E" at Case.E ljust; "\sl .W" at Case.W rjust
+ "\sl Case statement" below at Case.s+(0,-0.2)
+ move to Case.nw+(-12bp__,10bp__)
+
+Whiledo: Fwhiledo("$i < n$",,,Fbox("Task"),"T" above ljust at Test.E) \
+ with .nw at Case.ne+(0.25,0)
+
+ "\sl .N" at Whiledo.N rjust; "\sl .S" at Whiledo.S rjust below
+ "\sl .E" at Whiledo.E ljust; "\sl .W" at Whiledo.W rjust
+ "\sl While-do" below at Whiledo.s+(0,-0.2)
+
+Repeatuntil: Frepeatuntil("$n \geq 5$",,,Fbox("Task"),
+ "T" at Test.E above ljust) with .nw at Whiledo.sw + (0.25,-1)
+
+ "\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
+ "\sl Repeat-until" below at Repeatuntil.s+(0,-0.2)
+
+Ifthenelse: Fifthenelse("$A<B$",,,
+ Fbox("False"),
+ Fbox("True",ht fboxht*1.2 wid fboxwid)dnl
+ ) with .nw at Repeatuntil.sw +(0.5,-0.5)
+
+ "\sl .N" at Ifthenelse.N rjust above; "\sl .S" at Ifthenelse.S below rjust
+ "\sl .E" at Ifthenelse.E ljust; "\sl .W" at Ifthenelse.W rjust
+ "\sl If-then-else" below at Ifthenelse.s+(0,-0.3) \
+ "\sl (the True and False tasks are optional)"
+
+# Compound statement:
+[ right
+ ellipse shaded YellowGreen "Start"
+ arrow right linewid/2
+
+ Fbox("First task") with .W at Here
+ arrow down linewid/2 from last [].S
+
+ Fifthenelse("Test 1",,,
+ Frepeatuntil("$i \geq 5$",,shaded Goldenrod,Fbox("Task")),
+ Fifthenelse("$A < B$",,shaded Goldenrod,
+ Fbox("Left"),
+ Fbox("Right"),
+ "T" at Test.E above ljust),
+ "T" at Test.E above ljust) with .N at Here
+
+ A: arrow down 0.25 from last [].S ] with .nw at Case.sw + (-12bp__,-0.7)
+
+ "\sl Compound statement" below at last [].A.end
+
+Example: [ fillvalue = 0.8; awid = linewid/2; right_
+ Start: ellipse wid boxwid/2 ht boxwid/3 shaded "green"
+ arrow right_ awid
+ B1: Fbox("Planejamento")
+ B2: Fbox(`"Execu\c{c}\~ao"') with .W at B1.E+(awid*3,0)
+ B3: Fbox(`"Sele\c{c}\~ao"') with .W at B2.E+(awid*3,0)
+ LT: Ftest(`"Avalia\c{c}\~ao do" "Planejamento"',
+ wid fboxwid*1.5 ht fboxht*2.0,
+ shaded YellowGreen,
+ "Correto" at Box.e above ljust;
+ "Incompleto" at Box.w above rjust) with .S at 0.5 between B1.ne and B2.nw
+ arrow from B1.E to (LT.S,B1.E) then to LT.S
+ arrow from LT.W to (B1.N,LT.W) then to B1.N
+ arrow from LT.E to (B2.N,LT.E) then to B2.N
+ RT: Ftest(`"Avalia\c{c}\~ao da" "Execu\c{c}\~ao"',
+ wid fboxwid*1.5 ht fboxht*2.0,
+ shaded YellowGreen,
+ "Correto" at Box.e below ljust;
+ "Incompleto" at Box.w below rjust) with .N at 0.5 between B2.se and B3.sw
+ arrow from B2.E to (RT.N,B2.E) then to RT.N
+ arrow from RT.W to (B2.S,RT.W) then to B2.S
+ arrow from RT.E to (B3.S,RT.E) then to B3.S
+ B4: Fbox(`"Extra\c{c}\~ao"') with .S at B3.N+(0,awid)
+ arrow from B3.N to B4.S
+ arrow right_ awid from B4.E
+ B5: Fbox(`"Conclus\~ao"')
+ ellipse wid boxwid/2 ht boxwid/3 shaded "red" at (B5.S,Start)
+ arrow down_ awid from B5.S to last ellipse.n
+] with .nw at last [].sw+(0,-fboxht)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/FlowchartDefs.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/FlowchartDefs.m4
new file mode 100644
index 00000000000..bb039338da8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/FlowchartDefs.m4
@@ -0,0 +1,128 @@
+divert(-1)
+ FlowchartDefs.m4
+ `Some experimental flow-chart macros.
+ In the following, every subchart is in
+ [] brackets, with .N, .S, .E and .W
+ internally defined. Follow this convention
+ if you create compound constructs.
+
+ Generally, the first argument is one
+ or more strings; the second adjusts
+ the size, and the third can be used
+ to add color, dashed lines, labels,
+ or other embellishements. Default is
+ grey fill if arg3 is blank.
+
+ These macros have been renamed from earlier
+ versions because of slight differences of
+ arguments.'
+
+define(`FlowchartDefs_')
+
+ `Default sizes:'
+define(`fboxwid',linewid*2)
+define(`fboxht',linewid*0.75)
+define(`farrowht',linewid*0.5)
+
+ `Fbox( "text", wid expr ht expr,
+ attributes ) The basic task box: arg1 may
+ be 1 or more label strings. Attributes
+ include box line and fill specs.
+ To adjust the box size to the size of
+ the typeset text, see the \boxdims macro
+ in the manual. Example:
+ Fbox("$x < 1$",,
+ shaded rgbstring(0.46,0.53,0.63))'
+define(`Fbox',`[ boxwid = fboxwid; boxht = fboxht
+ Box: box `$2' ifelse(`$3',,`fill_(fillval)',`$3') `$1'
+ N: Box.n; S:Box.s; E:Box.e; W: Box.w
+ `$4']')
+
+ `If-then
+ Ftest( "text", wid expr ht expr, attributes )'
+define(`Ftest',`[boxwid = fboxwid*0.8; boxht = fboxht*1.4
+ Box: box ifelse(`$2',,,`$2') invis
+ N: Box.n; S: Box.s; E: Box.e; W: Box.w
+ line from 0.5 between last box.n and last box.e \
+ to last box.e then to last box.s then to last box.w then to last box.n \
+ then to 0.5 between last box.n and last box.e \
+ ifelse(`$3',,`fill_(fillval)',`$3')
+ ifelse(`$1',,,`$1' at Box)
+ `$4']')
+
+ `case statement
+ Fcase(wid expr ht expr,
+ "Test string 1",task, ...,
+ "Test string n",task)'
+ `arg1 adjusts the size of the tests
+ A task is a flow subchart with internal names .E and .S defined
+ The test blocks are labeled Test1, Test2, ... and the tasks are
+ labeled Task1, Task2, ... '
+define(`Fcase',`[ down; S: Here; sx = S.x
+ Fcaseloop_(1,$@)
+ ifelse(`$2',,`E:S; W:S; N:S',
+ `E:(sx+linewid/2,Task1.E.y); W:Test1.W; N:Test1.N')
+ Fcasearrow_(1,$@)
+ arrow from E to (E,S) then to S ]')
+
+ define(`Fcaseloop_',`ifelse(`$3',,,
+ `Test`$1': Ftest(`$3',`$2') with .N at S
+ Task`$1': `$4' with .nw at Test`$1'.E+(linewid/2,min(Test`$1'.ht,fboxht)/2)
+ arrow right linewid/4 from Test`$1'.E \
+ then down Test`$1'.E.y-Task`$1'.W.y then to Task`$1'.W
+ S: (Test`$1'.S.x,min(Test`$1'.S.y,Task`$1'.S.y)-linewid/3)
+ ifelse(`$5',,`line',`arrow') from Test`$1'.S to S
+ sx = max(sx,Task`$1'.E.x)
+ Fcaseloop_(incr($1),`$2',shift(shift(shift(shift($@)))))')')
+ define(`Fcasearrow_',`ifelse(`$3',,,
+ `arrow from Task`$1'.E to (E,Task`$1'.E)
+ Fcasearrow_(incr($1),`$2',shift(shift(shift(shift($@)))))')')
+
+ `while statement with explicit test
+ Fwhiledo("test text", wid x ht y, attributes, task spec )
+ The task structure is given label Task '
+define(`Fwhiledo',`[ down
+ Test: Ftest(`$1',`$2',`$3')
+ arrow right linewid/2 from Test.E
+ Task: `$4' with .W at Here
+ E: Task.E; W: Test.w; S: Test.S
+ arrow up max(linewid/4,Test.n.y-Task.n.y+arrowht*1.5) \
+ from Task.N then left Task.x-Test.x
+ N: Here
+ arrow to Test.n
+ `$5']')
+
+ `repeat statement with explicit test
+ Frepeatuntil("test",wid x ht y,attributes, task spec )
+ The task structure is given label Task '
+define(`Frepeatuntil',`[ N: Here
+ Task: ifelse(`$4',,Here,`$4' with .N at N)
+ W: Task.W
+ arrow down linewid/3
+ Test: Ftest(`$1',`$2',`$3')
+ E: Task.E+(linewid/2+max(0,Test.e.x-Task.e.x),0)
+ arrow from Test.e to (E,Test) then to E then to Task.E
+ S: Test.S
+ `$5']')
+
+ `if-then-else
+ Fifthenelse( "test", wid x ht y, attributes,
+ left tasks, right tasks)
+ The left task structure is given label Ltask and the right
+ task structure is given label Rtask '
+define(`Fifthenelse',`[ Test: Ftest(`$1',`$2',`$3')
+ N: Test.N
+ Ltask: ifelse(`$4',,`Test.S; W:Test.W; LS:Ltask',
+ `$4 with .ne at ((Test.W.x+Test.x)/2,Test.S.y)
+ W: Ltask.W; LS:Ltask.S
+ arrow from Test.W to (Ltask.N,Test.W) then to Ltask.N')
+ Rtask: ifelse(`$5',,`Test.S; E:Test.E; RS:Rtask',
+ `$5 with .nw at ((Test.E.x+Test.x)/2,Test.S.y)
+ E: Rtask.E; RS: Rtask.S
+ arrow from Test.E to (Rtask.N,Test.E) then to Rtask.N')
+ S: (Test.x,min(LS.y,RS.y)-linewid/3)
+ arrow from LS to (LS,S)
+ arrow from RS to (RS,S)
+ line to (LS,Here)
+ `$6']')
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/GnuMakefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/GnuMakefile
new file mode 100644
index 00000000000..4b7d99c4538
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/GnuMakefile
@@ -0,0 +1,119 @@
+# Makefile for Circuit macros (based on Version 8.5.1)
+# Use GNU make.
+
+SRC = $(wildcard *.m4)
+TARGET = $(SRC:%.m4=%.$(MODE))
+
+CMLIBDIR = /usr/local/share/Circuit_macros
+CMLIBDIR = $$(HOME)/lib
+CMLIBS = liblog.m4
+CMLIBS = libgen.m4
+
+DPIC = dpic
+GPIC = pic
+M4 = m4 -I $(CMLIBDIR)
+
+# select one of tex, eps, pdf, svg, mp or fig
+MODE = tex
+
+# select one of pstricks, pgf, mfpic, latex or tpic
+# (for .tex output)
+TEXMODE = pgf
+TEXMODE = pstricks
+
+# select one of raw or psfrag
+# (for .eps output)
+EPSMODE = raw
+
+
+
+# ---- DO NOT CHANGE THE FOLLOWING LINES ----
+PIC = $(DPIC)
+
+# for .tex
+TPIC = $(PIC)
+ifeq ($(TEXMODE),pstricks)
+ TPICOPT = -P
+ TCMDRIVER = $(TEXMODE).m4
+else ifeq ($(TEXMODE),pgf)
+ TPICOPT = -g
+ TCMDRIVER = $(TEXMODE).m4
+else ifeq ($(TEXMODE),mfpic)
+ TPICOPT = -m
+ TCMDRIVER = $(TEXMODE).m4
+else ifeq ($(TEXMODE),latex)
+ TPICOPT = -e
+ TCMDRIVER =
+else ifeq ($(TEXMODE),tpic)
+ TPIC = $(GPIC)
+ TPICOPT = -t
+ TCMDRIVER = gpic.m4
+else
+ TERROR = TRUE
+endif
+
+# for .eps
+ifeq ($(EPSMODE),raw)
+ EPICOPT = -r
+ ECMDRIVER = postscript.m4
+else ifeq ($(EPSMODE),psfrag)
+ EPICOPT = -f
+ ECMDRIVER = $(EPSMODE).m4
+else
+ EERROR = TRUE
+endif
+
+
+.SUFFIXES: .m4 .tex .eps .pdf .svg .mp .fig
+
+.m4.tex:
+ifeq ($(TERROR),TRUE)
+ @echo "Invalid TEXMODE:" $(TEXMODE)
+ @exit 1 \
+else
+ $(M4) $(CMLIBS) $(TCMDRIVER) $< > $*.pic
+ $(TPIC) $(TPICOPT) $*.pic > $*.tex
+endif
+
+.m4.eps:
+ifeq ($(EERROR),TRUE)
+ echo "Invalid EPSMODE:" $(EPSMODE)
+ @exit 1 \
+else
+ $(M4) $(CMLIBS) $(ECMDRIVER) $< > $*.pic
+ $(PIC) $(EPICOPT) $*.pic > $*.eps
+endif
+
+.m4.pdf:
+ $(M4) $(CMLIBS) $< > $*.pic
+ $(PIC) -d $*.pic > $*.pdf
+.m4.svg:
+ $(M4) $(CMLIBS) svg.m4 $< > $*.pic
+ $(PIC) -v $*.pic > $*.svg
+.m4.mp:
+ $(M4) $(CMLIBS) mpost.m4 $< > $*.pic
+ $(PIC) -s $*.pic > $*.mp
+.m4.fig:
+ $(M4) $(CMLIBS) xfig.m4 $< > $*.pic
+ $(PIC) -x $*.pic > $*.fig
+
+-include GNUmakefile.local
+
+all: $(TARGET)
+
+clean:
+ rm -f *~
+ rm -f $(SRC:%.m4=%.pic)
+
+distclean: clean
+
+# use carefully!!!
+dodistclean: distclean
+ rm -f $(SRC:%.m4=%.tex)
+ rm -f $(SRC:%.m4=%.eps)
+ rm -f $(SRC:%.m4=%.pdf)
+ rm -f $(SRC:%.m4=%.svg)
+ rm -f $(SRC:%.m4=%.mp)
+ rm -f $(SRC:%.m4=%.fig)
+
+-include GNUmakefile.localdep
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Heathkit.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Heathkit.m4
new file mode 100644
index 00000000000..5cf7ca38d26
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Heathkit.m4
@@ -0,0 +1,353 @@
+.PS
+# Heathkit.m4
+cct_init
+# Landscape
+maxpswid = 11
+maxpsht = 8.5
+
+# Set small text size
+ iflatex(`ifpsfrag(`textht = 7.5bp__; textoffset = 0.5bp__',
+ `latexcommand({\tiny\sf)') ')
+
+# Grid parameters
+ picwid = 8.5
+ picht = 6
+ g = 1/12
+
+# Element scaling
+ linewid = 8*g
+define(`dimen_',dimen_*4/5)
+# Default sizes
+ boxwid = 2*g
+ boxht = 2*g
+ arrowht = arrowht*2/3
+
+# Grid
+ ifdpic(`linethick_(0.4)',`linethick_(0)')
+ for i=0 to picwid/g do { line color "lightgray" up picht from (i*g,0) }
+ for i=0 to picwid/g by 10 do { sprintf("%g",i) at (i*g,0) below }
+ for i=0 to picht/g do { line color "lightgray" right picwid from (0,i*g) }
+ for i=0 to picht/g by 10 do { sprintf("%g",i) at (0, i*g) rjust }
+ linethick_(0.8)
+
+ifdpic(`
+ spline outlined "white" shaded "white" \
+ from (0,picht+g) down g then down picht/5 then right picwid/5
+ for i=1 to 4 do { contline down picht/5 then right picwid/5 }
+ contline right 2*g then up 2*g
+ contline up picht-2*g then up g then left g ')
+
+# Place the bottom inductor on the grid
+ L1: inductor(down_ 13*g from (80*g,22*g),,13,,g)
+ L2: inductor(down_ 10*g from L1.start+(0,21*g),,10,,g)
+ L3: inductor(down_ 10*g from L2.start+(0,12*g),,10,M,g)
+ line from M4Core1.end to (M4Core1,L1.end)
+ line from M4Core2.end to (M4Core2,L1.end)
+ Scrn: 2 between M4Core1.start and M4Core2.start
+ line dashed from Scrn to (Scrn,L1.end)
+ ground
+ L4: inductor(up_ 5*g from (Scrn.x+M4Core1.x-L2.c.x,L2.start.y-2*g),,5,,g)
+ L5: inductor(up_ 5*g from (L4,L2.end+(0,g)),,5,,g)
+
+# Circuit board
+ Board: box dashed thick 2 wid 58*g ht 55*g with .se at L1.end+(-7*g,-2*g)
+ P: box invis wid 12*g ht 4*g with .s at Board.sw+(26*g,0)
+ { "POWER SUPPLY" ljust "CIRCUIT BOARD" ljust at P.w+(g,0) }
+ line dashed thick 2 from P.sw to P.nw; line dashed thick 2 to P.ne
+ line dashed thick 2 to P.se
+
+define Pad { P`$1': box fill_(1) "$1" }
+# Board connections on the right
+ Pad(1) at (Board.e,L1.end)
+ line from P1.e to L1.end "RED" above
+ Pad(2) at (Board.e,L1.start)
+ line from P2.e to L1.start "RED" above
+ Pad(3) at (Board.e,L2.end)
+ GRN1: line left 4*g from L2.start "GRN" above ; ground
+ GRN2: line from P3.e to L2.end "GRN" above
+ spline <-> from GRN2.end+(-g,0) up 2.5*g right 0.5*g then up 5*g left g \
+ then up 2.5*g right 0.5*g
+ box invis fill_(1) wid 3*g ht g "\unit{6}{\hbox{VAC}}" at L2.c-(2*g,0)
+ Pad(4) at P3-(0,3*g)
+ line right_ 3*g from P4.e "BRN" above
+ arrow down_ 2*g ht arrowht*2/3
+ "TO DIAL" "LAMPS" at Here+(0,-g)below
+ Pad(5) at (Board.e,L3.end)
+ line from P5.e to L3.end "BLU" above
+ Pad(7) at (Board.e,L3.start)
+ line from P7.e to L3.start "BLU" above
+ Pad(6) at 0.5 between P5 and P7
+ line from P6.e to L3.c "BLU-YEL" above
+
+# Power wiring, plug, switch
+define(`socket',`[
+ Outer: box wid dimen_*2/3 ht dimen_/2*3/4
+ L: box wid dimen_/16 ht dimen_/4 at Outer-(dimen_/6,0)
+ R: box wid dimen_/16 ht dimen_/4 at Outer+(dimen_/6,0)
+ line from Outer.w to L.w
+ line from Outer.e to R.e
+ ] ')
+
+ BLK: line from L4.end to (int(L4.end.x/g+8)*g,L4.end.y) "BLK" below ; dot
+ b = lin_leng(BLK)
+ BLKYEL: line from L4.start right_ b "BLK-YEL" above ; dot
+ BLKGRN: line from L5.end right_ b "BLK-GRN" below ; dot
+ BLKRED: line from L5.start right_ b "BLK-RED" above ; dot
+ line right_ g; PL: dot
+ line from BLKYEL.end right g then to Here+(0,-g)
+ fuse(down_ 3*g,D)
+ rlabel(,"\unit{3}{\ampere} FUSE" rjust "SLOW BLOW")
+ line to (Here.x,int(Here.y/g)*g-g); dot
+ Sckt1: socket at Here+(5*g,0)
+ line from Sckt1.w to (PL,Sckt1); A: dot; "A" rjust
+ line from Sckt1.e right_ lin_leng(last line); B: dot; "B" ljust
+ Sckt2: socket at (Sckt1,P1+(0,6*g))
+ line from Sckt2.w to (A,Sckt2); dot
+ line from Sckt2.e to (B,Sckt2); dot
+ Sckt3: socket at (Sckt1,P1+(0,2*g))
+ line from Sckt3.w to (A,Sckt3); dot
+ line from Sckt3.e to (B,Sckt3); dot
+
+define(`plug',`[ w = dimen_*2/3; q = 0.25*w
+ F: line right_ w
+ arc cw from F.start to F.end with .c at F.c
+ T1: F.c+(-q,w/2+g/2)
+ T2: F.c+( q,w/2+g/2)
+ line from T1 to (T1,F.c)-(0,2*g)
+ line from T2 to (T2,F.c)-(0,2*g) ]')
+
+ PP: plug with .F.c at Sckt3+(0,-8*g)
+ "\unit{120}{\hbox{VAC}}" ljust "\unit{50/60}{\hertz}" ljust at PP.e
+
+define(`pwrswitch',`[ right; circlerad = 1.75*g/2
+ C1: circle "1"
+ C4: circle "4"
+ C2: circle "2" with .n at C1.s+(0,-C1.rad)
+ C5: circle "5"
+ C3: circle "3" with .n at C2.s+(0,-C1.rad)
+ C6: circle "6"
+ hatchbox(wid g ht C2.n.y-C3.s.y,0.05) with .w at 0.5 between C5.e and C6.e
+ ]')
+
+ Psw: pwrswitch with .C4.e at Sckt1+(0,-4*g)
+ "POWER" at Psw.w+(-2*g,0) rjust
+ arrow up Psw.ht/2 at Psw.e+(1.5*g,0)
+ "ON" above; "OFF" at last arrow.start below
+ line from Psw.C1.w to (A,Psw.C1) then to A
+ line from Psw.C2.w to (A,Psw.C2); contline to (Here,PP.T1) then to PP.T1
+ line from PP.T2 to (B,PP.T2) then to (B,L4.end) then to L4.end
+ line from BLKGRN.end to (B,BLKGRN); dot
+
+# Bottom connections
+ Pad(25) at Board.se+(-3*g,0)
+ R516: resistor(down_ 6*g from P25.s); rlabel(,"R516" rjust "22"); ground(,T)
+ dot(at P25.s+(0,-g)); line right_ 5*g
+ reversed(`source',down_ 4*g,B); llabel(,"No 49" ljust "HI" ljust "TEMP")
+ line to (P25,Here); dot
+ t = linethick; linethick_(0.4)
+ arrow <- from P25.s+(0,-g/2) right_ 2*g up_ g/4; "BRN" ljust; linethick_(t)
+
+ Pad(24) at P25+(-4*g,0)
+ line from P24.s to (P24,R516.end); ground(,T)
+ Pad(23) at Board.sw+(12*g,0)
+ line from P23.s to (P23,R516.end); ground(,T)
+
+ Pad(22) at Board.sw+(0,3*g)
+ R514: resistor(right_ 8*g from P22.e); llabel(,"R514")
+ rlabel(,"\unit{680}{\kilo}")
+ dot; { ground }
+ line to (P23,Here) then to P23.n
+
+# Diode bridge
+ BE: dot(at (P24,L1.c))
+ d1h = lin_leng(L1)/2
+ diode(left_ d1h up_ d1h); rlabel(,,"D508")
+ BN: dot
+ diode(left_ d1h down_ d1h); rlabel("D506")
+ BW: dot
+ diode(from BE left_ d1h down_ d1h); llabel(,,"D509")
+ BS: dot
+ diode(left_ d1h up_ d1h); llabel(D507)
+ capacitor(down_ from BN to BS,C); llabel("C507",,\unit{.22}{})
+ line from BE to P24.n
+ line from BN to P2.w
+ line from BS to P1.w
+ spline <-> from (BE.x+2*g,BS.y) \
+ up d1h/2 right g/2 then up d1h left g then up d1h/2 right g/2
+ box invis fill_(1) ht 2*g wid 2*g "57" "VAC" at last spline.c
+
+# Left board connections
+ Pad(21) at (Board.w,BW); line from P21.e to BW
+ Pad(19) at P21+(0,-3*g)
+ Pad(20) at P21+(0, 3*g)
+
+# Transistor with circles
+define(`hbi_tr',`[ linewid = linewid*4/4.16
+ Q: bi_tr(`$1',`$2',`$3',E)
+ E: circle rad m4_xyU at 5/4 between Q.A1 and Q.E "E"
+ B: circle rad m4_xyU at 5/4 between Q.A1 and Q.B "B"
+ C: circle rad m4_xyU at 5/4 between Q.A1 and Q.C "C"
+ ]')
+
+# Interior circuits
+ line from P6.w left 2*g; ground
+ line from P5.w left 4*g; dot
+ { C504: capacitor(down_ 4*g,C); llabel("C504",,\unit{.22}{}); ground(,T) }
+ D504: diode(left_ 5*g); rlabel(,"D504"); dot
+ { C505: capacitor(down_ to (Here,C504.end),C+L)
+ rlabel("C505",\unit{100}{},\unit{75}{\volt}); ground(,T) }
+ line right_ to (Here,P7); dot
+ { D503: reversed(`diode',to (D504.start,Here)); llabel(,"D503")
+ line to P7.w }
+ d3 = lin_leng(L3)
+ spline <-> from C504.start+(g/2,0) \
+ up d3/4 right g/4 then up d3*2/4 left g/2 then up d3/4 right g/4
+ box invis fill_(1) ht g wid 4*g "\unit{100}{\hbox{VAC}}" \
+ at last spline.c+(-g,0)
+
+ down_
+ Q503: hbi_tr(,R,P) with .E at (C505,P3)
+ line from Q503.C.e to (P25,Q503.C) then to P25.n
+ line from Q503.B.s to (Q503.B.x,Q503.E.y-4*g)
+ R513: resistor(down_ 5*g); llabel(,"R513" ljust "1500"); ground(,T)
+ line from P19.e to (BW-(2*g,0),P19) then up Q503.E.y-P19.y+2*g
+ R511: resistor(right_ 5*g); llabel(,"R511"); rlabel(,\unit{470}{});
+ line to (Q503.E,Here) then to Q503.E.n
+ line from P20.e to (BW,P20) then up R513.end.y-P20.y
+ resistor(up_ lin_leng(R513))
+ rlabel(,"R512" ljust "5600" ljust "\unit{1}{\watt}")
+ line to (Here,Q503.B) then to Q503.B.w
+ "Q503" "S2091 HI TEMP" "CONTROL" at Q503.E+(1.5*g,4*g)
+ D505: reversed(`diode',right_ from Q503.E.e to (C504,Q503.E)); llabel(,"D505")
+ line to P3.w
+
+ line from P4.w left_ 2*g then up P3.y-P4.y; dot
+ line from D503.end to (R513,D503); dot
+ { Pad(8) at (Here,Board.n) }
+ { line to P8.s }
+ R505: resistor(down_ to (Here,P6))
+ llabel(,"R505" ljust "\unit{12}{\kilo}"); dot
+ { C503: capacitor(down_ to (Here,C505.end),C+L)
+ rlabel(,"C503" rjust "100" rjust "\unit{70}{\volt}")
+ ground(,T) }
+ right_
+ Q502: hbi_tr(,R) with .B at (R511.start,Here)
+ line from Q502.C.e to R505.start
+ line from Q502.B.e to R505.end
+ R504: resistor(down_ from Q502.B.s to (Q502.B,C505.end))
+ rlabel(,"R504" rjust "\unit{51}{\kilo}"); ground(,T)
+ "Q502" "TA7311" "REGULATOR" "CONTROL" at Q502.C+(-1*g,3.5*g)
+
+ Pad(9) at (Q502.E,Board.n)
+ line from Q502.E.n to P9.s
+ Pad(10) at (Q502.B-(9*g,0),Board.n)
+ R502: resistor(left_ from Q502.E.w to (P10,Q502.E))
+ rlabel(,"R502"); llabel(,\unit{150}{}); dot
+
+ Pad(11) at (Board.w,Q502.E)
+ Pad(14) at P11+(0,2.5*g)
+ Pad(12) at P11+(0,-2.5*g)
+ Pad(13) at P12+(0,-2.5*g)
+ line right 2*g from P13.e then up P11.y-P13.y; dot
+ line from P12.e to (Here,P12); dot
+ Pad(15) at P13+(0,-3*g)
+
+ right_
+ Q501: hbi_tr(,R) with .B at P9.n+(0,2*g)
+ line from Q501.B.s to P9.n
+ line from Q501.C.e to (P8,Q501.C) then to P8.n
+ line from Q501.E.w to (P10,Q501.E) then to P10.n
+ "Q501" "2N3055" "REGULATOR" at Q501.n+(0,2*g)
+ line from P14.e to (P10,P14); dot
+
+ Pad(17) at (Board.w,R511)
+ Pad(16) at P17+(0,3*g)
+ Pad(18) at P17+(0,-3*g)
+ line right 2*g from P18.e then up P17.y-P18.y; dot
+
+ right_
+ Q504: hbi_tr(,R) with .C at (P10,P17)
+ line from P17.e to Q504.E.w
+ line from Q504.B.s to (Q504.B,R513.start)
+ R508:resistor(down_ to (Here,R513.end))
+ llabel(,"R508" ljust "680"); ground(,T)
+ dot(at (P10,P15))
+ { line to P10.s }
+ { resistor(down_ 5*g)
+ llabel(,
+ "R510" ljust "225" ljust "\unit{10}{\watt}" ljust "\unit{5}{\hbox{\%}}")
+ line to Q504.C.n }
+ R503:resistor(left_ 10*g); rlabel(,"R503")
+ { "290" "\unit{10}{\watt} \unit{5}{\hbox{\%}}" at last [].s+(0,-1.3*g) }
+ dot
+ line to (Here,Q504.B)
+ resistor(right_ to Q504.B.w); llabel(,"R507"); rlabel(,\unit{100}{})
+ line from P15.e to R503.end
+# "Q504" "40409" "REGULATOR" at Q504.C+(3.5*g,3*g)
+ "Q504" "40409" "REGULATOR" at Q504.n+(-2*g,3*g)
+ resistor(left_ from R502.end to (R503.end,P11)); rlabel(,"R501")
+ {"390" "\unit{5}{\watt} \unit{5}{\hbox{\%}}" at last [].s+(0,-1.3*g)}
+ line to P11.e
+
+ resistor(right_ from P16.e to (R514.end,P16)); llabel(,"R506")
+ rlabel(,\unit{82}{})
+ line down P16.y-P17.y; dot
+
+ dot(at (R514.end,P11))
+ C501: capacitor(down_ 6*g,C+); llabel("C501")
+ {"100" ljust "\unit{30}{\volt}" ljust at last [].s+(0,-g) below }
+ ground(,T)
+ dot(at (Here.x+4*g,P11.y))
+ ZD501: reversed(`diode',down_ lin_leng(C501),Z); llabel("ZD501"); ground(,T)
+
+ dot(at (R514.end,P15))
+ C502: capacitor(down_ 6*g,C+); llabel("C502")
+ {"100" ljust "\unit{30}{\volt}" ljust at last [].s+(0,-g) below }
+ ground(,T)
+ dot(at (Here.x+4*g,P15.y))
+ ZD502: reversed(`diode',down_ lin_leng(C502),Z); llabel("ZD502"); ground(,T)
+
+ line from (C502,P17) to (C502,R508.start+(0,g))
+ C506: capacitor(down_ to (Here,R508.end),C+); llabel("C506")
+ {"100" ljust "\unit{30}{\volt}" ljust at last [].s+(0,-g) below }
+ ground(,T)
+
+# Left-side boxes
+ boxwid = 10*g
+ boxht = 5*g
+ line left 3*g from P22.w "GRY" above
+ line left 3*g from P19.w "VIOL" above
+ box with .e at (Here,0.5 between P19 and P22) \
+ "\shortstack[l]{TO SIGNAL\\ METER\\ CIRCUIT}"
+
+ line left 8*g from P21.w "RED TO C508" above
+ line left 8*g from P20.w "VIOL" above
+
+ line left 3*g from P17.w "RED" above
+ line left 3*g from P18.w "WHT-" "RED" above
+ box with .e at (Here,0.5 between P17 and P18) \
+ "\shortstack[l]{\unit{12.7}{\volt} SOURCE\\ TO MULTIPLEX}"
+
+ line left 3*g from P16.w "WHT" above
+ box with .se at Here+(0,-g) \
+ "\shortstack[l]{\unit{12}{\volt} SOURCE\\ TO FM TUNER\\ SOURCE SWITCH}"
+
+ line left 3*g from P15.w "ORG" above
+ box ht 3*g with .e at Here \
+ "\shortstack[l]{\unit{15}{\volt} SOURCE\\ TO FM TUNER}"
+
+ line left 3*g from P13.w "BLU" above
+ line left 3*g from P12.w " WHT-" "RED"
+ line left 3*g from P11.w "RED" above
+ box ht 6*g with .e at (Here,P12) \
+ "\shortstack[l]{\unit{27}{\volt} SOURCE\\ TO CONTROL\\ PREAMP AND\\ PWR\
+ AMPLIFIER}"
+
+ line left 3*g from P14.w
+ { "WHT-" "GRY-" "GRN" at last line.c+(0,2*g) }
+ box with .se at Here+(0,-g) \
+ "\shortstack[l]{\unit{50}{\volt} SOURCE\\ TO PHONO\\ PREAMP}"
+
+ iflatex(`ifpsfrag(,`latexcommand(})')')
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/I2L.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/I2L.m4
new file mode 100644
index 00000000000..3e256f8beca
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/I2L.m4
@@ -0,0 +1,77 @@
+.PS
+# I2L.m4
+ log_init
+
+[
+ down_
+T1: bi_trans(,R,BC2uEBU)
+ dy = T1.C0.y-T1.C1.y
+ dx = T1.C0.x-T1.Bulk.x
+ up_
+Q1: bi_trans(,,BC1dEBU) with .C1 at (T1.C2.x+dy+dx+dx,T1.C0.y-dy)
+Q2: bi_trans(,,BC1dEBU) with .C1 at Q1.E+(0,-dy*2)
+Q3: bi_tr(,,) with .B at Q2.C0+(2*dy,0)
+ down_
+T2: bi_trans(,R,BC1uEBU) with .C1 at (Q3.C.x+2*dx+2*dy,Q1.C0.y+dy)
+ up_
+X1: bi_tr(,,) with .B at (T2.C0.x+dy+dx,Q1.C0.y)
+X2: bi_tr(,,) with .B at (X1.B,Q3.C)
+
+ line down dx from Q2.E
+G: dot
+ line from T1.B to (T1.B,G) then to (X1.E.x+dy,G.y) then to X1.E+(dy,0) \
+ then to X1.E
+ line from X2.E right dy; dot
+
+ line from Q1.E down dy then to (T1.B.x,Q1.E.y-dy); dot
+ line from T1.C0 to (Q3.B,T1.C0) then to Q3.B; dot; line to Q2.C0
+
+A: dot(at (T1.B,Q1.B)-(dx,0)); { "$A$" rjust }
+ line to Q1.B
+ line from T1.C2 to (T1.C2,Q1.B); dot
+
+ line from Q2.B to (A,Q2.B); dot; { "$B$" rjust }
+ line right dy from T1.C1 then down T1.C1.y-Q2.B.y; dot
+
+VB: dot(at (T2.E.x+2*dx,T1.E.y+dy)); { "$V_B$" ljust }
+ line to (T1.E,Here) then to T1.E
+ line from T2.E to (T2.E,VB); dot
+
+ line from Q1.C1 to (Q3.C,Q1.C1) then to Q3.C; dot; line to X2.B
+
+ line from Q1.C0 to X1.B
+ dot(at Q1.C0+(dy,0)); line to (Here,Q2.C1) then to Q2.C1
+
+ line from Q3.E to (Q3.E,G); dot; ground
+
+ line from T2.B to (T2.B,G); dot
+
+ line from T2.C1 to (T2.C1,X1.B); dot
+ "$\overline{A+B}$" below at Here+(0,-2pt__)
+
+ line from T2.C0 to (X2.B,T2.C0) then to X2.B; dot
+ "$\overline{A+\overline{B}}$" below at (T2.E,Here)+(0pt__,-2pt__)
+
+]
+
+[
+right_
+
+jog = AND_ht/2*L_unit
+
+ X1: NOR_gate
+ line right jog from X1.Out; "$\overline{A+B}$" ljust
+ X2: NOR_gate at X1+svec_(0,-AND_ht*3/2)
+ line right jog from X2.Out; "$\overline{A+\overline{B}}$" ljust
+ line left jog from X2.In2
+ right_
+ NOT: NOT_gate with .Out at Here
+ line left jog from NOT.In1 then up X1.In2.y-NOT.In1.y; dot
+ line from X1.In2 to Here chop 0 chop -jog
+ B: dot; "$B$" rjust
+ line from X1.In1 to (B,X1.In1); dot; "$A$" rjust
+ line left jog from X2.In1 then up X1.In1.y-X2.In1.y; dot
+
+] with .e at last [].w-(1,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/IC10107.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/IC10107.m4
new file mode 100644
index 00000000000..5203f67376f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/IC10107.m4
@@ -0,0 +1,48 @@
+.PS
+# IC10107.m4
+ log_init
+
+right_
+ pinlen = 2*NOT_rad
+ hunit = AND_wd*L_unit*1.6
+B: box invis wid hunit*4 ht hunit*2
+ psep = hunit/2
+ nrad = B.ht*0.06
+ line from B.w+(0,nrad) to B.nw then to B.ne then to B.se then to B.sw \
+ then to B.w-(0,nrad)
+ arc ccw to Here+(0,2*nrad) with .c at B.w
+ for i = 1 to 8 do {
+ line down pinlen from B.sw+(psep/2,0)+((i-1)*psep,0)
+ sprintf("\small\sf%g",i) below
+ exec sprintf("P%g: last line.start",i)
+ line up pinlen from B.ne-(psep/2,0)-((i-1)*psep,0)
+ sprintf("\small\sf%g",8+i) above
+ exec sprintf("P%g: last line.start",8+i)
+ }
+G1: OR_gen(2,PIBANEONSEC) with .Out at P12.x-pinlen,B.y+B.ht/4
+G2: OR_gen(2,PIBANNEOSEC) with .Out at B.e.x-4*pinlen,B.y
+ left_
+G3: OR_gen(2,PIBANEONSEC) with .NE at P3.x,B.y-B.ht/4-AND_ht/6*L_unit
+
+ line from G3.N_NSE.w to (P2,G3.N_NSE) then to P2
+ line from P3 to G3.NE
+ line right pinlen from G3.In1 then down 2*pinlen
+ contline to (P4,Here) then to P4
+ line from G3.In2 to (P5,G3.In2) then to P5
+
+ line from G2.In2 left pinlen then down 2*pinlen
+ contline to (P9,Here) then to P9
+ line from G2.In1 left pinlen*2 then down G2.In1.y-G2.In2.y+3*pinlen
+ contline to (P7,Here) then to P7
+ line from G2.SE right NOT_rad+2*pinlen then up B.n.y-pinlen-G2.SE.y
+ contline to (P10,Here) then to P10
+ line from G2.N_NNE.e right pinlen then up B.n.y-2*pinlen-G2.N_NNE.y
+ contline to (P11,Here) then to P11
+
+ line from P12 to (P12,G1.N_NSE) then to G1.N_NSE.e
+ line from P13 down pinlen
+ contline to (G1.NE,Here) then to G1.NE
+ line from G1.In1 to (P14,G1.In1) then to P14
+ line from G1.In2 to (P15,G1.In2) then to P15
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.eps.bb b/Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.eps.bb
new file mode 100644
index 00000000000..68af8724aa1
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.eps.bb
@@ -0,0 +1 @@
+%%BoundingBox: 134 457 250 611
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.eps.gz b/Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.eps.gz
new file mode 100644
index 00000000000..537be23d4c5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.eps.gz
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.pdf b/Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.pdf
new file mode 100644
index 00000000000..bfd75c0987c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Incl.pdf
@@ -0,0 +1,553 @@
+%PDF-1.3
+%âãÏÓ
+2 0 obj
+<<
+/Length 122
+/Filter [/ASCII85Decode /FlateDecode]
+>>
+stream
+8;ShW1/u=oi%iY82`=Vh1c<jjYV]321c3`=['WZV"UUQ"RO])KEeQ%)ETt(?)_%R!
+Etr^]<L>0O!$P%(R0(GH"*9hiV@(GU>l(&&L'fR/>_,-G(]_I=(2N~>
+endstream
+endobj
+3 0 obj
+<<
+/ProcSet [/PDF /ImageC ]
+/XObject <<
+/Im1 4 0 R
+>>
+/ExtGState <<
+/GS2 5 0 R
+>>
+/ColorSpace <<
+/Cs6 6 0 R
+>>
+>>
+endobj
+6 0 obj
+[/ICCBased 8 0 R]
+endobj
+8 0 obj
+<<
+/N 3
+/Alternate /DeviceRGB
+/Length 3266
+/Filter [/ASCII85Decode /FlateDecode]
+>>
+stream
+8;Wk&GuR^d(<:oCae"TZYesr[>C`p^O>Ui_OW=R%#Y>:&&jf.A"[PN['LbECWg,?j
+D0/6C7@c'6A$$6lIHo5_oe>[p34'IQNh$tG8"ECfVUOuUn+Sj:GOP"VhnAcTo)PF2
+V5grR0FIl?etC>]N5ZPI'OmjE!!<QN!YGDfH*&\N4!=jeP/^/!>20G^Mk45[OD2BP
+9Zk.)nGe=sfBE_E5T)Nd.$V,[S3(_nW]0-8p)0BGV3NB^;%r9c"ECk,Z"flDkBuDP
+g;F>X<e7S+B:VAa0_&kI=4\=T3$YC^GL`[Xof-<tfqlii;<.T0'WY*RC&pTa-G)Pm
+0?;`VB=^8S97la:!6B944'_Ul)jCd9e"n>?\jjA:<GoV-jW9d;1fTD[.I4%!#(nTs
+-EiZu'pte#UQ]C2!LUXnS2dD"@X+#f7A7Q66@U*)4,*O7S%hdshTjT6bdj<2r!RF[
+5Nc*2$@m@:YKcpQ[aH`-N3<B"o&a/GbPM8nn\-$Xps+<_VKjUL(j'3#^@h0l5&-qL
+a&LDEqO\845juA3a)p++nmHI[17>DiJ=5[LYHFl`lEON`9Wl<e598`j*Vf5OG\8JK
+P^9/AO3#5:9W_=RmFEc:#'I<h;euD3'7XTG:Gb;f\@?%P!O(,\YV,JHo!\u,jjF-,
+ZjkoDhXiCbOp<c32;dBLr7oU)qY*qI51?9-XdY03AE@3>UV:Vpch(?A!h]TAhuP?9
+&"J24&-@=m!l@5[L^2$E*TV_PYS>/E3R@ahW!=oI*HZiRYT@T^_dGPC"1uBuE"It\
+O22.l7rTMs$*Jh`?kQ.cLL:<K"g9$S,!cWn$X#b*O=TAqq*SU>&rMHBTe*,B.Y1Q\
+(,A3.cjH]VlA(+f*RJ]fpWue$"EY-b"FUGJ5nBXWTU.>6dpX;6#J7gdYS`CO;rAX?
+$*8_oi$PrI?3_"WU[UJB0RNpc%psr:iJ6nR!Y?9e7iW*a,"<hK3`:cu+aTq!ksbl>
+;.Mn3$os5N5ph^aa:"5gE`!5[U>]buRZ#>9)RL7H7>K8rk[F*?H3Kj+B@,65#/QV`
+70k,/$&]'=69V$#0M'hfpkWmDE/cPGGY04oq*Y6<KU>.Y+BB&CM7pj0_ums<`(S%\
+`*!_0A4?&57?Gqh16R4<7G:)^8,A0dR5@Wa:8X-oaSt6'EZnRYmN<%'pQ.Tc?RFYT
+^S7q\Y*:V43^l>KV"@O(.*!_P.FXM_<&R`ANM,E1/#_jb+mOOA)<u)(',lkm6joi&
+daYYcZm"/lBV3bNBJ8Qh\gLcM0;9EMlf]G=O41k<5@H5_DN&6u+iD)ta4SWr`V>nl
+gl-%2@jX'3R'i?AQlS)sD"a5f@Ce4(QqNiAbX(A7k!eDW(5:kiP-AJu<n7QB.-h(Q
+QHa!!f]d2]]9g3dI?&`J6fPUqi].?@-g(TW.F)3O_KG!5\8q!EmMP[,GFD%_$$]?S
+"g<^U>M]L$`ggN[BV&kn?p8'!M>8D=iOeWVr$m.;ruh>&s.tF?7>urK@ZA?UMoum^
+/8Zr5/X;XXQ3StE=h_8[XQ$?3XYs:@>MZPRXZ`dBXm<*u=eDsJAAb_[[uoEegDmT2
+Ba`[Ag1K"rgO<OW_04DThCd2NB=GkJPhdR2^4!A:L&HQ#VtLW@\.4W2C52hFcQ)qA
+R:@sR'fL`9`b$3-*KqJ&N]S4.*+(]4S8t/]S.7O7EMbdTS]dN.S522l\2_!o\[8m5
+Fh-a/E>?*O]5DdTlh\h"i0Ni?b&,r$^;*Vh'f66j$?!I3gnWY?gdg2(H4W6X*gIdN
+4hgQA4bGl?4\%UfHGNq(?>?[G?C/;2hP&e0mnrNm6Fnj?==;lSSFYY9V##3.N;Ga2
+Fn%'Uh;EY2pU+@i?^9N9h^oF1PUu)2*><kan*)M"+7[)a^^*I:BF?d4n84h"TJCIj
+i1GY36"rWcJkcOK,<-rN+1si56&80)8]Z6%2oIguL:C=_Gpjgm2RG(.j3STN_-r)&
+K406?(PZ"Gmg6bD5d3Ma?u3[8#c@r2`/]Yq81_%lo)6YO.*!`=e7d>jdE^-skag,q
+@Q\*L@eRc'NqJ=\a*na"9G/[T-93-&`$NEGa%aKnicF.8j1e?.8l-i#9peK\8o.6b
+SjZ+A8_T8J6Y\!696X$AP!bD!-(dr+Vdu\6VgO]nRAs%GQ3O65Veo,>^!LnqG2[[,
+8=-2l9YZc7aJd5U6RFND,BG.%03P$NQE7FGh!F%e4kWVP@WVBdDWSIm)KS^:1%U:n
+G3;$3O3@"<T3UHhB\B-O"kEkBJg5uF_S!aVKsQ]t(N3J>>ng8f<HNYG?qJ8!F%`X%
+<\=9GQrtsj5#aisaY2=Gnq/K!2Cb1JQ'T-c3[:!42p39mU(mcf#Kd<`^[b]66s5#m
+I8tr8UZt-j<;Bqt,IKp&XT#XPWFC4nZc_p_%kE.2b-*k!+_s\,8$s=RV=o#=I<@pM
+-(UC*9/fue<jSc;7\?F4=UWb4WBF_KiBL6WN:+]N`i6Pj\rjSeom-4c)V>MQL's!4
+NGBI$2'k*XVAX6:2kOo+Ch[gU=r+G\7k<(mg3U'L\ZN2TH?nN@?1$/8b4\&BpiZ4Q
+I(pkT`N`1McK1U@=!k**gL\s4n%,bRI+@r@k\BeUM)><L[]Fc1Xm#bYa00-[kD*Ah
+mh]b.CPUL?\?9Z(6sjoj[e7T3g@a&V6uCT,cgG`:^Ul4;j5C#TTR5Vo9uWUI%0d;[
+hb;jBgcRT]qTf/;!F,Pj\="V1OI?$8BU[J@6CY0K*1VkUpRPicd[i^qY+H`,MkBj=
+BqX+P8"mAc-DHg$#,?@:k+l%Ra/(blWMUT2Ml-HNDPuEk;Q.O52lWdV*3,(#!ipIE
+l)\-kd&f^<\?7EdTs#68Mm*2cFg1/9@'S:g9<uF@34#cp-+'2M'=E_+!Od9^n@*)?
+i4)q"dCDl[_R_h?[C\''Vn=1cS%TQMO1kt8KYIK$HGB-gE5:hVB>NWF?c(R8=MrY,
+;8gc!9?"ul7`N?d6-$a]4ik:X3m"qT36J_R2TrPQ29`JQ29iPS2U8bW2p]"\3RG@b
+4OLmk5LRBs7+90*8^tr6:=[bC<S#gS>h@odAD$,!Ct\@4G1uiJJD:=`MVSj"QJNV<
+U>IEWYM_=s^#;B<bi2R\gZ)f(lf<-Jr8iUo%H`u>+6TWe1?cC87d8:b>O(>9E9mDf
+L@#T?SF.fn[-p9Kbj\a(jmdB]s72-?)=scu2"\ZX;"`]=D>*l$MYJ(aW;/FKa8/m6
+kPKK$#Q0tf.K-jW9E*`HD?'Y1K_,'~>
+endstream
+endobj
+4 0 obj
+<<
+/Type /XObject
+/Subtype /Image
+/Width 240
+/Height 320
+/BitsPerComponent 8
+/ColorSpace 6 0 R
+/Length 23686
+/Filter [/ASCII85Decode /DCTDecode]
+>>
+stream
+s4IA>!"M;*Ddm8XA:OX[!!3,S!/(=\#RC\B#Rh"G$kWjS$P=*a$k*X](_[Pt',)3!
+&el#o'G;2u)]Tn=)]'bF-RU/b2)@$E2*3l]4$,Mc4$,M)%1<OQ%LisZ%M0<a%h99f
+&.oKc'HIl%'bh?&,oRR9(Ddu9+<qpK*[;dU-m^/f-o*P31,:pQ4$,Mc4$,Mcs1eUH
+#Q[0jn,i\8!!3`5!tbS6_uW(&!!*6(!<E3%!<<*"z!rr?'"9eu7#RLhG!<<-(!<E3%
+!<E0#z!!*'$!sAc3#7(VC$P3:="9AT+"9J`3"pbA7$o7na!YGM;+VHL55uD&(,&r/h
+"r*2nYsKZ\'iMkW1Gj-(d6e-bP#Ll/nRHVt(8A*e-:F%sA4=A1F>ar`<T7T\Z\66F
+FlW'_-^:E\[$ASZjRf:V`RX)C<b?N0QDV+1f&lZb7os>ILR4pJa4KMK&HDk6!<NB,
+!sAc3#6tG:2$![Y&Ha12&d1Kt@<!J)"YtXk'VVcu,Jd:*n1u>!iGsO56W4_0F#<D5
+"r<r=K*N_\_U:i9<217?79)6fA`E9eKYu8]j7>a)UkQ1@`73l?V7":mjn2YdG(u<[
+[`6n\p*Vdh=(c`4Q`%=5s4RG]!s&B'&H`UF5619Z5p2Gd:nS7uF![UfQ"4%upO26:
+OB]Q.NXVn<8J"-/2+a*b.Xn)\5us9Gboi*5<P9bWB6.3V)dl(h*o3_jGtB88%j4.D
+TX9P(/T00dDYU^!PFCX$*$h7VH=A0Ye(HNo,L$c27&6JY=(,g'%s9Ql&eK5tAJ'S%
+mH0S"rr=t9B4ko=@b-TtK3_=n?:5iW7B/75JKu'8%ROWlH<s2INg]E<b=VO^M"+;g
+/15s3#_JiP&n2P]a=p.QZ&]E5Ubq:a.K7W;ZJe"g;RJC-_4VpC!O(QO27q@JR+%bt
+TKdb6.^!l,$::$sS9BKRTR8j6,tR?;j+'=7q%6&5Li^9A+\f1+4*_L=;L:[YHaMD3
+*sC+B21S'-_p&fEM#n"k+=8s;+O_U+f-bKgI8X;ZTIcSJ4RLN#qE:ZY/U,nemQkRb
+WU6dL,UA_Hb,-OTRq#k$/rqe.SNp<11i4M;!te)hS%hf6gi/nP^.K.%<a[mXn5cO1
+'=G\IBgGt2I2=a0L^Scdb./\T)ULSRJ]G%4#p0-[<?Vfc*XY3LUI#"Qd1,_2R^u`/
+3r]2#Fu$dTJib62K'M39QYY;4,OS$2MmP&]q"@&aDs"#jluYfW];mP+7Qr++A^0_*
+!@ku/XE^_!LZuZI+f="1&(pIRn5Y4#h:l:";q[&[[P\;UT)t]_4nNf;E:ZXd2OMi<
+2#&<#mV)]&A)QnJ.'0hPn.6a;ORViOd.un'l1cC1Se["5"2K.%;ceTgC[0e]J3N](
+RR`0-%d""V#Zf((AcRJg<Ej9^I"Um$niVSf_LRC_&a40\*SEufG8j%d:hr>GCE1?j
+)aP1O7BZi<Bd"$g4pV2J[h.-&g]<!M)7DM]g[[BJ\/S[R$>3E#5i^Q:Hg)tN4LgW=
+N&ZA"&"/\0g;b&c-b<&_8E*5UD;h]3>9s3C9>P9e6n(.B/bZW#M,6.d=rKrc"@gc`
+k6`EK!JAHXOX4upG>C+R3R<NqTUo1ZDbOOaaXa*][+**f!Vm:IESC6X84b(2kNnW+
+7MZRW8U<HlSe4+!'&>iOYqrEZ'rGM&7$U8[di9)L3Wt'`&>qt*29#u]g;Y-<YkB*&
+@::/>MT]I?!Y]AG3_N5=P7g06nl)KXc"fUl?=3f5T*RirLGA[4dasQ(,?04q$0[)H
+*JuX(R+"hV#;FA=5;`sL`XiCVVb-"_+[EV5Z+MAm!$^@S!(DE^C9(@'lMgjo"a[V4
+!=gaQTC+stK#CTu]:(%DK@rcD%Hm4^)-\rk!TBo3Sr&GO4d0_*>>*T?g0ES"BTbVL
+A_s'iBFoFDm=4?BSWn$fkZ'+tFY7ekoQ=m<Du134hB&X8Mh#a:5sP$79s',b]U(Ts
+Gj"q-K$+/A`X44?5maoo_R>XSYX`/Yg.0"VgU_Lc'"]+lBg(P]luFKtXWW$*WU`(m
+RUAmrY.AFZRG<cLa.CA!6j"F%%B6?1.=re\&_.cH7+OjO'f"(&#s][Fa\-$%+SJHB
+n"NE@p6QeB4t7$F1s^aNLs@TEDPZtEVL:HWXi7\/!'QBp80Zk.!VC.iSYPa)\Y6oI
+:oMU3[8nVtZj;[K7!<E.CgfOK','eb8K.[Y[F]<S>/J:OU`I=UNH#n'qppZ3,MTDZ
+R>#.0f8`*D_c.F[]<UD3,Eo&i)BuH_HalXe%XY4]W0=l<#>"`VX)ePu+Si,m8X9Ju
+\oAeRM$LNa,A<lIJ])q$7qI3:+FM^HZWb-ahE**%Ktg3j,XR'"O%mMk)mOSh_$*8g
+OeIg^@C?Y+p`Mo4F8\19G/?-'Hr6lS`Z8'g1:pXR3q>,cW;6a4O9<+JD,cg[nGkXK
+(&G3Qi&0,la)qVm"SVC`Dm*CW6eXPOW'J:C<P*dcW*)qAG\B0a4sRYaX#@b$P"066
+?)o-0D^i''Ro-;Cgt;0oJiG%RZrTQH:7liF1e\ql+JBH(*F"uaK.bLld]CtW#nCeF
+#(M6,FX>:R>O`dI_J3?H_"0.LA&TW)%5s[Qp=L:!B`=Zmp_7JtOQM_kh7,GPhVERV
+1uVMJ98@Y2$T%GDY"9C0*7.Ap=bHJ`aY-AJe$F(#[^u1Qk?4_<"Hos2*f!c\8\Z^d
+Rq4-'/pT6-aCs&k5eF("M2>_VBFi2X2;uNWA9'sD"0?VdVfbaGfiL1oDUR@q5nVlX
+PQW?s6(jet6k'/J\ee<0h*a/[[sApAR_X*Phs-TVhFi-]=D`-e5pO!uT=S)?d;^hT
+lFejLA[L'CHbDo*#2gC+C$]5Z[_B?Gg^^+C<Io"Q22&NZi4"9k;4L4F&K2^hM=_EU
+gBVuS=TC-VhV23=n3XO<CX1t8:HnojSs.`HH<rkF[lW6'QK,W@f=/n7#jbW,NLbdQ
+."0a6H@R]9<+&hF62%jG:'N2,_)1/+SYC3;VUlTJ@99gMfgO7Y#b[*#(-JhI5"bK.
+!,+@[(4(-`[D7em$<ANcQ8&.4&Xl2jVrseVKmbkMO$9,JO(,8N=1;HXIHdeg7+^9H
+%GCeE'(%meBpN'J3/3J*#t#Hl%MI8p^h<f$DBG>I!8paQC7._b8TU^!^`Oi(_oI"V
+[V*,upd.Il5V7W[8Y[Gk!0Q$IBN%\*T-$I8g(47mOr4.F%s=s+!5lWhpnk=+mr#9?
+jf&R'8#h@c)@Wtd0abg'-W5]cEchE24,0+eH5=\kFCV)N0TLp!Cu!a^X%\QfU2NiD
+=7tp]DL5n)Ud:.KN%7T0Y@us&#XF&pN)nQ$KL^gf85T#P@>%!KiuuA,+H7&BcsosD
+M(&M&X0M"Hm1kpt<M[,-0\/?]cju'YRS?R3!,Ju\OmWi\G[/<$!Vdgtb]E`5f&O<H
+FTh=,PQne+,\j20@5)4;Us:P:5T3J<L:9(i+L/g]^hNMSn0s0b$?itU3Ni32&5XN%
+N3?'kPe&#k\jmZ_<4]Jje/J*<oNTNM'_ga#Ch\/)Zh^gJ#sN@uPsZc@=M2^!$#C4E
+4k,Q3+J!AGLRX]-:i.bjRTKi2*U[<N]uOn`K2d6pCrdg?[N/\\THnQ")BdF^qMn:o
+r?IcUeCm*CC#jY=q@0XNc//%UMb,H\[*Q**F9u.6)d5@&2^Rg0I8a@j%r!/IQs2^L
+TnetAK&*Rj]-":A2?*Ys_B=G6i*,*5#=8ri*'ikR#^UBNon&1JVlT4c^_o$"rr?;B
+nI)94391=KDI^Vm_:sMGK$kI*ZiJJp$`*X(f<K<McVDf9V,/K1?=^E<Y-#KZjI%uM
+$_]b<igeHG#=:ES1>01sk/e#?GmA+MJfG;^E3h1:ZD0#jG`>XQ>!`d.b1,\S<p$s#
+=Co-&a0NlZ(e"s6p9M]_oaoFblD-=CfjkEM&4-4p2brWJWU6kO(K!6=V5)#1W5liN
+i@T%$5=C>)j[Ca.n9CB2DGE;-\^bsB,Q$$&Xi,2\esB(MZeJ5I5"6-dUt"R3=o(BF
+hDC(&0e.)*f2IN?4[.'TF+$Mh#G(PO,MC80bb,5*.tBc?C#+W+nh$VMGil@)>W[um
+)Ja2L/thTQ$pM"mRX>H9Vq#1(483nZkroEu)/QjlJfAJpffHOcrRZN%i3?eX2#F)%
+VRL5.f+iBjO3ukfhi\[)`G=1#+DJu!Ot!3l"NWkCqF!#a>(2#@a7=_j>4c/LOlSJs
+CNLG.E:><t7pU&(':Qu\NdIb2#DaUh?s659#q;t&>')RZh%[9JZY92?[/U+S+q!)s
+Hh'?,g=NRSg%ZhhKao;"-c]LW"J(=i")i_QnuFWNW"/"%YStA=!-SV\O=eLa0AcDj
+"c&-_,TTi9VW*#i\Xl;f(;5ti4ca:4q2UGVj<'LXqAB54c%IZ2/dppQHWoICe$Yuq
+Of:Uf^i0EZUSCBH[V`s(EX.7kcDih6KqYXYg,K(^*`N$YJOHUO-0OJM;bO'nOoZgM
+,.'P8f$?hW=ECYU!RN*/jfkMB93rUrepokR$K'B1r-YTggtf'>NH8>1,$K-LigOB`
+UkfS!dqq$+a/&0o":h-uH'sV4gfn(OCl:cYa(Imm<RC.FY-H3Qnb]KeM7W=c5jIlB
+\9W<E$^_;BoIXs^1[!Ed'jK75@107T2Tkt[RNBKTE,^nf9+.eBEDqSD/9C'*dU;fd
+5$d,=)='_K:t!7Gb<75*=HH;`<Fr]l[VNBjn/s:?k8;_\(5!j'jTHsP_IhWs&[-)p
+MjdgX_@M7+<N]iFLRq"H>8^/;1,bc]7b#bXFS=m.5Le8q7cu`)Va)$#@r7l!c'G^=
+&7BMU'7E`V$Zbpq"'RnZYB;m_VUGG^#Qs.^S<"\4%$C@&_T1tj:6GU`eRrLH2h/5B
+B@\Hal+2IO@S7bhHr`Eg2`M&of^`&:j'u:u&aA!RY$cd//Q2(lJjaa'W6N;#ZH=i"
+ei`@;c>0K4^UTKq.eS"kb/<HJ&(4s\3N'Jo(HOTZ[D/E?V;n$$@/N=[;%2`7#Cb8Y
+G;()eq*K!"k`I@M4Wa=<#MPAYgSc:5q'K-:+';2;PtPFC/uZT.fdfCJNh)L'eD(pS
+qBu.Hnh[*>&htVRgd/.c*]GtZLZY-QGSF(D90mCZ1^&e%0dnB1%*A9+6Dha_]QQPn
+K5<-Z/XRHJ&=ZV>nF9SJO^hSub<.d,MI9Up\2Ts",Y,e#'"&<g6V.jP9S4I?$>jcr
+Jg]Q\1^:R5FX)JF:8AK5!7hH>VhD/l/Q0sX&2YbpGu/@i%[qXg@]UK<$u,G_q_K3`
+Nccb%Xqas#\47VE@?,,ZeeKRlQFh3(Nu:3cm#!HC%ZPGag%"%:+\2g,\P0$.Mec\r
+9T!(nXL_%VA'5mj+g,VmW*Qc^:WZBk.,*fGo%',!]k:]6rM?h#nl#eoRU20+;5f9`
+n[^pq_A-sFODF.JY"<2aF!>tNT93*^2e?qi'-937pc0\8ToWk#(::m<ab#I\7G;cQ
+&K9pUh:LBo)?:g+rQ;h*?KO@2)U]eI%`b/@Qe(aQ@u->M'Itp*'tBPiXD!q@,RHnR
+(78OY%#3*K<*!&N&aX:/_A#a_1JbA<hJ`_i87p@HQ(Nm^-1e.:F>h!!]7:.GXud*0
+2\B7i07JKf<ogit"`^5t:9[&t^<<*TF3ED!<0Y7gfA\Oh!RC[Iro>9_813gsXk[?[
+<Ha<n5Rt3Yn(erdJ5a/S*gYM9$/c!fI.^S;eTJ2:pJ-F<T8\9)#O8J7=dcT_mn5se
+FY:&U/B5e\huaktDfT*+l13A*R/LMS+0,k^9#c"`A\jjrni(I@fQe0P7FX:9)?X9<
+I-thG*s@%FQ&AF62;_WQST,E%8:gol!ug;p,0J`>5F4erlV(\g[jUOYhbBSM]0Q9+
+WV1+-cI_Y-+^OsI!LCf8iJ1CQ"c)=T#FJ-4_UGrP4H4Aq@<_Q;HX6XO79$ajA(gf&
+,!Y#Q+8=amb5JgRKUlGpjDs.iPR$,M@EguDVZK1AlI'NTDl3oFH)uJZ(0C5J<[dg_
+i$0SOqS&^0k/)qs1@*Fl60qP)LOJ<$D/V0$Lk:#MC5K*glp.h\/^/+/NK?E&juArI
+Ze5*ESI2sn+3Wq$SofPYY&`B]@FhlLr0%:A3?;n5R%hX/JGfT=BDIRP$qEXX,LejY
+f]E4?FYGZZgL[Jup?6TRZKh;7pO8/^'rSC18_AJR>p3FQXE<3I!o8n8gBQ.*ah0",
+mNLDlfCn%l;Bj3UIHZ-JE15^KoNX6qJoGRF_ltRfjkBSir%pVLSCYkO]s;tuWcl(O
+lHptWOgUiq!?M7F2"RuA?9>9-d:q4qU?6L%-=F!/XCXE*0%T;rm1]DcdT8C$)mW+A
+f)QoKg&M@1-clq(P'.:49?JcPC8nX#g>M3#]WKb5<dcj1flfBD<rW.WLJnYCcu/e)
+phE<:lAfH];T12r1EZ5u,aOGjA")#)m3K0&&HicAks0cDJ_+PCl.nu;W8lB1O^%B^
+=>s+u%M+VM[).4!0Orf^''9bQ3g-GlTClQl@?scHr%CgWD8*H?iBaYba3s_m4/\.Q
+6OP<2lhaA6(uX-o6'e.=;mKi1M8\%-*sJmlB8/a/gVoY$Z8iXZJ^88WSDn&g6NHnH
+HL@\k-ZtE@5P?QCFZaU!0)-jfm'r2,=+I-.Glb%1ZtR6gpKm=oG(Ulo[b=p&Zr\=M
+&;hrGi9T<s[Q7Tl.ViM)J8^8Cnr)]6TGqCF:_dh&$qGa\gZo:e9V@_blIB`]Z9sB(
+Tc]/a>S[4/n+o7&X7U17=LHI1I=c_66L*6AF\cp&"F]RJJMXOU#S<`jFR.gi3uWOD
+`5KOAa2tDS$nO#j`M]>hMTtCm<;]SU]4p%jh<(jr'#p'ug;a6HQn!MFYQ7LODl:4;
+%uAXuJhV6S7UErVCOhSSrEPf2b5a-bfC;Mb@tYU14<Y&;`8@l5LMI?KnsX#f.kJc@
+ctbAkSeOQE5(IccQnhnFCo;E9n0c4LO2k3b5rOmbP2kN\$9<>RBHtMS<BcV!O0joe
+h+tr(X&ZYA"i[D8:&a3Q%4K<FVL/G^liJ4dOjE27^i1m^2RL;\;Yr7sOFPm'VV68l
+)Y'EOHPpUKFjVTJke/2)g2+cKqE%5hBDSe1ojuc@R2$`&E-Lg!%+OgB_h3;cW(ts<
+V7Le_rl")H`4lO"=rYXeil?H!m1VFZoaF?-bb43oE<VC#F=TYb:9:gShUDGgb8khA
+Blbk9KGM'",On=J\?phA7Y?$%:WX3\d;eOC\+/E\W4QGVGI+R8IGmZ`RF?'rV8`(t
+rfWJOk8Li!<=_I&K>4>HOFM9.Yl3pSrX!<"X\XkKI8siffo'6mj9&Mg#n;)11%>NV
+=#sL&c$`_YSaFC/XpCR`4.-P"C[+<fK.jCdLs!XR23)"i5O,9Jj`dVN@d-B.52g*3
+p,\\sk3`D5e3h6if4p^5P7e,Yac96YNu!?D\*LNP`dW?\Ha7]Aqb?NpU$]n+hb,%,
+[h#8!fI#41g*P=Q`9JFG3eMH.>?=_CG2&Q/Rr5KkCJUf4dqb^mo4TEVN3a`8R!@@A
+)bV94lI0N9CrUhA7433FAX,L!YYo+%]]=LE1"G$#Q^YgA7NUu6%@H"!O9-+Qeqc@/
+,nb%NUta1:cB$Hr?K]ffXj$W;ck#5'>M%legfKfq%CYP*:;)Cs+Kg#K29mKG.,CdU
+`;C;k@iW>"6Q1dKVNt?Rn4.9"Ha(Koad6Y4^"Fudf<u"rb8td;<itc.H_JC()JGl#
+$AeWoUn6DZBIP+MGIc'oM:G8IWR$*;n6)j,^iVeeZX-"r*?XV0P(@KZJ),)LieT.n
+V?gsmLfHn2-\=MfNP45;U$X9Xf]f$)U?;`8JG''h3tejq\D(;OoXL9J$!P"\a*i^h
+q>r3ap\`IGHM_"3')%VNJG-@%$"4=tmtQ]#o8q5n(=hWu2>oP5Z$V"%?%dK;56YDg
+OEtsoNc>SLOFMks2737LiT-j^KrT*qi)i86E)?EI;[G&:pB7TV3g)=F*tb5'.qY8U
+&!/&dEYc9@b\,X4URK5TIlg$h7J05:bmMdQ51QMK)@:IqH,IDNUd!!g0!"u4pS;@m
+iGr*\\8;"J%YoK&gYf3_]qPU27rNB]pl-#`B1ackQB:.")X;\Q,M1E1GhlYK#kif9
+,?Xm3#Ji7X$\Se$[Hmr8:t(R-E;UEnY^\[0L\W'R\NB>eBXCcFN$i=h^.85b,$>/^
+PAAF0'6>!T266u@5!K00_F.!VTUDtWHlP3p%[(4<No9:hLdq&SXoA3/S-HR/8)AA:
+X=U^bo_3;8UBBtL\GQsA7+B6tYGasJ&t!*,:>cri0HnfMT8_Aq>&.r+2HBpX[\XAZ
+^%*0&?J]kVdC=YsFHec*932@U!K,G.f5>7D2!1<<q>UGPZ&O[kT,s8`QFIU/6X(WK
+5lUB`E&-&je%P@P-+cH-+ihDD0RBLIoL*G(7(0r<n.Md/?5(D`/(/]^gsY]qM2`LH
+ge.cf%h_GTnig<ReO:XVGa$G93]6f^iuJk0?,'J1m!e:ONAg>Nng!XC8[SG.`":_(
+YHP9KG2rT&94,YAa_7gQ0o'c26(c+^mgjJF^9,1e+?E9E1^CIC&Wlc>0ce>%m^pt'
+a6U)rTB.bEC&?G>DP;WN\+PK%Nomft9`38_.pgZdm;R8W8I,#CDlRo;l+#JJ%W)^6
+JKRHFE1AmuC8kpO//PR89;V%2*$%(6pin38K-HXT+LI0S&koBVWkCb$WpI^I\ZC.K
+/2g8U,>\a2DDcrf]p;aqY$`N&3),X5%5&V'>JLJ%6kTX'/[NZq2O]19[kuEMN!:e%
+[XmR-QItF%[$/WaDC8`Jr6ZGLG>?2c^n),B29ol^(sq.V!"^mfF`<q56hOo^Ad2J1
+W,9``^l=-HdCQMJ]/-6gT%CQo<)"ZlakKo@K2X#:$gP+.VI^!#Mq]ub7;gj3Y9L5=
+[KeSV[L&&b".[_?HiVNS'jk<edl8GM%k5pi#2uhq\@03IBKTqL?Z#G\g?s$Qg06e.
+:p?q0Q*nPnflN4ApI`%n;%.F9aY#]>Tp7IDVBA,B])o.4FK0n(PH.7$EcaYn.+W6^
+Wit,M2L4[0.YFhZp.)J15qOI:fg30%M.Y[q3$3Ae!<G]o<:NJRUu+nT(5ndB%!uEt
+/]um>!W]Lrpk!=/Sk/D*a9r^DRi34@Es0eJ5T]t3fAr[\.g-L5#p/-FrZ@C,'?B&'
+@k*&:=2!r#m1e+ha'e'WIoU7e2\iJ"2S.W_l&u="4hQ'A>4TnTAYIKpgjFV,N6L;5
+bDt`jLQH&1q7ZY*QpL)2E;+3Or.^NpCI;FFi7T>hCZCuB*/,O4[YF6lg>1%lk<SRd
+C(koQ%ZT"(Clgq8N<j4lCD"ZWV_XuOD[^'+`tg@jG(:E>GB>uR634cWL!SOWr7lXf
+i8R!L6_WHS]C)nXQb6"0/[1PWL<jQ/KL]S3&du`5!Mnq(&9UOPLUle),S8lP%^7t?
+Lba[UTfVgTpKfC%guel,CJ4C'BA<lQJjoB.i6rg9,%6'c=?t64rKa;c\u.Np!P,@h
+pE+1aVoQ_)H7c;.m&W-^RjG[phaEj!fAik<f;\g>Y*MOBp99<:g.Bjc56U<bU['&e
+)i5nS^F6sg5s$Q)"hR'<TFPLZ[+.C;DmYDC"DV_.nqls/PoUdgWQ!.E)$FZ[M&jH_
+ZAV;Y!82rH)%m[Mi8!<#4jKJMVrj$]ai-1DJG7*CSe=t#m%L,tF-oK#gU92[!$F?>
+)33TR'-BoW;<G7oF<6O*5_;PfI3Yo+VY"']#pm@.OX(#@+WsbHdb<CT%b/h@=sgom
+JYtlI:.IN4&NpPA6[&hakf>*"C.5YNQ5:,-gfPN,HYFoAJ18^akku_*!-O\%\Z[:%
+A2k/>%BDAB%fBBMfpRPr%O]Z1JNdkEoOn]]V!]@@TH5R)B<-;AOL)_o&=bKfe=ST0
+%o9IkRW,r9d[+&tDXmNNAes7ZR-\Sgi,G\sb=$6f!Ro;3/c61eZlbuW*TUDm^oIH5
+_^e/UGnh@e)NI4d+)T+D*n.#4BN1I4XZSc,q+PVhn1$pN+/[NY@K$E3:^J((-e1k6
+o\>iUhcpFLr=9T;]9.M$=8I4^)&n<jNadH/ri1]7V;5WHO'I;M2%1L_XnA71FtK/N
+E0K>_;"'^>+BC#Z*d8O&mD`qt@,1>47!Yc'SdZCKVh5N]Ndg'F4f,Z)E-+j1=c\Zp
+>SUr8?WX65r>\HRa+k;YR8X_a1t?=>c[dZeT%dNnV=o;6\8C'_Nt<JNLW0^Wj[a56
+*Pp.Dks0oQ-ZpUTC95[=F+[/JnKNER4#0?DN9qNS<WTb.#H12?_nf-[f`\bN3<gM%
+O,?3VQo?hNe]okrW$Xn5*RpRB8KRlbb\?Tu_Il$/$d52f=8g700urI3p]:^I2MYij
+&&rRS]A,^-#PXcd5cg1GE7(TGP9M5G9!0RY8:+-gQp3#qki`.hfFWT?"gf9$3).qT
+41f\=Kk"VKCLrN]HU--j8DpT=`^[Rrrhq6iU6q*8ll,#:8'Rk3'FUYYGR\>.82<sD
+I3!S=N4IoA=NCOS\mdNOrQ@@326[NTZqi:mCZ#PJbSlcI#*'gn58;gVlIULE*8RdR
+#>X+rrr<0kf^0Q\!P-[aci=03WKiP0<(LtB!MgCsd!0:rnaJqVR1a^j#Qe7QT)&P_
+nO%j">RBU7F*T%@Z-F=K:EXV%NDm.WZq)45#4&]]oolrQYdO/:&19uXqb6=Knj]=s
+gqXp!pb".^/K45Zjq'712+RtYIFe]ck\`"7NhCIN?5-Q\#M;<bcaY(8+>NHS>in$9
+]RU)s;KloSJ4:!]YOl%8P7F_1b?WNUFO;q`NRP[8N]SK]Sp2G:,Ip?D%luZ_hf'JE
+R74*AN4*WrSW;]@bq>Q[(@l'cg4G\HoYY].(0t#]RaPFD\ZR[-KV$8fp<S%S=Wi;+
+o>([MGUWDhOon(1C&h;:Dl6f*H.c#8=s-S9(clR%U)!=-qMt5B81(QH)YXgE-$t(o
+%*XeQ*U"9aLZA-0/\Qi&aS:E.EHSDX26pMp$&M'H\JI6:R[ircA2&U'I+8"7?k=V-
+FtjZ8bs!8LCoQ3-SdFHJVkU3Hm?n!oYB2Y(#BO'+h*)!&WuU.o5dMRqL:BeQ)4b"P
+$VWs5ThE<1g$$/R^:H@*X=%rP%jHAt=r'WZ)p>65STZuBd43a:(0/bRa1bmWhB[=G
+h%idko`H72&4-sMZej;tkQAXC9r,B&U\8l`#Vu.!8QJS;1k)UD-^MDto3%G?h*f]3
+f&A-%NG0V>R=J(r]1[I)m?V[K-*3Z1a;_X],j>DCLu!uBSr%k'!$S*1!QeoGa-7:T
+QYqFm^`=H\((pQH8/5Qo\a>;Z\bZZ7B`i<=RdHl@1b.U'U<%2QZ&I6Yh90AiR@\e)
+9Zhdu(G+Q@NNonoj&66ZQGRRH>iG'e6).7AF+<Yq(7%Am[^FYi!o:.%?l'KTJ0:fu
+9-DSUDB#"KV#.]BIlqn18Be7S:Id6AQIG9#!Vs>YIr0?&4%,,"ei;5OJ'^:5YJ@]%
+.lbeYfABfMQjac;/Hpp#]:;A@dC$0!guA(Bm=sQi%cRM4iOEPedQncr`(?\SN&dTX
+F,&&X1=hWHA<,.'VmPPd"QE"4`.t^eq(`3"=hbi/YiZMA`a,MI9;bMAPSFDAFIJ3J
+_9V]]#S(fp7aUPM3W[)_paG/32J8?gqC?'-eiL)^pe*q01?c0UqH"95ql=c=Ipo*\
+^&69HCl;WO3ULJjQU,uDJ9uG/P\/sb+cWs=/gS`<!?e`[Hu#`=4"*@:eYU#lc=&Qj
+0tue[K2[Re%Jr(-fos+C\CA'LF1/\rJSB)j"A^LkFC<I2AT$9j=QU7J6^hHQk<cG7
+KbW'c4"Om]k<l_o1(N=",UK9h8-\@J=P4SNc5+""=:!8T"AJdXQ(4Sg>3e>RA@lW6
+F'1VG+sVbfnb3S@bojiL@K[6H,F)<`Y%o%l1A_toA'9&@ViK%.PC3LGK188<WQZEN
+F0YctG.'Ec>oXn5i2d@BIo3SebodSW$\u;r[Rf#TiF$3I4TNO84L7oPJg*4.9Nu?6
+\tD8W>1j)j\9JnB;DAEYTLa]&X/c/lr(DN=BY.]>8<@6M4<q'tY;EIblSmQ-CRW>1
+^a6,s.lZikWU=<`f@jI1&jP*Fp:]N@$%'l*3&B1id0oJ?+48ralE>!31&IM=g=#C!
+fK.'/.b6K3?I172Ps3(=g;e)E)Nr"l!pB(okV0Hb+4:ehKZJ03k5j\t?_]+mcd5Y3
+(QNS[291k<TOZV,N/86p3\;]7m\CEiLU7U`KA'>6;3i'YA)MU`T'DkKJD'4t4cU$,
+m@?ht8^sdu4e&#n[n?XhbkURb;\oi,nCZ$1W+#djdbm"YX(%6-Z/?2YMaLb*#W&Bu
+<G[,W`ah!]>O:,Ij8pLYC5Mg^ZX]H>>f$SuLlsSn!)H',7s@<@\)ab$Li@>WVs(r@
+BCJroLg08JLGsu",e$M'Wc_j=KBs0$'%&aR3*I0n<D.,5^ui&/iWL'aGMD,O2pm]f
+k36tk_n'1K!]SkLT_"pDrX0P.'k+IOoCPR*nsCNU\djc:o[Z4@Es&$;E(%JaH*"c^
+lj'HFin^9Kq6eI:-e<[m,Ns4FFs+,fcsOJuft;/@[hb;fTG`LMbc?f@%Wn$MqHGmA
+X`QGnqqPDc"33QjInT&]JBFsk>'@<VSK&\p#n(5f2YQc\WKhlbU^Fdr"eS>T6X&O>
+dM&MrEG=5?0d'ggKtT72.'C^Nc#smfoFfb8aP6,8LA++5#!dU%f&6EUS[g[58$n#*
+#<1lRm\o.<8)[O-;%P835nQ1d4MX!uNo$t(0]-:kCWU.*".0SSUrWX5a9YSd6;[,F
+W\O)I*p^*]Uk3c.B%&=Dm3T?iQr9t'q]=oYqVE&9.tC0_EA.DI<C<+8IPsRHW7WA8
+"?8RaUhLf@X8>B;199/6XDNo=KqZ9f069['p@IC_E5kM15oS7Be^J+fDS;aqD:#QS
+43#\-i>t#`'84Vk"*9j\rf,\t8X=ltcmhPd>5Oia<F)3:6f5Bd)?X/<^,cuFFaU3Y
+7>r)NHd.Q[%5)]-F+0P5&Eu8h_'+h?9(t\nY+'R:*ft6(OmZq,^tknc((i_S&LtVo
+[QE=2]t^(@@A"JJBRq:c#V-a7N8p!*AIK?bg?j"('<F:,]7Z`@p:BLnQ$RV?0U=DP
+U*oQ&HkH(K7.q":fTS[#kW8dM`X;HB^sMgX!Ge4p8H97Wh$?ql:TIuZiq$GLQ<N4q
+UhVoL-6&kOc)32k.mC(&e:8C__l4P6&\*4QD!G$RQuUeUUmdidi8"ca48F?_RN*6r
+Po7r[[p%XQrr>jeKL9!nOC0^P)g2506u+9V_Q(8KSEgP3CC;(^XD;3\B\FRhXur_/
+=dH^U[bA.o28[@g1$s&B9+.T&'Cb)qYH'SUfH3ALiN6gE%)I:M]"1/U7,Ah0<PhcU
+J$?M;IYj=LJDg0g0K+01qMsOI+ZlP]m+[\<#.>.\Wn'2TN^4,$\Q*ZiSTPl1Og3bq
+Y8+V8E&..![aW*mNJ2U1V^F(GbF7TP^ufNEH#1S&T/<ntJnY@Zf"OXK2HpC%D/GZo
+49os<PP&tAV.TRE:+__8P>9/%i^`0Y@Cp[P>1HII.ucAFH5S8\KB+,KFG''51S]8K
+)lU%'VReBqg^`=TdajPfVo%YK^NI13&8Be<qP.B`9REsaXN7Z^QEdOf/9BemA%<a@
+5L^V)@<oH<RkkOlkHr7*Y$p%5CHC?Dj5Z<OF+oWqb@S"*1cATO72m/]@sr[HBlGr=
+CQ%Q<c>V,"KS3u<`V:Y9qnJ'=AFtg(LAJ14O@X%(9e<BU2cA%@_F1E=Z$I.0mBsE,
+dcQH/a4Xh"_FC<Ud4i((N19NAa#VCq)E<TC,m#)s_'4(/1Yj:9?bTP.a7iq2INM+T
+Wnd$Dp9rPno`\SA2Nd!lrfMn##0bg??,Lj;1&Jr186k2$M9;iqjB"d**Ldm??inF(
+[&pL7A$XdFb2+&k-oHdD"5)`qC[_Xb1'Cb;]-e;+O>_>W1&>f`IC9ana0I_&csMmc
+\[@tL7fhB_<3*;UB&CjP5;fUf[sCfi[EeF2e@4Jk9d4LA],YTj1u%8I)R9!o*p16@
+J3/n`9$E/J*DI9,G.GPreW4Zg1)eh.+CVo<jr)t$5hB:'973#;N2(Z.)UHcclI'&t
+`'>l$Bs+-r8$An&]8^M@WqsJ7WT`_]Y;MZX%(4AoJ#TC:g(nn`[fb)q"-'/Erm>Mr
+MUqX9[.MRY_GBE#@+V#dp8i27Nr;l<N>b<oI)^g"&eakg8W]lT>O(rO)(_lHP>)eE
+.^aqr(]J@R0Fh-Mef1[4kZL[t*1H**VDe1XB):0Le%)5Z%'4oAG"$Y8XcI="]!1<7
+"T!0YMhJXPphI!jD9_p^eXH!`[8mH,A)-3.A05K0";.a1VohL%mM887%6G8NEP:%+
+0YNHcAQG"fG24*9%%]F)2Dal_Df`2!@nu/?30JA>oT$.<4/b@_,-7;Y;YC//d+0$#
+*qm#aoLtA0CFRrc/iC&&5:G3t2sE3D05F.#AcW-4BaF59X$9$lS%8pn(tMa-OMP=5
+o\*lL\]o-gZtZIAq-pFAG#mPQIY&JA+GmAO4u(3n:JQ6dFa3Voj't5f9n57Ehm`4O
+1deW4/F:tc<K)88[^J>aZ%qQQcM)5N2f,;s%;B]FFOIR*d=!RW/Z-Ea>i!1'9>n+7
+d+<,qD#D+KZREm4?B)l][uD<C2XG*>6r/uml1fMtMXIe$j1=r5K$'PU*T5%Pkt]h1
+7_8L4?D3"?ap1jRY9t$o0t,YD[ES?^LM<"25b@0^n8+)n<[u/B5=o)#Z,_V/IG](W
+K9ku8d9DR64f$+?l_;YEW/BHtS$@roG5(_EoLI#=FQUs9_l=2hYBsI)*Et>9Pj(`d
+nllr_63HKl@b24a?)\r^,fCbhqZSUG\F_Z?mP[(cd%:MuCNjqd8O9lRD;M%&2RF+;
+!pOM=Ce3%eN99#/[FWne[]m8'BcBILZ./9<#0edMDVq>8N/E<hf[AG\V]SC9j?Tr_
+hjR2eMbr)$B-FZHLK5L*CPWE1BOEHoK'`gU#?3cG-2>*1hUrFB)TrBrCk`1dhKkHt
+AgTOVIf.po<Z9<bpQc:p@i`)#4?80rd0Y8^Tp/1K@H?@uQM8r'Eqe;Ih=aoSJHk/H
+l'&$QZ,.NKp/59]ZMK=A)Wr-u]N`&CQ+:Z\Z&eQ_k;C5jWb$1`c91Q6cl-[LX77_V
+#7:cQ^!-5$`nB?ak`FZlRm[7"Zt\[LAOY+.Q8I2''srPqr=dKqG$+P>!,0@;[pg,^
+AnshRA&Pab^@l7c\6U\OfBJH)*A&jik#rh`h<jqOc#p,!7W'HMdER#,NZ%nHN.gP1
+?_Sl(#I.p,l5Jo.K57[AB\Q\J35HXCH$3PTp:ck2!;hheM>c<@&A"_Z\>$ttjL2[(
+j&:Wq\4=*-cal9,QBuMB+M0tk)/T(l;K3&J`8Y-+E#YNHU^>D/)+p?,,>o<#qGj]$
+_H:!qK1K]oN\<,dm/\+')9i?8&o4SVY'/Io>\WBU<-@D^F/uG7`gua](8.f'Z)hpk
+X<,_r!BdJKq6k(IQA8T2<L\`&)Yos).+`lSZC;dB[`Vk"_e9Z.n4D!#-l'OKeajCn
+*!f&GYMUrG4t<NW\1))s4K%\/X#9,+iEX/>1.t#*V!0ZkW6k;i($&qSX:"M8-un#f
+aH/Lp$SmSiERg(mPG\NB[cjIo*&hF\\DI8j\\Y!Z5+j1hCOo0D5dJ$rkT9>mH?Jjr
+(:R]nR<dJdA^2R>q6")jA\Y9.&LG#L06Y*^lFLP$rI]]+*nj.,')*-^rFh6ee&d[V
+ih;.RjB;$q8"6L)^9(;g-]_JCp>aV`CU1XXqnojZZoUH,fiT(*d:R8HWYO?PN;Bgs
+Cu3QT5s*^0)mklmdBbUI6QMT(4+1P(j#*[Poa:Z"DtO>C:SsH4S4db*p/]@AqlC7]
+4!8m$/sH4/A[u"F.pZD]2i@.qEiZ@k9d,i7!@C:l2ef`l.`L(H54[F5[psbYQJ?X#
+pH`?W,L*ftl1\Zdc,7K5i4[mHCeIEF4R<Q-d=MmOQdfcW]EZcted#pmmdI^ALdV=h
+FKKa^d2$PAGA>!AYj5mOT5.q<<Alti@<$IN)M:*K(4K!fo\rqf4Y(O)hb(I0@2D%h
+:UQ7"K%\_%lE$JT*B+VCXRob4#LogTmS8OOcu(sj+D,4o**XmO=aaELC1X*RV'3n/
+o[rmE/W%uAdDcJRmoh?1!KW>O-`?VQ?$iWu2HPfo2%Uq6h4T1(HhGei/(p;t;B(nM
+9po+oc@=OU,Z*YA5L"q8>FQN4(.I+i]!i)O50rJLEHB=\@GUG%:<IgJhp\]Pa1:ur
+Del8:]DB=a+;HO=lop@PF?N$;KPh5VHC+?VTu?8jpas4PMX,9d=R9l^J0/3ECIfWi
+[B:b=*nncW[%!"ZiFAHQ$Fg52%3TDs%\%T7HYB(A)WG>s@0?VK[2KqN'8RnP6rf5)
+IXSA9Q,USb/pMlUP$m^MD"s:)=%16KA+qrmf"f\=_WU>FS\+Lq!#hD*.d8s&YX:8N
+QSQ#ZA-]Z`]>p1T)TN.A0Ul>@Z-B3`!DG`hF3hLiFR4r26Wi[-;BkIu&/1%!7f*iO
+@B>fa]eIHa9.\jW2r*pXmI<X\[cZ=Um;U,t#.>N[UdiuZ#ns"#^i-!(ca1u(I853/
+I'J6l*A.47B82u^Ki>#'>LTQ09:/AQ2G)`:G9_AbKD;2ia9t&bm!rRj5g]gWdWTc@
+rdj^u/$PXe?huMrffRq@qk[98A$9D1@!AHNVc0,ik.':40eEY%<hfbtXjrJJ>W0=R
+dBk!=mKk!K1kaNsd5Ds1%P;@0g`"iTESSrJMQnP6Y)Rrn&bXPlF(t8"AVIb_@Blm=
+<]lB&D4P=WC<Pl_0"Z'RZX6`YBH%)"/t0Fr$QG8Op,UD@>3EHI(H>'#F?oUE],o^$
+FQAPK$gcLJ?u@;"]BL.rE0Np//V;(FW85b9a02JmM3-=h@*#I%g34"_UGO?/C1MNo
+'7*\@g'psCe3?L>h2RiQXYZq>QRgI;SJS;/F/j<FA"LjIE*l`qq:;eK05i"UG%[+u
+17N'"Yj?I/OMeK.1Z(b/``2_`e:Z;+GI:9MFW:VI2_)nRTnU_b3"<"m@p3>RAN*9"
+Z1qeAmLM?BX#Bg.oa-F8#3j8hg5'P8&*[G4YB-6Gcp?$dTLZE(.>s[JOQrr+C`</H
+Yip.:Xrfi,r$(N>]%#]e`\sRRjBV<A]6Tc_+._+)_a9qi?%.nFF':g<I8fQOe),A+
+=Pmk<A+""7[Lbo]5!sd`EuK7"cHE2IAkSNG/@N!mb0GdKJWchU$OD-?\h(/59r$K$
+Kk\4Z-k4*L^(&j"Vu!;k=jJtXj0%pF-d0)1?Xq+M9_(fY\_QEI%lZDIEj=EO=$qTn
+V60mULQ]IACSS^g(gg/n&$/iX%BrJW/<32o%_^IUokt%lqMQfJF6W@K1d.u\?KV1t
+dPU.+H6r`7i)a$'6+SqA/2&*uT6#JS2CpSE2D1:fA/[j>H<3nGV`MY(nZ2<*`hC<`
+BCT4sef0UV>3![KneK^J]SE#X>A5%0LCbRAjLF'N6`IK/b`G$m:d>>K416L\?p(&M
+koWqe(raD+f]CdFA(,.r^!PAW@-IpM$@Mi:7npn4gh*scV'UcpBA13/q!"g2l"pM5
+$,HKJC0L]<!5XX*hQ)'6@g>W>conILPLpFk<i5q*9atR_KZKN%5F[Y[X/@&9@_Zon
+n"H5NE8;I:/-W3<XjmNRjOQ6^"(/$KKr1uS,.CSk.s5:G/M>j+>d&7n0R>VZS6`9\
+7+YNr@A?=g3\Go^FcMf$;&($%bKFGD9f9.Y%*7(-93FL0i=ce?$=!k$o]X]/(Yb!^
+Q+LqiY1jEh%9c#5cFqai..u>3DO.e8\6)<4!MaHte`p5uj'dA3FSi,>*MKVH[=koJ
+V"ebgYC`*9XQ<m!k@6E^o*4.=/e3/F!44R"*VEF.2(,.I"I^:>D8iraK.<r[c8C4)
+)4$lYS^VV\^K,5l&D"Z#kq;]*/PI/.(-^t(LSECeHB,("pmDWD?I6*+J(_!?Y;7/V
+K3[$6`\b/8OrbZ,S:2m))&aHoET%[<%"=S]<L-]>`Gf_X[BTML+<Bj;J:&/QdlM'm
+R*<]_R:@8</U#_/1m$0Amk,=^H@&)^Fg,DBe1,1fdI`qL+.UaQY-+t7?%gC@gtS8e
+ee[SYpOV#<]!*mh!Bj'^a[UoPAN!`.>;t3X>gR;6Kl(m72e^Un`1UX?jtO4>ime/g
+*N^r5QF3f18FC&'>1V-Xn!CGaFB.s+hW(STiN;IGg)Eu*80%Mu"_O\SRgJgPqLKsp
+EK-Ga-nhmB<mXrPoB:(*%2/4iae-i0g51)jDZC##OR8@b$X,(idB;(sD"oHf_e%*J
+6`Y0QWFJ2No\'WC,s@M$E>st%IY$8r\8GeAO*?CTi&+%/b'5eN+/M=r@s$SIcODTi
+T#c"]LH)`;\agg8cIYhmS[Bj7>#br8a5K!pCE5$S8XC3P&&B0S=(5*>ltHXo)!>[G
+N?:gI3:Kdl1d`Y#C5HqHWU2?Nk1R952$<1WfQ]YLft._#0A9-ZG\dX,f13WWQ!kU\
+hH8b$4o;Yfe%-o.+3d(90!?@pd=$SjHWXB!D[nZeG39IQ+,Yh1%geA(#m2:PT7_a^
+bHg_F?ePl.[Ii$CDY>o6g%hfB*3ALShm:j]Zo?LO[)R8L#"H1-co?B!Y*\F["dEY/
+3,H=1L>L)ugsGbI,Q!ULcUZ-#Q??FJ#MeHYbGBi$X:bBr5k^QD<!FNi)994e`<R^1
+`:PWt$8&]D=]62e/X/?FZ<fnNrrB&/UP*tBaL8[[I28GK#!UC$g'`D4%ZcdoqS1QF
+B%eron+((%];U#;Mbed)Z,c)4fJ`#3F+Z#Un]Ws**T?K;eflIW.G-\o\8s=<,ZhFd
+`i"!S>66%?Vr4VdXgX9d1OEu;m;rfqlQSF[H!6bg%F6omhbK.(53eq'\&5P6)3F3#
+.^L6]l7HVp?8oQN$#ZN"7uDKp[;*B,nsis/>j6@A[LPQipk=&:V[SNMj0N<+e%)'O
+114n*kMa;%CUT=>-*N]_`h+!Pe+525"s-oi\7#/bZ3.NsK=(259!i9#/'3*dQ%b3U
+MY\uCK+dRKempHtQ!?:sFu*0d)E<,r7toGc%8CEYZ+GFXg6)9F&j@f^VI<Vq:V+`K
+O@:g:!P;*grabq.8^aj]LHoEtA2V)s!=g?hLm<<,BP86Z]f7$5[p>>KK9n]e&ZF<t
+Euf:UZQ9?5KL5>NI]Qr<e8gRU:c8dD#?Tflo6lr=ool*-A!TElk0'RR@"HGYX_c/*
+rA&anB`*MLH`UD3fl>(p*%7b'*9bE6ij4*Bh"H/'a^f66J1R+([/7\2b<lF3To8pN
+&Qdo;Z+dhrcKNPbId%*d*R1n:d&p&C2QV@H)gt;k8\HnbU@`sRR?pWjfokA;Atb/s
+ZIn]u)S(=3dID54O4/E#Fc:IEVOp[X(tooh(V=edSl]E6AgT-:7K#jTnZ/]4)Rm9F
+g*H*-RbmJa_,BNV`lrQc6uJjremDQCrEJ&9J""n0!0PmTFCYBGinn+r3doRWer'!4
+-e2^195!ICp*\q";:9c>2dFP4,*pq4`3.hNm927r*p5mKJnMQ(dIiB7[g+P!^5b!_
+Z,+#<&/n%&clk=A19gY+E,GhtBE>BL2RdnfaqDW:FW7OY#o.f'icT^%/um^8qJEtV
+[9>%i)G\mP4G_d$h7JA^VW1lJXm/m4f&?:&Zt/h')"_kO[?'-RUP&&(ag/t?O]rdg
+=`u$iXfO.<k-@7911Vmp2&sWGgEQ!Q)nD03[A.F^\kd$*:lkd^b1)=uYo4-LTq[n$
+?j=ZZ]38Pc)8li"MupRa1=jt'bmU>[!NC8G^f\9!Q0%"(R8[8k7eRV-n(L7S)t8tD
+<o";b'0A15I+<kJ@@<l`?U\S)(QXB.p5NSN<,TU#^J.Su>[b$f>TqB?a_=P6Y1D>r
+Y&-9a`5D6eO"oV`5\L]T:.m&hok>MAo[jZJ9TfnMT+Z6HCWCd-l<*2Z[TD^bqmRGq
+n1*OCf%XHe:MlVf!XL(G#JgJr!54><?WiBTHe[rC1krsDV[Z8d-/FUT=OpO`ge1;p
+&fM]$jJ)D&i8RPD_CH*M)dPhq!O!li=NbiBCKUY!mEXho*oe?)$/sW(Wht?`G+&s,
+pF-(PlTlg9p=G(]_=VRTEH0t_Q'V,uRPLrRGGO@4*b6&)2t>j@og_jTKhO'/G_-6R
+=p0B\#:ha3JS!KdYCQ3?K.A3_UqlHP6d5]]Bt9=:_J301;LMo'eh\-KC[A0hNq9Zt
+XqH"c)b=\*U>u)^ATdr[`=A2:E42Zr+9</O6L&u"OuAHsnqIT]#O^eVkP=SYb5H2A
+D5R'\9)tkJ>pE(Q!O(D'd/(MLO4H?dDTZI=B[IOU[ETYe\d&`jij?:o1G^_ea)Kk3
+p3;?O=UU@i0*eEJ7V,W_[(VK39hhj,dRUgUIk_JrnrMUqi-=3^lA3jOno+[][?T>+
+[IO),n#oTi!b?\9`lQ0CWudXL)T#$VKXr*)kS]Z"*XSsbiUth-fB?E#OY,9jWF(5u
+/nW+>g`/8F'BXC;phU%C*pd:`j0[eY>3:l^rA$XcFu[abq\p@i=jR05CmjhI4"Tf`
+d9bSF/Zk:mqo+4K_9CqCj_s2<qBWcI[a6kdg;RSm+A"_RLCP2'&aI).(IOsqME6B*
+LQ/'F&73qYYmo_\nQ'DI&6hegW$?X052O:AHrXU3;;**dXoX*)mr0SWA8Qo5[UV/F
+(h)NZ!_MA^GZK?V#Jl?<GNnuj_JN"bf!V8[(!Lf<P5_;>bT5i0F/.7c34DZcb3p@Y
+R)?]r&&E<i!1pNM)UT&(<tc/I<_TkH\2=;Y2q>XOO,[F8Y<-<4%;@ed88C_9l!-a0
+c`C-u:YG!tQY5AYr]\Y&<AD`]hSJ[@[Yq?h!#_-\:Y#E/f]oD^rr?.P0^#f_>`R)W
+<T;[qX.SflhZiid"RorG3\_Nn)r3lakOi)<1HL60g[&TeE<$"[RKj5-qR-!gU\(.;
+NVcKF1n'DG2RYZ`>1])QVOWpeiF$2-ejETNJFgdb\i4_;S1qNk=685bl+cUZWh3SI
+?<eMUTGldlAttUK80YN5Ul$e&<Vl^qdW0<5WPtb[m2:&8X0M&-=OHWn:8t;jd>*q7
+XNp]#NjB)(C<^\)KXKQ:+'_SO"-lcVX5?mJ>2Qa\/"U/G0h#J@QMi8qZm,LqqPdL"
+FdP2"VqB#F7C89DZZ%OQ?nC#%4t4sFLu.em3'l6G_<UCP%&50I/=Q("FpjeJa0hW!
+qLCN\,!6R/eT'<tDmOqkLN+O0;l_RJcJ$HG!5lQr5ZBIeYi9ckB&V`WhigcEoM;iO
+h<rh-n4nbG[8ZAj!*HgmHQ(+U-K25F[_hcs#qd?<gfiNe3-(7XC`)RS,]9GXHsY-q
+n*/*+$S&ot4h%uOfjkj:mj@>9Z(FGT4i(p\k83u4A!h"KN,Su)j6UhldQn7kqM<Fi
+m+e\4MfK:lVCAaZQSm(og=,>)#@RFqA1I5(?4Gb\1gt78d+9:*[XeP).GuI\$"K>=
+US;s(D/p&3J0o^OT&F0b;pNDqW,rmu>3`*=O%?4[N,s2Xi[h;nTC_"OC:A:jHa^LD
+1$u7P*Ynj]br^T[!O,d*grK:s^`:h6TTDAt#nTUY'0;U(r-,^=BJ+?0Y4f-_1tk`J
+6Mg&l4!#<k0Yk9r_[N(?XDjB_M0:LO'bcd2)9a\d9jk2t$)j5`0P)=[\-d.YF#'o(
+[M`K+>Fbs+Vg#NGQ)@tkR$U:(d5q%R*'ot3(Xld:Wb(sprr>[3E-B;4)b0qWZtdgf
+aurFJd8\^5\W1R^2g5HtJqt=C.3n5U1h3u'=Da2b]L-?-7*L%E.g+*ua4.Nig@n!M
+"`;UC9;0*@9%Y2XrcE%+VHcn+*Lj4#/:;i)SS[%dS(PlR=r:K9S3Zp>8!I/0Hcp=R
+n2a,6%Q6`i5H\R?B%hFeAMpkNI[M=)T60S7#2<GDeSm_./$/!BH$QPbb1^-k`k-<*
+B0G`0)&n,;>lu^^qC0%kVUF).6;N"CH#n&J5HUj6G"S_-X^)`R(HZ,20u\g`IU1+V
+o<9sR3i5AnBrTs[U$lXp(C-"Ko!aW]2>W>VgE[&EPKo-h&)a_hen%N5?[H&2W\nTa
+mAb@f&i&&;&dg@-.de6M`Od%sfn".\X%0UR4*t0m_cu`k5M>mci8i`J!6\#N"g.;6
+%k#U0"#*s.kfn43&.-mu#_EC@\Q7`k/MXP!:RG#gEA5*U$eBkp,T8LGB;=Rt+L7o)
+_1Y1`obosIbk_!=%4r#8jit,6Hbk@5g4dW-jOS<*E\+FQb$#Wf;[BT3kp=1%K%7ic
+aa"C-IR"nLD/1[I[-l?!/Q6WMci`o>TJ"6F806E@g>E6gFO9q39t=78"f-p51uOMl
+^oZ=7dsDsof@oCZ!kV!MA8#*-IVQIFL3m47[[nuN7%VfaXTQKnNR@^,e0%X1k5/P4
+U^7.=_3Ef_XWOHr41=AMg/TqE=MWCeE60:gX!q7o_ceN5c>a;%0bSiCGp"g$)amli
+3?QZt^:4BZlGXI"m=&h:n+9#bjR)4,cb%_M@(DjI0!";,%&`B^-t"<Zq/_TBOQgae
+%MDC-_Dp_VknZXnI$/TtZf/:f1ptjrme"UD#9HN`KsB+3C$HDHqS9.Ic"2pbJj%"e
+gDgkM@8mD<1S.4mqS/E?BY(*s#+J8pL<E&=R+*R)`(E90P65dXrJKOkmI`^ID2/[8
+;rJY[4:8)L;.\alE,CVYrP1f_]8Ueoq\?F"=(=_J*n.3N54r#NZ^GUM/KhB-mADFD
+MBcN5#;XSW9kDOiMji:hN?OrZl*(52@62G=_QcTu_.AXJWqB-tod#+p*oba=q5k#A
+c0h!6G(bDoKdK#\2h47\i5$YtLrKJ'!kVY4[b"fGARVGSc'nsSTH0fiU>$bZX`[[q
+:9A<?\Bd3-"K?_Xf=UjboU%VofYWgk8Ta<8Nu!QYg`rPUj5nY2/7T-\MtLl'>]rX"
+HorN%)"t8T\Bsq6CQ@iN*cCD8HX,PS"&'?q5#@s:dpOFYb]l=pRUP77j$.NXiB7mG
+e?T#Rc?lIW+-XN.d@lUZ6"rQR*-Zj21%sa^(Y)sn>pZiI/:Z^e<K^VY<U:IUdCX0h
+ju@h]*W-72qLp\OW,maJ>2)?o]*j&H5C*IAii"nmo_bD"(A`:/-6-@@CE$^A>YKmE
+'m@%d98/)=cI_rXDoEJnAS`Nl[L8HjY`[d(I#p>.5bL[$Xe+m[/3*>aOOc6LjtYFJ
+62D#^^mT36=Ys2nbB#<Ad',@`m@\9'4+MLO)G7V70#4aY^D3&6ip/#(Jm@G$_eXmW
+iR-WBO4%:Rh3D\uZeE=,D'%*mOJ%^6Cc0sFbo'J,V<HFp1ch0#Aq=()[_8$DdKYYL
++2fDrlV%(S:'YoA#<'F%B[VAli3Ta2HBW@t_qeZm#A(G@CmSuoCSWr5=[,L)QUmjP
+R^,:G`hJXDNlm9U5`f9Q+.,b-LH4;rnW&L`!-W77g.QIip:lnZE%PMWRX&qRF][+*
+'t0`YU?9*%Y(4V4bc;8dWmokuZE)_dV8/Pd,K,Y<.l.%g+%[[o_'XTGM"huifjm&N
+:6lBJ@L^u?Q3L!QNKHZ2/S!W%<mg=X4HJ=dQ2,[#MOa6&-<fnB,NA,k;j3G^fZ/`P
+`qu--YjNP89^&)&%To]s+&7n(F8HS3#Z,!R.6pBj_s&!8=3;`Es4I~>
+endstream
+endobj
+5 0 obj
+<<
+/Type /ExtGState
+/SA true
+/SM 0.02
+/TR2 /Default
+>>
+endobj
+1 0 obj
+<<
+/Type /Page
+/Parent 7 0 R
+/Resources 3 0 R
+/Contents 2 0 R
+>>
+endobj
+9 0 obj
+<<
+/S /D
+>>
+endobj
+10 0 obj
+<<
+/Nums [0 9 0 R ]
+>>
+endobj
+7 0 obj
+<<
+/Type /Pages
+/Kids [1 0 R]
+/Count 1
+/MediaBox [0 0 116 154]
+>>
+endobj
+11 0 obj
+<<
+/CreationDate (D:20040721110942-04'00')
+/ModDate (D:20040721110942-04'00')
+/Producer (Acrobat Distiller 5.0 \(Windows\))
+/Author (Dwight Aplevich)
+/Creator (CorelDRAW 10)
+/Title (Xrik.eps)
+>>
+endobj
+12 0 obj
+<<
+/Type /Metadata
+/Subtype /XML
+/Length 1020
+>>
+stream
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='1019'?><rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'><rdf:Description about='' xmlns='http://ns.adobe.com/pdf/1.3/' xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:CreationDate='2004-07-21T15:09:42Z' pdf:ModDate='2004-07-21T15:09:42Z' pdf:Producer='Acrobat Distiller 5.0 (Windows)' pdf:Author='Dwight Aplevich' pdf:Creator='CorelDRAW 10' pdf:Title='Erik.eps'/>
+<rdf:Description about='' xmlns='http://ns.adobe.com/xap/1.0/' xmlns:xap='http://ns.adobe.com/xap/1.0/' xap:CreateDate='2004-07-21T15:09:42Z' xap:ModifyDate='2004-07-21T15:09:42Z' xap:Author='Dwight Aplevich' xap:MetadataDate='2004-07-21T15:09:42Z'><xap:Title><rdf:Alt><rdf:li xml:lang='x-default'>Erik.eps</rdf:li></rdf:Alt></xap:Title></rdf:Description>
+<rdf:Description about='' xmlns='http://purl.org/dc/elements/1.1/' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:creator='Dwight Aplevich' dc:title='Erik.eps'/>
+</rdf:RDF><?xpacket end='r'?>
+endstream
+endobj
+13 0 obj
+<<
+/Type /Catalog
+/Pages 7 0 R
+/Metadata 12 0 R
+/PageLabels 10 0 R
+>>
+endobj
+xref
+0 14
+0000000000 65535 f
+0000027709 00000 n
+0000000016 00000 n
+0000000227 00000 n
+0000003772 00000 n
+0000027639 00000 n
+0000000356 00000 n
+0000027855 00000 n
+0000000389 00000 n
+0000027789 00000 n
+0000027816 00000 n
+0000027936 00000 n
+0000028147 00000 n
+0000029250 00000 n
+trailer
+<<
+/Size 14
+/Root 13 0 R
+/Info 11 0 R
+/ID [<e424d9116c71a55ea1a236548ee30e1b><e424d9116c71a55ea1a236548ee30e1b>]
+>>
+startxref
+29336
+%%EOF
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Incleps.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Incleps.m4
new file mode 100644
index 00000000000..ceb1bc0f0c2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Incleps.m4
@@ -0,0 +1,21 @@
+.PS
+# Incleps.m4 : Illustrating one way to import and overwrite .eps graphics
+# Note: gpic doesn't fill the arrows
+darrow_init
+s_init(Incleps)
+sinclude(F_Incleps.dim) # Inserted for the web-page version.
+sinclude(examples.dim) # Change examples to the name of the main LaTeX file.
+
+define(`backarrow',`darrow(`$1',,,2pt__,6pt__,6pt__,<-|)')
+
+S: s_box(`\includegraphics[width=3in]{Incl}')
+ifgpic(`S: box invis ht s_ht wid s_wd with .c at S.n')
+
+thinlines_
+ backarrow( from boxcoord(S,0.4,0.95) up 0.4 right 0.7 )
+ s_box(\sf Basket) ljust
+ backarrow( from boxcoord(S,0.9,0.41) up 0.2 right 0.5 )
+ s_box(\sf Ball) ljust
+ backarrow( from boxcoord(S,0.85,0.32) up 0.2 right 0.5 )
+ s_box(`\sf\shortstack[l]{Star\\ player}') ljust
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Inclpdf.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Inclpdf.m4
new file mode 100644
index 00000000000..e93090948cb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Inclpdf.m4
@@ -0,0 +1,22 @@
+.PS
+#`Inclpdf.m4 : Illustrating one way to import and overwrite graphics'
+
+include(darrow.m4)
+s_init(Inclpdf)
+sinclude(F_Inclpdf.dim)
+
+define(`backarrow',`darrow(`$1',,,2pt__,6pt__,6pt__,<-|)')
+
+# A blank box the size of the included pdf figure:
+S: s_box("\hskip %gin\vrule width 0pt height %gin",\
+ boxdim(InclA,w),boxdim(InclA,v))
+
+# Annotate the included figure:
+thinlines_
+ backarrow( from boxcoord(S,0.4,0.95) up 0.4 right 0.7 )
+ s_box(\sf Basket) ljust
+ backarrow( from boxcoord(S,0.9,0.41) up 0.2 right 0.5 )
+ s_box(\sf Ball) ljust
+ backarrow( from boxcoord(S,0.85,0.32) up 0.2 right 0.5 )
+ s_box(`\sf\shortstack[l]{Star\\ player}') ljust
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Koch.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Koch.m4
new file mode 100644
index 00000000000..faa46dfff8e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Koch.m4
@@ -0,0 +1,32 @@
+.PS
+# Koch snowflake
+gen_init
+
+ leng = 4
+ X: 3,5
+ nsides = 3; rot[1] = 0; rot[2] = -120; rot[3] = -120
+ depth=4
+
+ for i=1 to depth do {
+ for j=1 to nsides do { tmp[j] = rot[j] }
+ leng = leng/3
+ k = 0
+ for j=1 to nsides do {
+ rot[k+1] = tmp[j]
+ rot[k+2] = 60
+ rot[k+3] = -120
+ rot[k+4] = 60
+ k += 4
+ }
+ nsides = k
+ }
+
+ a = 0
+ line from X to X
+ for i=1 to nsides do {
+ a += rot[i]
+ X: X+(Rect_(leng,a))
+ continue to X
+ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Loglog.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Loglog.m4
new file mode 100644
index 00000000000..2985338b3dc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Loglog.m4
@@ -0,0 +1,85 @@
+.PS
+# Loglog.m4
+gen_init
+s_init(Loglog)
+sinclude(tst.dim)
+
+define(`rint',`sign(`$1')*int(abs(`$1')+.5)')
+S:[
+ horiz = 4
+ vert = horiz*2/3
+ tmax = 10
+ tmin = 1
+ vmax = 100
+ vmin = 0.1
+ tic = 0.08
+ denv = log(vmax) - log(vmin)
+ denh = log(tmax) - log(tmin)
+
+ Origin: Here
+ define(`coord',
+ `Origin+((log(`$1')-log(tmin))/denh*horiz,(log(`$2')-log(vmin))/denv*vert)')
+
+thinlines_
+# Left axes and labels
+ psset_(linecolor=gray)
+ vm = log(vmin); if vm!=0 then { vm=rint(vm) }
+ vM = log(vmax); if vM!=0 then { vM=rint(vM) }
+ for i = vm to vM do {
+ move to coord(tmin,exp(i))
+ line right horiz
+ s_box(\sf %g,exp(i)) rjust at last line.start ifgpic(`-(0.05,0)')
+ if i < rint(log(vmax)) then {
+ for j = 2 to 9 do {
+ move to coord(tmin,j*exp(i))
+ line right horiz
+ if (j==2) || (j==5) then {
+ s_box(\sf %g,j*exp(i)) rjust at last line.start ifgpic(`-(0.05,0)') }
+ } } }
+
+#Horizontal axis and labels
+ tm = log(tmin); if tm!=0 then { tm=rint(tm) }
+ tM = log(tmax); if tM!=0 then { tM=rint(tM) }
+ for t = tm to tM do {
+ move to coord(exp(t),vmin)
+ line up vert
+ s_box(\sf %g,exp(t)) below at last line.start ifgpic(`-(0,0.05)')
+ if t < rint(log(tmax)) then {
+ for j = 2 to 9 do { move to coord(j*exp(t),vmin)
+ line up vert
+ if (j==2) || (j==5) then {
+ s_box(\sf %g,j*exp(t)) below at last line.start ifgpic(`-(0,0.05)') }
+ } } }
+ psset_(linecolor=black)
+
+# arrow from Origin up vert chop 0 chop -.1
+ line from Origin up vert
+ s_box($y(t)$) at Origin+(-.1,.5*vert) rjust
+
+# arrow from Origin right horiz chop 0 chop -.1
+ line from Origin right horiz
+ s_box($t$) at Origin+(.5*horiz,-.1) below
+
+thicklines_
+ alpha = 2.5
+ beta = 3.0
+ tm = max(tmin,(vmin/alpha)^(1/beta))
+ tM = min(tmax,(vmax/alpha)^(1/beta))
+ line from coord(tm,alpha*tm^beta) to coord(tM,alpha*tM^beta)
+ f_box(invis fill_(1),`$y(t) = %g\,t^{%g}$',alpha,beta) \
+ with .sw at coord(2.1,11)
+
+ alpha = 0.05
+ beta = 2.0
+ tm = max(tmin,(vmin/alpha)^(1/beta))
+ tM = min(tmax,(vmax/alpha)^(1/beta))
+ line from coord(tm,alpha*tm^beta) to coord(tM,alpha*tM^beta)
+ f_box(invis fill_(1),`$y(t) = %g\,t^{%g}$',alpha,beta) \
+ with .se at coord(4.6,1.1)
+
+]
+
+# box wid S.wid ht S.ht at S
+# print (S.wid,S.ht)/(1 pc__)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/MC.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/MC.m4
new file mode 100644
index 00000000000..8c8872b9c96
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/MC.m4
@@ -0,0 +1,35 @@
+.PS
+# MC.m4
+cct_init
+
+ dv = dimen_*0.6
+ dh = dimen_*0.4
+ backup = dimen_/6
+
+ for i=1 to 3 do {{
+ if i==2 then { Input: dot } else { line up (2-i)*dv }
+ source(right_ dimen_,AC); llabel(,,sprintf("$v_{\char%g}$",96+i))
+ resistor(right_ dimen_ from Here-(backup/2,0)); if i==1 then { llabel(,R_i)}
+ inductor(right_ dimen_ from Here-(backup,0),W); if i==1 then { llabel(,L_i)}
+ line right_ i*dh; b_current(sprintf("$i_{\char%g}$",96+i)); dot
+ { line down (3-i)*dv; capacitor(down_ dimen_)
+ if i==1 then { rlabel(,C_i) }
+ if i==2 then { dot(ifgpic(at last line.end)) } \
+ else { line ifgpic(from last line.end) right (2-i)*dh }
+ }
+ line right 3*dh; dot
+ E: Here+((3-i)*dh+dimen_*3/2,(4-2*i)*dv)
+ for j=1 to 3 do {{
+ line up (6-j*3)*dv then right (3-i)*dh
+ switch(right_ E.x-Here.x)
+ llabel(,,sprintf("$S_{\char%g\char%g}$",96+i,64+j))
+ if i==2 then { dot } else { line down (2-i)*dv }
+ }}
+ line from E right dh then down E.y-Here.y
+ arrow right dimen_/2 ; { sprintf("$i_{\char%g}\quad$",64+i) above }
+ resistor(right_ dimen_ from Here-(arrowht/2,0)); if i==1 then {llabel(,R_o)}
+ inductor(right_ dimen_ from Here-(backup,0),W); if i==1 then {llabel(,L_o)}
+ source(right_ dimen_,AC); llabel(sprintf("$v_{\char%g}$",64+i))
+ if i==2 then { Output: dot } else { line down (2-i)*dv }
+ }}
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/Makefile
new file mode 100644
index 00000000000..5cad778d914
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Makefile
@@ -0,0 +1,269 @@
+# Examples Makefile
+#
+# Type "make" to generate examples.pdf containing many examples.
+# Type "make clean; make examples.ps" to invoke latex intead of pdflatex.
+# Type "make <diag>.ps" to make a postscript file from <diag>.m4
+# It may be necessary to type "make clean" before this or any of the following:
+# Type "make <diag>.eps" to make an .eps file from <diag>.m4
+# The following require ImageMagick convert:
+# Type "make <diag>.png" to make a .png file from <diag>.m4
+# Type "make <diag>.tif" to make a .tif file from <diag>.m4
+# Type "make <diag>.svg" to make a .svg file from <diag>.m4
+# See also: the svg subdirectory for generating svg directly.
+#
+# To test the file test.m4, type "make tst" if boxdims is used, otherwise
+# type "make tst1". In either case the file tst.ps is created.
+#
+# To debug a single diagram in a directory other than this examples
+# directory, copy this makefile and tst.tex to where you want to work,
+# redefine LIBDIR (below) appropriately, and type "make <diag>.xxx"
+# where xxx is one of ps, eps, png, or pdf
+
+#########################################################################
+
+# Circuit_macro directory, change this if necessary:
+# LIBDIR = $$HOME/lib
+LIBDIR = ..
+
+# The dpic processor:
+PIC = dpic -p
+#PIC = $$HOME/dpic/bu*/p2c/ftp/dpic -p
+#PIC = /cygdrive/d/Dwight/dpic/p2c/Windows/dpic -p
+#PIC = dpic -1 -p
+#PIC = $$HOME/dpic/build/test/dpic -p
+#PIC = $$HOME/tmp/dpic -p
+
+CONFIGFILE = pstricks.m4
+
+# This is for testing the mingw version of dpic:
+#CUSTOM=windows.m4
+
+# Uncomment for gpic. Use gpic or pic as applicable on your machine:
+# PIC = gpic -t
+# PIC = pic -t
+# CONFIGFILE = gpic.m4
+
+# Convert options
+EPSOPTS =
+PNGOPTS = -density 400 -scale 25% -alpha Remove
+
+# M4 = m4 -B32000
+# M4 = m4 -I $(LIBDIR)
+# If environment variable M4PATH has been set to the installation directory:
+M4 = m4
+
+#########################################################################
+
+DOC = examples
+PICS = \
+ Adder.tex Alogix.tex ABlogix.tex AmpTable.tex Antennas.tex Audio.tex \
+ Bip.tex Btree.tex Byte.tex Buttons.tex \
+ CanLogic.tex CctTable.tex Conn.tex Counting.tex Crossbar.tex Crow.tex \
+ Csource.tex \
+ Decoder.tex Demultiplexer.tex Diodes.tex Drive.tex \
+ Emarrows.tex Flow.tex Fuses.tex Grounds.tex \
+ Headers.tex Heathkit.tex \
+ I2L.tex Incleps.tex Jack.tex \
+ Logic.tex Loglog.tex MC.tex Mixer.tex MotorControl.tex Multiplexer.tex \
+ NLG.tex NPDT.tex Nport.tex \
+ Opamp.tex Optoiso.tex Pconn.tex PushPull.tex \
+ Quantum.tex Rectifiers.tex Relay.tex Rotbox.tex \
+ Schottky.tex ShiftR.tex Sierpinski.tex Sixpole.tex Sources.tex SQUID.tex \
+ Switches.tex \
+ TTLnand.tex Tgate.tex Three.tex Timer.tex Ttree.tex \
+ Variable.tex Windings.tex Xform.tex \
+ control.tex csc.tex diamond.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 \
+ graysurf.tex lcct.tex pwrsupply.tex quick.tex \
+ random.tex recycle.tex rose.tex \
+ sfg.tex shapes.tex thyristor.tex ujt.tex worm.tex XOR.tex
+
+# From the doc directory:
+MANFIGS = AmpTable Antennas Audio Bip CctTable Conn Demultiplexer Diodes \
+ Emarrows Fuses \
+ Grounds Headers Jack Logic Multiplexer NLG NPDT Nport Opamp Pconn \
+ Relay ShiftR Sources Switches \
+ Tgate Variable Windings Xform fet quick thyristor ujt
+
+# Files that have to be processed twice:
+BOXDIMS = ex09 Crow Incleps Loglog Opamp random Ttree Windings
+
+DVIPSOPTS = -Ppdf -G0 -t letter
+M4LIBS = $(CONFIGFILE) $(CUSTOM)
+DIMFILE = $(DOC).dim
+BS = tr '|' '\134'
+
+# Might be needed (change latex commands to $(LTX) )
+# LTX = latex --shell-escape
+
+.SUFFIXES: .ps .dvi .tex .m4 .pic .eps .png .pdf .svg .tif .gif
+.dvi.ps:
+ dvips $(DVIPSOPTS) $* -o $*.ps
+ chmod 644 $*.ps
+.m4.tex:
+ @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi ; touch F_$*.dim
+ $(M4) $(M4LIBS) $(DIMFILE) F_$*.dim $*.m4 | sed -e '/^ *$$/d' > $*.pic
+ $(PIC) $*.pic > $*.tex
+# grep Production dpic.log >> newp.txt
+.m4.pic:
+ @if test -n "$(DIMFILE)" ; then touch $(DIMFILE) ; fi
+ $(M4) $(M4LIBS) $(DIMFILE) $*.m4 > $*.pic
+.m4.dvi:
+ make $*.tex
+ printf "|documentclass[11pt]{article}\n\
+|usepackage{times,pstricks,boxdims,graphicx,pst-grad,pst-slpe}\n\
+|usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}\n\
+|setlength{|textwidth}{28cm}|setlength{|textheight}{28cm}\n\
+|setlength{|oddsidemargin}{0pt}|setlength{|evensidemargin}{0pt}\n\
+|setlength{|hoffset}{-1cm}\n\
+|pagestyle{empty}|thispagestyle{empty}\n\
+|newbox|graph\n\
+|begin{document}\n\
+|noindent|input{"$*".tex}\n\
+|end{document}\n" | $(BS) > F_$*.tex
+ latex F_$*
+ touch F_$*.dim $(DIMFILE) ; rm -f $*.tex $*.pic ; make $*.tex
+ latex F_$*
+ touch F_$*.dim $(DIMFILE) ; rm -f $*.tex $*.pic ; make $*.tex
+ latex F_$*
+.m4.eps:
+ make $*.dvi
+ dvips -Ppdf F_$* -T128cm,28cm -o $*.ps
+# Recent changes to PSTricks(?) have clashed with the use of TeXtoEPS
+# so use ps2epsi
+ ps2epsi $*.ps $*.epsi
+ sed -e '/%%Pages:/d' -e '/BeginPreview/,$$d' $*.epsi \
+ | tr '\015' '\012' > $*.eps
+ sed -e '1,/EndPreview/d' $*.epsi >> $*.eps
+.m4.ps:
+ make $*.tex && mv $*.tex test.tex; latex tst
+ rm -f test.tex $*.pic
+ if test -f tst.dim ; then cp tst.dim F_$*.dim ; fi
+ make $*.tex && mv $*.tex test.tex; latex tst
+ dvips $(DVIPSOPTS) tst -o $*.ps
+ chmod 644 $*.ps
+.m4.svg:
+ make $*.eps
+ convert $(EPSOPTS) $*.eps $*.svg
+.m4.png:
+ make $*.eps
+ convert $(PNGOPTS) $*.eps $*.png
+ @if test -f $*.png.0 ; then mv $*.png.0 $*.png ; fi
+.m4.gif:
+ make $*.ps
+ convert $(GIFOPTS) $*.ps $*.gif
+# @if test -f $*.png.0 ; then mv $*.png.0 $*.png ; fi
+.m4.tif:
+ make $*.eps
+ convert $(EPSOPTS) $*.eps $*.tif
+ @if test -f $*.tif.0 ; then mv $*.tif.0 $*.tif ; fi
+.m4.pdf:
+ touch F_$*.dim
+ $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic
+ dpic -g $*.pic > test.tex
+ sed -e '/^\\usepackage.*graphicx/s/^.*$$/\\usepackage{tikz}/' \
+ -e '/pstricks/d' tst.tex > F_$*.tex
+ pdflatex F_$*
+ $(M4) pgf.m4 F_$*.dim $*.m4 > $*.pic
+ dpic -g $*.pic > test.tex
+ pdflatex F_$*
+ mv F_$*.pdf $*.pdf
+
+#########################################################################
+
+$(DOC).pdf: clean pdfmode $(DOC).frp
+ touch $(DOC).dim
+ for file in $(BOXDIMS) ; do \
+ rm -f $$file.tex $$file.pic ; \
+ make PIC="dpic -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim $${file}.tex ; \
+ done
+ pdflatex $(DOC)
+ for file in $(BOXDIMS) ; do \
+ rm -f $$file.tex $$file.pic ; \
+ make PIC="dpic -g" CONFIGFILE=pgf.m4 DIMFILE=$(DOC).dim $${file}.tex ; \
+ done
+ pdflatex $(DOC)
+
+$(DOC).ps: psmode $(DOC).dvi
+
+psmode:
+ printf "|usepackage{pstricks,pst-grad}\n" | $(BS) > mode.tex
+
+pdfmode:
+ printf "|usepackage{tikz}\n" | $(BS) > mode.tex
+
+doclinks:
+ -for nm in $(MANFIGS) ; do cp $(LIBDIR)/doc/$$nm.m4 . ; done
+ touch doclinks
+
+$(DOC).dvi: $(DOC).frs
+ touch $(DOC).dim
+ for file in $(BOXDIMS) ; do \
+ rm -f $$file.tex $$file.pic ; \
+ make PIC="$(PIC)" DIMFILE=$(DOC).dim $${file}.tex ; done
+ latex $(DOC)
+ for file in $(BOXDIMS) ; do \
+ rm -f $$file.tex $$file.pic ; \
+ make PIC="$(PIC)" DIMFILE=$(DOC).dim $${file}.tex ; done
+ latex $(DOC)
+
+$(DOC).frs: doclinks $(DOC).tex files.tex header.tex psmode
+ make $(PICS)
+ cp $(LIBDIR)/doc/Version.tex .
+ latex $(DOC)
+ touch $(DOC).frs
+ rm -f $(DOC).dvi
+
+$(DOC).frp: doclinks $(DOC).tex files.tex header.tex pdfmode
+ make CONFIGFILE=pgf.m4 PIC="dpic -g" $(PICS)
+ cp $(LIBDIR)/doc/Version.tex .
+ pdflatex $(DOC)
+ rm -f $(DOC).pdf
+ touch $(DOC).frp
+
+tst:
+ make test.tex; latex tst; rm -f test.tex test.pic
+ make DIMFILE=tst.dim test.tex; latex tst
+ dvips $(DVIPSOPTS) tst -o tst.ps
+
+tst1: test.tex tst.tex
+ latex tst
+ dvips $(DVIPSOPTS) tst -o tst.ps
+
+gtst:
+ touch test.m4; make PIC="gpic -t" CONFIGFILE="" tst
+
+gtst1:
+ touch test.m4; make PIC="gpic -t" CONFIGFILE="" tst1
+
+echopics:
+ @echo $(PICS)
+
+clobber: clean
+ rm -f *.ps
+ -@for dir in mf mpost pdflatex xfig psfrag pgf svg dev test; \
+ do (if test -d $$dir ; then cd $$dir; make clobber; fi) ; done
+ rm -f *.warn quick.m4
+ rm -rf index.html html basenames *.png* dist zips htmlfiles svgfiles
+ rm -rf $(TMP)/Cir* $(ECETMP)/Cir* $(ECEDIR)
+ if test -f Incl.pdf ; then \
+ mv Incl.pdf Incl.pdx; rm -f *.pdf; mv Incl.pdx Incl.pdf ; fi
+ for file in `ls *.tex` ; do \
+ nm=`echo $$file | sed -e "s/\(.*\)\.tex/\1/"` ; \
+ if test -s $$nm.m4 ; then rm -f $$nm.pic $$nm.tex ; fi ; done
+ @if test -f distmakefile ; then make -f distmakefile clobber ; fi
+
+clean:
+ @printf "\n examples clean:\n"
+ rm -f core examples.pdf boxdims.tar.gz
+ rm -f *.dvi *.aux *.log *.toc *.blg *.eps *.tif *.epsi eps *-mfpic*
+ rm -f fig*.tex $(PICS) *.roff *.int *.pic gpic.m4 test.tex xxx* *.fig
+ rm -f *.dim *.bak *.frs *.frp $(RPICS) rotate.ps tst.ps *.bbl *-pics.ps
+ rm -f *.tfm *[0-9]pk *.png *.1 *.gif
+ rm -f F_* Version.tex doclinks *stackdump *.ico quick.m4
+ for nm in $(MANFIGS) ; do rm -f $$nm.* ; done
+ 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/Mixer.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Mixer.m4
new file mode 100644
index 00000000000..32920a89cfe
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Mixer.m4
@@ -0,0 +1,102 @@
+.PS
+#`Mixer.m4
+# Showing VMOS mosfet and custom transformer'
+cct_init
+ifdpic(`
+define(`sftxt',`{\sf `$1'}')
+
+define(`dimen_',0.6)
+define(`elen_',0.75)
+
+define(`Xform21',
+ `[ L1: inductor(to rvec_(dimen_*0.5,0),L,,M)
+ Core1E: M4Core1.end; Core2E: M4Core2.end
+ D: (0.5 between M4Core1 and M4Core2) - L1
+ T: line to rvec_(dimen_/3,0); { dot(at T.c) }
+ L2: inductor(to rvec_(L1.len,0),L,,M)
+ line from M4Core1.start to Core1E
+ line from M4Core2.start to Core2E
+ L3: inductor(to rvec_(-L1.len,0) with .c at T+(D.x*2,D.y*2),L) ]')
+
+ del = dimen_/3
+ setdir_(U)
+T1: Xform21; "sftxt(T1)" at T1.n above rjust
+ dot(at T1.L3.start+(0,4bp__))
+ dot(at T1.L1.end+(4bp__,0))
+ dot(at T1.L2.end+(4bp__,0))
+ line from T1.L3.start left_ dimen_*2/3
+RF: dot(,,1); "sftxt(RF)" at RF.w rjust
+ line from T1.L3.end left_ del; corner; ground(,,F)
+
+ line down_ del/2 from T1.L1.start then right_ del
+ reversed(`capacitor',right_ dimen_,C); llabel(,\unit{0.1}{\micro\farad})
+BT: dot(at Here)
+ line up_ del/2 from T1.L2.end then right del
+ reversed(`capacitor',right_ dimen_,C); llabel(,\unit{0.1}{\micro\farad})
+ t = dimen_*7/8
+ line to (BT.x+4*t,Here.y)
+TT: dot
+ line right_ dimen_+del/2; setdir_(U)
+Q1: mosfet(,,dMESDQuB,E) with .G at Here
+ { "sftxt(Q1)" at Q1.Env.ne above ljust }
+ ground(at Q1.S,,F)
+ line right_ del*3/2 from Q1.D then down_ Q1.D.y-T1.L2.end.y
+T2: Xform21 with .L1.start at (Here,T1.L2.end); "sftxt(T2)" at T2.n above ljust
+ dot(at T2.L1.start+(-4bp__,0))
+ dot(at T2.L3.end+(0,4bp__))
+ line from T2.L3.end right_ dimen_*2/3
+IF: dot(,,1); "sftxt(IF)" at IF.e ljust
+ setdir_(U)
+Q2: mosfet(,,dMESDQuB,E) at (Q1,T2.s-(0,elen_-del))
+ { "sftxt(Q2)" at Q2.Env.ne above ljust }
+ line from Q2.D to (T2.L2.end,Q2.D) then to T2.L2.end
+ line from Q2.G left_ del/2 then up_ BT.y-Q2.G.y then to BT
+
+ line right_ del from T1.T then down_ T1.T.y-BT.y+del
+ corner; left_
+ capacitor(to (T1.L3.end-(del,0),Here),C)
+ rlabel(,\unit{0.1}{\micro\farad}\hskip20pt)
+LOD: dot
+ { line to (RF,Here); dot(,,1)
+ move left_ 4bp__; "sftxt(local)" rjust "sftxt(oscillator)" rjust
+ move left 40bp__ }
+ line from T2.T left_ to (Q1.S,T2.T)
+T2T: dot
+ { capacitor(down_ to (Here,BT),C); rlabel(,\unit{0.1}{\micro\farad})
+ ground(,T,F) }
+ { line from T2.L3.start right_ del; corner; ground(,,F) }
+Vt: dot(at (0.5 between BT and TT,Q1.Env.nw),,1)
+ { "sftxt($+$V$_{\hbox{\scriptsize CC}}$)" at last [].e ljust }
+ line to (Here,T2T) chop dotrad_ chop 0; dot
+ { line to (Here,BT); Cv: capacitor(down_ 3/2*dimen_,C)
+ llabel(\unit{10}{\micro\farad}); G: dot; ground(,,F) }
+
+ for s=-1 to 1 by 2 do {{
+ line right s*t; corner
+ resistor(down_ to (Here,BT))
+ if s<0 then { llabel(,\unit{5}{\kilo\ohm}) } \
+ else { rlabel(,\unit{5}{\kilo\ohm})
+ { dot(at last line.start); line to (TT,Here)
+ resistor(right_ to (T2T,Here))
+ llabel(,\unit{10}{\ohm}) } }
+ P: potentiometer(down_ Cv.len,,0.5,s*t ) with .Start at Here
+ if s<0 then { "sftxt(\unit{1}{\kilo\ohm})" at P. 1st [].ne ljust } \
+ else { "sftxt(\unit{1}{\kilo\ohm})" at P. 1st [].sw rjust }
+ dot(at P.End)
+ dot(at P.T1)
+ { L: inductor(up_ to (Here,BT),L);
+ if s<0 then { "sftxt(\unit{100}{\micro\henry})" at last [].sw rjust } \
+ else { line to TT
+ "sftxt(\unit{100}{\micro\henry})" \
+ at last [].ne ljust below } }
+ capacitor(down_ to (Here,G),C)
+ if s<0 then { rlabel(,\unit{0.1}{\micro\farad}) } \
+ else { llabel(,\unit{0.1}{\micro\farad}) }
+ dot }}
+
+ resistor(down_ from LOD to (LOD,G)); llabel(,\unit{51}{\ohm}); corner
+ line to (Q2.S,Here) then to Q2.S
+
+',
+`box wid 2*boxwid "Mixer cct" "requires dpic"')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/MosfetElements.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/MosfetElements.m4
new file mode 100644
index 00000000000..b8786e20e8b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/MosfetElements.m4
@@ -0,0 +1,78 @@
+.PS
+# MosfetElements.m4
+cct_init
+s_init(MosfetElements)
+
+ linewid = linewid*1.5
+ linethick = 1.5
+
+define(`mfgrid',
+ `tr_xy_init(,m4_U,m4R)define(`m4R',)
+ ltt = linethick; linethick = 0.4
+ m4gdim = ifelse(`$1',,4,`($1)')
+ iflatex(`latexcommand(\color{lightgray})')
+ for x=-m4gdim to m4gdim do {
+ line color "lightgray" from tr_xy(x,0) to tr_xy(x,2*m4gdim)
+ if pmod(x,2)==0 then { sprintf("{\tiny %g}",x) at last line.start below }}
+ for y=0 to 2*m4gdim do {
+ line color "lightgray" from tr_xy(-m4gdim,y) to tr_xy(m4gdim,y)
+ if pmod(y,2)==0 then { sprintf("{\tiny %g}",y) at last line.start rjust }}
+ linethick = ltt
+ iflatex(`latexcommand(\color{black})')
+ Grid: box invis wid 2*m4gdim*m4_xyU ht 2*m4gdim*m4_xyU \
+ with .sw at tr_xy(-m4gdim,0)
+')
+define(`gridnext',`with .Grid.w at last [].Grid.e + (m4_xyU*2,0)')
+define(`gridbelow',`with .Grid.nw at `$1'.Grid.sw+(0,-linewid/2)')
+define(`Gmosfet',`mfgrid; Q: mosfet(,,`$1') with .S at Grid.sw + (2*m4_xyU,0)')
+
+R1: [ Gmosfet(B); "B" at Q.Bl ljust ]
+ [ Gmosfet(D); "D" at Q.Dl ljust ] gridnext
+ [ Gmosfet(E); "E" at Q.Channel below ] gridnext
+ [ Gmosfet(F); "F" at Q.Channel below ] gridnext
+ [ Gmosfet(G); "G" at Q.Gl ljust ] gridnext
+ [ Gmosfet(H); "H" at Q.Hl ljust ] gridnext
+ [ Gmosfet(L); "L" at Q.Ll ] gridnext
+ [ Gmosfet(M); "M" at Q.Glh below ] gridnext
+
+R2:[ Gmosfet(uM); "uM" at Q.Gl ] gridbelow(R1)
+ [ Gmosfet(dM); "dM" at Q.Gl ] gridnext
+ [ Gmosfet(Pz); "Pz" at Grid.s ] gridnext
+ [ Gmosfet(Q); "Q" at Q.Ql above ] gridnext
+ [ Gmosfet(R); "R" at Q.Rl below ] gridnext
+ [ Gmosfet(S); "S" at Q.Sl ljust ] gridnext
+ [ Gmosfet(dT); "dT" at Q.Tl below ] gridnext
+ [ Gmosfet(X); "X" at Q.Xh above ] gridnext
+
+R3:[ Gmosfet(uM1)
+ "uM1" at Grid.s above
+ "G0" at Q.G0 above
+ "G1" at Q.G1 above ] gridbelow(R2)
+ [ Gmosfet(dM1)
+ "G0" at Q.G0 above
+ "G1" at Q.G1 above
+ "dM1" at Grid.s above ] gridnext
+
+# [ Q: mosfet
+# {"S" at Q.S rjust}
+# {"D" at Q.D ljust}
+# {"G" at Q.G rjust}
+# s_box(``mosfet'') at Q.s below]
+#
+# [ Q: mosfet(,,DSELuBQ)
+# s_box(``mosfet(,,DSELuBQ)'') at Q.s below] with .n at last [].s + (0,-0.2)
+#
+# [ Q: mosfet(,,DSEMuBQ)
+# s_box(``mosfet(,,DSEMuBQ)'') at Q.s below] with .n at last [].s + (0,-0.2)
+#
+# [ Q: mosfet(,,DSEdMuBQ)
+# s_box(``mosfet(,,DSEdMuBQ)'') at Q.s below] with .n at last [].s + (0,-0.2)
+#
+# [ Q: mosfet(right dimen_,,DSELuBQN)
+# {"S" at Q.S rjust}
+# {"D" at Q.D ljust}
+# {"G" at Q.G rjust}
+# s_box(``mosfet(right dimen\_,,DSELuBQN)'') at Q.s below] \
+# with .n at last [].s + (0,-0.2)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/MotorControl.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/MotorControl.m4
new file mode 100644
index 00000000000..38b81b26c94
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/MotorControl.m4
@@ -0,0 +1,57 @@
+.PS
+# MotorControl.m4
+cct_init
+
+ trad = 2.5*dotrad_
+define(`bigterminal',`circle rad trad')
+
+ mrad = linewid*2/3
+Motor: circle rad mrad "iflatex({\sf) Motor iflatex(})"
+
+ linethick = 2
+ T2: Motor.n+(0,dimen_/2)
+
+ for i=1 to 3 do {
+ if i==2 then { line from Motor.n to T2 } \
+ else { line from Motor right (i-2)*Motor.diam chop Motor.rad chop 0 \
+ then up T2.y-Motor.y }
+ bigterminal
+ cbreaker(up_ dimen_*3/4,,T)
+ bigterminal
+ line up_ dimen_
+ bigterminal
+ capacitor(up_ dimen_*1.2,,,dimen_/3,dimen_/6)
+ { circle fill_(1) rad dotrad_*3/2 thick 0.8 \
+ at 0.25 between last line.end and last line.start }
+ if i==1 then { L1: last circle } \
+ else { if i==2 then { L2: last circle }}
+ bigterminal
+ line up_ dimen_/4
+ }
+ linethick_(0.8)
+ C2: circle rad mrad/3 at Motor.n+ (0,dimen_*2)
+ line from C2.e right_ dimen_/3 then up C2.rad*1.5
+ line to (L1.x-dimen_/2,Here.y)
+ {S23: capacitor(up_ dimen_*2/3 from (L1.x-dimen_/2,Here.y),,,
+ dimen_/3,dimen_/6); dot(,,1) }
+ dot(,,1)
+ line to (L1.x-dimen_*2,Here.y) chop dotrad_ chop 0 then up dimen_/3
+ S1: [ bswitch(right_ dimen_/2) ] with .Bsw_T1.s at Here
+ S2: [ bswitch(right_ dimen_/2,,C) ] at S1+(0,-dimen_)
+ line right dimen_/6 down dimen_/6 from S1.Bsw_T2.se \
+ then down S1.Bsw_T2.se.y-S2.Bsw_T2.ne.y-dimen_/3 \
+ then to S2.Bsw_T2.ne
+ box wid S1.wid+dimen_/2 ht S1.n.y-S2.s.y+dimen_/3 \
+ at 0.5 between S1.s and S2.n
+ line left dimen_/2 from S23.end chop dotrad_ chop 0; corner
+ line to (Here,S1.Bsw_T2) then to S1.Bsw_T2.e
+ line from S2.Bsw_T1.w left dimen_/2; corner
+ line to (Here,L1) then to L1 chop 0 chop dotrad_
+
+ dot(at 0.5 between L1 and L2,,1)
+ { line to L2 chop dotrad_ }
+ S45: variable(`capacitor(down_ dimen_*2/3 chop dotrad_ chop 0,,,
+ dimen_/3,dimen_/6)',L,,dimen_/2); dot(,,1)
+ line to (Here,C2) then to C2.w chop dotrad_ chop 0
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/OpAmpFilter.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/OpAmpFilter.m4
new file mode 100644
index 00000000000..db1ce2778d7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/OpAmpFilter.m4
@@ -0,0 +1,72 @@
+.PS
+# OpAmpFilter.m4
+cct_init
+command "{\small\sf"
+
+divert(-1)
+divert(0)dnl
+
+ define(`SpecOpAmp',`$1: [ right_
+ lwtmp = linewid; linewid = 1*scale
+ H: opamp
+ "$2" at H.In1 below rjust
+ "$3" at H.In2 below rjust
+ "$4" at H.E below ljust
+ "V${-}$" at H.E1 below
+ line up_ dimen_/3 from H.E1 "4" rjust; dot(,,1)
+ "$\hbox{V}_{\hbox{CC}}$" above rjust at last [].n
+ "V${+}$" at H.E2 above
+ line down_ dimen_/3 from H.E2 "11" ljust; dot(,,1)
+ "${-}\hbox{V}_{\hbox{CC}}$" below ljust at last [].s
+ linewid = lwtmp
+ ifelse($1,U1,,`line left_ jog from H.In2 then down_ jog/2; zground ')
+ "$1" at H.S below ljust
+ In1: H.In1; In2: H.In2; Out: H.Out
+ D: dot(at Out)
+ V: circle diam 12bp__ "V" at Out+(dimen_/3,dimen_/3)
+ "V$_{\hbox{\scriptsize $5}}$" at V.n above
+ open_arrow(from V to D chop last circle.rad chop dotrad_) ] ')
+ define(`zground',`ground(`$1',,S); "0" at Here+(dimen_/6,-dimen_/2)')
+
+ cscale = 3/2
+ linewid = linewid*cscale
+ jog = dimen_*0.3
+ vstep = dimen_*5/4
+ SpecOpAmp(U1,2,3,1,hp)
+ R1: resistor(right_ elen_*3/4 from U1.Out); llabel(,"R1"); rlabel(,"1`\,'k")
+ dot; line right_ jog
+ SpecOpAmp(U2,5,6,7,bp) with .In1 at Here
+ R2: resistor(right_ elen_*3/4 from U2.Out); llabel(,"R2"); rlabel(,"1`\,'k")
+ dot; line right_ jog
+ SpecOpAmp(U3,9,10,8,lp) with .In1 at Here
+ SpecOpAmp(U4,13,12,14,n) with .Out at U3.Out+(0,-dimen_*3.0)
+ line up vstep from U4.Out
+ Rf: resistor(left_); rlabel(,R_f); llabel(,"1`\,'k")
+ line to (U4.In1,Here)-(jog,0) then to U4.In1-(jog,0); dot
+ line from U3.Out down_ vstep then left_ jog
+ RL: resistor; rlabel(,RL); llabel(,"100")
+ line to (U4.In1-(2*jog,0),Here) then to U4.In1-(2*jog,0); dot
+ line from U1.Out to (U1.Out,Here); right_
+ R42: resistor(to U4.In1); llabel(,"R42"); rlabel(,"1`\,'k")
+ line from U2.Out down_ vstep
+ R41: resistor(left_ to (U1.In2-(jog,0),Here))
+ llabel(,"2.2`\,'k"); rlabel(,"R41")
+ line to (Here,U1.In2); dot; { line to U1.In2 }
+ line left_ jog; dot
+ { resistor(down_ elen_); rlabel(,"R0" rjust "10`\,'k"); zground }
+ R3: resistor(left_ dimen_); rlabel(,"R3","in"); llabel(,"1`\,'k")
+ source(down_ elen_,AC); llabel("V$_{\hbox{\scriptsize in}\;}$"); zground
+ line up_ vstep from U1.Out
+ R5: resistor(left_ to (U1.In1-(jog,0),Here)); rlabel(,"R6\enskip 10`\,'k")
+ dot
+ line from U1.In1 left_ jog then to Here+(0,dimen_/2)
+ resistor(right_ to (U3.Out,Here)); llabel(,"R5"); rlabel(,"1`\,'k")
+ line to U3.Out; dot(at Here+(0,vstep))
+ capacitor(left_ to (U3.In1-(jog,0),Here)); rlabel(,"C2\enskip 100`\,'n")
+ line to (Here,U3.In1)
+ line from U2.Out up_ vstep
+ capacitor(left_ to (U2.In1-(jog,0),Here)); rlabel(,"C1\enskip 100`\,'n")
+ line to (Here,U2.In1)
+
+command "}%"
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Optoiso.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Optoiso.m4
new file mode 100644
index 00000000000..e0bc16d3bf0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Optoiso.m4
@@ -0,0 +1,63 @@
+.PS
+# Optoiso.m4
+cct_init
+movewid = 0.25
+
+# `optoiso([L|R][A|B|C])'
+define(`optoiso',`ifinstr(`$1',C,
+`[{ u = dimen_
+ hd = u/5
+ Q: bi_tr(up hd*4,ifinstr(`$1',R,R))
+ line from Q.E ifinstr(`$1',R,left,right)(hd+u/3); Pin4: dot(,,1)
+ line from Q.C to (Pin4,Q.C); Pin5: dot(,,1)
+ T: (Q.B,Pin5)+(0,4*hd)
+ line from Q.B to T then to (Pin5,T); Pin6: dot(,,1)
+ D: diode(from Pin6 +(ifinstr(`$1',R,+,-)(u/3+hd*8),0) down hd*4)
+ line from D.start ifinstr(`$1',R,right,left) (hd*2+u/3); Pin1: dot(,,1)
+ line from D.end to (Pin1,D.end); Pin2: dot(,,1)
+ line from (D.end,Pin4) to (Pin1,Pin4) chop hd chop 0; Pin3: dot(,,1)
+ B: box wid hd*10 ht hd*10 with .c at 0.5 between Pin4 and Pin1
+ arrow from B.c+(ifinstr(`$1',R,,-)hd*1.5,hd*1.5) to B.c chop 0 chop -0.7*hd
+ F: (ifinstr(`$1',R,,-)hd*0.5,-hd*0.5)
+ arrow from last arrow.start+(F.x,F.y) to last arrow.end+(F.x,F.y)
+ `$2' }]',
+`[{u = dimen_/2
+ Q: bi_trans(up u*2,ifinstr(`$1',R,R),ifinstr(`$1',B,B)CBUdE)
+ E: Q.E; C: Q.C; A:ifinstr(`$1',R,Q.e+(u*3/2,u),Q.w+(-u*3/2,u)); K: A-(0,u*2)
+ ifinstr(`$1',B,line from Q.B to (Q.B,E); B: Here)
+ D: diode(from A to K)
+ arrow from D.c+(0,u/6) to Q.ifinstr(`$1',R,e,w)+(0,u/6) chop u/3 chop u/4
+ arrow from last arrow.start-(0,u/3) to last arrow.end-(0,u/3)
+ Enc: box rad u wid abs(C.x-A.x)+u*2 ht u*2 with .c at 0.5 between C and K
+ `$2' }]')')
+
+define(`optlabels',
+ `{"\sl C" ht 0.1 at last [].C above
+ "\sl E" at last [].E below
+ ifinstr(`$1',B,`"\sl B" at last [].B below')
+ "\sl A" at last [].A above
+ "\sl K" at last [].K below}')
+
+Q: optoiso; optlabels; move
+ {`"\tt optoiso"' at last [].s+(0,-0.22)}
+ optoiso(Rightorientation); optlabels; move
+ {`"\tt optoiso(R)"' at last [].s+(0,-0.22)}
+ optoiso(B); optlabels(B); move
+ {`"\tt optoiso(B)"' at last [].s+(0,-0.22)}
+ optoiso(RB); optlabels(B)
+ {`"\tt optoiso(RB)"' at last [].s+(0,-0.22)}
+
+R: optoiso(C) with .nw at Q.sw+(0.33,-0.75); move 1
+{"\sl 1" at R.Pin1 rjust; "\sl 2" at R.Pin2 rjust
+ "\sl 3" wid 0.3 at R.Pin3 rjust}
+{"\sl 4" at R.Pin4 ljust; "\sl 5" at R.Pin5 ljust
+ "\sl 6" at R.Pin6 ljust }
+{`"\tt optoiso(C)"' at R.s below }
+S: optoiso(RC)
+{"\sl 1" at S.Pin1 ljust; "\sl 2" at S.Pin2 ljust
+ "\sl 3" at S.Pin3 ljust }
+{"\sl 4" at S.Pin4 rjust; "\sl 5" at S.Pin5 rjust
+ "\sl 6" wid 0.3 at S.Pin6 rjust }
+{`"\tt optoiso(RC)"' at S.s below }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Orbits.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Orbits.m4
new file mode 100644
index 00000000000..c49bacbc7ca
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Orbits.m4
@@ -0,0 +1,74 @@
+.PS
+# Orbits.m4
+threeD_init
+NeedDpicTools
+
+ crad = 1.0
+ g = 0.65
+
+# `orbitpos(long,lat,rad,ang)'
+define(`orbitpos',
+ `rot3Dx((`$2')*dtor_,rot3Dz((`$1')*dtor_,rot3Dy(-(`$4')*dtor_,`$3',0,0)))')
+
+define(`PO',`B.C+(project(orbitpos(orbitlong,orbitlat,orbitrad,`$1')))')
+
+define vis { X: PO($1)
+ if (distance(X,B.C)>crad) || \
+ (dot3D(View3D,orbitpos(orbitlong,orbitlat,orbitrad,$1))>0) \
+ then {$2 = 1} else {$2 = -1} }
+
+# `orbit(long,lat,rad)'
+define(`orbit',
+ `[da = 3
+ orbitlong = `$1'
+ orbitlat = `$2'
+ orbitrad = `$3'
+ define(`decorated',`ifelse(`$4',,,`outlined `$4'')')
+ arrow from PO(0) to PO(da*3) decorated
+ n=0
+ P[n]: PO(0)
+ vis(0,v)
+ for d=da to 360 by da do {
+ vis(d,x)
+ if x*v < 0 then {
+ findroot(vis,d-da,d,1e-6,x)
+ n+=1; P[n]: PO(x)
+ if v < 0 then { fitcurve(P,n,dashed decorated) } \
+ else { fitcurve(P,n,decorated) }
+ P[0]: P[n]
+ n = 0; v = -v }
+ n +=1; P[n]: PO(d)
+ }
+ if v < 0 then { fitcurve(P,n,dashed decorated) } \
+ else { fitcurve(P,n,decorated) }
+ ] with .c at B.C')
+
+# ball(rad,highlight rad,highlight degrees)
+define(`ball',`[
+ lt = linethick bp__
+ C: circle invis rad `$1' at (0,0)
+ D: C+(Rect_(`$2',`$3'))
+ rm = `$1'+distance(C,D)
+ a = 1 # fade rate parameter
+ for r=lt to rm by lt do {
+ u = 1-(r/rm*(a*r/rm+(1-a)))
+ if r < (1-g)*`$1' then { circle outlined rgbstring(u,u,u) rad r at D } \
+ else { arc cw outlined rgbstring(u,u,u) from Cintersect(D,r,C,`$1') \
+ to Cintersect(D,r,C,`$1',R) with .c at D
+ }
+ }
+ circle rad C.rad at C
+ ]')
+
+ linethick = 0.8
+ B: ball(crad,crad*g,110)
+
+ azimuth = 0
+ elevation = 0
+ setview(azimuth,elevation)
+
+ orbit(10, 30,crad*1.3,"red")
+ orbit(10,-30,crad*1.3,"blue")
+ orbit(10,-90,crad*1.3,"cyan")
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/PPA.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/PPA.m4
new file mode 100644
index 00000000000..8d25901310d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/PPA.m4
@@ -0,0 +1,40 @@
+.PS
+# `PPA.m4 Push-pull amplifier'
+cct_init
+
+Vs: source(up_ elen_,"$V_S$")
+ line right elen_/2
+T1: transformer(down_ elen_,,,W,10) with .P1 at Here
+ { dot(at T1.TP+(-dimen_/8,dimen_/3)) }
+ { dot(at T1.TS+(dimen_/8,dimen_*2/3))}
+ { dot(at T1.TS+(dimen_/8,-dimen_/8)) }
+ line from T1.P2 to Vs.start
+
+ line up_ dimen_*3/4 from T1.S1 then right_ dimen_*3/4
+ up_
+Q1: bi_tr(,L,,E) with .B at Here
+ line down_ dimen_*3/4 from T1.S2 then right_ dimen_*3/4
+ down_
+Q2: bi_tr(,R,,E) with .B at Here
+ line from Q1.E to Q2.E
+R2: resistor(left_ dimen_ from last line); llabel(,R_2)
+ dot; {dot(at R2.start) }
+ line to T1.TS
+ line down_ dimen_/2 right_ dimen_/2 from R2.start
+ ground
+
+ line right_ dimen_/6 from R2.start
+Vcc: battery(right_ elen_,2); rlabel(,V_{cc})
+ dot
+ line up dimen_*2/3 then to (R2.start.x,Here.y+dimen_*2/3)
+ resistor(to (R2.end,Here)); rlabel(,R_1); line to R2.end
+ line right_ dimen_/2 from Vcc.end
+T2: transformer(up_ elen_,,,W,10) with .TS at Here
+ line from T2.S2 to (T2.S2,Q1.C) then to Q1.C
+ line from T2.S1 to (T2.S1,Q2.C) then to Q2.C
+
+ line right elen_/2 from T2.P2
+ resistor(down_ to (Here,T2.P1)); llabel(,R_L)
+ line to T2.P1
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/PushPull.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/PushPull.m4
new file mode 100644
index 00000000000..f0711033072
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/PushPull.m4
@@ -0,0 +1,107 @@
+.PS
+# `PushPull.m4'
+cct_init
+iflatex(`ifpsfrag(,`latexcommand({\sf)') ')
+
+linewid = 1.2*linewid
+
+# Transformer as for Mixer.m4
+define(`Xform21',
+ `[ L1: inductor(to rvec_(dimen_*0.5,0),,,M)
+ Core1E: M4Core1.end; Core2E: M4Core2.end
+ D: (0.5 between M4Core1 and M4Core2) - L1
+ T: line to rvec_(dimen_/3,0); { dot(at T.c) }
+ L2: inductor(to rvec_(L1.len,0),,,M)
+ line from M4Core1.start to Core1E
+ line from M4Core2.start to Core2E
+ L3: inductor(to rvec_(-L1.len,0) with .c at T+(D.x*2,D.y*2),) ]')
+
+ del = dimen_/3
+ up_
+ T1: Xform21
+ line left_ del from T1.L3.end; corner; ground(,,F)
+ line left_ 2*del from T1.L3.start
+ In: dot(,,1); { "RF" wid 12bp__ at In.n above }
+ up_
+ Q1: mosfet(,,dBSDFQM1,E) with .G0 at T1.T+(2*dimen_+del/2,dimen_)
+ { "3N200" at last [].n above }
+ line from T1.L2.end to (T1.L2.end,Q1.G0) then to Q1.G0
+ Q2: mosfet(,,dBSDFQM1,E) with .G0 at (Q1.G0.x,T1.T.y-dimen_)
+ { "3N200" at last [].n above }
+ line from T1.L1.start to (T1.L1.start,Q2.G0) then to Q2.G0
+
+ resistor(right_ dimen_ from T1.T); llabel(,\unit{330}{\ohm}); Tx:dot
+ { line right_ del*3/2; corner; ground(,,F) }
+ dot(at (Tx,Q1.G0))
+ capacitor(down_ to Tx,C); llabel(\unit{5.6}{\pico\farad})
+ dot(at (Tx,Q2.G0))
+ capacitor(up_ to Tx,C); rlabel(\unit{5.6}{\pico\farad})
+
+ for_(1,2,1,
+ `dot(at Q`'m4x.S+(dimen_+del/2,0))
+ { resistor(down_ dimen_); G1:Here; { "$120$" at last [].nw rjust }
+ rlabel(,\ohm); dot; ground(,,F) }
+ line from Q`'m4x.S to (Here.x+dimen_*3/4,Q`'m4x.S.y); corner
+ capacitor(down_ to (Here,G1),C); rlabel(\raisebox{2pt}{1000},{\pico\farad});
+ corner
+ line left_ 2*dimen_*3/4; corner
+ TG: dot(at (Here,Q`'m4x.S))
+ capacitor(down_ to (Here,G1),C); rlabel(,,\unit{0.01}{\micro\farad})
+ ')
+
+ R: dot(at (Here.x+dimen_*2,(Q1.D.y+Q2.D.y)/2))
+ dot(at (R,Q1.D)); capacitor(down_ to R,C); llabel(\unit{20}{\pico\farad})
+ dot(at (R,Q2.D)); capacitor(up_ to R,C); llabel(\unit{20}{\pico\farad})
+ line right_ del*3/2 from R then down_ R.y-(Q1.S.y-dimen_); ground(,,F)
+
+ Vc: dot(at (R+(dimen_,0),Q1.ne),,1); { "$+V_{\hbox{c}}$" rjust at Vc.w }
+ dot(at (Vc,R))
+ inductor(right_ dimen_,); llabel(,\unit{1}{\micro\henry})
+ down_
+ T2: Xform21 with .T at Here
+ arrow from T2.L2 to T2.L3 chop -dimen_/4
+ line right_ del from T2.L3.start; corner
+ capacitor(down_ dimen_,C); llabel(\unit{1000}{\pico\farad}); ground(,T,F)
+ line right_ 2*del from T2.L3.end
+ Out: dot(,,1); { "IF" wid 12bp__ at Out.n above }; move right_ 0.3
+
+ line from T2.L1.start to (T2.L1,Q1.D) then to Q1.D
+ line from T2.L2.end to (T2.L2.end,Q2.D) then to Q2.D
+
+ line from Vc to (Vc,Q2.S) chop dotrad_/2 chop 0; dot
+ { line right_ del*2; corner
+ capacitor(down_ dimen_,C); llabel(,,\unit{1000}{\pico\farad}); ground(,,F) }
+ reversed(`inductor',down_ dimen_,); rlabel(,\unit{1}{\micro\henry})
+ line down_ dimen_/2
+
+ TL: dot(at (Q1.G1.x-del/2,Here.y))
+ up_
+ Q3: bi_tr(,R,,E) with .C at (TG.x,TL.y-dimen_*2/3)
+ resistor(right_ from TL to (Q3.C,TL)); llabel(,\unit{82}{\kilo\ohm})
+ line to (Vc,Here); dot
+ resistor(down_ to (Here,Q3.B)); rlabel(,\unit{8.2}{\kilo\ohm}); dot
+ dot(at Q3.B+(del,0))
+ line up_ (TL.y+Q3.C.y)/2 - Here.y+del/4 then left_ Here.x-TL.x
+ reversed(`capacitor',left_ dimen_,C); llabel(,\unit{1500}{\pico\farad})
+ Osc: dot(,,1); { "Osc" above at Osc.n }
+
+ line from Q3.B to (Vc,Q3.B)
+ line from Q3.C to (Q3.C,TL); dot
+ dot(at Q3.C+(0,del/2))
+ capacitor(left_ to (TL,Here),C); llabel(,\unit{1500}{\pico\farad}); dot
+ line down_ del/2 from Q3.E; dot
+ { resistor(down_ dimen_*3/4); rlabel(,\unit{820}{\ohm})
+ G: Here; ground(,T,F) }
+ line right_ dimen_; corner
+ capacitor(down_ to (Here,G),C); llabel(,\unit{1000}{\pico\farad})
+ ground(,T,F)
+ ground(at (TL,G),T,F)
+ resistor(up_ dimen_); llabel(,\unit{12}{\kilo\ohm})
+ line to (Here,Q1.G1) then to Q1.G1
+ line from Q2.G1 to (TL,Q2.G1); dot
+
+ ground(at (Vc,G),T,F)
+ resistor(up_ dimen_); rlabel(,\unit{5.6}{\kilo\ohm}); line to (Here,Q3.B)
+
+iflatex(`ifpsfrag(,`latexcommand(})')')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Quantum.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Quantum.m4
new file mode 100644
index 00000000000..9de7aeddab2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Quantum.m4
@@ -0,0 +1,31 @@
+.PS
+# Quantum.m4
+gen_init
+
+ boxht = 0.35
+ boxwid = boxht
+ define(`dotrad_',boxht/5)
+
+define(`Bus',`line right_ 10*boxwid `$1'
+ circle diam boxht `$2' at last line.start
+ box fill_(1) "H" at last line.start+(boxwid*3/2,0)
+ box fill_(1) "H" at last line.end-(boxwid*2.5,0) ')
+
+define(`Meter',`[ Box: box wid boxwid*3/2 fill_(1)
+ r = Box.wid/3
+ C: 0.3 between Box.s and Box.n
+ arc cw from C+(-r,0) to C+(r,0) with .c at C
+ arrow from C+(-r/4,0) to C+(0.9*r,0.9*r) ]')
+
+X: Bus(,shaded rgbstring(0.5,0.5,1) "X")
+A1: Bus(from X.start+(0,-boxht*3/2), shaded "red" "A")
+A2: Bus(from 2 between X.start and A1.start,shaded "red" "A")
+ dot(at X.start+(3*boxwid,0))
+ line to (Here,A2); dot
+ circle rad dotrad_ at A1.start+(4*boxwid,0)
+ line from last circle.s to (last circle,X); dot
+ Meter with .e at X.end
+ box wid boxwid*1.2 ht boxht*1.2 fill_(1) "$R_{\psi}^{\pi/2}$" \
+ at A2.end-(4.5*boxwid,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/README-examples b/Master/texmf-dist/doc/latex/circuit-macros/examples/README-examples
new file mode 100644
index 00000000000..7585e3dc77c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/README-examples
@@ -0,0 +1,58 @@
+
+This directory contains examples.tex, source files for the diagrams
+that are imported when examples.tex is LaTeXed, and some other standalone
+diagrams. To generate examples.pdf in a unix-like environment (versions
+of unix, linux, cygwin, djgpp, ...):
+
+1. Install the libraries as described in the top-level README file.
+2. In this directory, type "make". If your installed dpic is the
+ Mingw version included in the dpic distribution, (a) edit the
+ file windows.m4 to point to your installation folder, and (b) uncomment
+ the CUSTOM= line in the Makefile, or type "make CUSTOM=windows.m4".
+
+To test one of the diagrams, say ex01.m4, type one of the following
+(and have a look at the comments at the top of the Makefile):
+"make ex01.ps"
+"make ex01.eps"
+"make ex01.pdf" (uses pdflatex)
+"make ex01.png" (requires Imagemagick convert)
+"make ex01.tif" (requires Imagemagick convert)
+"make ex01.svg" (requires Imagemagick convert, but see the svg folder)
+
+IN CASE OF DIFFICULTY: Look at files debug1.tex and debug2.m4, and
+follow the instructions.
+
+To test and debug a single diagram, write it into test.m4. Type
+"make tst" to process the file, creating test.tex, which is imported into
+tst.tex. The diagram source and tst.tex are processed twice in case
+the boxdim macro is being used. If you only need to process once, type
+"make tst1". In both cases the resulting file is tst.ps.
+To use tikz and pdflatex to produce test.pdf, type "make test.pdf" as above.
+
+To test and debug a single diagram in a different directory, copy Makefile
+and tst.tex to where you want to work, adjust the definition of LIBDIR
+in Makefile if environment variable M4PATH has not been defined, and type
+one of the above commands.
+
+By default, the dpic processor is invoked, producing TiKz commands.
+To use PSTricks instead, type "make clean; make examples.ps".
+To process the diagrams using TikZ PGF for processing either by LaTeX or
+PDFlatex, type "make" or "make examplespgf.ps" in the pgf subdirectory.
+
+There are often several methods of producing similar graphical results,
+particularly of text labels. Some of the diagrams in this directory are
+slightly more complicated than required for Tikz or PSTricks in order
+that they will work with other postprocessors. Dpic output that does
+not handle LaTeX labels has to be treated separately as, for example,
+in the svg directory.
+
+To process the diagrams using .eps intermediate files with embedded psfrag
+strings, go into the psfrag directory and read the README file.
+
+To process the diagrams using MetaPost, look in the mpost subdirectory.
+
+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.
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Rectifiers.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Rectifiers.m4
new file mode 100644
index 00000000000..e24315d0fd2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Rectifiers.m4
@@ -0,0 +1,186 @@
+.PS
+# Rectifiers.m4
+cct_init
+
+ tmax = 3.5
+ period = tmax/1.75
+ eamp = 0.5
+ omega = twopi_/period
+ ed = eamp/6
+ r = 0.95
+
+# For DC voltages
+ ted = asin(ed/eamp)/twopi_*period
+ npts = 40; sum = 0
+ for i=0 to npts do {
+ t = ted+(period/2-2*ted)*i/npts
+ sum += (eamp*cos(omega*t-pi_/2) - ed)*r }
+
+define(`Sine',`Cosine(eamp,omega,`$1',-pi_/2)')
+define(`axis',`line thick 0.4 right tmax chop -tmax*0.04 chop 0')
+
+Threephase: [ linethick_(1)
+ Ai: axis ; "$N_o$" ljust
+ EOrig: Ai.start+(tmax*0.04,0)
+ E1: sinusoid(eamp,omega,-pi_/2,-ted,tmax) with .Origin at EOrig
+ E2: sinusoid(eamp,omega,-pi_/2-twopi_/3,-ted,tmax) with .Origin at EOrig
+ E3: sinusoid(eamp,omega,-pi_/2+twopi_/3,-ted,tmax) with .Origin at EOrig
+ "$e_1$" at EOrig+(period/3,eamp*0.8) ljust above
+ "$e_2$" at EOrig+(2*period/3,eamp*0.8) ljust above
+ "$e_3$" at EOrig+(period,eamp*0.8) ljust above
+
+ Ad: axis with .end at Ai.end+(0,-eamp*2.1); "$N_o$" ljust
+ DOrig: Ad.start+(tmax*0.04,0)
+ Id: axis with .end at Ad.end+(0,-eamp*1.2); "${}0$" ljust
+ IOrig: Id.start+(tmax*0.04,0)
+
+ for i=1 to 11 by 2 do {
+ tl = max(0,period/2-i*period/6)
+ tr = min(period/2,tmax-(i*period/6-period/2))
+ sinusoid(eamp,omega,-pi_/2,tl,tr,thick 0.4 dashed) \
+ with .Origin at DOrig+(i*period/6-period/2,0)
+ tl = max(period/12,-(i*period/6-period/2+period/12) )
+ tr = period/2-period/12
+ S1: sinusoid(eamp*r,omega,-pi_/2,tl,tr) \
+ with .Origin at DOrig+(i*period/6-period/2,0)+(0,-ed*r); round(at S1.End)
+ S2: sinusoid(eamp*r,omega,-pi_/2,tl,tr) \
+ with .Origin at IOrig+(i*period/6-period/2,0)+(0,-ed*r); round(at S2.End)
+ }
+ "$e_1$" at DOrig+(period/3,eamp*0.8) ljust above
+ "$e_2$" at DOrig+(2*period/3,eamp*0.8) ljust above
+ "$e_3$" at DOrig+(period,eamp*0.8) ljust above
+
+ "$e_L$" at DOrig+(period/4,eamp*0.8) below
+ "$i_L$" at IOrig+(period/6,eamp*0.6) rjust above
+
+ vEd = r*eamp*cos(pi_/12)/(5*pi_/12) - r*ed
+ VEd: axis with .end at Ad.end+(0,vEd); "$E_D$" ljust
+ IEd: axis with .end at Id.end+(0,vEd); "$I_D$" ljust
+ ]
+
+Cct3:[
+ No: dot; {"$N_o$" below rjust }
+ { inductor(to Here+(Rect_(dimen_,60)),W); E2: "$e_2$" ljust }
+ { inductor(to Here+(Rect_(dimen_,-60)),W); E3: "$e_3$" ljust }
+ { inductor(from No-(dimen_,0) to No,W); E1: "$e_1$" above at last line.start }
+ D3: diode(down_ from E3); b_current(i_3,rjust); llabel(,,D_3)
+ line from E1 to (E1,D3.start)
+ D1: diode(down_); b_current(i_1,rjust); llabel(,,D_1)
+ line from E2 left E2.x-E1.x+dimen_/3 then down E2.y-E3.y \
+ then to 0.5 between D1.start and D3.start
+ D2: diode(down_); b_current(i_2,rjust); llabel(,,D_2)
+ { line from D1.end to D3.end }
+ dot
+ arrowline(down elen_/2); rlabel(,i_L)
+ resistor(right_ elen_); rlabel(+,e_L,-); llabel(,R)
+ line to (Here,No) then to No
+ ] with .e at Threephase.w-(0.5,0)
+
+Fullwave: [
+ linethick_(1)
+ Ai: axis ; "$N_o$" ljust
+ EOrig: Ai.start+(tmax*0.05,0)
+ E1: sinusoid(eamp,omega,-pi_/2,-ted,tmax) with .Origin at EOrig
+ "$e_1$" at EOrig+(period/3,eamp*0.8) ljust above
+ E2: sinusoid(eamp,omega, pi_/2,-ted,tmax) with .Origin at EOrig
+ "$e_2$" at EOrig+(period*5/6,eamp*0.8) ljust above
+
+ Ad: axis with .end at Ai.end+(0,-eamp*2.1); "$N_o$" ljust
+ DOrig: Ad.start+(tmax*0.05,0)
+ Id: axis with .end at Ad.end+(0,-eamp*1.2); "${}0$" ljust
+ IOrig: Id.start+(tmax*0.05,0)
+
+ for i=0 to 3 do {
+ if i<3 then { tf = period/2 } else { tf = Ad.end.x-(DOrig.x+3*period/2) }
+ sinusoid(eamp,omega,-pi_/2,0,tf,thick 0.4 dashed) \
+ with .Origin at DOrig+(i*period/2,0)
+ line from DOrig+(i*period/2-ted,0) right 2*ted
+ line from IOrig+(i*period/2-ted,0) right 2*ted
+ if i<3 then {tf = period/2-ted } else {tf = Ad.end.x-(DOrig.x+3*period/2) }
+ Ed: sinusoid(eamp*r,omega,-pi_/2,ted,tf) \
+ with .Origin at DOrig+(i*period/2,-ed*r)
+ Ed: sinusoid(eamp*r,omega,-pi_/2,ted,tf) \
+ with .Origin at IOrig+(i*period/2,-ed*r)
+ }
+ "$e_1$" at DOrig+(period/6,eamp*0.9) rjust above
+ "$e_2$" at DOrig+(period/6+period/2,eamp*0.9) rjust above
+ "$e_L$" at DOrig+(period/4,eamp*0.8) below
+ "$i_L$" at IOrig+(period/6,eamp*0.6) rjust above
+
+ vEd = sum/(period/2/(period/2-2*ted)*npts)
+ VEd: axis with .end at Ad.end+(0,vEd); "$E_D$" ljust
+ IEd: axis with .end at Id.end+(0,vEd); "$I_D$" ljust
+ ] with .sw at Threephase.nw+(0,0.5)
+
+Cct2:[
+ T: transformer(right_ elen_,R,8,AW,8)
+ line up elen_/2 from T.P1
+ gap(right_ elen_)
+ { sinusoid(0.08,omega*8,-pi_/2,0,twopi_/(omega*8)) with .c at last [] }
+ line to T.P2
+ line from T.S1 to (T.P1,T.S1) then down elen_/2
+ D1: diode(down_ elen_*3/4); rlabel(,D_1)
+ line from T.S2 to (T.P2,T.S2) then to (T.P2,D1.start)
+ D2: diode(down_ elen_*3/4); rlabel(,D_2)
+ corner; line to D1.end; corner
+ dot(at 0.5 between D1.end and D2.end)
+ arrowline(down elen_/2); rlabel(,i_L)
+ resistor(right_ elen_); rlabel(+,e_L,-); llabel(,R)
+ line to (Here,T.TS)-(0,elen_/2) then left Here.x-T.TS.x then to T.TS
+ {"$N_o$" at T.TS-(0,elen_/2) below }
+ thinlines_
+ move to T.TS-(0,0.1)
+ { arrow to (T.P1,Here) chop 0.05 "$e_1$" below }
+ { arrow to (T.P2,Here) chop 0.05 "$e_2$" below }
+ linethick_(1)
+ ] at (Cct3,Fullwave)
+
+Halfwave: [
+ linethick = 1
+ Ai: axis ; "$N_o$" ljust
+ EOrig: Ai.start+(tmax*0.05,0)
+ Ei: sinusoid(eamp,omega,-pi_/2,0,tmax) with .Origin at EOrig
+ "$e_i$" at EOrig+(period/3,eamp*0.8) ljust above
+
+ Ad: axis with .end at Ai.end+(0,-eamp*1.75); "$N_o$" ljust
+ DOrig: Ad.start+(tmax*0.05,0)
+ sinusoid(eamp,omega,-pi_/2,0,period/2,thick 0.4 dashed) with .Origin at DOrig
+ sinusoid(eamp,omega,-pi_/2,0,period/2,thick 0.4 dashed) \
+ with .Origin at DOrig+(period,0)
+ "$e_i$" at DOrig+(period/5,eamp*0.9) rjust above
+
+ line from Ad.start to DOrig+(ted,0)
+ Ed: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \
+ with .Origin at DOrig+(0,-ed*r)
+ "$e_L$" at DOrig+(period/3,eamp*0.6) below
+ line from Ed.End right period/2+2*ted
+ Ed2: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \
+ with .Origin at DOrig+(period,-ed*r)
+ line from Ed2.End to Ad.end
+
+ vEd = sum/(period/(period/2-2*ted)*npts)
+ VEd: axis with .end at Ad.end+(0,vEd); "$E_D$" ljust above
+
+ Id: axis with .end at Ad.end+(0,-eamp*1.0); "${}0$" ljust
+ IOrig: Id.start+(tmax*0.05,0)
+ line from Id.start to IOrig+(ted,0)
+ Sd: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \
+ with .Origin at IOrig+(0,-ed*r)
+ "$i_L$" at IOrig+(period/3,eamp*0.7) above
+ line from Sd.End right period/2+2*ted
+ Sd2: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \
+ with .Origin at IOrig+(period,-ed*r)
+ line from Sd2.End to Id.end
+ IEd: axis with .end at Id.end+(0,vEd); "$I_D$" ljust above
+ ] with .sw at Fullwave.nw+(0,0.5)
+
+Cct1:[ diode(down_ elen_); b_current(i_L,rjust,O,E); rlabel(D)
+ resistor(right_ elen_); rlabel(+,e_L,-); llabel(,R)
+ line up elen_
+ { "$N_o$" ljust below }
+ gap(left_ elen_); rlabel(-,e_i,+)
+ ] at (Cct3,Halfwave)
+
+
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Resolver.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Resolver.m4
new file mode 100644
index 00000000000..b6ca93047a7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Resolver.m4
@@ -0,0 +1,49 @@
+.PS
+# `Resolver.m4'
+cct_init
+s_init(tst)
+sinclude(tst.dim)
+
+iflatex(`latexcommand({\scriptsize\sf)')
+
+[
+linewid = linewid*1.25
+define(`dotrad_',dotrad_/2)
+
+ T1: transformer(down_ dimen_/2)
+ line left from T1.P1; dot; move left 15bp__ "RH"
+ line left from T1.P2; dot; "RL" rjust
+ "Rotor ($r$)" at T1.TP rjust
+ line right_ dimen_*3/4 from T1.S2
+ C: Here
+ phi = 35
+ move right_ 0.1 from T1.S1; move from C to C+(Rect_(0.1,90+phi))
+ Q: Intersect_(last move,2nd last move)
+ Lr: inductor(from Q to C)
+ S1: line from T1.S1 to Q
+ A: C+(Rect_(dimen_*0.9,90+phi))
+ thinlines_
+ line dashed from Q to A chop 2bp__ chop 0
+ "Rotor shaft" at last line.end rjust "angle" rjust "" rjust
+ line dashed from C up_ dimen_*0.9 chop 2bp__ chop 0
+ arcd(C,dimen_*0.85,90,90+phi) ->
+ thicklines_
+ f_box($\phi$) at C+(Rect_(dimen_*0.85,90+phi/2))
+
+ d = distance(T1.P1,T1.P2)
+ Ls: inductor(up_ d from C+(d/2,0))
+ line right_ from Ls.end
+ D2: dot; "S2" ljust
+ line from Ls.start to (D2,Ls.start); dot; "S4" ljust
+ "$Kr\cos(\phi)$" at 0.5 between last "" and 2nd last ""
+ Lq: inductor(right_ d at (Lr,(C+(0,-d/3))))
+ line from Lq.end down_ d/4
+ K: Here; corner; line to (D2,K); dot; "S3" ljust
+ line from Lq.start down_ d*5/4
+ L: Here; corner; line to (D2,L); dot; "S1" ljust
+ "$Kr\sin(\phi)$" at 0.5 between last "" and 2nd last ""
+]
+"Resolver essentials" at last [].s below
+
+iflatex(`latexcommand(})')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Rotbox.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Rotbox.m4
new file mode 100644
index 00000000000..6a224190952
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Rotbox.m4
@@ -0,0 +1,17 @@
+.PS
+# Rotbox.m4
+gen_init
+
+ Point_(-10)
+ rotbox(boxwid/2,,thick 2)
+ Point_(30)
+ rotbox(,,shaded "green" outlined "blue",r=0.1) at last []+vec_(boxwid,0)
+ "r=0.1" at last []
+ move to last [].ne
+ Point_(0)
+ [ for_(2,8,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0)
+ sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].ne+(0.1,0)
+ [ for_(10,16,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0)
+ sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].sw+(0,-0.1)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/SPM.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/SPM.m4
new file mode 100644
index 00000000000..0b3fdb642c4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/SPM.m4
@@ -0,0 +1,59 @@
+.PS
+# `SPM.m4 Salient-pole machine'
+gen_init
+
+ outerrad = 1
+ medrad = 11/16
+ windings = 6
+ polewid = 3/8
+ twid = (outerrad-medrad)/3
+ srad = twid/4
+ halfline = ifgpic(0,linethick/2 pt__)
+
+ C: circle rad outerrad at 0,0
+ line from Rect_(outerrad,180+60) to (C.w,C.s) then down polewid/2 \
+ then right 2*outerrad then up polewid/2 then to Rect_(outerrad,-60)
+
+ line from C+(medrad,-twid/2) right twid then up twid then left twid \
+ chop -halfline
+ E: Here+(halfline,0)
+ for i = 1 to windings*2 do {
+ Point_(i*360/(windings*2))
+ arc ccw from E to C+vec_(medrad,-twid/2) with .c at C
+ E: rvec_(0,twid)
+ line to rvec_(twid,0) then to rvec_(twid,twid) then to E chop -halfline
+ }
+ move to C
+ for i = 0 to 3 do {{
+ Point_(i*90)
+ for_(-1,1,2,
+ `{ line from rvec_(polewid/2,m4x*polewid/2) \
+ to rvec_(medrad*2/3,m4x*polewid/2) \
+ then to rvec_(medrad*2/3,m4x*(polewid/2+polewid/5)) \
+ chop -halfline chop 0
+ { move to rvec_(0,-(m4x*polewid/5))
+ line from rvec_(-twid/2,m4x*twid/4) to rvec_(-twid/4,m4x*twid/4) \
+ then to rvec_(-twid/4,m4x*twid*3/4) \
+ then to rvec_(-twid*7/4,m4x*twid*3/4) \
+ then to rvec_(-twid*7/4,m4x*twid/4) \
+ then to rvec_(-twid/2,m4x*twid/4) }
+ T: rvec_(srad,0)
+ arc ifelse(m4x,-1,c)cw to (1+srad/distance(T,C))<C,T> with .c at T
+ }')
+ arc cw from last arc.end to 2nd last arc.end with .c at C
+ }}
+
+ t = distance(C,last arc.s)
+ "\sf N" at C+(0, t) below
+ "\sf N" at C+(0,-t) above
+ "\sf S" at C+(-t,0) ljust
+ "\sf S" at C+( t,0) rjust
+
+ for i = 0 to windings/2-1 do {
+ for j = 1 to 2 do { sprintf("$\char%g_%g$",97+i,j) \
+ at Rect_(outerrad-twid,180*(2-j)-i*360/windings) }
+ for j = 1 to 2 do { sprintf("$\char%g_%g'$",97+i,j) \
+ at Rect_(outerrad-twid,180*(2-j)-90-i*360/windings) }
+ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/SQUID.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/SQUID.m4
new file mode 100644
index 00000000000..54f50f9fa6c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/SQUID.m4
@@ -0,0 +1,22 @@
+.PS
+# SQUID.m4
+cct_init
+
+divert(-1)
+divert(0)dnl
+
+down_
+#source
+S1: SQUID
+ "J1" at S1.J1 above rjust
+ "J2" at S1.J2 above ljust
+
+S2: SQUID(3,dimen_*1.5,-120) at S1.e+(elen_,0)
+ "J1" at S2.J1 above rjust
+ "J2" at S2.J2 below ljust
+ "J3" at S2.J3 above ljust
+ arcrad = S2.C.rad*0.7
+ arc from S2.c+(Rect_(arcrad,-135)) to S2.c+(Rect_(arcrad,-45)) \
+ with .c at S2.C ->
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Schottky.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Schottky.m4
new file mode 100644
index 00000000000..8cd98061e92
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Schottky.m4
@@ -0,0 +1,51 @@
+.PS
+# Schottky.m4
+# 4-input positive NAND: the Schottky option for transistors (TI TTL data book)
+ cct_init
+
+ tic = dimen_/4
+ rlen = dimen_*3/4
+
+E1: dot; line up_ tic
+Q1: bi_trans(,,dEBCBUS) with .E at Here; line left tic from Q1.B; B1: Here
+ resistor(up_ rlen from Q1.C); llabel(,\unit{3}{\kilo})
+B2: dot; line right_ tic
+Q2: bi_trans(up_ dimen_,,dEBCBUS) with .B at Here
+ line from Q2.E to (Q2.E,E1); dot
+Gnd: "GND" ljust at Here+(dimen_/2,0)
+ dot(at Q2.C)
+ { line to (Gnd,Here); "Y" ljust }
+ line to (Q1.C,Here); dot
+ resistor(up_ rlen); llabel(,\unit{4}{\kilo}); B4: dot; line right_ tic; up_
+Q4: bi_tr with .B at Here
+ line from Q4.E to Q2.C
+ line up_ tic from B4
+Q5: bi_trans(,,dEBCBUS) with .E at Here; line left_ tic from Q5.B; B5: dot
+ line from Q5.C to (Q4.C,Q5.C); dot
+ { line to Q4.C }
+ resistor(up_ rlen); llabel(,iflatex(120,"120")); dot
+Vcc: "Vcc" ljust at (Gnd,Here)
+ dot(at (B5,Vcc))
+ resistor(to (Here,Q5.C)); llabel(,\unit{8}{\kilo})
+ diode(from (B4,Q2.C) to (B5,Q2.C),Z)
+ line to (Here,Q5.C)
+ diode(from B4 to (Here,B4),Z); dot
+ line left_ tic; up_
+Q3: bi_trans(,,dEBCBUS) with .C at Here; line left_ tic from Q3.B; B3: Here
+ line from Q3.E to (Q3.E,B2); dot
+ dot(at (B1,Here)); resistor(down_ to (Here,Q1.C)); rlabel(,\unit{1.5}{\kilo}); line to B1
+ resistor(down_ from B3 to (B3,B2)); rlabel(,\unit{12}{\kilo}); line to B2
+ line from Vcc to (B3,Vcc); resistor(down_ to (Here,Q5.C))
+ rlabel(,\unit{20}{\kilo})
+ line to B3
+ ground(at (Q3.C,Gnd),,F); dot
+
+ for i=0 to 3 do {
+ dot(at (B3+(0,tic*i)))
+ line left_ tic*i; diode(left_ dimen_,Z); dot
+ {line down_ dimen_; reversed(`diode',down_ dimen_,Z); line to (Here,Gnd)
+ if i==3 then { line to Gnd } else { dot }}
+ line left_ tic*(4-i); ifpostscript(,`sprintf("\char%g",64+(4-i)) rjust')
+ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Shaky.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Shaky.m4
new file mode 100644
index 00000000000..7bd5113a57a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Shaky.m4
@@ -0,0 +1,141 @@
+.PS
+# Shaky.m4
+gen_init
+NeedDpicTools
+divert(-1)
+ `An attempt to draw shaky hand-drawn lines'
+
+ `shakyline(linespec,type,s=shake,[shakevals])
+ Draw a line with a tremor
+ arg3: s=shake parameter (default 1)
+ arg4=normal(0,1) perturbations used if given'
+define(`shakyline',
+`rpoint_(ifelse(`$1',,`to rvec_(linewid,0)',`$1'))
+ M4_start: last line.start
+ M4_end: last line.end
+ [ Start: M4_start
+ End: M4_end
+ llen = distance(Start,End)
+ npts = round_(llen/linewid*4)
+ setkey_($3,s,1)
+ if "$4"=="" then { randn(d,npts-1,0,m4s*(llen/npts/8)) }\
+ else { for i=1 to npts-1 do { d[i] = $4[i]*m4s*(llen/npts/8) }}
+ P[0]: Start
+ for i=1 to npts-1 do { P[i]: i/npts between Start and End + (vec_(0,d[i])) }
+ P[npts]: End
+ spline $2 from P[0] to P[1]
+ for i=2 to npts do { continue to P[i] }
+ ] with .Start at last line.start; move to last line.end')
+
+ `shakyarc(arcspec,type,s=shake,[shakevals])
+ Draw an arc with a tremor
+ arg3: s=shake parameter (default 1)
+ arg4=normal(0,1) perturbations used if given'
+define(`shakyarc',
+`arc invis $1
+ M4_start: last arc.start
+ M4_end: last arc.end
+ M4_C: last arc.c
+ [ Start: M4_start
+ End: M4_end
+ C: M4_C
+ as = atan2(Start.y-C.y,Start.x-C.x)
+ ae = atan2(End.y-C.y,End.x-C.x)
+ ar = distance(Start,C)
+ llen = abs(ar*(ae-as))
+ npts = round_(llen/linewid*4)
+ setkey_($3,s,1)
+ if "$4"=="" then { randn(d,npts-1,0,m4s*(llen/npts/8)) }\
+ else { for i=1 to npts-1 do { d[i] = $4[i]*m4s*(llen/npts/8) }}
+ P[0]: Start
+ for i=1 to npts-1 do { P[i]: C + (rect_(ar+d[i],as+i/npts*(ae-as))) }
+ P[npts]: End
+ spline $2 from P[0] to P[1]
+ for i=2 to npts do { continue to P[i] }
+ ] with .Start at last arc.start; move to last arc.end')
+
+ `shakyspline(points,type,s=shake,[shakevals])
+ Draw a spline with a tremor
+ arg3: s=shake parameter (default 1)
+ arg4=normal(0,1) perturbations used if given'
+define(`shakyspline',
+`rpoint_(ifelse(`$1',,`to rvec_(linewid,0)',`$1'))
+ M4_start: last line.start
+ M4_end: last line.end
+ [ Start: M4_start
+ End: M4_end
+ llen = distance(Start,End)
+ npts = round_(llen/linewid*4)
+ setkey_($3,s,1)
+ if "$4"=="" then { randn(d,npts-1,0,m4s*(llen/npts/8)) }\
+ else { for i=1 to npts-1 do { d[i] = $4[i]*m4s*(llen/npts/8) }}
+ P[0]: Start
+ for i=1 to npts-1 do { P[i]: i/npts between Start and End + (vec_(0,d[i])) }
+ P[npts]: End
+ spline $2 from P[0] to P[1]
+ for i=2 to npts do { continue to P[i] }
+ ] with .Start at last line.start; move to last line.end')
+
+ `shakyfitcurve(V,n,linetype,
+ m (default 0),s=val,[shakevals])
+ Like fitcurve but the control points
+ are perturbed
+ arg5: s=shake parameter (default 1)
+ arg6=normal(0,1) perturbations used if given'
+define(`shakyfitcurve',`
+ {[ m4fn = `$2'; m4fm = ifelse(`$4',,0,`$4')
+ M4P_[0]: `$1'[m4fm]
+ setkey_($5,s,1)
+# if "$6"=="" then { !!!!
+# else { for i=1 to npts-1 do { d[i] = $5[i]*m4s*(llen/npts/8) }}
+ for i=m4fm+1 to m4fn-1 do { M4P_[i-m4fm]: `$1'[i]*(4/3) }
+ M4P_[m4fn-m4fm]: `$1'[m4fn]
+ n = m4fn-m4fm
+ # forward substitution
+ M4P_[1]: M4P_[1]-M4P_[0]/6
+ d[1] = 1
+ for i = 2 to n-1 do {
+ M4P_[i]: M4P_[i]-M4P_[i-1]/(d[i-1]*6)
+ d[i] = 1-1/d[i-1]/36 }
+ # backward substitution
+ for i= n-1 to 1 by -1 do {
+ M4P_[i]: (M4P_[i]-M4P_[i+1]/6)/d[i] }
+ # draw using computed control points
+ spline 0.55 `$3' from M4P_[0] to 11/32 between M4P_[0] and M4P_[1] \
+ then to 5/32 between M4P_[1] and M4P_[2]
+ for i=2 to n-2 do { continue to M4P_[i] }
+ continue to 27/32 between M4P_[n-2] and M4P_[n-1] \
+ then to 21/32 between M4P_[n-1] and M4P_[n] then to M4P_[n]
+ ] with .M4P_[0] at `$1'[ifelse(`$4',,0,`$4')]} ')
+
+
+divert(0)
+
+[
+ linethick = 2.5
+ round(,,colored "gray")
+ nl = 10
+ for i=1 to nl do {
+ shakyline(right 6/nl up 2*(2*pmod(i,2)-1),colored "gray",s=1)
+ round(,,colored "gray") }
+ ]
+
+[
+ linethick = 2.5
+ na = 3
+ arcrad = 1
+ for i=1 to na do {
+ shakyarc(,colored "gray",s=1)
+ }
+ ] with .nw at last [].sw +(0,-1)
+
+[
+ linethick = 2.5
+ na = 3
+ arcrad = 2
+ for i=1 to na do {
+ shakyarc(,colored "gray",s=1)
+ }
+ ] with .sw at last [].se +(1,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Sierpinski.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Sierpinski.m4
new file mode 100644
index 00000000000..f9bad102e0d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Sierpinski.m4
@@ -0,0 +1,27 @@
+.PS
+# Sierpinski.m4
+gen_init
+`define Sierpinski' {
+ if $1 > 0.04 then {
+ d = $1/2-lh
+ shade(1,line from $2+(d/2,d/2*s3+lw*2) right d/2 up d/2*s3 then left d*2 \
+ then right d down d*s3 then right d/2 up d/2*s3 )
+ Sierpinski($1/2,$2-($1/2,0))
+ Sierpinski($1/2,$2+($1/2,0))
+ Sierpinski($1/2,$2+(0,$1*s3/2))
+ }
+ }
+
+ r = 4
+ linethick = 0.2
+ #linethick = 1/2 /(1pt__)
+ lw = linethick pt__ /2
+ s3 = sqrt(3)
+ lh = lw*s3
+ A: 3,3
+ d = r/2-lh
+ shade(0,line from A+(0,lw) right d then up d*s3 left d then down d*s3 left d\
+ then right d )
+ psset_(linecolor=white)
+ Sierpinski(r/2,A)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Sixpole.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Sixpole.m4
new file mode 100644
index 00000000000..430c0450697
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Sixpole.m4
@@ -0,0 +1,25 @@
+.PS
+# sixpole.m4
+define(`biquad',`[
+In: Here
+ resistor(right_)
+E: dot
+ resistor
+ dot
+ {capacitor(down_,C); ground(,T)}
+ line right_ elen_/3
+ { dot
+ line up_ elen_
+ amp(to (E,Here),elen_/2)
+ capacitor(from E to Here,C) }
+ amp(right_,elen_/2)
+ Out: Here
+ ]')
+
+cct_init
+define(`elen_',linewid)
+
+ biquad
+ biquad with .In at last [].Out+(-linewid/4,0)
+ biquad with .In at last [].Out+(-linewid/4,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/TTLnand.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/TTLnand.m4
new file mode 100644
index 00000000000..638e7bb5fbc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/TTLnand.m4
@@ -0,0 +1,50 @@
+.PS
+# TTLnand.m4
+ cct_init
+ up_
+Q3: bi_tr
+ "\sf Q3" at Q3.E above ljust
+ dot(at Q3.C); reversed(`diode',up_ dimen_/2)
+Q4: bi_tr with .E at Here
+ "\sf Q4" at Q4.E above ljust
+ resistor(up_ dimen_ from Q4.C); rlabel(,`130\,\mathrm{\Omega}')
+V: dot
+ line left_ dimen_*0.75 from Q4.B; dot
+ line left_ dimen_*0.75 from Q3.B; dot
+Q2: bi_tr(up_ Q4.B.y-Q3.B.y) with .E at Here
+ "\sf Q2" at 1/2 between Q2.E and Q2.C ljust
+ resistor(from Q2.C to (Q2.C,V)); rlabel(,`1.6\,\mathrm{k\Omega}'); dot
+ resistor(from Q2.E down_ dimen_); llabel(,`1\,\mathrm{k\Omega}')
+ line to (Q4.E,Here)
+G: dot
+ line to Q3.E
+ line left_ dimen_/4 from Q2.B
+ right_
+Q1: bi_trans(,,BCdE2BU) with .C at Here
+ "\sf Q1" at Q1.Bulk above rjust
+ resistor(up_ from Q1.B to (Q1.B,V)); rlabel(,`4\,\mathrm{k\Omega}')
+ line to V
+
+ line left dimen_ from Q1.E2
+X1: dot; "$X1$" rjust above at last [].w
+X2: dot(at (X1,Q3.C)); "$X2$" rjust at last [].w
+ AA: line invis right dimen_ from X2
+ line from X2 to Intersect_(AA,Q1.Em1) then to Q1.E1
+X3: dot(at 2 between X1 and X2); "$X3$" rjust below at last [].w
+ AA: line invis right dimen_ from X3
+ line from X3 to Intersect_(AA,Q1.Em0) then to Q1.E0
+
+W: X2+(dimen_/2,0)
+N: V+(0,dimen_/4)
+S: (N.x,N.y-2*(N.y-W.y))
+ line from V to 2 between V and N
+Vcc:dot; "$+5\,\hbox{V}$" ljust at last [].e
+ line from G to (G,S)
+ ground
+ line from N to (W,N) then to (W,S) then to S
+ arc rad N.y-W.y ccw to N with .c at 1/2 between N and S
+
+ line right (N.y-S.y)/2+dimen_/2 from Q3.C
+Z: dot; "$Z = \overline{X1\cdot X2\cdot X3}$" ljust
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Three.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Three.m4
new file mode 100644
index 00000000000..aace5031ac9
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Three.m4
@@ -0,0 +1,44 @@
+.PS
+# Three.m4: three-phase oscillator
+ cct_init
+
+define(`section',`[ I: Here
+ resistor(right elen_*0.75); llabel(,R/2)
+T: dot
+ line down dimen_/2 then right_ dimen_/4
+ Amp: opamp(,,,,,
+ rgbfill(0.9,0.6,0.1,line to N then to E then to S then to Here)
+ "{\scriptsize$-$}" at In1 ljust
+ "{\scriptsize$+$}" at In2 ljust
+ ) with .In1 at Here
+ line left dimen_/4 from Amp.In2 then down dimen_/4; G: ground
+ resistor(from T to (Amp.Out,T)); llabel(,R)
+O: dot
+ { arrow up dimen_*0.5 then right dimen_/4 up dimen_/4
+ "$`$1^\circ'$" above }
+ line to Amp.Out
+ dot(at T+(dimen_/4,0)); line up dimen_*0.6
+ capacitor(right_ Amp.Out.x-Here.x-dimen_/4,C); llabel(,2C)
+ line to (Here,T); dot
+ ]')
+
+A: section(0)
+B: section(120) with .I at A.O
+C: section(-120) with .I at B.O
+
+ ground(at (A.I,A.G)+(dimen_/3,0),,)
+P:potentiometer(down_ dimen_/2,,0.75,dimen_/2) with .End at Here
+ line from P.Start to (A.I,P.Start); dot
+ resistor(up_ dimen_*0.75 from P.T1)
+ line to A.T
+
+ dot(at B.Amp.Out+(dimen_/3,0)); { "$V_c$" above }
+ resistor(down_ dimen_*0.75)
+ { dot; line right (C.T.x-Here.x)/2
+ reversed(`diode',up_ dimen_)
+ line to C.T }
+ resistor(down_ dimen_*0.75)
+ dot
+ line from C.O right dimen_/4 then down C.O.y-Here.y then to (A.I,Here) \
+ then to A.I
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Timer.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Timer.m4
new file mode 100644
index 00000000000..65fe8978471
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Timer.m4
@@ -0,0 +1,52 @@
+.PS
+# Timer.m4
+cct_init
+iflatex(`latexcommand({\small\sf)')
+
+define(`ic555',`[Chip: box ht boxwid wid boxwid "555"
+ P7: "7" ljust at 1/6<Chip.sw,Chip.nw>
+ P6: "6" ljust at 1/2<Chip.sw,Chip.nw>
+ P2: "2" ljust at 5/6<Chip.sw,Chip.nw>
+ P4: "4" below at 1/3<Chip.nw,Chip.ne>
+ P8: "8" below at 2/3<Chip.nw,Chip.ne>
+ P3: "3" rjust at Chip.e
+ P1: "1" above at Chip.s
+ ]')
+
+ define(`elen_',`linewid')
+Vs: dot
+ down_
+ variable(`resistor(,E); llabel(,1`\,'\hbox{M})')
+ resistor(,E); llabel(,100`\,'\hbox{k})
+ capacitor(,E); llabel(220`\,'\mu)
+Zero: dot
+
+ dot(at Vs+(elen_*4/3,0))
+ resistor(,E); llabel(,33`\,'\hbox{k})
+ line to (Here,Zero) chop 0 chop elen_
+C2: capacitor; llabel(0.1`\,'\mu)
+ dot
+
+IC1: ic555 with .P7 at C2.start + (elen_,0)
+ line from IC1.P4 to (IC1.P4,Vs); dot
+ line from IC1.P8 to (IC1.P8,Vs); dot
+ line from IC1.P1 to (IC1.P1,Zero); dot
+ line from IC1.P2 to (C2,IC1.P2); dot
+ crossover(from IC1.P7 to (Zero,IC1.P7),R,C2); dot
+ line from IC1.P6 left elen_/2 then down IC1.P6.y-IC1.P7.y; dot
+ line from IC1.P3 right elen_*2/3
+R: dot
+ line right_ elen_/3
+B: buzzer(,,C) with .In3 at Here
+ line from B.In1 to (R,B.In1)
+ reversed(`diode',to (Here,Vs),LE); "red" at last line.c+(elen_/2,0)
+ resistor(down_ elen_ from R,E); llabel(,470)
+ diode(to (Here,Zero),LE); {"green" at last line.c+(elen_*2/3,0)}
+ line to Zero chop 0 chop -elen_
+ line up_ (Vs.y-Here.y)/3
+ battery(up_ (Vs.y-Here.y)/3); rlabel(,,9`\,'\hbox{V})
+ switch(to (Here,Vs),,D)
+ line to (R,Vs)
+
+iflatex(`latexcommand(})')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Ttree.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Ttree.m4
new file mode 100644
index 00000000000..6cf9203b006
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Ttree.m4
@@ -0,0 +1,56 @@
+.PS
+# Ttree.m4
+# A binary tree using m4
+gen_init
+sinclude(tst.dim)
+s_init(Ttree)
+
+# `Node(no in row, head [location],
+# displacement of top of body (.n) wrt head,
+# body Node 1, body Node 2, ...) '
+define(`Node',`
+ Head`$1': `$2'
+ ifelse(`$3',,,`Body`$1': [
+ Loopover_(`v',`v; define(`m4ct',m4Lx)',shift(shift(shift($@))))
+ ] with .n at Head`$1' + `$3'
+ connect(`$1',m4ct)')')
+
+define(`connect',`Bot: move from Head$1.sw to Head$1.se
+for_(1,`$2',1,
+ `Top: move from Body$1.Head`'m4x.nw to Body$1.Head`'m4x.ne
+ Move: move from Head$1 to Body$1.Head`'m4x
+ if Bot.len*Top.len*Move.len > 0 then {
+ line from Intersect_(Move,Top) to Intersect_(Move,Bot)}')')
+
+ vsep = 0.75
+
+ Node(1,s_box($`h(h(h(x_1,x_2),h(x_3,x_4)),h(h(x_5,x_6),h(x_7,x_8)))'$),
+ (0,-vsep),
+ Node(1,s_box($`h(h(x_1,x_2),h(x_3,x_4))'$),
+ (0,-vsep),
+ Node(1,s_box($`h(x_1,x_2)'$),
+ (0,-vsep),
+ Node(1,s_box($`x_1:=((A,pk_A),h_1)'$)),
+ Node(2,s_box($`x_2:=((B,pk_B),h_2)'$) \
+ with .n at last "".ne+(0.2,-vsep*2/3))),
+ Node(2,s_box($`h(x_3,x_4)'$) with .nw at Head1.ne+(Body1.wid/2+0.1,0),
+ (0,-vsep),
+ Node(1,s_box($`x_3:=((A,pk_A^\prime),h_3)'$)),
+ Node(2,s_box($`x_4:=((D,pk_D),h_4)'$) \
+ with .n at last "".ne+(0.2,-vsep*2/3)))),
+ Node(2,s_box($`h(h(x_5,x_6),h(x_7,x_8))'$) \
+ with .nw at Head1.ne+(Body1.wid/2,0),
+ (0,-vsep),
+ Node(1,s_box($`h(x_5,x_6)'$),
+ (0,-vsep*5/4),
+ Node(1,s_box($`x_5:=((E,pk_E),h_5)'$)),
+ Node(2,s_box($`x_6:=((H,pk_H),h_6)'$) \
+ with .n at last "".ne+(0.2,-vsep*2/3))),
+ Node(2,s_box($`h(x_7,x_8)'$) with .nw at Head1.ne+(Body1.wid/2+0.1,0),
+ (0,-vsep*5/4),
+ Node(1,s_box($`x_7:=((D,pk_D^\prime),h_7)'$)),
+ Node(2,s_box($`x_8:=((K,pk_K),h_8)'$) \
+ with .n at last "".ne+(0.2,-vsep*2/3))),
+ Node(3,s_box($`h(x_9)'$) at 0.5 between Head1 and Head2)))
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/Wheat.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/Wheat.m4
new file mode 100644
index 00000000000..a797c81e96a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/Wheat.m4
@@ -0,0 +1,20 @@
+.PS
+# `Wheat.m4'
+gen_init
+
+boxwid = boxht
+
+for j = 0 to 7 do {
+ for i = 0 to 7 do {
+ box fill_((i+j)%2) at (j*boxwid,-i*boxwid)
+ x = 2^(j+8*i)
+ if (i+j)%2==0 then { command "{\white" } else { command "{\black" }
+ if x < 10000 then { sprintf("\Large$%g$",x) at last box } \
+ else { y = int(log(x))
+ sprintf("{\Large$%g$}$\cdot 10^{%g}$",round_(x/(10^y)),y) \
+ at last box }
+ command "}"
+ }
+ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/XOR.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/XOR.m4
new file mode 100644
index 00000000000..f6af25c7862
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/XOR.m4
@@ -0,0 +1,66 @@
+.PS
+# `XOR.m4'
+# Some realizations of the XOR function
+log_init
+scale = 2.54
+
+define(`gatelineth',1.6) # gate line thickness
+define(`lineth',0.8) # connection thickness
+
+define(`labels',`
+ "$A$" at last [].InA above
+ "$B$" at last [].InB above
+ "$A\oplus B$" at last [].Out ljust
+')
+
+# single gate
+ XOR: Autologix(Xor(A,B))
+ labels
+
+# canonical form
+ Autologix(Or(And(A,Not(B)),And(Not(A),B))) \
+ with .nw at last [].sw+(0,-1)
+ labels
+
+# mixed gates
+ Autologix(And(Nand(A,B),Or(A,B))) \
+ with .nw at last [].nw+(8,0)
+ labels
+
+# nand realization
+ Autologix(Nand(Nand(Nand(A,A),B),Nand(Nand(B,B),A))) \
+ with .nw at 2nd last [].sw+(0,-1)
+ labels
+
+# nor realization
+ Autologix(Nor(Nor(Nor(A,A),Nor(B,B)),Nor(A,B))) \
+ with .nw at last [].nw+(8,0)
+ labels
+
+# These functions contain topologies in common so write a macro
+define(`customAB',
+ `S: Autologix(N`$1'(N`$1'(A,B1),N`$1'(B1,B)),N) with .Out at Here
+ line thick lineth from S.In2 to S.In3; InAB: dot(at last line.c)
+ line thick lineth from InAB left 2*L_unit
+ TN: Autologix(N`$1'(A,B)) with .Out at Here
+ line thick lineth from TN.InA up 3*L_unit; InA: Here
+ line thick lineth from TN.InB up 3*L_unit; InB: Here
+ line thick lineth from S.In4 to (InB,S.In4) then to (InB,TN.In2); dot
+ line thick lineth from S.In1 to (InA,S.In1); dot')
+
+ [ customAB(and)
+ Out: S.Out
+ ] with .nw at 2nd last [].sw+(0,-1)
+ labels
+
+ [ linethick = gatelineth
+ H: NOR_gate(2); linethick = lineth
+ L:dot(at H.w-(2*L_unit,0))
+ line from H.In1 to (L,H.In1) then to (L,H.In2) then to H.In2
+ line from L left 2*L_unit
+ customAB(or)
+ Out: H.Out
+ ] with .nw at last [].nw+(8,0)
+ labels
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/birds.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/birds.m4
new file mode 100644
index 00000000000..8d14ef18630
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/birds.m4
@@ -0,0 +1,34 @@
+.PS
+gen_init
+scale = 50
+linethick = 2*linethick
+
+define bird {[
+ line shaded "$1" from (0,0) to \
+ (10,-5) to (19,8) to (35,7) to (38,-12)+(0,2) to (60,0) to\
+ (75,23) to (80,40) to (52,37)+(2,2) to (74,50) to (52,50) to \
+ (60,60) to (38,48)+(0,2) to (35,67) to (19,68) to (10,55) to \
+ (0,60) to (-8,50) to (14,50) to (-8,37)+(2,2) to (20,40) to \
+ (15,23) to (0,0)
+E: (80,40)
+W: (20,40)
+N: (19,68)
+S: (19,8)
+ line outlined "gray" from (35,15) down 10 right 25
+ line outlined "gray" from (40,20) right 25 down 8
+ line outlined "gray" from (42,25) right 28 down 6
+ line outlined "gray" from (40,30) right 32 down 4
+ circle outlined "gray" rad 1 at (1,55)
+ circle outlined "gray" rad 4 at (24,55)
+]}
+
+ ncols = 4
+ nrows = 4
+ right
+ for i=0 to nrows-1 do {
+ for j=0 to ncols-1 do { move to (j*60,-i*60)
+ if (i+j)%2==0 then { bird(black) } else { bird(white) }
+ }
+ }
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/bistable.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/bistable.m4
new file mode 100644
index 00000000000..ac49023863b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/bistable.m4
@@ -0,0 +1,35 @@
+.PS
+# `bistable.m4'
+cct_init # Default initialization
+
+ up_
+rgbdraw(1,0,0,
+Q1: bi_tr(,R) # Q1 upward with base to the right
+ llabel(,Q_1) ) # Label to left of last []
+rgbdraw(0,0,1,
+Q2: bi_tr with .C at Q1.C+(elen_*7/4,0) # Q2 with base to left
+ rlabel(,Q_2) )
+
+ ground(at Q1.E)
+ ground(at Q2.E)
+
+ line right_ dimen_/3 from Q1.B # Extend the base conductors
+B1: Here
+ line left_ dimen_/3 from Q2.B
+B2: Here
+
+ resistor(up_ elen_*0.75 from Q1.C); llabel(,"$R_L$" wid 0.16) # Load resistors
+ line to (Q2.C,Here) "$V_{\hbox{cc}}$" below
+ resistor(down_ to Q2.C); llabel(,R_L)
+
+ move to Q1.C+(0,dimen_/5)
+ { resistor(right_ to (B1,Here)); llabel(,R_1)
+X: line to B2 } # Label the line to be jumped
+ resistor(from (Q2.C,Here) left_ to (B2,Here)); rlabel(,R_1)
+ crossover(to B1,R,X)
+
+ resistor(down_ elen_*0.75); rlabel(,R_2) # Bias resistors
+ {"$-V_{\hbox{cc}}$" rjust}
+ line to (B2,Here)
+ resistor(up_ to B2); rlabel(,R_2)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/brace.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/brace.m4
new file mode 100644
index 00000000000..3cf80f87635
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/brace.m4
@@ -0,0 +1,80 @@
+.PS
+# brace.m4
+gen_init
+NeedDpicTools
+
+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
+
+ del = 0.2
+ maxht = 2
+ minht = 0.3
+ n = 16
+ hmax = 360
+R1: [
+ for i=0 to n-1 do {
+ x = i/n
+ y = minht*(1-x)+maxht*x
+ hsvtorgb(x*hmax,1,1,r,g,b)
+ brace(from (-i*del,-y/2) up y,,,thick 0.4 \
+ shaded rgbstring(r,g,b))
+ brace(from ((i+1)*del,y/2) down y,,,thick 0.4 \
+ outlined rgbstring(r,g,b) \
+ shaded rgbstring(r,g,b))
+ }
+ ]
+R2: [
+ for i=0 to n-1 do {
+ x = i/n
+ y = minht*(1-x)+maxht*x
+ hsvtorgb(x*hmax,1,1,r,g,b)
+ brace(from (-i*del,-y/2) up y,5bp__+x*20bp__,2bp__+x*13bp__,thick 0.4 \
+ shaded rgbstring(r,g,b))
+ brace(from ((i+1)*del,y/2) down y,5bp__+x*20bp__,2bp__+x*13bp__,thick 0.4 \
+ outlined rgbstring(r,g,b) \
+ shaded rgbstring(r,g,b))
+ }
+ ] with .n at R1.s+(0,-0.2)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/chaos.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/chaos.m4
new file mode 100644
index 00000000000..17ae070e58d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/chaos.m4
@@ -0,0 +1,39 @@
+.PS
+# chaos.m4
+# Example simulation of chaos equations.
+gen_init
+scale = 10
+define(`FF',`dnl
+ `$4' = `$1'+dt*10*(-`$1'+`$2')
+ `$5' = `$2'+dt*(28*`$1'-`$2'-`$1'*`$3')
+ `$6' = `$3'+dt*(-8*`$3'/3+`$1'*`$2') ')
+[
+x0 = 1
+y0 = 0
+z0 = 0
+dt = 0.005
+nN = 100
+for i = 1 to nN do {
+ for j = 1 to 8 do {
+ FF(x0,y0,z0,x1,y1,z1)
+ FF(x1,y1,z1,x2,y2,z2)
+ FF(x2,y2,z2,x3,y3,z3)
+ FF(x3,y3,z3,x4,y4,z4)
+ spline from x0,y0 to x1,y1 then to x2,y2 then to x3,y3 then to x4,y4
+ x0 = x4; y0 = y4; z0 = z4
+ }
+ }
+arrow from (-15,0) to (15,0); "$x$" ljust
+line up 1 from (10,0); "$ 10$" at last line.start below
+line up 1 from (-10,0); "$-10$" at last line.start below
+arrow from (0,-15) to (0,15); "$y$" above
+line right 1 from (0,10); "$ 10$" at last line.start rjust
+line right 1 from (0,-10); "$-10$" at last line.start rjust
+"$ 0$" at (0,0) below rjust
+]
+`"\parbox{2.5in}{\begin{eqnarray*}
+ \dot{x}_1 & = & 10(-x_1+x_2)\\
+ \dot{x}_2 & = & 28x_1-x_2-x_1x_3\\
+ \dot{x}_3 & = & -8x_3/3+x_1x_2
+ .\end{eqnarray*}}"' at last [].s below
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/clock.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/clock.m4
new file mode 100644
index 00000000000..3431068d9bf
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/clock.m4
@@ -0,0 +1,20 @@
+.PS
+# clock.m4
+gen_init
+
+ linethick = 1.5
+ arrowwid = 5 pt__
+
+ rgbfill(255/255,250/255,205/255,
+ Clock: circle rad 0.75 at (0,0) )
+
+ command "\newcounter{hour}"
+ for time=1 to 12 do {
+ sprintf("\setcounter{hour}{%g}\Roman{hour}",time) \
+ at Rect_(Clock.rad*0.85,90-time*30)
+ }
+ line <-> from Rect_(Clock.rad*0.95,90-8.5*30) to Clock \
+ then to Rect_(Clock.rad*0.7,90-3.5*30)
+ line thick 1 outline "red" from Clock to Rect_(Clock.rad*0.95,90-0.75*30)
+
+.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
new file mode 100644
index 00000000000..62d92291acd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/control.m4
@@ -0,0 +1,142 @@
+.PS
+# control.m4
+gen_init
+ linewid = linewid*0.8
+ circlerad = 0.35/2
+ bw = boxwid/2
+ bh = boxht/2
+
+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #
+
+PID: [
+ {"$r(s)$" above ljust}
+ arrow
+S1: circle
+ line right "$e(s)$" above
+ { arrow right ; box ht bh wid bw "$K_p$"
+ arrow right linewid-circlerad ; S2: circle }
+ { line up linewid ; arrow right ; box ht bh wid bw "$K_D s$"
+ line to (S2,Here) ; arrow to S2.n }
+ { line down linewid ; arrow right ; box ht bh wid bw "$K_I/s$"
+ line to (S2,Here) ; arrow to S2.s }
+ arrow right from S2.e "$u(s)$" above
+ box "$G(s)$"
+ arrow right ; "$y(s)$" above rjust at Here+(0,2pt__)
+ line down boxht*3/2 from last arrow.c then left last arrow.c.x-S1.x
+ arrow to S1.s
+ "$-\;$" below rjust
+]
+ "(a) $PID$ control" below ljust at PID.sw+(0,-5pt__)
+
+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #
+
+Observer: [ {"$r$" above ljust}
+ arrow
+S: circle
+ "$-\;$" below rjust at S.s
+ arrow <- down linewid/2 from S.s
+ box ht bh wid bw "$K$"
+ arrow <- down linewid/2
+ line right linewid "$\hat x$" above
+Obs:box wid linewid*5 ht boxht*5/4 \
+ "$\frac{d}{dt}\hat x = (A{-}LC)\hat x + B u + L y$"
+ "\sl Observer" above ljust at Obs.sw
+ arrow <- right linewid/2 from 3/4<Obs.se,Obs.ne>
+ line to (Here,S)
+ {"$u$" above at Here+(linewid/2,0)}
+ arrow from S.e to Here+(linewid,0)
+Plant: box wid boxwid*3/2 ht boxht*5/4 \
+ "$\frac{d}{dt} x=Ax+Bu$" "$\quad y=Cx$\hfill\hbox{}"
+ "\sl Plant" above ljust at Plant.sw
+ arrow right from Plant.e
+ "$y$" above rjust at Here+(0,2pt__)
+ move to last arrow.c
+ line to (Here, 1/4<Obs.se,Obs.ne>)
+ arrow to (Obs.e,Here)
+] with .nw at PID.sw+(0,-0.5)
+ "(b) Output feedback with a full-order observer" below ljust \
+ at Observer.sw+(0,-5pt__)
+
+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #
+
+Multiblock: [
+boxwid = boxht
+circlerad = boxht*0.4
+
+define summer { circle
+ {line from last circle.nw to last circle.se
+ line from last circle.sw to last circle.ne
+ "$$1$" at last circle.n below
+ "$$2$" at last circle.s above
+ "$$3$" at last circle.e rjust
+ "$$4$" at last circle.w ljust}
+}
+define doublebox {[box "$$1$"; arrow; box "$$2$"]}
+
+ arrow "$E_1$" above
+S1: summer(,-,,+)
+ linewid = boxwid/2
+ arrow "$\epsilon$" above
+ doublebox(H_1,H_2)
+ arrow
+S2: summer(-,,,+)
+ arrow
+T: doublebox(H_3,H_4)
+ line
+Y: Here
+ arrow
+ "$S_1$" above
+R1: box "$R_1$" at (T.x,T.y+boxht*3/2)
+ arrow from Y to (Y,R1) then to R1.e
+ arrow from R1.w to (S2,R1) then to S2.n
+ "$n_1$" ljust at S2.n+(0,boxht/2)
+ left
+Rf: doublebox(R_2,R_3) at ((S1.x+T.x)/2,T.y-boxht*3/2)
+ arrow from T to (T,Rf) then to Rf.e
+ arrow from Rf.w to (S1,Rf) then to S1.s
+ "$n_2$" at S1.s+(0,-boxht/2) ljust
+] with .nw at Observer.sw + (0,-0.5)
+ "(c) A multiblock example" below ljust at Multiblock.sw+(0,-5pt__)
+
+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . #
+
+Nonlinear: [boxwid = boxwid*3/2; boxht = boxht*3/2
+ thicklines_
+ scale = 0.8
+ circlerad = 0.3/2
+R: box "reference" "$R$"
+ arrow right linewid*4/3 "${y_c}_{\hbox{\scriptsize ref}}$" above
+Gh: box "```inverse'''" "$\hat G$"
+ arrow from Gh.s down "${y_m}_{\hbox{\scriptsize ref}}$" ljust
+E: circle
+ arrow from E.e right "$e$" above
+ box "stabilizer" "$K$"
+ arrow "$\delta u$" above
+D: circle
+ line from Gh.e to (D,Gh.e) "$u_{\hbox{\scriptsize ref}}$" above
+ arrow to D.n
+ arrow from D.e right "$u$" above
+G: box "plant" "$G$"
+ arrow <- from G.n up boxht/2
+ "disturbance $z$" above
+ arrow right from G.e + (0,boxht/4)
+ "$y_c$" ljust
+ arrow right from G.e + (0,-boxht/4)
+ "$y_m$" ljust
+ move to last arrow.c
+ arrow down Here.y-G.s.y+boxht*2/3 then left Here.x-E.x then to E.s
+ "$-$" at Here + (-0.15,-0.1)
+ arrow <- down from R.s
+ "$W$ control input" at Here - (0,0.1)
+
+UL:R.nw +(-boxht/2,boxht/2)
+UR:(D.e,UL) + (0.1,0)
+ line dashed from UL to UR then to (UR,G.s+(0,-boxht*3/2))
+ line dashed to (Gh.w,Here) "Controller" above
+ line dashed to (Here,Gh.s+(0,-boxht/2))
+ line dashed to (UL,Here) then to UL
+] with .nw at Multiblock.sw + (0,-0.5)
+ "(d) Nonlinear feedforward (for performance) and small-signal feedback (for stability)" \
+ below ljust at Nonlinear.sw+(0,-5pt__)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/csc.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/csc.m4
new file mode 100644
index 00000000000..6fc3be88ba8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/csc.m4
@@ -0,0 +1,76 @@
+ifelse(ifpstricks(T)`'ifmpost(T)`'ifpostscript(T)`'ifpgf(T),,
+ `PSTricks, MetaPost, PGF, or Postscript required for this diagram',`dnl
+.PS 3.5
+# csc.m4
+gen_init
+
+circlerad=1.91
+hubrad=0.10
+s=0.5
+
+define(`midnight',`0.1, 0.1, 0.44')
+define(`white',`1, 1, 1')
+define(`spokewidth',0.1)
+define(`spoke',`dnl
+ {line from rvec_(0,hubrad-spokewidth/2) to rvec_(circlerad-0.05,0)}
+ {line from rvec_(0,-(hubrad-spokewidth/2)) to rvec_(circlerad-0.05,0)}')
+define(`lwid',1)
+define(`coord',`(s*(`$1'),s*(`$2'))')
+
+# Circle and spokes
+# [
+rgbdraw(midnight,
+ linethick=`0.'eval(lwid*15)/(1pt__)
+ {circle with .c at Here
+ circle invis diam last circle.diam + linethick pt__ at last circle }
+ linethick=spokewidth/(1pt__)
+ for angle = 0 to 330 by 30 do {
+ Point_(angle)
+ {spoke}
+ }
+ )
+
+# Whiten where the hull will be
+ linethick=`0.'eval(lwid*20)/(1pt__)
+ rgbdraw(white,
+ Point_(-60){line to rvec_(circlerad*0.72,0)}
+ Point_(-90){line to rvec_(circlerad*0.72,0)}
+ Point_(-120){line to rvec_(circlerad*0.72,0)}
+
+ linethick=`0.'eval(lwid*15)/(1pt__)
+ {move to coord(1.8,-2.3)+(0,0.025)
+ spline to Here+coord(-0.8,-0.3) then to Here+coord(-1.8,-0.3) \
+ then to Here+coord(-2.18,-0.27) \
+ then to Here+coord(-3.93,-0.1)}
+ )
+
+# Sail
+ thinlines_
+ setrgb(midnight)
+ rgbfill(midnight,
+ line from coord(0.44,3.38) to coord(0.44,2.6) \
+ then to coord(2.1,-1.75) \
+ then to coord(1.22,-1.53) \
+ then to coord(0.62,-1.4) \
+ then to coord(0.55,-1.6) \
+ then to coord(-2.2,-1.6) \
+ then to coord(-2.35,-1.5)
+ spline to coord(-2.14,-0.78) \
+ then to coord(-1.74,0.22) \
+ then to coord(-1.42,0.89) \
+ then to coord(-0.92,1.73) \
+ then to coord(0,2.9) \
+ then to coord(0.44,3.38)
+ )
+
+# Hull
+ rgbfill(midnight,
+ spline from coord(2.1,-1.75) to coord(1.9,-2.2) \
+ then to coord(1.85,-2.3) then to coord(1.8,-2.33) \
+ then to coord(1,-2.5) then to coord(0,-2.6) then to coord(-0.38,-2.57) \
+ then to coord(-2.13,-2.4)
+ line to coord(-2.2,-2.05) then to coord(2.1,-1.75)
+ spline to coord(-1,-2.08) then to coord(0.55,-1.77)
+ )
+# ] with .sw at 1,1
+.PE')
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/darrows.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/darrows.m4
new file mode 100644
index 00000000000..07c5bfaf228
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/darrows.m4
@@ -0,0 +1,61 @@
+.PS
+# darrows.m4
+darrow_init
+
+[
+line thick 0.4 outlined "lightgray" down_ 6
+line thick 0.4 outlined "lightgray" down_ 6 from last line.start+(1,0)
+move to 1st line.start
+right_
+
+linethick = 5
+define(`dlthick',0.25)
+linewid = 1
+
+ { darrow() }
+move down 0.4; right_; { darrow(,t) }
+move down 0.4; right_; { darrow(,,t) }
+move down 0.4; right_; { darrow(,t,t) }
+move down 0.4; right_; { darrow(,,,,,,|-) }
+move down 0.4; right_; { darrow(,,,,,,!-) }
+move down 0.4; right_; { darrow(,,,,,,<-) }
+move down 0.4; right_; { darrow(,t,,,,,<-) }
+move down 0.4; right_; { darrow(,,t,,,,<-) }
+move down 0.4; right_; { darrow(,t,t,,,,<-) }
+move down 0.4; right_; { darrow(,,,,,,<-|) }
+move down 0.4; right_; { darrow(,,,,,,<-!) }
+move down 0.4; right_; { darrow(,,,,,,<->) }
+move down 0.4; right_; { darrow(,t,,,,,<->) }
+move down 0.4; right_; { darrow(,,t,,,,<->) }
+move down 0.4; right_; { darrow(,t,t,,,,<->) }
+]
+
+[
+line thick 0.4 outlined "lightgray" down_ 6
+line thick 0.4 outlined "lightgray" down_ 6 from last line.start+(1,0)
+move to 1st line.start
+right_
+
+linethick = 5
+define(`dlthick',0.25)
+linewid = 1
+
+ { Darrow() }
+move down 0.4; right_; { Darrow(,S) }
+move down 0.4; right_; { Darrow(,E) }
+move down 0.4; right_; { Darrow(,S;E) }
+move down 0.4; right_; { Darrow(,ends=|-) }
+move down 0.4; right_; { Darrow(,ends=!-) }
+move down 0.4; right_; { Darrow(,ends=<-) }
+move down 0.4; right_; { Darrow(,S;ends=<-) }
+move down 0.4; right_; { Darrow(,E;ends=<-) }
+move down 0.4; right_; { Darrow(,S;E;ends=<-) }
+move down 0.4; right_; { Darrow(,ends=<-|) }
+move down 0.4; right_; { Darrow(,ends=<-!) }
+move down 0.4; right_; { Darrow(,ends=<->) }
+move down 0.4; right_; { Darrow(,S;ends=<->) }
+move down 0.4; right_; { Darrow(,E;ends=<->) }
+move down 0.4; right_; { Darrow(,S;E;ends=<->) }
+] with .nw at last [].ne+(0.5,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/debug1.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/debug1.tex
new file mode 100644
index 00000000000..44cc87cef85
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/debug1.tex
@@ -0,0 +1,15 @@
+% This is file debug1.tex
+% Type
+% pdflatex debug1
+% for a very basic test of your latex (or pdflatex) installation. The
+% file debug1.log should not contain any error messages and debug1.pdf
+% should read correctly in a pdf reader.
+%
+\documentclass{article}
+%
+\newcommand\Angle[1]{\setbox0=\hbox{$\mskip 7mu minus 4mu#1$}%
+ \raise.21ex\hbox{$/$}\hskip-0.95ex\underline{\raise\dp0\hbox{\box0}}}
+%
+\begin{document}
+ $120\Angle{50^{\circ}}$
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/debug2.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/debug2.m4
new file mode 100644
index 00000000000..eccd9d38bbc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/debug2.m4
@@ -0,0 +1,48 @@
+% This is file debug2.m4
+% Type the two (identical) command lines:
+% m4 pdf.m4 debug2.m4 | dpic -g > debug2.tex; pdflatex debug2
+% m4 pdf.m4 debug2.m4 | dpic -g > debug2.tex; pdflatex debug2
+% Alternatively, type the two not-quite-identical lines:
+% m4 pstricks.m4 debug2.m4 | dpic -p > debug2.tex; latex debug2
+% m4 pstricks.m4 debug2.m4 | dpic -p > debug2.tex; latex debug2; dvips debug2
+% In either case, the first command creates the file debug2.dim; the second
+% reads it to draw the correct bounding box.
+%
+% If m4 gives an error saying that it cannot find pdf.m4 then the M4PATH
+% environment variable has not been set to the directory containing
+% pgf.m4, pstricks.m4, and the other m4 libraries. For example, I have
+% export M4PATH=.:~/lib:
+% in the file ~/.bash_aliases on my Ubuntu machine, and on my PC with cygwin
+% it is in .bashrc. (You will have to change ~/lib to suit.)
+%
+% If other errors occur, look at debug2.log for details.
+%
+% If boxdims.sty is not found, then either it has not been copied to
+% where latex can find it or the latex filename database has not been
+% updated correctly. Instructions for the latter depend on the operating
+% system and may invlove commands texhash, mktexlsr, tlmgr, possibly preceded
+% by sudo, or (for MiKTeX) clicking on the Refresh FNDB button. See steps 3
+% and 4 (ignore 1 and 2) at
+% https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages
+%
+% On my Ubuntu machine, boxdims.sty is in
+% /usr/local/lib/localtexmf/tex/latex/local/
+% and on my cygwin machine it is in
+% /cygdrive/d/localtexmf/tex/latex/local/
+% but you might choose something like ~/texmf/tex/latex/boxdims/
+%
+\documentclass{article}
+\usepackage{boxdims}
+\usepackage{ifpstricks(pstricks,tikz)}
+\begin{document}
+.PS
+cct_init
+sinclude(debug2.dim)
+s_init(steinmetz)
+[
+ source(up_,AC); llabel(,s_box(`${}20$ V'),)
+ inductor(up_,W); llabel(,s_box(`${}20$ mH'),)
+ ]
+showbox_
+.PE
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/diamond.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/diamond.m4
new file mode 100644
index 00000000000..d16cfc91aa3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/diamond.m4
@@ -0,0 +1,38 @@
+.PS
+# diamond.m4
+gen_init
+# See LaTeX Graphics Companion pp 57-58
+ifdpic(`
+dimen = 1.5
+ratio = 0.9
+n = 30
+
+North: (0,dimen)
+East: (dimen,0)
+South: (0,-dimen)
+West: (-dimen,0)
+
+define(`square',
+ `shade(`$1',
+ line from North to East then to South then to West then to North)
+ ')
+
+define(`diamond',`[
+for i = 2 to n do {
+ square(`$1')
+ Tmp: North
+ North: ratio between East and North
+ East: ratio between South and East
+ South: ratio between West and South
+ West: ratio between Tmp and West
+ }]')
+
+linethick = 0
+diamond( i % 2 )
+linethick = 0.4
+diamond( (n-i)/(n-2) ) with .w at last [].e+(0.25,0)
+
+',
+`box "diamond.m4" "requires" "dpic"')
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex00.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex00.m4
new file mode 100644
index 00000000000..21131aa8a1f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex00.m4
@@ -0,0 +1,91 @@
+.PS
+# ex00.m4
+gen_init
+
+[
+thicklines_
+ewid = 2
+eht = 0.5
+E: ellipse wid ewid ht eht
+
+ [ narrows = 5
+ de = ewid/narrows
+ for i=0 to narrows do {
+ arrow down from i*de,0 }
+ ] with .s at E.n+(0,0.25)
+
+ "{\bf B$(t)$}" at last [].c
+
+thinlines_
+ arrow from E.c to E.ne
+ box invis fill_(1) ht 0.12 wid 0.12 with .c at last arrow.c "$r$"
+]
+[
+# ex07.m4
+# gen_init
+
+Barrel: box invis ht 0.4 wid 1.5
+ up
+Face: arc rad 2.6 from Barrel.e+(2.4,-1.7/2) to Barrel.e+(2.4,1.7/2)
+
+ eps = 0.03
+ arc ccw rad 2.6 from Face.start-(eps,0) to Face.end-(eps,0) \
+ with .c at Face.c-(eps,0)
+ line from Barrel.nw to Barrel.ne then to Face.end
+ line from Barrel.sw to Barrel.se then to Face.start
+ arc cw from Barrel.sw to Barrel.nw rad Barrel.ht*1.2
+
+Cathode: Barrel.w+(0.3,0)
+Term: Barrel.w+(-0.25,0)
+ dcath = 0.13
+ dan = 0.12
+
+ line from Cathode up dcath/2 left dcath/2 then to Term.x,Cathode.y+dcath/2
+ dot
+ line from Cathode down dcath/2 left dcath/2 then to Term.x,Cathode.y-dcath/2
+ dot
+
+ hole = 0.06
+Hole: line invis up hole from Cathode+(0.5,-hole/2)
+ line from Hole.end up dan-hole/2 then to Term.x,Cathode.y+dan; dot
+ line from Hole.start down dan-hole/2 then to Term.x,Cathode.y-dan; dot
+
+ platewid = 0.25
+ platesep = 0.15
+Plates: box invis wid platewid ht platesep at Barrel.e+(-platewid/2,0)
+ line right platewid from Plates.nw
+ line right platewid from Plates.sw
+ line up 0.3 from Plates.n
+ line down 0.3 from Plates.s
+
+linethick_(1.4)
+ move to Cathode+(0.03,0)
+Spot: 0.9<Face.start,Face.end>
+ arcto(Plates.c,Spot,(Plates.c.x-Cathode.x)*0.90,outlined "gray")
+ line to Spot chop 0 chop -0.02 outlined "gray"
+
+thinlines_
+
+ arrow <- from Cathode+(0.2,0.06) up 0.5 left 0.3
+ "{\sl electron}" above "{\sl gun}" above
+
+ arrow <- from Plates.nw+(0,0.06) up 0.5 left 0.3
+ "{\sl deflection}" above "{\sl plates}" above
+
+ arrow <- from 0.5<Plates.e,Spot>+(0,0.06) up 0.5 left 0.3
+ "{\sl electron beam}" at Here+(-0.3,0) above
+
+ spline <- from 1.015<Plates.e,Spot> right 0.1 up 0.1 then up 0.1 \
+ then up 0.1 left 0.1
+ "{\sl spot of light}sp_" rjust
+
+ "{\sl vacuum}sp_" at 0.5<Face.start,Face.end>+(-0.4,0) rjust
+
+ arrow <- from Face.start+(0.1,0.5) left 0.6*1.4 down 0.3*1.4
+ "{\sl phosphor coating}sp_" rjust
+
+ arrow <- from 0.2<Barrel.se,Face.start> left 0.6 down 0.3
+ "{\sl glass enclosure (tube)}sp_" rjust
+
+] with .sw at last [].se+(0.5,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex01.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex01.m4
new file mode 100644
index 00000000000..c72185cb00b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex01.m4
@@ -0,0 +1,21 @@
+.PS
+# ex01.m4
+cct_init
+ linewid = linewid*1.5 # let's make the circuit elements bigger than usual
+ define(`elen_',linewid) # but not longer
+ del = elen_/4 # a spacing parameter
+
+ Vin: source(up_ elen_ + 2*del); llabel(-,v_s,+)
+
+ switch(right_ elen_,,C); rlabel(,t = 0,)
+ resistor; llabel(,47\`,'\Omega,); b_current(i_R\strut,above rjust)
+
+ line right_ elen_/2 then down_ del
+ parallel_(`inductor(,W); llabel(,L,); b_current(i_L)',
+ `capacitor(,C); rlabel(+,v_C,-); llabel(,,\;C)')
+ line to (Here,Vin.start) then to Vin.start
+
+ arcd(last []+(4pt__,0),del,30,330) <- ; "$i_2$" at last arc
+ arcd(Vin.c+(4*del,0),2*del,30,330) <- ; "$i_1$" at last arc
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex02.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex02.m4
new file mode 100644
index 00000000000..2e5c2a6cb55
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex02.m4
@@ -0,0 +1,54 @@
+.PS
+# ex02.m4
+cct_init
+
+[
+ [
+ for angl=0 to 315 by 45 do {
+ Point_(angl)
+ opamp(to rvec_(linewid*3/2,0)) with .Out at (0,0) }
+ ]
+ resistor(down_ dimen_ from last [].s)
+ diode(down_ dimen_*2/3,LE)
+ diode(down_ dimen_*2/3,LER)
+ ground(,T)
+]
+
+[
+ define(`elen_',`dimen_*3/2') # restore defaults
+ define(`sourcerad_',`dimen_*0.25')
+ leng = elen_
+ define(`fromcentre',`move to C+(-elen_/2,-elen_*cosd(15)/(2*sind(15)))')
+ C: dot
+ { fromcentre()
+ for i = 0 to 359 by 30 do {
+ Point_(i); inductor
+ }
+ }
+ define(`elen_',leng*0.8)
+ { fromcentre()
+ for i=0 to 359 by 30 do {
+ Point_(i); inductor(,W)
+ }
+ }
+ define(`elen_',leng*0.6)
+ { fromcentre()
+ for i=0 to 359 by 30 do {
+ Point_(i); resistor
+ }
+ }
+ define(`elen_',leng*0.4)
+ { fromcentre()
+ for i=0 to 359 by 30 do {
+ Point_(i); capacitor(,C)
+ }
+ }
+ define(`elen_',leng*0.2)
+ { fromcentre()
+ for i=0 to 359 by 30 do {
+ Point_(i); diode
+ }
+ }
+ ] with .sw at last [].se+(linewid,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex03.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex03.m4
new file mode 100644
index 00000000000..3a1c265e989
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex03.m4
@@ -0,0 +1,30 @@
+.PS
+# ex03.m4
+cct_init
+circlerad = 0.35/2
+define(`elen_',`dimen_')
+del = linewid*0.6
+
+ "$u_k$" above
+ line
+{
+ arrow right_ del
+B0: circle "$b_0$"
+ arrow right linewid/2
+S: circle "$\sum$"
+ line right 2*circlerad + del + S.w.x-B0.e.x
+ {arrow ; "$y_k$" above }
+ down_
+ delay
+ {line left_ del ; circle "$-a_1$" ; arrow from last circle to S chop}
+ line dashed down_ del
+ delay
+ {line left_ del ; circle "$-a_n$" ; arrow from last circle to S chop}
+}
+ down_
+ delay
+ {line right_ del ; circle "$b_1$" ; arrow from last circle to S chop}
+ line dashed down_ del
+ delay
+ {line right_ del ; circle "$b_n$" ; arrow from last circle to S chop}
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex04.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex04.m4
new file mode 100644
index 00000000000..f121627ccc6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex04.m4
@@ -0,0 +1,59 @@
+.PS
+# ex04.m4
+cct_init
+
+[
+pushdef(`elen_',`dimen_') # short elements
+pushdef(`sourcerad_',`dimen_*0.2')
+#linewid = 0.85
+linewid = 0.6
+
+Ct:dot
+ Point_(-60); capacitor(,C); dlabel(0.14,0.14,,,C_3)
+Cr:dot
+ left_; capacitor(,C); dlabel(0.14,0.14,C_2,,)
+Cl:dot
+ down_; capacitor(from Ct to Cl,C); dlabel(0.14,-0.10,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.07,,L_3,)
+R:dot
+L:dot( at (Cl-(Cos(30)*(elen_),0),R) )
+
+ inductor(from L to Cl); dlabel(-0.1,-0.1,L_2,,,X)
+
+ right_; resistor(from L to R); rlabel(,R_2,)
+ move down 0.3
+
+ resistor(from T to R); dlabel(0,0.15,,R_3,) ; b_current(y,ljust above)
+
+ line from L to 0.2<L,T>
+ source(to 0.5 between L and T); dlabel(sourcerad_+0.07,0.1,-,,+)
+ dlabel(0,sourcerad_+0.07,,u,)
+ resistor(to 0.8 between L and T); dlabel(0,0.15,,R_1,)
+ line to T
+ ]
+popdef(`elen_')
+popdef(`sourcerad_')
+
+[
+ Point_(225)
+{B1: ebox ; b_current; dlabel(dimen_*0.4,-0.1,i_1)
+ dot
+ B4: ebox(to rvec_(rp_len,0)); b_current(,,,E); dlabel(dimen_*0.4,-0.1,,,i_4) }
+ Point_(-45)
+ B2: ebox ; b_current; dlabel(dimen_*0.4, 0.1,i_2)
+ dot
+ B7: ebox ; b_current; dlabel(dimen_*0.4, 0.1,i_7)
+ B3: ebox(from B1.end to B2.end); b_current; dlabel(dimen_*0.4,0.1,i_3)
+ dot(at (B1.start,B7.end))
+{B5: ebox(to B1.end); b_current; dlabel(dimen_*0.4,-0.09,i_5)}
+{B6: ebox(to B2.end); b_current; dlabel(dimen_*0.4, 0.09,i_6)}
+{B8: ebox(right_ to B4.end); b_current; dlabel(dimen_*0.4, 0.1,i_8)}
+ B9: ebox(left_ to B7.end); b_current; dlabel(dimen_*0.4,-0.1,i_9)
+ ] with .w at last [].e+(0.5,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex05.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex05.m4
new file mode 100644
index 00000000000..af26c787814
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex05.m4
@@ -0,0 +1,65 @@
+.PS
+# ex05.m4
+darrow_init
+
+ fillval = 0.8 # environmental variable
+
+ dx = boxht/5 # diagram parameters wrt scaled env variables
+ circlerad = boxht*3/8
+ extlen=4*dx
+ indel = boxht/3
+
+COb: box fill_ "C$\bar{\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"
+
+ dline(from CbO.s down_ dx,,t,,!-)
+ dright
+{Sum: circle invis at (CO,Here)}
+ darrow(to Sum.e)
+
+SW: (COb.w,Sum.s)+(-3*dx-extlen/2,-dx)
+NE: (CbO.e,COb.n)+(dx,dx)
+ right_; shadebox(box wid NE.x-SW.x ht NE.y-SW.y with .sw at SW)
+
+U: "\bf u$\,$" rjust at COb.w-(3*dx+extlen,0)
+ dline(right_ extlen+dx,,t,,|-)
+TU: dtee(R)
+ {darrow(to COb.w,t)}
+ dline(to (Here,CO),t,t)
+{Dum: circle invis at (Here,Sum)}
+ dtee(L)
+ {darrow(to CO.w,t)}
+{D: box "D" wid boxwid/2 ht boxwid/2 at 0.5<Here,Dum.n>}
+ darrow(to D.n,t)
+ darrow(from D.s to Dum.n,,,,,,!-)
+
+ dline(up_ from CO.n to (CO,COb)-(0,indel),,t,,!-)
+ dleft; darrow(to (COb.e,Here))
+
+ dline(up_ from CbOb.n to (CbOb,COb),,t,,!-)
+ dleft; darrow(to COb.e)
+
+ dline(from CbO.n-(indel,0) up_ CbOb.y-CbO.n.y,,t,,!-)
+ dleft; darrow(to CbOb.e)
+
+ dline(up_ from CbO.n to (CbO,CO),,t,,!-)
+ dleft
+ darrow(to CO.e)
+
+ dline(up_ from CbO.n+(indel,0) to (CbO,COb)+(indel,indel),,t,,!-)
+ dleft; darrow(to (COb.e,Here))
+
+ darrow(from CO.s to Sum.n,,,,,,!-)
+
+ darrow(left_ from Sum.w to Dum.e)
+ darrow(from Dum.w to (U,Dum))
+ {"{\bf y$\,$}" rjust}
+ move left 0.23
+
+ circle at Sum
+ circle at Dum
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex06.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex06.m4
new file mode 100644
index 00000000000..4f6986a1337
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex06.m4
@@ -0,0 +1,67 @@
+.PS
+# ex06.m4
+gen_init
+
+F: box invis wid 1.6i ht 1.8i
+E: box invis wid F.wid ht F.ht
+G: box invis wid 1i ht F.ht
+
+ ell = F.ht-0.6i
+ r = 0.3i
+ offset = 8bp__
+ hatch = 0.1i
+ dhs = hatch * sqrt(2)
+ qmell = F.ht - ell
+ kwid = F.wid-qmell-r
+
+ box wid G.e.x-F.w.x ht F.ht with .sw at F.sw thick linethick*3/2
+ Loopover_(`B',
+ `line from B.ne to B.se thick linethick*3/2
+ B`'T: B.se + (-qmell,qmell)
+ line from (B.w,B`'T) to B`'T chop 0 chop -offset
+ line from B`'T up ell chop -offset chop 0
+ line from B`'T + (-r,0) up ell
+ line dashed from B`'T to B.se
+ "\large $0$" at B`'T + (-r/2,ell/2)
+ "\large $0$" at B`'T + (qmell/2,ell/2)
+ "$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_
+ ',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_
+
+ "$q$" at F.sw + (-offset,offset/3)
+ "$\ell$" at (F.w,FT) + (-offset,offset/3)
+
+ "$n{+}p{+}m$" at G.ne + (0,offset)
+
+ Loopover_(`B',`"\Large $B$" ht 0.2 with .n at B.s + (0,-offset/2)',F,E,G)
+
+ # extra left brace to avoid a psfrag problem (bug?)
+ sprintf(\
+ "$\vphantom{\{}\left.\vrule height %gin depth0pt width0pt\right\}r$",r/2) \
+ at ET + (offset,r/2)
+
+# Adjust the bounding box without using s_box:
+ move from F.nw+(-12bp__,21bp__) to G.se+(20bp__,-15bp__)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex07.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex07.m4
new file mode 100644
index 00000000000..56dfa7c198f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex07.m4
@@ -0,0 +1,69 @@
+.PS
+# ex07.m4
+gen_init
+Barrel: box invis ht 0.4 wid 1.5
+ up
+Face: arc rad 2.6 from Barrel.e+(2.4,-1.7/2) to Barrel.e+(2.4,1.7/2)
+
+ eps = 0.03
+ arc ccw rad 2.6 from Face.start-(eps,0) to Face.end-(eps,0) \
+ with .c at Face.c-(eps,0)
+ line from Barrel.nw to Barrel.ne then to Face.end
+ line from Barrel.sw to Barrel.se then to Face.start
+ arc cw from Barrel.sw to Barrel.nw rad Barrel.ht*1.2
+
+Cathode: Barrel.w+(0.3,0)
+Term: Barrel.w+(-0.25,0)
+ dcath = 0.13
+ dan = 0.12
+
+ line from Cathode up dcath/2 left dcath/2 then to Term.x,Cathode.y+dcath/2
+ dot
+ line from Cathode down dcath/2 left dcath/2 then to Term.x,Cathode.y-dcath/2
+ dot
+
+ hole = 0.06
+Hole: line invis up hole from Cathode+(0.5,-hole/2)
+ line from Hole.end up dan-hole/2 then to Term.x,Cathode.y+dan; dot
+ line from Hole.start down dan-hole/2 then to Term.x,Cathode.y-dan; dot
+
+ platewid = 0.25
+ platesep = 0.15
+Plates: box invis wid platewid ht platesep at Barrel.e+(-platewid/2,0)
+ line right platewid from Plates.nw
+ line right platewid from Plates.sw
+ line up 0.3 from Plates.n
+ line down 0.3 from Plates.s
+
+linethick_(1.4)
+psset_(linecolor=gray)
+
+ move to Cathode+(0.03,0)
+Spot: 0.9<Face.start,Face.end>
+ arcto(Plates.c,Spot,(Plates.c.x-Cathode.x)*0.90)
+ line to Spot chop 0 chop -0.02
+
+psset_(linecolor=black)
+thinlines_
+
+ arrow <- from Cathode+(0.2,0.06) up 0.5 left 0.3
+ "{\sl electron}" above "{\sl gun}" above
+
+ arrow <- from Plates.nw+(0,0.06) up 0.5 left 0.3
+ "{\sl deflection}" above "{\sl plates}" above
+
+ arrow <- from 0.5<Plates.e,Spot>+(0,0.06) up 0.5 left 0.3
+ "{\sl electron beam}" at Here+(-0.3,0) above
+
+ spline <- from 1.015<Plates.e,Spot> right 0.1 up 0.1 then up 0.1 \
+ then up 0.1 left 0.1
+ "{\sl spot of light}sp_" rjust
+
+ "{\sl vacuum}sp_" at 0.5<Face.start,Face.end>+(-0.4,0) rjust
+
+ arrow <- from Face.start+(0.1,0.5) left 0.6*1.4 down 0.3*1.4
+ "{\sl phosphor coating}sp_" rjust
+
+ arrow <- from 0.2<Barrel.se,Face.start> left 0.6 down 0.3
+ "{\sl glass enclosure (tube)}sp_" rjust
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex08.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex08.m4
new file mode 100644
index 00000000000..379ba0cadd5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex08.m4
@@ -0,0 +1,81 @@
+.PS
+# ex08.m4
+log_init
+
+define(`del',`L_unit*5/2')
+
+# Input labels
+C: grid_(0,0); "\sf C sp_" rjust at C
+DE: C+grid_(0,AND_ht*7/4)
+A0: DE+grid_(0,BUF_ht*3/2); "\sf A0 sp_" rjust at A0
+A1: A0+grid_(0,BUF_ht*3/2); "\sf A1 sp_" rjust at A1
+A2: A1+grid_(0,BUF_ht*3/2); "\sf A2 sp_" rjust at A2
+ move to (-0.2,0) # Lettering within the global object
+
+# Buffer strings
+for_(1,3,1,
+ `line right 3*del from A`'eval(3-m4x)
+ B`'eval(2*m4x-1): NOT_gate; line right 2*del
+ T`'m4x: last line.c
+ B`'eval(2*m4x): BUFFER_gate(,N) ')
+
+B7: BUFFER_gate at (B1,C)
+
+G1: NOR_gate with .Out at (B1.Out,DE)
+G2: NOR_gate at (B2+grid_(N_rad,0),G1-grid_(0,AND_ht))
+G3: AND_gate(4) with .In1 at (G2.Out+(9*del,0),A2)
+G5: AND_gate(4) with .In4 at (G3.In1,G2.Out)
+G6: AND_gate at G5+grid_(AND_wd,AND_ht*3/4)+(del*2,0)
+G4: NOR_gate with .In1 at (G6.Out,G3)+(2*del,0)
+G7: NOR_gate with .In2 at (G4.In2,G5.Out)
+
+# Output to other latches
+TOL: (G2.Out,C)+(4*del,-4*L_unit)
+ move to TOL+(3*del,-del/3) ; {move down 0.15}
+ "\sf {\sl To other latches}" below
+
+# Remaining input lines
+ line from G1.In1 to (DE,G1.In1); "\sf D sp_" rjust
+ line from G1.In2 to (DE,G1.In2); "\sf E sp_" rjust
+ dot(at G1.In2-(del,0)); line to (Here,G2.In2) then to G2.In2
+ line from C to B7.In1
+
+# Connect Bi, and connect to output bus
+for_(1,3,1,
+ `dot(at T`'m4x.c) ; line down (A2.y-A1.y)/2
+ line to (TOL-(m4x*del,0),Here) ; arrow to (Here,TOL) ')
+
+# G1 to G2
+ dot(at (T1.c,G1)); line to (Here,G2.In1) then to G2.In1
+
+# Upper And inputs to output bus
+for_(1,4,1,
+ `line left eval(5-m4x)*del from G3.In`'m4x
+ arrow to (Here,TOL) ')
+
+ line from B2.Out to (G3.In1,B2)-(4*del,0) ; dot
+ line from B4.Out to (G3.In2,B4)-(3*del,0) ; dot
+ line from B6.Out to (G3.In3,B6)-(2*del,0) ; dot
+ line from G1.Out to (G3.In4,G1)-(del,0) ; dot
+
+# Lower And inputs
+ line left 4*del from G5.In1 ; dot
+ line left 3*del from G5.In2 ; dot
+ line left 2*del from G5.In3 ; dot
+ line from G2.Out to G5.In4 ; dot(at (TOL,Here)) ; arrow to (Here,TOL)
+
+# Fix up G4, G6, G7
+ line from G3.Out to G4.In1
+ line right del from G4.Out
+ {dot; line right del ; "\sf sp_ Q7" ljust; move right 0.2 } # letters in object
+ line down 2*del then to G6.In1+(-del,del)
+ line to (Here,G6.In1) then to G6.In1
+ line from G4.In2 to (G6.In1+(-del,0),G4.In2)
+ line down del then to G7.Out+(del,2*del)
+ line to (Here,G7) then to G7.Out
+ line from G6.Out right del ; line to (Here,G7.In1) then to G7.In1
+ line from G5.Out to G7.In2
+ line left del from G6.In2 ; arrow to (Here,TOL)
+ dot(at (Here,C)) ; line to B7.Out
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex09.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex09.m4
new file mode 100644
index 00000000000..a5ee6f11095
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex09.m4
@@ -0,0 +1,135 @@
+.PS
+# ex09.m4
+# Illustrating the arguments of the `dimension_' macro.
+gen_init
+sinclude(F_ex09.dim)
+sinclude(examples.dim)
+s_init(ex09)
+scale = 25
+
+define(`spacer',`
+[
+iflatex(`ifpsfrag(`textht = 7.5bp__; textoffset = 0.5bp__',
+ `latexcommand({\sf)') ')
+linethick_(1.0)
+
+ WC: circle diameter 4.22 at 0,0
+ EC: circle same at 30.15,0
+ NC: circle diameter 2.36 at 13.28, 10.92/2
+ SC: circle same at 13.28,-10.92/2
+
+ C: 0.5<WC,EC> # spacer centre
+ h = 27.26 # spacer height
+ s = 4.22/2 # small arc radius
+ r = h/2*0.80 # large arc radius
+ Cr: C+(0,h/2-r) # upper arc centre
+ e = s # small arc centre offset from small circle
+ Cs: EC+(e,0) # right arc centre
+
+# Tangent points Tr and Ts to circles at Cr and Cs
+ dx = Cr.x-Cs.x; dy = Cr.y-Cs.y; dsq = dx*dx+dy*dy
+ Tr: (r*(r-s)/dsq)<Cr,Cs> + (vscal_(r*sqrt(dsq-(r-s)^2)/dsq,dy,-dx))
+ Ts: (s/r)<Cr,Tr>-(dx,dy)
+
+ line from Tr to Ts
+ arc cw to (Ts.x,-Ts.y) with .c at Cs
+E: last arc.e
+ line to (Tr.x,-Tr.y)
+ arc cw to (C.x-(Here.x-C.x),Here.y) with .c at (Cr.x,-Cr.y)
+S: last arc.s
+ line to (Cs.x-Ts.x-s,Cs.y-Ts.y)
+ arc cw to (Here.x,-Here.y) with .c at (-e,0)
+W: last arc.w
+ line to (C.x-(Tr.x-C.x),Tr.y)
+ arc cw to Tr with .c at Cr
+N: last arc.n
+
+thinlines_
+ dimension_(from S+(2,0) to N+(2,0),-(E.x-C.x+4),s_box(27.76), H)
+ dimension_(from SC.n+(0,2) left SC.x-WC.x, (SC.n.y-S.y+3), s_box(13.28), W)
+ dimension_(from WC.n+(0,2) right EC.x-WC.x,-(WC.n.y-S.y+7), s_box(30.15), W)
+ dimension_(from W+(0,-1.5) to E+(0,-1.5), -(C.y-S.y+8), s_box(41.28), W)
+ dimension_(from SC.e+(2,0) up NC.y-SC.y, (SC.e.x-W.x+8), s_box(10.92), H)
+
+ arrow <- from EC left 6 up 16 chop EC.rad chop 0
+ line left 4 "4.22 (2) PL" above
+ arrow <- from NC up last line.y-NC.y+7/8 left 8 chop NC.rad chop 0
+ {"2.36" above}
+ arrow to SC chop 0 chop SC.rad
+iflatex(`ifpsfrag(,`latexcommand(})')')
+] ')
+
+define(`sk',`scale*0.7')
+
+define(`bdot',
+ `dot(`$1',,0.5)
+ s_box($`$2'$\strut) `$1' `$3' ')
+
+ thinlines_
+# Upper left diagram
+ spacer
+
+# Lower left diagram
+[ define(`lwid',`29bp__')
+A: bdot(at (0,0),A,below)
+B: bdot(at (2*sk,0),B,below)
+Ctr: 0.5 between A and B
+
+ linethick_(1)
+ dimension_(from A to B,0.5*sk,\sl label,lwid,0.1*sk)
+ s_box(`\tt dimension\_(from A to B,0.5,\char92 sl label,29bp\_\_,0.1)') \
+ with .sw at A+(-0.8*sk,-0.7*sk)
+
+ thinlines_
+ arrow from A to B chop 0.05*sk "\sl linespec" below
+ dimension_(up_ 0.5*sk from A,0.2*sk,"\sl offset\ {}" rjust,,,->)
+ dimension_(up_ 0.1*sk from B,-0.2*sk)
+ s_box(\ \sl tic offset) with .nw at 2nd last arrow
+ dimension_(up_ 0.1*sk from B+(0,0.5*sk),-0.2*sk)
+ s_box(\ \sl tic offset) with .nw at 2nd last arrow
+ dimension_(from Ctr+(-lwid/2,0.5*sk) right lwid,0.2*sk,
+ "\strut\sl blank width" above)
+ move up 1*sk from A
+] with .nw at last [].sw+(0,-0.6*sk)
+
+# Right diagram
+[ A: bdot(at (0,0),A, above rjust)
+ B: bdot(at (2*sk,0),B, above ljust)
+ C: bdot(at (0,-1.5*sk),C, above rjust)
+ D: bdot(at (2*sk,-1.5*sk),D, above ljust)
+
+T: C+(-1*sk,-0.5*sk)
+T: C+(-0.45*sk,-1.0*sk)
+ dimension_(from A to B,0.3*sk,$AB$,20bp__)
+
+ s_box(`\tt dimension\_(from A to B,0.3,\$AB\$,20bp\_\_)') \
+ with .sw at T
+
+ dimension_(from C to B chop dotrad_,,$X$,16bp__)
+ s_box(`\tt dimension\_(from C to B,,\$X\$,16bp\_\_)') \
+ with .sw at T+(0,-13bp__)
+
+ dimension_(from C to A,0.3*sk,$CA$,14bp__,,->)
+ s_box(`\tt dimension\_(from C to A,0.3,\$CA\$,14bp\_\_,,->)') \
+ with .sw at T+(0,-2*13bp__)
+
+ dimension_(from D to B,-0.3*sk,"$DB$" ljust)
+ s_box(`\tt dimension\_(from D to B,-0.3,\"\$DB\$\" ljust)') \
+ with .sw at T+(0,-3*13bp__)
+
+ dimension_(from C to D chop dotrad_,,s_box($T^{%g}$,15),W)
+ s_box(
+ `\tt dimension\_(from C to D,,s\_box(\$T\char94\char123\%g\char125\$,15),W)')\
+ with .sw at T+(0,-4*13bp__)
+
+ arcdimension_(from C to D with .c at \
+ 0.5 between A and B,12bp__,s_box($C$ to $D$),W)
+ s_box(
+ `\tt arcdimension\_(from C to D with .c at \smash{\char92}') \
+ with .sw at T+(0,-5*13bp__)
+ s_box(`\tt 0.5 between A and B,12bp\_\_,s\_box(\$C\$ to \$D\$),W)') \
+ with .sw at T+(5,-6*13bp__)
+
+] with .nw at 1st [].ne+(0.8*sk,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex10.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex10.m4
new file mode 100644
index 00000000000..cb9d3ed2e47
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex10.m4
@@ -0,0 +1,56 @@
+.PS
+# ex10.m4
+cct_init
+
+[
+ dt = 360/5
+ r = 0.75
+
+ N0: dot(at (Rect_(r,90)))
+ N1: dot(at (Rect_(r,(90-dt))))
+ N2: dot(at (Rect_(r,(90-2*dt))))
+ N3: dot(at (Rect_(r,(90-3*dt))))
+ N4: dot(at (Rect_(r,(90-4*dt))))
+
+ line from N0 to N1 then to N2 then to N3 then to N4 then to N0
+ L14: line from N1 to N4
+ L24: line from N2 to N4
+ C02: crossover(from N0 to N2,,L14)
+ C13: crossover(from N1 to N3,,C02,L24)
+ C03: crossover(from N0 to N3,,L14,L24)
+ ]
+
+[
+ up_
+rgbdraw(1,0,0,
+Q1: bi_tr(,R) # Q1 upward with base to the right
+ llabel(,Q_1) ) # Label to left of last []
+rgbdraw(0,0,1,
+Q2: bi_tr with .C at Q1.C+(elen_*7/4,0) # Q2 with base to left
+ rlabel(,Q_2) )
+
+ ground(at Q1.E)
+ ground(at Q2.E)
+
+ line right_ dimen_/3 from Q1.B # Extend the base conductors
+B1: Here
+ line left_ dimen_/3 from Q2.B
+B2: Here
+
+ resistor(up_ elen_*0.75 from Q1.C); llabel(,"$R_L$" wid 0.16) # Load resistors
+ line to (Q2.C,Here) "$V_{\hbox{cc}}$" below
+ resistor(down_ to Q2.C); llabel(,R_L)
+
+ move to Q1.C+(0,dimen_/5)
+ { resistor(right_ to (B1,Here)); llabel(,R_1)
+X: line to B2 } # Label the line to be jumped
+ resistor(from (Q2.C,Here) left_ to (B2,Here)); rlabel(,R_1)
+ crossover(to B1,R,X)
+
+ resistor(down_ elen_*0.75); rlabel(,R_2) # Bias resistors
+ {"$-V_{\hbox{cc}}$" rjust}
+ line to (B2,Here)
+ resistor(up_ to B2); rlabel(,R_2)
+ ] with .sw at last [].se+(0.75,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex11.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex11.m4
new file mode 100644
index 00000000000..3e1062d7707
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex11.m4
@@ -0,0 +1,74 @@
+.PS
+# ex11.m4
+cct_init
+
+ "sp_{audio}" ljust
+ { arrow down_ elen_/4}
+ resistor(down_ 2*elen_) ; llabel(R_{17})
+G: ground
+ capacitor(right_ dimen_ from last [].c) ; rlabel(,C_{19})
+ {arrow <- right_ arrowht from last line.start}
+ { resistor(down_ to (Here,G)); rlabel(,R_{19}) }
+{R18: resistor(up_ elen_*1.2); llabel(,R_{18}) }
+
+ line right_ elen_/4 ; up_
+Q4: bi_tr(,,,E) with .B at Here; llabel(,,Q_4)
+ resistor(down_ from Q4.E to (Q4.E,G)); rlabel(,R_{21})
+ resistor(up_ from Q4.C to (Q4.C,R18.end)); llabel(,R_{20})
+ line up_ elen_/4; dot; "$V_{CC}$" ljust
+
+T1: Q4.C+(0,elen_/8)
+
+ capacitor(right_ dimen_ from T1); llabel(,C_{20})
+ { capacitor(down_ 0.5*(Here.y-G.y)); rlabel(,C_{21})
+ resistor(right_ elen_); llabel(,R_{23})
+ arrow <- from last [] to (last [],G)
+ }
+ resistor(right_ elen_); llabel(,R_{22})
+ { resistor(down_ 0.5*(Here.y-G.y)); llabel(,R_{24})
+ capacitor(down_ to (Here,G)); llabel(,C_{22}) }
+
+ capacitor(right_ dimen_); llabel(,C_{23})
+ { capacitor(down_ to (Here,G)); rlabel(,C_{24}) }
+ line right_ elen_/2
+Q5I: Here
+ line right_ elen_/4 ; up_
+Q5: bi_tr(,,,E) with .B at Here; rlabel(,Q_5)
+R27: resistor(down_ dimen_ from Q5.E); rlabel(,R_{27})
+ line to (Here,G)
+ resistor(from Q5I down_ Q5I.y-R27.end.y-elen_/12); rlabel(,R_{25})
+ { capacitor(to (Here,G)); llabel(,C_{25}) }
+
+ crossover(to (R27,Here)+(hoprad_,0),,R27)
+R28: resistor(right_ elen_-hoprad_); llabel(,R_{28})
+ resistor(down_ to (Here,G)); rlabel(,R_{30})
+ line to G
+
+ resistor(up_ from Q5.C to (Q5.C,R18.end)); llabel(,R_{26})
+ line to R18.end
+
+ up_
+Q6: bi_tr(,,,E) with .E at (R28.end.x,Q5.E.y+(T1.y-Q4.B.y)); llabel(,,Q_6)
+
+ line from Q6.B to (Q5.C,Q6.B)
+ resistor(down_ from Q6.E to R28.end); rlabel(,R_{29})
+
+ line right_ dimen_*3/4 from Q6.C
+
+ { R31: resistor(down_ elen_); circle diam dimen_*0.8 with .c at last line.c
+ "$R_{31}$" below at last circle.sw
+ "$V$" below at last line.c+(dimen_/4,0) }
+ line right_ dimen_
+ { capacitor(down_ elen_); rlabel(,,C_{26})
+ line down_ elen_/4; dot; "sp_$V_{SS}$" ljust }
+ line right_ dimen_/2
+T6: transformer(down_ elen_) with .P1 at Here
+ line from T6.P2 to R31.end
+ {"$T_6$" at T6.n above }
+ line right_ elen_/3 from T6.S1
+ inductor(down_ elen_,W)
+ line to T6.S2
+
+ speaker(R) with .Box.w at last [].e+(dimen_/8,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex12.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex12.m4
new file mode 100644
index 00000000000..487740fd6fd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex12.m4
@@ -0,0 +1,133 @@
+.PS
+# ex12.m4
+cct_init
+
+[
+ fetht = dimen_*0.9
+
+G: ground
+Q4: e_fet(up_ fetht) with .S at G
+Q3: e_fet(up_ fetht) with .S at Q4.D
+
+Q2: e_fet(down_ fetht,R,P) with .G at Q3.Channel+( dimen_*0.25,dimen_*1.8)
+Q1: e_fet(down_ fetht,R,P) with .G at Q2.G + (-dimen_*1.25,0)
+
+ line left_ dimen_ from Q3.G
+A: dot; "$A$sp_" rjust
+ line left_ dimen_ from Q4.G
+B: dot; "$B$sp_" rjust
+
+ line from Q1.G to (Q1.G,Q3.D) then to (Q1.Channel,Q3.D) \
+ then to (Q1.Channel,B);dot
+ line from Q2.G to (Q3.Channel,Q2.G) then to (Q3.Channel,Q3.D) \
+ then to (Q3.G,Q3.D) then to Q3.G;dot
+ line from Q1.D to Q2.D
+ line from Q1.S to Q2.S
+ dot(at (G,Q1.S)) ; line up dimen_/3 ; "$+5$V{}sp_" rjust
+ line from Q3.D to (Q3.D,Q2.D);dot
+ dot(at Q3.D)
+ line right_ dimen_ ; dot ; "sp_$\overline{AB}$" above
+]
+
+[
+ del = dimen_/3
+
+define(`pair',`[
+Q1: c_fet(up_ dimen_,,P)
+ line right dimen_*2/3 from Q1.D
+ {dot(at last line.c); reversed(`source',up_ dimen_,I); Rail: Here
+ line right dimen_/2 with .c at Here}
+Q2: c_fet(up_ dimen_,R,P) with .D at Here
+ line down del*2 from Q2.S
+ resistor(down_ dimen_)
+Gnd: ground(,T,S)
+ ]')
+
+P1: pair
+Rail: P1.Rail
+Vc: dot(at P1.Q2.S+(0,-del)); "$V_{\hbox{\small c}}$" rjust
+ line from P1.Q1.G to (P1.Q1.G,Rail)+(0,del/2); "$S{+}$" ljust
+
+ line right_ del from P1.Q2.G
+ {dot(at last line.c); line up del; "$V_{\hbox{\small ref}}$" above}
+ pht = P1.Rail.y-P1.Gnd.y
+
+P2: pair with .Q1.G at Here
+Vcp: dot(at P2.Q2.S+(0,-del*2)); {"$V_{\hbox{\small c$'$}}$" above rjust}
+ {line to (P1.Q1.S,Here) then to P1.Q1.S}
+ line from P2.Q2.G to (P2.Q2.G,Rail)+(0,del/2); "$S{-}$" rjust
+
+ line from Vc to (P2.Q1.S,Vc) then to P2.Q1.S
+
+define(`cpair',`[
+Rail: line right dimen_/2
+Q1: c_fet(up_ dimen_,,P) with .D at last line.c
+Q2: c_fet(up_ dimen_) with .S at Rail.c+(0,-pht)
+ ground(at Q2.S,T,S)
+ line from Q1.G to Q2.G
+ line from Q1.S to Q2.D
+ ]')
+
+S1: cpair with .Rail at P2.Rail+(P2.Q2.G.x-P2.Rail.x+P2.Q2.G.x-P2.Q2.D.x+del,0)
+S2: cpair with .Q1.G at (S1.Q1.D.x+del,S1.Q1.G.y)
+S3: cpair with .Rail at 2 between S1.Rail and S2.Rail
+
+ line from Vcp to (S2.Q2.G,Vcp); dot
+ dot(at (S2.Q2.D,Here)); line to (S3.Q2.G,Here); dot
+ dot(at (S3.Q2.D,Here)); arrow right del; "$e_2$" ljust
+ dot(at P2.Q1.S); line to (S1.Q1.G,Here); dot
+ dot(at (S1.Q2.D,Here)); arrow to (last arrow.end,Here); "$e_1$" ljust
+
+
+] with .sw at last [].se+(0.25,0)
+
+[
+ elen=0.2
+
+VDD: dot; llabel(,V_{DD},)
+ line down_ elen/2
+P1: mosfet(up_,,ZSDFdTX,) with .D at Here
+
+MIDDLE: line from P1.S down_ elen/2
+
+N1: mosfet(up_,,ZSDFTX,) with .D at Here
+N2: mosfet(up_,,ZSDFTX,) with .D at N1.S
+ ground(at N2.S)
+
+ING: P1.G+(-elen/2,0)
+
+ line from P1.B right_ elen * 2/5 then down_ elen * 4/5
+ line to (ING, Here)
+ dot
+
+ line from N1.B right_ elen * 2/5 then up_ elen * 4/5
+ line to (ING, Here)
+ dot
+
+ line from N1.G to (ING,N1.G)
+ dot
+
+ line from N2.G to (ING,N2.G) then to ING then to P1.G
+
+ dot(at (ING,MIDDLE))
+ line left_ elen*2
+ "$V_{\hbox{\scriptsize in}}$" above
+
+ dot(at MIDDLE)
+ line right_ elen*2
+ { "$V_{\hbox{\scriptsize out}}$" above }
+
+ line from N2.B to (Here,N2.B)
+ "$V_{BB}$" above
+
+PUNT:dot(at 0.5 between N1.S and N2.D)
+
+ "$V_x$" ljust
+
+ "$P_1$" at P1.Channel.end above rjust
+ "$N_1$" at N1.Channel.start below rjust
+ "$N_2$" at N2.Channel.start below rjust
+
+] with .sw at last [].se
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex15.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex15.m4
new file mode 100644
index 00000000000..3b7092a51a9
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex15.m4
@@ -0,0 +1,40 @@
+.PS
+# ex15.m4
+gen_init
+
+[
+n = 10; r = 1
+for i = 1 to n-1 do {
+ for j = i+1 to n do {
+ line from rect_(r,i*twopi_/n) to rect_(r,j*twopi_/n)
+ }
+ }
+ ]
+[
+ linethick = 2.5
+ crad = 1.0
+ C: circle rad crad
+ g = 0.65
+ D: C+(Rect_(crad*g,110))
+ rm = crad+distance(C,D)
+ for r=lthick to rm by 2*lthick do {
+ if r < (1-g)*crad then { circle rad r at D thick r/rm*linethick } \
+ else { arc cw from Cintersect(D,r,C,crad) \
+ to Cintersect(D,r,C,crad,R) with .c at D thick r/rm*linethick }
+ }
+
+ linethick = 1.5
+ C: circle invis rad crad with .w at C.e+(0.1,0)
+ D: C+(Rect_(crad*g,110))
+ a = 1 # fade rate parameter
+ for r=lthick to rm by lthick do {
+ u = 1-(r/rm*(a*r/rm+(1-a)))
+ if r < (1-g)*crad then { circle outlined rgbstring(u,u,u) rad r at D } \
+ else { arc cw outlined rgbstring(u,u,u) from Cintersect(D,r,C,crad) \
+ thick linethick*1.5 to Cintersect(D,r,C,crad,R) with .c at D
+ }
+ }
+ circle rad C.rad at C
+ ] with .w at last [].e+(0.1,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex16.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex16.m4
new file mode 100644
index 00000000000..6d34455bfda
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex16.m4
@@ -0,0 +1,67 @@
+.PS
+# ex16.m4
+cct_init
+[
+define(`elen_',linewid*1.2)
+ circlerad = delay_rad_
+ {"\sl input" above ljust}
+ line right_
+J: Here
+ delay
+K: Here
+ delay
+L: Here
+S1: circle "$+$" at (K.x,K.y+linewid)
+S2: circle "$+$" at (L,S1)
+ arrow up_ S1.y-J.y from J then to S1.w
+ arrow from K to S1.s
+ arrow from S1.e to S2.w
+ arrow from L to S2.s
+S3: circle "$+$" at (L.x,L.y-linewid)
+ arrow down_ J.y-S3.y from J then to S3.w
+ arrow from L to S3.n
+ arrow from S2.e right_ linewid/2 then down_ (S2.y-S3.y)/2-circlerad \
+ then right_ linewid/2
+ arrow from S3.e right_ linewid/2 then up_ (S2.y-S3.y)/2-circlerad \
+ then right_ linewid/2
+ "\sl output" at 0.5<last arrow.end, 2nd last arrow.end>
+ ]
+[
+ circlerad = 0.35/2
+ d = linewid*1.75
+ S00: circle "$00$"
+ S10: circle "$10$" at S00+(d,d)
+ S01: circle "$01$" at S00+(d,-d)
+ S11: circle "$11$" at S01+(d,d)
+ dx = circlerad*cosd(60)
+ dy = circlerad*sind(60)
+ brad = circlerad*1.3
+ qrad = circlerad*6
+
+ arc -> cw from S00+(-dx,-dy) to S00+(-dx,dy) rad brad \
+ with .c at S00-(dx+sqrt(brad^2-dy^2),0)
+ "$0/00$" at last arc.w rjust
+ right
+ arc -> cw from S00+(dx,dy) to S10+(-dy,-dx) rad qrad
+ "$1/11$" at last arc.nw rjust above
+ right
+ arc -> cw from S10+(dy,-dx) to S11+(-dx,dy) rad qrad
+ "$1/01$" at last arc.ne ljust above
+ up_
+ arc -> cw from S11+(dx,dy) to S11+(dx,-dy) rad brad \
+ with .c at S11+(dx+sqrt(brad^2-dy^2),0)
+ "$1/10$" at last arc.e ljust
+ down_
+ arc -> cw from S11+(-dx,-dy) to S01+(dy,dx) rad qrad
+ "$0/01$" at last arc.se ljust below
+ left_
+ arc -> cw from S01+(-dy,dx) to S00+(dx,-dy) rad qrad
+ "$0/11$" at last arc.sw rjust below
+ up_
+ arc -> cw from S01+(-dx,dy) to S10+(-dx,-dy) rad qrad*2
+ "$1/00$" at last arc.w rjust
+ down_
+ arc -> cw from S10+(dx,-dy) to S01+(dx,dy) rad qrad*2
+ "$0/10$" at last arc.e ljust
+ ] with .sw at last [].se+(0.4,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex17.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex17.m4
new file mode 100644
index 00000000000..a0cd527986f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex17.m4
@@ -0,0 +1,43 @@
+.PS
+# ex17.m4
+cct_init
+
+[
+nrows = 4
+ncols = 9
+linewid = linewid*0.6 # everything smaller
+define(`elen_',linewid) # shorter default length
+
+ for j = 1 to nrows do {
+ { for i = 1 to ncols do {
+ Point_(-120) resistor
+ Point_( 0) inductor
+ Point_( 120) capacitor
+ if i < ncols then {Point_(0) diode} }
+ }
+ Point_(-120) move to rvec_(elen_,0)
+ { for i = 1 to ncols do {
+ Point_(-60) capacitor
+ Point_( 60) resistor }
+ }
+ Point_(-60) move to rvec_(elen_,0)
+ }
+ Point_(0) for i = 1 to ncols-1 do { inductor }
+]
+
+[ # an exercise of the `parallel_' macro:
+ down_ # for labelling
+ Point_(-80) # skew current direction
+
+ parallel_(Sep=1.75*dimen_;
+ parallel_(
+ `capacitor(,C); rlabel(,,C_2)',
+ `resistor; llabel(,R_2)' ),
+ parallel_(
+ `resistor; rlabel(,R_1); move to rvec_(-dimen_/5,0)
+ inductor(,W); rlabel(,L_1)',
+ `reversed(`source',to rvec_(elen_,0),V,sourcerad_*2.5); rlabel(,v_s)' )
+ )
+
+] with .sw at last [].se+(elen_,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex18.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex18.m4
new file mode 100644
index 00000000000..201e8fee622
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex18.m4
@@ -0,0 +1,37 @@
+.PS
+# ex18.m4
+cct_init
+
+[
+ "$v_i$" rjust; dot
+ resistor(right_ dimen_) ; llabel(,R_i)
+T: dot
+ line right_ linewid/4
+A: opamp with .In1 at Here
+
+ line from A.In2 to (T,A.In2)
+ resistor(down_ dimen_) ; rlabel(,R_g)
+ ground(,T)
+
+ line right_ dimen_ from A.Out
+ diode(up_ dimen_); dot
+ {line right_ linewid/2; dot; "$v_o$" ljust }
+ resistor(left_ to (A.Out,Here)) ; rlabel(,R_o); dot
+ { diode(down_ to A.Out); dot }
+ line to (T,Here) then to T
+]
+
+[
+define(`dimen_',dimen_*1.25)
+
+B: battery(up_ dimen_*2/3); rlabel(,V^o)
+ move down dimen_/4
+ resistor(up_ dimen_); rlabel(,R,)
+ inductor(right_ elen_); b_current(i); rlabel(,L)
+ { capacitor(down_ to (Here,B.start)); rlabel(,C); llabel(+,v,-) }
+ line right_ dimen_
+ diode(down_ to (Here,B.start),T); b_current(h(v))
+ line to B.start
+] with .nw at last [].ne+(20bp__,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ex21.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex21.m4
new file mode 100644
index 00000000000..7bd2c584e51
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ex21.m4
@@ -0,0 +1,64 @@
+.PS
+# ex21.m4
+log_init
+ iflatex(`textoffset = 1bp__; ifpsfrag(,`latexcommand({\sf)') ')
+
+dy = 0.2
+ddy = 1.8*dy
+
+D: FlipFlop(D)
+ `"\tt FlipFlop(D)"' at last [].s+(0,-ddy) above
+T: FlipFlop( T) with .Chip.sw at last [].se + (0.4,0)
+ `"\tt FlipFlop(T)"' at last [].s+(0,-ddy) above
+RS: FlipFlop(RS) with .Chip.sw at last [].se + (0.4,0)
+ `"\tt FlipFlop(RS)"' at last [].s+(0,-ddy) above
+JK: FlipFlop(JK) with .Chip.sw at last [].se + (0.4,0)
+ `"\tt FlipFlop(JK)"' at last [].s+(0,-dy) above
+
+# Test 3: synchronous 3-bit counter
+define(`counterFF',``$1':FlipFlop(JK) `$2'
+ "\sf\scriptsize `$1'" at `$1'.Chip.sw below ljust
+ "\sf\scriptsize $`'1$" at `$1'.PinCLR.end above
+ "\sf\scriptsize $`'1$" at `$1'.PinPR.end below')
+
+[
+right_
+ counterFF(FF0)
+ counterFF(FF1,with .Chip at FF0.Chip+(-28*L_unit,0))
+ counterFF(FF2,with .Chip at FF1.Chip+(-28*L_unit,0))
+ "\sf\scriptsize $1$sp_" at FF0.PinJ.end rjust
+ "\sf\scriptsize $1$sp_" at FF0.PinK.end rjust
+Dc: FF2.Chip.sw+(-9*L_unit,-7*L_unit)
+Bot: Dc+(0,-3*L_unit)
+
+left_
+AndG: AND_gate at FF1.Chip.nw+(4*L_unit,12*L_unit)
+right_
+
+ line from FF2.PinCK.end left 3*L_unit
+ line to (Here,Dc); dot
+ line from FF1.PinCK.end left 3*L_unit
+ line to (Here,Dc); dot
+ line from FF0.PinCK.end left 3*L_unit
+ line to (Here,Dc) then to Dc
+ "\sf\scriptsize $D_C$ sp_" rjust
+
+ line from FF2.PinK.end to FF2.PinJ.end; dot
+ line to (Here,AndG.Out) then to AndG.Out
+
+ line from FF1.PinK.end to FF1.PinJ.end; dot
+ line to (Here,FF1.PinCLR.end+(0,3*L_unit))
+ line to (AndG.In2+(6*L_unit,0),Here) then to AndG.In2+(6*L_unit,0); dot
+
+ line from FF0.PinQ.end right 0.1; dot
+ line from AndG.In2 to (Here,AndG.In2) then to (Here,Bot); "$D_{00}$" below
+
+ line right 0.1 from FF1.PinQ.end; dot
+ line from AndG.In1 to (Here,AndG.In1) then to (Here,Bot); "$D_{01}$" below
+
+ line right 0.1 from FF2.PinQ.end
+ line to (Here,Bot); "$D_{02}$" below
+ ] with .n at 0.5<2nd[].s,3rd[].s> - (0,0.4)
+
+ iflatex(ifpsfrag(,`latexcommand(})'))
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.pdf b/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.pdf
new file mode 100644
index 00000000000..da082ee704a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.pdf
Binary files 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
new file mode 100644
index 00000000000..6ab8d803150
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/examples.tex
@@ -0,0 +1,34 @@
+% PSTricks examples.tex
+
+\documentclass[11pt]{article}
+\usepackage{times}
+%\usepackage{pstricks,pst-grad}
+\input mode
+\usepackage{rotating}
+\usepackage{graphicx}
+\usepackage{boxdims}
+\usepackage{upgreek}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\usepackage{amssymb}
+
+\input header
+
+\global\psttrue
+
+\begin{document}
+ \hfill
+ {\large\bf Examples:
+ \input{Version.tex}}
+ \hfill\break
+
+ This is a collection of diagrams the author has had occasion to produce
+ using m4 circuit macros and others, and gpic or dpic. In some cases
+ there are other or better m4 or pic constructs for producing the
+ same drawings, but the source-file names are shown for reference.
+ Most of the examples can be processed using either dpic~-p or gpic~-t,
+ but the possibility of other postprocessing has meant that sometimes
+ the source is slightly more complicated than it would be if only
+ one workflow had been assumed. The most simplicity and elegance is
+ achieved by sticking to one pic interpreter and one postprocessor.
+
+\input files
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/exp.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/exp.m4
new file mode 100644
index 00000000000..c518eb9bcfe
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/exp.m4
@@ -0,0 +1,258 @@
+.PS
+# exp.m4
+threeD_init
+NeedDpicTools
+
+# Graduated shading is probably best done using the built-in functions
+# of PSTricks or the somewhat equivalent tikz capabilities. Other
+# postprocessors do not have the same functionality so the following
+# demonstrates how it can be done in the pic language with m4 macros.
+# See the macro `PhadedPolygon' in libgen.m4
+
+# Projected box object:
+[
+g = 1.2
+define(`axlen',1.2*g)
+define(`O3',`0,0,0')
+define(`X0',`axlen,0,0')
+define(`Y0',`0,axlen,0')
+define(`Z0',`0,0,axlen')
+
+# diagram viewing angle
+dazim = 54
+delev = 15
+setview(dazim,delev)
+
+# projection azimuth, elevation
+pazim = 20*dtor_
+pelev = 35*dtor_
+arad = 0.6*g
+
+# object displacement
+define(`D3',`0.3*g,0.6*g,0.9*g')
+
+# fixed coordinate frame
+O: project(O3)
+X: project(X0)
+Y: project(Y0)
+ Fector(X0,Z0) with .Origin at O ; "$x_0$" at X rjust
+ Fector(Y0,Z0) with .Origin at O ; "$y_0$" at Y ljust below
+ Fector(Z0,Y0) with .Origin at O ; "`$z_0$'" at project(Z0) above
+
+define(`R01',`rot3Dz(pazim,rot3Dy(-pelev,$1,$2,$3))')
+define(`R10',`rot3Dy(pelev,rot3Dz(-pazim,$1,$2,$3))')
+
+thinlines_ ; psset_(linecolor=gray)
+ line from O to project(rot3Dz(pazim,axlen,0,0))
+psset_(linecolor=black)
+ arc -> ccw from project(arad,0,0) to project(rot3Dz(pazim,arad,0,0)) rad arad
+ "$\theta$" below
+ up_
+ arc -> cw from project(rot3Dz(pazim,arad,0,0)) \
+ to project(R01(arad,0,0)) rad arad
+ "$\phi$" rjust at project(rot3Dz(pazim,rot3Dy(-pelev/2,arad,0,0)))
+ arc -> from project(0,arad,0) to project(R01(0,arad,0)) rad arad
+ "$\theta$" above
+ right_
+ arc -> cw from project(0,0,arad/2) to project(R01(0,0,arad/2)) rad arad/2
+ "$\phi$" ljust at Here+(-1pt__,-3pt__)
+
+ Fector(R01(X0),R01(Z0)) with .Origin at O ;
+ "$x_1$" above rjust at project(R01(X0))
+ Fector(R01(Y0),R01(Z0)) with .Origin at O ;
+ "$y_1$" ljust at project(R01(Y0))
+ Fector(R01(Z0),R01(Y0)) with .Origin at O ;
+ "$z_1$" above at project(R01(Z0))
+thicklines_
+
+# box object dimension
+b = 0.6*g
+d = 0.4*g
+h = 0.20*g
+
+# box object corners
+define(`B0',`D3')
+define(`B1',`sum3D(D3,d,0,0)') PB1: project(B1)
+define(`B2',`sum3D(D3,d,b,0)') PB2: project(B2)
+define(`B3',`sum3D(D3,0,b,0)') PB3: project(B3)
+define(`B4',`sum3D(D3,0,0,h)') PB4: project(B4)
+define(`B5',`sum3D(D3,d,0,h)') PB5: project(B5)
+define(`B6',`sum3D(D3,d,b,h)') PB6: project(B6)
+define(`B7',`sum3D(D3,0,b,h)') PB7: project(B7)
+
+# projected corners
+P0:project(R01(0,dcosine3D(2,R10(B0)),dcosine3D(3,R10(B0))))
+P1:project(R01(0,dcosine3D(2,R10(B1)),dcosine3D(3,R10(B1))))
+P2:project(R01(0,dcosine3D(2,R10(B2)),dcosine3D(3,R10(B2))))
+P3:project(R01(0,dcosine3D(2,R10(B3)),dcosine3D(3,R10(B3))))
+P4:project(R01(0,dcosine3D(2,R10(B4)),dcosine3D(3,R10(B4))))
+P5:project(R01(0,dcosine3D(2,R10(B5)),dcosine3D(3,R10(B5))))
+P6:project(R01(0,dcosine3D(2,R10(B6)),dcosine3D(3,R10(B6))))
+P7:project(R01(0,dcosine3D(2,R10(B7)),dcosine3D(3,R10(B7))))
+thinlines_
+ line from PB1 to P1
+ line from PB2 to P2
+ line from PB7 to P7
+ line from PB4 to P4
+thicklines_
+
+# draw the object
+ ifdpic(`line invis fill_(1) from PB4 to PB7 to PB6 to PB5
+ line from PB4 to PB7; line to PB6; line to PB5 ; line to PB4
+ line invis fill_(0.5) from PB5 to PB6 to PB2 to PB1
+ line from PB5 to PB6; line to PB2; line to PB1 ; line to PB5
+ line invis fill_(0.85) from PB6 to PB7 to PB3 to PB2
+ line from PB6 to PB7; line to PB3; line to PB2 ; line to PB6',
+ `gshade(1,PB4,PB7,PB6,PB5,PB4,PB7)
+ gshade(0.5,PB5,PB6,PB2,PB1,PB5,PB6)
+ gshade(0.85,PB6,PB7,PB3,PB2,PB6,PB7)')
+ line from PB4 to PB5 to PB1 to PB2 to PB3 to PB7 to PB4
+ line from PB5 to PB6 to PB7
+ line from PB6 to PB2
+
+ arrow from O to PB1 chop linethick pt__; "$X$" rjust
+
+ line from P4 to P5 to P1 to P2 to P3 to P7 to P4
+ line from P5 to P6 to P7
+ line from P6 to P2
+ line dashed from P4 to P0 to P3
+ line dashed from P0 to P1
+ ]
+
+# Globe:
+[
+ # Set small text size
+ iflatex(`textoffset = 1bp__; ifpsfrag(`textht = 9.5bp__',
+ `latexcommand({\small)') ')
+
+ azimuth = 15 # View angles in degrees
+ elevation = 35
+ setview(azimuth,elevation)
+
+ rectwid = 3.5 # Basic dimensions
+ rectht = 2.4
+ alpha = rectht/3
+
+# # Rectangle
+ NW: project(-rectht/2,-rectwid*0.25,0)
+ SW: project( rectht/2,-rectwid*0.25,0)
+ SE: project( rectht/2, rectwid*0.75,0)
+ NE: project(-rectht/2, rectwid*0.75,0)
+
+ ShadedPolygon(NW:NE:SE:SW,,-90,
+ 0,0.25,0.25,0.25,
+ 1,1,1,1) with .Start at NW
+
+ define(`C3D',`0,0,alpha') # Centre of the sphere
+ C: project(C3D)
+
+# # Shaded sphere using PSTricks or tikz:
+# # this is black magic but PSTricks
+# # seems to give more control
+# ifpstricks(
+# `Highlight: \
+# project(sum3D(C3D,rot3Dz(-15*dtor_,rot3Dy(-60*dtor_,alpha,0,0))))
+# command "\pscustom[fillstyle=gradient,gradmidpoint=0.0,%"
+# command sprintf("gradbegin=gray,gradend=white,gradlines=%g,%%",alpha*200)
+# command "GradientCircle=true,GradientScale=1.5,%"
+# command sprintf("GradientPos={(%g,%g)}]{",Highlight.x,Highlight.y)
+# circle rad alpha at C
+# command "}%"',
+#
+# `ifpgf( # A little too dark with tikz-pgf, maybe:
+# `command sprintf(\
+# "\dpicdraw[ball color=white](%g,%g) circle (%gin)\dpicstop",\
+# C.x,C.y,alpha/2.54)',
+#
+# `circle rad alpha at C fill_(1) ')')
+
+ # Shaded sphere with pic shading:
+ shadedball(alpha) at C
+
+ S: 0,0 # The sphere bottom touch point
+ "$S$" at S+(0,-2pt__) rjust
+ "$\alpha$" at 0.5<S,C> ljust
+
+ define(`N3D',`0,0,2*alpha') # North pole
+ N: project(N3D)
+ "$N$" at N+(0,3pt__) ljust
+
+ phi = 65*dtor_
+ define(`Phat3D',`rot3Dz(phi,alpha*3,0,0)')
+ Phat: "$\hat{P}$" at project(Phat3D) ljust
+
+ X: project(rectht/2*0.8,0,0)
+ Y: project(0,rectwid/2*0.8,0)
+
+`define' linevis { # ratio # Visibility function for lines fom S to Tmp
+ Tlv: $1 between S and Tmp
+ $2 = distance(Tlv,C)-alpha }
+
+`define' invisline { # name # Draw dashed invisible part of line in
+ Tmp: $1 # the plane
+ findroot(linevis, 0, 1, 1e-8, x)
+ line dashed from S to x between S and Tmp chop 0 chop 0.05 }
+
+thinlines_ # axes
+ invisline(X)
+ arrow to X chop 0.05 chop 0; "$x$" below
+ invisline(Y)
+ arrow to Y chop 0.05 chop 0; "$y$" ljust
+ line dashed from S to N chop 0 chop 0.05
+ arrow up alpha*0.5 chop 0.05 chop 0 ; "$z$" above
+ invisline(Phat)
+ line to Phat chop 0.05 chop 0
+ arc ccw -> rad alpha from project(alpha/2,0,0) to \
+ project(rot3Dz(phi,alpha/2,0,0))
+ "$\phi$" below at 0.5 between last arc.start and last arc.end
+
+ # vector (ratio along (N to Phat))
+define(`ray',`sum3D(N3D,sprod3D($1,diff3D(Phat3D,N3D)))')
+`define' rayvis { # ratio
+ $2 = length3D(diff3D(ray($1),C3D))-alpha }
+
+ findroot(rayvis, 1e-3, 1, 1e-8, p) # Find P
+ P: "$P$" at project(ray(p)) ljust above
+
+thicklines_
+ line dashed from N to P chop 0 chop 0.05
+ line to Phat chop 0.05 chop 0
+
+define(`meridian',`rot3Dz(phi,rot3Dy(-($1),alpha,0,0))')
+`define' meridianvis { # angle # Visibility function on the meridian
+ $2 = dot3D(meridian($1),View3D) }
+
+thinlines_ # Draw the meridian
+ findroot(meridianvis, 0, pi_, 1e-8, y)
+ n = 0
+ for ang = y-pi_ to y by pi_/20 do {
+ Q[n]: project(sum3D(C3D,meridian(ang))); n+=1 }
+ fitcurve(Q,n-1)
+ n = 0
+ for ang = y to y+pi_ by pi_/20 do {
+ Q[n]: project(sum3D(C3D,meridian(ang))); n+=1 }
+ fitcurve(Q,n-1,dashed)
+
+define(`equator',`rot3Dz($1,alpha,0,0)')
+`define' equatorvis { # angle # Visibility function on the equator
+ $2 = dot3D(View3D,equator($1)) }
+
+ findroot(equatorvis, 0, pi_, 1e-8, y)
+ n = 0
+ for ang = y-pi_ to y by pi_/20 do {
+ Q[n]: project(sum3D(C3D,equator(ang))); n+=1 }
+ fitcurve(Q,n-1)
+ n = 0
+ for ang = y to y+pi_ by pi_/20 do {
+ Q[n]: project(sum3D(C3D,equator(ang))); n+=1 }
+ fitcurve(Q,n-1,dashed)
+
+ line dashed from C to P # beta
+ line dashed from C to project(sum3D(C3D,equator(phi)))
+ arc ccw -> from 0.6 along_(last line) to 0.6 between C and P
+ "$\beta$" ljust at last arc.e+(0,2pt__)
+
+ iflatex(ifpsfrag(,`latexcommand(})'))
+ ] with .w at last [].e+(0.5,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/files.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/files.tex
new file mode 100644
index 00000000000..2e64c29cc3e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/files.tex
@@ -0,0 +1,668 @@
+% The format of this file must be strictly retained to avoid problems
+% in the generation of examples.html
+\bfig{
+ \centerline{\getpic{quick}}
+ \caption{The quick-start example from the manual
+ \src{quick.m4}.}
+ }
+
+\bfig{
+ \centerline{{\small\getpic{CctTable}}}
+ \caption{Two-terminal elements, showing some variations
+ \src{CctTable.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Diodes}}
+ \caption{Diodes: a {\tt K} in the second argument draws an open arrowhead
+ \src{Diodes.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Emarrows}}
+ \caption{Radiation arrows
+ \src{Emarrows.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Sources}}
+ \caption{Sources and source-like elements
+ \src{Sources.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Variable}}
+ \caption{Arrows and marks indicating variability
+ \src{Variable.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{AmpTable}}
+ \caption{Macros {\tt amp}, {\tt delay}, and {\tt integrator}
+ \src{AmpTable.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Fuses}}
+ \caption{Macros {\tt fuse} and {\tt cbreaker}
+ \src{Fuses.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Switches}}
+ \caption{The switch macros; {\tt switch(,,,L|B|D)} is a wrapper
+ for {\tt lswitch}, {\tt bswitch}, and {\tt dswitch}
+ \src{Switches.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Grounds}}
+ \caption{Ground symbols
+ \src{Grounds.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Antennas}}
+ \caption{Antenna symbols
+ \src{Antennas.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Audio}}
+ \caption{Audio elements
+ \src{Audio.m4}.}
+ }
+
+\bfig{
+ {\small\centerline{\getpic{Opamp}} }
+ \caption{The opamp
+ \src{Opamp.m4}.}
+ }
+
+\bfig{
+ {\small\centerline{\getpic{Xform}} }
+ \caption{The transformer element, drawing direction down
+ \src{Xform.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Relay}}
+ \caption{The {\tt contact} and {\tt relay} macros
+ \src{Relay.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{NPDT}}
+ \caption{Double throw with the {\tt NPDT} macro
+ \src{NPDT.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Jack}}
+ \caption{The {\tt jack} and {\tt plug} macros
+ \src{Jack.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Conn}}
+ \caption{The {\tt tstrip}, {\tt ccoax}, {\tt tconn}, and {\tt tbox} macros
+ \src{Conn.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Pconn}}
+ \caption{The {\tt pconnex} macro
+ \src{Pconn.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Headers}}
+ \caption{The {\tt Header} macro
+ \src{Headers.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{fet}}
+ \caption{FETs, showing programmable components and example customizations
+ \src{fet.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ujt}}
+ \caption{UJT examples
+ \src{ujt.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{thyristor}}
+ \caption{Thyristor examples
+ \src{thyristor.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Bip}}
+ \caption{Bipolar transistors (drawing direction: up)
+ \src{Bip.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Tgate}}
+ \caption{The {\tt tgate} and {\tt ptrans} elements
+ \src{Tgate.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Nport}}
+ \caption{The {\tt nport} and {\tt nterm} macros
+ \src{Nport.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{NLG}}
+ \caption{Some customizations of {\tt nport}
+ \src{NLG.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Windings}}
+ \caption{The macro
+ {\tt winding(L|R,diam,pitch,turns,core wid,core color)}
+ \src{Windings.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex01}\quad
+ \getpic{Timer}}
+ \caption{Two simple labeled circuits
+ \src{ex01.m4}%
+ \src{Timer.m4}.}
+ }
+
+\bfig{
+ {\small\centerline{\getpic{Optoiso}} }
+ \caption{Optical isolator: a circuit with right or left orientation
+ \src{Optoiso.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Mixer}}
+ \caption{A balanced mixer, using {\tt mosfet} and a custom transformer
+ \src{Mixer.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{PushPull}}
+ \caption{A push-pull mixer, showing FETs with multiple gates
+ \src{PushPull.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Quantum}}
+ \caption{A quantum circuit
+ \src{Quantum.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{SQUID}}
+ \caption{Superconducting quantum interface device (drawing direction down)
+ \src{SQUID.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Sixpole}}
+ \caption{A six-pole filter
+ \src{Sixpole.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex18}}
+ \caption{Precision half-wave rectifier and a tunnel diode circuit
+ (illustrating {\tt opamp, diode, resistor, ground,} and labels)
+ \src{ex18.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{MC}}
+ \caption{A three-phase switched AC-AC converter
+ \src{MC.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex10}}
+ \caption{Non-planar graph and bistable circuit
+ (illustrating the {\tt crossover} macro and colored elements)
+ \src{ex10.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Three}}
+ \caption{Three-phase oscillator
+ \src{Three.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex17}}
+ \caption{A repetitive network created by Pic looping and
+ a skewed circuit used to test the macro {\tt parallel\_}
+ \src{ex17.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex12}}
+ \caption{ A CMOS NAND gate, a test circuit, and an XMOSFET example
+ \src{ex12.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{pwrsupply}}
+ \caption{An elementary power supply circuit with colored elements,
+ and a multiple-winding transformer with 3-phase rectifier
+ \src{pwrsupply.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{TTLnand}}
+ \caption{ TTL NAND gate illustrating a transistor with multiple emitters
+ \src{TTLnand.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{I2L}}
+ \caption{ Gate circuit and equivalent embedded $I^2L$ components
+ illustrating multiple collectors
+ \src{I2L.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Schottky}}
+ \caption{ A 4-input NAND circuit illustrating the {\tt S} (Schottky)
+ option of {\tt bi\_trans}
+ \src{Schottky.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex11}}
+ \caption{Transistor radio audio chain
+ \src{ex11.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex04}}
+ \caption{Labels on non-manhattan elements
+ \src{ex04.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Csource}}
+ \caption{Realization of a controlled source
+ (illustrating stacked element labels)
+ \src{Csource.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Drive}}
+ \caption{Synchronous machine driven by variable-speed drive and rectifier
+ \src{Drive.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex16}}
+ \caption{A rate $1/2$ binary convolutional coder and its state diagram
+ \src{ex16.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex03}}
+ \caption{Digital filter
+ \src{ex03.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{MotorControl}}
+ \caption{Motor control connections
+ \src{MotorControl.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex02}}
+ \caption{Elements at obtuse angles
+ \src{ex02.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Rectifiers}}
+ \caption{Rectifier circuits and waveforms
+ \src{Rectifiers.m4}.}
+ }
+
+\begin{sidewaysfigure} %\rotatebox{90}{% \begin{landscape} %ignore%
+\bfig{
+ \centerline{\hspace*{2cm}\getpic{Heathkit}}
+ \caption{The power supply of a Heathkit AR-15 (Now, {\em that}
+ was a receiver!) with custom transformer and other elements,
+ drawn on a grid (partially shown) to aid in placement
+ \src{Heathkit.m4}.}
+ }
+\end{sidewaysfigure} %}% \end{landscape}
+
+\begin{sidewaysfigure} %\rotatebox{90}{% \begin{landscape} %ignore%
+\bfig{
+ \centerline{\hspace*{2cm}\getpic{lcct}}
+ \caption{A digital circuit of moderate size,
+ redrawn from M.~P.~Maclenan and G.~M.~Burns,
+ ``An Approach to Drawing Circuit Diagrams for Text Books,''
+ Tugboat (12)1, March 1991, pp.\ 66-69
+ \src{lcct.m4}.}
+ }
+\end{sidewaysfigure} %}% \end{landscape}
+
+\bfig{
+ \centerline{\getpic{sfg}}
+ \caption{Signal-flow graphs
+ \src{sfg.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Logic}}
+ \caption{Basic logic gates
+ \src{Logic.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex08}}
+ \caption{General-purpose latch: a small logic circuit
+ \src{ex08.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Decoder}}
+ \caption{Decoder logic, constructed using the {\tt for\_} macro
+ \src{Decoder.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex21}}
+ \caption{Some flip-flops
+ \src{ex21.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Multiplexer}}
+ \caption{Multiplexer
+ \src{Multiplexer.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Demultiplexer}}
+ \caption{Demultiplexer
+ \src{Demultiplexer.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ShiftR}}
+ \caption{A 5-bit shift register drawn using a custom flip-flop
+ \src{ShiftR.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Adder}}
+ \caption{A full adder and a cascade of $n$-bit adders
+ \src{Adder.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{CanLogic}}
+ \caption{A way of automatically drawing two-layer logic diagrams
+ \src{CanLogic.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Alogix}}
+ \caption{The {\tt Autologix(}{\sl Boolean expression};
+ {\sl Boolean expression}... , {\sl options}{\tt )}
+ macro automatically draws Boolean expressions in function notation.
+ The function tree is drawn, then a row or column of inputs, then
+ the connections. The default result is on the left,
+ a custom element at the top, and a tree of gates only is shown
+ on the right.
+ \src{Alogix.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ABlogix}}
+ \caption{The {\tt Autologix} macro can draw inputs on the left but
+ the added drawing complexity may require hand tuning with
+ second-argument options: {\tt L} puts the inputs on the left,
+ {\tt R} reverses their order, {\tt V} scans the input arguments
+ in reverse order, and {\tt offset=}{\sl value} displaces the array
+ of inputs
+ \src{ABlogix.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{XOR}}
+ \caption{Realizations of the XOR function using {\tt Autologix}
+ \src{XOR.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex00}}
+ \caption{Line diagrams
+ \src{ex00.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Crossbar}}
+ \caption{A crossbar switch
+ \src{Crossbar.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Byte}}
+ \caption{Elementary splines
+ \src{Byte.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Rotbox}}
+ \caption{The macro
+ {\tt rotbox(}{\sl wid,ht,type,}{\tt [r|t=}{\sl val}{\tt ])}
+ draws a box in the current direction
+ \src{Rotbox.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{exp}}
+ \caption{Test of {\tt project} and other {\tt lib3D}
+ macros, showing the projection of a solid onto
+ the $y_1,z_1$ plane by sighting along the $x_1$ axis.
+ \src{exp.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{graysurf}}
+ \caption{Plotting surfaces using gray scales. A sort algorithm
+ determines plotting order
+ \src{graysurf.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{shapes}}
+ \caption{Basic shapes
+ \src{shapes.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex09}}
+ \caption{Illustrating the macro
+ {\tt dimension\_(}{\sl linespec}, {\sl offset}, {\sl label},
+ {\tt D|H|W|}{\sl blank width}, {\sl tic offset},{\tt <-|->)}.
+ A negative second argument implies an offset to the right of the
+ {\sl linespec} direction. A {\sl label} starting with {\tt "} or
+ {\tt sprintf} is copied literally. If {\sl label} is an
+ {\tt s\_box(...)} then setting argument 4 to {\tt H}, {\tt W}, or
+ {\tt D} tailors the blank width to the {\tt s\_box} height, width, or
+ diagonal respectively; i.e.,\ {\tt W} is equivalent to
+ {\tt s\_wd+textoffset*2}.
+ The macro {\tt arcdimension\_} is similar but the first argument
+ specifies the arc to be dimensioned and the second argument is
+ the outward radial offset of the dimension arrow arc.
+ \src{ex09.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex05}}
+ \caption{Use of {\tt darrow}
+ \src{ex05.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{control}}
+ \caption{Control-system block diagrams that do not require m4
+ \src{control.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex06}}
+ \caption{Crosshatching by {\tt for} loops
+ \src{ex06.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Loglog}}
+ \caption{A graph drawn using the pic language
+ \src{Loglog.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{random}}
+ \caption{Testing random numbers
+ \src{random.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{csc}}
+ \caption{Conestoga Sailing Club (illustrating the filling of arbitrary
+ shapes)
+ \src{csc.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{rose}}
+ \caption{Redrawn from a detail of the set design for the musical
+ {\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},
+ or as postscript using \hbox{\tt dpic -r}
+ since no text formatting is required
+ \src{rose.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{diamond}}
+ \caption{Variations on M.~Goossens, S.~Rahtz, and F.~Mittelbach,
+ {\em The \LaTeX\ Graphics Companion,} Addison-Wesley 1997, pp.\ 57-58
+ \src{diamond.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{worm}}
+ \caption{An exercise in calculating RGB colours
+ \src{worm.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Buttons}}
+ \caption{Shading in color
+ \src{Buttons.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Sierpinski}}
+ \caption{The Sierpinski triangle: a test of pic macro recursion
+ \src{Sierpinski.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{recycle}}
+ \caption{Modest repetition and partial fill
+ \src{recycle.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{ex15}}
+ \caption{Simple diagrams that are easily drawn by looping
+ \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
+ \src{Crow.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Flow}}
+ \caption{A flowchart sampler
+ \src{Flow.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Btree}}
+ \caption{A binary tree
+ \src{Btree.m4}.}
+ }
+
+\bfig{
+ \centerline{\getpic{Ttree}}
+ \caption{Another tree
+ \src{Ttree.m4}.}
+ }
+
+% Overlaying a figure with line graphics depends on the postprocessor:
+\ifpst% PSTricks
+\bfig{%
+ \centerline{\getpic{Incleps}}%
+ \caption{Overlaying a figure with line graphics
+ \src{Incleps.m4}.}%
+ }
+\else\ifpgf% PGF
+\bfig{%
+ \centerline{\getpic{Incleps}}% %ignore%
+ \caption{Overlaying a figure with line graphics %ignore%
+ \src{Incleps.m4}.}%
+ }
+\else\ifmpost% MetaPost
+\bfig{%
+ \centerline{\boxdims{InclA}{%ignore%
+ \includegraphics[width=3in]{../Incl.eps.gz}}%
+ \hspace*{-3in}\includegraphics{Inclpdf.1}}%
+ \caption{Overlaying a figure with line graphics %ignore%
+ \src{Inclpdf.m4}.}
+ }
+\else\ifpdfl% pdflatex
+\bfig{%
+ \centerline{\boxdims{InclA}{%ignore%
+ \includegraphics[width=3in]{../Incl}}%
+ \hspace*{-3in}\includegraphics{Inclpdf}}%
+ \caption{Overlaying a figure with line graphics %ignore%
+ \src{Inclpdf.m4}.}
+ }
+\else\ifpostscript% Postscript with psfrag (.eps.gz not allowed)
+\bfig{%
+ \centerline{\boxdims{InclA}{%ignore%
+ \includegraphics[width=3in]{Incl.eps}}%
+ \hspace*{-3in}\includegraphics{Inclpdf.eps}}%
+ \caption{Overlaying a figure with line graphics %ignore%
+ \src{Inclpdf.m4}.}
+ }
+\fi\fi\fi\fi\fi
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/graysurf.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/graysurf.m4
new file mode 100644
index 00000000000..1dc3d1c38e5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/graysurf.m4
@@ -0,0 +1,189 @@
+.PS
+# graysurf.m4
+threeD_init
+NeedDpicTools
+
+Overall: [
+
+Surface:[
+# This just draws the facets back to front
+
+ setview(20,30)
+ dimen = 1.5
+
+ xmax = 2*dimen
+ ymax = 1.5*dimen
+ zmax = 1*dimen
+
+ define(`fn',
+ `expe(-(`$1')/tt)*cos((`$2')/xmax*1.75*twopi_)*cos((`$1')/ymax*twopi_)')
+
+ nx = 24; dx = xmax/nx
+ ny = 30; dy = ymax/ny
+ tt = 1.5
+ fnmax = fn(0,0,0)
+
+ Orig: (0,0)
+ linethick_(1.2)
+ arrow from Orig to 1.2 <Orig,(project(xmax,0,0))> ; "$x$" below
+ arrow from Orig to 1.2 <Orig,(project(0,ymax,0))> ; "$y$" ljust
+ arrow from Orig to 1.2 <Orig,(project(0,0,zmax))> ; "$z$" rjust
+
+ linethick_(0)
+ for i = 0 to nx-1 do {
+ x = xmax*i/nx
+ for j = 0 to ny-1 do {
+ y = ymax*j/ny
+ fnxy = fn(x,y)
+ shade((fnmax+fnxy)/fnmax/2,
+ line from (project(x,y,fnxy)) to (project(x,(y+dy),`fn(x,(y+dy))'))\
+ then to (project((x+dx),(y+dy),`fn((x+dx),(y+dy))'))\
+ then to (project((x+dx),y,`fn((x+dx),y)'))\
+ then to (project(x,y,fnxy))
+ ) } }
+] with .w at last [].e+(-0.2,0)
+
+Torus: [
+# Calculate all the facet centres but draw
+# only a subset of them after sorting
+
+ viewazimuth = 20 # Set view angles in degrees
+ viewelevation = 30
+
+ setview(viewazimuth,viewelevation,0)
+
+ sfactor = 0.7
+ tradius = 2*sfactor
+ sradius = 0.75*sfactor
+
+define(`torus',`rot3Dz((`$1')*dtor_,
+ sum3D(tradius,0,0,rot3Dy((`$2')*dtor_,sradius,0,0)))')
+
+define(`tvisible',
+ `dot3D(View3D, rot3Dz((`$1')*dtor_,rot3Dy((`$2')*dtor_,1,0,0)))')
+
+Orig: (0,0)
+X: arrow from Orig to (project(tradius+sradius*4,0,0)); "x" rjust
+Y: arrow from Orig to (project(0,tradius+sradius*2,0)); "y" ljust
+
+ dt = 10 # major angle degrees per facet
+ ds = 10 # minor angle degrees per facet
+
+ # create the arrays and sort
+ n = 0
+ for t = dt to 360+dt/2 by dt do {
+ for s=ds/2 to 360.1 by ds do {
+ if tvisible(t,s) >= 0 then {
+ n +=1
+ t[n] = t
+ s[n] = s
+ d[n] = dot3D(torus(t,s),view3D1,view3D2,view3D3) # view distance
+ ix[n] = n
+ } } }
+#prval(n)
+ dpquicksort(d,1,n,ix)
+
+ # draw the facets
+thinlines_
+ for i = 1 to n do {
+ tc = t[ix[i]]; sc = s[ix[i]]
+ SE: (project(torus(tc+dt/2,sc-ds/2)))
+ SW: (project(torus(tc-dt/2,sc-ds/2)))
+ NW: (project(torus(tc-dt/2,sc+ds/2)))
+ NE: (project(torus(tc+dt/2,sc+ds/2)))
+ f = ((dcosine3D(3,torus(tc,sc))/sradius+1)/2)^2
+ g = min(f,0.9)
+ setrgb(g,g,g)
+ line fill f ifpdf( invis ) \
+ from SE to SW then to NW then to NE then to SE
+# line invis shaded rgbstring(f,f^3,f^3) \
+# f from SE to SW then to NW then to NE then to SE
+ resetrgb
+ }
+
+thicklines_
+ arrow from Orig to (project(0,0,tradius*1.4)); "z" above
+ dashline(from Orig to (project(torus(0,0))),,,,G)
+ arrow to X.end
+ dashline(from Orig to (project(torus(90,0))),,,,G)
+ arrow to Y.end
+
+] with .sw at last [].se+(0.2,0)
+
+Hat: [
+# Sort as for the torus but draw edges too
+
+ azimuth = 25 # View angles in degrees
+ elevation = 20
+ setview(azimuth,elevation)
+ # the 3D object: `hat(t,y)'
+ define(`hat',`cosd($1)*($2),sind($1)*($2),(($2)^2-1)^2')
+ define(`gradient',`(-4*($2)*(($2)^2-1)*cosd(`$1')),
+ (-4*($2)*(($2)^2-1)*sind(`$1')),1')
+ define edge {$2=dot3D(View3D,gradient($1,y))}
+ define(`hatvis',
+ `(($2 > 0.6) || (dot3D(View3D,gradient($1,$2)) > 0))')
+
+ # grid parameters
+ dang = 09
+ maxy = 1.25
+ dy = 0.05
+
+Orig: (0,0)
+X: arrow from Orig to (project(maxy*1.2,0,0)); "x" rjust
+Y: arrow from Orig to (project(0,maxy*1.2,0)); "y" ljust
+Xv: (project(1,0,0))
+Yv: (project(0,1,0))
+Zv: (project(0,0,1))
+ # create the arrays and sort
+ n = 0
+ for t = dang/2 to 360.1 by dang do {
+ for y=dy/2 to maxy by dy do {
+ if hatvis(t,y) then {
+ n +=1
+ t[n] = t
+ y[n] = y
+ d[n] = dot3D(hat(t,y),View3D) #distance toward the front
+ ix[n] = n
+ } } }
+#prval(n)
+ dpquicksort(d,1,n,ix)
+ # draw the facets
+ ellipse wid maxy*2 ht maxy*2*sind(elevation) \
+ with .c at (project(0,0,(maxy^2-1)^2)+linethick bp__/2)
+thinlines_
+ for i = 1 to n do {
+ tc = t[ix[i]]; yc = y[ix[i]]
+ SE: (project(hat(tc+dang/2,yc-dy/2)))
+ SW: (project(hat(tc-dang/2,yc-dy/2)))
+ NW: (project(hat(tc-dang/2,yc+dy/2)))
+ NE: (project(hat(tc+dang/2,yc+dy/2)))
+ f = abs(yc^2-1)
+ line invis fill f from SE to SW then to NW then to NE then to SE
+ }
+
+ # Outline where the surface goes invisible
+mm = int(maxy/dy)
+nr = -1
+for i=1 to mm do { y = i/(mm+3)
+ findroot(edge,(azimuth+2),(azimuth+180-2),1e-8,t)
+ nr +=1
+ R[mm+nr]: (project(hat(t,y)))
+ R[mm-1-nr]: (-R[mm+nr].x,R[mm+nr].y)
+ }
+fitcurve(R,mm*2-1)
+
+ # Z axis
+thicklines_
+Z: arrow from Zv to (project(0,0,1.2)); "z" ljust
+ line dashed from Orig to Zv chop 0 chop dashwid/2
+ line dashed from Orig to Xv
+ line dashed from Orig to Yv
+
+ # Partial rim
+ellipsearc(maxy*2,maxy*2*sind(elevation),-pi_*1.4,pi_/3) \
+ with .C at (project(0,0,(maxy^2-1)^2)+linethick bp__/2)
+] scaled 1.25 with .s at 1st [].ne+(0,-0.75)
+] scaled 0.85
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/header.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/header.tex
new file mode 100644
index 00000000000..82d220bf1ce
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/header.tex
@@ -0,0 +1,54 @@
+% header.tex
+% instead of \usepackage[cm]{fullpage} (letter size):
+ \setlength{\topmargin}{-29.59087pt}
+ \setlength{\headheight}{0pt}
+ \setlength{\headsep}{0pt}
+ \setlength{\textheight}{679.61174pt}
+ \setlength{\footskip}{30.0pt}
+ \setlength{\textwidth}{528.93675pt}
+ \setlength{\oddsidemargin}{-29.59087pt}
+ \setlength{\evensidemargin}{\oddsidemargin}
+
+% To test a new installation, all but one of the diagram inclusions
+% below might be commented out, and re-introduced one by one.
+
+\newcommand{\src}[1]{{\tt [#1]}}
+\newcommand{\makepic}{\box\graph} % Required only for gpic -t
+%\newcommand\scriptstack[2][c]{\hbox{\scriptsize\shortstack[#1]{#2}}}%
+\newbox\graph
+
+\newif\ifmpost
+\newif\ifpst
+\newif\ifpdfl
+\newif\ifpgf
+\newif\ifpostscript
+
+\newcommand{\getpic}[1]{%
+ \ifpst
+ \input #1 \makepic
+ \else\ifpgf
+ \input #1
+ \else\ifmpost
+ \includegraphics[trim=1 1 1 1]{#1.1}%
+ \else\ifpdfl
+ \includegraphics[trim=1 1 1 1]{#1}
+ \else\ifpostscript%
+ \includegraphics{#1.eps}%
+ \fi\fi\fi\fi\fi}
+
+% Left-justified captions to be used in parbox
+\makeatletter
+\def\caption#1{%
+ \vskip\abovecaptionskip
+ \refstepcounter{figure}
+ \sbox\@tempboxa{{Figure \arabic{figure}: #1}}%
+ \ifdim \wd\@tempboxa >\hsize
+ {Figure \arabic{figure}: #1}\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\box\@tempboxa\hfil}%
+ \fi
+ \vskip\belowcaptionskip}
+\makeatother
+
+\newcommand{\bfig}[1]{\vspace{5ex}\noindent\parbox{\textwidth}{#1}}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/ics.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/ics.m4
new file mode 100644
index 00000000000..660c07ab431
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/ics.m4
@@ -0,0 +1,84 @@
+divert(-1)
+
+ Macros defining some integrated circuits
+
+define(`lg_pinsep',3*L_unit) logic pin separation in logic units
+define(`lg_chipwd',18*L_unit) default chip width
+
+ `A sequence of pins along the east or west side of a chip:
+ lg_pinseq(initial pin no,final pin no,
+ e|w,initial offset,pinnum_root,Labelroot,[not])'
+define(`lg_pinseq',`for_($1,$2,1,
+ `lg_pin( Chip.s`$3'+(0,eval($4+m4x)*lg_pinsep),
+ $6`'m4x,Pin`'eval($5`'m4x),`$3'`$7',eval($5`'m4x))') ')
+
+define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep
+ "6116" at Chip.sw below ljust
+ lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin12,w,12)
+ lg_pin(Chip.sw_+(0,2*lg_pinsep),lg_bartxt(CS),Pin18,wN,18)
+ lg_pinseq(0,2,w,4,9+,D)
+ lg_pinseq(3,7,w,4,10+,D)
+ lg_pin(Chip.sw_+(0,13*lg_pinsep),R/lg_bartxt(W),Pin21,w,21)
+ lg_pin(Chip.sw_+(0,14*lg_pinsep),V\hbox{\tiny CC},Pin24,w,24)
+ lg_pin(Chip.se_+(0,lg_pinsep),lg_bartxt(OE),Pin20,eN,20)
+ lg_pinseq(0,7,e,3,8-,A)
+ lg_pinseq(8,9,e,3,31-,A)
+ lg_pin(Chip.se_+(0,13*lg_pinsep),A10,Pin19,e,19)
+ ]')
+
+define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep
+ "6502" at Chip.sw_ below_ ljust_
+ lg_pin(Chip.sw_+(0,lg_pinsep),V\hbox{\tiny SS},Pin21,w,21)
+ lg_pin(Chip.sw_+(0,2*lg_pinsep),V\hbox{\tiny SS},Pin1,w,1)
+ lg_pin(Chip.sw_+(0,4*lg_pinsep),R/lg_bartxt(W),Pin34,w,34)
+ lg_pinseq(0,7,w,6,33-,D)
+ lg_pin(Chip.sw_+(0,15*lg_pinsep),lg_bartxt(RESET),Pin40,wN,40)
+ lg_pin(Chip.sw_+(0,17*lg_pinsep),SYNC,Pin7,w,7)
+ lg_pin(Chip.sw_+(0,19*lg_pinsep),lg_bartxt(NMI),Pin6,wN,6)
+ lg_pin(Chip.sw_+(0,21*lg_pinsep),RDY,Pin2,w,2)
+ lg_pin(Chip.sw_+(0,22*lg_pinsep),SO,Pin38,w,38)
+ lg_pin(Chip.sw_+(0,23*lg_pinsep),V\hbox{\tiny CC},Pin8,w,8)
+ lg_pin(Chip.se_+(0,lg_pinsep),{\large$\phi$}\hbox{\tiny 1}(in),Pin39,e,39)
+ lg_pin(Chip.se_+(0,4*lg_pinsep),
+ {\large$\phi$}\hbox{\tiny 2}(out),Pin37,e,37)
+ lg_pinseq(0,11,e,6,9+,A)
+ lg_pinseq(12,15,e,6,10+,A)
+ lg_pin(Chip.se+(0,23*lg_pinsep),lg_bartxt(IRQ),Pin4,eN,4)
+ ]')
+
+define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep
+ "6522" at Chip.sw below ljust
+ lg_pin(Chip.sw_+(0,lg_pinsep),V\hbox{\tiny SS},Pin1,w,1)
+ lg_pin(Chip.sw_+(0,3*lg_pinsep),CS1,Pin24,w,24)
+ lg_pin(Chip.sw_+(0,4*lg_pinsep),{\large$\phi$},Pin25,w,25)
+ lg_pin(Chip.sw_+(0,5*lg_pinsep),lg_bartxt(CS2),Pin23,wN,23)
+ lg_pin(Chip.sw_+(0,7*lg_pinsep),RS0(A0),Pin38,w,38)
+ lg_pin(Chip.sw_+(0,8*lg_pinsep),RS1(A1),Pin37,w,37)
+ lg_pin(Chip.sw_+(0,9*lg_pinsep),RS2(A2),Pin36,w,36)
+ lg_pin(Chip.sw_+(0,10*lg_pinsep),RS3(A3),Pin35,w,35)
+ lg_pinseq(0,7,w,12,33-,D)
+ lg_pin(Chip.sw_+(0,21*lg_pinsep),R/lg_bartxt(W),Pin22,w,22)
+ lg_pin(Chip.sw_+(0,22*lg_pinsep),lg_bartxt(IRQ),Pin21,wN,21)
+ lg_pin(Chip.sw_+(0,23*lg_pinsep),V\hbox{\tiny CC},Pin20,w,20)
+ lg_pinseq(0,7,e,1,10+,PB)
+ lg_pinseq(1,2,e,8,17+,CB)
+ lg_pinseq(0,7,e,12,2+,PA)
+ lg_pinseq(1,2,e,19,41-,CA)
+ lg_pin(Chip.se_+(0,23*lg_pinsep),lg_bartxt(RESET),Pin34,eN,34)
+ ]')
+
+define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep
+ "74LS138" at Chip.sw below ljust
+ lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin8,w,8)
+ lg_pin(Chip.sw_+(0,2*lg_pinsep),lg_bartxt(G2a),Pin4,wN,4)
+ lg_pin(Chip.sw_+(0,3*lg_pinsep),lg_bartxt(G2b),Pin5,wN,5)
+ lg_pin(Chip.sw_+(0,5*lg_pinsep),A,Pin1,w,1)
+ lg_pin(Chip.sw_+(0,6*lg_pinsep),B,Pin2,w,2)
+ lg_pin(Chip.sw_+(0,7*lg_pinsep),C,Pin3,w,3)
+ lg_pin(Chip.sw_+(0,9*lg_pinsep),G1,Pin6,w,6)
+ lg_pin(Chip.sw_+(0,10*lg_pinsep),V\hbox{\tiny CC},Pin16,w,16)
+ lg_pinseq(0,6,e,2,15-,Y,n)
+ lg_pin(Chip.se_+(0,9*lg_pinsep),Y7,Pin7,eN,7)
+ ]')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/keyval.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/keyval.m4
new file mode 100644
index 00000000000..dc81fd123f0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/keyval.m4
@@ -0,0 +1,74 @@
+.PS
+# keyval.m4
+cct_init
+
+#An experiment in defining macro options as key1=val1;key2=val2; ...
+# `resistor( linespec,
+# cycles=n;type=E|Q|H;side=L|R)
+# chars : E=ebox
+# Q=offset
+# H=squared (default 3 cycles)
+# R=to right of drawing direction'
+define(`xesistor',
+`print "`$0'($@)" ;
+ setkey_(`$2',cycles,4,N)dnl
+ setkey_(`$2',type,N,N)dnl
+ setkey_(`$2',side,R,N)dnl
+ print "cycles:m4cycles"
+ print "type:m4type"
+ print "side:m4side"
+ifelse(
+ m4type,E,
+ `ebox(`$1',shift(shift(shift($@))))',
+ `eleminit_(`$1')
+ ifelse(m4type,N,
+ `define(`m4n',`eval((m4cycles)*2)')dnl
+ define(`m4h',`dimen_/24')dnl
+ define(`m4v',2)dnl
+ if m4h*m4n*2 > rp_len then { eleminit_(to rvec_(m4h*m4n*2,0)) }
+ tr_xy_init(last line.c, m4h, ifelse(m4side,R,-))dnl
+ { line from last line.start to tr_xy(-m4n,0)\
+ for_(2,m4n,2,
+ `then to tr_xy(eval(2*m4x-3-m4n), m4v) \
+ then to tr_xy(eval(2*m4x-1-m4n),-m4v) \')dnl
+ then to tr_xy(m4n, 0) then to last line.end
+ [box invis ht_ m4h*m4v*2 wid_ m4h*m4n*2] at 2nd last line.c
+ }',
+ m4type,Q,
+ `define(`m4n',`eval(2*(m4cycles))')dnl
+ define(`m4h',`dimen_/24')dnl
+ define(`m4v',2)dnl
+ if m4h*m4n*2 > rp_len then { eleminit_(to rvec_(m4h*m4n*2,0)) }
+ tr_xy_init(last line.c, m4h, ifelse(m4side,R,-))dnl
+ { line from last line.start to tr_xy(-m4n,0)\
+ for_(2,m4n,2,
+ `then to tr_xy(eval(2*m4x-2-m4n), m4v*2) \
+ then to tr_xy(eval(2*m4x-m4n),0) \')dnl
+ then to tr_xy(m4n, 0) then to last line.end
+ [box invis ht_ m4h*m4v*2 wid_ m4h*m4n*2] at 2nd last line.c + ta_xy(0,m4v)
+ }',
+ m4type,H,
+ `define(`m4n',`ifelse(`$2',,5,`eval(2*$2-1)')')dnl
+ define(`m4h',`dimen_/20')dnl
+ define(`m4v',7/3)dnl
+ if m4h*m4n*2 > rp_len then { eleminit_(to rvec_(m4h*m4n*2,0)) }
+ tr_xy_init(last line.c, m4h, ifelse(m4side,R,-))dnl
+ { line from last line.start to tr_xy(-m4n,0)\
+ for_(-m4n,m4n,2,
+ `ifelse(eval(((m4x+m4n)/2)%2),0,
+ `then to tr_xy(m4x,m4v) then to tr_xy(eval(m4x+2),m4v) \',
+ `then to tr_xy(m4x,0) \
+ ifelse(m4x,m4n,,`then to tr_xy(eval(m4x+2),0)')\')')dnl
+ then to tr_xy(m4n, 0) then to last line.end
+ [box invis ht_ m4h*m4v wid_ m4h*m4n*2] at 2nd last line.c+(0,m4h*m4v/2)
+ }')
+ line invis from 2nd last line.start to 2nd last line.end ')
+
+ popdef(`m4cycles')dnl
+ popdef(`m4type')dnl
+ popdef(`m4side')dnl
+')
+
+ xesistor(,type=E;cycles=5;)
+ xesistor(,type=Q;cycles=3;side=L)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/lcct.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/lcct.m4
new file mode 100644
index 00000000000..f1be48ac367
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/lcct.m4
@@ -0,0 +1,193 @@
+.PS 8.5
+# lcct.m4
+log_init
+include(ics.m4)
+iflatex(`ifpsfrag(,`latexcommand({\sf)')')
+
+define(`dimen_',0.5)
+define(`elen_',dimen_)
+define(`Groundtype',`')
+
+define(`breakout',` for i = 1 to `$1' do {
+ {line `$2' ifelse(`$4',,del,`$4')-jog/2 then `$2' jog/2 `$3' jog \
+ then `$3' lg_pinsep}
+ move `$3' lg_pinsep }
+ move `$2' ifelse(`$4',,del,`$4')-jog/2 then `$2' jog/2 `$3' jog ')
+
+del = lg_pinsep
+jog = del*2/3
+
+ right_
+IC1: ic6502
+
+Vcc: IC1.Pin8.end.x-del-elen_,IC1.Pin4.y+lg_pinsep+3*del
+Reset: IC1.Pin8.end.x-del,Vcc.y+del
+
+ resistor(up_ Vcc.y-IC1.Pin4.y from IC1.Pin4.end)
+
+ line left 2*del from IC1.Pin6.end
+ line up_ to (Here,Vcc) chop 0 chop elen_
+ resistor
+
+ line left del from IC1.Pin40.end
+ {line to (Here,Reset)}
+ move left elen_
+ {NOT_gate(right_ elen_)}
+ {reversed(`capacitor',to (Here,Vcc),C)}
+ down_; resistor; ground(,T,Groundtype)
+
+ line from IC1.Pin2.end to (IC1.Pin2.end,Vcc)
+
+ move to IC1.Pin26.end; breakout(8,left,down)
+ line to (Here,IC1.sw+(0,-del))
+ line down jog right jog/2
+Data: Here
+
+ line from IC1.Pin1.end down_ 2*lg_pinsep; ground(,T,Groundtype)
+
+ line left 2*del from IC1.Pin34.end
+ line to (Here,Data+(0,-del))
+RWB: Here
+
+ move to IC1.Pin25.end; breakout(16,right,down)
+ line to (Here,RWB)+(0,-del+jog) then down jog left jog/2
+Addr: Here
+
+ right_
+IC5: ic74LS138 with .Chip.nw at (IC1.Chip.w.x,Addr.y-2*del)
+ line from IC5.Pin5.end down_ 3*lg_pinsep ; ground(,T,Groundtype)
+ line from IC5.Pin16.end down_ 1.5*lg_pinsep ; ground(,T,Groundtype)
+ move to IC5.Pin1.end; breakout(3,left,up)
+ line to Here.x,Addr.y-jog then up jog right jog/2 then to Addr
+
+ line right_ 2*del from IC1.Pin39.end
+ { NOT_gate(right_ 3*del)
+C1: Here }
+ capacitor(up_ elen_*0.6)
+ {resistor(right_ 3*del)}
+ line up 2*(IC1.Pin37.y-Here.y)
+ {line from IC1.Pin37.end to (Here,IC1.Pin37)}
+ right_; xtal(right_ 3*del)
+
+IC2: ic6116 with .Chip.nw at Here.x+2*del+lg_plen*L_unit,IC1.Chip.n.y
+ line from IC2.Pin24.end up to (IC2.Pin24.end,Vcc)
+ right_
+Or1: OR_gate with .Out at IC2.Pin21.end
+ line from Or1.In2 left del then down del
+ line to (C1,Here) then to C1
+ line from Or1.In1 left del
+ line to (Here,IC2.Chip.nw+(0,del))
+RW: Here
+ move to IC2.Pin17.end; breakout(8,left,down)
+ line to (Here,Data)+(0,jog) then down jog left jog/2
+ line down_ lg_pinsep from IC2.Pin12.end ; ground(,T,Groundtype)
+ move to IC2.Pin19.end; breakout(11,right,down)
+ line to (Here,Addr) chop 0 chop jog
+ line down jog left jog/2
+ line down_ lg_pinsep from IC2.Pin20.end ; ground(,T,Groundtype)
+
+ right_
+IC3: ic6116 with .Chip.nw at IC2.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0)
+IC4: ic6522 with .Chip.nw at IC3.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0)
+IC6: ic74LS138 with .Chip.nw at (IC3.Chip.nw,IC5.Chip.nw)
+
+ line from Vcc to (IC4.Pin34.end.x+del,Vcc.y)
+ line from Reset to (IC4.Pin34.end,Reset) then to IC4.Pin34.end
+
+ line right_ 2*del from (C1,IC4.Pin25); NOT_gate; line to IC4.Pin25.end
+ line right del from IC1.Pin4.end; line to Here.x,Vcc.y-del
+ line to (IC4.Pin21.end,Here)-(del,0) then to IC4.Pin21.end-(del,0) \
+ then to IC4.Pin21.end
+
+ line from IC3.Pin21.end to (IC3.Pin21.end,Vcc)
+ move to IC3.Pin17.end
+ breakout(8,left,down); line to (Here,Data)+(0,jog) then down jog left jog/2
+ move to IC3.Pin19.end
+ breakout(11,right,down); line to (Here,Addr)+(0,jog) then down jog left jog/2
+ move to IC4.Pin26.end
+ breakout(8,left,down,2*del);
+ line to (Here,Data)+(0,jog) then down jog left jog/2 then to Data
+ move to IC4.Pin35.end
+ breakout(4,left,down); line to (Here,Addr)+(0,jog) then down jog left jog/2 \
+ then to Addr
+ line from IC4.Pin20.end to (IC4.Pin20.end,Vcc)
+ line down_ lg_pinsep from IC4.Pin1.end; ground(,T,Groundtype)
+ line left 3*del from IC4.Pin23.end
+ line to (Here,IC6.Pin7) then to IC6.Pin7.end
+ line down_ 2*lg_pinsep from IC3.Pin18.end; ground(,T,Groundtype)
+
+ line down_ lg_pinsep from IC6.Pin8.end; ground(,T,Groundtype)
+ line up_ 2.5*lg_pinsep from IC6.Pin16.end \
+ then right_ lg_pinsep then down_ lg_pinsep/2; ground(,T,Groundtype)
+ move to IC6.Pin5.end; breakout(1,left,up); line up_ lg_pinsep
+ move to IC6.Pin1.end; breakout(3,left,up)
+ line to (Here,Addr)-(0,jog) then up jog left jog/2
+
+ line from RW to (IC3.Pin19.end+(2*del,0),RW)
+RWE: Here
+ line to (RWE,RWB) then to RWB
+ line from IC4.Pin22.end to (RWE,IC4.Pin22.end)
+
+ right_
+Or3: OR_gate with .Out at IC3.Pin20.end.x-del,IC1.Pin9.y
+ line from Or3.Out to (IC3.Pin20.end,Or3.Out) then to IC3.Pin20.end
+ left_
+Or2: OR_gate with .In2 at (IC2.Chip.se,Or3.In1)
+ line from Or2.Out to (IC2.Pin18.end-(3*del,0),Or2.Out)
+ line to (Here,IC2.Pin18) then to IC2.Pin18.end
+ line from Or2.In1 right del; line to (Here,IC1.Pin37)
+
+ line from Or3.In2 left del; line to (Here,IC1.Pin37)
+
+define(`addrlabel',`dnl
+ line invis right 4*del from IC5.Pin`$1'.end "{\tiny (`$2')}" above ')
+
+ addrlabel( 7,E000 - FFFF)
+ addrlabel( 9,C000 - DFFF)
+ addrlabel(10,A000 - BFFF)
+ addrlabel(11,8000 - 9FFF)
+ addrlabel(12,6000 - 7FFF)
+ addrlabel(13,4000 - 5FFF)
+ addrlabel(14,2000 - 3FFF)
+ addrlabel(15,0000 - 1FFF)
+
+ line from IC5.Pin7.end right 4*del
+K: Here; line to (K,IC5.Pin13)
+ line to (IC6.Pin4.end-(3*del,0),Here)
+ line to (Here,IC6.Pin4.end) then to IC6.Pin4.end
+
+Ands: [ right_
+ And1: AND_gate; line right del/2 then down del*3/2 \
+ then left And1.Out.x-And1.In1.x+del then down del then right_ del/2
+ And2: AND_gate with .In1 at Here
+ line from And2.Out right del/2 then down del then right_ del/2
+ And3: AND_gate with .In1 at Here
+ line right_ del/2 from And3.Out
+ NOT_gate
+ line right_ del/2
+ And4: AND_gate with .In1 at Here
+ ] with .And2.In1 at (K.x+2*del,IC5.Pin9.y)
+
+# line from Ands.And4.Out right del*3; line to (Here,Or3.In1) then to Or3.In1
+ line from Ands.And4.Out right IC6.Pin5.end.x-3*del-Ands.And4.Out.x
+ line to (Here,Or3.In1) then to Or3.In1
+ line from Ands.And4.In2 left del
+ line to (Here,IC5.Pin14) then to IC5.Pin14.end
+ line from IC5.Pin15.end to (IC2.Pin20.end.x+2*del,IC5.Pin15.y)
+ line to (Here,Or2.In2) then to Or2.In2
+ NOT_gate(right_ from (K,Ands.And3.In2) to Ands.And3.In2)
+ line from Ands.And2.In2 to (K+(del+jog/2,0),Ands.And2.In2)
+ line left jog/2 up jog; line to (Here.x,Addr.y-jog) then up jog left jog/2
+ line from Ands.And1.In1 to (K.x+del+jog/2,Ands.And1.In1.y) \
+ then left jog/2 up jog
+ line from Ands.And1.In2 to (K.x+del+jog/2,Ands.And1.In2.y) \
+ then left jog/2 up jog
+
+ line from IC6.Pin6.end left 2*del; line to (Here,IC4.Pin24)
+ line from IC4.Pin24.end to (IC2.Chip.se,IC4.Pin24)
+ move left dimen_; {NOT_gate(right_ dimen_)}
+ line left jog/2 down jog; line to (Here,Data) chop 0 chop jog
+ line down jog left jog/2
+
+iflatex(`ifpsfrag(,`latexcommand(})')')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/Makefile
new file mode 100644
index 00000000000..10173d43f3d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/Makefile
@@ -0,0 +1,55 @@
+# Type "make" or "make testfont.ps"
+# To test an individual diagram, type "make DOC=file clean file.ps"
+
+LIBDIR = $$HOME/lib
+M4MACROS = mfpic.m4
+
+M4 = m4 -I $(LIBDIR)
+
+# Use ljfive (which is 600dpi) because 1200dpi produces mf errors on some figs
+MODE = ljfive
+MF = MFINPUTS=.: mf "\mode:=$(MODE); scrollmode;"
+DOC = test
+LATEX = TEXFORMATS=.: TEXFONTS=.: latex
+TR = tr '\075' '\134'
+
+PIC=dpic
+
+testfont.ps:
+
+font.dvi: font.m4
+ $(M4) $(M4MACROS) font.m4 > font.pic
+ $(PIC) -m font.pic > font.tex
+ -$(LATEX) font
+ cat cct.mf | tr -d '\015' > xxx; mv xxx cct.mf
+ -$(MF) "input cct" < /dev/null
+ gftopk cct.*gf `ls cct.*gf | sed 's/gf$$/pk/'`
+ cp -p cct.*pk cct.pk
+
+testfont.ps: font.dvi
+ (echo 'cct'; echo '=table'; echo '=end') | $(TR) | \
+ (TEXFORMATS=.: TEXFONTS=.: tex testfont)
+ dvips -D600 testfont -o
+
+# For testing individual diagrams:
+$(DOC).ps: $(DOC).pk
+ $(LATEX) $(DOC)
+ TEXPKS=.: dvips -Z -P$(MODE) $(DOC)
+
+$(DOC).pk: $(DOC).tex
+ -$(LATEX) $(DOC)
+ -$(MF) "input $(DOC)-mfpic" < /dev/null
+ gftopk $(DOC)-mfpic.*gf `ls $(DOC)-mfpic.*gf | sed 's/gf$$/pk/'`
+
+$(DOC).tex: $(DOC).m4
+ sed -n -e "s/cct/$(DOC)-mfpic/" -e '1,/opengraphs/p' font.m4 > $(DOC).tex
+ $(M4) $(M4MACROS) $(DOC).m4 | $(PIC) -m >> $(DOC).tex
+ echo '=closegraphsfile=end{document}' | $(TR) >> $(DOC).tex
+
+clobber: clean
+ rm -f *.tfm cct.mf
+
+clean:
+ rm -f *.tex *pk *mfpic*
+ rm -f *.log *.dvi *.ps *.aux *gf
+ rm -f core log xxx *.pic font.tex testfont*
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
new file mode 100644
index 00000000000..a5c2759cfa9
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/cct.mf
@@ -0,0 +1,5732 @@
+% cct.mf, generated by Mfpic, v1.10 2012/12/03,
+% from TeX source "font" on 2019/04/11 at 19:33
+numeric mfpicversion; mfpicversion := 110;
+if unknown mode: mode := localfont; fi
+if unknown mag: mag := 1000/1000; fi
+if unknown grafbase: input grafbase; fi
+
+if unknown grafbaseversion: grafbaseversion := 0; fi
+if grafbaseversion <> mfpicversion :
+GBmsg "Bad mfpic installation: mfpic and grafbase versions do not match.";
+fi
+
+
+%----------------------------<1>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.041667, 0.041667);
+
+beginmfpic(1); % line 12 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.041667,0),
+(0.0625,0.041667),
+(0.104167,-0.041667),
+(0.145833,0.041667),
+(0.1875,-0.041667),
+(0.229167,0.041667),
+(0.270833,-0.041667),
+(0.291667,0),
+(0.333333,0));
+
+endmfpic; % (1) line 26 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<2>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.041667, 0.041667, 0, 0.333333);
+
+beginmfpic(2); % line 27 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0,0.041667),
+(-0.041667,0.0625),
+(0.041667,0.104167),
+(-0.041667,0.145833),
+(0.041667,0.1875),
+(-0.041667,0.229167),
+(0.041667,0.270833),
+(0,0.291667),
+(0,0.333333));
+
+endmfpic; % (2) line 41 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<3>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.019939, 0.071131);
+
+beginmfpic(3); % line 42 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.024933,0));
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0.024933,0),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.070249,0.021131),-155,-410,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0.102388,-0.017171),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.134527,0.021131),-130,-410,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0.166667,-0.017171),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.198806,0.021131),-130,-410,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0.230945,-0.017171),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.263085,0.021131),-130,-385,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0.3084,0),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.3084,0),
+(0.333333,0));
+
+endmfpic; % (3) line 59 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<4>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.019939, 0.071131, -0.333333, 0);
+
+beginmfpic(4); % line 60 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.024933));
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0,-0.024933),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.021131,-0.070249),115,-140,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0.017171,-0.102388),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.021131,-0.134527),140,-140,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0.017171,-0.166667),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.021131,-0.198806),140,-140,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0.017171,-0.230945),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.021131,-0.263085),140,-115,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0,-0.3084),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0,-0.3084),
+(-0,-0.333333));
+
+endmfpic; % (4) line 77 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<5>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.071131, 0.019939);
+
+beginmfpic(5); % line 78 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.024933,0));
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0.024933,0),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.070249,-0.021131),25,-230,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0.102388,0.017171),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.134527,-0.021131),50,-230,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0.166667,0.017171),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.198806,-0.021131),50,-230,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0.230945,0.017171),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.263085,-0.021131),50,-205,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0.3084,0),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.3084,0),
+(-0.333333,0));
+
+endmfpic; % (5) line 95 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<6>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.071131, 0.019939, 0, 0.333333);
+
+beginmfpic(6); % line 96 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.024933));
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0,0.024933),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.021131,0.070249),-65,-320,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0.017171,0.102388),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.021131,0.134527),-40,-320,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0.017171,0.166667),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.021131,0.198806),-40,-320,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((0.017171,0.230945),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.021131,0.263085),-40,-295,0.05);
+
+resizedrawpen (0.4bp);
+
+store (curpath)
+drawn
+circle ((-0,0.3084),0.002767);
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0,0.3084),
+(-0,0.333333));
+
+endmfpic; % (6) line 113 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<7>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.146418, 0.333333, 0, 0.123214);
+
+beginmfpic(7); % line 114 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.146418,0.091964),
+(0.146418,0.091964));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.146418,0.123214),
+(0.146418,0.123214));
+
+endmfpic; % (7) line 122 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<8>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.123214, 0, -0.146418, 0.333333);
+
+beginmfpic(8); % line 123 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.091964,-0.146418),
+(-0.091964,0.146418));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.123214,-0.146418),
+(-0.123214,0.146418));
+
+endmfpic; % (8) line 131 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<9>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0, 0.03125);
+
+beginmfpic(9); % line 132 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.041667,0));
+
+store (curpath)
+drawn
+arcplr ((0.072917,0),-180,-360,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.135417,0),-180,-360,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.197917,0),180,-0,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.260417,0),-180,-360,0.03125);
+
+store (curpath)
+drawn
+polyline (false)
+((0.291667,0),
+(0.333333,0));
+
+endmfpic; % (9) line 144 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<10>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0, 0.03125, -0.333333, 0);
+
+beginmfpic(10); % line 145 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.041667));
+
+store (curpath)
+drawn
+arcplr ((0,-0.072917),90,-90,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0,-0.135417),90,-90,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0,-0.197917),90,-90,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0,-0.260417),90,-90,0.03125);
+
+store (curpath)
+drawn
+polyline (false)
+((-0,-0.291667),
+(-0,-0.333333));
+
+endmfpic; % (10) line 157 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<11>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.03125, 0);
+
+beginmfpic(11); % line 158 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.041667,0));
+
+store (curpath)
+drawn
+arcplr ((-0.072917,0),-0,-180,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0.135417,0),-0,-180,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0.197917,0),-0,-180,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0.260417,0),-0,-180,0.03125);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.291667,0),
+(-0.333333,0));
+
+endmfpic; % (11) line 170 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<12>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.03125, 0, 0, 0.333333);
+
+beginmfpic(12); % line 171 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.041667));
+
+store (curpath)
+drawn
+arcplr ((0,0.072917),-90,-270,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0,0.135417),-90,-270,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0,0.197917),-90,-270,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0,0.260417),-90,-270,0.03125);
+
+store (curpath)
+drawn
+polyline (false)
+((-0,0.291667),
+(-0,0.333333));
+
+endmfpic; % (12) line 183 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<13>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.03125, 0, 0, 0.333333);
+
+beginmfpic(13); % line 184 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.041667));
+
+store (curpath)
+drawn
+arcplr ((0,0.072917),-90,-270,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0,0.135417),-90,-270,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0,0.197917),-90,-270,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0,0.260417),-90,-270,0.03125);
+
+store (curpath)
+drawn
+polyline (false)
+((-0,0.291667),
+(-0,0.333333));
+
+endmfpic; % (13) line 196 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<14>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.125, 0.333333, 0, 0.083333);
+
+beginmfpic(14); % line 197 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.125,0.052083),
+(0.125,0.052083));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.125,0.083333),
+(0.125,0.083333));
+
+endmfpic; % (14) line 205 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<15>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.083333, 0, -0.125, 0.333333);
+
+beginmfpic(15); % line 206 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.052083,-0.125),
+(-0.052083,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.083333,-0.125),
+(-0.083333,0.125));
+
+endmfpic; % (15) line 214 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<16>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.0625, 0.0625);
+
+beginmfpic(16); % line 215 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.141667,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.141667,-0.0625),
+(0.141667,0.0625));
+
+store (curpath)
+drawn
+arcplr ((0.29992,0),-150,-210,0.125);
+
+store (curpath)
+drawn
+polyline (false)
+((0.17492,0),
+(0.333333,0));
+
+endmfpic; % (16) line 226 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<17>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.0625, 0.0625, -0.333333, 0);
+
+beginmfpic(17); % line 227 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.141667));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.0625,-0.141667),
+(0.0625,-0.141667));
+
+store (curpath)
+drawn
+arcplr ((0,-0.29992),120,60,0.125);
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.17492),
+(0,-0.333333));
+
+endmfpic; % (17) line 238 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<18>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.0625, 0.0625);
+
+beginmfpic(18); % line 239 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.141667,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.141667,0.0625),
+(-0.141667,-0.0625));
+
+store (curpath)
+drawn
+arcplr ((-0.29992,0),30,-30,0.125);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.17492,0),
+(-0.333333,0));
+
+endmfpic; % (18) line 250 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<19>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.0625, 0.0625, 0, 0.333333);
+
+beginmfpic(19); % line 251 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.141667));
+
+store (curpath)
+drawn
+polyline (false)
+((0.0625,0.141667),
+(-0.0625,0.141667));
+
+store (curpath)
+drawn
+arcplr ((0,0.29992),-60,-120,0.125);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.17492),
+(0,0.333333));
+
+endmfpic; % (19) line 262 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<20>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.083333, 0.083333);
+
+beginmfpic(20); % line 263 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.141667,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.141667,-0.083333),
+(0.141667,0.083333));
+
+store (curpath)
+drawn
+polyline (false)
+((0.191667,-0.083333),
+(0.191667,0.083333));
+
+store (curpath)
+drawn
+polyline (false)
+((0.191667,0),
+(0.333333,0));
+
+endmfpic; % (20) line 275 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<21>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.083333, 0.083333, 0, 0.333333);
+
+beginmfpic(21); % line 276 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.141667));
+
+store (curpath)
+drawn
+polyline (false)
+((0.083333,0.141667),
+(-0.083333,0.141667));
+
+store (curpath)
+drawn
+polyline (false)
+((0.083333,0.191667),
+(-0.083333,0.191667));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.191667),
+(0,0.333333));
+
+endmfpic; % (21) line 288 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<22>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.051253, 0.051253);
+
+beginmfpic(22); % line 289 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.130582,0));
+
+store (curpath)
+filled
+drawn
+lclosed
+polyline (false)
+((0.130582,0),
+(0.130582,0.041667),
+(0.197216,0),
+(0.130582,-0.041667),
+(0.130582,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.202751,-0.045718),
+(0.202751,0.045718));
+
+store (curpath)
+drawn
+polyline (false)
+((0.202751,0),
+(0.333333,0));
+
+endmfpic; % (22) line 305 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<23>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.051253, 0.051253, -0.333333, 0);
+
+beginmfpic(23); % line 306 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.130582));
+
+store (curpath)
+filled
+drawn
+lclosed
+polyline (false)
+((0,-0.130582),
+(0.041667,-0.130582),
+(0,-0.197216),
+(-0.041667,-0.130582),
+(0,-0.130582));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.045718,-0.202751),
+(0.045718,-0.202751));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.202751),
+(0,-0.333333));
+
+endmfpic; % (23) line 322 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<24>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.051253, 0.051253);
+
+beginmfpic(24); % line 323 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.130582,0));
+
+store (curpath)
+filled
+drawn
+lclosed
+polyline (false)
+((-0.130582,0),
+(-0.130582,-0.041667),
+(-0.197216,0),
+(-0.130582,0.041667),
+(-0.130582,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.202751,0.045718),
+(-0.202751,-0.045718));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.202751,0),
+(-0.333333,0));
+
+endmfpic; % (24) line 339 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<25>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.051253, 0.051253, 0, 0.333333);
+
+beginmfpic(25); % line 340 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.130582));
+
+store (curpath)
+filled
+drawn
+lclosed
+polyline (false)
+((0,0.130582),
+(-0.041667,0.130582),
+(0,0.197216),
+(0.041667,0.130582),
+(0,0.130582));
+
+store (curpath)
+drawn
+polyline (false)
+((0.045718,0.202751),
+(-0.045718,0.202751));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.202751),
+(0,0.333333));
+
+endmfpic; % (25) line 356 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<26>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.051253, 0.051253);
+
+beginmfpic(26); % line 357 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.130582,0));
+
+store (curpath)
+filled
+drawn
+lclosed
+polyline (false)
+((0.130582,0),
+(0.130582,0.041667),
+(0.197216,0),
+(0.130582,-0.041667),
+(0.130582,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.181918,-0.045718),
+(0.202751,-0.045718),
+(0.202751,0.045718),
+(0.223584,0.045718));
+
+store (curpath)
+drawn
+polyline (false)
+((0.202751,0),
+(0.333333,0));
+
+endmfpic; % (26) line 375 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<27>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.051253, 0.051253, -0.333333, 0);
+
+beginmfpic(27); % line 376 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.130582));
+
+store (curpath)
+filled
+drawn
+lclosed
+polyline (false)
+((0,-0.130582),
+(0.041667,-0.130582),
+(0,-0.197216),
+(-0.041667,-0.130582),
+(0,-0.130582));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.045718,-0.181918),
+(-0.045718,-0.202751),
+(0.045718,-0.202751),
+(0.045718,-0.223584));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.202751),
+(0,-0.333333));
+
+endmfpic; % (27) line 394 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<28>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.051253, 0.051253);
+
+beginmfpic(28); % line 395 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.130582,0));
+
+store (curpath)
+filled
+drawn
+lclosed
+polyline (false)
+((-0.130582,0),
+(-0.130582,-0.041667),
+(-0.197216,0),
+(-0.130582,0.041667),
+(-0.130582,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.181918,0.045718),
+(-0.202751,0.045718),
+(-0.202751,-0.045718),
+(-0.223584,-0.045718));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.202751,0),
+(-0.333333,0));
+
+endmfpic; % (28) line 413 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<29>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.051253, 0.051253, 0, 0.333333);
+
+beginmfpic(29); % line 414 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.130582));
+
+store (curpath)
+filled
+drawn
+lclosed
+polyline (false)
+((0,0.130582),
+(-0.041667,0.130582),
+(0,0.197216),
+(0.041667,0.130582),
+(0,0.130582));
+
+store (curpath)
+drawn
+polyline (false)
+((0.045718,0.181918),
+(0.045718,0.202751),
+(-0.045718,0.202751),
+(-0.045718,0.223584));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.202751),
+(0,0.333333));
+
+endmfpic; % (29) line 432 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<30>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.036084, 0.333333, -0.051253, 0.051253);
+
+beginmfpic(30); % line 433 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.036084,-0.045718),
+(-0.036084,0.045718));
+
+endmfpic; % (30) line 439 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<31>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.051253, 0.051253, -0.333333, 0.036084);
+
+beginmfpic(31); % line 440 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.045718,0.036084),
+(0.045718,0.036084));
+
+endmfpic; % (31) line 446 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<32>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.0625, 0.0625);
+
+beginmfpic(32); % line 447 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.125,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.125,-0.041667),
+(0.125,0.041667));
+
+store (curpath)
+drawn
+polyline (false)
+((0.145833,0),
+(0.145833,0.0625),
+(0.1875,0.0625),
+(0.1875,-0.0625),
+(0.145833,-0.0625),
+(0.145833,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.208333,-0.041667),
+(0.208333,0.041667));
+
+store (curpath)
+drawn
+polyline (false)
+((0.208333,0),
+(0.333333,0));
+
+endmfpic; % (32) line 465 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<33>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.0625, 0.0625, -0.333333, 0);
+
+beginmfpic(33); % line 466 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.041667,-0.125),
+(0.041667,-0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.145833),
+(0.0625,-0.145833),
+(0.0625,-0.1875),
+(-0.0625,-0.1875),
+(-0.0625,-0.145833),
+(0,-0.145833));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.041667,-0.208333),
+(0.041667,-0.208333));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.208333),
+(0,-0.333333));
+
+endmfpic; % (33) line 484 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<34>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.125, 0.125);
+
+beginmfpic(34); % line 485 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.041667,0));
+
+store (curpath)
+drawn
+circle ((0.166667,0),0.125);
+
+store (curpath)
+drawn
+polyline (false)
+((0.291667,0),
+(0.333333,0));
+
+endmfpic; % (34) line 494 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<35>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.125, 0.125, 0, 0.333333);
+
+beginmfpic(35); % line 495 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.041667));
+
+store (curpath)
+drawn
+circle ((0,0.166667),0.125);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.291667),
+(0,0.333333));
+
+endmfpic; % (35) line 504 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<36>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.083333, 0.083333, -0.041667, 0.041667);
+
+beginmfpic(36); % line 505 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+arcplr ((-0.041667,0),180,0,0.041667);
+
+store (curpath)
+drawn
+arcplr ((0.041667,0),180,360,0.041667);
+
+endmfpic; % (36) line 511 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<37>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.15, 0.15);
+
+beginmfpic(37); % line 512 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.016667,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.016667,0),
+(0.166667,0.15),
+(0.316667,0),
+(0.166667,-0.15),
+(0.016667,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.316667,0),
+(0.333333,0));
+
+endmfpic; % (37) line 525 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<38>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.15, 0.15, 0, 0.333333);
+
+beginmfpic(38); % line 526 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.016667));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.016667),
+(-0.15,0.166667),
+(0,0.316667),
+(0.15,0.166667),
+(0,0.016667));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.316667),
+(0,0.333333));
+
+endmfpic; % (38) line 539 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<39>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.1875, -0.025, 0.025);
+
+beginmfpic(39); % line 540 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.0875,-0.025),
+(0.1875,0),(0.0875,0.025));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.164594,0));
+
+endmfpic; % (39) line 548 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<40>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.025, 0.025, -0.1875, 0);
+
+beginmfpic(40); % line 549 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.025,-0.0875),
+(0,-0.1875),(0.025,-0.0875));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.164594));
+
+endmfpic; % (40) line 557 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<41>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.1875, 0, -0.025, 0.025);
+
+beginmfpic(41); % line 558 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.0875,0.025),
+(-0.1875,0),(-0.0875,-0.025));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.164594,0));
+
+endmfpic; % (41) line 566 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<42>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.025, 0.025, 0, 0.1875);
+
+beginmfpic(42); % line 567 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.025,0.0875),
+(0,0.1875),(-0.025,0.0875));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.164594));
+
+endmfpic; % (42) line 575 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<43>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.132583, 0, 0.132583);
+
+beginmfpic(43); % line 576 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.07955,0.044194),
+(0.132583,0.132583),(0.044194,0.07955));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.116385,0.116385));
+
+endmfpic; % (43) line 584 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<44>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.132583, 0, 0, 0.132583);
+
+beginmfpic(44); % line 585 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.044194,0.07955),
+(-0.132583,0.132583),(-0.07955,0.044194));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.116385,0.116385));
+
+endmfpic; % (44) line 593 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<45>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.132583, 0, -0.132583, 0);
+
+beginmfpic(45); % line 594 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.07955,-0.044194),
+(-0.132583,-0.132583),(-0.044194,-0.07955));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.116385,-0.116385));
+
+endmfpic; % (45) line 602 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<46>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.132583, -0.132583, 0);
+
+beginmfpic(46); % line 603 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.044194,-0.07955),
+(0.132583,-0.132583),(0.07955,-0.044194));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.116385,-0.116385));
+
+endmfpic; % (46) line 611 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<47>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.125, 0.125);
+
+beginmfpic(47); % line 612 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.145833,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.145833,0.0625),
+(0.145833,-0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1875,0.125),
+(0.1875,-0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1875,0),
+(0.333333,0));
+
+endmfpic; % (47) line 624 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<48>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.125, 0.125, -0.333333, 0);
+
+beginmfpic(48); % line 625 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.145833));
+
+store (curpath)
+drawn
+polyline (false)
+((0.0625,-0.145833),
+(-0.0625,-0.145833));
+
+store (curpath)
+drawn
+polyline (false)
+((0.125,-0.1875),
+(-0.125,-0.1875));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.1875),
+(0,-0.333333));
+
+endmfpic; % (48) line 637 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<49>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.125, 0.125);
+
+beginmfpic(49); % line 638 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.145833,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.145833,-0.0625),
+(-0.145833,0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1875,-0.125),
+(-0.1875,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1875,0),
+(-0.333333,0));
+
+endmfpic; % (49) line 650 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<50>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.125, 0.125, 0, 0.333333);
+
+beginmfpic(50); % line 651 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.145833));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.0625,0.145833),
+(0.0625,0.145833));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.125,0.1875),
+(0.125,0.1875));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.1875),
+(0,0.333333));
+
+endmfpic; % (50) line 663 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<51>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.125, 0.125);
+
+beginmfpic(51); % line 664 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.0625,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.0625,0.0625),
+(0.0625,-0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((0.104167,0.125),
+(0.104167,-0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.145833,0.0625),
+(0.145833,-0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1875,0.125),
+(0.1875,-0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.229167,0.0625),
+(0.229167,-0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((0.270833,0.125),
+(0.270833,-0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.270833,0),
+(0.333333,0));
+
+endmfpic; % (51) line 684 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<52>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.125, 0.125, -0.333333, 0);
+
+beginmfpic(52); % line 685 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((0.0625,-0.0625),
+(-0.0625,-0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((0.125,-0.104167),
+(-0.125,-0.104167));
+
+store (curpath)
+drawn
+polyline (false)
+((0.0625,-0.145833),
+(-0.0625,-0.145833));
+
+store (curpath)
+drawn
+polyline (false)
+((0.125,-0.1875),
+(-0.125,-0.1875));
+
+store (curpath)
+drawn
+polyline (false)
+((0.0625,-0.229167),
+(-0.0625,-0.229167));
+
+store (curpath)
+drawn
+polyline (false)
+((0.125,-0.270833),
+(-0.125,-0.270833));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.270833),
+(0,-0.333333));
+
+endmfpic; % (52) line 705 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<53>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.125, 0.125);
+
+beginmfpic(53); % line 706 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.0625,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.0625,-0.0625),
+(-0.0625,0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.104167,-0.125),
+(-0.104167,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.145833,-0.0625),
+(-0.145833,0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1875,-0.125),
+(-0.1875,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.229167,-0.0625),
+(-0.229167,0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.270833,-0.125),
+(-0.270833,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.270833,0),
+(-0.333333,0));
+
+endmfpic; % (53) line 726 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<54>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.125, 0.125, 0, 0.333333);
+
+beginmfpic(54); % line 727 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.0625,0.0625),
+(0.0625,0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.125,0.104167),
+(0.125,0.104167));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.0625,0.145833),
+(0.0625,0.145833));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.125,0.1875),
+(0.125,0.1875));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.0625,0.229167),
+(0.0625,0.229167));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.125,0.270833),
+(0.125,0.270833));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.270833),
+(0,0.333333));
+
+endmfpic; % (54) line 747 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<55>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.05, 0.05);
+
+beginmfpic(55); % line 748 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.041667,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.291667,0),
+(0.291667,0.05),
+(0.041667,0.05),
+(0.041667,-0.05),
+(0.291667,-0.05),
+(0.291667,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.291667,0),
+(0.333333,0));
+
+endmfpic; % (55) line 762 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<56>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.05, 0.05, 0, 0.333333);
+
+beginmfpic(56); % line 763 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.041667));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.291667),
+(-0.05,0.291667),
+(-0.05,0.041667),
+(0.05,0.041667),
+(0.05,0.291667),
+(0,0.291667));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.291667),
+(0,0.333333));
+
+endmfpic; % (56) line 777 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<57>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.021706, 0.125);
+
+beginmfpic(57); % line 778 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.083333,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.083333,0),
+(0.208333,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.25,0),
+(0.333333,0));
+
+endmfpic; % (57) line 788 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<58>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.021706, 0.125, -0.333333, 0);
+
+beginmfpic(58); % line 789 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.083333));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.083333),
+(0.125,-0.208333));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.25),
+(0,-0.333333));
+
+endmfpic; % (58) line 799 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<59>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.125, 0.021706);
+
+beginmfpic(59); % line 800 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.083333,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.083333,0),
+(-0.208333,-0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.25,0),
+(-0.333333,0));
+
+endmfpic; % (59) line 810 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<60>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.125, 0.021706, 0, 0.333333);
+
+beginmfpic(60); % line 811 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.083333));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.083333),
+(-0.125,0.208333));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.25),
+(0,0.333333));
+
+endmfpic; % (60) line 821 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<61>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.021706, 0.125);
+
+beginmfpic(61); % line 822 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.083333,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.083333,0),
+(0.208333,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+lclosed
+begingroup; save mfpicnexus;
+hide(numeric mfpicnexus; path mfpicnexus[]; mfpicnexus = 0)
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((-0.074188,-0.014308),22.529508,35.422548,0.233002);
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((0.043984,-0.100954),72.077452,58.261852,0.233002);
+
+mkpoly (false, mfpicnexus)
+endgroup;
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.022091,-0.067162),11.25,45.13128,0.233002);
+
+store (curpath)
+drawn
+polyline (false)
+((0.25,0),
+(0.333333,0));
+
+endmfpic; % (61) line 837 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<62>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.021706, 0.125, -0.333333, 0);
+
+beginmfpic(62); % line 838 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.083333));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.083333),
+(0.125,-0.208333));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+lclosed
+begingroup; save mfpicnexus;
+hide(numeric mfpicnexus; path mfpicnexus[]; mfpicnexus = 0)
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((-0.014308,0.074188),-67.470492,-54.577452,0.233002);
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((-0.100954,-0.043984),-17.922548,-31.738148,0.233002);
+
+mkpoly (false, mfpicnexus)
+endgroup;
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.067162,0.022091),-78.75,-44.86872,0.233002);
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.25),
+(0,-0.333333));
+
+endmfpic; % (62) line 853 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<63>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.125, 0.021706);
+
+beginmfpic(63); % line 854 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.083333,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.083333,0),
+(-0.208333,-0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+lclosed
+begingroup; save mfpicnexus;
+hide(numeric mfpicnexus; path mfpicnexus[]; mfpicnexus = 0)
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((0.074188,0.014308),-157.470492,-144.577452,0.233002);
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((-0.043984,0.100954),-107.922548,-121.738148,0.233002);
+
+mkpoly (false, mfpicnexus)
+endgroup;
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.022091,0.067162),-168.75,-134.86872,0.233002);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.25,0),
+(-0.333333,0));
+
+endmfpic; % (63) line 869 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<64>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.125, 0.021706, 0, 0.333333);
+
+beginmfpic(64); % line 870 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.083333));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.083333),
+(-0.125,0.208333));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+lclosed
+begingroup; save mfpicnexus;
+hide(numeric mfpicnexus; path mfpicnexus[]; mfpicnexus = 0)
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((0.014308,-0.074188),112.529508,125.422548,0.233002);
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((0.100954,0.043984),162.077452,148.261852,0.233002);
+
+mkpoly (false, mfpicnexus)
+endgroup;
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.067162,-0.022091),101.25,135.13128,0.233002);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.25),
+(0,0.333333));
+
+endmfpic; % (64) line 885 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<65>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.032352, 0.125);
+
+beginmfpic(65); % line 886 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.083333,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.083333,0),
+(0.208333,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+lclosed
+begingroup; save mfpicnexus;
+hide(numeric mfpicnexus; path mfpicnexus[]; mfpicnexus = 0)
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((-0.0153,-0.121331),34.780608,22.077452,0.236733);
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((-0.025038,0.02723),-14.577452,-0.979566,0.236733);
+
+mkpoly (false, mfpicnexus)
+endgroup;
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.032152,-0.047835),12.233526,41.25,0.236733);
+
+store (curpath)
+drawn
+polyline (false)
+((0.25,0),
+(0.333333,0));
+
+endmfpic; % (65) line 901 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<66>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.032352, 0.125, -0.333333, 0);
+
+beginmfpic(66); % line 902 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.083333));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.083333),
+(0.125,-0.208333));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+lclosed
+begingroup; save mfpicnexus;
+hide(numeric mfpicnexus; path mfpicnexus[]; mfpicnexus = 0)
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((-0.121331,0.0153),-55.219392,-67.922548,0.236733);
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((0.02723,0.025038),-104.577452,-90.979566,0.236733);
+
+mkpoly (false, mfpicnexus)
+endgroup;
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((-0.047835,0.032152),-77.766474,-48.75,0.236733);
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.25),
+(0,-0.333333));
+
+endmfpic; % (66) line 917 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<67>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.125, 0.032352);
+
+beginmfpic(67); % line 918 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.083333,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.083333,0),
+(-0.208333,-0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+lclosed
+begingroup; save mfpicnexus;
+hide(numeric mfpicnexus; path mfpicnexus[]; mfpicnexus = 0)
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((0.0153,0.121331),-145.219392,-157.922548,0.236733);
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((0.025038,-0.02723),165.422548,179.020434,0.236733);
+
+mkpoly (false, mfpicnexus)
+endgroup;
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.032152,0.047835),-167.766474,-138.75,0.236733);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.25,0),
+(-0.333333,0));
+
+endmfpic; % (67) line 933 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<68>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.125, 0.032352, 0, 0.333333);
+
+beginmfpic(68); % line 934 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.083333));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.083333),
+(-0.125,0.208333));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+lclosed
+begingroup; save mfpicnexus;
+hide(numeric mfpicnexus; path mfpicnexus[]; mfpicnexus = 0)
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((0.121331,-0.0153),124.780608,112.077452,0.236733);
+
+store (mfpicnexus[incr mfpicnexus])
+arcplr ((-0.02723,-0.025038),75.422548,89.020434,0.236733);
+
+mkpoly (false, mfpicnexus)
+endgroup;
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+arcplr ((0.047835,-0.032152),102.233526,131.25,0.236733);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.25),
+(0,0.333333));
+
+endmfpic; % (68) line 949 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<69>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.625, -0.25, 0.25);
+
+beginmfpic(69); % line 950 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.0625,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.5625,0),
+(0.0625,0.25),
+(0.0625,-0.25),
+(0.5625,0),
+(0.625,0));
+
+endmfpic; % (69) line 961 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<70>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.25, 0.25, -0.625, 0);
+
+beginmfpic(70); % line 962 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.5625),
+(0.25,-0.0625),
+(-0.25,-0.0625),
+(0,-0.5625),
+(0,-0.625));
+
+endmfpic; % (70) line 973 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<71>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.625, 0, -0.25, 0.25);
+
+beginmfpic(71); % line 974 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.0625,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.5625,0),
+(-0.0625,-0.25),
+(-0.0625,0.25),
+(-0.5625,0),
+(-0.625,0));
+
+endmfpic; % (71) line 985 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<72>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.25, 0.25, 0, 0.625);
+
+beginmfpic(72); % line 986 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.0625));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.5625),
+(-0.25,0.0625),
+(0.25,0.0625),
+(0,0.5625),
+(0,0.625));
+
+endmfpic; % (72) line 997 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<73>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.333333, -0.175, 0.175);
+
+beginmfpic(73); % line 998 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0.020833,0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1375,-0.175),
+(0.020833,-0.175),
+(0.020833,0.175),
+(0.1375,0.175));
+
+store (curpath)
+drawn
+arcplr ((0.1375,0),90,-90,0.175);
+
+store (curpath)
+drawn
+polyline (false)
+((0.3125,0),
+(0.333333,0));
+
+endmfpic; % (73) line 1011 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<74>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, -0.333333, 0);
+
+beginmfpic(74); % line 1012 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.020833));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,-0.1375),
+(-0.175,-0.020833),
+(0.175,-0.020833),
+(0.175,-0.1375));
+
+store (curpath)
+drawn
+arcplr ((0,-0.1375),0,-180,0.175);
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.3125),
+(0,-0.333333));
+
+endmfpic; % (74) line 1025 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<75>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.333333, 0, -0.175, 0.175);
+
+beginmfpic(75); % line 1026 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(-0.020833,0));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1375,0.175),
+(-0.020833,0.175),
+(-0.020833,-0.175),
+(-0.1375,-0.175));
+
+store (curpath)
+drawn
+arcplr ((-0.1375,0),-90,-270,0.175);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.3125,0),
+(-0.333333,0));
+
+endmfpic; % (75) line 1039 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<76>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.333333);
+
+beginmfpic(76); % line 1040 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.020833));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.1375),
+(0.175,0.020833),
+(-0.175,0.020833),
+(-0.175,0.1375));
+
+store (curpath)
+drawn
+arcplr ((0,0.1375),180,-0,0.175);
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.3125),
+(0,0.333333));
+
+endmfpic; % (76) line 1053 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<77>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.083333, 0.083333, -0.0625, 0);
+
+beginmfpic(77); % line 1054 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.083333,0),
+(-0.083333,-0));
+
+store (curpath)
+drawn
+polyline (false)
+((0.055556,-0.03125),
+(-0.055556,-0.03125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.035714,-0.0625),
+(-0.035714,-0.0625));
+
+endmfpic; % (77) line 1064 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<78>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.083333, 0.083333, -0.1875, 0);
+
+beginmfpic(78); % line 1065 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,-0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.083333,-0.125),
+(-0.083333,-0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.055556,-0.15625),
+(-0.055556,-0.15625));
+
+store (curpath)
+drawn
+polyline (false)
+((0.035714,-0.1875),
+(-0.035714,-0.1875));
+
+endmfpic; % (78) line 1077 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<79>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.104167, 0.104167, -0.333333, -0);
+
+beginmfpic(79); % line 1078 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.104167,-0),
+(-0.104167,-0.041667));
+
+store (curpath)
+drawn
+arcplr ((-0.104167,-0.072917),90,-90,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0.104167,-0.135417),90,-90,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0.104167,-0.197917),90,-90,0.03125);
+
+store (curpath)
+drawn
+arcplr ((-0.104167,-0.260417),90,-90,0.03125);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.104167,-0.291667),
+(-0.104167,-0.333333));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.03125,-0.041667),
+(-0.03125,-0.291667));
+
+store (curpath)
+drawn
+polyline (false)
+((0.03125,-0.041667),
+(0.03125,-0.291667));
+
+store (curpath)
+drawn
+polyline (false)
+((0.104167,-0.333333),
+(0.104167,-0.291667));
+
+store (curpath)
+drawn
+arcplr ((0.104167,-0.260417),-90,-270,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.104167,-0.197917),-90,-270,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.104167,-0.135417),-90,-270,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.104167,-0.072917),-90,-270,0.03125);
+
+store (curpath)
+drawn
+polyline (false)
+((0.104167,-0.041667),
+(0.104167,0));
+
+endmfpic; % (79) line 1102 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<80>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0, 0.333333, -0.104167, 0.104167);
+
+beginmfpic(80); % line 1103 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.104167),
+(0.041667,-0.104167));
+
+store (curpath)
+drawn
+arcplr ((0.072917,-0.104167),-180,-360,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.135417,-0.104167),-180,-360,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.197917,-0.104167),180,-0,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.260417,-0.104167),-180,-360,0.03125);
+
+store (curpath)
+drawn
+polyline (false)
+((0.291667,-0.104167),
+(0.333333,-0.104167));
+
+store (curpath)
+drawn
+polyline (false)
+((0.041667,-0.03125),
+(0.291667,-0.03125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.041667,0.03125),
+(0.291667,0.03125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.333333,0.104167),
+(0.291667,0.104167));
+
+store (curpath)
+drawn
+arcplr ((0.260417,0.104167),0,-180,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.197917,0.104167),0,-180,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.135417,0.104167),0,-180,0.03125);
+
+store (curpath)
+drawn
+arcplr ((0.072917,0.104167),0,-180,0.03125);
+
+store (curpath)
+drawn
+polyline (false)
+((0.041667,0.104167),
+(0,0.104167));
+
+endmfpic; % (80) line 1127 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<81>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.1625, 0.1625, 0, 0.3);
+
+beginmfpic(81); % line 1128 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.0375,0.05),
+(-0.0375,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1625,0.15),
+(-0.0375,0.15));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1625,0),
+(-0.0375,0.09));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.025108,0.031366),
+(0.1125,0.0225),(0.047906,0.082028));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.096479,0.029709),
+(0.0125,0.0675));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1625,0.3),
+(-0.0375,0.21));
+
+endmfpic; % (81) line 1144 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<82>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.3, 0, -0.1625, 0.1625);
+
+beginmfpic(82); % line 1145 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.05,-0.0375),
+(-0.25,-0.0375));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.15,-0.1625),
+(-0.15,-0.0375));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.1625),
+(-0.09,-0.0375));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.031366,0.025108),
+(-0.0225,0.1125),(-0.082028,0.047906));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.029709,0.096479),
+(-0.0675,0.0125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.3,0.1625),
+(-0.21,-0.0375));
+
+endmfpic; % (82) line 1161 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<83>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.1625, 0.1625, 0, 0.3);
+
+beginmfpic(83); % line 1162 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.0375,0.05),
+(0.0375,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1625,0.15),
+(0.0375,0.15));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1625,0),
+(0.0375,0.09));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.047906,0.082028),
+(-0.1125,0.0225),(-0.025108,0.031366));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.096479,0.029709),
+(-0.0125,0.0675));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1625,0.3),
+(0.0375,0.21));
+
+endmfpic; % (83) line 1178 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<84>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.3, -0.1625, 0.1625);
+
+beginmfpic(84); % line 1179 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.05,-0.0375),
+(0.25,-0.0375));
+
+store (curpath)
+drawn
+polyline (false)
+((0.15,-0.1625),
+(0.15,-0.0375));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.1625),
+(0.09,-0.0375));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.082028,0.047906),
+(0.0225,0.1125),(0.031366,0.025108));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.029709,0.096479),
+(0.0675,0.0125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.3,0.1625),
+(0.21,-0.0375));
+
+endmfpic; % (84) line 1195 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<85>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.1625, 0.1625, 0, 0.3);
+
+beginmfpic(85); % line 1196 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.0375,0.05),
+(-0.0375,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1625,0.15),
+(-0.0375,0.15));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1625,0),
+(-0.0375,0.09));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.099892,0.058634),
+(0.0125,0.0675),(0.077094,0.007972));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.1125,0.0225),
+(0.028521,0.060291));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1625,0.3),
+(-0.0375,0.21));
+
+endmfpic; % (85) line 1212 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<86>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.3, 0, -0.1625, 0.1625);
+
+beginmfpic(86); % line 1213 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.05,-0.0375),
+(-0.25,-0.0375));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.15,-0.1625),
+(-0.15,-0.0375));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.1625),
+(-0.09,-0.0375));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.058634,0.099892),
+(-0.0675,0.0125),(-0.007972,0.077094));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.0225,0.1125),
+(-0.060291,0.028521));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.3,0.1625),
+(-0.21,-0.0375));
+
+endmfpic; % (86) line 1229 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<87>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.1625, 0.1625, 0, 0.3);
+
+beginmfpic(87); % line 1230 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.0375,0.05),
+(0.0375,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((0.1625,0.15),
+(0.0375,0.15));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1625,0),
+(0.0375,0.09));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.077094,0.007972),
+(-0.0125,0.0675),(-0.099892,0.058634));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1125,0.0225),
+(-0.028521,0.060291));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.1625,0.3),
+(0.0375,0.21));
+
+endmfpic; % (87) line 1246 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<88>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.3, -0.1625, 0.1625);
+
+beginmfpic(88); % line 1247 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.05,-0.0375),
+(0.25,-0.0375));
+
+store (curpath)
+drawn
+polyline (false)
+((0.15,-0.1625),
+(0.15,-0.0375));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.1625),
+(0.09,-0.0375));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.007972,0.077094),
+(0.0675,0.0125),(0.058634,0.099892));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.0225,0.1125),
+(0.060291,0.028521));
+
+store (curpath)
+drawn
+polyline (false)
+((0.3,0.1625),
+(0.21,-0.0375));
+
+endmfpic; % (88) line 1263 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<89>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.4, -0.2, 0.2);
+
+beginmfpic(89); % line 1264 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+circle ((0.2,0),0.2);
+
+endmfpic; % (89) line 1269 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<90>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.252778);
+
+beginmfpic(90); % line 1270 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.227778),
+(0,0.227778));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.002778),
+(0,0.252778));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.083333,-0),
+(0,0.027778),(-0.083333,0.055556));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.027778),
+(-0.017568,0.027778));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.027778),
+(0,0.027778));
+
+endmfpic; % (90) line 1284 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<91>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.252778);
+
+beginmfpic(91); % line 1285 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.227778),
+(0,0.227778));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.002778),
+(0,0.252778));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.083333,0.055556),
+(0,0.027778),(0.083333,-0));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.027778),
+(0.017568,0.027778));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.027778),
+(0,0.027778));
+
+endmfpic; % (91) line 1299 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<92>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.252778);
+
+beginmfpic(92); % line 1300 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.227778),
+(0,0.227778));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.002778),
+(0,0.252778));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.027778),
+(-0.175,0.027778));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.066667,0.055556),
+(-0.15,0.027778),(-0.066667,-0));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.066667,0.027778),
+(-0.132432,0.027778));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.027778),
+(0,0.027778));
+
+endmfpic; % (92) line 1316 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<93>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.252778);
+
+beginmfpic(93); % line 1317 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.227778),
+(0,0.227778));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.002778),
+(0,0.252778));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.027778),
+(0.175,0.027778));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.066667,-0),
+(0.15,0.027778),(0.066667,0.055556));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.066667,0.027778),
+(0.132432,0.027778));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.027778),
+(0,0.027778));
+
+endmfpic; % (93) line 1333 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<94>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.25);
+
+beginmfpic(94); % line 1334 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.125),
+(0,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.129167,0.152778),
+(0.045833,0.125),(0.129167,0.097222));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.129167,0.125),
+(0.063402,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.225),
+(0,0.225));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.075));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.1),
+(0,0.15));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.175),
+(0,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.05,0.225),
+(-0.05,0.025),
+(-0.175,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((0.16393,0.125),
+(0.175,0.125),
+(0.175,0.025),
+(0.16393,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.025),
+(0,0.025));
+
+endmfpic; % (94) line 1361 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<95>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.25);
+
+beginmfpic(95); % line 1362 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.125),
+(0,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.129167,0.097222),
+(-0.045833,0.125),(-0.129167,0.152778));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.129167,0.125),
+(-0.063402,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.225),
+(0,0.225));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.075));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.1),
+(0,0.15));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.175),
+(0,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((0.05,0.225),
+(0.05,0.025),
+(0.175,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.16393,0.125),
+(-0.175,0.125),
+(-0.175,0.025),
+(-0.16393,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.025),
+(0,0.025));
+
+endmfpic; % (95) line 1389 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<96>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.25);
+
+beginmfpic(96); % line 1390 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.125),
+(0,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.045833,0.097222),
+(0.129167,0.125),(0.045833,0.152778));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.111598,0.125),
+(0.045833,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.225),
+(0,0.225));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.075));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.1),
+(0,0.15));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.175),
+(0,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.05,0.225),
+(-0.05,0.025),
+(-0.175,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((0.16393,0.125),
+(0.175,0.125),
+(0.175,0.025),
+(0.16393,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.025),
+(0,0.025));
+
+endmfpic; % (96) line 1417 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<97>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.25);
+
+beginmfpic(97); % line 1418 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.125),
+(0,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.045833,0.152778),
+(-0.129167,0.125),(-0.045833,0.097222));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.111598,0.125),
+(-0.045833,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.225),
+(0,0.225));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.075));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.1),
+(0,0.15));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.175),
+(0,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((0.05,0.225),
+(0.05,0.025),
+(0.175,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.16393,0.125),
+(-0.175,0.125),
+(-0.175,0.025),
+(-0.16393,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.025),
+(0,0.025));
+
+endmfpic; % (97) line 1445 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<98>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.25);
+
+beginmfpic(98); % line 1446 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.125),
+(0,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.129167,0.152778),
+(0.045833,0.125),(0.129167,0.097222));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.129167,0.125),
+(0.063402,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.225),
+(0,0.225));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.05,0.225),
+(-0.05,0.025),
+(-0.175,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((0.16393,0.125),
+(0.175,0.125),
+(0.175,0.025),
+(0.16393,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.025),
+(0,0.025));
+
+endmfpic; % (98) line 1469 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<99>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.25);
+
+beginmfpic(99); % line 1470 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.125),
+(0,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.129167,0.097222),
+(-0.045833,0.125),(-0.129167,0.152778));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.129167,0.125),
+(-0.063402,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.225),
+(0,0.225));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((0.05,0.225),
+(0.05,0.025),
+(0.175,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.16393,0.125),
+(-0.175,0.125),
+(-0.175,0.025),
+(-0.16393,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.025),
+(0,0.025));
+
+endmfpic; % (99) line 1493 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<100>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.25);
+
+beginmfpic(100); % line 1494 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.125),
+(0,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((0.045833,0.097222),
+(0.129167,0.125),(0.045833,0.152778));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((0.111598,0.125),
+(0.045833,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.225),
+(0,0.225));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.05,0.225),
+(-0.05,0.025),
+(-0.175,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((0.16393,0.125),
+(0.175,0.125),
+(0.175,0.025),
+(0.16393,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0.025),
+(0,0.025));
+
+endmfpic; % (100) line 1517 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<101>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0.175, 0, 0.25);
+
+beginmfpic(101); % line 1518 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.125),
+(0,0.125));
+
+resizedrawpen (0bp);
+
+store (curpath)
+drawn
+filled
+polyline (true)
+((-0.045833,0.152778),
+(-0.129167,0.125),(-0.045833,0.097222));
+
+resizedrawpen (0.8bp);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.111598,0.125),
+(-0.045833,0.125));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.225),
+(0,0.225));
+
+store (curpath)
+drawn
+polyline (false)
+((0,0),
+(0,0.25));
+
+store (curpath)
+drawn
+polyline (false)
+((0.05,0.225),
+(0.05,0.025),
+(0.175,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.16393,0.125),
+(-0.175,0.125),
+(-0.175,0.025),
+(-0.16393,0.025));
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0.025),
+(0,0.025));
+
+endmfpic; % (101) line 1541 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<102>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.35, -0.15, 0.15);
+
+beginmfpic(102); % line 1542 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.2,-0.15),
+(0,-0.15),
+(0,0.15),
+(0.2,0.15));
+
+store (curpath)
+drawn
+arcplr ((0.2,0),90,-90,0.15);
+
+endmfpic; % (102) line 1551 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<103>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.15, 0.15, -0.35, 0);
+
+beginmfpic(103); % line 1552 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.15,-0.2),
+(-0.15,0),
+(0.15,0),
+(0.15,-0.2));
+
+store (curpath)
+drawn
+arcplr ((0,-0.2),0,-180,0.15);
+
+endmfpic; % (103) line 1561 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<104>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.35, 0, -0.15, 0.15);
+
+beginmfpic(104); % line 1562 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.2,0.15),
+(0,0.15),
+(0,-0.15),
+(-0.2,-0.15));
+
+store (curpath)
+drawn
+arcplr ((-0.2,0),-90,-270,0.15);
+
+endmfpic; % (104) line 1571 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<105>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.15, 0.15, 0, 0.35);
+
+beginmfpic(105); % line 1572 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.15,0.2),
+(0.15,0),
+(-0.15,0),
+(-0.15,0.2));
+
+store (curpath)
+drawn
+arcplr ((0,0.2),-180,-360,0.15);
+
+endmfpic; % (105) line 1581 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<106>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.355556, -0.151089, 0.151089);
+
+beginmfpic(106); % line 1582 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.122222,0.148911),
+(0,0.148911));
+
+store (curpath)
+drawn
+arcplr ((-0.310672,-0.001089),25.772366,-25.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.151089),
+(0.122222,-0.151089));
+
+store (curpath)
+drawn
+arcplr ((0.122222,-0.107571),90,24.529547,0.256481);
+
+store (curpath)
+drawn
+arcplr ((0.122222,0.105392),-90,-24.529547,0.256481);
+
+endmfpic; % (106) line 1593 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<107>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.151089, 0.151089, -0.355556, -0);
+
+beginmfpic(107); % line 1594 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.148911,-0.122222),
+(0.148911,0));
+
+store (curpath)
+drawn
+arcplr ((-0.001089,0.310672),-64.227634,-115.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.151089,-0),
+(-0.151089,-0.122222));
+
+store (curpath)
+drawn
+arcplr ((-0.107571,-0.122222),0,-65.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((0.105392,-0.122222),180,245.470453,0.256481);
+
+endmfpic; % (107) line 1605 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<108>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.355556, -0, -0.151089, 0.151089);
+
+beginmfpic(108); % line 1606 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.122222,-0.148911),
+(0,-0.148911));
+
+store (curpath)
+drawn
+arcplr ((0.310672,0.001089),-154.227634,-205.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0,0.151089),
+(-0.122222,0.151089));
+
+store (curpath)
+drawn
+arcplr ((-0.122222,0.107571),-90,-155.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((-0.122222,-0.105392),90,155.470453,0.256481);
+
+endmfpic; % (108) line 1617 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<109>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.151089, 0.151089, 0, 0.355556);
+
+beginmfpic(109); % line 1618 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.148911,0.122222),
+(-0.148911,0));
+
+store (curpath)
+drawn
+arcplr ((0.001089,-0.310672),115.772366,64.623066,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.151089,0),
+(0.151089,0.122222));
+
+store (curpath)
+drawn
+arcplr ((0.107571,0.122222),-180,-245.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((-0.105392,0.122222),0,65.470453,0.256481);
+
+endmfpic; % (109) line 1629 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<110>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.175, -0.1, 0.1);
+
+beginmfpic(110); % line 1630 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0),
+(0,-0.1),
+(0,0.1),
+(0.175,0));
+
+endmfpic; % (110) line 1638 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<111>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.1, 0.1, -0.175, 0);
+
+beginmfpic(111); % line 1639 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.175),
+(-0.1,0),
+(0.1,0),
+(0,-0.175));
+
+endmfpic; % (111) line 1647 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<112>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.175, 0, -0.1, 0.1);
+
+beginmfpic(112); % line 1648 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0),
+(0,0.1),
+(0,-0.1),
+(-0.175,0));
+
+endmfpic; % (112) line 1656 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<113>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.1, 0.1, 0, 0.175);
+
+beginmfpic(113); % line 1657 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.175),
+(0.1,0),
+(-0.1,0),
+(0,0.175));
+
+endmfpic; % (113) line 1665 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<114>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.425, -0.15, 0.15);
+
+beginmfpic(114); % line 1666 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.2,-0.15),
+(0,-0.15),
+(0,0.15),
+(0.2,0.15));
+
+store (curpath)
+drawn
+arcplr ((0.2,0),90,-90,0.15);
+
+store (curpath)
+drawn
+circle ((0.3875,0),0.0375);
+
+endmfpic; % (114) line 1676 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<115>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.15, 0.15, -0.425, 0);
+
+beginmfpic(115); % line 1677 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.15,-0.2),
+(-0.15,0),
+(0.15,0),
+(0.15,-0.2));
+
+store (curpath)
+drawn
+arcplr ((0,-0.2),0,-180,0.15);
+
+store (curpath)
+drawn
+circle ((0,-0.3875),0.0375);
+
+endmfpic; % (115) line 1687 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<116>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.425, 0, -0.15, 0.15);
+
+beginmfpic(116); % line 1688 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.2,0.15),
+(0,0.15),
+(0,-0.15),
+(-0.2,-0.15));
+
+store (curpath)
+drawn
+arcplr ((-0.2,0),-90,-270,0.15);
+
+store (curpath)
+drawn
+circle ((-0.3875,0),0.0375);
+
+endmfpic; % (116) line 1698 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<117>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.15, 0.15, 0, 0.425);
+
+beginmfpic(117); % line 1699 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.15,0.2),
+(0.15,0),
+(-0.15,0),
+(-0.15,0.2));
+
+store (curpath)
+drawn
+arcplr ((0,0.2),-180,-360,0.15);
+
+store (curpath)
+drawn
+circle ((0,0.3875),0.0375);
+
+endmfpic; % (117) line 1709 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<118>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.430556, -0.151089, 0.151089);
+
+beginmfpic(118); % line 1710 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.122222,0.148911),
+(0,0.148911));
+
+store (curpath)
+drawn
+arcplr ((-0.310672,-0.001089),25.772366,-25.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.151089),
+(0.122222,-0.151089));
+
+store (curpath)
+drawn
+arcplr ((0.122222,-0.107571),90,24.529547,0.256481);
+
+store (curpath)
+drawn
+arcplr ((0.122222,0.105392),-90,-24.529547,0.256481);
+
+store (curpath)
+drawn
+circle ((0.393056,-0.001089),0.0375);
+
+endmfpic; % (118) line 1722 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<119>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.151089, 0.151089, -0.430556, -0);
+
+beginmfpic(119); % line 1723 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.148911,-0.122222),
+(0.148911,0));
+
+store (curpath)
+drawn
+arcplr ((-0.001089,0.310672),-64.227634,-115.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.151089,-0),
+(-0.151089,-0.122222));
+
+store (curpath)
+drawn
+arcplr ((-0.107571,-0.122222),0,-65.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((0.105392,-0.122222),180,245.470453,0.256481);
+
+store (curpath)
+drawn
+circle ((-0.001089,-0.393056),0.0375);
+
+endmfpic; % (119) line 1735 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<120>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.430556, -0, -0.151089, 0.151089);
+
+beginmfpic(120); % line 1736 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.122222,-0.148911),
+(0,-0.148911));
+
+store (curpath)
+drawn
+arcplr ((0.310672,0.001089),-154.227634,-205.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0,0.151089),
+(-0.122222,0.151089));
+
+store (curpath)
+drawn
+arcplr ((-0.122222,0.107571),-90,-155.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((-0.122222,-0.105392),90,155.470453,0.256481);
+
+store (curpath)
+drawn
+circle ((-0.393056,0.001089),0.0375);
+
+endmfpic; % (120) line 1748 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<121>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.151089, 0.151089, 0, 0.430556);
+
+beginmfpic(121); % line 1749 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.148911,0.122222),
+(-0.148911,0));
+
+store (curpath)
+drawn
+arcplr ((0.001089,-0.310672),115.772366,64.623066,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.151089,0),
+(0.151089,0.122222));
+
+store (curpath)
+drawn
+arcplr ((0.107571,0.122222),-180,-245.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((-0.105392,0.122222),0,65.470453,0.256481);
+
+store (curpath)
+drawn
+circle ((0.001089,0.393056),0.0375);
+
+endmfpic; % (121) line 1761 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<122>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0, 0.4, -0.151089, 0.151089);
+
+beginmfpic(122); % line 1762 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+arcplr ((-0.316228,-0.001089),25.376934,-25.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.166667,0.148911),
+(0.044444,0.148911));
+
+store (curpath)
+drawn
+arcplr ((-0.266228,-0.001089),25.772366,-25.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.044444,-0.151089),
+(0.166667,-0.151089));
+
+store (curpath)
+drawn
+arcplr ((0.166667,-0.107571),90,24.529547,0.256481);
+
+store (curpath)
+drawn
+arcplr ((0.166667,0.105392),-90,-24.529547,0.256481);
+
+endmfpic; % (122) line 1774 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<123>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.151089, 0.151089, -0.4, 0);
+
+beginmfpic(123); % line 1775 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+arcplr ((-0.001089,0.316228),-64.623066,-115.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.148911,-0.166667),
+(0.148911,-0.044444));
+
+store (curpath)
+drawn
+arcplr ((-0.001089,0.266228),-64.227634,-115.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.151089,-0.044444),
+(-0.151089,-0.166667));
+
+store (curpath)
+drawn
+arcplr ((-0.107571,-0.166667),0,-65.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((0.105392,-0.166667),180,245.470453,0.256481);
+
+endmfpic; % (123) line 1787 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<124>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.4, 0, -0.151089, 0.151089);
+
+beginmfpic(124); % line 1788 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+arcplr ((0.316228,0.001089),-154.623066,-205.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.166667,-0.148911),
+(-0.044444,-0.148911));
+
+store (curpath)
+drawn
+arcplr ((0.266228,0.001089),-154.227634,-205.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.044444,0.151089),
+(-0.166667,0.151089));
+
+store (curpath)
+drawn
+arcplr ((-0.166667,0.107571),-90,-155.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((-0.166667,-0.105392),90,155.470453,0.256481);
+
+endmfpic; % (124) line 1800 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<125>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.151089, 0.151089, 0, 0.4);
+
+beginmfpic(125); % line 1801 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+arcplr ((0.001089,-0.316228),115.376934,64.623066,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.148911,0.166667),
+(-0.148911,0.044444));
+
+store (curpath)
+drawn
+arcplr ((0.001089,-0.266228),115.772366,64.623066,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.151089,0.044444),
+(0.151089,0.166667));
+
+store (curpath)
+drawn
+arcplr ((0.107571,0.166667),180,114.529547,0.256481);
+
+store (curpath)
+drawn
+arcplr ((-0.105392,0.166667),0,65.470453,0.256481);
+
+endmfpic; % (125) line 1813 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<126>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0, 0.475, -0.151089, 0.151089);
+
+beginmfpic(126); % line 1814 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+arcplr ((-0.316228,-0.001089),25.376934,-25.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.166667,0.148911),
+(0.044444,0.148911));
+
+store (curpath)
+drawn
+arcplr ((-0.266228,-0.001089),25.772366,-25.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.044444,-0.151089),
+(0.166667,-0.151089));
+
+store (curpath)
+drawn
+arcplr ((0.166667,-0.107571),90,24.529547,0.256481);
+
+store (curpath)
+drawn
+arcplr ((0.166667,0.105392),-90,-24.529547,0.256481);
+
+store (curpath)
+drawn
+circle ((0.4375,-0.001089),0.0375);
+
+endmfpic; % (126) line 1827 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<127>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.151089, 0.151089, -0.475, 0);
+
+beginmfpic(127); % line 1828 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+arcplr ((-0.001089,0.316228),-64.623066,-115.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.148911,-0.166667),
+(0.148911,-0.044444));
+
+store (curpath)
+drawn
+arcplr ((-0.001089,0.266228),-64.227634,-115.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.151089,-0.044444),
+(-0.151089,-0.166667));
+
+store (curpath)
+drawn
+arcplr ((-0.107571,-0.166667),0,-65.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((0.105392,-0.166667),180,245.470453,0.256481);
+
+store (curpath)
+drawn
+circle ((-0.001089,-0.4375),0.0375);
+
+endmfpic; % (127) line 1841 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<128>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.475, 0, -0.151089, 0.151089);
+
+beginmfpic(128); % line 1842 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+arcplr ((0.316228,0.001089),-154.623066,-205.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.166667,-0.148911),
+(-0.044444,-0.148911));
+
+store (curpath)
+drawn
+arcplr ((0.266228,0.001089),-154.227634,-205.376934,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.044444,0.151089),
+(-0.166667,0.151089));
+
+store (curpath)
+drawn
+arcplr ((-0.166667,0.107571),-90,-155.470453,0.256481);
+
+store (curpath)
+drawn
+arcplr ((-0.166667,-0.105392),90,155.470453,0.256481);
+
+store (curpath)
+drawn
+circle ((-0.4375,0.001089),0.0375);
+
+endmfpic; % (128) line 1855 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<129>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.151089, 0.151089, 0, 0.475);
+
+beginmfpic(129); % line 1856 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+arcplr ((0.001089,-0.316228),115.376934,64.623066,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((-0.148911,0.166667),
+(-0.148911,0.044444));
+
+store (curpath)
+drawn
+arcplr ((0.001089,-0.266228),115.772366,64.623066,0.35);
+
+store (curpath)
+drawn
+polyline (false)
+((0.151089,0.044444),
+(0.151089,0.166667));
+
+store (curpath)
+drawn
+arcplr ((0.107571,0.166667),180,114.529547,0.256481);
+
+store (curpath)
+drawn
+arcplr ((-0.105392,0.166667),0,65.470453,0.256481);
+
+store (curpath)
+drawn
+circle ((0.001089,0.4375),0.0375);
+
+endmfpic; % (129) line 1869 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<130>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (0, 0.25, -0.1, 0.1);
+
+beginmfpic(130); % line 1870 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0.175,0),
+(0,-0.1),
+(0,0.1),
+(0.175,0));
+
+store (curpath)
+drawn
+circle ((0.2125,0),0.0375);
+
+endmfpic; % (130) line 1879 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<131>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.1, 0.1, -0.25, 0);
+
+beginmfpic(131); % line 1880 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,-0.175),
+(-0.1,0),
+(0.1,0),
+(0,-0.175));
+
+store (curpath)
+drawn
+circle ((0,-0.2125),0.0375);
+
+endmfpic; % (131) line 1889 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<132>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.25, 0, -0.1, 0.1);
+
+beginmfpic(132); % line 1890 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((-0.175,0),
+(0,0.1),
+(0,-0.1),
+(-0.175,0));
+
+store (curpath)
+drawn
+circle ((-0.2125,0),0.0375);
+
+endmfpic; % (132) line 1899 in the TeX source.
+%------------------------------------------
+
+
+%----------------------------<133>
+unitlen := 1.0pt#;
+xscale := 72; yscale := 72;
+bounds (-0.1, 0.1, 0, 0.25);
+
+beginmfpic(133); % line 1900 in the TeX source.
+
+resizedrawpen (0.8bp);
+setcolor (drawcolor) black;
+
+store (curpath)
+drawn
+polyline (false)
+((0,0.175),
+(0.1,0),
+(-0.1,0),
+(0,0.175));
+
+store (curpath)
+drawn
+circle ((0,0.2125),0.0375);
+
+endmfpic; % (133) line 1909 in the TeX source.
+%------------------------------------------
+
+
+end.
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/cct.tfm b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/cct.tfm
new file mode 100644
index 00000000000..142e6cd003f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/cct.tfm
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/font.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/font.m4
new file mode 100644
index 00000000000..f94e98207b9
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/font.m4
@@ -0,0 +1,424 @@
+\documentclass[11pt]{article}
+\usepackage{mfpic}
+\pagestyle{empty}
+\begin{document}
+\thispagestyle{empty}
+\opengraphsfile{cct}
+
+ifdef(`L_unit',,`include(liblog.m4)')
+define(`srad_',`sourcerad_*3/2')
+define(`quad_',`srad_/sqrt(2)')
+define(`Dim',`dimen_*2/3')
+.PS
+ resistor(right_ Dim)
+.PE
+.PS
+ resistor(up_ Dim)
+.PE
+.PS
+ inductor(right_ Dim,W)
+.PE
+.PS
+ inductor(down_ Dim,W)
+.PE
+.PS
+ inductor(left_ Dim,W)
+.PE
+.PS
+ inductor(up_ Dim,W)
+.PE
+.PS
+ {eleminit_(right Dim)}
+ m4m_core(Here,m4wd,m4ht+dimen_/24,dimen_/16)
+.PE
+.PS
+ {eleminit_(up_ Dim)}
+ m4m_core(Here,m4wd,m4ht+dimen_/24,dimen_/16)
+.PE
+.PS
+ inductor(right_ Dim)
+.PE
+.PS
+ inductor(down_ Dim)
+.PE
+.PS
+ inductor(left_ Dim)
+.PE
+.PS
+ inductor(up_ Dim)
+.PE
+.PS
+ inductor(up_ Dim)
+.PE
+.PS
+ {eleminit_(right Dim)}
+ m4m_core(Here,m4wd,m4ht+dimen_/24,dimen_/16)
+.PE
+.PS
+ {eleminit_(up_ Dim)}
+ m4m_core(Here,m4wd,m4ht+dimen_/24,dimen_/16)
+.PE
+.PS
+ capacitor(right_ Dim,C)
+.PE
+.PS
+ capacitor(down_ Dim,C)
+.PE
+.PS
+ capacitor(left_ Dim,C)
+.PE
+.PS
+ capacitor(up_ Dim,C)
+.PE
+.PS
+ capacitor(right_ Dim)
+.PE
+.PS
+ capacitor(up_ Dim)
+.PE
+.PS
+ diode(right_ Dim)
+.PE
+.PS
+ diode(down_ Dim)
+.PE
+.PS
+ diode(left_ Dim)
+.PE
+.PS
+ diode(up_ Dim)
+.PE
+.PS
+ diode(right_ Dim,Z)
+.PE
+.PS
+ diode(down_ Dim,Z)
+.PE
+.PS
+ diode(left_ Dim,Z)
+.PE
+.PS
+ diode(up_ Dim,Z)
+.PE
+.PS
+ diode(right_ Dim,BD)
+.PE
+.PS
+ diode(down_ Dim,BD)
+.PE
+.PS
+ xtal(right_ Dim)
+.PE
+.PS
+ xtal(down_ Dim)
+.PE
+.PS
+ source(right_ Dim)
+.PE
+.PS
+ source(up_ Dim)
+.PE
+.PS
+ arc rad sourcerad_/3 cw from Here-(sourcerad_*2/3,0) to Here\
+ with .c at Here-(sourcerad_/3,0)
+ arc rad sourcerad_/3 ccw from Here to Here+(sourcerad_*2/3,0) \
+ with .c at Here+(sourcerad_/3,0)
+.PE
+.PS
+ consource(right_ Dim)
+.PE
+.PS
+ consource(up_ Dim)
+.PE
+.PS
+ {move down 1 bp__ then up_ 2 bp__}; arrow right_ srad_
+.PE
+.PS
+ {move right 1 bp__ then left 2 bp__}; arrow down_ srad_
+.PE
+.PS
+ {move down 1 bp__ then up_ 2 bp__}; arrow left_ srad_
+.PE
+.PS
+ {move right 1 bp__ then left 2 bp__}; arrow up_ srad_
+.PE
+.PS
+ arrow right quad_ up quad_
+.PE
+.PS
+ arrow left quad_ up quad_
+.PE
+.PS
+ arrow left quad_ down quad_
+.PE
+.PS
+ arrow right quad_ down quad_
+.PE
+.PS
+ battery(right_ Dim)
+.PE
+.PS
+ battery(down_ Dim)
+.PE
+.PS
+ battery(left_ Dim)
+.PE
+.PS
+ battery(up_ Dim)
+.PE
+.PS
+ battery(right_ Dim,3)
+.PE
+.PS
+ battery(down_ Dim,3)
+.PE
+.PS
+ battery(left_ Dim,3)
+.PE
+.PS
+ battery(up_ Dim,3)
+.PE
+.PS
+ ebox(right_ Dim)
+.PE
+.PS
+ ebox(up_ Dim)
+.PE
+.PS
+ switch(right_ Dim)
+.PE
+.PS
+ switch(down_ Dim)
+.PE
+.PS
+ switch(left_ Dim)
+.PE
+.PS
+ switch(up_ Dim)
+.PE
+.PS
+ switch(right_ Dim,,O)
+.PE
+.PS
+ switch(down_ Dim,,O)
+.PE
+.PS
+ switch(left_ Dim,,O)
+.PE
+.PS
+ switch(up_ Dim,,O)
+.PE
+.PS
+ switch(right_ Dim,,C)
+.PE
+.PS
+ switch(down_ Dim,,C)
+.PE
+.PS
+ switch(left_ Dim,,C)
+.PE
+.PS
+ switch(up_ Dim,,C)
+.PE
+.PS
+ amp(right_ Dim*3/2*5/4)
+.PE
+.PS
+ amp(down_ Dim*3/2*5/4)
+.PE
+.PS
+ amp(left_ Dim*3/2*5/4)
+.PE
+.PS
+ amp(up_ Dim*3/2*5/4)
+.PE
+.PS
+ delay(right_ Dim)
+.PE
+.PS
+ delay(down_ Dim)
+.PE
+.PS
+ delay(left_ Dim)
+.PE
+.PS
+ delay(up_ Dim)
+.PE
+.PS
+rp_ang = 0
+ right_
+ ground(,T)
+.PE
+.PS
+rp_ang = 0
+ right_
+ ground
+.PE
+.PS
+ down_; transformer(,L)
+.PE
+.PS
+ right_; transformer(,L)
+.PE
+.PS
+ up_; bi_tr
+.PE
+.PS
+ left_; bi_tr
+.PE
+.PS
+ up_; bi_tr(,R)
+.PE
+.PS
+ right_; bi_tr(,R)
+.PE
+.PS
+ up_; bi_tr(,,P)
+.PE
+.PS
+ left_; bi_tr(,,P)
+.PE
+.PS
+ up_; bi_tr(,R,P)
+.PE
+.PS
+ right_; bi_tr(,R,P)
+.PE
+.PS
+ circle rad 4*dimen_/10
+.PE
+.PS
+ up_; j_fet
+.PE
+.PS
+ up_; j_fet(,R)
+.PE
+.PS
+ up_; j_fet(,,P,)
+.PE
+.PS
+ up_; j_fet(,R,P,)
+.PE
+.PS
+ up_; e_fet(,,,)
+.PE
+.PS
+ up_; e_fet(,R,,)
+.PE
+.PS
+ up_; e_fet(,,P,)
+.PE
+.PS
+ up_; e_fet(,R,P,)
+.PE
+.PS
+ up_; d_fet(,,,)
+.PE
+.PS
+ up_; d_fet(,R,,)
+.PE
+.PS
+ up_; d_fet(,,P,)
+.PE
+.PS
+ up_; d_fet(,R,P,)
+.PE
+.PS
+ right_; AND_gate
+.PE
+.PS
+ down_; AND_gate
+.PE
+.PS
+ left_; AND_gate
+.PE
+.PS
+ up_; AND_gate
+.PE
+.PS
+ right_; OR_gate
+.PE
+.PS
+ down_; OR_gate
+.PE
+.PS
+ left_; OR_gate
+.PE
+.PS
+ up_; OR_gate
+.PE
+.PS
+ right_; BUFFER_gate
+.PE
+.PS
+ down_; BUFFER_gate
+.PE
+.PS
+ left_; BUFFER_gate
+.PE
+.PS
+ up_; BUFFER_gate
+.PE
+.PS
+ right_; NAND_gate
+.PE
+.PS
+ down_; NAND_gate
+.PE
+.PS
+ left_; NAND_gate
+.PE
+.PS
+ up_; NAND_gate
+.PE
+.PS
+ right_; NOR_gate
+.PE
+.PS
+ down_; NOR_gate
+.PE
+.PS
+ left_; NOR_gate
+.PE
+.PS
+ up_; NOR_gate
+.PE
+.PS
+ right_; XOR_gate
+.PE
+.PS
+ down_; XOR_gate
+.PE
+.PS
+ left_; XOR_gate
+.PE
+.PS
+ up_; XOR_gate
+.PE
+.PS
+ right_; NXOR_gate
+.PE
+.PS
+ down_; NXOR_gate
+.PE
+.PS
+ left_; NXOR_gate
+.PE
+.PS
+ up_; NXOR_gate
+.PE
+.PS
+ right_; NOT_gate
+.PE
+.PS
+ down_; NOT_gate
+.PE
+.PS
+ left_; NOT_gate
+.PE
+.PS
+ up_; NOT_gate
+.PE
+
+\closegraphsfile
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/mftest b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/mftest
new file mode 100755
index 00000000000..f75b74f39d0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mf/mftest
@@ -0,0 +1,43 @@
+#!/bin/sh
+# mftest -- script to test the mf version of a single picture file
+#
+# Usage: mftest file
+#
+# e.g. copy ex01.m4 here and type ./mftest ex01
+# Invokes m4 on file.m4, and builds the resulting picture in file.ps
+
+LIBS=mfpic.m4
+MODE=ljfzzz
+
+echo "\documentclass{article}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\usepackage{mfpic}
+&begin{document}
+\opengraphsfile{"$1"mfpic}
+%{This is a test of the -m option of dpic (mfpic output).}" \
+| tr '\046' '\134' > $1.tex
+
+m4 -B16000 $LIBS $1.m4 | dpic -m >> $1.tex
+
+echo "
+&closegraphsfile
+\end{document}" | tr '\046' '\134' >> $1.tex
+
+echo "
+latex "$1
+latex $1
+echo "
+mf \mode:=$MODE; scrollmode; input $1""mfpic < /dev/null"
+mf "\mode:="$MODE"; scrollmode; input "$1mfpic < /dev/null
+echo "
+gftopk:"
+ls $1mfpic.*gf | sed -e 's/^/gftopk /' \
+ -e "s/$1mfpic.\([0-9]*\)gf/$1mfpic.\1gf $1mfpic.\1pk/" | sh
+ls $1mfpic.*gf $1mfpic.*pk
+cp $1mfpic.*pk $1mfpic.pk
+echo "
+TEXFORMATS=.: TEXFONTS=.: latex $1"
+TEXFORMATS=.: TEXFONTS=.: latex $1
+echo "
+TEXPKS=.: dvips -M1 -P$MODE $1 -o"
+TEXPKS=.: dvips -M1 -P$MODE $1 -o
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mode.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/mode.tex
new file mode 100644
index 00000000000..f9aeb853844
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mode.tex
@@ -0,0 +1 @@
+\usepackage{tikz}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/Makefile
new file mode 100644
index 00000000000..37badbbf404
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/Makefile
@@ -0,0 +1,133 @@
+# Makefile for the mpost subdirectory
+# To test a new file, copy it into test.m4 and type "make tst" or "make tst1"
+
+M4 = m4 mpost.m4
+# If the M4PATH environment variable has not been set to include the
+# installation directory then change $$HOME/lib to point to the directory,
+# and uncomment the following:
+
+# M4 = m4 -I $$HOME/lib mpost.m4
+
+#---------------------------------------------
+
+MKDIM=pwd | sed -e 's%^%=boxdimfile{%' -e 's%/cygdrive/\(.\)/%\1:/%' \
+ -e 's%$$%/$(DIMFILE)}%'
+
+# Comment out the following line to produce absolute addresses for .dim files.
+MKDIM=printf '=boxdimfile{$(DIMFILE)}\n'
+
+#---------------------------------------------
+
+DOC = examplesmpost
+FIGS = Adder.1 Alogix.1 ABlogix.1 Antennas.1 AmpTable.1 Audio.1 \
+ Bip.1 Btree.1 Byte.1 Buttons.1 \
+ Counting.1 Crossbar.1 Crow.1 Csource.1 CanLogic.1 CctTable.1 Conn.1 \
+ Decoder.1 Demultiplexer.1 Diodes.1 Drive.1 \
+ Emarrows.1 Flow.1 Fuses.1 \
+ Grounds.1 Headers.1 Heathkit.1 I2L.1 Inclpdf.1 Jack.1 \
+ Logic.1 Loglog.1 MC.1 Mixer.1 MotorControl.1 Multiplexer.1 \
+ NLG.1 NPDT.1 Nport.1 \
+ Opamp.1 Optoiso.1 Pconn.1 PushPull.1 Quantum.1 \
+ Rectifiers.1 Relay.1 Rotbox.1 \
+ Schottky.1 Sierpinski.1 ShiftR.1 Sixpole.1 Sources.1 SQUID.1 Switches.1 \
+ Tgate.1 Three.1 Timer.1 TTLnand.1 Ttree.1 \
+ Variable.1 Windings.1 Xform.1 \
+ control.1 csc.1 diamond.1 ex00.1 ex01.1 ex02.1 \
+ ex03.1 ex04.1 ex05.1 ex06.1 ex08.1 ex09.1 ex10.1 \
+ ex11.1 ex12.1 ex15.1 ex16.1 ex17.1 ex18.1 ex21.1 exp.1 \
+ fet.1 graysurf.1 lcct.1 pwrsupply.1 quick.1 \
+ recycle.1 rose.1 shapes.1 thyristor.1 sfg.1 ujt.1 worm.1 XOR.1
+
+BOXDIMS = ex09 Crow Inclpdf Loglog Opamp Ttree Windings
+
+# It is advisable to do `make clean' between test examples.
+#---------------------------------------------
+
+DPIC = dpic
+# DPIC = $$HOME/dpic/test/dpic
+
+MPOST = mpost --tex=latex
+
+TR = | tr '=' '\134'
+
+LATEX = latex
+DVIPS = dvips
+
+DIMFILE = tmp.dim
+
+.SUFFIXES: .mp .dvi .ps .m4 .1
+.dvi.ps:
+ $(DVIPS) $* -o
+.tex.dvi:
+ $(LATEX) $*
+.m4.mp:
+ $(M4) $*.m4 | $(DPIC) -s > $*.mp
+# $(M4) $*.m4 $*.pic
+# $(DPIC) -s $*.pic > $*.mp
+.m4.1:
+ @touch $(DIMFILE) $(DOC).dim
+ $(M4) $(DIMFILE) $(DOC).dim $*.m4 > $(DOC).pic
+ @(printf 'verbatimtex\n' ;\
+ printf '=documentclass[11pt]{article}\n' ;\
+ printf '=usepackage{times,boxdims,graphicx}\n' ;\
+ printf '=usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}\n' ;\
+ $(MKDIM) ;\
+ printf '=begin{document} etex\n' ) $(TR) > $*.mp
+# $(M4) $(DIMFILE) $(DOC).dim $*.m4 | $(DPIC) -s >> $*.mp
+ dpic -s $(DOC).pic >> $*.mp
+ @printf 'end\n' >> $*.mp
+ $(MPOST) $*.mp
+
+$(DOC).ps: $(DOC).dvi
+ $(DVIPS) $(DOC) -o
+
+EXL = exlinks
+$(DOC).dvi: $(DOC).tex
+ -if test "$(DOC)" = "examplesmpost" ; then make exlinks dims; fi
+ make $(FIGS)
+ $(LATEX) $(DOC)
+ -if test -n "$(BOXDIMS)" ; then rm -f dims; \
+ for box in $(BOXDIMS) ; do rm -f $$box.1; done; \
+ make BOXDIMS="$(BOXDIMS)" dims; $(LATEX) $(DOC); fi
+
+dims:
+ -if test -n "$(BOXDIMS)" ; then for box in $(BOXDIMS) ; do \
+ make $$box.1; rm -f $$box.1; make $$box.1; done; fi
+ touch dims
+
+figs: $(EXL) $(FIGS)
+
+exlinks:
+ @echo ""
+ @echo 'Ignore "cannot create ... exists" warnings.'
+ -@if test ! -f ex11.m4 ; then \
+ ls ../*.m4 | sed -e 's/^/ln -s /' -e '/test.m4/d' | sh;\
+ fi
+ -@if test ! -f AmpTable.m4 ; then \
+ ls ../../doc/*.m4 ../*.bb ../*.gz | sed -e 's/^/ln -s /' | sh;\
+ fi
+ -if test -n "$(EXL)" ; then touch $(EXL) ; fi
+
+clobber: clean
+
+tst:
+ rm -f tst.ps tst.dvi test.1 test.mp
+ make EXL="" DPIC="$(DPIC)" CONFIGFILE="$(CONFIGFILE)" DOC=tstmpost \
+ FIGS=test.1 BOXDIMS=test
+ rm -f *.frs
+
+tst1: test.1 tstmpost.tex
+ latex tstmpost
+ dvips tstmpost
+
+clean:
+ rm -f stamp-* $(FIGS) *.pic
+ -if /usr/bin/test -f exlinks ; then \
+ ls -l *.m4 *.bb *.gz | grep '\->' | \
+ sed -e 's/^.* \([^ ][^ ]*\) ->.*$$/rm -f \1/' | sh; fi
+ rm -f Incl.eps.bb Incl.eps.gz
+ rm -f *.log *.dvi *.ps test.pdf *.aux *.mp *.[0-9] *.[0-9][0-9] *.mpx *.dim
+ rm -f core log mpxerr* *links figs.* *.dim dims F_test.*
+ rm -f man[0-9]*.pic man[0-9]*.m4 figs.m4 test.1 test.mp test.pic test.tex
+ -if test -n "$(BOXDIMS)" ; then for box in $(BOXDIMS) ; do \
+ rm -f F_$$box.tex $$box.tex ; done; fi
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/README-mpost b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/README-mpost
new file mode 100644
index 00000000000..8ac5ba426f3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/README-mpost
@@ -0,0 +1,13 @@
+
+THIS DIRECTORY contains a Makefile and test files for the MetaPost
+output of dpic.
+
+1. On a Unix-like system, typing "make" processes the examples file
+ and the diagrams it includes to produce examplesmpost.ps. Each diagram is
+ passed through m4, dpic, and MetaPost, and then is imported into
+ examplesmpost.tex by the \includegraphics macro. On MikTeX, check the MKDIM
+ definition in the Makefile before typing "make".
+
+2. To work on a single file, copy the source into test.m4 in this directory
+ and type make tst. The files test.pic, test.mp, test.1, tst.dvi, and tst.ps
+ will be created.
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/examplesmpost.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/examplesmpost.tex
new file mode 100644
index 00000000000..280a985c49e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/examplesmpost.tex
@@ -0,0 +1,21 @@
+% mpost examples.tex
+
+\documentclass[11pt]{article}
+\usepackage{times,boxdims,pstricks}
+\usepackage{rotating}
+\usepackage{graphicx}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+
+\input ../header
+
+\global\mposttrue
+\begin{document}
+ \hfill
+ {\large\bf Examples:
+ \input{../../doc/Version.tex}
+ }
+ \hfill\break
+ The source files have been processed with m4, dpic -s, and MetaPost to
+ produce this file.
+
+\input ../files.tex
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/mptest b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/mptest
new file mode 100755
index 00000000000..29f6d5841ae
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/mptest
@@ -0,0 +1,27 @@
+#!/bin/sh
+# mptest -- script to process a single picture file through MetaPost
+# to produce an eps file
+#
+# Usage: ./mptest file
+# You may have to make this file executable first.
+#
+# e.g. copy ex01.m4 here and type ./mptest ex01
+# Starting with file.m4, invoke m4, dpic -s, and MetaPost to produce file.1
+
+LIBS=mpost.m4
+
+rm -f $1.ps F$1.* $1.1 $1.mp $1.pic
+m4 $LIBS $1.m4 > $1.pic
+
+# Write the LaTeX heading. The = signs get translated to backslashes
+#
+( echo 'verbatimtex
+=documentclass[11pt]{article}
+=usepackage{times,boxdims}=usepackage{graphicx}
+=usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+=begin{document} etex
+') | tr '=' '\134' > $1.mp
+
+dpic -s $1.pic >> $1.mp
+
+TEX=latex mpost $1.mp end
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/tstmpost.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/tstmpost.tex
new file mode 100644
index 00000000000..a791b3d9dd8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/mpost/tstmpost.tex
@@ -0,0 +1,18 @@
+\documentclass[11pt,dvips]{article}
+\usepackage[dvips]{graphicx}
+\usepackage{amssymb,pstricks,boxdims,pst-grad}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\addtolength{\textwidth}{2cm}
+\addtolength{\textheight}{3cm}
+\setlength{\oddsidemargin}{0pt}
+\setlength{\evensidemargin}{0pt}
+\setlength{\hoffset}{-0.5in}
+
+\pagestyle{empty}
+\thispagestyle{empty}
+%
+\begin{document}
+\vspace*{-1bp}
+\includegraphics{test.1}
+\vspace*{-1bp}
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/person.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/person.m4
new file mode 100644
index 00000000000..c0033d63fe6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/person.m4
@@ -0,0 +1,43 @@
+.PS
+# person.m4
+gen_init
+
+divert(-1)
+ `person(
+ height=val;width=val;fill="colorname")
+ e.g. person(height=1;fill="gray")'
+define(`person',`[ setkey_(`$1',height,linewid)
+ setkey_(`$1',width,m4height*2/5)dnl
+ setkey_(`$1',fill,"black",N)dnl
+ bodywid = m4width/2
+ bodyrad = bodywid/8
+ bodyht = (m4height - bodywid - bodywid/16 + bodyrad*2)/2
+ tmplth = linethick; linethick = 0
+ Head: circle diam bodywid colored m4fill
+ Body: box rad bodyrad ht bodyht wid bodywid colored m4fill \
+ with .n at Head.s+(0,-Head.diam/16)
+ armwid = bodywid/3
+ Armleft: box wid armwid rad armwid/2 ht Body.ht-bodyrad colored m4fill \
+ with .w at Body.e + (armwid/2,0)
+ Armright: box same with .e at Body.w + (-armwid/2,0)
+ Legleft: box wid bodywid/2.5 rad armwid/2 ht Body.ht colored m4fill \
+ with .n at (Body.w,Body.s)+(bodywid/5,bodyrad*2)
+ Legright: box same with .n at (Body.e,Body.s)+(-bodywid/5,bodyrad*2)
+ linethick_(tmplth)
+ popdef(`m4height',`m4fill')dnl
+ ]')
+
+divert(0)dnl
+
+ linewid = 3*linewid
+
+ setrgb(0.54,0.81,0.94,babyblue)
+ person(fill="babyblue")
+ person(width=linewid*3/4;fill="babyblue")
+ person(width=linewid;fill="babyblue")
+ person
+ resetrgb
+ person(height=1;fill="gray")
+
+ line up linewid with .c at last [].e+(linewid/10,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/Makefile
new file mode 100644
index 00000000000..daf98f1c5ad
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/Makefile
@@ -0,0 +1,160 @@
+# Makefile for the pgf subdirectory
+
+# Type "make" to produce the examplespgf.pdf file
+# Type "make examplespgf.ps" for postscript output
+# Type "make tst" to process the file test.m4 and produce tstpgf.ps
+# Type "make tst.pdf" to process the file test.m4 and produce tstpgf.pdf
+
+# Where the .m4 libraries are installed. Change if necessary:
+LIBDIR = $$HOME/lib
+
+#---------------------------------------------
+
+# The .m4 circuit_macro libraries used for the examples:
+M4MACROS = pgf.m4
+M4 = m4 -I $(LIBDIR)
+
+#---------------------------------------------
+DOC = examplespgf
+
+FIGS = Adder.tex Alogix.tex ABlogix.tex Antennas.tex Audio.tex AmpTable.tex \
+ Bip.tex Btree.tex Byte.tex Buttons.tex \
+ CanLogic.tex CctTable.tex Conn.tex Counting.tex Crossbar.tex Crow.tex \
+ Csource.tex \
+ Decoder.tex Demultiplexer.tex Diodes.tex Drive.tex \
+ Emarrows.tex Flow.tex Fuses.tex \
+ Grounds.tex Headers.tex Heathkit.tex Jack.tex \
+ I2L.tex Incleps.tex \
+ Logic.tex Loglog.tex MC.tex Mixer.tex MotorControl.tex Multiplexer.tex \
+ NLG.tex NPDT.tex Nport.tex \
+ Opamp.tex Optoiso.tex Pconn.tex PushPull.tex Quantum.tex \
+ Rectifiers.tex Relay.tex Rotbox.tex \
+ Schottky.tex Sierpinski.tex ShiftR.tex Sixpole.tex Sources.tex SQUID.tex \
+ Switches.tex \
+ Tgate.tex Three.tex Timer.tex TTLnand.tex Ttree.tex \
+ Windings.tex Variable.tex Xform.tex \
+ control.tex csc.tex diamond.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 graysurf.tex lcct.tex pwrsupply.tex quick.tex \
+ recycle.tex rose.tex sfg.tex shapes.tex thyristor.tex ujt.tex worm.tex \
+ XOR.tex
+
+# Files using boxdims macros:
+BOXDIMS = ex09 Crow Incleps Loglog TTLnand Opamp Ttree Windings
+
+# It is advisable to do `make clean' between test examples.
+#---------------------------------------------
+
+DPIC = dpic
+# DPIC = $$HOME/dpic/test/dpic
+
+TR = | tr '=' '\134'
+
+.SUFFIXES: .tex .m4 .eps .ps .dim .pdf
+.tex.ps:
+ latex $*
+ dvips -Ppdf $*
+.m4.tex:
+ $(M4) $(M4MACROS) $*.m4 | $(DPIC) -g > $*.tex
+# $(M4) $(M4MACROS) $*.m4 > $*.pic
+# $(DPIC) -g $*.pic > $*.tex
+.m4.pdf:
+ $(M4) $(M4MACROS) $*.m4 | $(DPIC) -g > test.tex
+ pdflatex tstpgf
+ mv tstpgf.pdf $*.pdf
+.m4.dim:
+ printf '\\documentclass[11pt]{article}\n' > F$*.tex
+ printf '\usepackage{times,boxdims,tikz}\n' >> F$*.tex
+ printf '\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}\n' >>F$*.tex
+ printf '\\begin{document}\\input '$* >> F$*.tex
+ printf '\n\\end{document}\n' >> F$*.tex
+ make $*.tex
+ touch F$*.dim
+ $(M4) $(M4MACROS) F$*.dim $*.m4 | $(DPIC) -g > $*.tex; latex F$*
+ $(M4) $(M4MACROS) F$*.dim $*.m4 | $(DPIC) -g > $*.tex; latex F$*
+
+
+$(DOC).pdf: Incl.pdf $(DOC).tex
+ -if test "$(DOC)"="examplespgf" ; then make exlinks ; fi
+ -if test -n "$(BOXDIMS)" ; then \
+ for box in $(BOXDIMS) ; do touch F$$box.dim; make $$box.dim ; done; fi
+ make $(FIGS)
+ pdflatex $(DOC)
+
+EXL = exlinks
+$(DOC).ps: $(DOC).dvi
+ dvips -Ppdf $(DOC)
+
+$(DOC).dvi: Incl.eps.gz $(DOC).tex
+ -if test "$(DOC)"="examplespgf" ; then make exlinks ; fi
+ make dims $(FIGS)
+ latex $(DOC)
+
+dims:
+ -if test -n "$(BOXDIMS)" ; then \
+ for box in $(BOXDIMS) ; do touch F$$box.dim; make $$box.dim ; done; fi
+ touch dims
+
+Incl.eps.gz: ../Incl.eps.gz ../Incl.eps.bb
+ cp ../Incl.eps.gz .
+ cp ../Incl.eps.bb .
+
+Incl.pdf: ../Incl.pdf
+ cp ../Incl.pdf .
+
+figs: $(EXL) $(FIGS)
+
+exlinks: Incl.eps.gz
+ @echo ""
+ @echo 'Ignore "cannot create ... exists" warnings.'
+ -@if test ! -f ex11.m4 ; then \
+ ls ../*.m4 | sed -e 's/^/ln -s /' -e '/test.m4/d' -e '/quick.m4/d' | sh;\
+ ls ../../doc/*.m4 ../*.gz | sed -e 's/^/ln -s /' | sh;\
+ fi
+ touch $(EXL)
+
+clobber: clean
+ rm -f $(DOC).ps test.m4 *.pdf
+
+tstpgf.ps: tst
+tst: test.m4
+ touch tstpgf.dim
+ $(M4) pgf.m4 tstpgf.dim test.m4 \
+ > test.pic
+ $(DPIC) -g test.pic > test.tex
+ latex tstpgf
+ $(M4) pgf.m4 tstpgf.dim test.m4 \
+ > test.pic
+ $(DPIC) -g test.pic > test.tex
+ latex tstpgf
+ dvips tstpgf
+
+tst.pdf: test.m4
+ touch tstpgf.dim
+ $(M4) pgf.m4 tstpgf.dim test.m4 \
+ > test.pic
+ $(DPIC) -g test.pic > test.tex
+ pdflatex tstpgf
+ $(M4) pgf.m4 tstpgf.dim test.m4 \
+ > test.pic
+ $(DPIC) -g test.pic > test.tex
+ pdflatex tstpgf
+
+test.tex: test.m4
+ touch tstpgf.dim
+ $(M4) pgf.m4 tstpgf.dim test.m4 > test.pic
+ $(DPIC) -g test.pic > test.tex
+
+clean:
+ rm -f stamp-* $(FIGS) *.dvi *.bb *.gz tstpgf.ps tstpgf.pdf
+ rm -f *.out *.pfg Incl.* *.pic
+ -if /usr/bin/test -f exlinks ; then \
+ ls -l *.m4 | grep '\->' | \
+ sed -e 's/^.* \([^ ][^ ]*\) ->.*$$/rm -f \1/' | sh; fi
+ rm -f *.log *.ps *.aux *.mp *.[0-9] *.[0-9][0-9] *.mpx *.eps *.dim
+ rm -f core log mpxerr* *links figs.* *.dim dims Ftest.* setdim.tex
+ rm -f man[0-9]*.pic man[0-9]*.m4 figs.m4 test.1 test.mp test.pic test.tex
+ -if test -n "$(BOXDIMS)" ; then for box in $(BOXDIMS) ; do \
+ rm -f F$$box.tex $$box.tex ; done; fi
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/README-pgf b/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/README-pgf
new file mode 100644
index 00000000000..cddf8f2ef8d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/README-pgf
@@ -0,0 +1,9 @@
+
+To test a single diagram, copy it into test.m4
+and type 'make tst'. The file is processed through
+m4 and dpic -g to make test.tex which is then
+included by tstpgf.tex.
+
+To produce examplespgf.pdf using tikz-pgf and pdflatex, type "make"
+To produce examplespgf.ps using tikz-pgf, latex, and dvips,
+ type "make examplespgf.ps".
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/examplespgf.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/examplespgf.tex
new file mode 100644
index 00000000000..5ceb9cece2c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/examplespgf.tex
@@ -0,0 +1,28 @@
+% pgf examples.tex
+
+\documentclass[11pt]{article}
+\usepackage{times,boxdims,tikz}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\usepackage{rotating}
+
+\input ../header
+
+\global\pgftrue
+\addtolength{\textheight}{6ex}
+
+\begin{document}
+ \hfill
+ {\large\bf Examples:
+ \input{../../doc/Version.tex}
+ }
+ \hfill\break
+
+ In this directory the source files are processed with m4, dpic -g,
+ and TikZ PGF.
+ This is a collection of diagrams the author has had occasion to
+ produce using m4 circuit macros and others, and gpic or dpic. The
+ source-file names are shown for reference. There may be other or
+ better m4 or pic constructs for producing the same drawings in some
+ cases.
+
+\input ../files.tex
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/tstpgf.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/tstpgf.tex
new file mode 100644
index 00000000000..c5c560908c4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/pgf/tstpgf.tex
@@ -0,0 +1,9 @@
+\documentclass{article}
+\usepackage{times,boxdims,tikz}
+\usepackage{rotating}
+\pagestyle{empty}
+\begin{document}
+\thispagestyle{empty}
+%\centerline{\input test.tex}
+\centerline{\boxdims{tpgf}{\input{test.tex}}}
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/Makefile
new file mode 100644
index 00000000000..cd2e7b63c52
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/Makefile
@@ -0,0 +1,147 @@
+# Makefile for the psfrag subdirectory
+
+# Where the .m4 libraries are installed. Change if necessary:
+LIBDIR = $$HOME/lib
+
+#---------------------------------------------
+
+MKDIM=pwd | sed -e 's%^%=boxdimfile{%' -e 's%/cygdrive/\(.\)/%\1:/%' \
+ -e 's%$$%/$(DIMFILE)}%'
+
+# Comment out the following line to produce absolute addresses for .dim files.
+MKDIM=printf '=boxdimfile{$(DIMFILE)}\n'
+
+#---------------------------------------------
+
+# The .m4 circuit_macro libraries used for the examples:
+M4MACROS = psfrag.m4
+M4 = m4
+
+#---------------------------------------------
+DOC = examplespsfrag
+
+FIGS = Adder.eps Alogix.eps ABlogix.eps Antennas.eps Audio.eps AmpTable.eps \
+ Bip.eps Btree.eps Byte.eps Buttons.eps \
+ CanLogic.eps CctTable.eps Conn.eps Counting.eps Crossbar.eps Crow.eps \
+ Decoder.eps Demultiplexer.eps Diodes.eps Drive.eps \
+ Csource.eps \
+ Emarrows.eps Flow.eps Fuses.eps \
+ Grounds.eps Headers.eps Heathkit.eps Jack.eps \
+ I2L.eps Inclpdf.eps \
+ Logic.eps Loglog.eps MC.eps Mixer.eps MotorControl.eps Multiplexer.eps \
+ NLG.eps NPDT.eps Nport.eps \
+ Opamp.eps Optoiso.eps Pconn.eps PushPull.eps Quantum.eps \
+ Rectifiers.eps Relay.eps Rotbox.eps \
+ Schottky.eps Sierpinski.eps ShiftR.eps Sixpole.eps Sources.eps SQUID.eps \
+ Switches.eps \
+ Tgate.eps Three.eps Timer.eps TTLnand.eps Ttree.eps \
+ Windings.eps Variable.eps Xform.eps \
+ control.eps csc.eps diamond.eps \
+ ex00.eps ex01.eps ex02.eps ex03.eps ex04.eps \
+ ex05.eps ex06.eps ex08.eps ex09.eps ex10.eps ex11.eps ex12.eps \
+ ex15.eps ex16.eps ex17.eps ex18.eps ex21.eps exp.eps \
+ fet.eps graysurf.eps lcct.eps pwrsupply.eps quick.eps \
+ recycle.eps rose.eps sfg.eps shapes.eps thyristor.eps ujt.eps worm.eps \
+ XOR.eps
+
+LOCALFIGS = ex21
+
+# Files using boxdims macros:
+BOXDIMS = ex09 Crow Inclpdf Loglog TTLnand Opamp Ttree Windings
+
+# It is advisable to do `make clean' between test examples.
+#---------------------------------------------
+
+DPIC = dpic
+# DPIC = $$HOME/dpic/test/dpic
+
+TR = | tr '=' '\134'
+
+LATEX = latex
+
+DIMFILE = tmp.dim
+
+.SUFFIXES: .tex .m4 .eps .ps
+.tex.ps:
+ $(LATEX) $*
+ dvips -Ppdf $*
+
+.m4.eps:
+ touch $(DIMFILE)
+ $(M4) $(M4MACROS) $(DIMFILE) $*.m4 > $*.pic
+ $(DPIC) -f $*.pic > $*.eps
+# $(M4) $(M4MACROS) $(DIMFILE) $*.m4 | $(DPIC) -f >> $*.eps
+
+$(DOC).ps: $(DOC).dvi
+ dvips -Ppdf $(DOC)
+
+$(DOC).dvi: $(DOC).tex
+ -if test "$(DOC)"="examplespsfrag" ; then make exlinks ;\
+ $(MKDIM) $(TR) > setdim.tex; fi
+ make $(FIGS) Incl.eps
+ $(LATEX) $(DOC)
+ -if test -n "$(BOXDIMS)" ; then \
+ for box in $(BOXDIMS) ; do rm -f $$box.eps; make $$box.eps ; done; \
+ $(LATEX) $(DOC); fi
+ -if test -n "$(BOXDIMS)" ; then \
+ for box in $(BOXDIMS) ; do rm -f $$box.eps; make $$box.eps ; done; \
+ $(LATEX) $(DOC); fi
+
+Incl.eps: ../Incl.eps.gz
+ rm -f Incl.eps.gz
+ cp ../Incl.eps.gz .
+ gunzip Incl.eps.gz
+
+figs: exlinks $(FIGS)
+
+exlinks:
+ @echo ""
+ @echo 'Ignore "cannot create ... exists" warnings.'
+ -@if test ! -f ex11.m4 ; then \
+ ls ../*.m4 | sed -e 's/^/ln -s /' -e '/test.m4/d' | sh;\
+ ls ../../doc/*.m4 ../*.bb ../*.gz | sed -e 's/^/ln -s /' | sh;\
+ fi
+ touch exlinks
+# for file in $(LOCALFIGS); do cp $${file}PSF.m4 $${file}.m4 ; done
+
+clobber: clean
+ rm -f $(DOC).ps test.m4
+
+tst: tstpsfrag.ps
+
+tstpsfrag.ps: tstpsfrag.dvi
+ dvips tstpsfrag
+
+tstpsfrag.dvi: test.eps
+ latex tstpsfrag
+
+test.eps: test.pic
+ $(DPIC) -f test.pic > test.eps
+
+test.pic: test.m4 testlinks
+ $(M4) $(M4MACROS) test.m4 > test.pic
+ $(DPIC) -f test.pic > test.eps
+ latex tstpsfrag
+ touch tstpsfrag.dim
+ $(M4) $(M4MACROS) tstpsfrag.dim test.m4 > test.pic
+
+testlinks:
+ for file in ics.m4 FlowchartDefs.m4 ; do ln -s ../$$file ; done
+ touch testlinks
+
+clean:
+ @printf "\n psfrag clean:\n"
+ rm -f stamp-* $(FIGS) *.dvi *.bb *.gz tstpsfrag.ps *.out *.pfg Incl.eps
+ -if /usr/bin/test -f exlinks ; then \
+ ls -l *.m4 | grep '\->' | \
+ sed -e 's/^.* \([^ ][^ ]*\) ->.*$$/rm -f \1/' | sh; rm -f exlinks ; fi
+ -if /usr/bin/test -f testlinks ; then \
+ ls -l *.m4 | grep '\->' | \
+ sed -e 's/^.* \([^ ][^ ]*\) ->.*$$/rm -f \1/' | sh; rm -f testlinks ; fi
+ for file in $(LOCALFIGS); do rm -f $${file}.m4 ; done
+ rm -f *.log *.ps *.aux *.mp *.[0-9] *.[0-9][0-9] *.mpx *.eps *.dim *.pic
+ rm -f core log mpxerr* *links figs.* *.dim dims F_test.* setdim.tex
+ rm -f man[0-9]*.pic man[0-9]*.m4 figs.m4 test.1 test.mp test.pic test.tex
+ -if test -n "$(BOXDIMS)" ; then for box in $(BOXDIMS) ; do \
+ rm -f F_$$box.tex $$box.tex ; done; fi
+ @printf "\n"
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/README-psfrag.txt b/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/README-psfrag.txt
new file mode 100644
index 00000000000..805b333f120
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/README-psfrag.txt
@@ -0,0 +1,7 @@
+
+To test out a single diagram, copy it into test.m4 and type 'make tst'.
+The file is processed through m4 and dpic -f to make test.eps containing
+psfrag embedded labels. This file is read by tstpsfrag.tex using the
+\includegraphics command.
+
+Note that the configuration file to be read initially by m4 is psfrag.m4.
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/examplespsfrag.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/examplespsfrag.tex
new file mode 100644
index 00000000000..594eafcd08c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/examplespsfrag.tex
@@ -0,0 +1,30 @@
+% psfrag examples.tex
+
+\documentclass[11pt]{article}
+\usepackage{times,boxdims}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\usepackage{rotating}
+\usepackage{graphicx}
+\usepackage[scanall]{psfrag}
+\newcommand\scriptstack[2][c]{\hbox{\scriptsize\shortstack[#1]{#2}}}%
+\def\?{$\,$}
+
+\input{setdim.tex}
+
+\input ../header
+
+\global\postscripttrue
+\begin{document}
+ \hfill
+ {\large\bf Examples:
+ \input{../../doc/Version.tex}
+ }
+ \hfill\break
+
+ In this directory the source file are processed with m4, dpic -f,
+ and {\tt\char92 usepackage[scanall]\{psfrag\}}.
+ In some cases, there are other or better m4 or pic constructs for
+ producing the same drawings, but the source-file names are shown for
+ reference.
+
+\input ../files.tex
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/tstpsfrag.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/tstpsfrag.tex
new file mode 100644
index 00000000000..2073079ef1c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/psfrag/tstpsfrag.tex
@@ -0,0 +1,14 @@
+\documentclass[dvips]{article}
+\usepackage{times,boxdims,graphicx}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\usepackage[scanall]{psfrag}
+\addtolength{\textwidth}{2cm}
+\addtolength{\textheight}{3cm}
+\setlength{\oddsidemargin}{0pt}
+\setlength{\evensidemargin}{0pt}
+\setlength{\hoffset}{-0.5in}
+\pagestyle{empty}
+\begin{document}
+\thispagestyle{empty}
+\includegraphics{test.eps}
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/pwrsupply.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/pwrsupply.m4
new file mode 100644
index 00000000000..c5d03646b0d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/pwrsupply.m4
@@ -0,0 +1,75 @@
+.PS
+# pwrsupply.m4
+cct_init
+ifdef(`m4pco',`resetrgb')
+
+Singlephase:[
+ linewid = linewid*1.2
+ down_
+ T:transformer
+ line left_ elen_/8 from T.P1
+ rgbdraw(0,0,1,fuse(left_ elen_/3,D))
+ reversed(`switch',left_ elen_*2/3)
+ gap(down_ to (Here,T.P2))
+ { fuse(right_ 2*dimen_/5 at last []) }
+ line to T.P2
+ blen = dimen_/2
+ W: T.TS+(dimen_/2,0)
+ N: W+(blen,blen)
+ S: W+(blen,-blen)
+ E: S+(blen,blen)
+ diode(from W to N)
+ diode(from S to E)
+ G: gap(from E+(dimen_,0) down_ (E.y-S.y)*5/4); llabel(+,,-)
+ C: capacitor(down_ G.start.y-G.end.y from 0.5 between E and G.start,C)
+
+ setrgb(1,0,0)
+ line from T.S1 to (T.S1,N) then to N; dot
+ diode(to E); dot
+ line from E to G.start; dot
+ dot(at C.start)
+ resetrgb
+
+ setrgb(0,1,0)
+ dot(at C.end)
+ dot(at G.end)
+ ground
+ line to (W,Here) then to W; dot
+ diode(to S); dot
+ line to (T.S2,Here) then to T.S2
+ resetrgb
+ ]
+
+Threephase: [
+L:[ loadht = 2*elen_
+ Load: ebox(down_ loadht,0.4,0.25); llabel(+,,-)
+ hsep = dimen_*3/4
+ for_(1,3,1,
+ `line left_ hsep; ifelse(m4x,3,,dot)
+ { diode(up_ loadht/3) ; line up_ loadht/3; diode(up_ loadht/3)
+ T`'m4x: ifelse(m4x,3,Here,dot)
+ line right hsep } ')
+ ]
+
+T:[
+ X1: transformer(down_ dimen_*2/3,,,,4)
+ X2: transformer(down_ dimen_*2/3,,,,4) with .P1 at X1.P2
+ X3: transformer(down_ dimen_*2/3,,,,4) with .P1 at X2.P2
+ line from X1.M4Core1.end to X3.M4Core1.start
+ line from X1.M4Core2.end to X3.M4Core2.start
+ for_(1,3,1,
+ `move to X`'m4x.P2 ; ifelse(m4x,3,,dot)
+ line left_ dimen_
+ P`'m4x: dot(,,1)')
+ line left_ dimen_/2 from X1.P1 then down X1.P1.y-P3.y; dot
+ B: X1.S2+(dimen_/2,0)
+ line from X1.S1 right B.x-X1.S2.x then down X1.S1.y-X3.S1.y then to X3.S1
+ line from X2.S1 to (B,X2.S1); dot
+ ] with .X2.S2 at L.w-(dimen_,0)
+
+ line from T.X1.S2 to (L.T3,T.X1.S2); dot
+ line from T.X2.S2 to (L.T2,T.X2.S2); dot
+ line from T.X3.S2 to (L.T1,T.X3.S2); dot
+] with .sw at Singlephase.se+(0.3,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/random.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/random.m4
new file mode 100644
index 00000000000..6651048b75f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/random.m4
@@ -0,0 +1,101 @@
+.PS
+# random.m4
+gen_init
+NeedDpicTools
+sinclude(tst.dim)
+s_init(random)
+iflatex(`latexcommand({\small)')
+
+################################################################
+# hscale(right length,nlabels,
+# minlabel,maxlabel,[T][N])
+ define(`hscale',`[ define(`hs_nl',`ifelse(`$2',,5,`$2')')
+ A: line `$1' ; Start: A.start; End: A.end
+ td = 1/(hs_nl-1)*A.len/5
+ define(`hs_ud',`ifinstr(`$5',T,down,up)')
+# Major tics
+ for i=1 to hs_nl-2 do { line hs_ud graphsize/20 thick 0.4 \
+ from i/(hs_nl-1) between A.start and A.end }
+# Minor tics
+ for i=0 to hs_nl-2 do { Ts: i/(hs_nl-1) between A.start and A.end
+ for j=1 to 4 do { line thick 0.4 hs_ud graphsize/20/2 from Ts+(j*td,0) } }
+# Labels
+ ifinstr(`$5',N,,`for_(0,eval(hs_nl-1),1,
+ `Ts: m4x/(hs_nl-1) between A.start and A.end
+ s_box("\small %g",`$3'+m4x/(hs_nl-1)*(`$4'-(`$3'))) \
+ at Ts ifelse(`$5',T,above,below)') ')
+ ]')
+# vscale(up length,nlabels,
+# minlabel,maxlabel,[R][N] )
+ define(`vscale',`[ define(`vs_nl',`ifelse(`$2',,5,`$2')')
+ A: line `$1' ; Start: A.start; End: A.end
+ td = 1/(vs_nl-1)*A.len/5
+ define(`vs_lr',`ifinstr(`$5',R,left,right)')
+# Major tics
+ for i=1 to vs_nl-2 do { line vs_lr graphsize/20 thick 0.4 \
+ from i/(vs_nl-1) between A.start and A.end }
+# Minor tics
+ for i=0 to vs_nl-2 do { Ts: i/(vs_nl-1) between A.start and A.end
+ for j=1 to 4 do { line thick 0.4 vs_lr graphsize/20/2 from Ts+(0,j*td) } }
+# Labels
+ ifinstr(`$5',N,,`for_(0,eval(vs_nl-1),1,
+ `Ts: m4x/(vs_nl-1) between A.start and A.end
+ s_box("\small %g",`$3'+m4x/(vs_nl-1)*(`$4'-(`$3'))) \
+ at Ts ifelse(`$5',R,ljust,rjust)')')
+ ]')
+# f_gauss(x,mean,stddev)
+ define f_gauss`{ std_gauss(($1-($2))/($3))/($3) }'
+ define std_gauss`{ expe(-($1)^2/2)/sqrt(twopi_) }'
+################################################################
+
+[
+ n = 2000
+ stddev = 0.25
+ graphsize = 2
+
+ B: box wid graphsize ht graphsize
+# Gemerate n Gaussian random numbers
+ randn(z,n,0,stddev)
+ m = 0
+ for i=1 to n-1 by 2 do { m +=1; x[m] = z[i]; y[m] = z[i+1]
+ dot(at B+(x[m],y[m]))
+ }
+
+ hscale(right B.wid,5,-1,1) with .Start at B.sw
+ hscale(right B.wid,5,-1,1,TN) with .Start at B.nw
+ vscale(up B.ht,5,-1,1) with .Start at B.sw
+ vscale(up B.ht,5,-1,1,RN) with .Start at B.se
+
+ N: box invis wid B.wid ht B.ht with .sw at B.nw+(0,graphsize/10)
+ nb = 20
+ binmax = n/5*0.5
+ dx = N.wid/nb
+ histbins(x,m,-1,1,nb,hbin)
+ for i=0 to nb-1 do { line up hbin[i]/binmax * N.ht \
+ from N.sw+((0.5+i)*dx,0) thick dx/(1bp__) outlined "gray" }
+ box wid N.wid ht N.ht at N
+# vscale(up N.ht,5,0,1) with .Start at N.sw
+
+ E: box invis wid B.wid ht B.ht with .sw at B.se+(graphsize/10,0)
+ nb = 20
+ binmax = n/5*0.5
+ dy = E.ht/nb
+ histbins(y,m,-1,1,nb,vbin)
+ for i=0 to nb-1 do { line right vbin[i]/binmax * E.wid \
+ from E.sw+(0,(0.5+i)*dy) thick dy/(1bp__) outlined "gray" }
+ box wid E.wid ht E.ht at E
+# hscale(right E.wid,5,0,1) with .Start at E.sw
+
+ng = 16
+for i=0 to ng do { x = i/ng*N.wid
+ U: x,(f_gauss(x,N.wid/2,stddev)*m*dx)/binmax*N.ht
+ X[i]: N.sw+U
+ Y[i]: E.nw+(U.y,-U.x) }
+ fitcurve(X,ng)
+ fitcurve(Y,ng)
+
+]
+#showbox_
+
+iflatex(`latexcommand(})')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/recycle.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/recycle.m4
new file mode 100644
index 00000000000..135f31414e3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/recycle.m4
@@ -0,0 +1,128 @@
+.PS
+# recycle.m4
+gen_init
+NeedDpicTools
+[
+# Gradient fill and clipping are simply
+# done with PStricks or Tikz but the other
+# postprocessors don't all have this
+# facility so the following calculates
+# shading boundaries and lines.
+
+define ShadePoint { testexpr(i, $1<f1, $1<f2, $1<f3 )
+ Px: $1 between P0 and Pz
+ S: move from Px to Px+Up
+ case(i+1,
+ M4L: LCintersect(S,T1,stripwd/2)
+ M4R: ($1-f2)/(1-f2) between P9 and P8
+ ,
+ M4L: $1/f1 between P0 and P4
+ M4R: $1/f1 between P0 and P3
+ ,
+ M4L: Intersect_(S,M57)
+ M4R: LCintersect(S,P1,stripwd/2)
+ ,
+ M4L: Intersect_(S,M57)
+ M4R: ($1-f2)/(1-f2) between P9 and P8
+ )
+ line outlined rgbstring($2,$3,$4) from M4L to M4R
+ }
+
+define ShadeTail { testexpr(i, $1<g1, $1<g2, $1<g3 )
+ Px: $1 between T4 and Qz
+ S: move from Px to Px+AcrossTail
+ case(i+1,
+ M4L: LCintersect(S,T1,stripwd/2,R)
+ M4R: LCintersect(S,T1,stripwd/2)
+ ,
+ M4L: $1/g1 between T5 and T6
+ M4R: $1/g1 between T3 and T2
+ ,
+ M4L: LCintersect(S,T1,stripwd/2,R)
+ M4R: $1/g2 between T3 and P6
+ ,
+ M4L: LCintersect(S,T1,stripwd/2,R)
+ M4R: ($1-g2)/(g3-g2) between P6 and P7
+ )
+ line outlined rgbstring($2,$3,$4) from M4L to M4R
+ }
+
+# `recycle(width)'
+define(`recycle',`[ Origin: Here
+ space = 2*linethick pt__
+ stripwd = ($1-space)/3.765544
+ for angle=0 to 240 by 120 do {
+ Right: (dprot(angle*dtor_,stripwd,0))
+ Up: (dprot(angle*dtor_,0,stripwd/2))
+ P0: Here+Right*space/stripwd
+ Axis: move from P0 to P0+Right*3/4; P1: Here
+ P2: P1-Up
+ P3: 1.5 between P1 and P2
+ P4: P1 + (P1-P3)
+ P5: P1 + Up
+ P6: P5+Right/sqrt(3)/2
+ P7: P6+(P6-P5)
+ T1: 2 between P1 and P6
+ P8: T1+(dprot((angle-30)*dtor_,stripwd/2,0))
+ P9: P1+(P8-T1)
+ T2: T1+(dprot((angle+210)*dtor_,stripwd/2,0))
+ AcrossTail: T1-T2
+ T3: P6+(dprot((angle+120)*dtor_,stripwd,0))
+ T4: T3+AcrossTail
+ T5: 2 between T3 and T4
+ T6: 2 between T2 and T1
+ V: move from P8 to P8-Up; Pz: Intersect_(Axis,V)
+ t = distance(P0,Pz)
+ f1 = distance(P1,P0) / t
+ V: move from P9 to P9+Up; R: Intersect_(Axis,V); f2 = distance(P0,R) / t
+ V: move from P7 to P7-Up; R: Intersect_(Axis,V); f3 = distance(P0,R) / t
+ n = int(t/lthick*1.5)
+ M57: move from P5 to P7
+ ShadeObject( ShadePoint,n,
+ 0,1,1,1,
+ 1,0.5,0.5,0.5) with .Origin at Origin
+ point
+ J: move from T4 to T1; Qz: LCintersect(J,T1,stripwd/2,R)
+ u=distance(T4,Qz)
+ g1 = distance(T1,T4) / u
+ g2 = stripwd / u
+ V: move from P7 to P7+AcrossTail; R: Intersect_(V,J)
+ g3 = distance(R,T4) / u
+ m = int(u/lthick*1.5)
+ ShadeObject(ShadeTail,m,
+ 0,1,1,1,
+ 1,0.5,0.5,0.5) with .Origin at Origin
+ tail
+# { for i=0 to 9 do { exec sprintf("{\"P%g\" at P%g}",i,i) } }
+# { for i=1 to 6 do { exec sprintf("{\"T%g\" at T%g}",i,i) } }
+ move to T4
+ }
+ ]')
+define(`tail',`line from P7 to P6 then to T3 then to T5 then to T6
+ arc cw to P7 with .c at T1')
+
+define(`point',`line from P2 to P3 then to P0 then to P4 then to P5 then to P7
+ arc ccw to P8 with .c at T1
+ line to P9
+ arc cw to P2 with .c at P1')
+
+recycle(2)
+]
+[
+# yinyang.m4
+ifdpic(`
+circlerad = 0.5
+shade(0,
+A: arc ccw rad circlerad*2 to Here+(4*circlerad,0)
+ )
+B: circle colored "white" with .c at 1/4<A.w,A.e>
+ arc cw rad circlerad from B.e to B.w with .c at B.c
+ circle colored "black" with .c at 3/4<A.w,A.e>
+ circle rad circlerad*2 with .c at A.c
+ circle rad circlerad/3 fill_(0) at 0.5<A.w,A.c>
+ circle rad circlerad/3 fill_(1) at 0.5<A.c,A.e>
+',`
+box wid 1 ht 0.75 "Yinyang.m4" "requires" "dpic"
+')
+] with .w at last [].e+(0.2,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/rose.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/rose.m4
new file mode 100644
index 00000000000..b088b3afd46
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/rose.m4
@@ -0,0 +1,130 @@
+.PS
+# rose.m4
+gen_init
+ifelse(rgbstring(1,1,1),"",
+`This diagram is for PSTricks, postscript, PDF, MetaPost, or SVG',
+`
+
+scale = 1.2
+define(`gold_',`1,0.84,0')
+
+define(`rose',`point_(`$2'); CC: (vec_(`$1',0)); rrad = `$3'
+ move to CC
+ tmp = rrad-stripwid
+ {circle shaded rgbstring(gold_) rad rrad-sthick at CC}
+ {circle shaded rgbstring(gold_) rad tmp-sthick at CC}
+ {line to rvec_(rrad,0) chop tmp chop 0 }
+ {line to rvec_(-rrad,0) chop tmp chop 0 }
+ {line to rvec_(0,rrad) chop tmp chop 0 }
+ {line to rvec_(0,-rrad) chop tmp chop 0 }
+ {line from rvec_(-tmp/sqrt(2),-tmp/sqrt(2)) to rvec_(tmp/sqrt(2),tmp/sqrt(2))}
+ {line from rvec_(-tmp/sqrt(2),tmp/sqrt(2)) to rvec_(tmp/sqrt(2),-tmp/sqrt(2))}
+ {circle shaded rgbstring(gold_) rad tmp-stripwid-sthick at CC}
+ tmp = last circle.rad/sqrt(2)
+ line thick stripthick from rvec_(-tmp,0) to rvec_(0,-tmp) \
+ then to rvec_(tmp,0) then to rvec_(0,tmp) then to rvec_(-tmp,0) \
+ shaded rgbstring(gold_)
+ ')
+
+define(`spt_',`/72.27')
+
+[ lsk = 1.2
+ sector = 360*dtor_/16
+ exterior = 2.49
+ outer_circle = exterior-0.55
+ inner_circle = 1.1
+ spoke_tail = 0.41
+ spokethick = 0.09/(1spt_) # points
+ stripwid = 0.05
+ stripthick = 1.6/1.2
+ midroserad = inner_circle*sin(sector/2)-stripwid/2
+ outerroserad = outer_circle*sin(sector/4)-stripwid/2
+ del = 0.05
+
+C: (0,0)
+ circle rad exterior fill_(0) at C
+ circle shaded rgbstring(gold_) rad outer_circle at C
+ circle rad spoke_tail fill_(0) at C
+ linethick = stripthick
+ sthick = linethick/2 spt_
+ for i=0 to 15 do {
+ move to rect_(spoke_tail+1.5*stripwid,sector*i);
+ for j=-1 to 1 by 2 do {
+ {point_(sector*(i+j*0.5))
+ line to rvec_(outer_circle-spoke_tail,0) }
+ { point_(sector*i)
+ move to rvec_(0,j*spokethick spt_)
+ line to rvec_(outer_circle-spoke_tail,0) \
+ chop outer_circle-inner_circle chop 0
+ }
+ }
+ crad = 0.25 +1.5*stripwid
+ cthick = 1.5*stripwid/(1spt_)
+ X: rect_(inner_circle+midroserad,sector*i)
+ circle outlined rgbstring(gold_) rad crad-(cthick/2 spt_) thick cthick at X
+ circle rad crad - sthick at X
+ }
+ for i=0 to 15 do {
+ X: rect_(inner_circle+midroserad,sector*i)
+ circle fill_(0) rad crad-1.5*stripwid-sthick at X
+
+ for j = -1 to 1 by 2 do { move to X+vec_(0.20,j*0.14)
+ point_(sector*(i+j*0.25))
+ line to rvec_(1.5*stripwid,0) }
+
+ circle shaded rgbstring(gold_) rad midroserad*2/3-sthick at X
+ circle rad midroserad*2/3-stripwid-sthick at X
+ line from X to -(midroserad*2/3/(inner_circle+midroserad))<X,C>
+ }
+
+ crad = spoke_tail+7*stripwid
+ cthick = 2*stripwid/(1spt_)
+ circle outlined rgbstring(gold_) rad crad-cthick/2 spt_ thick cthick at C
+ circle rad spoke_tail+1.5*stripwid-sthick at C
+ for i=5 to 7 do { circle rad spoke_tail+i*stripwid-sthick at C }
+ # Spokes and roses
+ for i=0 to 15 do {
+ rose(inner_circle,sector*i,midroserad)
+ line thick spokethick/lsk from C to rect_(outer_circle,sector*(i-0.5))
+ line thick spokethick/lsk from C to rect_(outer_circle,sector*i) \
+ chop inner_circle+midroserad*2 chop 0
+ for j=-1 to 1 by 2 do {
+ X: rect_(outer_circle+outerroserad-linethick spt_,sector*(i+j*0.25))
+ linethick = 1/lsk
+ circle colored rgbstring(gold_) rad outerroserad*1/2-1/lsk/2 spt_ at X
+ linethick = stripthick
+ circle fill_(0) rad outerroserad*1/3-sthick at X
+ point_(sector*(i+j*0.25))
+ line from X to X + vec_(outerroserad,0)
+ rose(outer_circle,sector*(i+j*0.25),outerroserad)
+ }
+ }
+ # Outer decorations
+ for i=0 to 31 do {
+ move to rect_(exterior-0.25,sector*i/2); point_(sector*i/2)
+ { line thick stripthick from rvec_(del,3.5*del) to rvec_(-del,0) \
+ then to rvec_(del,-3.5*del) then to rvec_(del,3.5*del) \
+ shaded rgbstring(gold_) }
+ circle rad stripwid-sthick at Here
+ }
+ smrad = 0.08
+ for i=0 to 7 do {
+ point_(sector*2*i)
+ move to C + vec_(midroserad+smrad/4,0)
+ { circle shaded rgbstring(gold_) rad smrad-sthick at Here}
+ { circle shaded rgbstring(gold_) rad smrad/2-sthick at Here}
+ line from rvec_(smrad/2,0) to rvec_(smrad,0)
+ }
+
+ tmp = midroserad-stripwid
+ circle shaded rgbstring(gold_) rad midroserad-sthick at C
+ circle shaded rgbstring(gold_) rad tmp-sthick at C
+ CQ: circle invis rad tmp-linethick*4/2 spt_ at C
+ line from CQ.e to CQ.n to CQ.w to CQ.s to CQ.e to CQ.n
+ CQ: 0.5<CQ.e,CQ.n>
+ tmp = (distance(CQ,C) - linethick*3/2 spt_)*sqrt(2)
+ box wid tmp ht tmp at C
+ ] with .sw at 1,1
+
+')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/rotate.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/rotate.tex
new file mode 100644
index 00000000000..895b0691ecf
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/rotate.tex
@@ -0,0 +1,9 @@
+\documentclass[11pt]{article}\usepackage{pstricks,boxdims,pst-grad}
+
+\pagestyle{empty}
+\thispagestyle{empty}
+\begin{document}
+ {\vspace{2ex}\input{rotatetext.tex}
+% {\vspace{2ex}\input{rotellipse.tex}
+ }
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/rotatetext.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/rotatetext.m4
new file mode 100644
index 00000000000..2aec6abdf8d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/rotatetext.m4
@@ -0,0 +1,50 @@
+.PS
+# rotatetext.m4
+# This is a test of the \rput function to write a string around the
+# periphery of a circle of radius r, accounting for inter-letter kerns
+{\Huge
+gen_init
+twopi = twopi_
+rtod = rtod_
+
+define(`outputstring',`University of Waterloo')
+r = 0.75
+divert(-1)
+
+sinclude(rotate.dim) # Letter and letter-pair width definitions
+sinclude(tst.dim)
+define(`arctot',0) # Total arc used by the string
+sinclude(rotatetext.dim)
+
+define(`cname',`ifelse(`$1',` ',,`$1')')
+
+define(`cprint',`ifelse(len(`$3'),0,,
+ `define(`cc',`substr(`$3',0,1)')dnl
+ dt = atan2(boxdim(cname(cc),w)/2,`$2')
+ te = te + ifdef(`kern',`atan2(kern/2,`$2')',0) + dt
+
+# The kernel of the print mechanism. All else is to calculate angles
+ sprintf("\rput[B]{%8.3f}(0,0){\boxdims{cname(cc)}{cc}}",(arctot/2-te)*rtod) \
+ with .bottom at `$1'+(rect_(`$2',arctot/2-te+twopi/4))
+
+ define(`kern',0) ifelse(len(`$3'),1,,cc,` ',,substr(`$3',1,1),` ',,
+ `define(`kern',`(boxdim(substr(`$3',0,2),w)-boxdim(
+ cname(substr(`$3',0,1)),w)-boxdim(cname(substr(`$3',1,1)),w))')dnl
+ \defboxdim{substr(`$3',0,2)}{substr(`$3',0,2)}')
+if abs(kern/(1 pt__))>0.05 then {
+ print sprintf("k`'ern(substr(`$3',0,2))=%5.2gpt",kern/(1 pt__)) }
+ te = te + dt + atan2(kern/2,`$2')
+ cprint(`$1',`$2',substr(`$3',1))')')
+divert
+
+print sprintf("`arctot'=%g",arctot)
+
+C: circle rad r
+te = 0
+cprint(C,r,outputstring)
+
+# Write the total angle to rotatetext.dim
+sh sprintf("echo \"`define'(`\`arctot'',%f)\" > rotatetext.dim",te)
+
+}
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/rotellipse.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/rotellipse.m4
new file mode 100644
index 00000000000..a49ce308b3b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/rotellipse.m4
@@ -0,0 +1,20 @@
+.PS
+# `rotellipse.m4'
+gen_init
+
+[
+ E: ellipse shaded "red" outlined "blue"
+
+ A: rotellipse(1,1,outlined "red" shaded "blue") with .w at E.e
+ Point_(45)
+ B: rotellipse(,,dotted fill_(0.9))
+ C: rotellipse(,,colored "red") with .s at last [].n
+ thinlines_
+ showbox_(A)
+ showbox_(B)
+ showbox_(C)
+ thicklines_
+
+] with .sw at 1,1
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/sfg.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/sfg.m4
new file mode 100644
index 00000000000..9a97d828d54
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/sfg.m4
@@ -0,0 +1,93 @@
+.PS
+# sfg.m4
+sfg_init( 1.2 ) # scale default size by 1.2
+
+ iflatex(`textoffset = 1bp__; ifpsfrag(`textht = 9.5bp__',
+ `latexcommand({\small)') ')
+
+[
+# Graph 1
+T:[
+ Ft: sfgnode(,f(t),sfgbelow)
+ sfgline(,1/K)
+ Y1: sfgnode(,y_1,sfgbelow rjust)
+ sfgline(,K/M)
+ DDY2: sfgnode(,\ddot{y}_2,sfgbelow rjust)
+ sfgline(,s^{-1})
+ DY2: sfgnode(,`\dot{y}_2=x_2',sfgbelow ljust)
+ sfgline(,s^{-1})
+ Y2: sfgnode(,y_2=x_1,sfgbelow ljust)
+
+ sf = 1
+ sfgarc(from DY2 to DDY2,-B/M,below,,sf)
+ sfgarc(from Y2 to DDY2,-K/M,above,ccw,sf)
+ sfgarc(from Y2 to Y1,1,sfgabove,,sf)
+ ]
+
+# Graph 2
+B: [
+ R1: sfgnode(,r_1,sfgabove)
+ sfgline(,1)
+ X1: sfgnode(,\;x_1,ljust)
+ R2: sfgnode(at R1+(0,-1),r_2,sfgabove)
+ sfgline(,1)
+ X2: sfgnode(,\;x_2,ljust)
+ sfgarc(from X1 to X2,a_{21}\;,rjust,ccw)
+ sfgarc(from X2 to X1,\;a_{12},ljust,ccw)
+
+ sfgself(at X1,,q_{11})
+ sfgself(at X1,R,\;a_{11},ljust,cw,1.5)
+ sfgself(at X2,-90,a_{22},sfgbelow)
+ ] with .w at T.e + (linewid/2,-linewid/4)
+
+# Graph 3
+G3: [#sfg_init( 0.85,0.35/2 ) # change node spacing and increase node size
+ sfg_wid = 0.85
+ sfg_rad = 0.35/2
+ for_(1,4,1,`N`'m4x: sfgnode(,m4x,,fill_(0.9))
+ sfgself(at N`'m4x,-90,P_{m4x},,cw)
+ ifelse(m4x,4,,`sfgline(,G_{m4x},sfgbelow)') ')
+ sfgarc(from N2 to N1,F_2,sfgabove,ccw,)
+ sfgarc(from N3 to N1,F_3,sfgbelow,ccw,1.4)
+] with .nw at T.sw
+
+A: [#sfg_init( 0.75,0.15 )
+ sfg_wid = 0.75
+ sfg_rad = 0.15
+ arrow right linewid*2/3
+ P: sfgnode(,p)
+ sfgself(,90,a,sfgbelow,cw)
+ arrow from P.e "b" below
+ Q: sfgnode(,q)
+ R: sfgnode(at Q+(Q.x-P.x,Q.y-P.y),r) # for gpic
+ sfgarc(from Q to R,c,sfgabove,cw)
+ sfgarc(from R to Q,d,sfgbelow,cw)
+ sfgself(at R,-90,e,sfgabove,cw)
+ arrow right linewid*2/3 from R.e
+ ] with .w at G3.e+(linewid/2,0)
+
+G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size
+ s1 = 0.9
+ s2 = 1.2
+ N0: sfgnode(,\hbox{\Large 0},,invis)
+ sfgline(right_ sfg_wid,\nu,below,->)
+ N1: sfgnode(,\hbox{\Large 1},,invis)
+ { sfgarc(to N0 ->,(1{-}p)\gamma{+}\nu,above,ccw,s1) }
+ sfgline(right_ sfg_wid,\nu+\lambda,below,->)
+ N2: sfgnode(,\hbox{\Large 2},,invis)
+ { sfgarc(to N1 ->,{{2}\choose{1}}p(1{-}p)\gamma{+}2\nu,above,ccw,s1) }
+ { sfgarc(to N0 ->,(1{-}p)^2\gamma,above,ccw,s2) }
+ sfgline(right_ sfg_wid,\nu+2\lambda,below,->)
+ N3: sfgnode(,\hbox{\Large 3},,invis)
+ { sfgarc(to N2 ->,{{3}\choose{2}}p^2(1{-}p)\gamma{+}3\nu,above,ccw,s1) }
+ { sfgarc(to N1 ->,{{3}\choose{1}}p(1{-}p)^2\gamma,above,ccw,1.2) }
+ { sfgarc(to N0 ->,(1{-}p)^3\gamma,above,ccw,s2) }
+ sfgline(right_ sfg_wid/2,\nu+3\lambda,below,->)
+ {"$\ldots$" wid 0.3 ljust}
+ ] with .nw at G3.sw+(0,-0.15)
+ move from (T.w,G4.s)-(7bp__,6bp__) to B.ne+(15bp__,6bp__)
+]
+#showbox_
+
+ iflatex(ifpsfrag(,`latexcommand(})'))
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/shapes.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/shapes.m4
new file mode 100644
index 00000000000..08962e9f856
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/shapes.m4
@@ -0,0 +1,202 @@
+.PS
+# shapes.m4
+threeD_init
+
+divert(-1)
+# shapes.m4
+# 3D structures with complex surfaces and hidden lines are the domain of more
+# sophisticated software packages, but basic shapes can be drawn with pic.
+#threeD_init
+
+#####################################################
+
+ `cylinder3D(xdispl,ydispl,zdispl,diameter,
+ [colored "color"])'
+define(`cylinder3D',`[ Start: (0,0)
+ xdispl = `$1'; ydispl = `$2'; zdispl = `$3'
+ diamc = ifelse(`$4',,(lenc/2),`$4') ; radc = diamc/2
+ define(`M4CL',`xdispl,ydispl,zdispl')dnl
+ lenc = length3D(M4CL)
+ cs = dot3D(View3D,M4CL)/lenc
+ End: (project(M4CL))
+ az = atan2(ydispl,xdispl)
+ ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2))
+ CL: line invis from Start to End; C: CL.c
+ nls = int(twopi_*radc/lthick)
+ define(`M4PP',`rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,0,0,radc)))')dnl
+ for i=0 to nls-1 do { if dot3D(View3D,M4PP) > 0 then {
+ P: (project(M4PP))
+ ql = sqrta(dot3D(Light3D,M4PP)/radc)
+ line from P to End+P outlined rgbstring(ql,ql,ql) `$5' } }
+ Perp: (vperp(CL,radc))
+ if cs > 0 then { T: End; B: Start } else { T: Start; B: End }
+ rpoint_(from Start to Perp)
+ css = sqrta(cs)
+ Top: rotellipse(diamc,diamc*cs,
+ thick linethick/3 shaded rgbstring(css,css,css)) with .c at T
+ W: line thick linethick/3 from T+Perp to B+Perp
+ Bot: ellipsearc(diamc,diamc*cs,pi_,twopi_,rp_ang,cw,
+ thick linethick/3) with .C at B
+ E: line thick linethick/3 from B-Perp to T-Perp
+ rpoint_(from Start to End)
+`$6']')
+
+ `cone3D(xdispl,ydispl,zdispl,diameter,
+ [colored "color"])'
+define(`cone3D',`[ Start: (0,0)
+ xdispl = `$1'; ydispl = `$2'; zdispl = `$3'
+ define(`M4CL',`xdispl,ydispl,zdispl')dnl
+ lenc = length3D(M4CL)
+ diamc = ifelse(`$4',,(lenc/2),`$4') ; radc = diamc/2
+ End: (project(M4CL))
+ cs = dot3D(View3D,M4CL)/lenc
+ az = atan2(ydispl,xdispl)
+ ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2))
+ CL: line invis from Start to End; C: CL.c
+ nls = int(twopi_*radc/lthick)
+ lt = sqrt(radc^2+lenc^2)
+ b = 0
+ for i=0 to nls-1 do { if dot3D(View3D,
+ rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,radc,0,lenc)))) > 0 then {
+ ql = sqrta(dot3D(Light3D,
+ rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,radc,0,lenc))))/lt)
+ P: (project(rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,0,0,radc)))))
+ line from P to End outlined rgbstring(ql,ql,ql) `$5'
+ if !b then { WB: P; b = 1 }
+ } else { if b then { BW: P; b = 0 } } }
+ if vlength(CL.x,CL.y) != 0 then { Perp: (vperp(CL,radc,R)) } else { Perp: (radc,0) }
+ if cs >= 0 then { T: End; B: Start } else {T: Start; B: End }
+ rpoint_(from Start to Perp)
+ pout = (vlength(End.x,End.y) > abs(radc*cs))
+ if cs < 0 then { css = sqrta(cs)
+ if pout then { line thick linethick/3 from BW to End then to WB }
+ Bot: rotellipse(diamc,diamc*cs,thick linethick/3 \
+ ifelse(`$5',,`shaded rgbstring(css,css,css)',`$5')) with .c at T } \
+ else { if pout then {
+ line thick linethick/3 from BW to End then to WB
+ a = acos((WB.x*Perp.x+WB.y*Perp.y)/radc^2)
+ Bot: ellipsearc(diamc,diamc*cs,a,pi_-a,rp_ang,cw, thick linethick/3) \
+ with .C at B } \
+ else {
+ Bot: rotellipse(diamc,diamc*cs,thick linethick/3) with .c at B } }
+ rpoint_(from Start to End)
+`$6']')
+ `Arrow3D(xdispl,ydispl,zdispl,
+ diam,arrowwid,arrowht)'
+define(`Arrow3D',`[ diam_Ar = ifelse(`$4',,linewid/10,`$4')
+ wid_Ar = ifelse(`$5',,diam_Ar*2,`$5')
+ ht_Ar = ifelse(`$6',,wid_Ar*2,`$6')
+ x_Ar = ifelse(`$1',,1,`$1')
+ y_Ar = ifelse(`$2',,1,`$2')
+ z_Ar = ifelse(`$3',,1,`$3')
+ define(`M4Arrow3D',`x_Ar,y_Ar,z_Ar')dnl
+ len_Ar = length3D(M4Arrow3D)
+ len_Shaft = len_Ar - ht_Ar
+ cs_Ar = dot3D(View3D,M4Arrow3D)
+ if cs_Ar >= 0 then {
+ Shaft: cylinder3D(sprod3D(len_Shaft/len_Ar,M4Arrow3D),diam_Ar)
+ Head: cone3D(sprod3D(ht_Ar/len_Ar,M4Arrow3D),wid_Ar) \
+ with .Start at Shaft.End } \
+ else {
+ Head: cone3D(sprod3D(ht_Ar/len_Ar,M4Arrow3D),wid_Ar)
+ Shaft: cylinder3D(sprod3D(len_Shaft/len_Ar,M4Arrow3D),diam_Ar) \
+ with .End at Head.Start }
+ Start: Shaft.Start; End: Head.End
+ `$7']')
+
+define(`f2xyz3D',``$1'x = `$2'
+`$1'y = `$3'
+`$1'z = `$4' ')
+
+ `prism3D(xdispl,ydispl,zdispl,wid,ht,rotation (rad))'
+define(`prism3D',`[ Start: (0,0)
+ xdispl = ifelse(`$1',,linewid,`$1')
+ ydispl = ifelse(`$2',,linewid,`$2')
+ zdispl = ifelse(`$3',,linewid,`$3')
+ widp = ifelse(`$4',,(linewid/5),`$4')
+ htp = ifelse(`$5',,(linewid/10),`$5')
+ rotp = ifelse(`$6',,0,`$6')
+ End: (project(xdispl,ydispl,zdispl)); C: 0.5 between Start and End
+ lenp = length3D(xdispl,ydispl,zdispl)
+ az = atan2(ydispl,xdispl); ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2))
+ wp2 = widp/2; hp2 = htp/2
+# corners
+ f2xyz3D(nwB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0,-wp2, hp2))))
+ f2xyz3D(swB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0,-wp2,-hp2))))
+ f2xyz3D(seB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0, wp2,-hp2))))
+ f2xyz3D(neB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0, wp2, hp2))))
+ f2xyz3D(nwF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp,-wp2, hp2))))
+ f2xyz3D(swF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp,-wp2,-hp2))))
+ f2xyz3D(seF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp, wp2,-hp2))))
+ f2xyz3D(neF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp, wp2, hp2))))
+# facets
+ M4Facet3D(neF,nwF,swF,seF)
+ M4Facet3D(neB,seB,swB,nwB)
+ M4Facet3D(neF,seF,seB,neB)
+ M4Facet3D(neF,neB,nwB,nwF)
+ M4Facet3D(seF,swF,swB,seB)
+ M4Facet3D(nwF,nwB,swB,swF)
+`$7']')
+
+define(`M4Facet3D',`
+define(`PFacet',`cross3D(diff3D(`$2'x,`$2'y,`$2'z,`$1'x,`$1'y,`$1'z),
+ diff3D(`$3'x,`$3'y,`$3'z,`$2'x,`$2'y,`$2'z))')
+ if dot3D(View3D,PFacet) > 0 then {
+ fFacet = sqrta(dot3D(Light3D,PFacet)/length3D(PFacet))
+ P1: (project(`$1'x,`$1'y,`$1'z))
+ P2: (project(`$2'x,`$2'y,`$2'z))
+ P3: (project(`$3'x,`$3'y,`$3'z))
+ P4: (project(`$4'x,`$4'y,`$4'z))
+ line fill_(fFacet) invis from P1 to P2 then to P3 then to P4 then to P1
+ line from P1 to P2; round
+ line to P3; round
+ line to P4; round
+ line to P1; round } ')
+
+#####################################################
+divert(0)dnl
+
+azimuth = 60
+elev = 10
+setview(azimuth,elev)
+[ Orig: (0,0)
+ setlight
+ Arrow3D(1,0,0) with .Start at Orig; move left 12bp__ from last [].End "x"
+ Arrow3D(0,1,0) with .Start at Orig; "y" ljust at last [].End
+ Arrow3D(0,0,1.2) with .Start at Orig; "z" above at last [].End
+ setlight(0,0,0)
+ cylinder3D(1,1,1,0.6) with .Start at (project(0.5,0.5,0.5))
+]
+ Ball: shadedball(0.5) with .nw at last [].ne+(-0.25,0)
+[
+ setview(45,10)
+ setlight(40,70)
+ n = 9; len = 1.5; thmin = m4azim+pi_/2*0.8; thmax = thmin+twopi_
+ for i=0 to n do {
+ r = i/n*(thmax-thmin)+thmin
+ prism3D(rot3Dz(r,rot3Dy(pi_/4,len,0,0)),0.2,0.1) \
+ with .Start at (project(rot3Dz(r,rot3Dy(pi_/4,len*0.5,0,0)))) }
+] with .nw at last [].ne
+[
+ setlight(0,0)
+ movewid = 0.1
+ len = 1.5; ni = 5; nj = 5
+ for i=1 to ni-1 do {
+ {for j = 0 to nj by 2 do {
+ setview(0,i/ni*180-90,j/nj*90)
+ cylinder3D(0,0,len*(j+1)/(nj+1),0.4)
+ if j < nj then {move right} } }
+ if i < ni then {move down 0.85; right_} } #else { move down movewid } }
+] with .nw at 1st [].sw+(0,-0.1)
+[
+ setlight(0,0)
+ len = 1.5; ni = 4; nj = 6
+ for i=1 to ni do {
+ {for j = 0 to nj by 2 do {
+ setview(0,i/ni*180-90,j/nj*90)
+ cone3D(0,0,len*(j+1)/(nj+1),0.4)
+ if i==2 && j==(nj-2) then { move up_ 0.2 right_ -0.4 } \
+ else { if j < nj then {move right_ 0.1}} } }
+ if i < ni then {move down_ 0.75; right_} }
+] with .nw at last [].ne+(0.2,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/snake.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/snake.m4
new file mode 100644
index 00000000000..39f2b7d1d1f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/snake.m4
@@ -0,0 +1,21 @@
+.PS
+# snake.m4
+gen_init
+scale = 2
+rmax = 0.8
+rmin = 0.2
+fact = 0.75
+wd = 0.15
+[
+shade(0.8,
+ for r = rmax to rmin by *fact do {
+ arc cw rad r to Here+(r+r,0)
+ arc ccw rad r-wd to Here+(2*(r-wd),0) }
+ line right wd
+ for r = r to rmax by *1/fact do {
+ arc cw rad r to Here-(r+r,0)
+ arc ccw rad r-wd to Here-(2*(r-wd),0) }
+ line to (0,0)
+ )
+] with .sw at 2,2
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/squiggle.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/squiggle.m4
new file mode 100644
index 00000000000..af5831f593f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/squiggle.m4
@@ -0,0 +1,25 @@
+.PS
+gen_init
+
+divert(-1)
+dnl Should this macro be in libgen.m4 or would that be just adding clutter?
+
+ `squiggle(linespec,
+ amplitude,wavelength,attributes)'
+ `squiggly line (sinusoid), e.g.
+ squiggle(up_ 1 right_ 2,,,outlined "red")'
+define(`squiggle',`rpoint_(ifelse(`$1',,linewid,`$1'))
+ m4dist = lin_leng(last line)
+ m4cycles = int(m4dist/(ifelse(`$3',,0.25*scale,`$3'))+0.5)
+ define(`squiggleampl',`ifelse(`$2',,0.04*scale,`$2')')dnl
+ define(`squigglefreq',`(twopi_*m4cycles/m4dist)')dnl
+ sinusoid(squiggleampl,squigglefreq,-twopi_/4,0,m4dist,`$4') \
+ with .Origin at last line.start
+ move to last line.end')
+divert(0)dnl
+
+squiggle(up_ 1 right_ 2,,,outlined "red")
+squiggle(up 2 right_ 2,0.1,0.15,outlined "red" <-> wid 0.06 ht 0.05)
+squiggle(right_ 1,,,dotted outlined "blue" wid 0.06 ht 0.05)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ABlogixSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ABlogixSVG.m4
new file mode 100644
index 00000000000..d457250cc36
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ABlogixSVG.m4
@@ -0,0 +1,53 @@
+.PS
+# `ABlogixSVG.m4'
+ log_init(svg_font(sans-serif,10.5bp__))
+ linewid = 0.4
+
+# A more complex expression
+ F: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))))
+
+ Loopover_(`v_', `"svg_it(v_)" wid 11bp__ at F.In`'v_ above', x0,x1,x2,x3,x4)
+ "svg_it(Out)" ljust at F.Out
+ "svg_tt(`Autologix(And(Or(x3,x1,~x0),')" \
+ wid 201bp__ with .w at F.sw+(0,-0.25)
+ "svg_tt(`Nor(Or(x3,Not(x2),~x1,x0),And(x4,Or(x2,x1,~x0),')" \
+ wid 343bp__ with .w at last "".w+(65bp__,-16bp__)
+ "svg_tt(`Xor(x2,~x1)))))')" \
+ wid 105bp__ with .w at last "".w+(0,-16bp__)
+# Inputs on the left with vert offset in L_units
+define(`Doff',LV;offset=25)
+ G: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))),
+ Doff*L_unit) \
+ with .sw at F.Out+(0.2,-0.7)
+
+ Loopover_(`v_', `"svg_it(v_)" wid 11pt__ at G.In`'v_ rjust ', x0,x1,x2,x3,x4)
+ "svg_it(Out)" wid 22bp__ ljust at G.Out
+ "svg_tt(`...,'Doff*L`'_unit))" at G.s+(0,-10pt__)
+
+# A more complex expression
+define(`Eoff',R)
+ E: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))),
+ Eoff) \
+ with .nw at F.sw+(0,-1.5)
+
+ Loopover_(`v_', `"svg_it(v_)" wid 11bp__ at E.In`'v_ above ', x0,x1,x2,x3,x4)
+ "svg_it(Out)" ljust at E.Out
+ "svg_tt(...`,'Eoff))" at E.s+(0,-10pt__)
+
+# Inputs on the left with vert offset in L_units
+define(`Foff',LRV;offset=17)
+ D: Autologix(And(Or(x3,x1,~x0),Nor(Or(x3,Not(x2),~x1,x0),
+ And(x4,Or(x2,x1,~x0),Xor(x2,~x1)))),
+ Foff*L_unit) \
+ with .sw at E.Out1+(0.2,-0.5)
+
+ Loopover_(`v_', `"svg_it(v_)" wid 11pt__ at D.In`'v_ rjust ', x0,x1,x2,x3,x4)
+ "svg_it(Out)" ljust at D.Out
+ "svg_tt(...`,'Foff*L`'_unit))" at D.s+(0,-10pt__)
+
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AdderSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AdderSVG.m4
new file mode 100644
index 00000000000..cef4d07a8e5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AdderSVG.m4
@@ -0,0 +1,76 @@
+.PS
+# AdderSVG.m4
+log_init(svg_font(sans-serif,11bp__))
+
+ del = linewid/4
+[ # full adder using gates
+ A: dot; {"A" rjust}; line right
+ Xor1: XOR_gate with .In1 at Here
+ dy = Xor1.In1.y-Xor1.In2.y
+ B: dot(at (A,Xor1.In2)); {"B" rjust}; line to Xor1.In2
+ line from Xor1.Out right 2*del+dy
+ Xor2: XOR_gate with .In1 at Here
+
+ Co: Autologix(Or(And(X1,X2),And(A,B)),N) with .nw at Xor2.sw+(-del,-del/2)
+ line from Co.In1 to (Co.In1,Xor2.In2) then to Xor2.In2
+ dot(at (Xor1.Out+(del,0))); line to (Here,Co.In2) then to Co.In2
+ dot(at (Xor1.In1-(del,0))); line to (Here,Co.In3) then to Co.In3
+ dot(at (Xor1.In2-(del+dy,0))); line to (Here,Co.In4) then to Co.In4
+ line right del from Co.Out1; dot; {"Co" ljust }
+ dot(at (Here,Xor2.Out)); {"S" ljust}; line to Xor2.Out
+ Ci: dot(at (B,(0.5 between Xor2.s and Co.n))); line to (Co.In1,Here); dot
+ "Ci" rjust at Ci
+ ]
+
+[ # truth table
+ griddim = linewid*0.4
+ define(`row',`T: (0,-(`$1')*griddim*0.8)
+ Loopover_(`v',`"v" at T; T: T+(griddim,0)', shift($@))')
+
+ [row(0,A,B,Ci,Co,S)]
+ line thick 2 color "gray" right 4.5*griddim \
+ with .c at last [].c+(0,-griddim/2)
+
+ [row(1,0,0,0,0,0)
+ row(2,0,0,1,0,1)
+ row(3,0,1,0,0,1)
+ row(4,0,1,1,1,0)
+ row(5,1,0,0,0,1)
+ row(6,0,1,1,0,0)
+ row(7,1,1,0,1,0)
+ row(8,1,1,1,1,1) ] with .n at last [].c+(0,-griddim)
+
+ ] with .nw at 1st [].ne+(linewid,0)
+
+[ # cascade of n-bit adders
+define(`smarrow',`arrow arrowht*4/5 wid arrowwid*5/4')
+define(`nbitadder',
+`FlipFlopX(wid 2*linewid fill_(0.9),n-bit adder,
+ :, I:;I:;;;I:;I:, I:, O:;;;O: ) `$3'
+ `"... "' at last [].Chip.n + (0,arrowht)
+ `"... "' at last [].Chip.s - (0,arrowht)
+ ifelse(`$1',,,
+ `"x`'svg_sub($1)" at last [].N6.end above
+ "s`'svg_sub($1)" at last [].S4.end below
+ "y`'svg_sub($1)" at last [].N5.end above')
+ ifelse(`$2',,,
+ `"x`'svg_sub($2)" ljust at 0.5 between last [].N2.end and last [].N1.end above
+ "y`'svg_sub($2)" rjust at 0.5 between last [].N2.end and last [].N1.end above
+ "s`'svg_sub($2)" at last [].S1.end below ')
+ ')
+
+P: nbitadder(0,n-1)
+ {"c`'svg_sub(o)" wid 0.15 at P.E1.end ljust }
+ {"c`'svg_sub(n)" at P.W1.end above }
+Q: nbitadder(n,2n-1, with .E1.end at P.W1.end)
+ smarrow left arrowht from Q.W1.end
+ { "... " at Here+(-10pt__,0) }
+R: nbitadder(,kn-1, with .E1.end at Here-(20bp__,0))
+ smarrow left arrowht from R.W1.end
+ {"c`'svg_sub(kn)" wid 0.22 rjust }
+
+
+ ] with .nw at 1st [].sw+(0,-0.5)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AlogixSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AlogixSVG.m4
new file mode 100644
index 00000000000..58cac40f0cb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AlogixSVG.m4
@@ -0,0 +1,116 @@
+.PS
+# `AlogixSVG.m4'
+log_init(svg_font(sans-serif,10.5bp__))
+
+# A modest expression in default form
+A: Autologix(
+ Nand(And(Or(A,C),Or(B,~C),Or(~A,B,C)),Ck);
+ Nand(~A,B)@with .n at last [].s+(0,-2bp__))
+ "svg_it(Out1)" at A.Out1 ljust
+ "svg_it(Out2)" at A.Out2 ljust
+ Loopover_(`v_', `"svg_it(v_)" at A.In`'v_ above ', A,B,C,Ck)
+ move left 0.2 from A.w
+ "svg_tt(`Autologix(')" wid 68bp__ with .w at A.sw+(0,-0.15)
+ "svg_tt(`Nand(And(Or(A,C),Or(B,~C),Or(~A,B,C)),Ck);')" \
+ wid 305bp__ with .w at last "".w+(0.2,-0.18)
+ "svg_tt(`Nand(~A,B)@with .n at last [].s+(0,-2bp__))')"\
+ wid 313bp__ with .w at last "".w+(0,-0.18)
+
+# Draw a tree of gates only. The ~ has been
+# replaced by NOT gates.
+B: Autologix(Or(And(B,Not(C)),And(Not(A),B,C)),N) \
+ with .sw at A.e+(1.3,-0.5)
+ "svg_it(Out)" at B.Out above ljust
+ "svg_tt(`Autologix(')" wid 68bp__ with .w at B.sw+(0,-0.15)
+ "svg_tt(`Or(And(B,Not(C)),And(Not(A),B,C)),N)')" \
+ wid 262bp__ with .w at last "".w+(0.2,-0.18)
+ for_(1,4,1,`"svg_it(B.In`'m4x)" at B.In`'m4x rjust')
+ "svg_it(B.In5)" at B.In5+(0,-1.5bp__) rjust
+
+# Here is how to include an arbitrary circuit
+# that is not one of the standard gates.
+# First, define the circuit with a name ending
+# in _gate. Make sure its inputs are on the left
+# and named In1, In2, ... and the output Out
+# is on the right.
+define(`SR_gate',`[
+ S: NOR_gate
+ R: NOR_gate at S+(0,-L_unit*(AND_ht+4))
+ w = (S.Out.x-R.In1.x)/3
+ v = 2*L_unit
+ line right_ dimen_/2 from S.Out
+ Out: Here
+ TR: R.In1-(v,0)
+ line from S.Out+(v,0) down w*3/2 then left S.Out.x-TR.x+v down w \
+ then to TR then to R.In1
+ TS: S.In2-(v,0);
+ line from R.Out right v then up w*3/2 then left R.Out.x-TS.x+v up w \
+ then to TS then to S.In2
+ In1: S.In1
+ In2: R.In2 ]')
+# Now define the function by which the circuit
+# will be invoked:
+define(`SRff',`_AutoGate(SR,$@)')
+
+# You are done. Here is an example:
+G: [
+ F: Autologix(SRff(And(x,y),Nand(x,y)),LRV)
+
+ "svg_it(x)" at F.Inx rjust
+ "svg_it(y)" at F.Iny rjust
+ "svg_it(Out)" at F.Out ljust
+ ] with .sw at A.n+(0.5,-0.25)
+ "svg_tt(`Autologix(SRff(And(x,y),Nand(x,y)),LRV)')" wid 285pt__ \
+ with .w at last [].sw+(0,-10pt__)
+
+undefine(`extras')
+define(`extras')
+
+ifdef(`extras',`
+ Q1: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D))) \
+ with .nw at A.sw+(0,-61bp__)
+ Loopover_(`x',`"x" wid 7bp__ at last [].In`'x above',A,B,C,D)
+
+ "svg_tt(`Q1: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),options)')" \
+ wid 363bp__ with .nw at Q1.sw+(0,-10bp__)
+ "svg_tt(`Loopover_(`x',`\"svg_it(x)\" at last [].In`'x above',A,B,C,D)')" \
+ wid 431bp__ with .nw at last "".sw+(0,-5bp__)
+
+ Q2: Autologix(Nor(Nor(A,And(B,~C)),Nand(Not(B),D)),V) \
+ with .nw at last "".sw+(0,-16bp__)
+ Loopover_(`x',`"x" at last [].In`'x above',A,B,C,D)
+ "V" at last [].se above rjust
+
+ Q3: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),R) \
+ with .nw at last [].sw+(0,-0.2)
+ Loopover_(`x',`"x" at last [].In`'x above',A,B,C,D)
+ "R" at last [].se above rjust
+
+ Q4: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),RV) \
+ with .nw at last [].sw+(0,-0.2)
+ Loopover_(`x',`"x" at last [].In`'x above',A,B,C,D)
+ "RV" at last [].se above rjust
+
+ Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),LRV) \
+ with .Out at Q4.Out+(3.5,0)
+ Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D)
+ "LRV" at last [].se above rjust
+
+ Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),LR;offset=-L_unit*1.5) \
+ with .Out at Q3.Out+(3.5,0)
+ Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D)
+ "LR" at last [].se above rjust
+
+ Autologix(Nor(Nor(A,And(B,~C)),Nand(Not(B),D)),LV;offset=L_unit*2) \
+ with .Out at Q2.Out+(3.5,0)
+ Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D)
+ "LV" at last [].se above rjust
+
+ Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),L) \
+ with .Out at Q1.Out+(3.5,0)
+ Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D)
+ "L" at last [].se above rjust
+')
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AmpTableSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AmpTableSVG.m4
new file mode 100644
index 00000000000..2850ff5ad70
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AmpTableSVG.m4
@@ -0,0 +1,25 @@
+.PS
+# `Amptable.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+ textwid = 0.7
+ movewid = 2pt__
+{
+ {amp ; move ; "`amp'" ljust}
+ move down 0.4; right_
+ {amp(,0.3) ; move ; "`amp'(,0.3)" ljust}
+ }
+ move right_ 2.0
+{ {delay ; move ; "`delay'" ljust}
+ move down 0.4; right_
+ {delay(,0.2) ; move ; "`delay'(,0.2)" ljust}
+ }
+
+ move right_ 2.0
+{ {integrator ; move ; "`integrator'" ljust}
+ move down 0.5; right_
+ {integrator(,0.3) ; move ; "`integrator'(,0.3)" wid 1.2 at Here ljust}
+ }
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AntennasSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AntennasSVG.m4
new file mode 100644
index 00000000000..ed098b39108
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AntennasSVG.m4
@@ -0,0 +1,40 @@
+.PS
+# `Antennas.m4'
+cct_init(svg_font(sans-serif,11bp__))
+ textoffset = 3bp__
+
+ define(`elen_',elen_*0.9)
+ B: Here
+ A: antenna
+ "T" below at A.T
+ "`antenna'" wid 0.6 at A.n above
+ A: antenna(at A.T+(elen_,0),T)
+ "T" below at A.T
+ "`(,T)'" at A.n above
+ A: antenna(at A.T+(elen_,0),,L)
+ "T1" below rjust at A.T1
+ "T2" below ljust at A.T2
+ "`(,,L)'" at A.n above
+ A: antenna(at A.T+(elen_,0),T,L)
+ "T1" below rjust at A.T1
+ "T2" below ljust at A.T2
+ "`(,T,L)'" at A.n above
+ A: antenna(at A.T+(elen_,0),,T)
+ "T" below at A.T
+ "`(,,T)'" at A.n above
+ A: antenna(at A.T+(elen_,0),,S)
+ "T1" below rjust at A.T1
+ "T2" below ljust at A.T2
+ "`(,,S)'" at A.n above
+ A: antenna(at A.T+(elen_,0),,D)
+ "T1" below rjust at A.T1
+ "T2" below ljust at A.T2
+ "`(,,D)'" at A.n above
+ A: antenna(at A.T+(elen_,0),,P)
+ "T" below at A.T
+ "`(,,P)'" at A.n above
+ A: antenna(at A.T+(elen_,0),,F)
+ "T" below at A.T
+ "`(,,F)'" at A.n above
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AudioSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AudioSVG.m4
new file mode 100644
index 00000000000..116f155e589
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/AudioSVG.m4
@@ -0,0 +1,93 @@
+.PS
+# `Audio.m4'
+cct_init(svg_font(sans-serif,11bp__,2bp__))
+
+define(`In123',`
+thinlines_
+ arrow <- from `$1'.In1 up 0.05 left 0.15
+ "svg_it(In1)" wid 0.25 rjust above
+ arrow <- left 0.15 from `$1'.In2
+ "svg_it(In2)" rjust
+ arrow <- from `$1'.In3 down 0.05 left 0.15
+ "svg_it(In3)" rjust below
+thicklines_ ')
+
+L:[
+ S: speaker
+ `"speaker"' at S.s+(0,-0.2) below
+ In123(S)
+ thinlines_
+ arrow <- from S.In4 left 0.05 up 0.15
+ "svg_it(In4)" above rjust
+ arrow <- from S.In5 right 0.05 up 0.15
+ "svg_it(In5)" above ljust
+ arrow <- from S.In6 left 0.05 down 0.15
+ "svg_it(In6)" below rjust
+ arrow <- from S.In7 right 0.05 down 0.15
+ "svg_it(In7)" below ljust
+ spline <- from S.Box.e+(0,0.05) right 0.27 up 0.10 \
+ then right 0.1 up 0.2
+ "svg_it(Box)" above
+ thicklines_
+ ]
+[
+ H: speaker(,,H)
+ `"...(,,H)"' at H.s+(0,-0.30) below
+ ] with .sw at last [].se
+[
+ B: bell
+ `"bell"' at B.s+(0,-0.2) below
+ In123(B)
+ thinlines_
+ arrow <- from B.Box.n+(-0.1,0) up 0.15 left 0.1 ; "svg_it(Box)" above
+ arrow <- from B.Circle.n up 0.15 ; "svg_it(Circle)" above
+ thicklines_
+ ] with .sw at last [].se+(0.35,0)
+[
+ M: microphone
+ `"microphone"' at M.s+(0,-0.2) below
+ In123(M)
+ thinlines_
+ arrow <- from M.Circle.n up 0.15 ; "svg_it(Circle)" above
+ thicklines_
+ ] with .sw at last [].se+(0.4,0)
+[
+ Z: buzzer
+ `"buzzer"' at Z.s+(0,-0.2) below
+ In123(Z)
+ thinlines_
+ arrow <- from Z.Box.n up 0.15 ; "svg_it(Box)" above
+ thicklines_
+ ] with .sw at last [].se+(0.4,0)
+R:[
+ Z: buzzer(,,C)
+ `"buzzer(,,C)"' at Z.s+(0,-0.2) below
+ In123(Z)
+ thinlines_
+ spline <- from 0.8<Z.Face.s,Z.Face.n> right 2*arrowht up 0.5*arrowht \
+ then up 0.15 right 0.05
+ "svg_it(Face)" wid 0.5 at Here above
+ thicklines_
+ ] with .sw at last [].se+(0.4,0)
+[[
+ E: earphone
+ `"earphone"' at E.s+(0,-0.2) below
+ In123(E)
+ thinlines_
+ arrow <- from E.Box.n up 0.15 left 0.15 ; "svg_it(Box)" above
+ thicklines_
+ ]
+ [
+ E: earphone(,,C)
+ `"earphone(,,C)"' at E.s+(0,-0.2) below
+ thinlines_
+ arrow <- from E.L up 0.15 left 0.15; "svg_it(L)" rjust
+ arrow <- from E.R up 0.15 right 0.15; "svg_it(R)" ljust
+ "svg_it(N)" at E.N above
+ "svg_it(C)" at E.C
+ thicklines_
+ ] with .sw at last [].se+(0.4,0)
+] with .n at (0.5 between L and R,L.s)+(0,-0.2)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.m4
new file mode 100644
index 00000000000..630326f867c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.m4
@@ -0,0 +1,59 @@
+.PS
+#Banking.m4
+
+gen_init
+
+ scale = 2.54 # use cm
+ svg_font(Arial Black,11 bp__,2 bp__)
+ boxwid = 6.8
+ boxht = 4.5
+ linethick_(1.5)
+
+ define(`heading',
+ `<tspan font-style=\"bold\" font-size=\"120%\" fill=\"white\">`$1'</tspan>')
+ define(`subheading',
+ `<tspan fill=\"white\" font-size=\"75%\" font-style=\"bold\">[`$1']</tspan>')
+ define(`wtext',`<tspan fill=\"white\">`$1'</tspan>')
+
+ C: circle diam 2.6 colored "mediumblue"
+ Person: box rad boxht/4 colored "mediumblue" with .n at C.s+(0,C.rad/8) \
+ "heading(Personal Banking)" \
+ "" \
+ "heading(Customer)" \
+ "subheading(Person)" \
+ "" \
+ "wtext(A customer of the bank`,' with)" \
+ "wtext(personal bank accounts.)"
+
+ A1: arrow thick 1.5 dashed down 3.5 from Person.s
+ svg_font(Arial,11 bp__,2 bp__)
+ { box invis fill 1 ht 0.4 wid 1.0 "Uses" at A1 }
+ command "</g>"
+ Internet: box colored "steelblue" \
+ "heading(Internet Banking System)" \
+ "subheading(Software system)" \
+ "" \
+ "wtext(Allows customers to view)" \
+ "wtext(information about their bank)" \
+ "wtext(accounts`,' and make payments.)"
+
+ svg_font(Arial,11 bp__,2 bp__)
+ A2: arrow thick 1.5 dashed right 5.4 from Internet.e \
+ "Sends e-mail" above "using" below
+ command "</g>"
+ Email: box colored "slategrey" \
+ "heading(E-mail System)" \
+ "subheading(Software system)" \
+ "" \
+ "wtext(Internal Microsoft Exchange)" \
+ "wtext(e-mail system.)"
+
+ A3:arrow thick 1.5 dashed from Email.nw+(0.4,0) to Person.se+(0.3,Person.ht/5)
+ svg_font(Arial,11 bp__,2 bp__)
+ { box invis fill 1 ht 0.4 wid 3.3 "Sends e-mails to" at A3 }
+ command "</g>"
+
+# etc
+
+ command "</g>" # font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.txt b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.txt
new file mode 100644
index 00000000000..122846d1c33
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Banking.txt
@@ -0,0 +1,54 @@
+.PS
+#Banking.m4
+
+ command "<g style=\"font-family:Arial\">"
+ textht = 12*(scale/72)*dptextratio # 12 pt size
+
+ scale = 2.54 # use cm
+ boxwid = 6.8
+ boxht = 4.5
+ arrowwid = 0.25
+ arrowht = 0.5
+
+define heading {"<tspan font-style=\"bold\" font-size=\"120%\" fill=\"white\"
+>$1</tspan>"}
+define subheading {"<tspan font-style=\"bold\" font-size=\"75%\" fill=\"white\"
+>$1</tspan>"}
+define wtext {<tspan fill="white">$1</tspan>}
+
+ C: circle diam 2.6 colored "mediumblue"
+ Person: box rad boxht/4 colored "mediumblue" with .n at C.s+(0,C.rad/8) \
+ heading(Personal Banking) \
+ "" \
+ heading(Customer) \
+ subheading(Person) \
+ "" \
+ wtext(A customer of the bank, with) \
+ "wtext(personal bank accounts.)"
+
+# arrow thick 1.5 dashed down 3.5 from Person.s
+# { box invis fill 1 ht 0.4 wid 1.0 "Uses" at last arrow }
+# Internet: box colored "steelblue" \
+# "heading(Internet Banking System)" \
+# "subheading(Software system)" \
+# "" \
+# "wtext(Allows customers to view)" \
+# "wtext(information about their bank)" \
+# "wtext(accounts`,' and make payments.)"
+#
+# arrow thick 1.5 dashed right 5.4 from Internet.e \
+# "Sends e-mail" above "using" below
+# Email: box colored "slategrey" \
+# "heading(E-mail System)" \
+# "subheading(Software system)" \
+# "" \
+# "wtext(The internal Microsoft Exchange)" \
+# "wtext(e-mail system..)"
+#
+# arrow thick 1.5 dashed from Email.nw+(0.4,0) to Person.se+(0.3,Person.ht/5)
+# { box invis fill 1 ht 0.4 wid 3.3 "Sends e-mails to" at last arrow }
+
+# etc
+
+ command "</g>" # font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BipSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BipSVG.m4
new file mode 100644
index 00000000000..7dbf38c84a7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BipSVG.m4
@@ -0,0 +1,68 @@
+.PS
+# `Bip.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+ up_
+Q1: bi_tr(up_ dimen_)
+ thinlines_
+ box dotted ht last [].ht wid last [].wid at last []
+ thicklines_
+ "E" at Q1.E-(0,0.05) below
+ "B" at Q1.B rjust
+ "C" at Q1.C above
+ "`bi_tr(up_ dimen_)'" wid 1.2 at Q1.s + (0,-0.35) below
+
+Q2: bi_tr(,R) with .E at Q1.E+(0.25,0)
+ thinlines_
+ box dotted ht last [].ht wid last [].wid at last []
+ thicklines_
+ "E" at Q2.E-(0,0.05) below
+ "B" at Q2.B ljust
+ "C" at Q2.C above
+ "`bi_tr(,R)'" at Q2.s + (0,-0.2) below
+
+Q3: bi_tr(,,P) with .C at Q2.C+(1.15,0)
+ thinlines_
+ box dotted ht last [].ht wid last [].wid at last []
+ thicklines_
+ "E" at Q3.E-(0,0.05) below
+ "B" at Q3.B rjust
+ "C" at Q3.C above
+ "`bi_tr(,,P)'" at Q3.s + (0,-0.2) below
+
+Q4: bi_tr(,,,E) with .C at Q3.C+(0.9,0)
+ thinlines_
+ box dotted ht last [].ht wid last [].wid at last []
+ thicklines_
+ "E" at Q4.E-(0,0.05) below
+ "B" at Q4.B rjust
+ "C" at Q4.C above
+ "`bi_tr(,,,E)'" at (Q4.s,Q4.E) + (0,-0.2) below
+
+Q5: igbt(,,) with .E at Q4.E+(0.65,0)
+ thinlines_
+ box dotted ht last [].ht wid last [].wid at last []
+ thicklines_
+ "E" at Q5.E-(0,0.05) below
+ "G" at Q5.G rjust
+ "C" at Q5.C above
+ "`igbt'" at Q5.s + (0,-0.2) below
+
+Q6: igbt(,,LD) with .E at Q5.E+(0.55,0)
+ thinlines_
+ box dotted ht last [].ht wid last [].wid at last []
+ thicklines_
+ "E" at Q6.E-(0,0.05) below
+ "G" at Q6.G rjust
+ "C" at Q6.C above
+ "`igbt(,,LD)'" at (Q6.s,Q6.E) + (0,-0.2) below
+
+Q7: Darlington with .E at Q6.E+(1.2,0)
+ thicklines_
+ "E" wid 0.15 at Q7.E-(0,0.05) below
+ "B" at Q7.B rjust
+ "C" at Q7.C above
+ "`Darlington'" at (Q7.s,Q7.E) + (0,-0.2) below
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BtreeSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BtreeSVG.m4
new file mode 100644
index 00000000000..df0a2726b22
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/BtreeSVG.m4
@@ -0,0 +1,33 @@
+.PS
+# Btree.m4
+# One way to draw a binary tree using pic macros
+gen_init(svg_font(sans-serif,11bp__))
+circlerad = 0.35
+
+define n { [C: circle fill_(0.9) $1
+ if "$2" != "" then {
+ L: $2 with .ne at C.s-(circlerad/20, circlerad/2)
+ line from C to L.C chop }
+ if "$3" != "" then {
+ R: $3 with .nw at C.s+(circlerad/20,-circlerad/2)
+ line from C to R.C chop }
+ ] }
+
+# Redrawn from T. A. Standish, "Data Structure Techniques," Addison-Wesley 1980.
+# Node data:
+define Sirius { n("Sirius",Canopus,Vega) }
+define Canopus { n("Canopus",AlphaCentauri,Capella) }
+define AlphaCentauri { n("Alpha" "Centauri",Achernar,Arcturus) }
+define Arcturus { n("Arcturus",Betelgeux) }
+define Betelgeux { n("Betelgeux",BetaCentauri) }
+define Capella { n("Capella",Rigel) }
+define Rigel { n("Rigel",Procyon) }
+define Achernar { n("Achernar") }
+define BetaCentauri { n("Beta" "Centauri") }
+define Procyon { n("Procyon") }
+define Vega { n("Vega") }
+
+# Build the tree from the root
+S: Sirius
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ButtonsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ButtonsSVG.m4
new file mode 100644
index 00000000000..b9e9c12e699
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ButtonsSVG.m4
@@ -0,0 +1,115 @@
+.PS
+# ButtonsSVG.m4
+gen_init(svg_font(sans-serif,11bp__))
+copy "HOMELIB_/dpictools.pic"
+
+divert(-1)
+#################################################################
+
+ `RoundButton(diameter,hue,linedensity)
+ hue 0=red, 60=yellow, 120=green ...'
+define(`RoundButton',`[
+# Colors and radius:
+ hue = ifelse(`$2',,60,`$2')
+ crad = ifelse(`$1',,circlerad,(`$1')/2)
+ linedensity = ifelse(`$3',,150/scale,`$3') # default 150 lines per inch
+ hsvtorgb(hue, 1, 1, r1,g1,b1)
+ hsvtorgb(hue-5, 1,0.9, r2,g2,b2)
+ hsvtorgb(hue-10,1,0.5, r3,g3,b3)
+# Shaded main disk
+ define RBbackground {
+ circle rad crad*($`'1) thick lthk at C outlined rgbstring($`'2,$`'3,$`'4)
+ }
+ C: circle invis rad crad at (0,0)
+ nsteps = round_(crad*linedensity)
+ lthk = crad/nsteps/(1bp__)
+ ShadeObject(RBbackground,nsteps,
+ 0, r1,g1,b1,
+ 0.2, r1,g1,b1,
+ 0.8, r2,g2,b2,
+ 1, r3,g3,b3) at C
+# Highlight disk with arc shading
+ rad1 = crad*3/4
+ C1: C.n-(0,rad1+0.02*crad)
+ C2: C1+(0,2*rad1)
+ lthk = 2*rad1/nsteps/(1bp__)
+ define RBoverlay {
+ radx = rad1 + ($`'1)*2*rad1
+ if $`'1 < 1 then {
+ arc cw rad radx thick lthk outlined rgbstring($`'2,$`'3,$`'4) \
+ from Cintersect(C2,radx,C1,rad1) \
+ to Cintersect(C2,radx,C1,rad1,R) \
+ with .c at C2
+ } }
+ nsteps = round_(rad1*2*linedensity)
+ ShadeObject(RBoverlay,nsteps,
+ 0, 1, 1, 1,
+ 0.1, 1, 1, 1,
+ 0.33,(r1+r2)/2,(g1+g2)/2,(b1+b2)/2,
+ 0.67,r1,g1,b1,
+ 1, (r1+r2)/2,(g1+g2)/2,(b1+b2)/2) with .c at C1
+ `$4']')
+
+#################################################################
+
+ `BoxButton(wid,height,hue,linedensity)
+ hue 0=red, 60=yellow, 120=green ...'
+define(`BoxButton',`[
+# Size and Color
+ boxw = ifelse(`$1',,boxwid*4/3,`$1')
+ boxh = ifelse(`$2',,boxw/4,`$2')
+ hue = ifelse(`$3',,180,`$3')
+ hsvtorgb(hue, 1, 1, r1,g1,b1)
+ hsvtorgb(hue-5, 1,0.9, r2,g2,b2)
+ hsvtorgb(hue-10,1,0.5, r3,g3,b3)
+# Peripheral shading
+ linedensity = ifelse(`$4',,150/scale,`$4')
+ nsteps=10
+ define BxBshadow {
+ box ht boxh wid boxw rad boxh/2 \
+ outlined rgbstring($`'2,$`'3,$`'4) at (0,($`'1)*4*linethick bp__)
+ }
+ Q: ShadeObject(BxBshadow,nsteps,
+ 0, 1,1,1,
+ 1, r3,g3,b3)
+# Shaded body
+ lthk = boxh/nsteps/(1bp__)
+ define BxBshade {
+ v = boxh*(1-($`'1))
+ h = (boxw-boxh)/2+sqrt((boxh/2)^2-(v-boxh/2)^2)
+ line from (-h,v) to (h,v) thick lthk outlined rgbstring($`'2,$`'3,$`'4)
+ }
+ nsteps = boxh*linedensity
+ C: ShadeObject(BxBshade,nsteps,
+ 0, r1, g1, b1,
+ 0.4, r2, g2, b2,
+ 1, r3, g3, b3) with .n at Q.n
+# Shaded highlight
+ bh = boxh*0.4
+ bw = boxw*4/4.5
+ define BxBhighlight {
+ v = bh*(1-($`'1)); h = (bw-bh)/2+sqrt((bh/2)^2-(v-bh/2)^2)
+ line from (-h,v) to (h,v) thick lthk outlined rgbstring($`'2,$`'3,$`'4)
+ }
+ nsteps = bh*linedensity
+ ShadeObject(BxBhighlight,nsteps,
+ 0,1,1,1,
+ 8/nsteps,1,1,1,
+ 1, r2,g2,b2) with .n at Q.n+(0,-boxh/20)
+ `$5']')
+
+#################################################################
+divert(0)dnl
+
+for x=0 to 5 do {
+ B: RoundButton(0.6,x*60) at (x,0)
+ "Button" sprintf("%g",x+1) at B }
+
+[ for i=0 to 2 do {
+ BoxButton(1.5,,180+120*i) at (i*2,0)
+ "Button" at last [].C
+ }
+ ] with .nw at 1st [].sw+(0,-0.5)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ByteSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ByteSVG.m4
new file mode 100644
index 00000000000..fcd6bdce60c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ByteSVG.m4
@@ -0,0 +1,38 @@
+% Byte.m4
+.PS
+gen_init(svg_font(sans-serif,11bp__))
+boxht = 0.2
+boxwid = 3.5
+
+define leftlabel { {"$1" at last box.w ljust} }
+
+down_
+Lab[0]: box; leftlabel( B0STDISBL (reset pin is enabled) )
+Lab[1]: box; leftlabel( WDTON (WDT not always on) )
+Lab[2]: box; leftlabel( SPIEN (allow serial programming) )
+Lab[3]: box; leftlabel( CKOPT (full output swing) )
+Lab[4]: box; leftlabel( EESAVE (don't preserve EEPB0OM over chip erase) )
+Lab[5]: box; leftlabel( BOOTSZ1 )
+Lab[6]: box; leftlabel( BOOTSZ0 )
+Lab[7]: box; leftlabel( BOOTB0ST (boot reset vector at 0x0000) )
+
+boxwid = boxht
+left_
+B0:box "1" with .e at Lab[0].nw + (0.75,0.5)
+ box "0"
+ box "0"
+ box "1"
+ box "0"
+ box "0"
+ box "1"
+ box "1"
+ box wid 2*boxht "0xc9"
+
+for i=0 to 7 do {
+ spline -> ht arrowht*0.7 from B0.s-(i*boxht,0) down boxht/4 \
+ then to Lab[0].nw-((i+1)*boxht/2,0) \
+ then down Lab[0].nw.y-Lab[i].y then to Lab[i].w
+ }
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CanLogicSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CanLogicSVG.m4
new file mode 100644
index 00000000000..b6c1d02e2f2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CanLogicSVG.m4
@@ -0,0 +1,159 @@
+.PS
+#CanLogic
+ifdef(`L_unit',,`include(liblog.m4)')
+log_init(svg_font(sans-serif,11bp__))
+
+divert(-1)
+###########################################################################
+ Macros for automatically drawing 2-layer
+ Boolean functions
+
+ Style parameters
+define(`dotrad_',(0.01*scale))
+define(`gatelineth',1)
+define(`lineth',0.5)
+define(`inputsep',`2*jog')
+define(`jog',`(AND_ht/2)*L_unit')
+
+ `CanLogic(layer gate type,[N],
+ output gate type,[N],
+ term,term,...)
+ This is the driver macro. Terms are
+ strings of variables or of variables
+ preceded by the ~ character. Each
+ variable is one letter e.g.
+ CanLogic(NAND,,OR,N,abcd,a~b,c,~ad)'
+define(`CanLogic',
+ `define(`terms',`shift(shift(shift(shift($@))))')
+# Determine required input variables and negated
+# variables
+ Loopover_(`t_',`varloop(`v_',`define(X`'v_)',`define(XN`'v_)',t_)',terms)
+# Draw the inputs with NOT gates as necessary
+ LastInput: Here-(inputsep,0)
+ Loopover_(`t_',`varloop(`v_',
+ `ifdef(D`'v_,,`ifdef(XN`'v_,`DrawInNotIn(v_)',`DrawIn(v_)')')',
+ `ifdef(D`'v_,,`ifdef(X`'v_,`DrawInNotIn(v_)',`DrawNotIn(v_)')')', t_)',
+ terms)
+# Draw 2nd-layer gates
+ right_
+ LastGateSE: LastInput+(5*jog,-(AND_wd*L_unit*1.5))
+ Loopover_(`t_',
+ `define(`termcount',m4Lx)DrawLayerGate(G`'termcount,$1,$2,t_)',
+ terms)
+# Draw output gate
+ linethick = gatelineth
+ OP: m4xpand(`$3'_gate(termcount,$4)) with .Out at \
+ 0.5<G1.Out,G`'termcount.Out> + (jog/2*(termcount+3)+AND_wd*L_unit,0)
+ Out: Here
+ linethick = lineth
+# Connect 2nd-layer gates to the output gate
+ VectorConnect(G,termcount,OP)
+# Connect the inputs and negated inputs to
+# 2nd-layer gates
+ Loopover_(`t_',`ConnectInputs(G`'m4Lx,t_)',terms)
+# Clean up
+ Loopover_(`t_',`DeleteLogDefs(t_)',terms)
+ ')
+ `VectorConnect(number of 2nd layer gates,
+ common 2nd layer gate name,
+ output gate name)
+ Connect the 2nd-layer gate outputs to the
+ output gate inputs'
+define(`VectorConnect',
+ `for_(1,`$2',1,
+ `line from `$1'm4x.Out right `$3'.In1.x-`$1'm4x.Out.x \
+ - jog/2*(`$2'+1-abs(2*m4x-`$2'-1)) \
+ then down `$1'm4x.Out.y - `$3'.In`'m4x.y then to `$3'.In`'m4x ')')
+
+ Draw and label a non-inverted input
+define(`DrawIn',
+ `LastInput: LastInput+(inputsep,0)
+ In`'$1: LastInput
+ "svg_it($1)" ljust at LastInput # Maybe labels should be done externally
+ Int`'$1: LastInput
+ define(D`'$1)')
+
+ Draw and label an inverted input
+define(`DrawNotIn',
+ `LastInput: LastInput+(inputsep,0)
+ InN`'$1: LastInput
+ "svg_it($1)" ljust at LastInput # Maybe labels should be done externally
+ line down_ 2*jog from LastInput
+ linethick = gatelineth
+ NOT_gate
+ InNt`'$1: Here
+ linethick = lineth
+ define(D`'$1)')
+ Draw and label an input that is required both
+ inverted and uninverted.
+define(`DrawInNotIn',
+ `LastInput: LastInput+(inputsep,0)
+ In`'$1: LastInput
+ "svg_it($1)" ljust at LastInput # Maybe labels should be done externally
+ line from LastInput down jog
+ Int`'$1: dot
+ LastInput: LastInput+(inputsep,0)
+ line to (LastInput,Here) then down_ jog
+ linethick = gatelineth
+ NOT_gate
+ linethick = lineth
+ InNt`'$1: Here
+ define(D`'$1)')
+ `varloop(`var',ifnotnegated,ifnegated,term)
+ Loop over term variables performing actions'
+define(`varloop',`ifelse(`$4',,,substr(`$4',0,1),~,
+ `define(`$1',substr($4,1,1)) $3
+ varloop(`$1',`$2',`$3',substr($4,2))',
+ `define(`$1',substr($4,0,1)) $2
+ varloop(`$1',`$2',`$3',substr($4,1))')')')
+
+ Count gate inputs and mark last appearance
+define(`Countinputs',`varloop(`v_',
+ `define(`incount',incr(incount)) define(Last`'v_,`$1')',
+ `define(`incount',incr(incount)) define(LastN`'v_,`$1')',$2)')
+
+ Draw a 2nd layer gate
+define(`DrawLayerGate',
+ `define(`incount',0)
+ Countinputs($1,$4)
+ ifelse(incount,1,
+ `LastGateSE: LastGateSE-(0,jog)
+ $1: [ In1:Here; line right AND_wd*L_unit; Out: Here] \
+ with .Out at LastGateSE',
+ `LastGateSE: LastGateSE-(0,jog+AND_ht*L_unit)
+ linethick = gatelineth
+ $1: m4xpand(`$2'_gate(incount,$3)) with .se at LastGateSE
+ linethick = lineth ')')
+
+ Connect this gate to its input lines
+define(`ConnectInputs',`define(`innum',0) varloop(`v_',
+ `define(`innum',incr(innum))
+ line from `$1'.In`'innum to (In`'v_,`$1'.In`'innum)dnl
+ ifelse(`$1',m4xpand(Last`'v_),`then to In`'v_',`; dot')',
+ `define(`innum',incr(innum))
+ line from `$1'.In`'innum to (InNt`'v_,`$1'.In`'innum)dnl
+ ifelse(`$1',m4xpand(LastN`'v_), `then to InNt`'v_', `; dot')',$2)')
+
+ Delete definitions to allow more than one
+ circuit per diagram
+define(`DeleteLogDefs',`varloop(`v_',
+ `undefine(Last`'v_) undefine(D`'v_) undefine(X`'v_)',
+ `undefine(LastN`'v_) undefine(D`'v_) undefine(XN`'v_)',$1)')
+
+ Thanks to Alexander Ray for suggesting the
+ need for something like these macros
+###########################################################################
+divert(0)dnl
+
+ linethick = lineth
+
+[ CanLogic(AND,,OR,,abcd,a~b,c,~ad) #; line right jog from Out "svg_it(f)" above
+ ]
+{`"CanLogic(AND,,OR,,abcd,a~b,c,~ad)"' at last [].s -(0,11bp__)}
+
+[ CanLogic(OR,N,NAND,,ab~c,a~bc,ac,~d) #; line right jog from Out "$f$" above
+ ] with .sw at last [].se+(0.5,0)
+{`"CanLogic(OR,N,NAND,,ab~c,a~bc,ac,~d)"' at last [].s - (0,11bp__)}
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4
new file mode 100644
index 00000000000..3c79a32d6bc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CctTableSVG.m4
@@ -0,0 +1,79 @@
+.PS
+# `CctTableSVG.m4'
+cct_init(svg_font(sans-serif,11pt__))
+textwid = 1.5
+movewid = 2 pt__
+hm = 2.1
+vm = 0.28
+{ {resistor ; move ; svgLink(NportSVG.svg,"`resistor'" ljust)}
+ move right_ hm
+ {resistor(,,Q) ; move ; "`resistor(,,Q) '" ljust}
+ move right_ hm
+ {resistor(,,E) ; move ; "`resistor(,,E) = ebox'" ljust}
+}
+ move down vm; right_
+{ {resistor(,,ES) ; move ;"`resistor(,,ES) '" ljust}
+ move right_ hm
+ {resistor(,4,QR) ; move ;"`resistor(,4,QR) '" ljust}
+ move right_ hm
+ {resistor(,,H) ; move ;"`resistor(,,H) '" ljust}
+}
+ move down vm; right_
+{ {resistor(,,V) ; move ;"`resistor(,,V)'" ljust}
+ move right_ hm
+ {ebox(,,,0.5) ; move ;"`ebox(,,,0.5)'" ljust}
+ move right_ hm
+ {ebox(,0.5,0.3) ; move ;"`ebox(,0.5,0.3)'" ljust}
+}
+ move down vm; right_
+{ {inductor ; move ;"`inductor'" ljust}
+ move right_ hm
+ {inductor(,W); move ;"`inductor(,W)'" ljust}
+ move right_ hm
+ {inductor(,L); move ;"`inductor(,L)'" ljust}
+}
+ move down vm; right_
+{ {inductor(,,,M) ; move ;"`inductor(,,,M)'" ljust}
+ move right_ hm
+ {inductor(,W,6,P); move ;"`inductor(,W,6,P)'" ljust}
+ move right_ hm
+ {ttmotor(,G) ; move ;"`ttmotor(,G)'" ljust}
+}
+ move down vm; right_
+{ {capacitor ; move ;"`capacitor'" ljust}
+ move right_ hm
+ {capacitor(,C); move ;"`capacitor(,C)'" ljust}
+ move right_ hm
+ {capacitor(,C+); move ;"`capacitor(,C+)'" ljust}
+}
+ move down vm; right_
+{ {capacitor(,P); move ;"`capacitor(,P)'" ljust}
+ move right_ hm
+ {capacitor(,E); move ;"`capacitor(,E)'" ljust}
+ move right_ hm
+ {capacitor(,K); move ;"`capacitor(,K)'" ljust}
+}
+ move down 0.25; right_
+{ {capacitor(,M); move ;"`capacitor(,M)'" ljust}
+ move right_ hm
+ {capacitor(,N); move ;"`capacitor(,N)'" ljust}
+ move right_ hm
+ {xtal ; move ;"`xtal'" ljust}
+}
+ move down 0.25; right_
+{ {memristor ; move;"`memristor'" ljust}
+ move right_ hm
+ {heater; move;"`heater'" ljust}
+ move right_ hm
+ {tline ; move;"`tline'" ljust}
+}
+ move down 0.25; right_
+{ {gap ; move ;"`gap'" ljust}
+ move right_ hm
+ {gap(,,A) ; move ;"`gap(,,A)'" ljust}
+ move right_ hm
+ {arrowline ; move;"`arrowline'" ljust}
+}
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ConnSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ConnSVG.m4
new file mode 100644
index 00000000000..9d828ee48fd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ConnSVG.m4
@@ -0,0 +1,67 @@
+.PS
+# `ConnSVG.m4'
+cct_init(svg_font(sans-serif,11.5bp__))
+
+T:[
+ S1: tstrip(U)
+ thinlines_
+ arrow <- left 0.15 from S1.L1; "L1" rjust
+ arrow <- left 0.15 from S1.L4; "L4" wid 0.2 rjust
+ "..." at (0.5 between last "" and 2nd last "")+(-0.15,0.02)
+ arrow <- right 0.25 from S1.R1; "R1" ljust
+ arrow <- right 0.25 from S1.R4; "R4" ljust
+ "..." at (0.5 between last "" and 2nd last "")+(0.15,0.02)
+ arrow <- right 0.15 up 0.10 from S1.T1; "T1" ljust
+ arrow <- right 0.15 up 0.10 from S1.T4; "T4" ljust
+ "..." at (0.5 between last "" and 2nd last "")+(0.15,0.02)
+ thicklines_
+ CS1: "`tstrip(U)'" at S1.s+(0,-0.15)
+ S2: tstrip(R,5,DO;wid=1.0;ht=0.25) with .sw at S1.se+(0.7,0.15)
+ thinlines_
+ arrow <- up 0.2 right 0.1 from S2.T1; "T1" above
+ arrow <- up 0.2 right 0.1 from S2.T5; "T5" above
+ "..." at 0.5 between last "" and 2nd last "" above
+ CS2: `"tstrip(R,5,"' ljust \
+ `" DO;wid=1.0;ht=0.25)"' ljust at S2.sw+(-0.1,-0.2)
+]
+
+C: [
+ C1: ccoax
+ `"ccoax "' at C1.s below
+ thinlines_
+ arrow <- up 0.1 right 0.1 from C1.C.ne; "C" ljust
+ arrow <- down 0.05 right 0.1 from C1.S.e; "S" wid 0.1 ljust
+ thicklines_
+ C2: ccoax(at C1+(0,0.3),F)
+ `"ccoax(,F)"' wid 0.65 at C2.ne ljust
+ ] with .C1.sw at T.S2.se+(0.6,0.0)
+
+Y: [
+ tconn(,O)
+ {`"tconn(,O)"' at last line.c+(0,-0.2) wid 43 pt__ }
+ move to Here+(0.3,0)
+ P1: tconn(,>)
+ {`"(,&#x3E;)"' at last line.c+(0,-0.2)}
+ move to P1.end+(0.3,0)
+ tconn(,>>)
+ {`"(,&#x3E;&#x3E;)"' at last line.c+(0,-0.2)}
+ move to P1.start+(0,linewid)
+ P3: tconn(,<)
+ {`"tconn(,&#x3C;)"' at last line.c+(0,-0.2)}
+ move to P3.end+(0.3,0)
+ tconn(,<<)
+ {`"(,&#x3C;&#x3C;)"' at last line.c+(0,-0.2)}
+
+] with .sw at (C.e.x-0.3,T.s.y)
+
+B: [
+ tbox(V`'svg_sub(2))
+ `"tbox(V`'svg_sub(2))"' wid 105bp__ with .nw at last [].sw+(0,-4bp__)
+ [ left_;
+ tbox(V`'svg_sub(1)) ] with .nw at last [].sw+(0,-0.25)
+ `"left_"' at last [].sw +(0,-0.2) ljust `"tbox(V`'svg_sub(1))"' wid 100bp__ \
+ ljust
+] with .nw at Y.ne+(0.2,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CountingSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CountingSVG.m4
new file mode 100644
index 00000000000..a972ba663f6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CountingSVG.m4
@@ -0,0 +1,32 @@
+.PS
+# CountingSVG.m4
+gen_init(svg_font(sans-serif,11bp__))
+
+ g = 0.4 # grid size
+ define grid { (($2)*g,-($1)*g) }
+ circlerad = 0.1
+
+for i=1 to 4 do { # 66% becomes 66%% in the sprintf string:
+ sprintf("svg_it(S`'svg_sub(%g,66%):)",i) ljust at grid(i,-0.5)
+ for j=1 to 4 do { if i+j < 8 then {
+ sprintf("svg_it(s`'svg_sub(%g%g,66%))",i,j) at grid(i,j) } } }
+
+"." at grid(4.6,0)
+"." at grid(4.7,0)
+"." at grid(4.8,0)
+for i=1 to 3 do { `"..."' at grid(i,5) }
+"..." at grid(4,4)
+
+P: grid(1,1)
+for k=3 to 5 do {
+ for i=1 to k-1 do { if (k%2==1) then { m=i; n=k-i } else { m=k-i; n=i }
+ Q: grid(m,n)
+ arrow from P to Q chop
+ P: Q }
+ }
+
+move from grid(1,1)+(-0.5,0.1) \# Adjust bounding box
+ to grid(4,4)+(0.5,-0.45)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrossbarSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrossbarSVG.m4
new file mode 100644
index 00000000000..12bb2d72c31
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrossbarSVG.m4
@@ -0,0 +1,54 @@
+.PS
+# Crossbar switch
+gen_init(svg_font(sans-serif,11bp__))
+ circlerad = 0.12
+ boxwid = 0.18
+ boxht = 0.18
+ rathick = 1.5
+ rawd = rathick*4 bp__
+ raht = rawd*2
+ boxdist = boxwid*1.8
+
+`define bcoord {($2,-($1))*boxdist}'
+`define redarrow { arrow ht raht wid rawd thick rathick color "red" }'
+
+`define cbx {'
+ thinlines_
+ n = $+ - 1
+ for i=0 to n do {
+ line color "blue" from bcoord(i,0) to bcoord(i,n)
+ line color "blue" from bcoord(0,i) to bcoord(n,i)
+ C[i]: circle invis at bcoord(i,-1.5)
+ }
+ for i=0 to n do {
+ exec sprintf("col = $%g",i+1)
+ redarrow from C[i].e right 1.25*boxwid
+ redarrow from C[i].w+(-boxwid,0) right raht
+ for j=0 to n do {
+ B: box color "blue" shaded "yellow" at bcoord(i,j)
+ if j==col then {
+ line color "blue" from B.s to B.e
+ line thick rathick color "red" from C[i].e to B.w \
+ then to B.n then to (B.x,C[0].y+(2+j*2/3)*boxht)
+ continue to (C[j].x-(2+j*2/3)*boxht,Here.y)
+ continue to (Here,C[j]) then to C[j].w
+ } \
+ else {
+ line color "blue" from B.n to B.s
+ line color "blue" from B.w to B.e
+ }
+ }
+ }
+ thicklines_
+ for i=0 to n do {
+ circle thick 1.5 outlined "blue" shaded "yellow" at C[i] \
+ sprintf("ifpostscript(,ifsvg(,\large))%g",i)
+ }
+ }
+
+[
+ cbx(3,6,0,5,2,7,1,4)
+ ] at 4,4
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrowSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrowSVG.m4
new file mode 100644
index 00000000000..6be09389477
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrowSVG.m4
@@ -0,0 +1,74 @@
+.PS
+# CrowSVG.m4
+#`Illustrates shadebox and custom crowfoot line termination'
+gen_init(svg_font(sans-serif,11bp__))
+
+# Custom macros --------------------------
+
+# `crowline(linespec,wid,ht)'
+define(`crowline',
+ `line `$1'
+ M4_E: last line.end
+ crow_wd = ifelse(`$2',,`(arrowwid*8/5)',`$2')
+ crow_ht = ifelse(`$3',,`(1.5*crow_wd)',`$3')
+ M4_P: vperp(last line); M4_P: (M4_P.x*crow_wd,M4_P.y*crow_wd)
+ M4_X: crow_ht/lin_leng(last line) between M4_E and last line.start
+ ifdpic(
+ `spline 0.4 from M4_E+M4_P to M4_X+M4_P then to M4_X-M4_P then to M4_E-M4_P',
+ `spline from M4_E+(M4_P.x,M4_P.y) to M4_X+(M4_P.x,M4_P.y) \
+ then to M4_X-(M4_P.x,M4_P.y) then to M4_E-(M4_P.x,M4_P.y)') ')
+
+define(`custombox',
+ ``$1': shadebox(box `$2',3)
+ "`$1'" at last box.n above
+ boxtext(shift(shift($@)))')
+
+define boxtext {
+ for i=1 to $+ do { move to last box.nw+(3pt__,-(2+i*11)pt__);
+ exec sprintf("\"$%g\" ljust",i) }
+ }
+
+# ----------------------------
+
+ boxwid = boxwid*1.15
+ boxsep = boxwid/2
+
+ custombox(Class,ht boxht*2.2,
+ `classkey, class_type, class_desc')
+
+ custombox(Product,ht Class.ht with .nw at Class.ne+(boxsep,0),
+ `classkey, prodkey, prod_name, pkg_type')
+
+ custombox(Sales,ht boxht*3.3 with .nw at Product.ne+(boxsep*2,15pt__),
+ `perkey, classkey, prodkey, storekey, promokey, quantity, dollars')
+
+ custombox(Period,ht Sales.ht with .nw at Sales.ne+(boxsep*2,0),
+ `perkey, date, day, week, month, qtr, year')
+
+ custombox(Market,ht Sales.ht with .nw at Class.sw+(0,-boxsep*2),
+ `perkey, date, day, week, month, qtr, year')
+
+ custombox(Store,ht boxht*3.6 with .sw at (Product.w,Market.s),
+ `storekey, mktkey, store_type, store_name, street, city, state, zip')
+
+ custombox(Promotion,ht Market.ht with .sw at (Period.w,Market.s),
+ `promokey, promo_type, promo_desc, value, start_date, end_date')
+
+ move to Class.ne+(0,-10pt__); crowline(to (Product.w,Here))
+
+ move to Product.ne+(0,-10pt__); crowline(to (Sales.w,Here))
+ move to last line.start+(0,-crow_wd*2.5); crowline(to (Sales.w,Here))
+T: last line.c+(0,-crow_wd*2.5)
+
+ move to Period.nw+(0,-10pt__); crowline(to (Sales.e,Here),,1.75*crow_wd)
+Q: (last line.c,0.4 between Sales.se and Sales.ne)
+
+ move to Market.ne+(0,-10pt__); crowline(to (Store.w,Here))
+ move to Store.ne+(0,-10pt__); line to (T,Here) then to T
+ crowline(to (Sales.w,Here))
+
+ move to Promotion.nw+(0,-10pt__); line to (Q,Here) then to Q
+ crowline(to (Sales.e,Here),,1.75*crow_wd)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrullerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrullerSVG.m4
new file mode 100644
index 00000000000..f4630aff06e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CrullerSVG.m4
@@ -0,0 +1,67 @@
+.PS
+# CrullerSVG.m4
+threeD_init
+NeedDpicTools
+scale = 2.54
+
+define(`lobe',`(sind(6*(`$1'))+4)/5*2.25')
+
+ viewazimuth = 20 # Set view angles in degrees
+ viewelevation = 30
+ setview(viewazimuth,viewelevation,0)
+
+ dt = 3 # major angle degrees per facet
+ ds = 10 # minor angle degrees per facet
+
+ tradius = 6
+define(`cruller',`rot3Dz((`$1')*dtor_,
+ sum3D(0,tradius,0,0,Rect_(lobe(`$2'+2*(`$1')),`$2')))')
+
+define(`tvisible',`dot3D(View3D,
+ cross3D(diff3D(cruller(`$1'+dt/2,`$2'),cruller(`$1',`$2')),
+ diff3D(cruller(`$1',`$2'+ds/2),cruller(`$1',`$2'))))')
+
+ # create the arrays and sort
+ n = 0
+ for t = dt to 360+dt/2 by dt do {
+ for s=ds/2 to 360.1 by ds do {
+ if tvisible(t,s) > -0.01 then {
+ n +=1
+ t[n] = t
+ s[n] = s
+ d[n] = dot3D(cruller(t,s),view3D1,view3D2,view3D3) # view distance
+ ix[n] = n
+ }
+ } }
+# prval(n)
+ dpquicksort(d,1,n,ix)
+
+ # Background
+Bne: (9,6)
+Bsw: (-9,-6)
+B: 0.5 between Bne and Bsw
+iflatex(`line fill_(0.75) \
+ from (Bsw,Bne) to Bsw then to (Bne,Bsw) then to Bne then to (Bsw,Bne)',
+ `ShadedPolygon((Bsw,Bne):Bsw:(Bne,Bsw):Bne,,-30,
+ 0,1,1,1,
+ .5,.1,.4,0,
+ 1,0,0,0) at B')
+ # draw the facets
+thinlines_
+[
+ rgbtohsv(0.6,0.4,0,h,s,v)
+ for i = 1 to n do {
+ tc = t[ix[i]]; sc = s[ix[i]]
+ SE: (project(cruller(tc+dt/2,sc-ds/2)))
+ SW: (project(cruller(tc-dt/2,sc-ds/2)))
+ NW: (project(cruller(tc-dt/2,sc+ds/2)))
+ NE: (project(cruller(tc+dt/2,sc+ds/2)))
+ f = ((dcosine3D(3,cruller(tc,sc))/2.25+1)/2)^2
+ hsvtorgb(h,(1-f)*s,1,r,g,b)
+ line outlined rgbstring(r,g,b) shaded rgbstring(r,g,b) ifpdf( invis ) \
+ from SE to SW then to NW then to NE then to SE }
+ ] at B
+
+thicklines_
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CsourceSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CsourceSVG.m4
new file mode 100644
index 00000000000..e194f01f8cb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/CsourceSVG.m4
@@ -0,0 +1,197 @@
+.PS
+# Csource.m4
+cct_init(svg_font(sans-serif,11bp__,2bp__))
+
+# The default line separation is a bit small if the top line contains
+# subscripts, so we space stacked lines explicitly:
+define(`stbelow',`at last ""-(0,textht*1.3)')
+
+define(`loffset',`+(textoffset,0)')
+define(`roffset',`-(textoffset,0)')
+
+define(`npair',`[define(`m4lr',ifelse(`$1',,l,r))
+ J: mosfet(down_ dimen_,ifelse(`$1',,R,L),uHSDF,E)
+ {["svg_it(Q`'svg_sub(`$2'))" ljust; "2N5464" ljust stbelow]\
+ at J.nw+(ifelse(`$1',,-5bp__,5bp__),textht*0.75)}
+ G: J.G
+ line ifelse(`$1',,right,left) dimen_/4 from J.D
+ Q: bi_tr(up_ dimen_,ifelse(`$1',,L,R),,E) with .B at Here
+ {["svg_it(Q`'svg_sub(`$3'))" m4lr`'just; "2N4239" m4lr`'just stbelow] \
+ at last [].ifelse(`$1',,e,w)}
+ E: Q.E
+ S: dot(at (Q.C,J.S))
+ line from J.S to S then to Q.C ]')
+
+define(`ppair',`[define(`m4lr',ifelse(`$1',,l,r))
+ J: mosfet(down_ dimen_,ifelse(`$1',,R,L),dHSDF,E)
+ {["svg_it(Q`'svg_sub(`$2'))" ljust; "2N3819" ljust stbelow] \
+ at J.sw+(ifelse(`$1',,0,`4bp__'),-textht*0.6)}
+ G: J.G
+ line ifelse(`$1',,right,left) dimen_/4 from J.S
+ Q: bi_tr(down_ dimen_,ifelse(`$1',,R,L),P,E) with .B at Here
+ {["svg_it(Q`'svg_sub(`$3'))" m4lr`'just; "2N4236" m4lr`'just stbelow]}
+ E: Q.E
+ S: dot(at (Q.C,J.D))
+ line from J.D to S then to Q.C ]')
+
+ textht = textht*0.8
+ R2: resistor(down_ dimen_)
+ {["svg_it(R`'svg_sub(2))" ljust; "150`'svg_ohm" ljust stbelow] \
+ at last [].e loffset }
+ dot
+ Q13: bi_tr(down_ dimen_,,P,E) with .E at Here
+ {["svg_it(Q`'svg_sub(13))" rjust; "2N4236" rjust stbelow] at last [].w }
+ line down 3.1*elen_ from Q13.C
+ Q14: bi_tr(up_ dimen_,R,,E) with .C at Here
+ {["svg_it(Q`'svg_sub(14))" rjust; "2N4239" rjust stbelow] at last [].w }
+ dot(at Q14.E)
+ { line left_ dimen_*1.3 then up_ dimen_
+ R1: potentiometer(up_ dimen_) with .Start at Here
+ {["svg_it(R`'svg_sub(1))" ljust; "20k`'svg_ohm" ljust stbelow] \
+ at last [].e loffset }
+ { ground(at R1.T1) }
+ line from R1.End to (R1.End,Q13.E) then to Q13.E }
+ { dot(at Q13.C+(0,-elen_))
+ line to (R1.R,Here)+(-dimen_/2,0)
+ { arrowline(right_ dimen_/2); llabel(,i`'svg_sub(1)) }
+ { move left 0.2}
+ V1: gap(down_ dimen_,1); rlabel(+,V`'svg_sub(1),-)
+ line down_ dimen_/4 chop dotrad_ chop 0; ground(,T) }
+ R3: resistor(down_ dimen_)
+ {["svg_it(R`'svg_sub(3))" ljust; "150svg_ohm" ljust stbelow] \
+ at last [].e loffset}
+ dot(at Q13.C+(0,-2*elen_))
+ line right_ dimen_/2
+ A1: opamp with .In2 at Here; "svg_it(A`'svg_sub(1))" at A1.C
+ { "Nexus" rjust "SQ-10A" rjust at (A1.E,A1.s)+(0,-textht/2) }
+ line left_ dimen_/4 from A1.In1 then up_ dimen_/2 then right dimen_
+ dot
+ { resistor(up_ elen_)
+ {["svg_it(R`'svg_sub(14))" rjust; "19k`'svg_ohm" rjust stbelow] \
+ at last [].w roffset}
+ line to (Here,Q13.E) then to Q13.E }
+ line to (A1.Out,Here)
+ dot
+ { line to A1.Out
+ dot
+ resistor(down_ to (Here,Q14.E))
+ {["svg_it(R`'svg_sub(13))" ljust; "91k`'svg_ohm" ljust stbelow] \
+ at last [].e loffset}
+ line to Q14.E }
+ R6: resistor(right_ dimen_)
+ {["svg_it(R`'svg_sub(6))" ljust; "15k`'svg_ohm" ljust stbelow] \
+ with .n at last [].sw+(0,-textoffset) }
+ dot
+ line to (Here,A1.In1) then right_ dimen_/4
+ A2: opamp with .In1 at Here; {"svg_it(A`'svg_sub(2))" at A2.C }
+ { "Nexus" rjust "SQ-10A" rjust at (A2.E,A2.s)+(0,-textht/2) }
+ line left_ dimen_/4 from A2.In2
+ ground
+
+ dot(at A2.Out)
+ DP1: npair(,3,4) with .E at (A2.Out,Q14.B)+(elen_*1.25,0)
+#if 2 < 1 then {
+ line from A2.Out to (A2.Out,DP1.G) then to DP1.G
+ line from DP1.E to (DP1.E,R3.bottom); dot
+ D4: reversed(`diode',up_ dimen_/2 from DP1.S)
+ D3: reversed(`diode',up_ dimen_/2 from Here+(0,-dimen_/6))
+ { "OMC-V" rjust "svg_it(D`'svg_sub(4))" rjust \
+ "svg_it(D`'svg_sub(3))" rjust at last [].w }
+ DP2: ppair(,1,2) with .E at (DP1.E,Q13.B)
+ D1: diode(down_ dimen_/2 from DP2.S)
+ D2: diode(down_ dimen_/2 from Here+(0,dimen_/6))
+ {"svg_it(D`'svg_sub(1))" rjust "svg_it(D`'svg_sub(2))" rjust "OMC-V" rjust\
+ at last [].w }
+ dot(at (Here,A2))
+ line to D2.bottom
+ line from DP2.G to (A2.Out,DP2.G) then to A2.Out
+ line from DP2.E to (DP2.E,R2.top); dot
+
+ T: dot(at (DP1.E,A2)+(dimen_,0))
+ DP3: npair(,7,8) with .G at (Here,DP1.G)+(dimen_/4,0)
+ dot(at DP3.E)
+ line to Q14.B
+ DP4: ppair(,5,6) with .G at (DP3.G,DP2.G)
+ dot(at DP4.E)
+ line to Q13.B
+ line from DP3.G to (T,DP3.G) then to (T,DP4.G) then to DP4.G
+ R11: resistor(down_ dimen_ from DP4.S)
+ {["svg_it(R`'svg_sub(11))" rjust; "20`'svg_ohm" rjust stbelow] \
+ at last [].w roffset}
+ D5: diode(up_ from DP3.S to (DP3.S,A2),Z)
+ {["svg_it(D`'svg_sub(5))" rjust; "1N4729" rjust stbelow] \
+ at last [].w roffset}
+ line to R11.end
+ C4: capacitor(right_ dimen_*1.3 from DP3.S,C)
+ llabel(,svg_it(C`'svg_sub(4))); rlabel(,"0.68`'svg_micro(F)")
+ C3: capacitor(right_ dimen_*1.3 from DP4.S,C)
+ llabel(,svg_it(C`'svg_sub(3))); rlabel(,"0.68`'svg_micro(F)")
+ dot
+ dot(at (Here,R6))
+ C2: reversed(`capacitor',left_ dimen_*1.3,C)
+ rlabel(,svg_it(C`'svg_sub(2))); llabel(,"0.1`'svg_micro(F)")
+ line to R6.end
+
+ R5: resistor(up_ from R6.end to (R6.end,Q13.B))
+ {["svg_it(R`'svg_sub(5))" ljust; "100k`'svg_ohm" ljust stbelow] \
+ at last [].e loffset }
+ dot(at R5.top-(0,dimen_/2))
+ line left_ dimen_/2
+ capacitor(down_ dimen_,C)
+ {["svg_it(C`'svg_sub(1))" rjust; "1`'svg_micro(F)" rjust stbelow] \
+ at last [].w roffset}
+ ground(,T)
+
+ line from DP4.E to (DP4.E,R2.bottom)
+ resistor(up_ to (Here,R2.top))
+ {["svg_it(R`'svg_sub(9))" ljust; "910`'svg_ohm" ljust stbelow] \
+ at last [].e loffset}
+ dot
+ resistor(down_ from DP3.E to (DP3.E,R3.bottom))
+ {["svg_it(R`'svg_sub(10))" ljust; "910`'svg_ohm" ljust stbelow] \
+ at last [].e loffset}
+ dot
+
+ line from R5.top to (R5,Q13.E)
+ resistor(right_ elen_)
+ {["svg_it(R`'svg_sub(4))" ljust; "100k`'svg_ohm" ljust stbelow] \
+ with .s at last [].nw+(0,1bp__)}
+ line to (C4.end,Here) then to C4.end
+
+ DP5: npair(L,11,10) with .E at (C4.end,DP1.E)+(elen_*0.8,0)
+ line from DP5.E to (DP5.E,R3.bottom); dot
+ line from R3.bottom to Here+(dimen_/2,0)
+ dot(,,1)
+ "svg_it(-E`'svg_sub(CC))" ljust at last [].e
+ D6: diode(up_ from DP5.S to (DP5.S,A2),Z)
+ {["svg_it(D`'svg_sub(6))" rjust; "1N4728" rjust stbelow] \
+ at last [].w roffset}
+ DP6: ppair(L,12,9) with .E at (DP5.E,DP2.E)
+ line from DP6.E to (DP6.E,R2.top); dot
+ line from R2.top to Here+(dimen_/2,0)
+ dot(,,1)
+ { "svg_it(E`'svg_sub(CC))" ljust at last [].e }
+ resistor(down_ from DP6.S to (DP6.S,C2))
+ {["svg_it(R`'svg_sub(12))" rjust; "20`'svg_ohm" rjust stbelow] \
+ at last [].w roffset}
+ dot
+ { line to C2.e }
+ line to D6.end
+
+ Vr: dot(at (DP6.G,V1.top)+(dimen_/4,0))
+ line from DP6.G to (Vr,DP6.G) then to (Vr,DP5.G) then to DP5.G
+ reversed(`arrowline',right_ dimen_/2 from Vr); llabel(,i`'svg_sub(2))
+ V2: gap(down_ dimen_,1); llabel(+,V`'svg_sub(2),-)
+ { move right 0.2}
+ line down_ dimen_/4 chop dotrad_ chop 0; ground(,T)
+
+ dot(at (Vr,T))
+ resistor(left_ to (DP6.E,Here))
+ {["svg_it(R`'svg_sub(15))" ljust; "200`'svg_ohm" ljust stbelow] \
+ with .s at last [].nw+(0,textoffset)}
+ line to (DP1.E,Here)
+ dot
+#}
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DecoderSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DecoderSVG.m4
new file mode 100644
index 00000000000..2f9659ee42f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DecoderSVG.m4
@@ -0,0 +1,25 @@
+.PS
+# Decoder.m4
+log_init(svg_font(sans-serif,11bp__))
+
+ define(`nlines',3) # OK for nlines from 1 to approximately 4
+
+ define(`ndata',`eval(2**nlines-1)')
+ for_(0,nlines-1,1,
+ `{right_; A`'m4x: dot(at rsvec_(0,m4x*AND_ht))
+ "svg_it(A`'svg_sub(m4x))" wid 0.2 at last [].w rjust}')
+
+ for_(0,ndata,1,
+ `define(`m4y',m4x) down_
+ G`'m4y: AND_gate(nlines) \
+ at A0+svec_(AND_ht*3/2,(m4y+1/2)*AND_ht*3/2)
+ line down linewid/3; dot; "svg_it(D`'svg_sub(m4y))" at last [].s below
+ for_(0,nlines-1,1,
+ `ifelse(eval(m4y/2**m4x%2),0,
+ `up_; NOT_circle with .s at',`move to') G`'m4y.In`'eval(nlines-m4x)
+ line to (Here,A`'m4x) ifelse(m4y,ndata,`then to A`'m4x',`; dot')
+ ')
+ ')
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DemultiplexerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DemultiplexerSVG.m4
new file mode 100644
index 00000000000..37ff8e14311
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DemultiplexerSVG.m4
@@ -0,0 +1,37 @@
+.PS
+# `DemultiplexerSVG.m4'
+log_init(svg_font(sans-serif,11*0.8bp__))
+
+ right_
+
+ Demux(4,DM1)
+ "`Demux'(4,DM1)" at last [].s below
+ "svg_it(Out0)" at last [].Out0.end +(6bp__,6bp__)
+ "svg_it(Out3)" at last [].Out3.end +(6bp__,-6bp__)
+ "svg_it(In)" at last [].In.end rjust wid 11bp__
+ "svg_it(Sel)" at last [].Sel.end ljust above
+ left_; Demux(4,,LOE) with .c at last [].c+(1.2,0)
+ "`left_; Demux'(4,,LOE)" at last [].s + (0,-20bp__)
+ "svg_it(Sel)" at last [].Sel.end rjust
+ "svg_it(Out0)" at last [].Out0.end +(-6bp__,6bp__)
+ "svg_it(OE)" at last [].OE.end ljust
+ "svg_it(In)" at last [].In.end+(0,5bp__) ljust
+ right_; Demux(4,,NOEBN2) with .c at last [].c+(1.2,0)
+ "(4,,NOEBN2)" at last [].s below
+ "svg_it(Sel0)" at last [].Sel0.end rjust
+ "svg_it(Sel1)" at last [].Sel1.end ljust
+ "svg_it(Out0)" at last [].Out0.end +(5bp__,6bp__)
+ "svg_it(Out3)" at last [].Out3.end +(5bp__,6bp__)
+ "svg_it(NOE)" at last [].NOE.end rjust
+ "svg_it(In)" at last [].In.end above
+ down_; Demux(8,,L3,,28*L_unit) with .c at last [].c+(1.8,0)
+ "`down_; Demux'(8,,L3,,28*L_unit)" at last [].s+(0,-15bp__) wid 170bp__
+ "svg_it(Sel0)" at last [].Sel0.end rjust
+ "svg_it(Sel2)" at last [].Sel2.end rjust below
+ "svg_it(Out0)" at last [].Out0.end rjust
+ "svg_it(Out7)" at last [].Out7.end ljust
+ "svg_it(In)" at last [].In.end rjust
+
+ command "</g>" # end font
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4
new file mode 100644
index 00000000000..eb1c6f5672f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DiodesSVG.m4
@@ -0,0 +1,50 @@
+.PS
+# `Diodes.m4'
+cct_init(svg_font(sans-serif,11bp__))
+movewid = 2pt__
+{ {diode ; move ; "`diode'" ljust}
+ move down 0.2; right_
+ {diode(,S) ; move ; "`diode(,S)'" ljust}
+ move down 0.2; right_
+ {diode(,V) ; move ; "`diode(,V)'" ljust}
+ move down 0.2; right_
+ {diode(,v) ; move ; "`diode(,v)'" ljust}
+ move down 0.2; right_
+ {diode(,w) ; move ; "`diode(,w)'" ljust}
+ move down 0.2; right_
+ {diode(,B) ; move ; "`diode(,B)'" ljust}
+ move down 0.2; right_
+ {diode(,G) ; move ; "`diode(,G)'" ljust}
+ }
+
+ move right_ 2.0
+{
+ {diode(,K) ; move ; "`diode(,K)'" ljust}
+ move down 0.2; right_
+ {diode(,ZK) ; move ; "`diode(,ZK)'" ljust}
+ move down 0.2; right_
+ {diode(,CR) ; move ; "`diode(,CR)'" ljust}
+ move down 0.2; right_
+ {diode(,L) ; move ; "`diode(,L)'" ljust}
+ move down 0.2; right_
+ {diode(,F) ; move ; "`diode(,F)'" ljust}
+ move down 0.2; right_
+ {diode(,Sh) ; move ; "`diode(,Sh)'" ljust}
+ move down 0.2; right_
+ {diode(,D) ; move ; "`diode(,D)'" ljust}
+ }
+
+ move right_ 2.0
+{ {diode(,Z,RE) ; move ; "`diode(,Z,RE)'" ljust; move right 1.5}
+ move down 0.25; right_
+ {diode(,T) ; move ; "`diode(,T)'" ljust}
+ move down 0.30; right_
+ {diode(,P) ; move ; "`diode(,P)'" ljust}
+ move down 0.30; right_
+ {diode(,LE) ; move ; "`diode(,LE)'" ljust}
+ move down 0.15; right_
+ {diode(,LER) ; move ; "`diode(,LER)'" ljust}
+ }
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DriveSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DriveSVG.m4
new file mode 100644
index 00000000000..48a7165ff9f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/DriveSVG.m4
@@ -0,0 +1,74 @@
+.PS
+# `Drive.m4'
+cct_init
+
+define(`synchmachine',`[ r = ifelse(`$1',,`dimen_*3/4',(`$1')/2)
+ C: circle rad r
+ Point_(120)
+ line from C to C+vec_(r*2/9,0); reversed(`inductor',to rvec_(r*2/3,0))
+ W2: Here
+ Point_(240)
+ line from C to C+vec_(r*2/9,0); reversed(`inductor',to rvec_(r*2/3,0))
+ W3: Here
+ line from C right_ r*2/9; inductor(right_ r*2/3)
+ W1: Here ]')
+
+ bht = sourcerad_*10
+ dlen = dimen_*2/3
+define(`Diodepair',`[ diode(up_ dlen); line up bht-2*dlen; diode(up_ dlen) ]')
+
+define(`gbt',`bi_trans(`$1',`$2',CBUHdE`$3')')
+define(`dotrad_',dotrad_*0.5/linewid)
+define(`GBTpair',`[linewid = 0.5*3/4
+ Q1: gbt(up_ bht/2,,D)
+ Q2: gbt(up_ bht/2,,D) with .C at Q1.E
+ ]')
+
+SW: ground
+ line up
+W: Here
+ line right dimen_/3; dot
+ ssep = sourcerad_*2.5
+ { line up ssep; S1: source(right_ dimen_,AC) }
+ { S2: source(right_ dimen_,AC) }
+ { line down ssep; S3: source(right_ dimen_,AC) }
+
+ dsep = dimen_/2
+D1: Diodepair at S2.e
+D2: Diodepair at D1+(dsep,0); dot(at D2.n); dot(at D2.s)
+D3: Diodepair at D2+(dsep,0); dot(at D3.n); dot(at D3.s)
+ dot(at (D1,S1))
+ dot(at (D2,S2)); line to S2.e
+ dot(at (D3,S3)); line to S3.e
+
+ line from D1.n to D3.n
+ inductor(right_ dimen_)
+T: dot
+ capacitor(to (Here,D1.s),C)
+ dot
+
+ gsep = dimen_*1.25
+G1: GBTpair with .Q1.C at T+(dimen_,0)
+G2: GBTpair at G1+(gsep,0)
+G3: GBTpair at G2+(gsep,0)
+
+ line from G3.Q1.C to T
+ dot(at (G1.Q1.C,T))
+ dot(at (G2.Q1.C,T))
+ line from G3.Q2.E to D1.s
+ dot(at (G1.Q1.E,D1.s))
+ dot(at (G2.Q1.E,D1.s))
+
+M: synchmachine with .C at G3.e+(dimen_*2,0)
+ sg = dimen_/8
+L: (0.5<G3.e,M.w>,D1.s)-(sg,0)
+ line from M.W1 to (M.W1,L) then to L \
+ then up M.C.y-L.y-sg then to G3.Q2.C+(0,-sg); dot
+ line from M.W3 down M.W3.y-L.y-sg*2 then to L+(sg*2,sg*2)\
+ then up M.C.y-L.y-sg*2 then to G2.Q2.C; dot
+ line from M.W2 to (L,M.W2) \
+ then down M.W2.y-G1.Q2.C.y-sg then to G1.Q2.C+(0,sg); dot
+
+ line right dimen_/3 from M.e then down M.e.y-SW.y
+ ground
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EmarrowsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EmarrowsSVG.m4
new file mode 100644
index 00000000000..33372ae290f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/EmarrowsSVG.m4
@@ -0,0 +1,31 @@
+.PS
+# `Emarrows.m4'
+cct_init(svg_font(sans-serif,11bp__))
+ hskip = 0.6
+[
+ { em_arrows(N)
+ box dotted wid last [].wid ht last [].ht at last [].c
+ thinlines_
+ arrow <- up 0.12 from last [].Head;`"Head"' above
+ arrow <- down 0.12 from last [].Tail;`"Tail"' below
+ `"A1"' rjust below at last [].A1.c
+ `"A2"' ljust above at last [].A2.c
+ thicklines_
+ move down 0.25 from last [].s
+ move up 0.2 from last [].n
+ `"em_arrows(N)"' wid 1.0 at last [].s+(0,-0.20) below }
+ { em_arrows(ND,45) with .sw at last [].se+(hskip*1.5,0)
+ `"em_arrows(ND,45)"' at last [].s below }
+ { em_arrows(I) with .sw at last [].se+(hskip,0)
+ `"...(I)"' at last [].s+(0,-9bp__) below }
+ { em_arrows(ID) with .sw at last [].se+(hskip,0)
+ `"...(ID)"' at last [].s+(0,-2bp__) below }
+ { em_arrows(E) with .sw at last [].se+(hskip,0)
+ `"...(E)"' at last [].s+(0,-2bp__) below }
+ { em_arrows(ED) with .sw at last [].se+(hskip,0)
+ `"...(ED)"' wid .75 at last [].s+(0,-2bp__) below }
+ ]
+# box wid last [].wid ht last [].ht at last []
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4
new file mode 100644
index 00000000000..d0ba1384930
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FlowSVG.m4
@@ -0,0 +1,254 @@
+divert(-1)
+ FlowchartDefs.m4
+ `Some experimental flow-chart macros.
+ In the following, every subchart is in
+ [] brackets, with .N, .S, .E and .W
+ internally defined. Follow this convention
+ if you create compound constructs.
+
+ Generally, the first argument is one
+ or more strings; the second adjusts
+ the size, and the third can be used
+ to add color, dashed lines, labels,
+ or other embellishements. Default is
+ grey fill if arg3 is blank.
+
+ These macros have been renamed from earlier
+ versions because of slight differences of
+ arguments.'
+
+define(`FlowchartDefs_')
+
+ `Default sizes:'
+define(`fboxwid',linewid*2)
+define(`fboxht',linewid*0.75)
+define(`farrowht',linewid*0.5)
+
+ `Fbox( "text", wid expr ht expr,
+ attributes ) The basic task box: arg1 may
+ be 1 or more label strings. Attributes
+ include box line and fill specs.
+ To adjust the box size to the size of
+ the typeset text, see the \boxdims macro
+ in the manual. Example:
+ Fbox("svg_it(x svg_symbol(&`#'60;) 1)",,
+ shaded rgbstring(0.46,0.53,0.63))'
+define(`Fbox',`[ boxwid = fboxwid; boxht = fboxht
+ Box: box `$2' ifelse(`$3',,`fill_(fillval)',`$3') `$1'
+ N: Box.n; S:Box.s; E:Box.e; W: Box.w
+ `$4']')
+
+ `If-then
+ Ftest( "text", wid expr ht expr, attributes )'
+define(`Ftest',`[boxwid = fboxwid*0.8; boxht = fboxht*1.4
+ Box: box ifelse(`$2',,,`$2') invis
+ N: Box.n; S: Box.s; E: Box.e; W: Box.w
+ line from 0.5 between last box.n and last box.e \
+ to last box.e then to last box.s then to last box.w then to last box.n \
+ then to 0.5 between last box.n and last box.e \
+ ifelse(`$3',,`fill_(fillval)',`$3')
+ ifelse(`$1',,,`$1' at Box)
+ `$4']')
+
+ `case statement
+ Fcase(wid expr ht expr,
+ "Test string 1",task, ...,
+ "Test string n",task)'
+ `arg1 adjusts the size of the tests
+ A task is a flow subchart with internal names .E and .S defined
+ The test blocks are labeled Test1, Test2, ... and the tasks are
+ labeled Task1, Task2, ... '
+define(`Fcase',`[ down; S: Here; sx = S.x
+ Fcaseloop_(1,$@)
+ ifelse(`$2',,`E:S; W:S; N:S',
+ `E:(sx+linewid/2,Task1.E.y); W:Test1.W; N:Test1.N')
+ Fcasearrow_(1,$@)
+ arrow from E to (E,S) then to S ]')
+
+ define(`Fcaseloop_',`ifelse(`$3',,,
+ `Test`$1': Ftest(`$3',`$2') with .N at S
+ Task`$1': `$4' with .nw at Test`$1'.E+(linewid/2,min(Test`$1'.ht,fboxht)/2)
+ arrow right linewid/4 from Test`$1'.E \
+ then down Test`$1'.E.y-Task`$1'.W.y then to Task`$1'.W
+ S: (Test`$1'.S.x,min(Test`$1'.S.y,Task`$1'.S.y)-linewid/3)
+ ifelse(`$5',,`line',`arrow') from Test`$1'.S to S
+ sx = max(sx,Task`$1'.E.x)
+ Fcaseloop_(incr($1),`$2',shift(shift(shift(shift($@)))))')')
+ define(`Fcasearrow_',`ifelse(`$3',,,
+ `arrow from Task`$1'.E to (E,Task`$1'.E)
+ Fcasearrow_(incr($1),`$2',shift(shift(shift(shift($@)))))')')
+
+ `while statement with explicit test
+ Fwhiledo("test text", wid x ht y, attributes, task spec )
+ The task structure is given label Task '
+define(`Fwhiledo',`[ down
+ Test: Ftest(`$1',`$2',`$3')
+ arrow right linewid/2 from Test.E
+ Task: `$4' with .W at Here
+ E: Task.E; W: Test.w; S: Test.S
+ arrow up max(linewid/4,Test.n.y-Task.n.y+arrowht*1.5) \
+ from Task.N then left Task.x-Test.x
+ N: Here
+ arrow to Test.n
+ `$5']')
+
+ `repeat statement with explicit test
+ Frepeatuntil("test",wid x ht y,attributes, task spec )
+ The task structure is given label Task '
+define(`Frepeatuntil',`[ N: Here
+ Task: ifelse(`$4',,Here,`$4' with .N at N)
+ W: Task.W
+ arrow down linewid/3
+ Test: Ftest(`$1',`$2',`$3')
+ E: Task.E+(linewid/2+max(0,Test.e.x-Task.e.x),0)
+ arrow from Test.e to (E,Test) then to E then to Task.E
+ S: Test.S
+ `$5']')
+
+ `if-then-else
+ Fifthenelse( "test", wid x ht y, attributes,
+ left tasks, right tasks)
+ The left task structure is given label Ltask and the right
+ task structure is given label Rtask '
+define(`Fifthenelse',`[ Test: Ftest(`$1',`$2',`$3')
+ N: Test.N
+ Ltask: ifelse(`$4',,`Test.S; W:Test.W; LS:Ltask',
+ `$4 with .ne at ((Test.W.x+Test.x)/2,Test.S.y)
+ W: Ltask.W; LS:Ltask.S
+ arrow from Test.W to (Ltask.N,Test.W) then to Ltask.N')
+ Rtask: ifelse(`$5',,`Test.S; E:Test.E; RS:Rtask',
+ `$5 with .nw at ((Test.E.x+Test.x)/2,Test.S.y)
+ E: Rtask.E; RS: Rtask.S
+ arrow from Test.E to (Rtask.N,Test.E) then to Rtask.N')
+ S: (Test.x,min(LS.y,RS.y)-linewid/3)
+ arrow from LS to (LS,S)
+ arrow from RS to (RS,S)
+ line to (LS,Here)
+ `$6']')
+
+divert(0)dnl
+.PS
+# Here is a test file exercising the above definitions
+gen_init(svg_font(sans-serif,11bp__,2.5bp__))
+
+# Could use xcolor with option dvipsnames but define color here for portability
+define(`Thistle',`rgbstring(0.85,0.75,0.85)')dnl
+define(`RubineRed',`rgbstring(0.81,0,0.35)')dnl
+define(`YellowGreen',`rgbstring(0.68,1,0.18)')dnl
+define(`SeaGreen',`rgbstring(0.13,0.70,0.67)')dnl
+define(`Goldenrod',`rgbstring(0.85,0.65,0.13)')dnl
+
+# Accented characters
+define(`svg_ccedilla',`svg_symbol(&`#'231;)')dnl
+define(`svg_atilde',`svg_symbol(&`#'227;)')dnl
+
+ linethick_(1.0)
+ arrowwid = 0.05
+ arrowht = 0.1
+ fillval = 0.8
+ down
+
+Case: Fcase(,
+ "Test 1",[Fbox("Task 1",, shaded Thistle); W:last [].W; N:last [].N
+ arrow down linewid/3 from last [].S
+ Fbox("Task 1.5",, shaded Thistle) with .N at Here
+ E:last [].E; S:last [].S],
+ "Test 2",Fbox("Task 2" "is bigger", wid fboxwid*1.2 ht fboxht*3/2, \
+ shaded SeaGreen),
+ "Test 3",Fbox("Task 3",, shaded RubineRed)dnl
+ )
+
+ "svg_it(.N)" at Case.N rjust above
+ "svg_it(.S)" at Case.S rjust below
+ "svg_it(.E)" at Case.E ljust
+ "svg_it(.W)" at Case.W rjust
+ "svg_it(Case statement)" below at Case.s+(0,-0.2)
+ move to Case.nw+(-12bp__,10bp__)
+
+Whiledo: Fwhiledo("svg_it(i svg_lt n)",,,Fbox("Task"),
+ "T" above ljust at Test.E) \
+ with .nw at Case.ne+(0.25,0)
+
+ "svg_it(.N)" at Whiledo.N rjust
+ "svg_it(.S)" at Whiledo.S rjust below
+ "svg_it(.E)" at Whiledo.E ljust
+ "svg_it(.W)" at Whiledo.W rjust
+ "svg_it(While-do)" below at Whiledo.s+(0,-0.2)
+
+Repeatuntil: Frepeatuntil("svg_it(n svg_geq 5)",,,Fbox("Task"),
+ "T" at Test.E above ljust) with .nw at Whiledo.sw + (0.25,-1)
+
+ "svg_it(.N)" at Repeatuntil.N rjust above
+ "svg_it(.S)" at Repeatuntil.S rjust below
+ "svg_it(.E)" at Repeatuntil.E ljust
+ "svg_it(.W)" at Repeatuntil.W rjust
+ "svg_it(Repeat-until)" below at Repeatuntil.s+(0,-0.2)
+
+Ifthenelse: Fifthenelse("svg_it(A`'svg_lt`'B)",,,
+ Fbox("False"),
+ Fbox("True",ht fboxht*1.2 wid fboxwid)dnl
+ ) with .nw at Repeatuntil.sw +(0.5,-0.5)
+
+ "svg_it(.N)" at Ifthenelse.N rjust above;
+ "svg_it(.S)" at Ifthenelse.S below rjust
+ "svg_it(.E)" at Ifthenelse.E ljust
+ "svg_it(.W)" at Ifthenelse.W rjust
+ "svg_it(If-then-else)" at Ifthenelse.s+(0,-0.3) \
+ "svg_it((the True and False tasks are optional))"
+
+# Compound statement:
+[ right
+ ellipse shaded YellowGreen "Start"
+ arrow right linewid/2
+
+ Fbox("First task") with .W at Here
+ arrow down linewid/2 from last [].S
+
+ Fifthenelse("Test 1",,,
+ Frepeatuntil("svg_it(i svg_geq 5)",,shaded Goldenrod,Fbox("Task")),
+ Fifthenelse("svg_it(A svg_lt B)",,shaded Goldenrod,
+ Fbox("Left"),
+ Fbox("Right"),
+ "T" at Test.E above ljust),
+ "T" at Test.E above ljust) with .N at Here
+
+ A: arrow down 0.25 from last [].S ] with .nw at Case.sw + (-12bp__,-0.7)
+
+ "svg_it(Compound statement)" below at last [].A.end
+
+Example: [ fillvalue = 0.8; awid = linewid/2; right_
+ Start: ellipse wid boxwid/2 ht boxwid/3 shaded "green"
+ arrow right_ awid
+ B1: Fbox("Planejamento")
+ B2: Fbox("Execu`'svg_ccedilla`'svg_atilde`'o") \
+ with .W at B1.E+(awid*3,0)
+ B3: Fbox("Sele`'svg_ccedilla`'svg_atilde`'o") \
+ with .W at B2.E+(awid*3,0)
+ LT: Ftest("Avalia`'svg_ccedilla`'svg_atilde`'o do" "Planejamento",
+ wid fboxwid*1.5 ht fboxht*2.0,
+ shaded YellowGreen,
+ "Correto" at Box.e above ljust;
+ "Incompleto" at Box.w above rjust) with .S at 0.5 between B1.ne and B2.nw
+ arrow from B1.E to (LT.S,B1.E) then to LT.S
+ arrow from LT.W to (B1.N,LT.W) then to B1.N
+ arrow from LT.E to (B2.N,LT.E) then to B2.N
+ RT: Ftest("Avalia`'svg_ccedilla`'svg_atilde`'o da" \
+ "Execu`'svg_ccedilla`'svg_atilde`'o",
+ wid fboxwid*1.5 ht fboxht*2.0,
+ shaded YellowGreen,
+ "Correto" at Box.e below ljust;
+ "Incompleto" at Box.w below rjust) with .N at 0.5 between B2.se and B3.sw
+ arrow from B2.E to (RT.N,B2.E) then to RT.N
+ arrow from RT.W to (B2.S,RT.W) then to B2.S
+ arrow from RT.E to (B3.S,RT.E) then to B3.S
+ B4: Fbox("Extra`'svg_ccedilla`'svg_atilde`'o") \
+ with .S at B3.N+(0,awid)
+ arrow from B3.N to B4.S
+ arrow right_ awid from B4.E
+ B5: Fbox("Conclus`'svg_atilde`'o")
+ ellipse wid boxwid/2 ht boxwid/3 shaded "red" at (B5.S,Start)
+ arrow down_ awid from B5.S to last ellipse.n
+] with .nw at last [].sw+(0,-fboxht)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FontsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FontsSVG.m4
new file mode 100644
index 00000000000..856014836b9
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FontsSVG.m4
@@ -0,0 +1,28 @@
+.PS
+# FontsSVG.m4
+gen_init
+ textht = 0.2
+
+define(`ft',`{ svg_font(`$1',`$2',`$3',"`$1'")}; move down 0.5; right_')
+
+B: box wid 4 ht 7
+ move to B.nw+(2,-0.5)
+
+ ft(Arial)
+ ft(Helvetica)
+ ft(Times)
+ ft(Courier)
+ ft(Cursive)
+ ft(Verdana)
+ ft(Georgia)
+ ft(Palatino)
+ ft(Garamond)
+ ft(Bookman)
+# ft(Comic Sans MS)
+ ft(Trebuchet MS)
+ ft(Arial Black)
+ ft(Impact)
+
+ textht = 0.1
+ "These may be vewer-dependent" above ljust at B.sw
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FusesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FusesSVG.m4
new file mode 100644
index 00000000000..a4617e62212
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/FusesSVG.m4
@@ -0,0 +1,33 @@
+.PS
+# `FusesSVG.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+movewid = 0.25
+
+ {fuse ; {"`fuse'" at last line.c+(0,-0.2)}
+ move
+ fuse(,D) ; {"`fuse(,D)'" at last line.c+(0,-0.2)}
+ move
+ fuse(,B) ; {"`fuse(,B)'" at last line.c+(0,-0.2)}
+ move
+ fuse(,C) ; {"`fuse(,C)'" at last line.c+(0,-0.2)}
+ move
+ fuse(,S) ; {"`fuse(,S)'" at last line.c+(0,-0.2)}
+ move
+ fuse(,HB) ; {"`fuse(,HB)'" at last line.c+(0,-0.2)}
+ }
+ move down; right_
+ fuse(,HC,0.5,0.3) ; {"`(,HC,0.5,0.3)'" ljust at last line.start+(0,-0.25)}
+ move
+ cbreaker; {"`cbreaker'" at last line.c+(0,-0.25)}
+ move
+ cbreaker(,R); {"`cbreaker(,R)'" at last line.c+(0,-0.25)}
+ move
+ cbreaker(,,D); {"`...(,,D)'" at last line.c+(0,-0.25)}
+ move
+ cbreaker(,,T); {"`...(,,T)'" at last line.c+(0,-0.25)}
+ move
+ cbreaker(,,TS); {"`...(,,TS)'" at last line.c+(0,-0.25)}
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GroundsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GroundsSVG.m4
new file mode 100644
index 00000000000..7c4d741d0ee
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/GroundsSVG.m4
@@ -0,0 +1,40 @@
+.PS
+# `GroundsSVG.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+sep = 0.65
+Ground: ground
+ move right sep
+GT: ground(,T)
+ move right sep
+GF: ground(,,F)
+ move right sep
+GE: ground(,,E)
+ move right sep
+
+B: Here+(0,-0.5) ; {
+ "`ground'" wid 36bp__ at (Ground,B)
+ "`ground'(,T)" at (GT,B)+(0,12bp__)
+ "(,,F)" at (GF,B)
+ "(,,E)" at (GE,B)}
+
+
+GS: ground(,,S)
+ move right sep
+GS90: [ground(,,S,90) ] with .n at Here
+ move right sep from GS90.n
+GQ: ground(,,Q)
+ move right sep
+GL: ground(,,L)
+ move right sep
+GP: ground(,,P)
+
+C: Here+(0,-0.5)
+ "(,,S)" at (GS,C)
+ "(,,S,90)" at (GS90,C)
+ "(,,Q)" at (GQ,C)
+ "(,,L)" at (GL,C)
+ "(,,P)" at (GP,C)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeadersSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeadersSVG.m4
new file mode 100644
index 00000000000..c222f186500
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeadersSVG.m4
@@ -0,0 +1,38 @@
+.PS
+# HeadersSVG.m4
+log_init(svg_font(sans-serif,10bp__))
+
+ Header
+ {"svg_it(P1)" wid 15bp__ at last [].P1 rjust
+ `"Header"' wid 45bp__ at last [].s+(0,-10pt__)
+ "svg_it(P2)" at last [].P2 rjust}
+
+ Header(2,3,8mm__,10mm__) with .nw at last [].ne+(0.75,-0.05)
+ {"svg_it(P1)" at last [].P1 rjust
+ "`Header(2,3,8mm__,10mm__)'" at last [].s+(0,-10pt__)
+ "svg_it(P2)" at last [].P2 ljust
+ "svg_it(P5)" at last [].P5 rjust
+ "svg_it(P6)" at last [].P6 ljust}
+
+ left_
+ Header(2,4,,,fill_(0.9)) with .sw at last [].se+(0.75,0)
+ {"svg_it(P1)" at last [].P1 rjust_
+ "`left_; Header(2,4,,,fill_(0.9))'" at last [].s+(0,-23pt__)
+ "svg_it(P8)" at last [].P8 ljust_}
+
+ down_
+ Header(2,8) with .nw at last [].ne+(0.75,0)
+ {"svg_it(P1)" at last [].P1 ljust
+ "svg_it(P2)" at last [].P2 ljust
+ "`down_; Header'(2,8)" at last [].s+(0,-10pt__)
+ "svg_it(P15)" at last [].P15 rjust
+ "svg_it(P16)" at last [].P16 rjust}
+ {thinlines_
+ arrow <- right 0.15 from last [].PinP1.e ; {move right 0.45}
+ "svg_it(PinP1)" ljust
+ arrow <- right 0.15 from last [].PinP2.e
+ "svg_it(PinP2)" ljust
+ thicklines_ }
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeathkitSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeathkitSVG.m4
new file mode 100644
index 00000000000..fc7ffd21588
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/HeathkitSVG.m4
@@ -0,0 +1,343 @@
+.PS
+cct_init(svg_font(Helvetica,7pt__))
+# HeathkitSVG.m4
+# Landscape
+maxpswid = 11
+maxpsht = 8.5
+
+# llabel and rlabel without math mode
+define(`Llabel',`llabel(
+ ifelse(`$1',,,`m4lstring(`$1',"`$1'")'),
+ ifelse(`$2',,,`m4lstring(`$2',"`$2'")'),
+ ifelse(`$3',,,`m4lstring(`$3',"`$3'")'))')
+define(`Rlabel',`rlabel(
+ ifelse(`$1',,,`m4lstring(`$1',"`$1'")'),
+ ifelse(`$2',,,`m4lstring(`$2',"`$2'")'),
+ ifelse(`$3',,,`m4lstring(`$3',"`$3'")'))')
+
+# Grid parameters
+ picwid = 8.5
+ picht = 6
+ g = 1/12
+
+# Element scaling
+ linewid = 8*g
+define(`dimen_',dimen_*4/5)
+# Default sizes
+ boxwid = 2*g
+ boxht = 2*g
+ arrowht = arrowht*2/3
+
+# Grid
+ linethick_(0.4)
+ for i=0 to picwid/g do { line color "lightgray" up picht from (i*g,0) }
+ for i=0 to picwid/g by 10 do { sprintf("%g",i) at (i*g,0) below }
+ for i=0 to picht/g do { line color "lightgray" right picwid from (0,i*g) }
+ for i=0 to picht/g by 10 do { sprintf("%g",i) at (0, i*g) rjust }
+ move left 2*g from (0,0)
+ linethick_(0.8)
+
+ spline outlined "white" shaded "white" \
+ from (0,picht+g) down g then down picht/5 then right picwid/5
+ for i=1 to 4 do { continue down picht/5 then right picwid/5 }
+ continue right 2*g then up 2*g
+ continue up picht-2*g then up g then left g
+
+# Place the bottom inductor on the grid
+ I1: inductor(down_ 13*g from (80,22)*g,,13,,g)
+ I2: inductor(down_ 10*g from I1.start+(0,21*g),,10,,g)
+ I3: inductor(down_ 10*g from I2.start+(0,12)*g,,10,M,g)
+ line from M4Core1.end to (M4Core1,I1.end)
+ line from M4Core2.end to (M4Core2,I1.end)
+ Scrn: 2 between M4Core1.start and M4Core2.start
+ line dashed from Scrn to (Scrn,I1.end)
+ ground
+ I4: inductor(up_ 5*g from (Scrn.x+M4Core1.x-I2.x,I2.start.y-2*g),,5,,g)
+ I5: inductor(up_ 5*g from (I4,I2.end+(0,g)),,5,,g)
+
+# Circuit board
+ Board: box dashed thick 2 wid 58*g ht 55*g with .se at I1.end+(-7,-2)*g
+ P: box invis wid 12*g ht 4*g with .s at Board.sw+(26*g,0) \
+ "POWER SUPPLY" "CIRCUIT BOARD"
+ line dashed thick 2 from P.sw to P.nw; line dashed thick 2 to P.ne
+ line dashed thick 2 to P.se
+
+define Pad { P`$1': box fill_(1) "$1" }
+# Board connections on the right
+ Pad(1) at (Board.e,I1.end)
+ line from P1.e to I1.end "RED" above
+ Pad(2) at (Board.e,I1.start)
+ line from P2.e to I1.start "RED" above
+ Pad(3) at (Board.e,I2.end)
+ GRN1: line left 4*g from I2.start "GRN" above ; ground
+ GRN2: line from P3.e to I2.end "GRN" above
+ spline <-> from GRN2.end+(-g,0) up 2.5*g right 0.5*g then up 5*g left g \
+ then up 2.5*g right 0.5*g
+ box invis fill_(1) wid 3*g ht g "6 VAC" at I2-(2*g,0)
+ Pad(4) at P3-(0,3)*g
+ line right_ 3*g from P4.e "BRN" above
+ arrow down_ 2*g ht arrowht*2/3
+ "TO DIAL" "LAMPS" at Here+(0,-g)
+ Pad(5) at (Board.e,I3.end)
+ line from P5.e to I3.end "BLU" above
+ Pad(7) at (Board.e,I3.start)
+ line from P7.e to I3.start "BLU" above
+ Pad(6) at 0.5 between P5 and P7
+ line from P6.e to I3 "BLU-YEL" above
+
+# Power wiring, plug, switch
+define(`socket',`[
+ Outer: box wid dimen_*2/3 ht dimen_/2*3/4
+ L: box wid dimen_/16 ht dimen_/4 at Outer-(dimen_/6,0)
+ R: box wid dimen_/16 ht dimen_/4 at Outer+(dimen_/6,0)
+ line from Outer.w to L.w
+ line from Outer.e to R.e
+ ] ')
+
+ BLK: line from I4.end to (int(I4.end.x/g+8)*g,I4.end.y) "BLK" below ; dot
+ b = lin_leng(BLK)
+ BLKYEL: line from I4.start right_ b "BLK-YEL" above ; dot
+ BLKGRN: line from I5.end right_ b "BLK-GRN" below ; dot
+ BLKRED: line from I5.start right_ b "BLK-RED" above ; dot
+ line right_ g; PL: dot
+ line from BLKYEL.end right g then to Here+(0,-g)
+ fuse(down_ 3*g,D)
+ {"3 A FUSE" "SLOW BLOW" at last line+(-5*g,0) }
+ line to (Here.x,int(Here.y/g)*g-g); dot
+ Sckt1: socket at Here+(5,0)*g
+ line from Sckt1.w to (PL,Sckt1); A: dot; "A" rjust
+ line from Sckt1.e right_ lin_leng(last line); B: dot; "B" ljust
+ Sckt2: socket at (Sckt1,P1+(0,6)*g)
+ line from Sckt2.w to (A,Sckt2); dot
+ line from Sckt2.e to (B,Sckt2); dot
+ Sckt3: socket at (Sckt1,P1+(0,2)*g)
+ line from Sckt3.w to (A,Sckt3); dot
+ line from Sckt3.e to (B,Sckt3); dot
+
+define(`plug',`[ w = dimen_*2/3; q = 0.25*w
+ F: line right_ w
+ arc cw from F.start to F.end with .c at F
+ T1: F+(-q,w/2+g/2)
+ T2: F+( q,w/2+g/2)
+ line from T1 to (T1,F)-(0,2*g)
+ line from T2 to (T2,F)-(0,2*g) ]')
+
+ PP: plug with .F at Sckt3+(0,-8)*g
+ {"120 VAC" ljust "50/60 Hz" ljust at PP.e }
+
+define(`pwrswitch',`[ right; circlerad = 1.75*g/2
+ C1: circle "1"
+ C4: circle "4"
+ C2: circle "2" with .n at C1.s+(0,-C1.diam/2)
+ C5: circle "5"
+ C3: circle "3" with .n at C2.s+(0,-C1.diam/2)
+ C6: circle "6"
+ hatchbox(wid g ht C2.n.y-C3.s.y,0.05) with .w at 0.5 between C5.e and C6.e
+ ]')
+
+ Psw: pwrswitch with .C4.e at Sckt1+(0,-4*g)
+ "POWER" at Psw.w+(-2*g,0) rjust
+ arrow up Psw.ht/2 at Psw.e+(1.5*g,0)
+ "ON" above; "OFF" at last arrow.start below
+ line from Psw.C1.w to (A,Psw.C1) then to A
+ line from Psw.C2.w to (A,Psw.C2); continue to (Here,PP.T1) then to PP.T1
+ line from PP.T2 to (B,PP.T2) then to (B,I4.end) then to I4.end
+ line from BLKGRN.end to (B,BLKGRN); dot
+
+# Bottom connections
+ Pad(25) at Board.se+(-3,0)*g
+ R516: resistor(down_ 6*g from P25.s)
+ {"R516" "22" at last line+(-2*g,0)} ; ground(,T)
+ dot(at P25.s+(0,-g)); line right_ 5*g
+ reversed(`source',down_ 4*g,B)
+ {"#49" ljust "HI" ljust "TEMP" ljust at last line+(2*g,0) }
+ line to (P25,Here); dot
+ t = linethick; linethick_(0.4)
+ arrow <- from P25.s+(0,-g/2) right_ 2*g up_ g/4; "BRN" ljust; linethick_(t)
+
+ Pad(24) at P25+(-4,0)*g
+ line from P24.s to (P24,R516.end); ground(,T)
+ Pad(23) at Board.sw+(12*g,0)
+ line from P23.s to (P23,R516.end); ground(,T)
+
+ Pad(22) at Board.sw+(0,3)*g
+ R514: resistor(right_ 8*g from P22.e); Llabel(,R514); Rlabel(,680 K)
+ dot; { ground }
+ line to (P23,Here) then to P23.n
+
+# Diode bridge
+ BE: dot(at (P24,I1))
+ d1h = lin_leng(I1)/2
+ diode(left_ d1h up_ d1h); Rlabel(,,D508)
+ BN: dot
+ diode(left_ d1h down_ d1h); Rlabel(D506)
+ BW: dot
+ diode(from BE left_ d1h down_ d1h); Llabel(,,D509)
+ BS: dot
+ diode(left_ d1h up_ d1h); Llabel(D507)
+ capacitor(down_ from BN to BS,C); Llabel(C507,,.22)
+ line from BE to P24.n
+ line from BN to P2.w
+ line from BS to P1.w
+ spline <-> from (BE.x+2*g,BS.y) \
+ up d1h/2 right g/2 then up d1h left g then up d1h/2 right g/2
+ box invis fill_(1) ht 2*g wid 2*g "57" "VAC" at last spline
+
+# Left board connections
+ Pad(21) at (Board.w,BW); line from P21.e to BW
+ Pad(19) at P21+(0,-3*g)
+ Pad(20) at P21+(0, 3*g)
+
+# Transistor with circles
+define(`hbi_tr',`[ linewid = linewid*4/4.16
+ Q: bi_tr(`$1',`$2',`$3',E)
+ E: circle rad m4_xyU at 5/4 between Q.A1 and Q.E "E"
+ B: circle rad m4_xyU at 5/4 between Q.A1 and Q.B "B"
+ C: circle rad m4_xyU at 5/4 between Q.A1 and Q.C "C"
+ ]')
+
+# Interior circuits
+ line from P6.w left 2*g; ground
+ line from P5.w left 4*g; dot
+ { C504: capacitor(down_ 4*g,C); Llabel(C504,,.22); ground(,T) }
+ D504: diode(left_ 5*g); Rlabel(,D504); dot
+ { C505: capacitor(down_ to (Here,C504.end),C+L)
+ Rlabel(C505,100,75 V); ground(,T) }
+ line right_ to (Here,P7); dot
+ { D503: reversed(`diode',to (D504.start,Here)); Llabel(,D503); line to P7.w }
+ d3 = lin_leng(I3)
+ spline <-> from C504.start+(g/2,0) \
+ up d3/4 right g/4 then up d3*2/4 left g/2 then up d3/4 right g/4
+ box invis fill_(1) ht g wid 4*g "100 VAC" at last spline+(-g,0)
+
+ down_
+ Q503: hbi_tr(,R,P) with .E at (C505,P3)
+ line from Q503.C.e to (P25,Q503.C) then to P25.n
+ line from Q503.B.s to (Q503.B.x,Q503.E.y-4*g)
+ R513: resistor(down_ 5*g)
+ {"R513" ljust "1500" ljust at last [].e}; ground(,T)
+ line from P19.e to (BW-(2*g,0),P19) then up Q503.E.y-P19.y+2*g
+ R511: resistor(right_ 5*g); Llabel(,R511); Rlabel(,470);
+ line to (Q503.E,Here) then to Q503.E.n
+ line from P20.e to (BW,P20) then up R513.end.y-P20.y
+ resistor(up_ lin_leng(R513))
+ {"R512" ljust "5600" ljust "1 W" ljust at last [].e}
+ line to (Here,Q503.B) then to Q503.B.w
+ "Q503" "S2091 HI TEMP" "CONTROL" at Q503.E+(1.5,4)*g
+ D505: reversed(`diode',right_ from Q503.E.e to (C504,Q503.E)); Llabel(,D505)
+ line to P3.w
+
+ line from P4.w left_ 2*g then up P3.y-P4.y; dot
+ line from D503.end to (R513,D503); dot
+ { Pad(8) at (Here,Board.n) }
+ { line to P8.s }
+ R505: resistor(down_ to (Here,P6)); Llabel(,"R505" ljust "12 K"); dot
+ { C503: capacitor(down_ to (Here,C505.end),C+L)
+ Rlabel(C503,100,70 V); ground(,T) }
+ right_
+ Q502: hbi_tr(,R) with .B at (R511.start,Here)
+ line from Q502.C.e to R505.start
+ line from Q502.B.e to R505.end
+ R504: resistor(down_ from Q502.B.s to (Q502.B,C505.end))
+ {"R504" ljust "51 K" ljust at last [].e}; ground(,T)
+ "Q502" "TA7311" "REGULATOR" "CONTROL" at Q502.C+(-1,3)*g
+
+ Pad(9) at (Q502.E,Board.n)
+ line from Q502.E.n to P9.s
+ Pad(10) at (Q502.B-(9,0)*g,Board.n)
+ R502: resistor(left_ from Q502.E.w to (P10,Q502.E))
+ Rlabel(,R502); Llabel(,150); dot
+
+ Pad(11) at (Board.w,Q502.E)
+ Pad(14) at P11+(0,2.5)*g
+ Pad(12) at P11+(0,-2.5)*g
+ Pad(13) at P12+(0,-2.5)*g
+ line right 2*g from P13.e then up P11.y-P13.y; dot
+ line from P12.e to (Here,P12); dot
+ Pad(15) at P13+(0,-3)*g
+
+ right_
+ Q501: hbi_tr(,R) with .B at P9.n+(0,2*g)
+ line from Q501.B.s to P9.n
+ line from Q501.C.e to (P8,Q501.C) then to P8.n
+ line from Q501.E.w to (P10,Q501.E) then to P10.n
+ "Q501" "2N3055" "REGULATOR" at Q501.n+(0,2)*g
+ line from P14.e to (P10,P14); dot
+
+ Pad(17) at (Board.w,R511)
+ Pad(16) at P17+(0,3*g)
+ Pad(18) at P17+(0,-3*g)
+ line right 2*g from P18.e then up P17.y-P18.y; dot
+
+ right_
+ Q504: hbi_tr(,R) with .C at (P10,P17)
+ line from P17.e to Q504.E.w
+ line from Q504.B.s to (Q504.B,R513.start)
+ R508:resistor(down_ to (Here,R513.end))
+ {"R508" ljust "680" ljust at last [].e}; ground(,T)
+ dot(at (P10,P15))
+ { line to P10.s }
+ { resistor(down_ 5*g); {"225" ljust "10 W" ljust "5 %" ljust at last [].e}
+ line to Q504.C.n }
+ R503:resistor(left_ 10*g); Rlabel(,R503); Llabel(,290 10 W 5%); dot
+ line to (Here,Q504.B)
+ resistor(right_ to Q504.B.w); Llabel(,R507); Rlabel(,100)
+ line from P15.e to R503.end
+ "Q504" "40409" "REGULATOR" at Q504.C+(3.5,3)*g
+ resistor(left_ from R502.end to (R503.end,P11))
+ Rlabel(,R501); Llabel(,390 5W 5%); line to P11.e
+
+ resistor(right_ from P16.e to (R514.end,P16)); Llabel(,R506); Rlabel(,82)
+ line down P16.y-P17.y; dot
+
+ dot(at (R514.end,P11))
+ C501: capacitor(down_ 6*g,C+)
+ Llabel(C501); {"100" ljust "30 V" ljust at last [].s +(0,-g)}
+ ground(,T)
+ dot(at (Here.x+4*g,P11.y))
+ ZD501: reversed(`diode',down_ lin_leng(C501),Z); Llabel(ZD501); ground(,T)
+
+ dot(at (R514.end,P15))
+ C502: capacitor(down_ 6*g,C+)
+ Llabel(C502); {"100" ljust "30 V" ljust at last [].s +(0,-g)}
+ ground(,T)
+ dot(at (Here.x+4*g,P15.y))
+ ZD502: reversed(`diode',down_ lin_leng(C502),Z); Llabel(ZD502); ground(,T)
+
+ line from (C502,P17) to (C502,R508.start+(0,g))
+ C506: capacitor(down_ to (Here,R508.end),C+)
+ Llabel(C506); {"100" ljust "30 V" ljust at last [].s +(0,-g)}
+ ground(,T)
+
+# Left-side boxes
+ boxwid = 10*g
+ boxht = 5*g
+ line left 3*g from P22.w "GRY" above
+ line left 3*g from P19.w "VIOL" above
+ box with .e at (Here,0.5 between P19 and P22) "TO SIGNAL" "METER CIRCUIT"
+
+ line left 8*g from P21.w "RED TO C508" above
+ line left 8*g from P20.w "VIOL" above
+
+ line left 3*g from P17.w "RED" above
+ line left 3*g from P18.w; {"WHT-" ljust "RED" ljust at Here+(0,g) }
+ box with .e at (Here,0.5 between P17 and P18) "12.7 V SOURCE" "TO MULTIPLEX"
+
+ line left 3*g from P16.w "WHT" above
+ box with .se at Here+(0,-g) "12 V SOURCE" "TO FM TUNER" "SOURCE SWITCH"
+
+ line left 3*g from P15.w "ORG" above
+ box ht 3*g with .e at Here "15 V SOURCE" "TO FM TUNER"
+
+ line left 3*g from P13.w "BLU" above
+ line left 3*g from P12.w; {"WHT-" ljust "RED" ljust at Here+(0,g) }
+ line left 3*g from P11.w "RED" above
+ box ht 6*g with .e at (Here,P12) "27 V SOURCE" "TO CONTROL" "PREAMP AND" \
+ "PWR AMPLIFIER"
+
+ line left 3*g from P14.w
+ {"WHT-" ljust "GRY-" ljust "GRN" ljust at Here+(0,1.5*g) }
+ box with .se at Here+(0,-g) "50 V SOURCE" "TO PHONO" "PREAMP"
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/I2LSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/I2LSVG.m4
new file mode 100644
index 00000000000..835ecaec535
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/I2LSVG.m4
@@ -0,0 +1,78 @@
+.PS
+# I2L.m4
+log_init(svg_font(sans-serif,11bp__))
+
+[
+ down_
+T1: bi_trans(,R,BC2uEBU)
+ dy = T1.C0.y-T1.C1.y
+ dx = T1.C0.x-T1.Bulk.x
+ up_
+Q1: bi_trans(,,BC1dEBU) with .C1 at (T1.C2.x+dy+dx+dx,T1.C0.y-dy)
+Q2: bi_trans(,,BC1dEBU) with .C1 at Q1.E+(0,-dy*2)
+Q3: bi_tr(,,) with .B at Q2.C0+(2*dy,0)
+ down_
+T2: bi_trans(,R,BC1uEBU) with .C1 at (Q3.C.x+2*dx+2*dy,Q1.C0.y+dy)
+ up_
+X1: bi_tr(,,) with .B at (T2.C0.x+dy+dx,Q1.C0.y)
+X2: bi_tr(,,) with .B at (X1.B,Q3.C)
+
+ line down dx from Q2.E
+G: dot
+ line from T1.B to (T1.B,G) then to (X1.E.x+dy,G.y) then to X1.E+(dy,0) \
+ then to X1.E
+ line from X2.E right dy; dot
+
+ line from Q1.E down dy then to (T1.B.x,Q1.E.y-dy); dot
+ line from T1.C0 to (Q3.B,T1.C0) then to Q3.B; dot; line to Q2.C0
+
+A: dot(at (T1.B,Q1.B)-(dx,0)); { "svg_it(A)" wid 0.15 rjust }
+ line to Q1.B
+ line from T1.C2 to (T1.C2,Q1.B); dot
+
+ line from Q2.B to (A,Q2.B); dot; { "svg_it(B)" rjust }
+ line right dy from T1.C1 then down T1.C1.y-Q2.B.y; dot
+
+VB: dot(at (T2.E.x+2*dx,T1.E.y+dy)); { "svg_it(V`'svg_sub(B))" ljust }
+ line to (T1.E,Here) then to T1.E
+ line from T2.E to (T2.E,VB); dot
+
+ line from Q1.C1 to (Q3.C,Q1.C1) then to Q3.C; dot; line to X2.B
+
+ line from Q1.C0 to X1.B
+ dot(at Q1.C0+(dy,0)); line to (Here,Q2.C1) then to Q2.C1
+
+ line from Q3.E to (Q3.E,G); dot; ground
+
+ line from T2.B to (T2.B,G); dot
+
+ line from T2.C1 to (T2.C1,X1.B); dot
+ "svg_it(~(A+B))" wid textht*1.5 below at Here+(0,-2pt__)
+
+ line from T2.C0 to (X2.B,T2.C0) then to X2.B; dot
+ "svg_it(~(A+(~B)))" below at (T2.E,Here)+(0pt__,-2pt__)
+
+]
+
+[
+right_
+
+jog = AND_ht/2*L_unit
+
+ X1: NOR_gate
+ line right jog from X1.Out; "svg_it(~(A+B))" ljust
+ X2: NOR_gate at X1+svec_(0,-AND_ht*3/2)
+ line right jog from X2.Out; "svg_it(~(A+(~B)))" ljust
+ line left jog from X2.In2
+ right_
+ NOT: NOT_gate with .Out at Here
+ line left jog from NOT.In1 then up X1.In2.y-NOT.In1.y; dot
+ line from X1.In2 to Here chop 0 chop -jog
+ B: dot; "svg_it(B)" rjust
+ line from X1.In1 to (B,X1.In1); dot; "svg_it(A)" wid 0.15 rjust
+ line left jog from X2.In1 then up X1.In1.y-X2.In1.y; dot
+
+] with .e at last [].w-(1,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Incl.jpg b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Incl.jpg
new file mode 100644
index 00000000000..80632b54e99
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Incl.jpg
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/InclepsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/InclepsSVG.m4
new file mode 100644
index 00000000000..501329f9d68
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/InclepsSVG.m4
@@ -0,0 +1,90 @@
+.PS
+# InclepsSVG.m4 : Illustrating one way to import and overwrite jpg in svg
+# A bit messy, but it works. This file has to be processed
+# by m4 in the usual way and then twice by dpic, eg
+# m4 svg.m4 SVGconfig.m4 InclepsSVG.m4 > InclepsSVG.pic
+# dpic -v InclepsSVG.pic > InclepsSVG.svg
+# dpic -v InclepsSVG.pic > InclepsSVG.svg
+
+# The double processing is needed because svg coordinates are to the right
+# and down. We have to store the coordinates of the nw corner and use them
+# on the second pass.
+
+divert(-1)
+######################################################################
+# Macros to simplify inclusion and positioning of raster image files such
+# as png or jpg or files with mime type of "image/svg+xml"
+
+ `svg_init_include([Unique_name])
+ Put this (once) before all drawing commands
+ in the diagram. It opens a [] block for the
+ total diagram and creates the file
+ Unique_name.dim (default SVGinsertTemp.dim).'
+define(`svg_init_include',
+`define(`M4IP_uniq',`ifelse(`$1',,SVGinsertTemp,`$1')')dnl
+ M4IP_NW: (0,0); m4IP_nw = 0; m4IP_lth = lthick
+ sh "touch M4IP_uniq.dim"
+ copy "M4IP_uniq.dim"
+ [ M4IP_NW: M4IP_NW; { move to M4IP_NW } ')
+
+ `svg_include(filename, wid, ht, [position],[attrib])
+ Insert bitmap at specified position; also create
+ an invis box of the same size and location.
+ arg1= path to image file
+ arg2= picture width in drawing units
+ arg3= picture height in drawing units
+ arg4= position attribute e.g.
+ Pic: svg_include(Incl.jpg,2,3, with .sw at (1,4))
+ arg5= additional svg image attributes in the sprintf
+ string, e.g.
+ clip-path=\"polygon(5%% 0%%, 100%% 0%%, 100%% 100%%, 5%% 100%%)\" (distances
+ in percent to top-left, top-right, bottom-right, bottom-left clip corners,
+ or in pixels) '
+define(`svg_include',`box invis wid `$2' ht `$3' `$4'
+define(`m4xpx',`(last box.w.x-M4IP_NW.x+m4IP_lth/2)/(1px__)')dnl
+define(`m4ypx',`(M4IP_NW.y-last box.n.y+m4IP_lth/2)/(1px__)')dnl
+define(`m4wdpx',`(`$2')/(1px__)')dnl
+define(`m4htpx',`(`$3')/(1px__)')dnl
+if m4IP_nw then { command sprintf(\
+ "<image x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"dnl
+ xlink:href=\"`$1'\" `$5' />", m4xpx,m4ypx,m4wdpx,m4htpx) } ')
+
+ `svg_end_include
+ Put this before .PE after all drawing commands.
+ It closes the [] block and writes to Unique_name.dim'
+define(`svg_end_include',`] with .M4IP_NW at M4IP_NW
+ print sprintf("m4IP_nw=1; m4IP_lth=%g; M4IP_NW:(%g,%g)",lthick,\
+ last [].w.x+3*m4IP_lth/2, last [].n.y+3*m4IP_lth/2) > "M4IP_uniq.dim"
+ undefine(`M4IP_uniq') ')
+
+######################################################################
+divert(0)dnl
+
+darrow_init
+svg_init_include
+
+
+# This jpg is 242 px x 321 px
+ Picture: svg_include(Incl.jpg, 242px__, 321px__, with .w at (1,0))
+
+ define(`backarrow',`darrow(`$1',,,2pt__,6pt__,6pt__,<-|)')
+ thinlines_
+ backarrow( from boxcoord(Picture,0.4,0.95) up 0.4 right 0.7 )
+ "Basket" wid 0.45 with .w at Here+(2bp__,0)
+ backarrow( from boxcoord(Picture,0.9,0.41) up 0.2 right 0.5 )
+ "Ball" wid 0.3 with .w at Here+(2bp__,0)
+ backarrow( from boxcoord(Picture,0.85,0.32) up 0.2 right 0.5 )
+ "Star" wid 0.3 with .w at Here+(2bp__,0)
+ "Player" wid 0.43 with .w at last "".w+(0,-0.15)
+
+#for i=3 to 1 by -1 do {
+# Picture: svg_include(Incl.jpg, i/4*242px__, i/4*321px__,
+# with .nw at last box.nw+(0.125,-0.25)) }
+
+# P2: svg_include(Incl.jpg, 242px__, 321px__,
+# with .w at Picture.e+(1.25,0),
+# clip-path=\"polygon(30 0, 100%% 0%%, 100%% 100%%, 30 321)\" )
+
+svg_end_include
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/JackSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/JackSVG.m4
new file mode 100644
index 00000000000..ea14a04e597
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/JackSVG.m4
@@ -0,0 +1,75 @@
+.PS
+# `Jack.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+P: [
+ P1: plug
+ "A" wid 0.1 at P1.A rjust
+ "B" at P1.B rjust
+ "TB" at P1.TB ljust above
+ "TA" at P1.TA ljust below
+ P2: plug(,R) with .B at P1.A+(0.85,0)
+ "A" wid 0.1 at P2.A rjust
+ "B" at P2.B rjust
+ P3: plug(,3) with .A at P2.B+(0.85,0)
+ "A" at P3.A rjust
+ "B" at P3.B rjust
+ "C" at P3.C rjust
+ P4: plug(L,3R) with .A at P3.A+(1,0)
+ "A" wid 0.1 at P4.A ljust
+ "B" at P4.B ljust
+ "C" at P4.C ljust
+ `"plug"' below at P1.s+(0,-0.1)
+ `"plug(,R)"' below at P2.s+(0,-0.1)
+ `"plug(,3)"' below at P3.s+(-0.1,-0.1)
+ `"plug(L,3R)"' below at P4.s+(0.1,-0.1)
+]
+
+L: [
+ J1: jack
+ thinlines_
+ "L" wid 0.1 rjust at J1.L
+ arrow <- right 0.1 from J1.F; "F" ljust
+ arrow <- down 0.1 from J1.G then left 0.1 ; "G" rjust
+ thicklines_
+ J2: jack(,LMBS) with .F at J1.F+(1.2,0)
+ thinlines_
+ "L" rjust at J2.L
+ arrow <- from J2.LM left 0.25; "LM" rjust
+ arrow <- from J2.LB left 0.25; "LB" rjust
+ "S" rjust at J2.S
+ thicklines_
+ J3: jack(L,RLS) with .F at J2.F+(0.4,0)
+ thinlines_
+ "L" ljust at J3.L
+ "S" ljust at J3.S
+ thicklines_
+ J4: jack(L,RLBLMLMS) with .F at J3.F+(1,0)
+ thinlines_
+ "L1" ljust at J4.L1
+ arrow <- right 0.3 from J4.LM1; "LM1" ljust
+ "L2" ljust at J4.L2
+# arrow <- right 0.3 from J4.LM2; "LM2" ht 11pt__ ljust
+ arrow <- right 0.3 from J4.LM2; "LM2" ljust
+ "S" ljust at J4.S
+ "L" ljust at J4.L
+ arrow <- right 0.2 from J4.LB ; "LB" ljust
+ J5: jack(,RSBSMLB) with .F at J4.F+(1.95,0)
+ thinlines_
+ "L" rjust at J5.L
+ "S" rjust at J5.S
+ "S1" rjust at J5.S1
+ arrow <- left 0.3 from J5.SM1; "SM1" rjust
+ arrow <- left 0.25 then left 0.1 down 0.05 from J5.LB; "LB" rjust
+ arrow <- left 0.25 then left 0.1 up 0.05 from J5.SB; "SB" rjust
+ thicklines_
+
+ `"jack"' below at J1.s+(0,-0.15)
+ `"jack(,LMBS)"' at (J2,last "")
+ `"..(L,RLS)"' at (J3,last "")
+ `"..(L,RLBLMLMS)"' at (J4,last "")
+ `"..(,RSBSMLB)"' wid 72bp__ at (J5,last "")
+] with .nw at P.sw + (0,0.1)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LgateSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LgateSVG.m4
new file mode 100644
index 00000000000..7a8cf06d221
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LgateSVG.m4
@@ -0,0 +1,153 @@
+divert(-1)
+# LgateSVG.m4
+###########################################################################
+
+define(`And',`GenLogGate(AND,$@)')
+define(`Nand',`GenLogGate(NAND,$@)')
+define(`Or',`GenLogGate(OR,$@)')
+define(`Nor',`GenLogGate(NOR,$@)')
+define(`Xor',`GenLogGate(XOR,$@)')
+define(`Nxor',`GenLogGate(NXOR,$@)')
+define(`Not',`GenLogGate(NOT,$@)')
+
+define(`GenLogGate',`[ pushdef(`m4nargs',0)dnl
+ # Count the arguments and draw the gate
+ Loopover_(`a',`define(`m4nargs',incr(m4nargs))',shift($@))dnl
+ G: ifelse(`$1',NOT,`NOT_gate()',`$1_gate(m4nargs)')
+ Out: G.Out
+ T: (G.In1.x-2*L_unit,G.y)
+ # Sublayer gates with centre at the height of G
+ SubLayer: [ pushdef(`m4_nct',0)
+ pushdef(`m4glayer')dnl
+ Loopover_(`arg',
+ `define(`m4_nct',incr(m4_nct))dnl
+ # Stack the input label or draw a sublayer gate
+ pushdef(`m4InNames')dnl
+ Gate`'m4_nct: ifelse(patsubst(substr(arg,0,1),`[a-zA-Z]',`&'),&,
+ `[ In`'arg: ifdef(`MarkLogInputs',`"arg" above',Here)
+ pushdef(`m4InNames',In`'arg)dnl
+ Out: Here ] ht 2*L_unit',
+ `arg') ifelse(m4_nct,1,,`with .ne at last [].se+(0,-L_unit)')
+ ifdef(`MarkSubLayers',
+ `{ box wid last [].wid ht last [].ht at last [] }')
+ # Prepend gate name to labels
+ m4LogPromote(Gate`'m4_nct)',
+ shift($@)) dnl
+ # Promote gate labels to Sublayer block
+ pushdef(`m4InNames') m4LogLabel()
+ MidOut: 0.5 between Gate`'eval((m4_nct+1)/2).Out \
+ and Gate`'eval((m4_nct+2)/2).Out
+ popdef(`m4_nct')dnl
+ ] with .MidOut at T+(-m4nargs*L_unit,0) # end SubLayer
+ ifdef(`MarkSubLayers',
+ `{ box wid last [].wid ht last [].ht at last [] }')
+ # Promote sublayer labels to outer block
+ pushdef(`m4glayer') m4LogPromote(SubLayer) dnl
+ pushdef(`m4InNames') m4LogLabel() dnl
+ # Draw the connecting lines
+ define(`m4hhv',`(m4nargs-1)/2')dnl
+ for_(1,m4nargs,1,`
+ line from G.In`'m4x \
+ left G.In`'m4x.x-T.x+(m4hhv-abs(m4x-m4hhv-1))*L_unit \
+ then up SubLayer.Gate`'m4x.Out.y-G.In`'m4x.y \
+ then to SubLayer.Gate`'m4x.Out')
+ popdef(`m4nargs') dnl
+ ]')
+
+# Manage names of sublayer inputs
+define(`m4LogPromote',`ifelse(m4InNames,,`popdef(`m4InNames')',
+ `pushdef(`m4glayer',m4InNames:$1)
+ popdef(`m4InNames') m4LogPromote($1)') ')dnl
+
+define(`m4LogLabel',`ifelse(m4glayer,,`popdef(`m4glayer')',
+ `define(`m4BaseIn',`substr(m4glayer,0,index(m4glayer,:))')dnl
+ m4glayer.m4BaseIn
+ pushdef(`m4InNames',m4BaseIn) popdef(`m4glayer') m4LogLabel()') ')dnl
+
+# Clear a name stack
+define(`stack_del',`ifelse($1,`$1',,`popdef(`$1')$0($@)')')
+
+###########################################################################
+divert(0)dnl
+.PS
+log_init(svg_font(sans-serif,11bp__))
+#define(`MarkLogInputs')
+
+define(`bbelow',`with .nw at last [].sw+(0,-0.2)')
+
+ define(`MarkLogInputs')
+Ex1:Or(x1,q,`Or(y1,z1)',`Or(z3,u,v,`Or(w,r)',x2,y2,z2,m)')
+ `"Or(x1,q,`Or(y1,z1)',`Or(z3,u,v,`Or(w,r)',x2,y2,z2,m)')"' \
+ at Ex1.se+(-0.4,-0.2)
+ undefine(`MarkLogInputs')
+
+ line from Ex1.Inx1 to (Ex1.w,Ex1.Inx1)-(L_unit,0)
+ line from Ex1.Inx2 to (Here,Ex1.Inx2) then to Here; dot
+ line to Here-(2*L_unit,0); Inx: "x" above
+
+ line from Ex1.Iny1 to (Ex1.w,Ex1.Iny1)-(2*L_unit,0)
+ line from Ex1.Iny2 to (Here,Ex1.Iny2) then to Here; dot
+ line to Here-(2*L_unit,0); Iny: "y" above
+
+ line from Ex1.Inz1 to (Ex1.w,Ex1.Inz1)-(3*L_unit,0)
+ {line from Ex1.Inz3 to (Ex1.Inz3,Ex1.Inz1); dot}
+ line from Ex1.Inz2 to (Here,Ex1.Inz2) then to Here; dot
+ line to Here-(2*L_unit,0); Inz: "z" above
+
+Ex2: And(`Not(A)',B,C,`Nor(A2,D)') with .nw at Ex1.Out+(0.75,0.2)
+ line right 3*L_unit from Ex2.Out
+ "svg_it(ABC(A+D))" above ljust at Ex2.G.nw
+ line right 0.1 at last ""+(0.1,0.16)
+ line right 0.35 at last ""+(0.55,0.16)
+ line from Ex2.InA2 to (Ex2.InA2,Ex2.InA); dot
+ line to Ex2.InA chop -3*L_unit chop 0
+ "svg_it(A)" rjust at last line.start
+ "svg_it(B)" rjust at Ex2.InB
+ "svg_it(C)" rjust at Ex2.InC
+ "svg_it(D)" rjust at Ex2.InD
+ `"And(`Not(A)',B,C,`Nor(A2,D)')"' wid 2.1 with .w at Ex2.sw-(0,0.2)
+ `"line from Ex2.InA2 to (Ex2.InA2,Ex2.InA); dot"' wid 3.2 \
+ with .w at last "".w+(0,-0.2)
+ `"line to Ex2.InA chop -3*L_unit chop 0"' wid 2.60 \
+ with .w at last "".w+(0,-0.2)
+ `"\"A\" rjust at last line.start"' wid 1.6 with .w at last "".w+(0,-0.2)
+ `"\"B\" rjust at Ex2.InB; \"C\" rjust at Ex2.InC"' wid 2.7 with .w \
+ at last "".w+(0,-0.2)
+
+Ex3: Or(`And(A1,C1)',`And(B1,`Not(C2)')',`And(`Not(A2)',B2,C3)') \
+ with .nw at Ex1.sw+(0,-0.4)
+ line right 3*L_unit from Ex3.Out
+ line from Ex3.InB2 to (Ex3.InA2,Ex3.InB2)+(-2*L_unit,0) \
+ then up Ex3.InB1.y-Ex3.InB2.y; dot
+ line from Ex3.InB1 to Here chop 0 chop -2*L_unit; B: "svg_it(B)" rjust
+ line from Ex3.InA2 to (Ex3.InA2,Ex3.InA1); dot
+ line from Ex3.InA1 to (B,Here) ; "svg_it(A)" rjust
+ line from Ex3.InC2 to (Ex3.InC2,Ex3.InC1) then to Ex3.InC1
+ dot(at Ex3.InC2); line to (B,Here); "svg_it(C)" rjust
+ dot(at ((Ex3.InC2)+(-2*L_unit,0),Ex3.InC2))
+ line to (Here,Ex3.InC3) then to Ex3.InC3
+ "svg_it(AC+BC+ABC)" above ljust at Ex3.G.nw
+ line right 0.1 at last ""+(0.5,0.16)
+ line right 0.1 at last ""+(0.73,0.16)
+ `"Or(`And(A1,C1)',`And(B1,`Not(C2)')',`And(`Not(A2)',B2,C3)')"' \
+ at (B,Ex3.s)+(0,-0.2) ljust
+
+# define(`MarkSubLayers')
+Ex4: And(`Or(`Nand(`Or(A,B)',C)',D)',E) with .w at Ex3.e+(1.25,0)
+ "svg_it(A)" rjust at Ex4.InA
+ "svg_it(B)" rjust at Ex4.InB
+ line from Ex4.InC to (Ex4.InA,Ex4.InC); "svg_it(C)" rjust
+ line from Ex4.InD to (Ex4.InA,Ex4.InD); "svg_it(D)" rjust
+ line from Ex4.InE to (Ex4.InA,Ex4.InE); "svg_it(E)" rjust
+ line right 3*L_unit from Ex4.Out
+ "svg_it((D+(A+B)C)E)" above ljust at Ex4.G.nw
+ line right 0.5 at last ""+(0.6,0.16)
+ `"And(`Or(`Nand(`Or(A,B)',C)',D)',E)"' at Ex4.sw+(0,-0.2) ljust
+# undefine(`MarkSubLayers')
+
+stack_del(`m4InNames') # clear the name stack in case other diagrams need it
+# extend the bounding box
+move from Ex1.nw+(-0.35,0.1) to Ex4.Out+(1,-0.65)
+
+command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LogicSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LogicSVG.m4
new file mode 100644
index 00000000000..ec89a62bb02
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LogicSVG.m4
@@ -0,0 +1,59 @@
+.PS
+# Logic.m4
+log_init(svg_font(sans-serif,11bp__))
+xgap = 0.5
+[ dmov = 0.4
+{ {AND_gate ; "`AND_gate'" ljust at last [].w + (xgap,0)}
+ move down dmov; right_
+ {OR_gate ; "`OR_gate'" ljust at last [].w + (xgap,0)}
+ move down dmov; right_
+ {BUFFER_gate ; "`BUFFER_gate'" ljust at last [].w + (xgap,0)}
+ move down dmov; right_
+ {XOR_gate ; "`XOR_gate'" ljust at last [].w + (xgap,0)}
+ }
+
+xgap = 0.65
+ move right_ 2
+{ { NAND_gate ; "`NAND_gate'" ljust at last [].w + (xgap,0) }
+ move down dmov; right_
+ { Gate: NOR_gate(3)
+ "`NOR_gate(3)'" ljust at last [].w + (xgap,0)
+ thinlines_
+ spline <- from Gate.Out right arrowht*2.0 \
+ then up 0.15 then right 0.05
+ "`Out'" ljust
+ spline <- from Gate.N_Out down arrowht*2.0 \
+ then right 0.1+arrowht*1.5+NOT_rad down 0.15-arrowht*2.0
+ "`N_Out'" ljust
+ for_(1,3,1,
+ `arrow <- left 0.2 down 0.05 from Gate.In`'m4x
+ "In`'m4x" rjust at Here+(0,(2-m4x)*0.02)')
+ }
+ thicklines_
+ move down dmov; right_
+ { NOT_gate ; "`NOT_gate'" ljust at last [].w + (xgap,0) }
+ move down dmov; right_
+ { NXOR_gate ; "`NXOR_gate'" ljust at last [].w + (xgap,0) }
+}
+ move right_ 2
+{ {B: NAND_gate(,B) ; "`NAND_gate(,B)'" ljust at B.w + (xgap,0)}
+ { line invis right 1.8 from last [].se then down 1}
+ move down dmov; right_
+ move left N_diam*L_unit; right_
+ {NOR_gate(3,NB) ; "`NOR_gate(3,NB)'" ljust at (B.w,last []) + (xgap,0) }
+ move down dmov; right_
+ {BOX_gate(PN,N,,,=1)
+ "`BOX_gate(PN,N,,,=1)'" ljust at (B.w,last []) + (xgap,0)
+ line left 0.15 from last [].In1
+ line left 0.15-NOT_rad*2 from last [].In2
+ line right 0.15 from last [].Out }
+ move down dmov; move right_ N_diam*L_unit
+ {BOX_gate(PP,N,,,=)
+ "`BOX_gate(PP,N,,,=)'" ljust at (B.w,last []) + (xgap,0)
+ line left 0.15 from last [].In1
+ line left 0.15 from last [].In2
+ line right 0.15 from last [].Out }
+}
+]
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4
new file mode 100644
index 00000000000..d6b29d0fa02
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/LoglogSVG.m4
@@ -0,0 +1,81 @@
+.PS
+# LoglogSVG.m4
+gen_init(svg_font(sans-serif,11bp__))
+
+define(`rint',`sign(`$1')*int(abs(`$1')+.5)')
+S:[
+ horiz = 4
+ vert = horiz*2/3
+ tmax = 10
+ tmin = 1
+ vmax = 100
+ vmin = 0.1
+ tic = 0.08
+ denv = log(vmax) - log(vmin)
+ denh = log(tmax) - log(tmin)
+
+ Origin: Here
+ define(`coord',
+ `Origin+((log(`$1')-log(tmin))/denh*horiz,(log(`$2')-log(vmin))/denv*vert)')
+
+thinlines_
+# Left axes and labels
+ psset_(linecolor=gray)
+ for i = rint(log(vmin)) to rint(log(vmax)) do {
+ move to coord(tmin,exp(i))
+ line right horiz
+ sprintf("%g",exp(i)) wid 0.2 rjust at last line.start
+ if i < rint(log(vmax)) then {
+ for j = 2 to 9 do { move to coord(tmin,j*exp(i))
+ line right horiz
+ if (j==2) || (j==5) then {
+ sprintf("%g",j*exp(i)) rjust at last line.start }
+ } } }
+
+#Horizontal axis and labels
+ for t = rint(log(tmin)) to rint(log(tmax)) do {
+ move to coord(exp(t),vmin)
+ line up vert
+ sprintf("%g",exp(t)) wid 0.15 below at last line.start
+ if t < rint(log(tmax)) then {
+ for j = 2 to 9 do { move to coord(j*exp(t),vmin)
+ line up vert
+ if (j==2) || (j==5) then {
+ sprintf("%g",j*exp(t)) below at last line.start }
+ } } }
+ psset_(linecolor=black)
+
+# arrow from Origin up vert chop 0 chop -0.1
+ line from Origin up vert
+ "svg_it(y(t))" wid 0.3 at Origin+(-0.1,0.5*vert) rjust
+
+# arrow from Origin right horiz chop 0 chop -0.1
+ line from Origin right horiz
+ "svg_it(t)" at Origin+(.5*horiz,-0.1) below
+
+thicklines_
+ alpha = 2.5
+ beta = 3.0
+ tm = max(tmin,(vmin/alpha)^(1/beta))
+ tM = min(tmax,(vmax/alpha)^(1/beta))
+ line from coord(tm,alpha*tm^beta) to coord(tM,alpha*tM^beta)
+P: box invis fill_(1) wid 0.75 ht 0.18 \
+ "svg_it(y(t) = 1.5 t)" with .w at coord(2.005,14)
+ "svg_it(svg_small(3))" with .w at P.ne #ljust
+
+ alpha = 0.05
+ beta = 2.0
+ tm = max(tmin,(vmin/alpha)^(1/beta))
+ tM = min(tmax,(vmax/alpha)^(1/beta))
+ line from coord(tm,alpha*tm^beta) to coord(tM,alpha*tM^beta)
+Q: box invis fill_(1) wid 0.80 ht 0.18 \
+ "svg_it(y(t) = 0.05 t)" with .e at coord(4.6,1.4)
+ "svg_it(svg_small(2))" with .w at Q.ne #ljust
+
+]
+
+# box wid S.wid ht S.ht at S
+# print (S.wid,S.ht)/(1 pc__)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MCSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MCSVG.m4
new file mode 100644
index 00000000000..ef1d2158091
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MCSVG.m4
@@ -0,0 +1,44 @@
+.PS
+#MC.m4
+cct_init(svg_font(Times,11bp__))
+textoffset = 3bp__
+
+ dv = dimen_*0.6
+ dh = dimen_*0.4
+ backup = dimen_/6
+
+ for i=1 to 3 do {{
+ if i==2 then { Input: dot } else { line up (2-i)*dv }
+ source(right_ dimen_,AC)
+# The pound sign has to be protected from m4
+ llabel(,,sprintf("svg_it(v`'svg_sub(&``#''%g;,66%))",96+i))
+ resistor(right_ dimen_ from Here-(backup/2,0))
+ if i==1 then { llabel(,R`'svg_sub(i))}
+ inductor(right_ dimen_ from Here-(backup,0),W)
+ if i==1 then { llabel(,L`'svg_sub(i))}
+ line right_ i*dh
+ b_current(sprintf("svg_it(i`'svg_sub(&``#''%g;,66%))",96+i)); dot
+ { line down (3-i)*dv; capacitor(down_ dimen_)
+ if i==1 then { rlabel(,C`'svg_it(i)) }
+ if i==2 then { dot } else { line right (2-i)*dh }}
+ line right 3*dh; dot
+ E: Here+((3-i)*dh+dimen_*2,(4-2*i)*dv)
+ for j=1 to 3 do {{
+ line up (6-j*3)*dv then right (3-i)*dh
+ switch(right_ E.x-Here.x)
+ llabel(,,sprintf("svg_it(S`'svg_sub(&``#''%g;&``#''%g;,66%))",96+i,64+j))
+ if i==2 then { dot } else { line down (2-i)*dv }
+ }}
+ line from E right dh then down E.y-Here.y
+ arrow right dimen_/2
+ { sprintf("svg_it(i`'svg_sub(&`#'%g;,66%))",64+i) above }
+ resistor(right_ dimen_ from Here-(arrowht/2,0))
+ if i==1 then {llabel(,R`'svg_sub(o))}
+ inductor(right_ dimen_ from Here-(backup,0),W)
+ if i==1 then {llabel(,L`'svg_sub(o))}
+ source(right_ dimen_,AC)
+ llabel(sprintf("svg_it(v`'svg_sub(&``#''%g;,66%))",64+i))
+ if i==2 then { Output: dot } else { line down (2-i)*dv }
+ }}
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile
new file mode 100644
index 00000000000..eba342fa226
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Makefile
@@ -0,0 +1,91 @@
+LIBDIR = $$HOME/lib
+M4LIBS = svg.m4 SVGconfig.m4
+
+# To process a single file, copy it to test.m4 and type "make tst"
+# to produce tstSVG.html
+
+DPIC = dpic
+#DPIC = $$HOME/dpic/bu*/p2c/ftp/dpic
+#DPIC = $$HOME/dpic/bu*/test/dpic
+
+.SUFFIXES: .pic .svg .m4
+.pic.svg:
+ $(DPIC) -v $*.pic > $*.svg
+ grep '<\!-- width' $*.svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' > $*.siz
+.m4.svg:
+ m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic
+ $(DPIC) -v $*.pic > $*.svg
+ grep '<\!-- width' $*.svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' > $*.siz
+
+CCTSVG = \
+ AdderSVG.svg AlogixSVG.svg ABlogixSVG.svg AmpTableSVG.svg AntennasSVG.svg \
+ AudioSVG.svg \
+ BipSVG.svg BtreeSVG.svg ByteSVG.svg ButtonsSVG.svg \
+ CanLogicSVG.svg CctTableSVG.svg ConnSVG.svg CountingSVG.svg CrossbarSVG.svg \
+ CrowSVG.svg CrullerSVG.svg CsourceSVG.svg \
+ DecoderSVG.svg DemultiplexerSVG.svg DiodesSVG.svg DriveSVG.svg \
+ EmarrowsSVG.svg \
+ FlowSVG.svg FontsSVG.svg FusesSVG.svg GroundsSVG.svg \
+ HeadersSVG.svg HeathkitSVG.svg InclepsSVG.svg I2LSVG.svg JackSVG.svg \
+ LogicSVG.svg LoglogSVG.svg \
+ MCSVG.svg MixerSVG.svg MotorControlSVG.svg MultiplexerSVG.svg \
+ NLGSVG.svg NPDTSVG.svg NportSVG.svg OpampSVG.svg OptoisoSVG.svg \
+ PconnSVG.svg PushPullSVG.svg QuantumSVG.svg \
+ RectifiersSVG.svg RelaySVG.svg RotboxSVG.svg\
+ SchottkySVG.svg ShiftRSVG.svg SierpinskiSVG.svg \
+ SixpoleSVG.svg SourcesSVG.svg SQUIDSVG.svg SwitchesSVG.svg \
+ TTLnandSVG.svg TgateSVG.svg TtreeSVG.svg \
+ ThreeSVG.svg TimerSVG.svg VariableSVG.svg WindingsSVG.svg XformSVG.svg \
+ controlSVG.svg cscSVG.svg diamondSVG.svg ex00SVG.svg \
+ ex01SVG.svg ex02SVG.svg ex03SVG.svg ex04SVG.svg ex05SVG.svg ex06SVG.svg \
+ ex08SVG.svg ex09SVG.svg ex10SVG.svg ex11SVG.svg ex12SVG.svg \
+ ex15SVG.svg ex16SVG.svg ex17SVG.svg ex18SVG.svg ex21SVG.svg \
+ expSVG.svg fetSVG.svg graysurfSVG.svg lcctSVG.svg \
+ pwrsupplySVG.svg quickSVG.svg randomSVG.svg recycleSVG.svg roseSVG.svg \
+ sfgSVG.svg shapesSVG.svg paletteSVG.svg \
+ thyristorSVG.svg ujtSVG.svg wormSVG.svg XORSVG.svg Np.svg
+
+examplesSVG.html: examplesSVG.htmx
+ make $(CCTSVG)
+ Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \
+ sed -e 's/Version XXX/Version '$$Version'/' examplesSVG.htmx \
+ | m4 > examplesSVG.html
+
+SED = sed -e '/^\%/d'
+TEST = test
+tst: $(TEST).pic
+ $(DPIC) -v $(TEST).pic > $(TEST).svg
+ m4 $(M4LIBS) $(TEST).m4 | $(SED) > $(TEST).pic
+ $(DPIC) -v $(TEST).pic > $(TEST).svg
+ grep '<\!-- width' $(TEST).svg | sed -e 's%<\!-- *%%' -e 's% *-->%%' \
+ > $(TEST).siz
+ make tstSVG.html
+
+test.pic:
+ m4 $(M4LIBS) test.m4 | $(SED) > test.pic
+
+tstSVG.html: tstSVG.htmx $(TEST).svg
+ Version=`sed -e 's/Version //' $(LIBDIR)/doc/Version.tex` ; \
+ sed -e 's/Version XXX/Version '$$Version'/' \
+ -e 's/XXXXX/'$(TEST)'/g' \
+ tstSVG.htmx | m4 > tstSVG.html
+# cp tstSVG.html $(TEST) $$HOME/public_html/svg
+
+xst: Incleps.png
+
+InclepsSVG.svg: InclepsSVG.m4
+ m4 $(M4LIBS) $*.m4 | sed -e '/^\%/d' > $*.pic
+ $(DPIC) -v $*.pic > $*.svg
+ $(DPIC) -v $*.pic > $*.svg
+
+Incleps.png:
+ (cd ..; make Incleps.png); cp ../Incleps.png .
+
+clean:
+ @printf "\n svg clean:\n"
+ rm -f *.svg *.dim *.ps *log *.siz *.pic examplesSVG.html Incleps.png
+ rm -f tstSVG.html
+ @printf "\n"
+
+clobber: clean
+ rm -f test.m4
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MixerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MixerSVG.m4
new file mode 100644
index 00000000000..aa778337b33
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MixerSVG.m4
@@ -0,0 +1,98 @@
+.PS
+#`MixerSVG.m4
+# Showing VMOS mosfet and custom transformer'
+cct_init(svg_font(sans-serif,11bp__,1bp__))
+
+define(`dimen_',0.6)
+define(`elen_',0.75)
+
+define(`Xform21',
+ `[ L1: inductor(to rvec_(dimen_*0.5,0),L,,M)
+ Core1E: M4Core1.end; Core2E: M4Core2.end
+ D: (0.5 between M4Core1 and M4Core2) - L1
+ T: line to rvec_(dimen_/3,0); { dot(at T.c) }
+ L2: inductor(to rvec_(L1.len,0),L,,M)
+ line from M4Core1.start to Core1E
+ line from M4Core2.start to Core2E
+ L3: inductor(to rvec_(-L1.len,0) with .c at T+(D.x*2,D.y*2),L) ]')
+
+ del = dimen_/3
+ setdir_(U)
+T1: Xform21; "T1" at T1.n above rjust
+ dot(at T1.L3.start+(0,4bp__))
+ dot(at T1.L1.end+(4bp__,0))
+ dot(at T1.L2.end+(4bp__,0))
+ line from T1.L3.start left_ dimen_*2/3
+RF: dot(,,1); "RF" at RF.w rjust
+ line from T1.L3.end left_ del; corner; ground(,,F)
+
+ line down_ del/2 from T1.L1.start then right_ del
+ reversed(`capacitor',right_ dimen_,C); llabel(,0.1 svg_micro`'F)
+BT: dot(at Here)
+ line up_ del/2 from T1.L2.end then right del
+ reversed(`capacitor',right_ dimen_,C); llabel(,0.1 svg_micro`'F)
+ t = dimen_*7/8
+ line to (BT.x+4*t,Here.y)
+TT: dot
+ line right_ dimen_+del/2; setdir_(U)
+Q1: mosfet(,,dMESDQuB,E) with .G at Here
+ { "Q1" at Q1.Env.ne above ljust }
+ ground(at Q1.S,,F)
+ line right_ del*3/2 from Q1.D then down_ Q1.D.y-T1.L2.end.y
+T2: Xform21 with .L1.start at (Here,T1.L2.end); "T2" at T2.n above ljust
+ dot(at T2.L1.start+(-4bp__,0))
+ dot(at T2.L3.end+(0,4bp__))
+ line from T2.L3.end right_ dimen_*2/3
+IF: dot(,,1); "IF" wid 12bp__ at IF.e ljust
+ setdir_(U)
+Q2: mosfet(,,dMESDQuB,E) at (Q1,T2.s-(0,elen_-del))
+ { "Q2" at Q2.Env.ne above ljust }
+ line from Q2.D to (T2.L2.end,Q2.D) then to T2.L2.end
+ line from Q2.G left_ del/2 then up_ BT.y-Q2.G.y then to BT
+
+ line right_ del from T1.T then down_ T1.T.y-BT.y+del*3/2
+ corner; left_
+ capacitor(to (T1.L3.end-(del,0),Here),C)
+ rlabel(,0.1 svg_micro`'F )
+LOD: dot
+ { line to (RF,Here)
+ dot(,,1); move left_ 4bp__; "local" rjust "oscillator" rjust;
+ move left 50bp__ }
+ line from T2.T left_ to (Q1.S,T2.T)
+T2T: dot
+ { capacitor(down_ to (Here,BT),C); rlabel(,0.1 svg_micro`'F)
+ ground(,T,F) }
+ { line from T2.L3.start right_ del; corner; ground(,,F) }
+Vt: dot(at (0.5 between BT and TT,Q1.Env.nw),,1)
+ { "+V`'svg_sub(CC)" at last [].e ljust }
+ line to (Here,T2T); dot
+ { line to (Here,BT); Cv: capacitor(down_ 3/2*dimen_,C)
+ llabel(10 svg_micro`'F); G: dot; ground(,,F) }
+
+ for s=-1 to 1 by 2 do {{
+ line right s*t; corner
+ resistor(down_ to (Here,BT))
+ if s<0 then { llabel(,5 k`'svg_ohm) } \
+ else { rlabel(,5 k`'svg_ohm)
+ { dot(at last line.start); line to (TT,Here)
+ resistor(right_ to (T2T,Here))
+ llabel(,10 svg_ohm) } }
+ P: potentiometer(down_ Cv.len,,0.5,s*t ) with .Start at Here
+ if s<0 then { "1 k`'svg_ohm" at P. 1st [].ne ljust } \
+ else { "1 k`'svg_ohm" at P. 1st [].sw rjust }
+ dot(at P.End)
+ dot(at P.T1)
+ { L: inductor(up_ to (Here,BT),L);
+ if s<0 then { "100 svg_micro`'H" at last [].sw rjust } \
+ else { line to TT
+ "100 svg_micro`'H" at last [].ne ljust below } }
+ capacitor(down_ to (Here,G),C)
+ if s<0 then { rlabel(,0.1 svg_micro`'F) } \
+ else { llabel(,0.1 svg_micro`'F) }
+ dot }}
+
+ resistor(down_ from LOD to (LOD,G)); llabel(,51 svg_ohm); corner
+ line to (Q2.S,Here) then to Q2.S
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MotorControlSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MotorControlSVG.m4
new file mode 100644
index 00000000000..7a27d4b4d32
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MotorControlSVG.m4
@@ -0,0 +1,58 @@
+.PS
+# MotorControl.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+ trad = 2.5*dotrad_
+define(`bigterminal',`circle rad trad')
+
+ mrad = linewid*2/3
+Motor: circle rad mrad "Motor"
+
+ linethick = 2
+ T2: Motor.n+(0,dimen_/2)
+
+ for i=1 to 3 do {
+ if i==2 then { line from Motor.n to T2 } \
+ else { line from Motor right (i-2)*Motor.diam chop Motor.rad chop 0 \
+ then up T2.y-Motor.y }
+ bigterminal
+ cbreaker(up_ dimen_*3/4,,T)
+ bigterminal
+ line up_ dimen_
+ bigterminal
+ capacitor(up_ dimen_*1.2,,,dimen_/3,dimen_/6)
+ { circle fill_(1) rad dotrad_*3/2 thick 0.8 \
+ at 0.25 between last line.end and last line.start }
+ if i==1 then { L1: last circle } \
+ else { if i==2 then { L2: last circle }}
+ bigterminal
+ line up_ dimen_/4
+ }
+ linethick_(0.8)
+ C2: circle rad mrad/3 at Motor.n+ (0,dimen_*2)
+ line from C2.e right_ dimen_/3 then up C2.rad*1.5
+ line to (L1.x-dimen_/2,Here.y)
+ {S23: capacitor(up_ dimen_*2/3 from (L1.x-dimen_/2,Here.y),,,
+ dimen_/3,dimen_/6); dot(,,1) }
+ dot(,,1)
+ line to (L1.x-dimen_*2,Here.y) chop dotrad_ chop 0 then up dimen_/3
+ S1: [ bswitch(right_ dimen_/2) ] with .Bsw_T1.s at Here
+ S2: [ bswitch(right_ dimen_/2,,C) ] at S1+(0,-dimen_)
+ line right dimen_/6 down dimen_/6 from S1.Bsw_T2.se \
+ then down S1.Bsw_T2.se.y-S2.Bsw_T2.ne.y-dimen_/3 \
+ then to S2.Bsw_T2.ne
+ box wid S1.wid+dimen_/2 ht S1.n.y-S2.s.y+dimen_/3 \
+ at 0.5 between S1.s and S2.n
+ line left dimen_/2 from S23.end chop dotrad_ chop 0; corner
+ line to (Here,S1.Bsw_T2) then to S1.Bsw_T2.e
+ line from S2.Bsw_T1.w left dimen_/2; corner
+ line to (Here,L1) then to L1 chop 0 chop dotrad_
+
+ dot(at 0.5 between L1 and L2,,1)
+ { line to L2 chop dotrad_ }
+ S45: variable(`capacitor(down_ dimen_*2/3 chop dotrad_ chop 0,,,
+ dimen_/3,dimen_/6)',L,,dimen_/2); dot(,,1)
+ line to (Here,C2) then to C2.w chop dotrad_ chop 0
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MultiplexerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MultiplexerSVG.m4
new file mode 100644
index 00000000000..aba528b33bf
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/MultiplexerSVG.m4
@@ -0,0 +1,43 @@
+.PS
+# MultiplexerSVG.m4
+log_init
+
+# Font
+ textht = textht*0.8
+ command "<g font-size=\"50%\" font-family=\"Helvetica\">"
+ right_
+
+ Mux(4,M1)
+ "`Mux'(4,M1)" at last [].s below
+ "svg_it(In0)" at last [].In0.end rjust wid 14bp__
+ "svg_it(In1)" at last [].In1.end rjust
+ "svg_it(In2)" at last [].In2.end rjust
+ "svg_it(In3)" at last [].In3.end rjust
+ "svg_it(Out)" at last [].Out.end above
+ "svg_it(Sel)" at last [].Sel.end ljust above
+
+ left_; Mux(4,,LNOE) with .c at last [].c+(0.9,0)
+ { line right 8bp__ at last [] . 1nd last ""+(-10bp__,4bp__) }
+ "`left_; Mux'(4,,LNOE)" at last [].s +(0,-20bp__)
+ "svg_it(In0)" at last [].In0.end above
+ "svg_it(NOE)" at last [].NOE.end +(4bp__,0) below
+ "svg_it(Out)" at last [].Out.end below
+ "svg_it(Sel)" at last [].Sel.end rjust below
+
+ right_; Mux(4,,OEBN2) with .c at last [].c+(1.4,0)
+ "`Mux'(4,,OEBN2)" at last [].s below
+ "svg_it(Sel0)" at last [].Sel0.end rjust
+ "svg_it(Sel1)" at last [].Sel1.end ljust
+ "svg_it(In0)" at last [].In0.end rjust
+ "svg_it(In3)" at last [].In3.end rjust
+ "svg_it(OE)" at last [].OE.end rjust
+
+ down_; Mux(8,,L3,,28*L_unit) with .c at last [].c+(1.7,0)
+ "`down_; Mux'(8,,L3,,28*L_unit)" at last [].s below wid 162bp__
+ "svg_it(Sel0)" at last [].Sel0.end rjust
+ "svg_it(Sel2)" at last [].Sel2.end rjust below
+ "svg_it(In0)" at last [].In0.end rjust
+ "svg_it(In7)" at last [].In7.end ljust wid 14bp__
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NLGSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NLGSVG.m4
new file mode 100644
index 00000000000..987e2911fb1
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NLGSVG.m4
@@ -0,0 +1,21 @@
+.PS
+# NLG.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+ define(`nullor',`nport(`$1'
+ {`"0"' at Box.w ljust
+ `"oo"' at Box.e rjust},shift($@))')
+
+N: nullor
+`"nullor"' at last [].s+(0,-3pt__) below
+G: gyrator with .sw at N.se+(0.5,0)
+`"gyrator"' at G.s+(0,-3pt__) below
+I: gyrator(invis,,0,N) with .w at G.e+(0.5,0)
+`"gyrator(invis,,0,N)"' at I.s
+V: gyrator(invis wid boxht,,0,NV) with .w at I.e+(1,0)
+`"gyrator(invis wid boxht,,0,NV)"' wid 2 at V.s+(0,-3pt__) below
+
+ move right 0.9
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NPDTSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NPDTSVG.m4
new file mode 100644
index 00000000000..3702d025501
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NPDTSVG.m4
@@ -0,0 +1,41 @@
+.PS
+# `NPDT.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+ movewid = 1.0
+
+ NPDT
+ {move left 0.1 from last [].w}
+ { "svg_it(R)" at last [].R.s below
+ "svg_it(T)" at last [].T.s below
+ "svg_it(L)" at last [].L.s below }
+ { `"NPDT"' at last [].s +(0,-0.22) }
+
+ up_; NPDT with .sw at last[].se+(0.5,0)
+ { "svg_it(R)" wid 8pt__ at last [].R.e ljust
+ "svg_it(T)" at last [].T.e ljust
+ "svg_it(L)" at last [].L.e ljust }
+ { `"up_; NPDT"' at last [].s +(0.1,-0.15) }
+ right_
+
+ NPDT(2) with .w at last [].e+(0.75,0)
+ { for_(1,2,1,
+ `"svg_it(R`'m4x)" at last [].R`'m4x.e ljust
+ "svg_it(L`'m4x)" wid 11pt__ at last [].L`'m4x.w rjust') }
+ { `"NPDT(2)"' at last [].s +(0,-0.15) }
+ move
+
+ NPDT(3,R)
+ { for_(1,3,1,
+ `"svg_it(R`'m4x)" at last [].R`'m4x.e ljust
+ "svg_it(L`'m4x)" wid 11pt__ at last [].L`'m4x.w rjust') }
+ { `"NPDT(3,R)"' at last [].s below }
+
+ left_; NPDT(2,R) with .w at last [].e+(1.0,0)
+ { for_(1,2,1,
+ `"svg_it(R`'m4x)" at last [].R`'m4x.w rjust
+ "svg_it(L`'m4x)" wid 11pt__ at last [].L`'m4x.e ljust') }
+ { `"left_; NPDT(2,R)"' wid 90bp__ at last [].s +(0,-0.15) }
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Np.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Np.m4
new file mode 100644
index 00000000000..e0ae4fb6bbf
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/Np.m4
@@ -0,0 +1,20 @@
+.PS
+svg_font(sans-serif,9bp__)
+
+B: box invis wid 6 ht 2
+"`nport(box specs; other commands,nw,nn,ne,ns,space ratio,pin lgth,style,other commands)" \
+ ljust at B.w \
+"" ljust \
+"Default is a twoport the size of a normal box." ljust \
+"Args 2 to 5 are the number of ports to be drawn on w, n, e, s sides." ljust \
+"" ljust \
+"The port pins are named by side, number, and by a or b pin," ljust \
+"e.g. W1a, W1b, W2a, ... . Arg 6 specifies the ratio of" ljust \
+"port width to interport space, and arg 7 is the pin length." ljust \
+"" ljust \
+"Set arg 8 to N to omit the dots on the port pins" ljust \
+"Arguments 1 and 9 allow customizations'" ljust
+
+svgLink(NportSVG.svg,"&lt;- back" ljust at last box.sw above ljust,B)
+command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NportSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NportSVG.m4
new file mode 100644
index 00000000000..be0aab19c0c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/NportSVG.m4
@@ -0,0 +1,47 @@
+.PS
+# `NportSVG.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+textoffset = 2bp__
+Twoport: nport
+
+ "W1a" wid 0.35 above rjust at Twoport.W1a
+ "W1b" below rjust at Twoport.W1b
+ "E1a" above ljust at Twoport.E1a
+ "E1b" below ljust at Twoport.E1b
+
+#Nport: nport(wid 1 ht 1.5 fill_(0.9) svgLinkString(Np.svg,n-port,B),1,2,3,4) \
+# with .Box.w at Twoport.Box.e+(1.0,0)
+Nport: nport(wid 1.75 ht 1 fill_(0.9),1,2,3,4) \
+ with .Box.w at Twoport.Box.e+(1.25,0)
+ svgLink(Np.svg,"n-port" at Nport,B)
+
+ "W1a" rjust at Nport.W1a
+ "W1b" rjust at Nport.W1b
+
+ "E1a" ljust at Nport.E1a
+ "E3b" ljust at Nport.E3b
+
+ "N1a" above at Nport.N1a.n
+ "N1b " above at Nport.N1b.n
+ " N2a" above at Nport.N2a.n
+ "N2b" above at Nport.N2b.n
+
+ "S1a" below at Nport.S1a.s
+ "S4b" below at Nport.S4b.s
+
+ "..." at 0.5<Nport.S1a,Nport.S4b>+(0,-0.10)
+ "..." at 0.5<Nport.E1a,Nport.E3b>+(0.15,0.05)
+
+Nterm: nterm with .Box.w at Nport.Box.e+(1.0,0)
+ "W1" rjust at Nterm.W1
+ "E1" wid 0.2 ljust at Nterm.E1
+ "S1" below at Nterm.S1.s
+
+ `"nport"' at Twoport.s+(0,-0.3)
+ `"nport(wid 1.5 ht 1.75 fill_(0.9),1,2,3,4)"' ljust at Nport.sw+(0,-0.3)
+ `"svgLink(Np.svg,\"n-port\" at Nport,B)"' ljust at Nport.sw+(0,-0.5)
+ `"nterm"' at Nterm.s+(0,-0.3)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OpampSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OpampSVG.m4
new file mode 100644
index 00000000000..65ea9233b07
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OpampSVG.m4
@@ -0,0 +1,35 @@
+.PS
+# Opamp.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+ A: opamp
+ thinlines_
+ "`opamp'" at A.s-(0,0.25)
+ "Out" below at A.Out
+ spline <- from A.In1 left 0.1 then up 0.1 left 0.1
+ "In1" wid 0.25 rjust above
+ spline <- from A.In2 left 0.1 then down 0.1 left 0.1
+ "In2" rjust below
+ arrow <- up 0.1 right 0.1 from A.E1
+ "E1" ljust above
+ arrow <- down 0.1 right 0.1 from A.E2
+ "E2" ljust below
+ thicklines_
+ Point_(15)
+ B: opamp(,,,,PR) with .sw at A.se+(0.65,0)
+ thinlines_
+ "`Point_(15); opamp(,,,,PR)'" at B.s-(0,0.25)
+ spline <- right arrowht up arrowht from B.V1 then right 0.1
+ "V1" ljust
+ spline <- right arrowht down arrowht from B.V2 then right 0.1
+ "V2" ljust
+ thicklines_
+ Point_(90)
+ C: opamp with .sw at B.se+(1.05,0)
+ "`Point_(90); opamp'" at C.s-(0,0.25)
+ right_
+ D: opamp(,,,,T) with .sw at C.se+(0.65,0)
+ "`opamp(,,,,T)'" wid 0.75 at D.s-(0,0.25)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OptoisoSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OptoisoSVG.m4
new file mode 100644
index 00000000000..b99e096c5a7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/OptoisoSVG.m4
@@ -0,0 +1,64 @@
+.PS
+# OptoisoSVG.m4
+cct_init(svg_font(sans-serif,11bp__,3bp__))
+movewid = 0.25
+
+# `optoiso([L|R][A|B|C])'
+define(`optoiso',`ifinstr(`$1',C,
+`[{ u = dimen_
+ hd = u/5
+ Q: bi_tr(up hd*4,ifinstr(`$1',R,R))
+ line from Q.E ifinstr(`$1',R,left,right)(hd+u/3); Pin4: dot(,,1)
+ line from Q.C to (Pin4,Q.C); Pin5: dot(,,1)
+ T: (Q.B,Pin5)+(0,4*hd)
+ line from Q.B to T then to (Pin5,T); Pin6: dot(,,1)
+ D: diode(from Pin6 +(ifinstr(`$1',R,+,-)(u/3+hd*8),0) down hd*4)
+ line from D.start ifinstr(`$1',R,right,left) (hd*2+u/3); Pin1: dot(,,1)
+ line from D.end to (Pin1,D.end); Pin2: dot(,,1)
+ line from (D.end,Pin4) to (Pin1,Pin4) chop hd chop 0; Pin3: dot(,,1)
+ B: box wid hd*10 ht hd*10 with .c at 0.5 between Pin4 and Pin1
+ arrow from B.c+(ifinstr(`$1',R,,-)hd*1.5,hd*1.5) to B.c chop 0 chop -0.7*hd
+ F: (ifinstr(`$1',R,,-)hd*0.5,-hd*0.5)
+ arrow from last arrow.start+(F.x,F.y) to last arrow.end+(F.x,F.y)
+ `$2' }]',
+`[{u = dimen_/2
+ Q: bi_trans(up u*2,ifinstr(`$1',R,R),ifinstr(`$1',B,B)CBUdE)
+ E: Q.E; C: Q.C; A:ifinstr(`$1',R,Q.e+(u*3/2,u),Q.w+(-u*3/2,u)); K: A-(0,u*2)
+ ifinstr(`$1',B,line from Q.B to (Q.B,E); B: Here)
+ D: diode(from A to K)
+ arrow from D.c+(0,u/6) to Q.ifinstr(`$1',R,e,w)+(0,u/6) chop u/3 chop u/4
+ arrow from last arrow.start-(0,u/3) to last arrow.end-(0,u/3)
+ Enc: box rad u wid abs(C.x-A.x)+u*2 ht u*2 with .c at 0.5 between C and K
+ `$2' }]')')
+
+define(`optlabels',
+ `{"svg_it(C)" ht 0.1 at last [].C above
+ "svg_it(E)" at last [].E below
+ ifinstr(`$1',B,`"svg_it(B)" at last [].B below')
+ "svg_it(A)" at last [].A above
+ "svg_it(K)" at last [].K below}')
+
+Q: optoiso; optlabels; move
+ {`"optoiso"' at last [].s+(0,-0.22)}
+ optoiso(Rightorientation); optlabels; move
+ {`"optoiso(R)"' at last [].s+(0,-0.22)}
+ optoiso(B); optlabels(B); move
+ {`"optoiso(B)"' at last [].s+(0,-0.22)}
+ optoiso(RB); optlabels(B)
+ {`"optoiso(RB)"' at last [].s+(0,-0.22)}
+
+R: optoiso(C) with .nw at Q.sw+(0.33,-0.75); move 1
+{"svg_it(1)" at R.Pin1 rjust; "svg_it(2)" at R.Pin2 rjust
+ "svg_it(3)" wid 0.3 at R.Pin3 rjust}
+{"svg_it(4)" at R.Pin4 ljust; "svg_it(5)" at R.Pin5 ljust
+ "svg_it(6)" at R.Pin6 ljust }
+{`"optoiso(C)"' at R.s below }
+S: optoiso(RC)
+{"svg_it(1)" at S.Pin1 ljust; "svg_it(2)" at S.Pin2 ljust
+ "svg_it(3)" at S.Pin3 ljust }
+{"svg_it(4)" at S.Pin4 rjust; "svg_it(5)" at S.Pin5 rjust
+ "svg_it(6)" wid 0.3 at S.Pin6 rjust }
+{`"optoiso(RC)"' at S.s below }
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PconnSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PconnSVG.m4
new file mode 100644
index 00000000000..066d397ca25
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PconnSVG.m4
@@ -0,0 +1,51 @@
+.PS
+# `PconnSVG.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+P1: [
+ C1: pconnex(,A)
+ thinlines_
+ arrow <- left 0.2 from C1.H.w; "svg_it(H)" wid 10bp__ rjust
+ thicklines_
+ `"pconnex(,A)"' at last [].s below
+ C2: pconnex(,AF) with .w at C1.e+(0.3,0)
+ thinlines_
+ arrow <- right 0.2 up 0.1 from C2.H.e; "svg_it(H)" ljust
+ N: box invis wid (C2.w.x-C1.e.x)/2 ht C1.N.ht \
+ with .n at 0.5 between C1.ne and C2.nw "svg_it(N)"
+ arrow from N.w to C1.N.e
+ arrow from N.e to C2.N.w
+ G: box invis wid N.wid ht N.ht with .n at (N,C1.N.s) "svg_it(G)"
+ arrow from G.w to C1.G.e
+ arrow from G.e to C2.G.w
+ `"(,AF)"' at last [].s below
+ C03: pconnex(,AC) with .w at C2.e+(0.2,0)
+ `"(,AC)"' at last [].s below
+ C3: pconnex(,ACF) with .w at last [].e+(0.2,0)
+ `"(,ACF)"' at last [].s below
+
+ C4: pconnex(,P) with .w at last [].e+(0.2,0)
+ `"(,P)"' at (C4,last "") below
+ C5: pconnex(U,D) with .w at last [].e+(0.2,0)
+ `"(U,D)"' at last [].s below
+ C6: pconnex(U,DF) with .w at last [].e+(0.2,0)
+ `"(U,DF)"' at last [].s below
+ C7: pconnex(U,J) with .w at last [].e+(0.2,0)
+ `"(U,J)"' at last [].s below
+ C8: pconnex(U,JF) with .w at last [].e+(0.2,0)
+ `"(U,JF)"' wid 21bp__ at last [].s below
+ ]
+
+P2: [
+ C9: pconnex(,G)
+ `"(,G)"' at last [].s below
+ C91: pconnex(,GF) with .w at last [].e+(0.2,0)
+ `"(,GF)"' at last [].s below
+ C92: pconnex(L,GF) with .w at last [].e+(0.2,0)
+ `"(L,GF)"' at last [].s below
+ C10: pconnex(,GC) with .w at last [].e + (0.2,0)
+ `"(,GC)"' at last [].s below
+] with .nw at P1.C1.sw + (0,-0.25)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PushPullSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PushPullSVG.m4
new file mode 100644
index 00000000000..775b9de966c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/PushPullSVG.m4
@@ -0,0 +1,108 @@
+.PS
+# `PushPullSVG.m4'
+cct_init(svg_font(sans-serif,10bp__,1bp__))
+
+linewid = 1.2*linewid
+
+# Transformer as for Mixer.m4
+define(`Xform21',
+ `[ L1: inductor(to rvec_(dimen_*0.5,0),,,M)
+ Core1E: M4Core1.end; Core2E: M4Core2.end
+ D: (0.5 between M4Core1 and M4Core2) - L1
+ T: line to rvec_(dimen_/3,0); { dot(at T.c) }
+ L2: inductor(to rvec_(L1.len,0),,,M)
+ line from M4Core1.start to Core1E
+ line from M4Core2.start to Core2E
+ L3: inductor(to rvec_(-L1.len,0) with .c at T+(D.x*2,D.y*2),) ]')
+
+ del = dimen_/3
+ up_
+ T1: Xform21
+ line left_ del from T1.L3.end; corner; ground(,,F)
+ line left_ 2*del from T1.L3.start
+ In: dot(,,1); { "RF" wid 12bp__ at In.n above }
+ up_
+ Q1: mosfet(,,dBSDFQM1,E) with .G0 at T1.T+(2*dimen_+del/2,dimen_)
+ { "3N200" at last [].n above }
+ line from T1.L2.end to (T1.L2.end,Q1.G0) then to Q1.G0
+ Q2: mosfet(,,dBSDFQM1,E) with .G0 at (Q1.G0.x,T1.T.y-dimen_)
+ { "3N200" at last [].n above }
+ line from T1.L1.start to (T1.L1.start,Q2.G0) then to Q2.G0
+
+ resistor(right_ dimen_ from T1.T); llabel(,330`'svg_ohm); Tx:dot
+ { line right_ del*3/2; corner; ground(,,F) }
+ dot(at (Tx,Q1.G0))
+ capacitor(down_ to Tx,C); llabel(5.6pF)
+ dot(at (Tx,Q2.G0))
+ capacitor(up_ to Tx,C); rlabel(5.6pF)
+
+ for_(1,2,1,
+ `dot(at Q`'m4x.S+(dimen_+del/2,0))
+ { resistor(down_ dimen_); G1:Here;
+ { "120" at last [].w rjust "svg_ohm" rjust }
+ dot; ground(,,F) }
+ line from Q`'m4x.S to (Here.x+dimen_*3/4,Q`'m4x.S.y); corner
+ capacitor(down_ to (Here,G1),C)
+ { "1000" at last [].w rjust "pF" rjust }
+ corner
+ line left_ 2*dimen_*3/4; corner
+ TG: dot(at (Here,Q`'m4x.S))
+ capacitor(down_ to (Here,G1),C); rlabel(,0.01 svg_micro(F))
+ ')
+
+ R: dot(at (Here.x+dimen_*2,(Q1.D.y+Q2.D.y)/2))
+ dot(at (R,Q1.D)); capacitor(down_ to R,C); llabel(20pF)
+ dot(at (R,Q2.D)); capacitor(up_ to R,C); llabel(20pF)
+ line right_ del*3/2 from R then down_ R.y-(Q1.S.y-dimen_); ground(,,F)
+
+ Vc: dot(at (R+(dimen_,0),Q1.ne),,1); { "+Vc" rjust at Vc.w }
+ dot(at (Vc,R))
+ inductor(right_ dimen_,); llabel(,1 svg_micro(H))
+ down_
+ T2: Xform21 with .T at Here
+ arrow from T2.L2 to T2.L3 chop -dimen_/4
+ line right_ del from T2.L3.start; corner
+ capacitor(down_ dimen_,C); llabel(1000 pF); ground(,T,F)
+ line right_ 2*del from T2.L3.end
+ Out: dot(,,1); { "IF" wid 12bp__ at Out.n above }; move right_ 0.3
+
+ line from T2.L1.start to (T2.L1,Q1.D) then to Q1.D
+ line from T2.L2.end to (T2.L2.end,Q2.D) then to Q2.D
+
+ line from Vc to (Vc,Q2.S) chop dotrad_/2 chop 0; dot
+ { line right_ del*2; corner
+ capacitor(down_ dimen_,C); llabel(,1000 pF); ground(,,F) }
+ reversed(`inductor',down_ dimen_,); rlabel(,1 svg_micro(H))
+ line down_ dimen_/2
+
+ TL: dot(at (Q1.G1.x-del/2,Here.y))
+ up_
+ Q3: bi_tr(,R,,E) with .C at (TG.x,TL.y-dimen_*2/3)
+ resistor(right_ from TL to (Q3.C,TL)); llabel(,82 k`'svg_ohm)
+ line to (Vc,Here); dot
+ resistor(down_ to (Here,Q3.B)); rlabel(,8.2 k`'svg_ohm); dot
+ dot(at Q3.B+(del,0))
+ line up_ (TL.y+Q3.C.y)/2 - Here.y+del/4 then left_ Here.x-TL.x
+ reversed(`capacitor',left_ dimen_,C); llabel(,1500 pF)
+ Osc: dot(,,1); { "Osc" above at Osc.n }
+
+ line from Q3.B to (Vc,Q3.B)
+ line from Q3.C to (Q3.C,TL); dot
+ dot(at Q3.C+(0,del/2))
+ capacitor(left_ to (TL,Here),C); llabel(,1500 pF); dot
+ line down_ del/2 from Q3.E; dot
+ { resistor(down_ dimen_*3/4); rlabel(,820`'svg_ohm)
+ G: Here; ground(,T,F) }
+ line right_ dimen_; corner
+ capacitor(down_ to (Here,G),C); llabel(,1000 pF)
+ ground(,T,F)
+ ground(at (TL,G),T,F)
+ resistor(up_ dimen_); llabel(,12 k`'svg_ohm)
+ line to (Here,Q1.G1) then to Q1.G1
+ line from Q2.G1 to (TL,Q2.G1); dot
+
+ ground(at (Vc,G),T,F)
+ resistor(up_ dimen_); rlabel(,5.6 k`'svg_ohm); line to (Here,Q3.B)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/QuantumSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/QuantumSVG.m4
new file mode 100644
index 00000000000..863c3ac857a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/QuantumSVG.m4
@@ -0,0 +1,31 @@
+.PS
+# QuantumSVG.m4
+gen_init
+
+ boxht = 0.35
+ boxwid = boxht
+ define(`dotrad_',boxht/5)
+
+define(`Bus',`line right_ 10*boxwid `$1'
+ circle diam boxht `$2' at last line.start
+ box fill_(1) "H" at last line.start+(boxwid*3/2,0)
+ box fill_(1) "H" at last line.end-(boxwid*2.5,0) ')
+
+define(`Meter',`[ Box: box wid boxwid*3/2 fill_(1)
+ r = Box.wid/3
+ C: 0.3 between Box.s and Box.n
+ arc cw from C+(-r,0) to C+(r,0) with .c at C
+ arrow from C+(-r/4,0) to C+(0.9*r,0.9*r) ]')
+
+X: Bus(,shaded rgbstring(0.5,0.5,1) "X")
+A1: Bus(from X.start+(0,-boxht*3/2), shaded "red" "A")
+A2: Bus(from 2 between X.start and A1.start, shaded "red" "A")
+ dot(at X.start+(3*boxwid,0))
+ line to (Here,A2); dot
+ circle rad dotrad_ at A1.start+(4*boxwid,0)
+ line from last circle.s to (last circle,X); dot
+ Meter with .e at X.end
+ box wid boxwid*1.2 ht boxht*1.2 fill_(1) at A2.end-(4.5*boxwid,0) \
+ "svg_it(R)svg_sub(svg_psi)svg_sup(svg_pi/2,,,-1.2ex)"
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RectifiersSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RectifiersSVG.m4
new file mode 100644
index 00000000000..3329094082c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RectifiersSVG.m4
@@ -0,0 +1,189 @@
+.PS
+# RectifiersSVG.m4
+cct_init(svg_font(Times,11bp__))
+
+ tmax = 3.5
+ period = tmax/1.75
+ eamp = 0.5
+ omega = twopi_/period
+ ed = eamp/6
+ r = 0.95
+
+# For DC voltages
+ ted = asin(ed/eamp)/twopi_*period
+ npts = 40; sum = 0
+ for i=0 to npts do {
+ t = ted+(period/2-2*ted)*i/npts
+ sum += (eamp*cos(omega*t-pi_/2) - ed)*r }
+
+define(`Sine',`Cosine(eamp,omega,`$1',-pi_/2)')
+define(`axis',`line thick 0.4 right tmax chop -tmax*0.04 chop 0')
+
+Threephase: [ linethick_(1)
+ Ai: axis ; "N`'svg_sub(o)" ljust
+ move right 0.3 from Ai.end
+ EOrig: Ai.start+(tmax*0.04,0)
+ E1: sinusoid(eamp,omega,-pi_/2,-ted,tmax) with .Origin at EOrig
+ E2: sinusoid(eamp,omega,-pi_/2-twopi_/3,-ted,tmax) with .Origin at EOrig
+ E3: sinusoid(eamp,omega,-pi_/2+twopi_/3,-ted,tmax) with .Origin at EOrig
+ "e`'svg_sub(1)" at EOrig+(period/3,eamp*0.8) ljust above
+ "e`'svg_sub(2)" at EOrig+(2*period/3,eamp*0.8) ljust above
+ "e`'svg_sub(3)" at EOrig+(period,eamp*0.8) ljust above
+
+ Ad: axis with .end at Ai.end+(0,-eamp*2.1); "N`'svg_sub(o)" ljust
+ DOrig: Ad.start+(tmax*0.04,0)
+ Id: axis with .end at Ad.end+(0,-eamp*1.2); "0" ljust
+ IOrig: Id.start+(tmax*0.04,0)
+
+ for i=1 to 11 by 2 do {
+ tl = max(0,period/2-i*period/6)
+ tr = min(period/2,tmax-(i*period/6-period/2))
+ sinusoid(eamp,omega,-pi_/2,tl,tr,thick 0.4 dashed) \
+ with .Origin at DOrig+(i*period/6-period/2,0)
+ tl = max(period/12,-(i*period/6-period/2+period/12) )
+ tr = period/2-period/12
+ S1: sinusoid(eamp*r,omega,-pi_/2,tl,tr) \
+ with .Origin at DOrig+(i*period/6-period/2,0)+(0,-ed*r); round(at S1.End)
+ S2: sinusoid(eamp*r,omega,-pi_/2,tl,tr) \
+ with .Origin at IOrig+(i*period/6-period/2,0)+(0,-ed*r); round(at S2.End)
+ }
+ "e`'svg_sub(1)" at DOrig+(period/3,eamp*0.8) ljust above
+ "e`'svg_sub(2)" at DOrig+(2*period/3,eamp*0.8) ljust above
+ "e`'svg_sub(3)" at DOrig+(period,eamp*0.8) ljust above
+
+ "e`'svg_sub(L)" at DOrig+(period/4,eamp*0.8) below
+ "i`'svg_sub(L)" at IOrig+(period/6,eamp*0.6) rjust above
+
+ vEd = r*eamp*cos(pi_/12)/(5*pi_/12) - r*ed
+ VEd: axis with .end at Ad.end+(0,vEd); "E`'svg_sub(D)" ljust
+ IEd: axis with .end at Id.end+(0,vEd); "I`'svg_sub(D)" ljust
+ ]
+
+Cct3:[
+ No: dot; {"N`'svg_sub(o)" below rjust }
+ { inductor(to Here+(Rect_(dimen_,60)),W); E2: "e`'svg_sub(2)" ljust }
+ { inductor(to Here+(Rect_(dimen_,-60)),W); E3: "e`'svg_sub(3)" ljust }
+ { inductor(from No-(dimen_,0) to No,W)
+ E1: "e`'svg_sub(1)" above at last line.start }
+ D3: diode(down_ from E3); b_current(i`'svg_sub(3),rjust)
+ llabel(,,D`'svg_sub(3))
+ line from E1 to (E1,D3.start)
+ D1: diode(down_); b_current(i`'svg_sub(1),rjust); llabel(,,D`'svg_sub(1))
+ line from E2 left E2.x-E1.x+dimen_/3 then down E2.y-E3.y \
+ then to 0.5 between D1.start and D3.start
+ D2: diode(down_); b_current(i`'svg_sub(2),rjust); llabel(,,D`'svg_sub(2))
+ { line from D1.end to D3.end }
+ dot
+ arrowline(down elen_/2); rlabel(,i`'svg_sub(L))
+ resistor(right_ elen_); rlabel(+,e`'svg_sub(L),-); llabel(,R)
+ line to (Here,No) then to No
+ ] with .e at Threephase.w-(0.5,0)
+ move left 0.2 from Cct3.w
+
+Fullwave: [
+ linethick_(1)
+ Ai: axis ; "N`'svg_sub(o)" ljust
+ EOrig: Ai.start+(tmax*0.05,0)
+ E1: sinusoid(eamp,omega,-pi_/2,-ted,tmax) with .Origin at EOrig
+ "e`'svg_sub(1)" at EOrig+(period/3,eamp*0.8) ljust above
+ E2: sinusoid(eamp,omega, pi_/2,-ted,tmax) with .Origin at EOrig
+ "e`'svg_sub(2)" at EOrig+(period*5/6,eamp*0.8) ljust above
+
+ Ad: axis with .end at Ai.end+(0,-eamp*2.1); "N`'svg_sub(o)" ljust
+ DOrig: Ad.start+(tmax*0.05,0)
+ Id: axis with .end at Ad.end+(0,-eamp*1.2); "0" ljust
+ IOrig: Id.start+(tmax*0.05,0)
+
+ for i=0 to 3 do {
+ if i<3 then { tf = period/2 } else { tf = Ad.end.x-(DOrig.x+3*period/2) }
+ sinusoid(eamp,omega,-pi_/2,0,tf,thick 0.4 dashed) \
+ with .Origin at DOrig+(i*period/2,0)
+ line from DOrig+(i*period/2-ted,0) right 2*ted
+ line from IOrig+(i*period/2-ted,0) right 2*ted
+ if i<3 then {tf = period/2-ted } else {tf = Ad.end.x-(DOrig.x+3*period/2) }
+ Ed: sinusoid(eamp*r,omega,-pi_/2,ted,tf) \
+ with .Origin at DOrig+(i*period/2,-ed*r)
+ Ed: sinusoid(eamp*r,omega,-pi_/2,ted,tf) \
+ with .Origin at IOrig+(i*period/2,-ed*r)
+ }
+ "e`'svg_sub(1)" at DOrig+(period/6,eamp*0.9) rjust above
+ "e`'svg_sub(2)" at DOrig+(period/6+period/2,eamp*0.9) rjust above
+ "e`'svg_sub(L)" at DOrig+(period/4,eamp*0.8) below
+ "i`'svg_sub(L)" at IOrig+(period/6,eamp*0.6) rjust above
+
+ vEd = sum/(period/2/(period/2-2*ted)*npts)
+ VEd: axis with .end at Ad.end+(0,vEd); "E`'svg_sub(D)" ljust
+ IEd: axis with .end at Id.end+(0,vEd); "I`'svg_sub(D)" ljust
+ ] with .sw at Threephase.nw+(0,0.5)
+
+Cct2:[
+ T: transformer(right_ elen_,R,8,AW,8)
+ line up elen_/2 from T.P1
+ gap(right_ elen_)
+ { sinusoid(0.08,omega*8,-pi_/2,0,twopi_/(omega*8)) with .c at last [] }
+ line to T.P2
+ line from T.S1 to (T.P1,T.S1) then down elen_/2
+ D1: diode(down_ elen_*3/4); rlabel(,D`'svg_sub(1))
+ line from T.S2 to (T.P2,T.S2) then to (T.P2,D1.start)
+ D2: diode(down_ elen_*3/4); rlabel(,D`'svg_sub(2))
+ corner; line to D1.end; corner
+ dot(at 0.5 between D1.end and D2.end)
+ arrowline(down elen_/2); rlabel(,i`'svg_sub(L))
+ resistor(right_ elen_); rlabel(+,e`'svg_sub(L),-); llabel(,R)
+ line to (Here,T.TS)-(0,elen_/2) then left Here.x-T.TS.x then to T.TS
+ {"N`'svg_sub(o)" at T.TS-(0,elen_/2) below }
+ thinlines_
+ move to T.TS-(0,0.1)
+ { arrow to (T.P1,Here) chop 0.05 "e`'svg_sub(1)" below }
+ { arrow to (T.P2,Here) chop 0.05 "e`'svg_sub(2)" below }
+ linethick_(1)
+ ] at (Cct3,Fullwave)
+
+Halfwave: [
+ linethick = 1
+ Ai: axis ; "N`'svg_sub(o)" ljust
+ EOrig: Ai.start+(tmax*0.05,0)
+ Ei: sinusoid(eamp,omega,-pi_/2,0,tmax) with .Origin at EOrig
+ "e`'svg_sub(i)" at EOrig+(period/3,eamp*0.8) ljust above
+
+ Ad: axis with .end at Ai.end+(0,-eamp*1.75); "N`'svg_sub(o)" ljust
+ DOrig: Ad.start+(tmax*0.05,0)
+ sinusoid(eamp,omega,-pi_/2,0,period/2,thick 0.4 dashed) with .Origin at DOrig
+ sinusoid(eamp,omega,-pi_/2,0,period/2,thick 0.4 dashed) \
+ with .Origin at DOrig+(period,0)
+ "e`'svg_sub(i)" at DOrig+(period/5,eamp*0.9) rjust above
+
+ line from Ad.start to DOrig+(ted,0)
+ Ed: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \
+ with .Origin at DOrig+(0,-ed*r)
+ "e`'svg_sub(L)" at DOrig+(period/3,eamp*0.6) below
+ line from Ed.End right period/2+2*ted
+ Ed2: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \
+ with .Origin at DOrig+(period,-ed*r)
+ line from Ed2.End to Ad.end
+
+ vEd = sum/(period/(period/2-2*ted)*npts)
+ VEd: axis with .end at Ad.end+(0,vEd); "E`'svg_sub(D)" ljust above
+
+ Id: axis with .end at Ad.end+(0,-eamp*1.0); "0" ljust
+ IOrig: Id.start+(tmax*0.05,0)
+ line from Id.start to IOrig+(ted,0)
+ Sd: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \
+ with .Origin at IOrig+(0,-ed*r)
+ "i`'svg_sub(L)" at IOrig+(period/3,eamp*0.7) above
+ line from Sd.End right period/2+2*ted
+ Sd2: sinusoid(eamp*r,omega,-pi_/2,ted,period/2-ted) \
+ with .Origin at IOrig+(period,-ed*r)
+ line from Sd2.End to Id.end
+ IEd: axis with .end at Id.end+(0,vEd); "I`'svg_sub(D)" ljust above
+ ] with .sw at Fullwave.nw+(0,0.5)
+
+Cct1:[ diode(down_ elen_); b_current(i`'svg_sub(L),rjust,O,E); rlabel(D)
+ resistor(right_ elen_); rlabel(+,e`'svg_sub(L),-); llabel(,R)
+ line up elen_
+ { "N`'svg_sub(o)" ljust below }
+ gap(left_ elen_); rlabel(-,e`'svg_sub(i),+)
+ ] at (Cct3,Halfwave)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RelaySVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RelaySVG.m4
new file mode 100644
index 00000000000..df633176b01
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RelaySVG.m4
@@ -0,0 +1,80 @@
+.PS
+# `Relay.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+{contact
+ {`"contact"' wid 0.8 at last [].s+(0,-0.2)
+ "svg_it(P)" rjust at last [].P.w
+ "svg_it(O)" ljust at last [].O
+ "svg_it(C)" ljust at last [].C }
+ move right_ 1.0; contact(R,)
+ {`"contact(,R)"' at last [].s+(0,-0.2)
+ "svg_it(P)" rjust at last [].P.w
+ "svg_it(O)" ljust at last [].O
+ "svg_it(C)" ljust at last [].C }
+ move right_ 1.0; contact(P)
+ {`"contact(P)"' at last [].s+(0,-0.2)
+ "svg_it(P)" rjust at last [].P.w
+ "svg_it(O)" ljust at last [].O
+ "svg_it(C)" ljust at last [].C }
+ move right_ 1.0; contact(O,); {`"contact(O,)"' at last [].s+(0,-0.2)}
+ move right_ 1.0; contact(C,); {`"contact(C,)"' at last [].s+(0,-0.2)}
+}
+move down 0.8
+right_
+{contact(I)
+ {`"contact(I)"' at last [].s+(0,-0.2)
+ "svg_it(P)" rjust at last [].P.w
+ "svg_it(O)" ljust at last [].O.e
+ "svg_it(C)" ljust at last [].C.e }
+ move right_ 1.0; contact(RI)
+ {`"contact(RI)"' at last [].s+(0,-0.2)
+ "svg_it(P)" rjust at last [].P.w
+ "svg_it(O)" ljust at last [].O.e
+ "svg_it(C)" ljust at last [].C.e }
+ move right_ 1.0; contact(PI)
+ {`"contact(PI)"' at last [].s+(0,-0.2)
+ "svg_it(P)" rjust at last [].P.w
+ "svg_it(O)" ljust at last [].O.e
+ "svg_it(C)" ljust at last [].C.e }
+ move right_ 1.0; contact(OI); {`"contact(OI)"' at last [].s+(0,-0.2)}
+ move right_ 1.0; contact(CI); {`"contact(CI)"' at last [].s+(0,-0.2) wid 1}
+}
+move down 1.3
+right_
+{
+relay
+ {"svg_it(V1)" rjust at last [].V1
+ "svg_it(V2)" ljust at last [].V2
+ "svg_it(P1)" rjust at last [].P1.w
+ "svg_it(O1)" ljust at last [].O1
+ "svg_it(C1)" ljust at last [].C1 }
+`"relay"' at last [].s+(0,-0.2)
+relay(2) with .sw at last [].sw+(1.2,0)
+ {"svg_it(V1)" rjust at last [].V1
+ "svg_it(V2)" ljust at last [].V2
+ "svg_it(P1)" rjust at last [].P1.w
+ "svg_it(O1)" ljust at last [].O1
+ "svg_it(C1)" ljust below at last [].C1
+ "svg_it(P2)" rjust at last [].P2.w
+ "svg_it(O2)" ljust at last [].O2
+ "svg_it(C2)" ljust at last [].C2 }
+`"relay(2)"' at last [].s+(0,-0.2)
+relay(2,RPI) with .sw at last [].sw+(1.2,0)
+ {"svg_it(V1)" rjust at last [].V1
+ "svg_it(V2)" ljust at last [].V2
+ "svg_it(P1)" rjust at last [].P1.w
+ "svg_it(O1)" wid 0.2 ljust at last [].O1.e
+ "svg_it(C1)" wid 0.2 ljust at last [].C1.e+(0,2pt__)
+ "svg_it(P2)" rjust at last [].P2.w
+ "svg_it(O2)" wid 0.2 ljust at last [].O2.e+(0,-2pt__)
+ "svg_it(C2)" wid 0.2 ljust at last [].C2.e }
+`"relay(2,RIP)"' at last [].s+(0,-0.2)
+relay(2,O) with .sw at last [].sw+(1.2,0)
+`"relay(2,O)"' at last [].s+(0,-0.2)
+relay(2,CT) with .sw at last [].sw+(1.2,0)
+`"relay(2,CT)"' at last [].s+(0,-0.2)
+}
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RotboxSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RotboxSVG.m4
new file mode 100644
index 00000000000..a5686ba3939
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/RotboxSVG.m4
@@ -0,0 +1,20 @@
+% Rotbox.m4
+.PS
+gen_init
+#nclude(dpictools.pic)
+
+[
+ Point_(-10)
+ rotbox(boxwid/2,,thick 2)
+ Point_(30)
+ rotbox(,,shaded "green" outlined "blue",r=0.1) at last []+vec_(boxwid,0)
+ "r=0.1" at last []
+ move to last [].ne
+ Point_(0)
+ [ for_(2,8,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0)
+ sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].ne+(0.1,0)
+ [ for_(10,16,2, `rotbox(,,dashed,t=m4x/10) at last []+vec_(boxwid*1.1,0)
+ sprintf("t=%g",m4x/10) at last [] ') ] with .nw at last [].sw+(0,-0.1)
+]
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SQUIDSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SQUIDSVG.m4
new file mode 100644
index 00000000000..391587e177b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SQUIDSVG.m4
@@ -0,0 +1,19 @@
+.PS
+# SQUIDSVG.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+down_
+S1: SQUID
+ "J1" at S1.J1 above rjust wid 15bp__
+ "J2" at S1.J2 above ljust
+
+S2: SQUID(3,dimen_*1.5,-120) at S1.e+(elen_,0)
+ "J1" at S2.J1 above rjust
+ "J2" at S2.J2 below ljust
+ "J3" at S2.J3 above ljust
+ arcrad = S2.C.rad*0.7
+ arc from S2.c+(Rect_(arcrad,-135)) to S2.c+(Rect_(arcrad,-45)) \
+ with .c at S2.C ->
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SVGconfig.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SVGconfig.m4
new file mode 100644
index 00000000000..372a93937bb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SVGconfig.m4
@@ -0,0 +1,70 @@
+divert(-1)
+#nclude(svg.m4)dnl
+#ivert(-1)
+
+#Adjust scale and default lengths
+define(`scaledefaults',`
+ scale = 1/($1)
+ arcrad = arcrad*($1)
+ arrowht = arrowht*($1)
+ arrowwid = arrowwid*($1)
+ boxht = boxht*($1)
+ boxrad = boxrad*($1)
+ boxwid = boxwid*($1)
+ circlerad = circlerad*($1)
+ dashwid = dashwid*($1)
+ ellipseht = ellipseht*($1)
+ ellipsewid = ellipsewid*($1)
+ lineht = lineht*($1)
+ linewid = linewid*($1)
+ moveht = moveht*($1)
+ movewid = movewid*($1)
+ textht = textht*($1)
+ textoffset = textoffset*($1)
+ textwid = textwid*($1)
+ linethick = linethick*($1)
+ maxpsht = maxpsht*($1)
+ maxpswid = maxpswid*($1)
+')
+
+# Possible defaults for diagrams in mm
+define(`SIdefaults',`
+ scale = scale*25.4
+ arcrad = 5
+ arrowht = 2.5
+ arrowwid = arrowht/2
+ boxht = 12
+ boxrad = 0
+ boxwid = 18
+ circlerad = 5
+ dashwid = 1.5
+ ellipseht = 12
+ ellipsewid = 18
+ lineht = 12
+ linewid = 12
+ moveht = 12
+ movewid = 12
+ textht = ifsvg(4,0)
+ textoffset = 3
+ textwid = 0
+')
+
+define(`local_init',`
+ scaledefaults(1.1)
+')
+
+# If the variable dptextratio is not found you don't have
+# dpic version 2018.05.15 or later. In that case, change
+# dptextratio to 1 in the following (or delete *dptextrario ).
+define(`svg_font',`
+command "<g patsubst(ifelse(`$1',,,
+index(`$1',font),0,`$1',
+index(`$1',style),0,`$1',
+style="font-family:`$1'")
+,",\\")>"
+ ifelse(`$2',,,`textht=(`$2')*dptextratio')
+ ifelse(`$3',,,`textoffset=`$3'')
+ `$4'
+ ifelse(`$4',,,`command "</g>"')')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SchottkySVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SchottkySVG.m4
new file mode 100644
index 00000000000..68a7037eb5f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SchottkySVG.m4
@@ -0,0 +1,54 @@
+% SchottkySVG.m4
+.PS
+# 4-input positive NAND: the Schottky option for transistors (TI TTL data book)
+cct_init(svg_font(sans-serif,11bp__,1bp__))
+
+ tic = dimen_/4
+ rlen = dimen_*3/4
+
+E1: dot; line up_ tic
+Q1: bi_trans(,,dEBCBUS) with .E at Here; line left tic from Q1.B; B1: Here
+ resistor(up_ rlen from Q1.C); llabel(,3 k`'svg_ohm); B2: dot; line right_ tic
+Q2: bi_trans(up_ dimen_,,dEBCBUS) with .B at Here
+ line from Q2.E to (Q2.E,E1); dot
+Gnd: "GND" ljust at Here+(dimen_/2,0)
+ dot(at Q2.C)
+ { line to (Gnd,Here); "Y" wid 0.3 ljust }
+ line to (Q1.C,Here); dot
+ resistor(up_ rlen); llabel(,4 k`'svg_ohm); B4: dot; line right_ tic; up_
+Q4: bi_tr with .B at Here
+ line from Q4.E to Q2.C
+ line up_ tic from B4
+Q5: bi_trans(,,dEBCBUS) with .E at Here; line left_ tic from Q5.B; B5: dot
+ line from Q5.C to (Q4.C,Q5.C); dot
+ { line to Q4.C }
+ resistor(up_ rlen); llabel(,120 svg_ohm); dot
+Vcc: "Vcc" ljust at (Gnd,Here)
+ dot(at (B5,Vcc))
+ resistor(to (Here,Q5.C)); llabel(,8 k`'svg_ohm)
+ diode(from (B4,Q2.C) to (B5,Q2.C),Z)
+ line to (Here,Q5.C)
+ diode(from B4 to (Here,B4),Z); dot
+ line left_ tic; up_
+Q3: bi_trans(,,dEBCBUS) with .C at Here; line left_ tic from Q3.B; B3: Here
+ line from Q3.E to (Q3.E,B2); dot
+ dot(at (B1,Here)); resistor(down_ to (Here,Q1.C)); rlabel(,1.5 k`'svg_ohm)
+ line to B1
+ resistor(down_ from B3 to (B3,B2)); rlabel(,12 k`'svg_ohm); line to B2
+ line from Vcc to (B3,Vcc); resistor(down_ to (Here,Q5.C))
+ rlabel(,20 k`'svg_ohm)
+ line to B3
+ ground(at (Q3.C,Gnd),,F); dot
+
+ for_(0,3,1,
+ `dot(at (B3+(0,tic*m4x)))
+ line left_ tic*m4x; diode(left_ dimen_,Z); dot
+ {line down_ dimen_; reversed(`diode',down_ dimen_,Z); line to (Here,Gnd) \
+ ifelse(m4x,3,`then to Gnd',`; dot') }
+ line left_ tic*eval(4-m4x)
+ "ifelse(m4x,3,D,m4x,2,C,m4x,1,B,m4x,0,A)" wid 0.15 rjust
+ ')
+
+ command "</g>" # end font
+.PE
+
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ShiftRSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ShiftRSVG.m4
new file mode 100644
index 00000000000..9c8aa65a1c3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ShiftRSVG.m4
@@ -0,0 +1,51 @@
+.PS
+# ShiftR.m4
+log_init(svg_font(sans-serif,11*0.9bp__))
+
+define(`lg_plen',3)
+
+define(`customFF',
+ `FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,,
+ : S;NE:CK;: R, N:PR, :Q;;ifelse(`$1',1,:Q), N:CLR,
+ ifelse(`$1',1,line right 5bp__ at 2nd last ""+(-7bp__,4bp__)))')
+
+ F0: customFF(1)
+
+ BUFFER_gate(,N) with .Out at F0.W1.end
+ line left 2*L_unit from last [].In1
+ T: dot
+ reversed(`NOT_gate',left 10*L_unit)
+ {move left textht*8}
+ Serial: "SERIAL" rjust "INPUT" rjust
+ line from T to (T,F0.W3) then to F0.W3.end
+
+ NCLR: NOT_gate(right T.x-Serial.x from (Serial,F0.S1.end),N)
+ "CLEAR" at NCLR.start rjust
+ line left textht*2.3 from last ""+(-0.3,0.6)*textht
+
+ CLK: NOT_gate(right T.x-Serial.x from NCLR.start+(0,-BUF_ht*3/2*L_unit))
+ "CLOCK" at CLK.start rjust
+
+for_(1,4,1,`
+ F`'m4x: customFF(eval(m4x!=4)) with .W3.end at F`'eval(m4x-1).E3.end
+ ')
+
+ "OUTPUT" wid 0.7 at F4.E1.end ljust
+ line from NCLR.end to F4.S1.end
+
+ down_
+for_(0,4,1,`
+ line from F`'m4x.W2.end down F0.W2.y-CLK.y
+ ifelse(eval(m4x!=4),1,`dot',`line to CLK.end')
+ N`'m4x: NAND_gate with .Out at F`'m4x.N1.end
+ line up 2*L_unit from N`'m4x.In2
+ { line up 6*L_unit from N`'m4x.In1
+ "PR`'eval(4-m4x)" rjust }
+ ifelse(eval(m4x!=4),1,
+ `dot; dot(at F`'m4x.S1.end)',
+ `line to (Serial,Here)
+ "PRESET" rjust "ENABLE" rjust ')
+ ')
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SierpinskiSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SierpinskiSVG.m4
new file mode 100644
index 00000000000..3a014b8a0f5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SierpinskiSVG.m4
@@ -0,0 +1,26 @@
+.PS
+# Sierpinski.m4
+gen_init
+ define Sierpinski {
+ if $1 > 0.04 then {
+ d = $1/2-lh
+ shade(1,line from $2+(d/2,d/2*s3+lw*2) right d/2 up d/2*s3 then left d*2 \
+ then right d down d*s3 then right d/2 up d/2*s3 )
+ Sierpinski($1/2,$2-($1/2,0))
+ Sierpinski($1/2,$2+($1/2,0))
+ Sierpinski($1/2,$2+(0,$1*s3/2))
+ }
+ }
+
+ r = 4
+ linethick = 0.2
+ lw = linethick pt__ /2
+ s3 = sqrt(3)
+ lh = lw*s3
+ A: 3,3
+ d = r/2-lh
+ shade(0,line from A+(0,lw) right d then up d*s3 left d then down d*s3 left d\
+ then right d )
+# psset_(linecolor=white)
+ Sierpinski(r/2,A)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SixpoleSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SixpoleSVG.m4
new file mode 100644
index 00000000000..430c0450697
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SixpoleSVG.m4
@@ -0,0 +1,25 @@
+.PS
+# sixpole.m4
+define(`biquad',`[
+In: Here
+ resistor(right_)
+E: dot
+ resistor
+ dot
+ {capacitor(down_,C); ground(,T)}
+ line right_ elen_/3
+ { dot
+ line up_ elen_
+ amp(to (E,Here),elen_/2)
+ capacitor(from E to Here,C) }
+ amp(right_,elen_/2)
+ Out: Here
+ ]')
+
+cct_init
+define(`elen_',linewid)
+
+ biquad
+ biquad with .In at last [].Out+(-linewid/4,0)
+ biquad with .In at last [].Out+(-linewid/4,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SourcesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SourcesSVG.m4
new file mode 100644
index 00000000000..8096317a5d4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SourcesSVG.m4
@@ -0,0 +1,47 @@
+.PS
+# `SourcesSVG.m4'
+cct_init(svg_font(sans-serif,11bp__))
+textwid = 0.7
+movewid = 2pt__
+moveht = 0.275
+define(`NL',`; move down $1; right_')
+{
+ {source ; move ; "`source'" ljust} NL
+ {source(,I) ; move ; "`source(,I)'" ljust} NL
+ {source(,i) ; move ; "`source(,i)'" ljust} NL
+ {source(,V) ; move ; "`source(,V)'" ljust} NL
+ {source(,v) ; move ; "`source(,v)'" ljust} NL
+ {source(,AC); move ; "`source(,AC)'" ljust} NL
+ {source(,X) ; move ; "`source(,X)'" ljust} NL
+ {source(,F) ; move ; "`source(,F)'" ljust} NL
+ {source(,G) ; move ; "`source(,G)'" ljust} NL
+ {source(,Q) ; move ; "`source(,Q)'" ljust}
+}
+ move right_ 2.0
+{
+ {source(,,0.4) ; move ; "`source(,,0.4)'" ljust} NL(0.35)
+ {source(,P) ; move ; "`source(,P)'" ljust} NL
+ {source(,U) ; move ; "`source(,U)'" ljust} NL
+ {source(,H) ; move ; "`source(,H)'" ljust} NL
+ {source(,R) ; move ; "`source(,R)'" ljust} NL
+ {source(,S) ; move ; "`source(,S)'" ljust} NL
+ {source(,T) ; move ; "`source(,T)'" ljust} NL
+ {source(,L) ; move ; "`source(,L)'" ljust} NL
+ {source(,B) ; move ; "`source(,B)'" ljust} NL(moveht*0.8)
+ {nullator ; move ; "`nullator'" ljust} NL(moveht*0.6)
+ {norator ; move ; "`norator'" ljust}
+}
+ move right_ 2.0
+ {source(,N) ; move ; "`source(,N)'" ljust} NL
+ {source(,"svg_micro(A)"); move; "`source(,\"svg_micro(A)\")'" \
+ wid 1.7 at Here ljust}NL(0.31)
+ {consource ; move ; "`consource'" ljust } NL(0.32)
+ {consource(,I) ; move ; "`consource(,I)'" ljust} NL(0.32)
+ {consource(,i) ; move ; "`consource(,i)'" ljust} NL(0.32)
+ {consource(,V) ; move ; "`consource(,V)'" ljust} NL(0.32)
+ {consource(,v) ; move ; "`consource(,v)'" ljust} NL(0.3)
+ {battery ; move ; "`battery'" ljust} NL
+ {battery(,3,R) ; move ; "`battery(,3,R)'" ljust}
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4
new file mode 100644
index 00000000000..8808e5be277
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/SwitchesSVG.m4
@@ -0,0 +1,103 @@
+.PS
+# SwitchesSVG.m4
+cct_init(svg_font(sans-serif,11bp__,2bp__))
+textoffset = 3bp__
+
+movewid = 0.25
+moveht = moveht*1.25
+ right_; {
+ lswitch; rlabel(,"``lswitch''")
+ move right_
+ lswitch(,,O); rlabel(,"`(,,O)'")
+ move right_
+ lswitch(,,C); rlabel(,"`(,,C)'")
+ move right_
+ lswitch(,,DA); rlabel(,"`(,,DA)'")
+ move right_
+ lswitch(,,DO); rlabel(,"`(,,DO)'")
+ move right_
+ lswitch(,,DC); rlabel(,"`(,,DC)'")
+ }
+ move down; right_; {
+ lswitch(,,K); rlabel(,"`(,,K)'")
+ move right_
+ lswitch(,,KD); rlabel(,"`(,,KD)'")
+ move right_
+ lswitch(,,KOD); rlabel(,"`(,,KOD)'")
+ move right_
+ lswitch(,,KCD); rlabel(,"`(,,KCD)'")
+ move right_
+ bswitch; rlabel(,"``bswitch''")
+ move right_
+ bswitch(,,C); rlabel(,"`(,,C)'")
+ }
+ move down; right_; {
+ S: dswitch(,,)
+ ifgpic(`{[line invis] at S.c+(0,-0.2)}')
+ rlabel(,"``dswitch=''")
+ { "`switch(,,,D)'" at last [].s + (0,-0.23) }
+ thinlines_
+ { spline <- from 0.25 along_(S) up 0.1 then up 0.05 left 0.1
+ "W" wid 8bp__ at Here+(-5bp__,0)
+ spline <- from S.c+(0,m4sc*2) up 0.1 then up 0.05 left 0.1
+ "B" wid 5bp__ at Here+(-5bp__,0) }
+ thicklines_
+ move right_
+ S: dswitch(,,WdBK); rlabel(,"`(,,WdBK)'")
+ thinlines_
+ { spline <- from tr_xy(0,-2) up 0.1 then up 0.10 left 0.1
+ "dB" rjust
+ spline <- from tr_xy(4,-2) right 0.1 then right 0.05 up 0.15
+ "K" above }
+ thicklines_
+ move right_
+ dswitch(,,WBuD); rlabel(,"`(,,WBuD)'")
+ move right_
+ dswitch(,,WdBKF); rlabel(,"`(,,WdBKF)'")
+ move right_
+ dswitch(,,WBL); rlabel(,"`(,,WBL)'")
+ move right_
+ dswitch(,,WdBKL); rlabel(,"`(,,WdBKL)'")
+ }
+ move down; right_; {
+ dswitch(,,WBT); rlabel(,"`(,,WBT)'")
+ move right_
+ dswitch(,,WdBKC); rlabel(,"`(,,WdBKC)'")
+ move right_
+ dswitch(,,WBM); rlabel(,"`(,,WBM)'")
+ move right_
+ dswitch(,,WBCO); rlabel(,"`(,,WBCO)'")
+ move right_
+ dswitch(,,WBMP); rlabel(,"`(,,WBMP)'")
+ move right_
+ dswitch(,,WBoKCP); rlabel(,"`(,,WBoKCP)'")
+ }
+ move down; right_; {
+ dswitch(,,WBCY); rlabel(,"`(,,WBCY)'")
+ move right_
+ dswitch(,,WBCZ); rlabel(,"`(,,WBCZ)'")
+ move right_
+ dswitch(,,WBCE); rlabel(,"`(,,WBCE)'")
+ move right_
+ dswitch(,,WBRH); rlabel(,"`(,,WBRH)'")
+ move right_
+ dswitch(,,WBRdH); rlabel(,"`(,,WBRdH)'")
+ move right_
+ dswitch(,,WBRHH); rlabel(,"`(,,WBRHH)'")
+ }
+ move down; right_; {
+ dswitch(,,WBMMR); rlabel(,"`(,,WBMMR)'")
+ move right_
+ dswitch(,,WBMM); rlabel(,"`(,,WBMM)'")
+ move right_
+ dswitch(,,WBMR); rlabel(,"`(,,WBMR)'")
+ move right_
+ dswitch(,,WBEL); rlabel(,"`(,,WBEL)'")
+ move right_
+ dswitch(,,WBLE); rlabel(,"`(,,WBLE)'")
+ move right_
+ dswitch(,,WdBKEL); rlabel(,"`(,,WdBKEL)'")
+ }
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TTLnandSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TTLnandSVG.m4
new file mode 100644
index 00000000000..e1d7d4dae14
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TTLnandSVG.m4
@@ -0,0 +1,55 @@
+.PS
+# TTLnand.m4
+cct_init(svg_font(sans-serif,11bp__,1bp__))
+
+ up_
+Q3: bi_tr
+ "Q3" at Q3.E above ljust
+ dot(at Q3.C); reversed(`diode',up_ dimen_/2)
+Q4: bi_tr with .E at Here
+ "Q4" at Q4.E above ljust
+ resistor(up_ dimen_ from Q4.C); rlabel(,`svg_norm(130 svg_ohm)')
+V: dot
+ line left_ dimen_*0.75 from Q4.B; dot
+ line left_ dimen_*0.75 from Q3.B; dot
+Q2: bi_tr(up_ Q4.B.y-Q3.B.y) with .E at Here
+ "Q2" at 1/2 between Q2.E and Q2.C ljust
+ resistor(from Q2.C to (Q2.C,V)); rlabel(,`svg_norm(1.6 k`'svg_ohm)'); dot
+ resistor(from Q2.E down_ dimen_); llabel(,`svg_norm(1 k`'svg_ohm)')
+ line to (Q4.E,Here)
+G: dot
+ line to Q3.E
+ line left_ dimen_/4 from Q2.B
+ right_
+Q1: bi_trans(,,BCdE2BU) with .C at Here
+ "Q1" at Q1.Bulk above rjust
+ resistor(up_ from Q1.B to (Q1.B,V)); rlabel(,svg_norm(4 k`'svg_ohm))
+ line to V
+
+ line left dimen_ from Q1.E2
+X1: dot; "X1" wid 0.2 rjust above at last [].w
+X2: dot(at (X1,Q3.C)); "X2" rjust at last [].w
+ AA: line invis right dimen_ from X2
+ line from X2 to Intersect_(AA,Q1.Em1) then to Q1.E1
+X3: dot(at 2 between X1 and X2); "X3" rjust below at last [].w
+ AA: line invis right dimen_ from X3
+ line from X3 to Intersect_(AA,Q1.Em0) then to Q1.E0
+
+W: X2+(dimen_/2,0)
+N: V+(0,dimen_/4)
+S: (N.x,N.y-2*(N.y-W.y))
+ line from V to 2 between V and N
+Vcc:dot; "+5 svg_norm(V)" ljust at last [].e
+ line from G to (G,S)
+ ground
+ line from N to (W,N) then to (W,S) then to S
+ arc rad N.y-W.y ccw to N with .c at 1/2 between N and S
+
+ line right (N.y-S.y)/2+dimen_/2 from Q3.C
+Z: dot
+ lw = 1.05
+ "svg_it(Z = X1 . X2 . X3)" wid lw ljust
+ line left lw*0.73 from last "".ne+(0,2*textoffset)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TgateSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TgateSVG.m4
new file mode 100644
index 00000000000..35054606391
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TgateSVG.m4
@@ -0,0 +1,53 @@
+.PS
+# Tgate.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+right_
+
+[ { Q: tgate
+ "A" at Q.A rjust
+ "B" at Q.B ljust
+ "G" at Q.G ljust below
+ "Gb" at Q.Gb ljust above
+ `"tgate"' wid 0.5 at Q.A-(0.25,0) rjust
+ }
+
+ move down_ linewid; right_
+ { Q: tgate(,L)
+ "A" at Q.A rjust
+ "B" at Q.B ljust
+ "G" at Q.G rjust above
+ "Gb" at Q.Gb ljust below
+ `"tgate(,L)"' at Q.A-(0.25,0) rjust
+ move left 0.75; right
+ }
+ ]
+
+[ { Q: tgate(,B)
+ "A" at Q.A rjust
+ "B" at Q.B ljust
+ "G" at Q.G ljust
+ `"tgate(,B)"' at Q.G-(0,10bp__) below
+ }
+ ] with .Q.A at last [].Q.B+(0.5,linewid/2)
+
+[ { Q: ptrans
+ "A" at Q.A rjust
+ "B" at Q.B ljust
+ "G" at Q.G rjust below
+ "Gb" at Q.Gb rjust
+ `"ptrans"' at Q.B+(0.25,0) ljust
+ }
+
+ move down_ linewid; right_
+ { Q: ptrans(,L)
+ "A" at Q.A rjust
+ "B" at Q.B ljust
+ "G" at Q.G ljust above
+ "Gb" at Q.Gb ljust below
+ `"ptrans(,L)"' wid 0.75 at Q.B+(0.25,0) ljust
+ }
+ ] with .Q.Gb at (last [].e.x+elen_/2+0.5,1st [].Q.Gb.y)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ThreeSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ThreeSVG.m4
new file mode 100644
index 00000000000..29a784eead2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ThreeSVG.m4
@@ -0,0 +1,47 @@
+.PS
+# ThreeSVG.m4: three-phase oscillator
+cct_init(svg_font(sans-serif,11bp__))
+
+define(`section',`[ I: Here
+ resistor(right elen_*0.75); llabel(,R/2)
+T: dot
+ line down dimen_/2 then right_ dimen_/4
+ Amp: opamp(,,,,,{
+ rgbfill(0.9*255,0.6*255,0.1*255,line to N then to E then to S then to Here)
+ "-" at In1 ljust
+ "+" at In2 ljust }
+ ) with .In1 at Here
+ line left dimen_/4 from Amp.In2 then down dimen_/4; G: ground(,,)
+ resistor(from T to (Amp.Out,T)); llabel(,R)
+O: dot
+ { arrow up dimen_*0.5 then right dimen_/4 up dimen_/4
+ "`$1'" above }
+ line to Amp.Out
+ dot(at T+(dimen_/4,0)); line up dimen_*0.6
+ capacitor(right_ Amp.Out.x-Here.x-dimen_/4,C); llabel(,2C)
+ line to (Here,T); dot
+ ]')
+
+A: section(svg_symbol(0&`#'176;))
+B: section(svg_symbol(120&`#'176;)) with .I at A.O
+C: section(svg_symbol(-120&`#'176;)) with .I at B.O
+ move right 22pt__ from C.O
+
+ ground(at (A.I,A.G)+(dimen_/3,0),,)
+P:potentiometer(down_ dimen_/2,,0.75,dimen_/2) with .End at Here
+ line from P.Start to (A.I,P.Start); dot
+ resistor(up_ dimen_*0.75 from P.T1)
+ line to A.T
+
+ dot(at B.Amp.Out+(dimen_/3,0)); { "svg_it(V`'svg_sub(c))" at last [].n above }
+ resistor(down_ dimen_*0.75)
+ { dot; line right (C.T.x-Here.x)/2
+ reversed(`diode',up_ dimen_)
+ line to C.T }
+ resistor(down_ dimen_*0.75)
+ dot
+ line from C.O right dimen_/4 then down C.O.y-Here.y then to (A.I,Here) \
+ then to A.I
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TimerSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TimerSVG.m4
new file mode 100644
index 00000000000..dcdb2cc4774
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TimerSVG.m4
@@ -0,0 +1,51 @@
+.PS
+# TimerSVG.m4
+cct_init(svg_font(sans-serif,11bp__,1bp__))
+
+define(`ic555',`[Chip: box ht boxwid wid boxwid "555"
+ P7: "7" ljust at 1/6<Chip.sw,Chip.nw>
+ P6: "6" ljust at 1/2<Chip.sw,Chip.nw>
+ P2: "2" ljust at 5/6<Chip.sw,Chip.nw>
+ P4: "4" below at 1/3<Chip.nw,Chip.ne>
+ P8: "8" below at 2/3<Chip.nw,Chip.ne>
+ P3: "3" rjust at Chip.e
+ P1: "1" above at Chip.s
+ ]')
+
+ define(`elen_',`linewid')
+Vs: dot
+ down_
+ variable(`resistor(,E); llabel(,svg_norm(1 M`'svg_ohm))');
+ resistor(,E); llabel(,svg_norm(100 k`'svg_ohm))
+ capacitor(,E); llabel(svg_norm(220 svg_micro`'F))
+Zero: dot
+
+ dot(at Vs+(elen_*4/3,0))
+ resistor(,E); llabel(,svg_norm(33 k`'svg_ohm))
+ line to (Here,Zero) chop 0 chop elen_
+C2: capacitor; llabel(svg_norm(0.1 svg_micro`'F))
+ dot
+
+IC1: ic555 with .P7 at C2.start + (elen_,0)
+ line from IC1.P4 to (IC1.P4,Vs); dot
+ line from IC1.P8 to (IC1.P8,Vs); dot
+ line from IC1.P1 to (IC1.P1,Zero); dot
+ line from IC1.P2 to (C2,IC1.P2); dot
+ crossover(from IC1.P7 to (Zero,IC1.P7),R,C2); dot
+ line from IC1.P6 left elen_/2 then down IC1.P6.y-IC1.P7.y; dot
+ line from IC1.P3 right elen_*2/3
+R: dot
+ line right_ elen_/3
+B: buzzer(,,C) with .In3 at Here
+ line from B.In1 to (R,B.In1)
+ reversed(`diode',to (Here,Vs),LE); "red" at last line.c+(elen_/2,0)
+ resistor(down_ elen_ from R,E); llabel(,svg_norm(470 svg_ohm))
+ diode(to (Here,Zero),LE); {"green" wid 0.4 at last line.c+(elen_*2/3,0)}
+ line to Zero chop 0 chop -elen_
+ line up_ (Vs.y-Here.y)/3
+ battery(up_ (Vs.y-Here.y)/3); rlabel(,,svg_norm(9 V))
+ switch(to (Here,Vs),,D)
+ line to (R,Vs)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TtreeSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TtreeSVG.m4
new file mode 100644
index 00000000000..2b779191b72
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/TtreeSVG.m4
@@ -0,0 +1,70 @@
+.PS
+# Ttree.m4
+# A binary tree using m4
+gen_init
+sinclude(tst.dim)
+s_init(Ttree)
+
+# `Node(no in row, head [location],
+# displacement of top of body (.n) wrt head,
+# body Node 1, body Node 2, ...) '
+define(`Node',`
+ Head`$1': `$2'
+ ifelse(`$3',,,` Body`$1': [
+ Loopover_(`v',`v; define(`m4ct',m4Lx)',shift(shift(shift($@))))
+ ] with .n at Head`$1' + `$3'
+ connect(`$1',m4ct)')')
+
+define(`connect',`Bot: move from Head$1.sw-(0,5bp__) to Head$1.se-(0,5bp__)
+for_(1,`$2',1,
+ `Top: move from Body$1.Head`'m4x.nw+(0,2bp__) \
+ to Body$1.Head`'m4x.ne+(0,2bp__)
+ Mov: move from Head$1 to Body$1.Head`'m4x
+ if Bot.len*Top.len*Mov.len > 0 then {
+ line from Intersect_(Mov,Top) to Intersect_(Mov,Bot)}')')
+
+ vsep = 0.75
+define(`txw',`wid `$1'mm__')dnl scaled by 14/12 for 14 pt type
+
+ Node(1,"svg_it(h(h(h(x`'svg_sub(1),x`'svg_sub(2))," \
+ + "h(x`'svg_sub(3),x`'svg_sub(4))),h(h(x`'svg_sub(5),x`'svg_sub(6))," \
+ + "h(x`'svg_sub(7),x`'svg_sub(8)))))" txw(70) ,
+ (0,-vsep),
+ Node(1,"svg_it(h(h(x`'svg_sub(1),x`'svg_sub(2)),h(x`'svg_sub(3)," \
+ + "x`'svg_sub(4))))" txw(32) ,
+ (0,-vsep),
+ Node(1,"svg_it(h(x`'svg_sub(1),x`'svg_sub(2)))" txw(14) ,
+ (0,-vsep),
+ Node(1,"svg_it(x`'svg_sub(1):=((A,pk`'svg_sub(A)),h`'svg_sub(1)))" \
+ txw(29) ),
+ Node(2,"svg_it(x`'svg_sub(2):=((B,pk`'svg_sub(B)),h`'svg_sub(2)))" \
+ txw(29) with .n at last "".ne+(0.2,-vsep*2/3))),
+ Node(2,"svg_it(h(x`'svg_sub(3),x`'svg_sub(4)))" txw(14) \
+ with .nw at Head1.ne+(Body1.wid/2+0.1,0),
+ (0,-vsep),
+ Node(1,"svg_it(x`'svg_sub(3):=" \
+ + "((A,pk`'svg_prime`'svg_sub(A,,,-0.5ex)),h`'svg_sub(3)))" \
+ txw(29)),
+ Node(2,"svg_it(x`'svg_sub(4):=((D,pk`'svg_sub(D)),h`'svg_sub(4)))" \
+ txw(29) with .n at last "".ne+(0.2,-vsep*2/3)))),
+ Node(2,"svg_it(h(h(x`'svg_sub(5),x`'svg_sub(6)),h(x`'svg_sub(7)," \
+ + "x`'svg_sub(8))))" txw(29) with .nw at Head1.ne+(Body1.wid/2,0),
+ (0,-vsep),
+ Node(1, "svg_it(h(x`'svg_sub(5),x`'svg_sub(6)))" txw(14) ,
+ (0,-vsep*5/4),
+ Node(1,"svg_it(x`'svg_sub(5):=((E,pk`'svg_sub(E)),h`'svg_sub(5)))" \
+ txw(29) ),
+ Node(2,"svg_it(x`'svg_sub(6):=((H,pk`'svg_sub(H)),h`'svg_sub(6)))" \
+ txw(29) with .n at last "".ne+(0.2,-vsep*2/3))),
+ Node(2,"svg_it(h(x`'svg_sub(7),x`'svg_sub(8)))" txw(14) \
+ with .nw at Head1.ne+(Body1.wid/2+0.1,0),
+ (0,-vsep*5/4),
+ Node(1,"svg_it(x`'svg_sub(7):=" \
+ + "((D,pk`'svg_prime`'svg_sub(D,,,-0.5ex)),h`'svg_sub(7)))" \
+ txw(29) ),
+ Node(2,"svg_it(x`'svg_sub(8):=((K,pk`'svg_sub(K)),h`'svg_sub(8)))" \
+ txw(29) with .n at last "".ne+(0.2,-vsep*2/3))),
+ Node(3,"svg_it(h(x`'svg_sub(9)))" txw(8) \
+ at 0.5 between Head1 and Head2)))
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/VariableSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/VariableSVG.m4
new file mode 100644
index 00000000000..642b81466ac
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/VariableSVG.m4
@@ -0,0 +1,36 @@
+.PS
+# `Variable.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+define(`elen_',dimen_)
+down_
+[ { variable(`capacitor') }
+ move right; down_
+ { variable(`resistor',uN) }
+ move right; down_
+ { variable(`capacitor(,C)') }
+ move right; down_
+ { variable(`inductor') }
+ move right; down_
+ { variable(`inductor(,W)') }
+ ]
+[
+ skp = 0.4
+ hskip = linewid*0.5
+ cskip = hskip
+Orig: Here
+ { move right cskip
+ move right elen_; move up 0.15 then down 0.15 then right_ hskip
+ line invis right_ elen_ "C"; move right_ hskip
+ line invis right_ elen_ "S" }
+ Loopover_(`char',
+ `move down skp ifelse(char,A,*0.5)
+ { line invis right_ cskip "char"
+ variable(`capacitor(,C)',char); move right_ hskip
+ variable(`capacitor(,C)',char`'C); move right_ hskip
+ variable(`capacitor(,C)',char`'S) }',
+ A,P,L,N)
+ ] with .w at last [].e+(0.4,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/WindingsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/WindingsSVG.m4
new file mode 100644
index 00000000000..0ead17d87f0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/WindingsSVG.m4
@@ -0,0 +1,102 @@
+.PS
+# Windings.m4
+cct_init(svg_font(sans-serif,11bp__))
+textoffset = 3bp__
+
+define(`vlight',`rgbstring(0.9,0.9,0.9)')
+define(`lightgray',`rgbstring(0.7,0.7,0.7)')
+
+[ winding ]
+ `"winding"' at last [].s below
+
+[ winding(R) ] with .n at last "".s+(0,-0.1)
+ `"winding(R)"' wid 1 at last [].s below
+
+[ sk = 0.75
+ d = 1.5*sk
+ p = 0.4*sk
+ w = 1*sk
+
+W: winding(L,d,p,4,w,vlight)
+
+thinlines_
+ dimension_(from W.nw+(p/4,0) right p,0.1,"pitch" above,0.3)
+ dimension_(from W.sw to W.nw,0.2,diam,0.3)
+ dimension_(from W.e+(-p/2,-w/2) up w,-0.3,,0.2)
+ "core wid" wid 0.75 at W.e ljust
+ arrow <- up d-w+0.1 left d/10 from W.ne+(-p/2,-(d-w))
+ "core color" at Here+(-0.2,0) ljust above
+thicklines_
+] with .sw at last [].se+(0.25,0)
+ "T1" at last [].W.T1 below
+ "T2" at last [].W.T2 below
+
+[
+#`winding(L|R, diam, pitch, nturns, core wid, core color )'
+boxwid = 0.3
+boxht = 0.4
+ down_
+B1: box
+ winding(,boxwid*1.3,boxht/5,3,boxwid) at B1
+ "Left pins" "cw" at B1.s+(0,-0.15)
+ for_(1,2,1,`"svg_small(T`'m4x)" at last [].T`'m4x rjust')
+B2: box at B1.e + (0.5,0)
+ winding(R,boxwid*1.3,boxht/5,3,boxwid) at B2
+ "Left pins" "ccw" at B2.s+(0,-0.15)
+ for_(1,2,1,`"svg_small(T`'m4x)" at last [].T`'m4x rjust')
+ up_
+B3: box at B1.s + (0,-0.55)
+ winding(,boxwid*1.3,boxht/5,3,boxwid) at B3
+ "Right pins" "cw" at B3.s+(0,-0.15)
+ for_(1,2,1,`"svg_small(T`'m4x)" at last [].T`'m4x ljust')
+B4: box at (B2,B3)
+ winding(R,boxwid*1.3,boxht/5,3,boxwid) at B4
+ "Right pins" "ccw" at B4.s+(0.07,-0.15)
+ for_(1,2,1,`"svg_small(T`'m4x)" at last [].T`'m4x ljust')
+] with .sw at last [].se+(0,-0.15)
+
+[
+ Q: box invis ht 1 wid 5/4
+ g = Q.wid/12
+ ironwid = Q.wid/4.5
+
+ line thick ironwid/(1bp__)+linethick from Q.n+(g/2-linethick/2 bp__,0) \
+ to Q.ne then to Q.se then to Q.sw then to Q.nw \
+ then to Q.n+(-g/2+linethick/2 bp__,0)
+ line thick ironwid/(1bp__)-linethick outlined lightgray \
+ from Q.n+(g/2+linethick/2 bp__,0) \
+ to Q.ne then to Q.se then to Q.sw then to Q.nw \
+ then to Q.n+(-g/2-linethick/2 bp__,0)
+
+thinlines_
+ dimension_(from Q.n+(-g/2,-ironwid/2) right g,-ironwid/4,
+ "svg_it(g)" below,1,2pt__)
+thicklines_
+
+ down_
+ P: winding(R,ironwid*5/4,ironwid/2,4,ironwid,lightgray) at Q.w
+ line left ironwid*2/3 from P.T1
+ arrow right to P.T1 "svg_it(i`'svg_sub(1))" above
+ line left ironwid*2/3 from P.T2
+ gap(up_ to 2nd last line.end)
+ llabel(-,svg_it(v`'svg_sub(1)),+)
+ "svg_it(N`'svg_sub(1))" at P.e ljust
+
+ up_
+ S: winding(L,ironwid*5/4,ironwid/2,4,ironwid,lightgray) at Q.e
+ line right ironwid*2/3 from S.T2
+ arrow left to S.T2 "svg_it(i`'svg_sub(2))" above
+ line right ironwid*2/3 from S.T1
+ gap(up_ to 2nd last line.end)
+ rlabel(-,"svg_it(v`'svg_sub(2))" wid 0.2,+)
+ "svg_it(N`'svg_sub(2))" at S.w rjust
+
+ box dashed rad ironwid/4 wid Q.wid ht Q.ht at Q
+ arrow right arrowht from 0.5 between Q.n and Q.ne
+
+ move up ironwid/2 from Q.n
+ move down ironwid/2 from Q.s
+] with .sw at last [].se+(0.25,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XORSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XORSVG.m4
new file mode 100644
index 00000000000..c0f5613dbdb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XORSVG.m4
@@ -0,0 +1,67 @@
+.PS
+# `XORSVG.m4'
+# Realizations of the XOR function
+log_init
+scale = 2.54
+
+define(`gatelineth',1.6) # gate line thickness
+define(`lineth',0.8) # connection thickness
+
+define(`labels',`
+ "svg_it(A)" at last [].InA above wid 0.25
+ "svg_it(B)" at last [].InB above wid 0.25
+ "svg_it(A) O`'svg_sup(+,100,0,-1.4ex) svg_it(B)" at last [].Out ljust wid 1.2
+#"svg_it(A) svg_font(Latin,,,"O")`'svg_sup(+,100,0,-1.4ex) svg_it(B)" at last [].Out ljust
+')
+
+# single gate
+ XOR: Autologix(Xor(A,B))
+ labels
+
+# canonical form
+ Autologix(Or(And(A,Not(B)),And(Not(A),B))) \
+ with .nw at last [].sw+(0,-1)
+ labels
+
+# mixed gates
+ Autologix(And(Nand(A,B),Or(A,B))) \
+ with .nw at last [].nw+(8,0)
+ labels
+
+# nand realization
+ Autologix(Nand(Nand(Nand(A,A),B),Nand(Nand(B,B),A))) \
+ with .nw at 2nd last [].sw+(0,-1)
+ labels
+
+# nor realization
+ Autologix(Nor(Nor(Nor(A,A),Nor(B,B)),Nor(A,B))) \
+ with .nw at last [].nw+(8,0)
+ labels
+
+# These functions contain topologies in common so write a macro
+define(`customAB',
+ `S: Autologix(N`$1'(N`$1'(A,B1),N`$1'(B1,B)),N) with .Out at Here
+ line thick lineth from S.In2 to S.In3; InAB: dot(at last line.c)
+ line thick lineth from InAB left 2*L_unit
+ TN: Autologix(N`$1'(A,B)) with .Out at Here
+ line thick lineth from TN.InA up 3*L_unit; InA: Here
+ line thick lineth from TN.InB up 3*L_unit; InB: Here
+ line thick lineth from S.In4 to (InB,S.In4) then to (InB,TN.In2); dot
+ line thick lineth from S.In1 to (InA,S.In1); dot')
+
+ [ customAB(and)
+ Out: S.Out
+ ] with .nw at 2nd last [].sw+(0,-1)
+ labels
+
+ [ linethick = gatelineth
+ H: NOR_gate(2); linethick = lineth
+ L:dot(at H.w-(2*L_unit,0))
+ line from H.In1 to (L,H.In1) then to (L,H.In2) then to H.In2
+ line from L left 2*L_unit
+ customAB(or)
+ Out: H.Out
+ ] with .nw at last [].nw+(8,0)
+ labels
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XformSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XformSVG.m4
new file mode 100644
index 00000000000..8d8805f59b7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/XformSVG.m4
@@ -0,0 +1,41 @@
+divert(-1)
+# `XformSVG.m4'
+define(`trlabels',
+ `{ thinlines_
+ ifelse(`$1',R,
+ `arrow from `$3'.P1 <- right 0.12 up 0.072 chop 1pt__ ; "P1" ljust
+ arrow from `$3'.P2 <- right 0.12 down 0.072 chop 1pt__ ; "P2" ljust
+ arrow from `$3'.TP <- right 0.12 chop 1pt__ ; "TP" ljust
+ arrow from `$3'.S1 <- left 0.12 up 0.072 chop 1pt__ ; "S1" rjust
+ arrow from `$3'.S2 <- left 0.12 down 0.072 chop 1pt__ ; "S2" rjust
+ arrow from `$3'.TS <- left 0.12 chop 1pt__ ; "TS" rjust
+ ',`
+ arrow from `$3'.P1 <- left 0.12 up 0.072 chop 1pt__ ; "P1" rjust
+ arrow from `$3'.P2 <- left 0.12 down 0.072 chop 1pt__ ; "P2" rjust
+ arrow from `$3'.TP <- left 0.12 chop 1pt__ ; "TP" rjust
+ arrow from `$3'.S1 <- right 0.12 up 0.072 chop 1pt__ ; "S1" ljust
+ arrow from `$3'.S2 <- right 0.12 down 0.072 chop 1pt__ ; "S2" ljust
+ arrow from `$3'.TS <- right 0.12 chop 1pt__ ; "TS" ljust
+ ')
+ `"'`$2'`"' at `$3'.s+(0,-(`$4'))
+ thicklines_ } ')
+divert(0)dnl
+.PS
+cct_init(svg_font(sans-serif,11bp__))
+
+move right 0.5
+ down_
+ T1: transformer
+ trlabels(,`transformer',T1,0.3)
+ T2: transformer(down_ 0.6,,2,P,8) with .w at T1.e+(1,0)
+ trlabels(,`...(down_ 0.6,,2,P,8)',T2,0.3)
+ T3: transformer(,,8,WD12,4) with .w at T2.e+(1,0)
+ trlabels(,`...(,,8,WD12,4)',T3,0.23)
+ T4: transformer(,,9,AL) with .sw at T3.se+(1,0)
+ trlabels(,`...(,,9,AL)',T4,0.3)
+ T5: transformer(,R,8,AW) with .sw at T4.se+(1,0)
+ trlabels(R,`...(,R,8,AW)',T5,0.3)
+move right 0.4 from last [].e
+
+command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4
new file mode 100644
index 00000000000..53db5c6312a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/controlSVG.m4
@@ -0,0 +1,97 @@
+.PS
+# control.m4
+#.PS 5i
+cct_init(svg_font(sans-serif,11bp__))
+ linewid = linewid*0.8
+ circlerad = 0.35/2
+ bw = boxwid/2
+ bh = boxht/2
+PID: [
+ {"svg_it(r(s))" above ljust}
+ arrow
+S1: circle
+ line right "svg_it(e(s))" above
+ { arrow right ; box ht bh wid bw "svg_it(K`'svg_sub(p))"
+ arrow right linewid-circlerad ; S2: circle }
+ { line up linewid ; arrow right ; box ht bh wid bw "svg_it(K`'svg_sub(D) s)"
+ line to (S2,Here) ; arrow to S2.n }
+ { line down linewid ; arrow right
+ box ht bh wid bw "svg_it(K`'svg_sub(I) /s)"
+ line to (S2,Here) ; arrow to S2.s }
+ arrow right from S2.e "svg_it(u(s))" above
+ box "svg_it(G(s))"
+ arrow right ; "svg_it(y(s))" above rjust at Here+(0,2pt__)
+ line down boxht*3/2 from last arrow.c then left last arrow.c.x-S1.x
+ arrow to S1.s
+ "-" below rjust
+ ]
+ "(a) PID control" below ljust at PID.sw+(0,-5pt__)
+
+Obs: [ {"svg_it(r)" above ljust}
+ arrow
+S: circle
+ "-" below rjust at S.s
+ arrow <- down linewid/2 from S.s
+ box ht bh wid bw "svg_it(K)"
+ arrow <- down linewid/2
+ line right linewid "svg_it(z)" above
+Obs:box wid linewid*5.5 ht boxht*5/4 "svg_it(dz/dt = (A - LC) z + B u + L y)"
+ "Observer" above ljust at Obs.sw
+ arrow <- right linewid/2 from 3/4<Obs.se,Obs.ne>
+ line to (Here,S)
+ {"svg_it(u)" above at Here+(linewid/2,0)}
+ arrow from S.e to Here+(linewid,0)
+Plant: box wid boxwid*1.7 ht boxht*5/4 \
+ "svg_it(dx/dt = Ax + Bu)" "svg_it(y = Cx)"
+ "Plant" above ljust at Plant.sw
+ arrow right from Plant.e
+ "svg_it(y)" above rjust at Here+(0,2pt__)
+ move to last arrow.c
+ line to (Here, 1/4<Obs.se,Obs.ne>)
+ arrow to (Obs.e,Here)
+ ] with .nw at PID.sw+(0,-0.5)
+ "(b) Output feedback with a full-order observer" below ljust \
+ at Obs.sw+(0,-5pt__)
+
+NL: [boxwid = boxwid*1.8
+ boxht = boxht*3/2
+ thicklines_
+ scale = scale*0.8
+ circlerad = 0.3/2
+R: box wid boxwid*5/4 "reference" "svg_it(R)"
+ arrow right linewid*4/3 "svg_it(y`'svg_sub(c ref))" above
+Gh: box wid boxwid*5/4 "\"inverse\"" "of svg_it(G)"
+ arrow from Gh.s down "svg_it(y`'svg_sub(m ref))" ljust
+E: circle
+ arrow from E.e right "svg_it(e)" above
+ box wid boxwid*5/4 "stabilizer" "svg_it(K)"
+ arrow "svg_it(du)" above
+D: circle
+ line from Gh.e to (D,Gh.e) "svg_it(u`'svg_sub(ref))" above
+ arrow to D.n
+ arrow from D.e right "svg_it(u)" above
+G: box "plant" "svg_it(G)"
+ arrow <- from G.n up boxht/2
+ "disturbance svg_it(z)" above
+ arrow right from G.e + (0,boxht/4)
+ "svg_it(y`'svg_sub(c))" ljust
+ arrow right from G.e + (0,-boxht/4)
+ "svg_it(y`'svg_sub(m))" ljust
+ move to last arrow.c
+ arrow down Here.y-G.s.y+boxht*2/3 then left Here.x-E.x then to E.s
+ "svg_it(-)" at Here + (-0.15,-0.1)
+ arrow <- down from R.s
+ "svg_it(W) control input" at Here - (0,0.1)
+
+UL:R.nw +(-boxht/2,boxht/2)
+UR:(D.e,UL) + (0.1,0)
+ line dashed from UL to UR then to (UR,G.s+(0,-boxht*3/2))
+ line dashed to (Gh.w,Here) "Controller" above
+ line dashed to (Here,Gh.s+(0,-boxht/2))
+ line dashed to (UL,Here) then to UL
+ ] with .nw at Obs.sw + (0,-0.5)
+ "(c) Nonlinear feedforward (for performance) and small-signal feedback
+ (for stability)" wid Obs.wid+0.4 below ljust at NL.sw+(0,-5pt__)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4
new file mode 100644
index 00000000000..375881b4711
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/cscSVG.m4
@@ -0,0 +1,79 @@
+.PS 3.5
+# csc.m4
+gen_init
+
+circlerad=1.91*scale
+hubrad=0.10
+s=0.5
+
+define(`midnight',`26,26,112')
+define(`white',`255,255,255')
+define(`spokethick',0.1)
+define(`spoke',`dnl
+ {line from rvec_(0,hubrad-spokethick/2) to rvec_(circlerad-0.05,0)}
+ {line from rvec_(0,-(hubrad-spokethick/2)) to rvec_(circlerad-0.05,0)}')
+define(`lwid',1)
+define(`coord',`(s*(`$1'),s*(`$2'))')
+
+# Circle and spokes
+# [
+rgbdraw(midnight,
+ linethick=`0.'eval(lwid*15)/(1pt__)
+ {circle with .c at Here
+ circle invis diam last circle.diam + linethick pt__ at last circle }
+ linethick=spokethick/(1pt__)
+ for angle = 0 to 330 by 30 do {
+ Point_(angle)
+ {spoke}
+ }
+ )
+
+# Whiten where the hull will be
+ linethick=`0.'eval(lwid*20)/(1pt__)
+ rgbdraw(white,
+ Point_(-60){line to rvec_(circlerad*0.72,0)}
+ Point_(-90){line to rvec_(circlerad*0.72,0)}
+ Point_(-120){line to rvec_(circlerad*0.72,0)}
+
+ linethick=`0.'eval(lwid*15)/(1pt__)
+ {move to coord(1.8,-2.3)+(0,0.025)
+ spline to Here+coord(-0.8,-0.3) then to Here+coord(-1.8,-0.3) \
+ then to Here+coord(-2.18,-0.27) \
+ then to Here+coord(-3.93,-0.1)}
+ )
+
+# Sail
+ thinlines_
+ setrgb(midnight)
+ line from coord(0.44,3.38) to coord(0.44,2.6) \
+ then to coord(2.1,-1.75) \
+ then to coord(1.22,-1.53) \
+ then to coord(0.62,-1.4) \
+ then to coord(0.55,-1.6) \
+ then to coord(-2.2,-1.6) \
+ then to coord(-2.35,-1.5)
+ spline to coord(-2.14,-0.78) \
+ then to coord(-1.74,0.22) \
+ then to coord(-1.42,0.89) \
+ then to coord(-0.92,1.73) \
+ then to coord(0,2.9) \
+ then to coord(0.44,3.38)
+
+# Hull
+ spline from coord(2.1,-1.75) to coord(1.9,-2.2) \
+ then to coord(1.85,-2.3) then to coord(1.8,-2.33) \
+ then to coord(1,-2.5) then to coord(0,-2.6) then to coord(-0.38,-2.57) \
+ then to coord(-2.13,-2.4)
+ line to coord(-2.2,-2.05) then to coord(2.1,-1.75)
+# spline to coord(-1,-2.08) then to coord(0.55,-1.77)
+ line to coord(2.1,-1.75)
+resetrgb
+ setrgb(white)
+ spline from coord(-2.2,-2.05) to coord(-1,-2.08) then to coord(0.55,-1.77)
+ line to coord(-2.2,-2.05)
+resetrgb
+ linethick=`0.'eval(lwid*15)/(1pt__)
+
+# ] with .sw at 1,1
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/diamondSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/diamondSVG.m4
new file mode 100644
index 00000000000..3c5e0f5bfea
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/diamondSVG.m4
@@ -0,0 +1,34 @@
+.PS
+# diamond.m4
+# See LaTeX Graphics Companion pp 57-58
+gen_init
+dimen = 1.5*scale
+ratio = 0.9
+n = 30
+
+North: (0,dimen)
+East: (dimen,0)
+South: (0,-dimen)
+West: (-dimen,0)
+
+define(`square',
+ `shade(`$1',
+ line from North to East then to South then to West then to North)
+ ')
+
+define(`diamond',`[
+for i = 2 to n do {
+ square(`$1')
+ Tmp: North
+ North: ratio between East and North
+ East: ratio between South and East
+ South: ratio between West and South
+ West: ratio between Tmp and West
+ }]')
+
+linethick = 0
+diamond( i % 2 )
+linethick = 0.4
+diamond( (n-i)/(n-2) ) with .w at last [].e+(0.25,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex00SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex00SVG.m4
new file mode 100644
index 00000000000..97c52687257
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex00SVG.m4
@@ -0,0 +1,94 @@
+.PS
+# ex00.m4
+gen_init(svg_font(sans-serif,11bp__))
+
+[
+thicklines_
+ewid = 2
+eht = 0.5
+E: ellipse wid ewid ht eht
+
+ [ narrows = 5
+ de = ewid/narrows
+ for i=0 to narrows do {
+ arrow down from i*de,0 }
+ ] with .s at E.n+(0,0.25)
+
+ "svg_bf(B)svg_it((t))" at last [].c
+
+thinlines_
+ arrow from E.c to E.ne
+ box invis fill_(1) ht 0.12 wid 0.12 with .c at last arrow.c "svg_it(r)"
+
+ command "</g>" # end font
+]
+[
+# ex07.m4
+#gen_init
+
+Barrel: box invis ht 0.4 wid 1.5
+ up
+Face: arc rad 2.6 from Barrel.e+(2.4,-1.7/2) to Barrel.e+(2.4,1.7/2)
+
+ eps = 0.03
+ arc ccw rad 2.6 from Face.start-(eps,0) to Face.end-(eps,0) \
+ with .c at Face.c-(eps,0)
+ line from Barrel.nw to Barrel.ne then to Face.end
+ line from Barrel.sw to Barrel.se then to Face.start
+ arc cw from Barrel.sw to Barrel.nw rad Barrel.ht*1.2
+
+Cathode: Barrel.w+(0.3,0)
+Term: Barrel.w+(-0.25,0)
+ dcath = 0.13
+ dan = 0.12
+
+ line from Cathode up dcath/2 left dcath/2 then to Term.x,Cathode.y+dcath/2
+ dot
+ line from Cathode down dcath/2 left dcath/2 then to Term.x,Cathode.y-dcath/2
+ dot
+
+ hole = 0.06
+Hole: line invis up hole from Cathode+(0.5,-hole/2)
+ line from Hole.end up dan-hole/2 then to Term.x,Cathode.y+dan; dot
+ line from Hole.start down dan-hole/2 then to Term.x,Cathode.y-dan; dot
+
+ platewid = 0.25
+ platesep = 0.15
+Plates: box invis wid platewid ht platesep at Barrel.e+(-platewid/2,0)
+ line right platewid from Plates.nw
+ line right platewid from Plates.sw
+ line up 0.3 from Plates.n
+ line down 0.3 from Plates.s
+
+linethick_(1.4)
+
+ move to Cathode+(0.03,0)
+Spot: 0.9<Face.start,Face.end>
+ arcto(Plates.c,Spot,(Plates.c.x-Cathode.x)*0.90,outlined "lightgrey" thick 2)
+ line to Spot chop 0 chop -0.02 outlined "lightgrey" thick 2
+
+thinlines_
+
+ arrow <- from Cathode+(0.2,0.06) up 0.5 left 0.3
+ "electron" above "gun" above
+
+ arrow <- from Plates.nw+(0,0.06) up 0.5 left 0.3
+ "deflection" above "plates" above
+
+ arrow <- from 0.5<Plates.e,Spot>+(0,0.06) up 0.5 left 0.3
+ "electron beam" at Here+(-0.3,0) above
+
+ spline <- from 1.015<Plates.e,Spot> right 0.1 up 0.1 then up 0.1 \
+ then up 0.1 left 0.1
+ "spot of light" rjust
+
+ "vacuum" at 0.5<Face.start,Face.end>+(-0.4,0) rjust
+
+ arrow <- from Face.start+(0.1,0.5) left 0.6*1.4 down 0.3*1.4
+ "phosphor coating" rjust
+
+ arrow <- from 0.2<Barrel.se,Face.start> left 0.6 down 0.3
+ "glass enclosure (tube)" rjust
+
+] with .sw at last [].se+(0.5,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex01SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex01SVG.m4
new file mode 100644
index 00000000000..535bdec7955
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex01SVG.m4
@@ -0,0 +1,28 @@
+.PS
+# ex01.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+linewid = linewid*1.5 # let's make the circuit elements bigger than usual
+define(`elen_',linewid) # but not longer
+
+ del = elen_/4 # a spacing parameter
+ move right 0.4
+Vin: source(up_ elen_ + 2*del, V); llabel(,v`'svg_sub(s),)
+
+ switch(right_ elen_,,C); rlabel(,t = svg_norm(0),)
+ resistor; llabel(,svg_norm(47 ohm),); b_current(i`'svg_sub(R),above rjust)
+
+ line right_ elen_/2 then down_ del
+ parallel_(`inductor(,W); llabel(,"L" wid 0.15,); b_current(i`'svg_sub(L))',
+ `capacitor(,C); rlabel(+,v`'svg_sub(C),-); llabel(,,C)')
+ line to (Here,Vin.start) then to Vin.start
+
+ define(`meshcurrent',`[arc -> cw with .c at (0,0) \
+ from (Rect_(`$1',-30)) to (Rect_(`$1',30)) "svg_it(`$2')"]')
+
+ right_
+ meshcurrent(del,i`'svg_sub(2)) at last[].C
+ meshcurrent(2*del,i`'svg_sub(1)) at Vin.start + (4*del,3*del)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex02SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex02SVG.m4
new file mode 100644
index 00000000000..9ec72d8e2ae
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex02SVG.m4
@@ -0,0 +1,51 @@
+.PS
+# ex02.m4
+cct_init
+
+[
+ [ for angle = 0 to 315 by 45 do { Point_(angle)
+ opamp(to rvec_(linewid*3/2,0)) with .Out at 0,0 } ]
+ resistor(down_ dimen_ from last [].s)
+ diode(down_ dimen_*2/3,LE)
+ diode(down_ dimen_*2/3,LER)
+ ground(,T)
+]
+
+[
+ define(`elen_',`dimen_*3/2') # restore defaults
+ define(`sourcerad_',`dimen_*0.25')
+ leng = elen_
+ define(`fromcentre',`move to C+(-elen_/2,-elen_*cosd(15)/(2*sind(15)))')
+ C: dot
+ { fromcentre()
+ for i = 0 to 359 by 30 do {
+ Point_(i); inductor
+ }
+ }
+ define(`elen_',leng*0.8)
+ { fromcentre()
+ for i=0 to 359 by 30 do {
+ Point_(i); inductor(,W)
+ }
+ }
+ define(`elen_',leng*0.6)
+ { fromcentre()
+ for i=0 to 359 by 30 do {
+ Point_(i); resistor
+ }
+ }
+ define(`elen_',leng*0.4)
+ { fromcentre()
+ for i=0 to 359 by 30 do {
+ Point_(i); capacitor(,C)
+ }
+ }
+ define(`elen_',leng*0.2)
+ { fromcentre()
+ for i=0 to 359 by 30 do {
+ Point_(i); diode
+ }
+ }
+ ] with .sw at last [].se+(linewid,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex03SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex03SVG.m4
new file mode 100644
index 00000000000..ef1e6126d2b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex03SVG.m4
@@ -0,0 +1,37 @@
+.PS
+# ex03.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+circlerad = 0.35/2
+define(`elen_',`dimen_')
+del = linewid*0.6
+
+ "svg_it(u`'svg_sub(k))" wid 0.15 above
+ line
+{
+ arrow right_ del
+B0: circle "svg_it(b`'svg_sub(0))"
+ arrow right linewid/2
+S: circle
+ line right 2*circlerad + del + S.w.x-B0.e.x
+ {arrow ; "svg_it(y`'svg_sub(k))" wid 0.2 above }
+ down_
+ delay
+ {line left_ del
+ circle "svg_it(-a`'svg_sub(1))" ; arrow from last circle to S chop}
+ line dashed down_ del
+ delay
+ {line left_ del
+ circle "svg_it(-a`'svg_sub(n))" ; arrow from last circle to S chop}
+}
+ down_
+ delay
+ {line right_ del
+ circle "svg_it(b`'svg_sub(1))" ; arrow from last circle to S chop}
+ line dashed down_ del
+ delay
+ {line right_ del
+ circle "svg_it(b`'svg_sub(n))" ; arrow from last circle to S chop}
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex04SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex04SVG.m4
new file mode 100644
index 00000000000..366cf24c05e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex04SVG.m4
@@ -0,0 +1,61 @@
+.PS
+# ex04.m4
+cct_init(svg_font(sans-serif,10bp__))
+
+[
+pushdef(`elen_',`dimen_') # short elements
+pushdef(`sourcerad_',`dimen_*0.2')
+#linewid = 0.85
+linewid = 0.6
+
+Ct:dot
+ Point_(-60); capacitor(,C); dlabel(0.14,0.14,,,C`'svg_sub(3))
+Cr:dot
+ left_; capacitor(,C); dlabel(0.14,0.14,C`'svg_sub(2),,)
+Cl:dot
+ down_; capacitor(from Ct to Cl,C); dlabel(0.14,-0.10,C`'svg_sub(1),,)
+
+T:dot(at Ct+(0,elen_))
+ inductor(from T to Ct); dlabel(0.12,-0.1,,,L`'svg_sub(1))
+
+ Point_(-30); inductor(from Cr to Cr+vec_(elen_,0))
+ dlabel(0,-0.07,,L`'svg_sub(3),)
+R:dot
+L:dot( at (Cl-(Cos(30)*(elen_),0),R) )
+
+ inductor(from L to Cl); dlabel(-0.1,-0.1,L`'svg_sub(2),,,X)
+
+ right_; resistor(from L to R); rlabel(,R`'svg_sub(2),)
+ move down 0.3
+
+ resistor(from T to R); dlabel(0,0.15,,R`'svg_sub(3),)
+ b_current(y,ljust above)
+
+ line from L to 0.2<L,T>
+ source(to 0.5 between L and T); dlabel(sourcerad_+0.07,0.1,-,,+)
+ dlabel(0,sourcerad_+0.07,,u,)
+ resistor(to 0.8 between L and T); dlabel(0,0.15,,R`'svg_sub(1),)
+ line to T
+ ]
+popdef(`elen_')
+popdef(`sourcerad_')
+
+[
+ Point_(225)
+{B1: ebox ; b_current; dlabel(dimen_*0.4,-0.1,i`'svg_sub(1))
+ dot
+ B4: ebox(to rvec_(rp_len,0)); b_current(,,,E); dlabel(dimen_*0.4,-0.1,,,i`'svg_sub(4)) }
+ Point_(-45)
+ B2: ebox ; b_current; dlabel(dimen_*0.4, 0.1,i`'svg_sub(2))
+ dot
+ B7: ebox ; b_current; dlabel(dimen_*0.4, 0.1,i`'svg_sub(7))
+ B3: ebox(from B1.end to B2.end); b_current; dlabel(dimen_*0.4,0.1,i`'svg_sub(3))
+ dot(at (B1.start,B7.end))
+{B5: ebox(to B1.end); b_current; dlabel(dimen_*0.4,-0.09,i`'svg_sub(5))}
+{B6: ebox(to B2.end); b_current; dlabel(dimen_*0.4, 0.09,i`'svg_sub(6))}
+{B8: ebox(right_ to B4.end); b_current; dlabel(dimen_*0.4, 0.1,i`'svg_sub(8))}
+ B9: ebox(left_ to B7.end); b_current; dlabel(dimen_*0.4,-0.1,i`'svg_sub(9))
+ ] with .w at last [].e+(0.5,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex05SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex05SVG.m4
new file mode 100644
index 00000000000..0ca39bf4f54
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex05SVG.m4
@@ -0,0 +1,69 @@
+.PS
+# ex05.m4
+darrow_init
+
+ fillval = 0.8 # environmental variable
+
+ dx = boxht/5 # diagram parameters wrt scaled env variables
+ circlerad = boxht*3/8
+ extlen=4*dx
+ indel = boxht/3
+
+COb: box fill_ "CO"
+ { line right textht*0.5 from COb+(0,textht*0.5) }
+CO:box fill_ with .nw at last box.se+(dx,-dx) "CO"
+CbOb: box fill_ with .nw at last box.se+(dx,-dx) "CO"
+ { line right textht*1.0 with .c at CbOb+(-textht*0.1,textht*0.5) }
+CbO: box fill_ with .nw at last box.se+(dx,-dx) "CO"
+ { line left textht*0.5 from CbO+(-textht*0.2,textht*0.5) }
+
+ dline(from CbO.s down_ dx,,t,,!-)
+ dright
+{Sum: circle invis at (CO,Here)}
+ darrow(to Sum.e)
+
+SW: (COb.w,Sum.s)+(-3*dx-extlen/2,-dx)
+NE: (CbO.e,COb.n)+(dx,dx)
+ right_;
+SB: shadebox(box wid NE.x-SW.x ht NE.y-SW.y with .sw at SW)
+
+U: COb.w-(3*dx+extlen,0)
+ {"svg_bf(u)" wid 0.1 rjust at U}
+ dline(from U right_ extlen+dx,,t,,|-)
+TU: dtee(R)
+ {darrow(to COb.w,t)}
+ dline(to (Here,CO),t,t)
+{Dum: circle invis at (Here,Sum)}
+ dtee(L)
+ {darrow(to CO.w,t)}
+{D: box "D" wid boxwid/2 ht boxwid/2 at 0.5<Here,Dum.n>}
+ darrow(to D.n,t)
+ darrow(from D.s to Dum.n,,,,,,!-)
+
+ dline(up_ from CO.n to (CO,COb)-(0,indel),,t,,!-)
+ dleft; darrow(to (COb.e,Here))
+
+ dline(up_ from CbOb.n to (CbOb,COb),,t,,!-)
+ dleft; darrow(to COb.e)
+
+ dline(from CbO.n-(indel,0) up_ CbOb.y-CbO.n.y,,t,,!-)
+ dleft; darrow(to CbOb.e)
+
+ dline(up_ from CbO.n to (CbO,CO),,t,,!-)
+ dleft
+ dline(to (CbOb.w,Here)); darrow(to CO.e)
+
+ dline(up_ from CbO.n+(indel,0) to (CbO,COb)+(indel,indel),,t,,!-)
+ dleft; darrow(to (COb.e,Here))
+
+ darrow(from CO.s to Sum.n,,,,,,!-)
+
+ darrow(left_ from Sum.w to Dum.e)
+ dline(from Dum.w to (SB.w-(0.1,0),Dum)); darrow(to (U,Here))
+ {"svg_bf(y)" rjust}
+ move left 0.23
+
+ circle at Sum
+ circle at Dum
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex06SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex06SVG.m4
new file mode 100644
index 00000000000..9d3df657452
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex06SVG.m4
@@ -0,0 +1,64 @@
+.PS
+# ex06SVG.m4
+gen_init(svg_font(font-family="Times" font-style="italic",11bp__))
+
+F: box invis wid 1.6i ht 1.8i
+E: box invis wid F.wid ht F.ht
+G: box invis wid 1i ht F.ht
+
+ ell = F.ht-0.6i
+ r = 0.3i
+ offset = 8bp__
+ hatch = 0.1i
+ dhs = hatch * sqrt(2)
+ qmell = F.ht - ell
+ kwid = F.wid-qmell-r
+
+ box wid G.e.x-F.w.x ht F.ht with .sw at F.sw thick linethick*3/2
+ Loopover_(`B',
+ `line from B.ne to B.se thick linethick*3/2
+ B`'T: B.se + (-qmell,qmell)
+ line from (B.w,B`'T) to B`'T chop 0 chop -offset
+ line from B`'T up ell chop -offset chop 0
+ line from B`'T + (-r,0) up ell
+ line dashed from B`'T to B.se
+ "svg_fsize(0,110)" at B`'T + (-r/2,ell/2)
+ "svg_fsize(0,110)" at B`'T + (qmell/2,ell/2)
+ "t" at (B`'T,B.n) + (-offset/2,offset)
+ thinlines_
+ arrow <-> from B.nw+(0,offset*2/3) right B.wid-qmell-r "k" above
+ for x = hatch to B`'T.x-B.w.x-r by hatch do {line down ell from B.nw+(x,0)}
+ for y = dhs to qmell by dhs do {line up y right y from (B.w,B`'T)+(0,-y)}
+ for x = y-qmell to B.wid-qmell*2 by dhs do {
+ line up qmell right qmell from B.sw+(x,0) }
+ for x = last line.start.x-B.w.x+dhs to B.wid by dhs do {
+ line up (B.wid-x)/2 right (B.wid-x)/2 from B.sw+(x,0) }
+ thicklines_
+ ',F,E)
+
+ line from (G.w,ET) right G.wid
+ line from ET + (0,r) left ET.x-E.w.x
+
+ thinlines_
+ for y = hatch to r by hatch do { line left r from ET+(0,r-y) }
+ for x = dhs to G.wid by dhs do {
+ line left x down x from G.nw+(x,0) }
+ for y=x-G.wid to G.ht-G.wid by dhs do {
+ line left G.wid down G.wid from G.ne+(0,-y) }
+ for x = y-(G.ht-G.wid) to G.wid by dhs do {
+ line right G.wid-x up G.wid-x from G.sw+(x,0) }
+ arrow <-> up r with .c at ET+(offset*2/3,r/2) "r" ljust
+ thicklines_
+
+ "q" at F.sw + (-offset,offset/3)
+ "l" at (F.w,FT) + (-offset,offset/3)
+
+ "n+p+m" at G.ne + (0,offset)
+
+ Loopover_(`B',`"B" ht 0.12 below at B.s+(0,-2bp__)',F,E,G)
+
+# Adjust the bounding box without using s_box:
+ move from F.nw+(-12bp__,21bp__) to G.se+(20bp__,-15bp__)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex08SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex08SVG.m4
new file mode 100644
index 00000000000..aca3f41069a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex08SVG.m4
@@ -0,0 +1,83 @@
+.PS
+# ex08.m4
+log_init(svg_font(sans-serif,11bp__))
+
+define(`del',`L_unit*5/2')
+
+# Input labels
+C: "C" rjust at grid_(0,0)
+DE: grid_(0,AND_ht*7/4)
+A0: DE+grid_(0,BUF_ht*3/2); "A0" rjust at A0
+A1: A0+grid_(0,BUF_ht*3/2); "A1" rjust at A1
+A2: A1+grid_(0,BUF_ht*3/2); "A2" wid 0.2 rjust at A2
+ move to (-0.2,0) # Lettering within the global object
+
+# Buffer strings
+for_(1,3,1,
+ `line right 3*del from A`'eval(3-m4x)
+ B`'eval(2*m4x-1): NOT_gate; line right 2*del
+ T`'m4x: last line.c
+ B`'eval(2*m4x): BUFFER_gate(,N) ')
+
+B7: BUFFER_gate at (B1,C)
+
+G1: NOR_gate with .Out at (B1.Out,DE)
+G2: NOR_gate at (B2+grid_(N_rad,0),G1-grid_(0,AND_ht))
+G3: AND_gate(4) with .In1 at (G2.Out+(9*del,0),A2)
+G5: AND_gate(4) with .In4 at (G3.In1,G2.Out)
+G6: AND_gate at G5+grid_(AND_wd,AND_ht*3/4)+(del*2,0)
+G4: NOR_gate with .In1 at (G6.Out,G3)+(2*del,0)
+G7: NOR_gate with .In2 at (G4.In2,G5.Out)
+
+# Output to other latches
+TOL: (G2.Out,C)+(4*del,-4*L_unit)
+ move to TOL+(3*del,-del/3) ; {move down 0.15}
+ "To other latches" below
+
+# Remaining input lines
+ line from G1.In1 to (DE,G1.In1); "D" rjust
+ line from G1.In2 to (DE,G1.In2); "E" rjust
+ dot(at G1.In2-(del,0)); line to (Here,G2.In2) then to G2.In2
+ line from C to B7.In1
+
+# Connect Bi, and connect to output bus
+for_(1,3,1,
+ `dot(at T`'m4x.c) ; line down (A2.y-A1.y)/2
+ line to (TOL-(m4x*del,0),Here) ; arrow to (Here,TOL) ')
+
+# G1 to G2
+ dot(at (T1.c,G1)); line to (Here,G2.In1) then to G2.In1
+
+# Upper And inputs to output bus
+for_(1,4,1,
+ `line left eval(5-m4x)*del from G3.In`'m4x
+ arrow to (Here,TOL) ')
+
+ line from B2.Out to (G3.In1,B2)-(4*del,0) ; dot
+ line from B4.Out to (G3.In2,B4)-(3*del,0) ; dot
+ line from B6.Out to (G3.In3,B6)-(2*del,0) ; dot
+ line from G1.Out to (G3.In4,G1)-(del,0) ; dot
+
+# Lower And inputs
+ line left 4*del from G5.In1 ; dot
+ line left 3*del from G5.In2 ; dot
+ line left 2*del from G5.In3 ; dot
+ line from G2.Out to G5.In4 ; dot(at (TOL,Here)) ; arrow to (Here,TOL)
+
+# Fix up G4, G6, G7
+ line from G3.Out to G4.In1
+ line right del from G4.Out
+ {dot; line right del
+ "Q7" wid 0.2 ljust; move right 0.2 } # letters in object
+ line down 2*del then to G6.In1+(-del,del)
+ line to (Here,G6.In1) then to G6.In1
+ line from G4.In2 to (G6.In1+(-del,0),G4.In2)
+ line down del then to G7.Out+(del,2*del)
+ line to (Here,G7) then to G7.Out
+ line from G6.Out right del ; line to (Here,G7.In1) then to G7.In1
+ line from G5.Out to G7.In2
+ line left del from G6.In2 ; arrow to (Here,TOL)
+ dot(at (Here,C)) ; line to B7.Out
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex09SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex09SVG.m4
new file mode 100644
index 00000000000..507245235e6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex09SVG.m4
@@ -0,0 +1,129 @@
+.PS
+# ex09.m4
+# Illustrating the arguments of the `dimension_' and `arcdimension_' macros.
+gen_init(svg_font(sans-serif,10bp__,3bp__))
+scale = 25
+
+define(`spacer',`
+[
+linethick_(1.0)
+
+ WC: circle diameter 4.22 at 0,0
+ EC: circle same at 30.15,0
+ NC: circle diameter 2.36 at 13.28, 10.92/2
+ SC: circle same at 13.28,-10.92/2
+
+ C: 0.5<WC,EC> # spacer centre
+ h = 27.26 # spacer height
+ s = 4.22/2 # small arc radius
+ r = h/2*0.80 # large arc radius
+ Cr: C+(0,h/2-r) # upper arc centre
+ e = s # small arc centre offset from small circle
+ Cs: EC+(e,0) # right arc centre
+
+# Tangent points Tr and Ts to circles at Cr and Cs
+ dx = Cr.x-Cs.x; dy = Cr.y-Cs.y; dsq = dx*dx+dy*dy
+ Tr: (r*(r-s)/dsq)<Cr,Cs> + (vscal_(r*sqrt(dsq-(r-s)^2)/dsq,dy,-dx))
+ Ts: (s/r)<Cr,Tr>-(dx,dy)
+
+ line from Tr to Ts
+ arc cw to (Ts.x,-Ts.y) with .c at Cs
+E: last arc.e
+ line to (Tr.x,-Tr.y)
+ arc cw to (C.x-(Here.x-C.x),Here.y) with .c at (Cr.x,-Cr.y)
+S: last arc.s
+ line to (Cs.x-Ts.x-s,Cs.y-Ts.y)
+ arc cw to (Here.x,-Here.y) with .c at (-e,0)
+W: last arc.w
+ line to (C.x-(Tr.x-C.x),Tr.y)
+ arc cw to Tr with .c at Cr
+N: last arc.n
+
+thinlines_
+ dimension_(from S+(2,0) to N+(2,0),-(E.x-C.x+4),27.76, 5)
+ dimension_(from SC.n+(0,2) left SC.x-WC.x, (SC.n.y-S.y+3), 13.28, 10)
+ dimension_(from WC.n+(0,2) right EC.x-WC.x,-(WC.n.y-S.y+7), 30.15, 10)
+ dimension_(from W+(0,-1.5) to E+(0,-1.5), -(C.y-S.y+8), 41.28, 10)
+ dimension_(from SC.e+(2,0) up NC.y-SC.y, (SC.e.x-W.x+8),"10.92" wid 10, 5)
+
+ arrow <- from EC left 6 up 16 chop EC.rad chop 0
+ line left 4 "4.22 (2) PL" above
+ arrow <- from NC up last line.y-NC.y+7/8 left 8 chop NC.rad chop 0
+ {"2.36" above}
+ arrow to SC chop 0 chop SC.rad
+
+] ')
+
+define(`sk',`scale*0.7')
+
+define(`bdot',
+ `dot(`$1',,0.5)
+ "svg_it($2)" $1 $3 ')
+
+ thinlines_
+
+ move right 0.8
+
+# Upper left diagram
+ spacer
+
+# Lower left diagram
+[ define(`lwid',`29bp__')
+A: bdot(at (0,0),A,below)
+B: bdot(at (2*sk,0),B,below)
+Ctr: 0.5 between A and B
+ move up 1*sk from A
+L: move left 0.85*sk from A
+
+ linethick_(1)
+ dimension_(from A to B,0.5*sk,label,lwid,0.1*sk)
+ "`dimension_(from A to B,0.5,label,29bp__,0.1)'" wid 90 \
+ with .w at (L.end,A +(0,-9))
+
+ thinlines_
+ arrow from A to B chop 0.05*sk "linespec" below
+ dimension_(up_ 0.5*sk from A,0.2*sk,"offset" rjust,,,->)
+ dimension_(up_ 0.1*sk from B,-0.2*sk," tic offset" ljust)
+ dimension_(up_ 0.1*sk from B+(0,0.5*sk),-0.2*sk," tic offset" ljust)
+ dimension_(from Ctr+(-lwid/2,0.5*sk) right lwid,0.2*sk,
+ "blank width" above)
+] with .nw at last [].sw+(0,-0.7*sk)
+
+# Upper right diagram
+[ A: bdot(at (0,0),A, above rjust)
+ B: bdot(at (2*sk,0),B, above ljust)
+ C: bdot(at (0,-1.5*sk),C, above rjust)
+ D: bdot(at (2*sk,-1.5*sk),D, above ljust)
+
+T: C+(-1*sk,-0.5*sk)
+T: C+(-0.45*sk,-0.5*sk)
+ dimension_(from A to B,0.3*sk,svg_it(AB),20bp__)
+ dimension_(from C to B chop dotrad_,,svg_it(X),16bp__)
+ dimension_(from C to A,0.3*sk,svg_it(CA),14bp__,,->)
+ dimension_(from D to B,-0.3*sk,"svg_it(DB)" ljust)
+ dimension_(from C to D chop dotrad_,,svg_it(T`'svg_sub(15)),15bp__)
+ arcdimension_(from C to D with .c at 0.5 between A and B,12bp__,
+ svg_it(C) to svg_it(D),34bp__)
+Q: C+(-9,-9)
+
+`define' leftparagraph { [ baselineskip = textht*1.5; { move right $1 }
+ for i = 2 to $+ do {
+ move to Here+(0,-baselineskip)
+ exec sprintf("{ `\"$%g \"' ljust }; ",i) } ] }
+
+define(`svg_comma',`svg_symbol(&`#'44;)')
+leftparagraph(5.7*scale; baselineskip = 1.5*textht,
+ `dimension_(from A to B,0.3,svg_it(AB),20bp__)',
+ `dimension_(from C to B,,svg_it(X),16bp__)',
+ `dimension_(from C to A,0.3,svg_it(CA),14bp__,,->)',
+ `dimension_(from D to B,-0.3,"svg_it(DB)" ljust)',
+ `dimension_(from C to D chop dotrad_,,svg_it(T`'svg_sub(15)),15bp__)',
+ `arcdimension_'svg_symbol(&`#'40;)`from C to D with .c at 0.5 \
+ between A and B'svg_comma`12bp__'svg_comma,
+ svg_ensp `svg_it(C) to svg_it(D)'svg_comma`34bp__'svg_symbol(&`#'41;)
+ ) with .nw at Q
+
+] with .nw at 1st [].ne+(1.7*sk,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex10SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex10SVG.m4
new file mode 100644
index 00000000000..0c707781b35
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex10SVG.m4
@@ -0,0 +1,62 @@
+.PS
+# ex10.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+[
+ dt = 360/5
+ r = 0.75
+
+ N0: dot(at (Rect_(r,90)))
+ N1: dot(at (Rect_(r,(90-dt))))
+ N2: dot(at (Rect_(r,(90-2*dt))))
+ N3: dot(at (Rect_(r,(90-3*dt))))
+ N4: dot(at (Rect_(r,(90-4*dt))))
+
+ line from N0 to N1 then to N2 then to N3 then to N4 then to N0
+ L14: line from N1 to N4
+ L24: line from N2 to N4
+ C02: crossover(from N0 to N2,,L14)
+ C13: crossover(from N1 to N3,,C02,L24)
+ C03: crossover(from N0 to N3,,L14,L24)
+ ]
+
+[
+move right 0.5
+ up_
+setrgb(255,0,0)
+Q1: bi_tr(,R) # Q1 upward with base to the right
+ llabel(,Q`'svg_sub(1))
+ resetrgb # Label to left of last []
+setrgb(0,0,255)
+Q2: bi_tr with .C at Q1.C+(elen_*7/4,0) # Q2 with base to left
+ rlabel(,Q`'svg_sub(2))
+ resetrgb
+ move right 0.5
+
+ ground(at Q1.E)
+ ground(at Q2.E)
+
+ line right_ dimen_/3 from Q1.B # Extend the base conductors
+B1: Here
+ line left_ dimen_/3 from Q2.B
+B2: Here
+
+ resistor(up_ elen_*0.75 from Q1.C); llabel(,R`'svg_sub(L)) # Load resistors
+ line to (Q2.C,Here) "svg_it(V`'svg_sub(svg_norm(cc)))" below
+ resistor(down_ to Q2.C); llabel(,R`'svg_sub(L))
+
+ move to Q1.C+(0,dimen_/5)
+ { resistor(right_ to (B1,Here)); llabel(,R`'svg_sub(1))
+X: line to B2 } # Label the line to be jumped
+ resistor(from (Q2.C,Here) left_ to (B2,Here)); rlabel(,R`'svg_sub(1))
+ crossover(to B1,R,X)
+
+ resistor(down_ elen_*0.75); rlabel(,R`'svg_sub(2)) # Bias resistors
+ {"svg_it(-V`'svg_sub(svg_norm(cc)))" rjust}
+ line to (B2,Here)
+ resistor(up_ to B2); rlabel(,R`'svg_sub(2))
+ ] with .sw at last [].se+(0.75,0)
+
+ command "</g>" # end font
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex11SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex11SVG.m4
new file mode 100644
index 00000000000..cca63ef176c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex11SVG.m4
@@ -0,0 +1,75 @@
+.PS
+# ex11.m4
+cct_init(svg_font(sans-serif,11bp__,1bp__))
+
+ "audio" ljust
+ { arrow down_ elen_/4}
+ resistor(down_ 2*elen_) ; llabel(R`'svg_sub(17))
+G: ground
+ capacitor(right_ dimen_ from last [].c) ; rlabel(,C`'svg_sub(19))
+ {arrow <- right_ arrowht from last line.start}
+ { resistor(down_ to (Here,G)); rlabel(,R`'svg_sub(19)) }
+{R18: resistor(up_ elen_*1.2); llabel(,R`'svg_sub(18)) }
+
+ line right_ elen_/4 ; up_
+Q4: bi_tr(,,,E) with .B at Here; llabel(,,Q`'svg_sub(4))
+ resistor(down_ from Q4.E to (Q4.E,G)); rlabel(,R`'svg_sub(21))
+ resistor(up_ from Q4.C to (Q4.C,R18.end)); llabel(,R`'svg_sub(20))
+ line up_ elen_/4; dot; "svg_it(V`'svg_sub(CC))" ljust
+
+T1: Q4.C+(0,elen_/8)
+
+ capacitor(right_ dimen_ from T1); llabel(,C`'svg_sub(20))
+ { capacitor(down_ 0.5*(Here.y-G.y)); rlabel(,C`'svg_sub(21))
+ resistor(right_ elen_); llabel(,R`'svg_sub(23))
+ arrow <- from last [] to (last [],G)
+ }
+ resistor(right_ elen_); llabel(,R`'svg_sub(22))
+ { resistor(down_ 0.5*(Here.y-G.y)); llabel(,R`'svg_sub(24))
+ capacitor(down_ to (Here,G)); llabel(,C`'svg_sub(22)) }
+
+ capacitor(right_ dimen_); llabel(,C`'svg_sub(23))
+ { capacitor(down_ to (Here,G)); rlabel(,C`'svg_sub(24)) }
+ line right_ elen_/2
+Q5I: Here
+ line right_ elen_/4 ; up_
+Q5: bi_tr(,,,E) with .B at Here; rlabel(,Q`'svg_sub(5))
+R27: resistor(down_ dimen_ from Q5.E); rlabel(,R`'svg_sub(27))
+ line to (Here,G)
+ resistor(from Q5I down_ Q5I.y-R27.end.y-elen_/12); rlabel(,R`'svg_sub(25))
+ { capacitor(to (Here,G)); llabel(,C`'svg_sub(25)) }
+
+ crossover(to (R27,Here)+(hoprad_,0),,R27)
+R28: resistor(right_ elen_-hoprad_); llabel(,R`'svg_sub(28))
+ resistor(down_ to (Here,G)); rlabel(,R`'svg_sub(30))
+ line to G
+
+ resistor(up_ from Q5.C to (Q5.C,R18.end)); llabel(,R`'svg_sub(26))
+ line to R18.end
+
+ up_
+Q6: bi_tr(,,,E) with .E at (R28.end.x,Q5.E.y+(T1.y-Q4.B.y)); llabel(,,Q`'svg_sub(6))
+
+ line from Q6.B to (Q5.C,Q6.B)
+ resistor(down_ from Q6.E to R28.end); rlabel(,R`'svg_sub(29))
+
+ line right_ dimen_*3/4 from Q6.C
+
+ { R31: resistor(down_ elen_); circle diam dimen_*0.8 with .c at last line.c
+ "svg_it(R`'svg_sub(31))" below at last circle.sw
+ "svg_it(V)" below at last line.c+(dimen_/4,0) }
+ line right_ dimen_
+ { capacitor(down_ elen_); rlabel(,,C`'svg_sub(26))
+ line down_ elen_/4; dot; "svg_it(V`'svg_sub(SS))" ljust }
+ line right_ dimen_/2
+T6: transformer(down_ elen_) with .P1 at Here
+ line from T6.P2 to R31.end
+ {"svg_it(T`'svg_sub(6))" at T6.n above }
+ line right_ elen_/3 from T6.S1
+ inductor(down_ elen_,W)
+ line to T6.S2
+
+ speaker(R) with .Box.w at last [].e+(dimen_/8,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex12SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex12SVG.m4
new file mode 100644
index 00000000000..1dfa749b7a4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex12SVG.m4
@@ -0,0 +1,136 @@
+.PS
+# ex12.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+[
+ fetht = dimen_*0.9
+
+G: ground
+Q4: e_fet(up_ fetht) with .S at G
+Q3: e_fet(up_ fetht) with .S at Q4.D
+
+Q2: e_fet(down_ fetht,R,P) with .G at Q3.Channel+( dimen_*0.25,dimen_*1.8)
+Q1: e_fet(down_ fetht,R,P) with .G at Q2.G + (-dimen_*1.25,0)
+
+ line left_ dimen_ from Q3.G
+A: dot; "svg_it(A)" wid 0.15 rjust
+ line left_ dimen_ from Q4.G
+B: dot; "svg_it(B)" rjust
+
+ line from Q1.G to (Q1.G,Q3.D) then to (Q1.Channel,Q3.D) \
+ then to (Q1.Channel,B);dot
+ line from Q2.G to (Q3.Channel,Q2.G) then to (Q3.Channel,Q3.D) \
+ then to (Q3.G,Q3.D) then to Q3.G;dot
+ line from Q1.D to Q2.D
+ line from Q1.S to Q2.S
+ dot(at (G,Q1.S)) ; line up dimen_/3 ; "+5 V" rjust
+ line from Q3.D to (Q3.D,Q2.D);dot
+ dot(at Q3.D)
+ line right_ dimen_ ; dot ; "svg_it(~(AB))" above
+]
+
+[
+ del = dimen_/3
+
+define(`pair',`[
+Q1: c_fet(up_ dimen_,,P)
+ line right dimen_*2/3 from Q1.D
+ {dot(at last line.c); reversed(`source',up_ dimen_,I); Rail: Here
+ line right dimen_/2 with .c at Here}
+Q2: c_fet(up_ dimen_,R,P) with .D at Here
+ line down del*2 from Q2.S
+ resistor(down_ dimen_)
+Gnd: ground(,T,S)
+ ]')
+
+P1: pair
+Rail: P1.Rail
+Vc: dot(at P1.Q2.S+(0,-del)); "svg_it(V`'svg_sub(c))" rjust
+ line from P1.Q1.G to (P1.Q1.G,Rail)+(0,del/2); "svg_it(S+)" ljust
+
+ line right_ del from P1.Q2.G
+ {dot(at last line.c); line up del; "svg_it(V`'svg_sub(ref))" above}
+ pht = P1.Rail.y-P1.Gnd.y
+
+P2: pair with .Q1.G at Here
+Vcp: dot(at P2.Q2.S+(0,-del*2)); {"svg_it(V`'svg_sub(c'))" above rjust}
+ {line to (P1.Q1.S,Here) then to P1.Q1.S}
+ line from P2.Q2.G to (P2.Q2.G,Rail)+(0,del/2); "svg_it(S-)" rjust
+
+ line from Vc to (P2.Q1.S,Vc) then to P2.Q1.S
+
+define(`cpair',`[
+Rail: line right dimen_/2
+Q1: c_fet(up_ dimen_,,P) with .D at last line.c
+Q2: c_fet(up_ dimen_) with .S at Rail+(0,-pht)
+ ground(at Q2.S,T,S)
+ line from Q1.G to Q2.G
+ line from Q1.S to Q2.D
+ ]')
+
+S1: cpair with .Rail at P2.Rail+(P2.Q2.G.x-P2.Rail.x+P2.Q2.G.x-P2.Q2.D.x+del,0)
+S2: cpair with .Q1.G at (S1.Q1.D.x+del,S1.Q1.G.y)
+S3: cpair with .Rail at 2 between S1.Rail and S2.Rail
+
+ line from Vcp to (S2.Q2.G,Vcp); dot
+ dot(at (S2.Q2.D,Here)); line to (S3.Q2.G,Here); dot
+ dot(at (S3.Q2.D,Here)); arrow right del
+ "svg_it(e`'svg_sub(2))" ljust
+ dot(at P2.Q1.S); line to (S1.Q1.G,Here); dot
+ dot(at (S1.Q2.D,Here)); arrow to (last arrow.end,Here)
+ "svg_it(e`'svg_sub(1))" ljust
+
+
+] with .sw at last [].se+(0.25,0)
+
+[
+ elen=0.2
+
+VDD: dot; llabel(,V`'svg_sub(DD),)
+ line down_ elen/2
+P1: mosfet(up_,,ZSDFdTX,) with .D at Here
+
+MIDDLE: line from P1.S down_ elen/2
+
+N1: mosfet(up_,,ZSDFTX,) with .D at Here
+N2: mosfet(up_,,ZSDFTX,) with .D at N1.S
+ ground(at N2.S)
+
+ING: P1.G+(-elen/2,0)
+
+ line from P1.B right_ elen * 2/5 then down_ elen * 4/5
+ line to (ING, Here)
+ dot
+
+ line from N1.B right_ elen * 2/5 then up_ elen * 4/5
+ line to (ING, Here)
+ dot
+
+ line from N1.G to (ING,N1.G)
+ dot
+
+ line from N2.G to (ING,N2.G) then to ING then to P1.G
+
+ dot(at (ING,MIDDLE))
+ line left_ elen*2
+ "svg_it(V`'svg_sub(in))" above
+
+ dot(at MIDDLE)
+ line right_ elen*2
+ { "svg_it(V`'svg_sub(out))" wid 0.25 above }
+
+ line from N2.B to (Here,N2.B)
+ "svg_it(V`'svg_sub(BB))" above
+
+PUNT:dot(at 0.5 between N1.S and N2.D)
+
+ "svg_it(V`'svg_sub(x))" ljust
+
+ "svg_it(P`'svg_sub(1))" at P1.Channel.end above rjust
+ "svg_it(N`'svg_sub(1))" at N1.Channel.start below rjust
+ "svg_it(N`'svg_sub(2))" at N2.Channel.start below rjust
+
+] with .sw at last [].se
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex15SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex15SVG.m4
new file mode 100644
index 00000000000..055986740bb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex15SVG.m4
@@ -0,0 +1,40 @@
+.PS
+# ex15.m4
+gen_init
+
+[
+n = 10; r = 1
+for i = 1 to n-1 do {
+ for j = i+1 to n do {
+ line from rect_(r,i*twopi_/n) to rect_(r,j*twopi_/n)
+ }
+ }
+ ]
+[
+ linethick = 2.5
+ lt = linethick bp__
+ crad = 1.0
+ C: circle rad crad
+ g = 0.65
+ D: C+(Rect_(crad*g,110))
+ rm = crad+distance(C,D)
+ for r=lt to rm by 2*lt do {
+ if r < (1-g)*crad then { circle rad r at D thick r/rm*linethick } \
+ else { arc cw from Cintersect(D,r,C,crad) \
+ to Cintersect(D,r,C,crad,R) with .c at D thick r/rm*linethick }
+ }
+ linethick = 1.5
+ lt = linethick bp__
+ C: circle invis rad crad with .w at C.e+(0.1,0)
+ D: C+(Rect_(crad*g,110))
+ rm = crad+distance(C,D)
+ for r=lt to rm by lt do {
+ u = (1-r/rm)*255
+ if r < (1-g)*crad then { rgbdraw(u,u,u,circle rad r at D) } \
+ else { rgbdraw(u,u,u,arc cw from Cintersect(D,r,C,crad) \
+ to Cintersect(D,r,C,crad,R) with .c at D) }
+ }
+ circle rad C.rad at C
+ ] with .w at last [].e+(0.1,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex16SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex16SVG.m4
new file mode 100644
index 00000000000..70a7d00e28a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex16SVG.m4
@@ -0,0 +1,70 @@
+.PS
+# ex16.m4
+cct_init(svg_font(sans-serif,11bp__))
+
+[
+define(`elen_',linewid*1.2)
+ circlerad = delay_rad_
+ {"input" above ljust}
+ line right_
+J: Here
+ delay
+K: Here
+ delay
+L: Here
+S1: circle "+" at (K.x,K.y+linewid)
+S2: circle "+" at (L,S1)
+ arrow up_ S1.y-J.y from J then to S1.w
+ arrow from K to S1.s
+ arrow from S1.e to S2.w
+ arrow from L to S2.s
+S3: circle "+" at (L.x,L.y-linewid)
+ arrow down_ J.y-S3.y from J then to S3.w
+ arrow from L to S3.n
+ arrow from S2.e right_ linewid/2 then down_ (S2.y-S3.y)/2-circlerad \
+ then right_ linewid/2
+ arrow from S3.e right_ linewid/2 then up_ (S2.y-S3.y)/2-circlerad \
+ then right_ linewid/2
+ "output" at 0.5<last arrow.end, 2nd last arrow.end>
+ ]
+[
+ circlerad = 0.35/2
+ d = linewid*1.75
+ S00: circle "00"
+ S10: circle "10" at S00+(d,d)
+ S01: circle "01" at S00+(d,-d)
+ S11: circle "11" at S01+(d,d)
+ dx = circlerad*cosd(60)
+ dy = circlerad*sind(60)
+ brad = circlerad*1.3
+ qrad = circlerad*6
+
+ arc -> cw from S00+(-dx,-dy) to S00+(-dx,dy) rad brad \
+ with .c at S00-(dx+sqrt(brad^2-dy^2),0)
+ "0/00" at last arc.w rjust
+ right
+ arc -> cw from S00+(dx,dy) to S10+(-dy,-dx) rad qrad
+ "1/11" at last arc.nw rjust above
+ right
+ arc -> cw from S10+(dy,-dx) to S11+(-dx,dy) rad qrad
+ "1/01" at last arc.ne ljust above
+ up_
+ arc -> cw from S11+(dx,dy) to S11+(dx,-dy) rad brad \
+ with .c at S11+(dx+sqrt(brad^2-dy^2),0)
+ "1/10" wid 0.3 at last arc.e ljust
+ down_
+ arc -> cw from S11+(-dx,-dy) to S01+(dy,dx) rad qrad
+ "0/01" at last arc.se ljust below
+ left_
+ arc -> cw from S01+(-dy,dx) to S00+(dx,-dy) rad qrad
+ "0/11" at last arc.sw rjust below
+ up_
+ arc -> cw from S01+(-dx,dy) to S10+(-dx,-dy) rad qrad*2
+ "1/00" at last arc.w rjust
+ down_
+ arc -> cw from S10+(dx,-dy) to S01+(dx,dy) rad qrad*2
+ "0/10" at last arc.e ljust
+ ] with .sw at last [].se+(0.4,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex17SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex17SVG.m4
new file mode 100644
index 00000000000..fbe892f1477
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex17SVG.m4
@@ -0,0 +1,44 @@
+.PS
+# ex17SVG.m4
+cct_init(svg_font(sans-serif,11bp__,0bp__))
+
+[
+nrows = 4
+ncols = 9
+linewid = linewid*0.6 # everything smaller
+define(`elen_',linewid) # shorter default length
+
+ for j = 1 to nrows do {
+ { for i = 1 to ncols do {
+ Point_(-120) resistor
+ Point_( 0) inductor
+ Point_( 120) capacitor
+ if i < ncols then {Point_(0) diode} }
+ }
+ Point_(-120) move to rvec_(elen_,0)
+ { for i = 1 to ncols do {
+ Point_(-60) capacitor
+ Point_( 60) resistor }
+ }
+ Point_(-60) move to rvec_(elen_,0)
+ }
+ Point_(0) for i = 1 to ncols-1 do { inductor }
+]
+
+[
+ down_
+ Point_(-80)
+
+ parallel_(Sep=1.75*dimen_;
+ parallel_(`capacitor(,C); rlabel(,,C`'svg_sub(2))',
+ `resistor; llabel(,R`'svg_sub(2))' ),
+ parallel_(`resistor; rlabel(,R`'svg_sub(1)); move to rvec_(-dimen_/5,0)
+ inductor(,W); rlabel(,L`'svg_sub(1))',
+ `reversed(`source',to rvec_(elen_,0),V,sourcerad_*2.5)
+ rlabel(,v`'svg_sub(s))' )
+ )
+ move left 0.2 from last [].w
+] with .sw at last [].se+(elen_,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex18SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex18SVG.m4
new file mode 100644
index 00000000000..c14e7c46163
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex18SVG.m4
@@ -0,0 +1,40 @@
+.PS
+# ex18.m4
+cct_init(svg_font(Times,11bp__))
+
+[
+ "svg_it(v`'svg_sub(i))" wid 0.1 rjust; dot
+ resistor(right_ dimen_) ; llabel(,svg_it(R`'svg_sub(i)))
+T: dot
+ line right_ linewid/4
+A: opamp with .In1 at Here
+
+ line from A.In2 to (T,A.In2)
+ resistor(down_ dimen_) ; rlabel(,svg_it(R`'svg_sub(g)))
+ ground(,T)
+
+ line right_ dimen_ from A.Out
+ diode(up_ dimen_); dot
+ {line right_ linewid/2; dot; "svg_it(v`'svg_sub(o))" wid 0.2 ljust }
+ resistor(left_ to (A.Out,Here)) ; rlabel(,svg_it(R`'svg_sub(o))); dot
+ { diode(down_ to A.Out); dot }
+ line to (T,Here) then to T
+ ]
+[
+# ex19.m4
+define(`dimen_',dimen_*1.25)
+
+B: battery(up_ dimen_*2/3); rlabel(,V)
+ move down dimen_/4
+ resistor(up_ dimen_); rlabel(,R,)
+ {move up textht*1.5 }
+ inductor(right_ elen_); b_current(i); rlabel(,L)
+ { capacitor(down_ to (Here,B.start)); rlabel(,C); llabel(+,v,-) }
+ line right_ dimen_
+ diode(down_ to (Here,B.start),T); b_current(h(v))
+ { move right 0.3}
+ line to B.start
+ ] with .nw at last [].ne+(20bp__,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex21SVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex21SVG.m4
new file mode 100644
index 00000000000..785c13361e7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ex21SVG.m4
@@ -0,0 +1,71 @@
+.PS
+# ex21SVG.m4
+log_init(svg_font(sans-serif,11bp__))
+
+dy = 0.2
+ddy = 1.8*dy
+textht = textht*0.9
+
+D: FlipFlop(D)
+ line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__)
+T: FlipFlop(T) with .Chip.sw at last [].se + (0.4,0)
+ line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__)
+RS: FlipFlop(RS) with .Chip.sw at last [].se + (0.4,0)
+ line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__)
+JK: FlipFlop(JK) with .Chip.sw at last [].se + (0.4,0)
+ line right 5bp__ at last [] . 2nd last ""+(-7bp__,4bp__)
+ `"FlipFlop(JK)"' at JK.s below
+ `"FlipFlop(RS)"' at (RS.s,JK.s) below
+ `"FlipFlop(T)"' at (T.s,JK.s) below
+ `"FlipFlop(D)"' at (D.s,JK.s) below
+
+# Test 3: synchronous 3-bit counter
+define(`counterFF',``$1':FlipFlop(JK) `$2'
+ line right 5bp__ at last [] . 2nd last ""+(-7bp__,4bp__)
+ "`$1'" at `$1'.Chip.sw-(3bp__,0) below ljust
+ "1" at `$1'.PinCLR.end above
+ "1" at `$1'.PinPR.end below')
+
+[
+right_
+ counterFF(FF0)
+ counterFF(FF1,with .Chip at FF0.Chip+(-28*L_unit,0))
+ counterFF(FF2,with .Chip at FF1.Chip+(-28*L_unit,0))
+ "1" at FF0.PinJ.end rjust
+ "1" at FF0.PinK.end rjust
+Dc: FF2.Chip.sw+(-9*L_unit,-7.5*L_unit)
+Bot: Dc+(0,-3*L_unit)
+
+left_
+GAnd: AND_gate at FF1.Chip.nw+(4*L_unit,12*L_unit)
+right_
+
+ line from FF2.PinCK.end left 3*L_unit
+ line to (Here,Dc); dot
+ line from FF1.PinCK.end left 3*L_unit
+ line to (Here,Dc); dot
+ line from FF0.PinCK.end left 3*L_unit
+ line to (Here,Dc) then to Dc
+ "svg_it(D`'svg_sub(C))" rjust
+
+ line from FF2.PinK.end to FF2.PinJ.end; dot
+ line to (Here,GAnd.Out) then to GAnd.Out
+
+ line from FF1.PinK.end to FF1.PinJ.end; dot
+ line to (Here,FF1.PinCLR.end+(0,3*L_unit))
+ line to (GAnd.In2+(6*L_unit,0),Here) then to GAnd.In2+(6*L_unit,0); dot
+
+ line from FF0.PinQ.end right 0.1; dot
+ line from GAnd.In2 to (Here,GAnd.In2) then to (Here,Bot)
+ "svg_it(D`'svg_sub(00))" below
+
+ line right 0.1 from FF1.PinQ.end; dot
+ line from GAnd.In1 to (Here,GAnd.In1) then to (Here,Bot)
+ "svg_it(D`'svg_sub(01))" below
+
+ line right 0.1 from FF2.PinQ.end
+ line to (Here,Bot); "svg_it(D`'svg_sub(02))" below
+ ] with .n at 0.5<2nd[].s,3rd[].s> - (0,0.4)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx
new file mode 100644
index 00000000000..0a5fd2eca99
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/examplesSVG.htmx
@@ -0,0 +1,358 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<HTML>
+<HEAD>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<meta http-equiv="Content-Style-Type" content="text/css">
+<!--meta http-equiv="Content-Script-Type" content="text/javascript"-->
+<TITLE>SVG Examples: Circuit_macros Version XXX</TITLE>
+<style type="text/css">
+.svg{display:none}
+*>.svg{display:inline}
+</style>
+<link rel="shortcut icon" href="../Circuit_macros.ico" type="image/x-icon" />
+</HEAD>
+
+<BODY>
+<H2>SVG Circuit_macros examples, Version XXX</H2>
+<hr>
+
+<p>
+ These diagrams are in .svg format.
+ <A HREF="examples.pdf">Pdf</A>
+ and
+ <A HREF="examples.html">png</A>
+ versions are also available.
+ The PDF equivalent can be found in examples.pdf of the distribution.
+</p>
+ <p>
+ Click on the link to view the source of each diagram.
+</p>
+<hr>
+
+define(`cfig',`
+<p>
+
+<!--[if lte IE 8]><embed src="$1.svg" sinclude($1.siz)><![endif]-->
+
+<!--[if gte IE 9]>
+<object dx="4" data="$1.svg" sinclude($1.siz) type="image/svg+xml" class="img">
+ </object> <![endif]-->
+
+<!--[if !IE]><!-->
+<object data="$1.svg" sinclude($1.siz) type="image/svg+xml" class="img">
+ </object> <!--<![endif]-->
+
+<br>
+<a href="$1.txt" TYPE="text/plain" TARGET="_blank" alt="$1">$1.m4</a>
+</p>
+<hr>')
+
+define(`m4tt',`<g style="font-family:monospace">')
+
+<!--
+<embed pluginspage="http://www.adobe.com/svg/viewer/install/" />
+-->
+
+<p>
+These diagrams have been adapted from the Circuit_macros examples in
+order to test the <em>experimental</em> svg output of dpic.
+Generating the line art is relatively straightforward, but
+the labeling is not created by a text processor and therefore must be
+more basic. Some of these diagrams might benefit from a little more
+tweaking of fonts and labels.
+</p>
+<p>
+These examples conform to the latest dpic, which has changed the
+treatment of text sizing. That is, "Text" ht y sets the true height
+of SVG text to y rather than the nominal height as previously.
+</p>
+<p>
+There are a number of other issues:
+<ul>
+ <li> Embedding .svg files in html documents with the &lt;embed&gt; or
+ &lt;object&gt; tag seems to be a perennial issue.
+ <li> This file has been tested mainly by using Firefox.
+ Chrome also seems to work well with two issues detected to date:
+ a difference handling color fills and text links in svg.
+ <li> The Adobe reader apparently requires a line of the form
+ <br> &lt;embed src="figure.svg" width="x" height="y" type="image/svg+xml"
+ /&gt;
+ This means that the html file has to contain dimension
+ information for each figure, whereas Firefox can
+ determine the figure size
+ from the &lt;svg ... object. Currently, dpic includes a comment line
+ giving reasonable dimensions in pixels but this has to be insterted into
+ the &lt;embed or &lt;object line. A makefile does it easily but
+ otherwise this could be tedious.
+ <li> The font face is not specified by default in these diagrams but is
+ inherited from the enclosing document. The default appearance of labels can
+ differ according to the browser.
+ <li> The &lt;svg tag may require modification
+ from the default used for this test. Dpic might be modified to
+ allow the generation of custom headers but that has not yet been done.
+ <li> Diagrams such as these contain text labels
+ that have to be treated differently from the LaTeX-compatible versions.
+ Apparently there is no direct way to know the bounding box of arbitrary svg
+ text.
+ <!-- text, as discussed
+ <a href="http://www.aditus.nu/jpgraph/jpg_svg.php" TARGET="_blank">here,</a>
+ for example. -->
+ Consequently, text placement is approximate and may require
+ manual adjustment.
+ Rather than patch the original source files for svg production, edited copies
+ have been used. The configuration file svg.m4 read by m4
+ prior to libcct.m4 contains the following macros defined for svg.
+ Others should be defined to exercise some of the media capabilties of svg.
+ They are subject to change:
+ <ul>
+ <li>
+ m4tt`'svg_font(</g>font-face,height,textoffset,dpic commands`'m4tt)</g>:
+ Change font face, size, and dpic textoffset parameter.
+ If arg4 is blank, the font is changed and
+ requires m4tt`'command "&lt;/g&gt;"</g> to cancel the font change.
+ Examples: <br>
+ m4tt`'svg_font(Times)</g><br>
+ m4tt`'svg_font(Times,11bp__,1bp__,"text" at A)</g><br>
+ m4tt`'svg_font(font-family="Times")</g><br>
+ m4tt`'svg_font(font-family="Times" font-style="italic")</g><br>
+ m4tt`'svg_font(style="font-family:Times; font-style:italic")</g>
+ <li>m4tt svg_tspan(</g>text attributes`'m4tt)</g>;
+ e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%")</g>
+ <li>m4tt svg_it(</g>text`'m4tt)</g>: for italics
+ <li>m4tt svg_tt(</g>text`'m4tt)</g>: for monospace (courier)
+ <li>m4tt svg_norm(</g>text`'m4tt)</g>: for normal text
+ <li>m4tt svg_bf(</g>text`'m4tt)</g>: for bold face
+ <li>m4tt svg_small(</g>text, percent`'m4tt)</g>:
+ to set a smaller text size, default 66
+ <li>m4tt svg_fsize(</g>text, percent`'m4tt)</g>:
+ for setting larger or smaller text size, default 100
+ <li>m4tt svg_sub(</g>text, size percent, y displ, x displ`'m4tt)</g>:
+ subscript
+ <li>m4tt svg_sup(</g>text, size percent, y displ, x displ`'m4tt)</g>:
+ superscript
+ <li>m4tt svg_symbol(</g>text`'m4tt)</g>: allow quoted pound sign in text,
+ e.g., m4tt`'svg_symbol(10&&#96;&#35;&#39;176;)</g> produces 10&#176;
+ <li>m4tt svgLink(</g>URL, drawing object, m4tt[B])</g>:
+ link to external file using
+ &lt;a xlink:href=...&gt;...&lt;/a&gt; (default is
+ m4tt`'target="_blank"</g> unless
+ arg 3 = B)
+ <li>m4tt svgLinkString</g> as above but for strings attached to objects
+ <li> Greek and other symbols:
+<table cellpadding="0" cellspacing="0" width="100%" >
+<tr>
+<td width="7%"> m4tt svg_alpha</g>
+ <td align="left"> changecom(,)&`#'945;changecom(`#')
+<td width="7%"> m4tt svg_beta</g>
+ <td align="left"> changecom(,)&`#'946;changecom(`#')
+<td width="7%"> m4tt svg_chi</g>
+ <td align="left"> changecom(,)&`#'967;changecom(`#')
+<td width="7%"> m4tt svg_comma</g>
+ <td align="left"> changecom(,)&`#'44;changecom(`#')
+<td width="7%"> m4tt svg_Delta</g>
+ <td align="left"> changecom(,)&`#'916;changecom(`#')
+<td width="7%"> m4tt svg_delta</g>
+ <td align="left"> changecom(,)&`#'948;changecom(`#')
+<td width="7%"> m4tt svg_epsilon</g>
+ <td align="left"> changecom(,)&`#'949;changecom(`#')
+<td width="7%"> m4tt svg_eta</g>
+ <td align="left"> changecom(,)&`#'951;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_Gamma</g>
+ <td align="left"> changecom(,)&`#'915;changecom(`#')
+<td width="7%"> m4tt svg_gamma</g>
+ <td align="left"> changecom(,)&`#'947;changecom(`#')
+<td width="7%"> m4tt svg_iota</g>
+ <td align="left"> changecom(,)&`#'953;changecom(`#')
+<td width="7%"> m4tt svg_kappa</g>
+ <td align="left"> changecom(,)&`#'954;changecom(`#')
+<td width="7%"> m4tt svg_Lambda</g>
+ <td align="left"> changecom(,)&`#'923;changecom(`#')
+<td width="7%"> m4tt svg_lambda</g>
+ <td align="left"> changecom(,)&`#'955;changecom(`#')
+<td width="7%"> m4tt svg_micro</g>
+ <td align="left"> changecom(,)&`#'956;changecom(`#')
+<td width="7%"> m4tt svg_mu</g>
+ <td align="left"> changecom(,)&`#'956;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_nu</g>
+ <td align="left"> changecom(,)&`#'957;changecom(`#')
+<td width="7%"> m4tt svg_ohm</g>
+ <td align="left"> changecom(,)&`#'937;changecom(`#')
+<td width="7%"> m4tt svg_Omega</g>
+ <td align="left"> changecom(,)&`#'937;changecom(`#')
+<td width="7%"> m4tt svg_omega</g>
+ <td align="left"> changecom(,)&`#'969;changecom(`#')
+<td width="7%"> m4tt svg_Phi</g>
+ <td align="left"> changecom(,)&`#'934;changecom(`#')
+<td width="7%"> m4tt svg_phi</g>
+ <td align="left"> changecom(,)&`#'966;changecom(`#')
+<td width="7%"> m4tt svg_Pi</g>
+ <td align="left"> changecom(,)&`#'928;changecom(`#')
+<td width="7%"> m4tt svg_pi</g>
+ <td align="left"> changecom(,)&`#'960;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_Psi</g>
+ <td align="left"> changecom(,)&`#'936;changecom(`#')
+<td width="7%"> m4tt svg_psi</g>
+ <td align="left"> changecom(,)&`#'968;changecom(`#')
+<td width="7%"> m4tt svg_rho</g>
+ <td align="left"> changecom(,)&`#'961;changecom(`#')
+<td width="7%"> m4tt svg_Sigma</g>
+ <td align="left"> changecom(,)&`#'931;changecom(`#')
+<td width="7%"> m4tt svg_sigma</g>
+ <td align="left"> changecom(,)&`#'963;changecom(`#')
+<td width="7%"> m4tt svg_tau</g>
+ <td align="left"> changecom(,)&`#'964;changecom(`#')
+<td width="7%"> m4tt svg_Theta</g>
+ <td align="left"> changecom(,)&`#'920;changecom(`#')
+<td width="7%"> m4tt svg_theta</g>
+ <td align="left"> changecom(,)&`#'952;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_upsilon</g>
+ <td align="left"> changecom(,)&`#'965;changecom(`#')
+<td width="7%"> m4tt svg_Xi</g>
+ <td align="left"> changecom(,)&`#'926;changecom(`#')
+<td width="7%"> m4tt svg_xi</g>
+ <td align="left"> changecom(,)&`#'958;changecom(`#')
+<td width="7%"> m4tt svg_zeta</g>
+ <td align="left"> changecom(,)&`#'950;changecom(`#')
+<td width="7%"> m4tt svg_lt</g>
+ <td align="left"> changecom(,)&`#'60;changecom(`#')
+<td width="7%"> m4tt svg_gt</g>
+ <td align="left"> changecom(,)&`#'62;changecom(`#')
+<td width="7%"> m4tt svg_leq</g>
+ <td align="left"> changecom(,)&`#'8804;changecom(`#')
+<td width="7%"> m4tt svg_geq</g>
+ <td align="left"> changecom(,)&`#'8805;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_prime</g>
+ <td align="left"> changecom(,)&`#'8242;changecom(`#')
+<td width="7%"> m4tt svg_ensp</g>
+ <td align="left"> |changecom(,)&`#'8194;changecom(`#')|
+<td width="7%"> m4tt svg_emsp</g>
+ <td align="left"> |changecom(,)&`#'8195;changecom(`#')|
+<td width="7%"> m4tt svg_thinsp</g>
+ <td align="left"> |changecom(,)&`#'8201;changecom(`#')|
+<td width="7%"> m4tt svg_backsl</g>
+ <td align="left"> changecom(,)&`#'92;changecom(`#')
+</table>
+
+ </ul>
+ <li> Inkscape: It may be efficient to define elements by macro and to
+ place them using a WYSIWYG graphics editor. A draft page intended
+ for Inkscape is included. A reasonable variety of elements is defined
+ but many more could be added and they should be customized for
+ particular applications.
+ <li> Link experiments: Click on the resistor or source of quickSVG
+ to go to external
+ files in new windows. Click on "n-port" in NportSVG to replace the diagram
+ and then "back" to return.
+ <li> Some of the assumptions used to create this draft may be naive. Comments
+ are welcome.
+</ul>
+<hr>
+
+cfig(quickSVG)
+cfig(CctTableSVG)
+cfig(DiodesSVG)
+cfig(EmarrowsSVG)
+cfig(SourcesSVG)
+cfig(VariableSVG)
+cfig(AmpTableSVG)
+cfig(FusesSVG)
+cfig(SwitchesSVG)
+cfig(GroundsSVG)
+cfig(AntennasSVG)
+cfig(AudioSVG)
+cfig(OpampSVG)
+cfig(XformSVG)
+cfig(RelaySVG)
+cfig(NPDTSVG)
+cfig(JackSVG)
+cfig(ConnSVG)
+cfig(PconnSVG)
+cfig(HeadersSVG)
+cfig(fetSVG)
+cfig(ujtSVG)
+cfig(thyristorSVG)
+cfig(BipSVG)
+cfig(TgateSVG)
+cfig(NportSVG)
+cfig(NLGSVG)
+cfig(WindingsSVG)
+cfig(ex01SVG)
+cfig(TimerSVG)
+cfig(OptoisoSVG)
+cfig(MixerSVG)
+cfig(PushPullSVG)
+cfig(QuantumSVG)
+cfig(SQUIDSVG)
+cfig(SixpoleSVG)
+cfig(ex18SVG)
+cfig(MCSVG)
+cfig(ex10SVG)
+cfig(ThreeSVG)
+cfig(ex17SVG)
+cfig(ex12SVG)
+cfig(pwrsupplySVG)
+cfig(TTLnandSVG)
+cfig(I2LSVG)
+cfig(SchottkySVG)
+cfig(ex11SVG)
+cfig(ex04SVG)
+cfig(CsourceSVG)
+cfig(DriveSVG)
+cfig(ex16SVG)
+cfig(ex03SVG)
+cfig(MotorControlSVG)
+cfig(ex02SVG)
+cfig(RectifiersSVG)
+cfig(HeathkitSVG)
+cfig(lcctSVG)
+cfig(sfgSVG)
+cfig(LogicSVG)
+cfig(ex08SVG)
+cfig(DecoderSVG)
+cfig(ex21SVG)
+cfig(MultiplexerSVG)
+cfig(DemultiplexerSVG)
+cfig(ShiftRSVG)
+cfig(AdderSVG)
+cfig(CanLogicSVG)
+cfig(AlogixSVG)
+cfig(ABlogixSVG)
+cfig(XORSVG)
+cfig(ex00SVG)
+cfig(CrossbarSVG)
+cfig(ByteSVG)
+cfig(RotboxSVG)
+cfig(paletteSVG)
+cfig(randomSVG)
+cfig(expSVG)
+cfig(graysurfSVG)
+cfig(CrullerSVG)
+cfig(shapesSVG)
+cfig(ex09SVG)
+cfig(ex05SVG)
+cfig(controlSVG)
+cfig(ex06SVG)
+cfig(LoglogSVG)
+cfig(cscSVG)
+cfig(roseSVG)
+cfig(diamondSVG)
+cfig(wormSVG)
+cfig(ButtonsSVG)
+cfig(SierpinskiSVG)
+cfig(recycleSVG)
+cfig(ex15SVG)
+cfig(CountingSVG)
+cfig(CrowSVG)
+cfig(FlowSVG)
+cfig(BtreeSVG)
+cfig(TtreeSVG)
+cfig(InclepsSVG)
+cfig(FontsSVG)
+
+</BODY>
+</HTML>
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4
new file mode 100644
index 00000000000..deff7bae074
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/expSVG.m4
@@ -0,0 +1,303 @@
+.PS
+# expSVG.m4
+threeD_init
+NeedDpicTools
+
+# Graduated shading is probably best done using the built-in functions
+# of PSTricks or the somewhat equivalent tikz capabilities. Other
+# postprocessors do not have the same functionality so the following
+# demonstrates how it can be done in the pic language with m4 macros.
+
+# `shadedpolygon(shadedpvertseq,line attributes,
+# sweep angle (degrees),colorseq)
+# arg1 is a colon (:) separated sequence of
+# positions or position names, the vertices in
+# order (cw or ccw) of the polygon. Colored
+# shade lines are drawn perpendicular to the
+# sweep angle. A colorseq is of the form
+# 0,r0,g0,b0,
+# frac1,r1,g1,b1,
+# frac2,r2,g2,b2,
+# ...
+# 1,rn,gn,bn'
+#`e.g. shadedpolygon((0,0):(0,1):(2,1):(2,0),,0,0,1,1,1,1,0,0,0)'
+define(`shadedpolygon',`[ Origin: Here
+ shadedpverts(V,1,patsubst(patsubst(`$1',`,',|),:,`,'))
+ nverts = m4vx
+ T: (Rect_(1,`$3'))
+ p0 = 1; d[1] = T.x*V[1].x + T.y*V[1].y
+ pm = 1
+ for i=2 to nverts do { d[i] = T.x*V[i].x + T.y*V[i].y
+ if d[i] < d[p0] then { p0 = i }
+ if d[i] > d[pm] then { pm = i } }
+ d0 = d[p0]; dmx = d[pm]-d0
+ for i=1 to nverts do { d[i] = (d[i]-d0)/dmx }
+ qL = p0; pL = qL + 1; if pL > nverts then { pL = 1 }
+ qR = p0; pR = qR - 1; if pR < 1 then { pR = nverts }
+ nlines = int(1.5*dmx/lthick)
+ ShadeObject(ShadedPline,nlines,shift(shift(shift($@)))) \
+ with .Origin at Origin
+ Midpt: 0.5 between V[1] and V[nverts]
+ line `$2' \
+ from Midpt to for_(1,m4vx,1,`V[m4x] then to\') Midpt
+ Start: V[p0]; End: V[pm]
+ ]')
+define(`shadedpverts',`
+ifelse($3,,,`$1[$2]: patsubst(`$3',|,`,') define(`m4vx',$2)
+shadedpverts(`$1',incr(`$2'),shift(shift(shift($@))))')')
+define ShadedPline {
+ if $1 > d[pL] then { qL = pL; pL = qL + 1; if pL > nverts then {pL = 1} }
+ if $1 > d[pR] then { qR = pR; pR = qR - 1; if pR < 1 then {pR = nverts} }
+ M4L: ($1-d[qL])/(d[pL]-d[qL]) between V[qL] and V[pL]
+ M4R: ($1-d[qR])/(d[pR]-d[qR]) between V[qR] and V[pR]
+ line outlined rgbstring($2,$3,$4) \
+ from M4L to M4R }
+
+# Projected box object:
+[
+g = 1.2
+define(`axlen',1.2*g)
+define(`O3',`0,0,0')
+define(`X0',`axlen,0,0')
+define(`Y0',`0,axlen,0')
+define(`Z0',`0,0,axlen')
+
+# diagram viewing angle
+dazim = 54
+delev = 15
+setview(dazim,delev)
+
+# projection azimuth, elevation
+pazim = 20*dtor_
+pelev = 35*dtor_
+arad = 0.6*g
+
+# object displacement
+define(`D3',`0.3*g,0.6*g,0.9*g')
+
+# fixed coordinate frame
+O: project(O3)
+X: project(X0)
+Y: project(Y0)
+ Fector(X0,Z0) with .Origin at O ; "svg_it(x`'svg_sub(0))" at X rjust
+ Fector(Y0,Z0) with .Origin at O ; "svg_it(y`'svg_sub(0))" at Y ljust below
+ Fector(Z0,Y0) with .Origin at O ; "svg_it(z`'svg_sub(0))" at project(Z0) above
+
+define(`R01',`rot3Dz(pazim,rot3Dy(-pelev,$1,$2,$3))')
+define(`R10',`rot3Dy(pelev,rot3Dz(-pazim,$1,$2,$3))')
+
+thinlines_ ; psset_(linecolor=gray)
+ line from O to project(rot3Dz(pazim,axlen,0,0))
+psset_(linecolor=black)
+ arc -> ccw from project(arad,0,0) to project(rot3Dz(pazim,arad,0,0)) rad arad
+ "svg_theta" below
+ up_
+ arc -> cw from project(rot3Dz(pazim,arad,0,0)) \
+ to project(R01(arad,0,0)) rad arad
+ "svg_phi" rjust at project(rot3Dz(pazim,rot3Dy(-pelev/2,arad,0,0)))
+ arc -> from project(0,arad,0) to project(R01(0,arad,0)) rad arad
+ "svg_theta" above
+ right_
+ arc -> cw from project(0,0,arad/2) to project(R01(0,0,arad/2)) rad arad/2
+ "svg_phi" ljust at Here+(-1pt__,-3pt__)
+
+ Fector(R01(X0),R01(Z0)) with .Origin at O ;
+ "svg_it(x`'svg_sub(1))" above rjust at project(R01(X0))
+ Fector(R01(Y0),R01(Z0)) with .Origin at O ;
+ "svg_it(y`'svg_sub(1))" ljust at project(R01(Y0))
+ Fector(R01(Z0),R01(Y0)) with .Origin at O ;
+ "svg_it(z`'svg_sub(1))" above at project(R01(Z0))
+thicklines_
+
+# box object dimension
+b = 0.6*g
+d = 0.4*g
+h = 0.20*g
+
+# box object corners
+define(`B0',`D3')
+define(`B1',`sum3D(D3,d,0,0)') PB1: project(B1)
+define(`B2',`sum3D(D3,d,b,0)') PB2: project(B2)
+define(`B3',`sum3D(D3,0,b,0)') PB3: project(B3)
+define(`B4',`sum3D(D3,0,0,h)') PB4: project(B4)
+define(`B5',`sum3D(D3,d,0,h)') PB5: project(B5)
+define(`B6',`sum3D(D3,d,b,h)') PB6: project(B6)
+define(`B7',`sum3D(D3,0,b,h)') PB7: project(B7)
+
+# projected corners
+P0:project(R01(0,dcosine3D(2,R10(B0)),dcosine3D(3,R10(B0))))
+P1:project(R01(0,dcosine3D(2,R10(B1)),dcosine3D(3,R10(B1))))
+P2:project(R01(0,dcosine3D(2,R10(B2)),dcosine3D(3,R10(B2))))
+P3:project(R01(0,dcosine3D(2,R10(B3)),dcosine3D(3,R10(B3))))
+P4:project(R01(0,dcosine3D(2,R10(B4)),dcosine3D(3,R10(B4))))
+P5:project(R01(0,dcosine3D(2,R10(B5)),dcosine3D(3,R10(B5))))
+P6:project(R01(0,dcosine3D(2,R10(B6)),dcosine3D(3,R10(B6))))
+P7:project(R01(0,dcosine3D(2,R10(B7)),dcosine3D(3,R10(B7))))
+thinlines_
+ line from PB1 to P1
+ line from PB2 to P2
+ line from PB7 to P7
+ line from PB4 to P4
+thicklines_
+
+# draw the object
+ ifdpic(`line invis fill_(1) from PB4 to PB7 to PB6 to PB5
+ line from PB4 to PB7; line to PB6; line to PB5 ; line to PB4
+ line invis fill_(0.5) from PB5 to PB6 to PB2 to PB1
+ line from PB5 to PB6; line to PB2; line to PB1 ; line to PB5
+ line invis fill_(0.85) from PB6 to PB7 to PB3 to PB2
+ line from PB6 to PB7; line to PB3; line to PB2 ; line to PB6',
+ `gshade(1,PB4,PB7,PB6,PB5,PB4,PB7)
+ gshade(0.5,PB5,PB6,PB2,PB1,PB5,PB6)
+ gshade(0.85,PB6,PB7,PB3,PB2,PB6,PB7)')
+ line from PB4 to PB5 to PB1 to PB2 to PB3 to PB7 to PB4
+ line from PB5 to PB6 to PB7
+ line from PB6 to PB2
+
+ arrow from O to PB1 chop linethick pt__; "svg_it(X)" rjust
+
+ line from P4 to P5 to P1 to P2 to P3 to P7 to P4
+ line from P5 to P6 to P7
+ line from P6 to P2
+ line dashed from P4 to P0 to P3
+ line dashed from P0 to P1
+ ]
+
+# Globe:
+[
+ # Set small text size
+ iflatex(`textoffset = 1bp__; ifpsfrag(`textht = 9.5bp__',
+ `latexcommand({\small)') ')
+
+ azimuth = 15 # View angles in degrees
+ elevation = 35
+ setview(azimuth,elevation)
+
+ rectwid = 3.5 # Basic dimensions
+ rectht = 2.4
+ alpha = rectht/3
+
+# # Rectangle
+ NW: project(-rectht/2,-rectwid*0.25,0)
+ SW: project( rectht/2,-rectwid*0.25,0)
+ SE: project( rectht/2, rectwid*0.75,0)
+ NE: project(-rectht/2, rectwid*0.75,0)
+
+ shadedpolygon(NW:NE:SE:SW,,-90,
+ 0,0.25,0.25,0.25,
+ 1,1,1,1) with .Start at NW
+
+ define(`C3D',`0,0,alpha') # Centre of the sphere
+ C: project(C3D)
+
+# # Shaded sphere using PSTricks or tikz:
+# # this is black magic but PSTricks
+# # seems to give more control
+# ifpstricks(
+# `Highlight: \
+# project(sum3D(C3D,rot3Dz(-15*dtor_,rot3Dy(-60*dtor_,alpha,0,0))))
+# command "\pscustom[fillstyle=gradient,gradmidpoint=0.0,%"
+# command sprintf("gradbegin=gray,gradend=white,gradlines=%g,%%",alpha*200)
+# command "GradientCircle=true,GradientScale=1.5,%"
+# command sprintf("GradientPos={(%g,%g)}]{",Highlight.x,Highlight.y)
+# circle rad alpha at C
+# command "}%"',
+#
+# `ifpgf( # A little too dark with tikz-pgf, maybe:
+# `command sprintf(\
+# "\dpicdraw[ball color=white](%g,%g) circle (%gin)\dpicstop",\
+# C.x,C.y,alpha/2.54)',
+#
+# `circle rad alpha at C fill_(1) ')')
+
+ # Shaded sphere with pic shading:
+ shadedball(alpha) at C
+
+ S: 0,0 # The sphere bottom touch point
+ "svg_it(S)" at S+(0,-2pt__) rjust
+ "svg_alpha" at 0.5<S,C> ljust
+
+ define(`N3D',`0,0,2*alpha') # North pole
+ N: project(N3D)
+ "svg_it(N)" at N+(0,3pt__) ljust
+
+ phi = 65*dtor_
+ define(`Phat3D',`rot3Dz(phi,alpha*3,0,0)')
+ Phat: "svg_it(P)" at project(Phat3D) ljust
+ "svg_symbol(&`#'94;)" at last "".n ljust
+
+ X: project(rectht/2*0.8,0,0)
+ Y: project(0,rectwid/2*0.8,0)
+
+`define' linevis { # ratio # Visibility function for lines fom S to Tmp
+ Tlv: $1 between S and Tmp
+ $2 = distance(Tlv,C)-alpha }
+
+`define' invisline { # name # Draw dashed invisible part of line in
+ Tmp: $1 # the plane
+ findroot(linevis, 0, 1, 1e-8, x)
+ line dashed from S to x between S and Tmp chop 0 chop 0.05 }
+
+thinlines_ # axes
+ invisline(X)
+ arrow to X chop 0.05 chop 0; "svg_it(x)" below
+ invisline(Y)
+ arrow to Y chop 0.05 chop 0; "svg_it(y)" ljust
+ line dashed from S to N chop 0 chop 0.05
+ arrow up alpha*0.5 chop 0.05 chop 0 ; "svg_it(z)" above
+ invisline(Phat)
+ line to Phat chop 0.05 chop 0
+ arc ccw -> rad alpha from project(alpha/2,0,0) to \
+ project(rot3Dz(phi,alpha/2,0,0))
+ "svg_phi" below at 0.5 between last arc.start and last arc.end
+
+ # vector (ratio along (N to Phat))
+define(`ray',`sum3D(N3D,sprod3D($1,diff3D(Phat3D,N3D)))')
+`define' rayvis { # ratio
+ $2 = length3D(diff3D(ray($1),C3D))-alpha }
+
+ findroot(rayvis, 1e-3, 1, 1e-8, p) # Find P
+ P: "svg_it(P)" at project(ray(p)) ljust above
+
+thicklines_
+ line dashed from N to P chop 0 chop 0.05
+ line to Phat chop 0.05 chop 0
+
+define(`meridian',`rot3Dz(phi,rot3Dy(-($1),alpha,0,0))')
+`define' meridianvis { # angle # Visibility function on the meridian
+ $2 = dot3D(meridian($1),View3D) }
+
+thinlines_ # Draw the meridian
+ findroot(meridianvis, 0, pi_, 1e-8, y)
+ n = 0
+ for ang = y-pi_ to y by pi_/20 do {
+ Q[n]: project(sum3D(C3D,meridian(ang))); n+=1 }
+ fitcurve(Q,n-1)
+ n = 0
+ for ang = y to y+pi_ by pi_/20 do {
+ Q[n]: project(sum3D(C3D,meridian(ang))); n+=1 }
+ fitcurve(Q,n-1,dashed)
+
+define(`equator',`rot3Dz($1,alpha,0,0)')
+`define' equatorvis { # angle # Visibility function on the equator
+ $2 = dot3D(View3D,equator($1)) }
+
+ findroot(equatorvis, 0, pi_, 1e-8, y)
+ n = 0
+ for ang = y-pi_ to y by pi_/20 do {
+ Q[n]: project(sum3D(C3D,equator(ang))); n+=1 }
+ fitcurve(Q,n-1)
+ n = 0
+ for ang = y to y+pi_ by pi_/20 do {
+ Q[n]: project(sum3D(C3D,equator(ang))); n+=1 }
+ fitcurve(Q,n-1,dashed)
+
+ line dashed from C to P # beta
+ line dashed from C to project(sum3D(C3D,equator(phi)))
+ arc ccw -> from 0.6 along_(last line) to 0.6 between C and P
+ "svg_beta" ljust at last arc.e+(0,2pt__)
+
+ iflatex(ifpsfrag(,`latexcommand(})'))
+ ] with .w at last [].e+(0.5,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/fetSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/fetSVG.m4
new file mode 100644
index 00000000000..2393513219a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/fetSVG.m4
@@ -0,0 +1,152 @@
+.PS
+# `fetSVG.m4'
+cct_init(svg_font(Times,11bp__))
+dwn = 0.8
+rgt = 0.9
+
+dnl `IRF4905(linespec,R)'
+define(`IRF4905',
+ `[ ifelse(`$1',,,`eleminit_(`$1')')
+ Q: mosfet(,`$2',LdPzEDSQdB,) ifelse(`$1',,`
+ S: Q.tr_xy(-4,-2); line from Q.tr_xy(-2,-2) to S
+ D: Q.tr_xy( 4,-2); line from Q.tr_xy(2,-2) to D',
+ `with .Diode.c at last line.c
+ S: last line.start; D: last line.end; line from S to D ')
+ G: Q.G
+ circle rad 5*dimen_/10 at Q.tr_xy(0,1) ]')
+
+define(`rmove',0.75)
+define(`dir_',`right_')
+
+dir_
+ {j_fet(right_ dimen_,,,E)
+ `"j_fet(right_ dimen_,,,E)"' wid 1.5 at last [].s+(0.0,-0.05) below
+ "G" at last [].G rjust above
+ "S" at last [].S rjust
+ "D" at last [].D ljust
+ }
+
+ {move down_ dwn; dir_
+ j_fet(,,P,)
+ `"j_fet(,,P,)"' at last [].s+(0,-0.05) below
+ "G" at last [].G rjust
+ "S" at last [].S rjust
+ "D" at last [].D ljust
+ }
+
+ move right_ 1.35; dir_
+ {e_fet(,R,,)
+ `"e_fet(,R,,)"' at last [].s+(0,-0.2) below
+ "G" at last [].G rjust
+ "S" at last [].S rjust
+ "D" at last [].D ljust
+ }
+
+ {move down_ dwn; dir_
+ e_fet(,,P,)
+ `"e_fet(,,P,)"' at last [].s+(0,-0.05) below}
+
+ move right_ 1; dir_
+ {d_fet(,,,)
+ `"d_fet(,,,)"' at last [].s+(0,-0.05) below}
+
+ {move down_ dwn; dir_
+ d_fet(,,P,)
+ `"d_fet(,,P,)"' at last [].s+(0,-0.05) below}
+
+ move right_ 1; dir_
+ {e_fet(,,,S)
+ `"e_fet(,,,S)"' at last [].s+(0,-0.05) below}
+
+ {move down_ dwn; dir_
+ e_fet(,,P,S)
+ `"e_fet(,,P,S)"' at last [].s+(0,-0.05) below}
+
+ move right_ 1; dir_
+ {d_fet(,,,S)
+ `"d_fet(,,,S)"' at last [].s+(0,-0.05) below}
+
+ {move down_ dwn; dir_
+ d_fet(,,P,S)
+ `"d_fet(,,P,S)"' at last [].s+(0,-0.05) below}
+right_
+{ [
+ c_fet(,,,)
+ `"c_fet(,,,)"' at last [].s+(0,-0.05) below
+ move right rgt from last [].e
+ c_fet(,,P)
+ `"c_fet(,,P)"' at last [].s+(0,-0.05) below
+ ] with .n at 5th last [].s+(0,-0.3)
+ }
+move down 1; right_
+[
+ linewid = linewid*1.2
+
+ Q1: mosfet(,,dGSDF,)
+ { "`mosfet'(,,dGSDF,)" at last [].s+(0,-0.1) below wid 1.3
+ thinlines_
+ arrow <- down .05 left .15 from (Q1.G.x,Q1.G.y-0.05)
+ "dG" rjust
+ arrow <- down .10 left .30 from Q1.Channel.start+(.15,0)
+ "F" rjust
+ arrow <- down .05 left .15 from (Q1.S.x,Q1.S.y+0.05)
+ "S" rjust
+ arrow <- down .05 right .15 from (Q1.D.x,Q1.D.y+0.05)
+ "D" ljust
+ thicklines_ }
+
+ move right_ rmove
+ Q2: mosfet(,,uHSDF,)
+ {"`...'(,,uHSDF,)" at last [].s+(0,-0.15) below
+ thinlines_
+ arrow <- down .05 left .15 from (Q2.G.x,Q2.G.y-0.05)
+ "uH" rjust
+ thicklines_ }
+
+ move right_ rmove
+ Q3: mosfet(,,LEDSQuB,)
+ {"`...'(,,LEDSQuB,)" at last [].s+(0,-0.15) below
+ thinlines_
+ arrow <- down .05 left .15 from (Q3.G.x,Q3.G.y-0.05)
+ "L" rjust
+ arrow <- down .13 left .30 from Q3.Channel.start+(.12,0)
+ "E" rjust
+ arrow <- down .05 left .10 from Q3.S+(.06,0)
+ "Q" rjust
+ arrow <- down .08 right .24 from (Q3.B.x,Q3.B.y+0.175)
+ "uB" ljust
+ thicklines_ }
+
+ move right_ rmove
+ Q4: mosfet(,,LEDSuB)
+ {`"...(,,LEDSuB)"' at last [].s+(0,-0.15) below
+ "G" at last [].G rjust
+ "S" at last [].S rjust
+ "D" at last [].D ljust
+ "B" at last [].B below
+ }
+
+ move right_ rmove
+ Q5: mosfet(,,ZSDFdT,)
+ {"`...'(,,ZSDFdT,)" at last [].s+(0,-0.05) below
+ thinlines_
+ arrow <- down .08 left .08 from (Q5.S.x,Q5.S.y+0.12)
+ "Z" rjust
+ arrow from last arrow.end to Q5.Channel.c+(0.05,0)
+ arrow from last arrow.start to (Q5.D.x,Q5.D.y+.05)
+ arrow <- down .08 right .24 from (Q5.G.x,Q5.G.y-0.02)
+ "dT" ljust
+ thicklines_ }
+
+ move right_ rmove
+ up_
+ Q6: IRF4905 with .c at Here
+ {`"IRF4905"' at Q6.s+(0,-0.15) below
+ "G" at Q6.G rjust
+ "D" wid 0.1 at Q6.D ljust above
+ "S" at Q6.S ljust below
+ }
+ ] with .n at last [].s+(0,-.2)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/graysurfSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/graysurfSVG.m4
new file mode 100644
index 00000000000..9ea55807039
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/graysurfSVG.m4
@@ -0,0 +1,190 @@
+.PS
+# graysurfSVG.m4
+threeD_init
+copy "HOMELIB_/dpictools.pic"
+
+Overall: [
+
+Surface:[
+# This just draws the facets back to front
+
+ setview(20,30)
+ dimen = 1.5
+
+ xmax = 2*dimen
+ ymax = 1.5*dimen
+ zmax = 1*dimen
+
+ define(`fn',
+ `expe(-(`$1')/tt)*cos((`$2')/xmax*1.75*twopi_)*cos((`$1')/ymax*twopi_)')
+
+ nx = 24; dx = xmax/nx
+ ny = 30; dy = ymax/ny
+ tt = 1.5
+ fnmax = fn(0,0,0)
+
+ Orig: (0,0)
+ linethick_(1.2)
+ arrow from Orig to 1.2 <Orig,(project(xmax,0,0))> ; "svg_it(x)" wid 0.08 below
+ arrow from Orig to 1.2 <Orig,(project(0,ymax,0))> ; "svg_it(y)" ljust
+ arrow from Orig to 1.2 <Orig,(project(0,0,zmax))> ; "svg_it(z)" rjust
+
+ linethick_(0)
+ for i = 0 to nx-1 do {
+ x = xmax*i/nx
+ for j = 0 to ny-1 do {
+ y = ymax*j/ny
+ fnxy = fn(x,y)
+ shade((fnmax+fnxy)/fnmax/2,
+ line from (project(x,y,fnxy)) to (project(x,(y+dy),`fn(x,(y+dy))'))\
+ then to (project((x+dx),(y+dy),`fn((x+dx),(y+dy))'))\
+ then to (project((x+dx),y,`fn((x+dx),y)'))\
+ then to (project(x,y,fnxy))
+ ) } }
+] with .w at last [].e+(-0.2,0)
+
+Torus: [
+# Calculate all the facet centres but draw
+# only a subset of them after sorting
+
+ viewazimuth = 20 # Set view angles in degrees
+ viewelevation = 30
+
+ setview(viewazimuth,viewelevation,0)
+
+ sfactor = 0.7
+ tradius = 2*sfactor
+ sradius = 0.75*sfactor
+
+define(`torus',`rot3Dz((`$1')*dtor_,
+ sum3D(tradius,0,0,rot3Dy((`$2')*dtor_,sradius,0,0)))')
+
+define(`tvisible',`dot3D(view3D1,view3D2,view3D3,
+ rot3Dz((`$1')*dtor_,rot3Dy((`$2')*dtor_,1,0,0)))')
+
+Orig: (0,0)
+X: arrow from Orig to (project(tradius+sradius*4,0,0)); "x" rjust
+Y: arrow from Orig to (project(0,tradius+sradius*2,0)); "y" below wid 4bp__
+
+ dt = 10 # major angle degrees per facet
+ ds = 10 # minor angle degrees per facet
+
+ # create the arrays and sort
+ n = 0
+ for t = dt to 360+dt/2 by dt do {
+ for s=ds/2 to 360.1 by ds do {
+ if tvisible(t,s) >= 0 then {
+ n +=1
+ t[n] = t
+ s[n] = s
+ d[n] = dot3D(torus(t,s),view3D1,view3D2,view3D3) # view distance
+ ix[n] = n
+ } } }
+#prval(n)
+ dpquicksort(d,1,n,ix)
+
+ # draw the facets
+thinlines_
+ for i = 1 to n do {
+ tc = t[ix[i]]; sc = s[ix[i]]
+ SE: (project(torus(tc+dt/2,sc-ds/2)))
+ SW: (project(torus(tc-dt/2,sc-ds/2)))
+ NW: (project(torus(tc-dt/2,sc+ds/2)))
+ NE: (project(torus(tc+dt/2,sc+ds/2)))
+ f = ((dcosine3D(3,torus(tc,sc))/sradius+1)/2)^2
+ g = min(f,0.9)
+ setrgb(g,g,g)
+# line fill f ifpdf( invis ) \
+# from SE to SW then to NW then to NE then to SE
+ shade(f,
+ line invis fill f from SE to SW then to NW then to NE then to SE )
+
+ resetrgb
+ }
+
+thicklines_
+ arrow from Orig to (project(0,0,tradius*1.4)); "z" above
+ dashline(from Orig to (project(torus(0,0))),,,,G)
+ arrow to X.end
+ dashline(from Orig to (project(torus(90,0))),,,,G)
+ arrow to Y.end
+
+] with .sw at last [].se+(0.2,0)
+
+Hat: [
+# Sort as for the torus but draw edges too
+
+ azimuth = 25 # View angles in degrees
+ elevation = 20
+ setview(azimuth,elevation)
+ # the 3D object: `hat(t,y)'
+ define(`hat',`cosd($1)*($2),sind($1)*($2),(($2)^2-1)^2')
+ define(`gradient',`(-4*($2)*(($2)^2-1)*cosd(`$1')),
+ (-4*($2)*(($2)^2-1)*sind(`$1')),1')
+ define edge {$2=dot3D(View3D,gradient($1,y))}
+ define(`hatvis',
+ `(($2 > 0.6) || (dot3D(View3D,gradient($1,$2)) > 0))')
+
+ # grid parameters
+ dang = 09
+ maxy = 1.25
+ dy = 0.05
+
+Orig: (0,0)
+X: arrow from Orig to (project(maxy*1.2,0,0)); "x" rjust
+Y: arrow from Orig to (project(0,maxy*1.2,0)); "y" ljust
+Xv: (project(1,0,0))
+Yv: (project(0,1,0))
+Zv: (project(0,0,1))
+ # create the arrays and sort
+ n = 0
+ for t = dang/2 to 360.1 by dang do {
+ for y=dy/2 to maxy by dy do {
+ if hatvis(t,y) then {
+ n +=1
+ t[n] = t
+ y[n] = y
+ d[n] = dot3D(hat(t,y),View3D) #distance toward the front
+ ix[n] = n
+ } } }
+#prval(n)
+ dpquicksort(d,1,n,ix)
+ # draw the facets
+ ellipse wid maxy*2 ht maxy*2*sind(elevation) \
+ with .c at (project(0,0,(maxy^2-1)^2)+linethick bp__/2)
+thinlines_
+ for i = 1 to n do {
+ tc = t[ix[i]]; yc = y[ix[i]]
+ SE: (project(hat(tc+dang/2,yc-dy/2)))
+ SW: (project(hat(tc-dang/2,yc-dy/2)))
+ NW: (project(hat(tc-dang/2,yc+dy/2)))
+ NE: (project(hat(tc+dang/2,yc+dy/2)))
+ f = abs(yc^2-1)
+ line invis fill f from SE to SW then to NW then to NE then to SE
+ }
+
+ # Outline where the surface goes invisible
+mm = int(maxy/dy)
+nr = -1
+for i=1 to mm do { y = i/(mm+3)
+ findroot(edge,(azimuth+2),(azimuth+180-2),1e-8,t)
+ nr +=1
+ R[mm+nr]: (project(hat(t,y)))
+ R[mm-1-nr]: (-R[mm+nr].x,R[mm+nr].y)
+ }
+fitcurve(R,mm*2-1)
+
+ # Z axis
+thicklines_
+Z: arrow from Zv to (project(0,0,1.2)); "z" ljust
+ line dashed from Orig to Zv chop 0 chop dashwid/2
+ line dashed from Orig to Xv
+ line dashed from Orig to Yv
+
+ # Partial rim
+ellipsearc(maxy*2,maxy*2*sind(elevation),-pi_*1.4,pi_/3) \
+ with .C at (project(0,0,(maxy^2-1)^2)+linethick bp__/2)
+] scaled 1.25 with .s at 1st [].ne+(0,-0.75)
+] scaled 0.85
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4
new file mode 100644
index 00000000000..88ea5b65a04
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/icsSVG.m4
@@ -0,0 +1,122 @@
+divert(-1)
+
+ Macros defining some integrated circuits
+
+define(`lg_pinsep',3*L_unit) logic pin separation in logic units
+define(`lg_chipwd',18*L_unit) default chip width
+
+ `A sequence of pins along the east or west side of a chip:
+ lg_pinseq(initial pin no,final pin no,
+ e|w,initial offset,pinnum_root,Labelroot,[not])'
+define(`lg_pinseq',`for_($1,$2,1,
+ `lg_pin( Chip.s`$3'+(0,eval($4+m4x)*lg_pinsep),
+ $6`'m4x,Pin`'eval($5`'m4x),`$3'`$7',eval($5`'m4x))') ')
+
+define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep
+ "6116" at Chip.sw+(0,-2bp__) below ljust
+ lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin12,w,12)
+ lg_pin(Chip.sw_+(0,2*lg_pinsep),,Pin18,wN,18)
+ "svg_small(CS,75)" wid textht*1.5 at (Chip.w,last line) ljust
+ { line right last "".wid from last "".nw+(1,0)*textoffset }
+
+ lg_pinseq(0,2,w,4,9+,D)
+ lg_pinseq(3,7,w,4,10+,D)
+ lg_pin(Chip.sw_+(0,13*lg_pinsep),,Pin21,w,21)
+ "svg_small(R/W,75)" wid textht*2.0 at (Chip.w,last line) ljust
+ { line right last "".wid/2 from last "".n+(2,0)*textoffset }
+
+ lg_pin(Chip.sw_+(0,14*lg_pinsep),V`'svg_small(CC,75),Pin24,w,24)
+ lg_pin(Chip.se_+(0,lg_pinsep),,Pin20,eN,20)
+ "svg_small(OE,75)" wid textht*1.5 at (Chip.e,last line) rjust
+ { line left last "".wid from last "".ne+(-1,0)*textoffset }
+
+ lg_pinseq(0,7,e,3,8-,A)
+ lg_pinseq(8,9,e,3,31-,A)
+ lg_pin(Chip.se_+(0,13*lg_pinsep),A10,Pin19,e,19)
+ ]')
+
+define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep
+ "6502" at Chip.sw_+(0,-2bp__) below_ ljust_
+ lg_pin(Chip.sw_+(0,lg_pinsep),V`'svg_small(SS,75),Pin21,w,21)
+ lg_pin(Chip.sw_+(0,2*lg_pinsep),V`'svg_small(SS,75),Pin1,w,1)
+ lg_pin(Chip.sw_+(0,4*lg_pinsep),,Pin34,w,34)
+ "svg_small(R/W,75)" wid textht*2.0 at (Chip.w,last line) ljust
+ { line right last "".wid/2 from last "".n+(2,0)*textoffset }
+
+ lg_pinseq(0,7,w,6,33-,D)
+ lg_pin(Chip.sw_+(0,15*lg_pinsep),,Pin40,wN,40)
+ "svg_small(RESET,75)" wid textht*3.8 at (Chip.w,last line) ljust
+ { line right last "".wid from last "".nw+(1,0)*textoffset }
+
+ lg_pin(Chip.sw_+(0,17*lg_pinsep),SYNC,Pin7,w,7)
+ lg_pin(Chip.sw_+(0,19*lg_pinsep),,Pin6,wN,6)
+ "svg_small(NMI,75)" wid textht*2.1 at (Chip.w,last line) ljust
+ { line right last "".wid from last "".nw+(1,0)*textoffset }
+
+ lg_pin(Chip.sw_+(0,21*lg_pinsep),RDY,Pin2,w,2)
+ lg_pin(Chip.sw_+(0,22*lg_pinsep),SO,Pin38,w,38)
+ lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'svg_small(CC,75),Pin8,w,8)
+ lg_pin(Chip.se_+(0,lg_pinsep),CK`'svg_small(1,75)(in),Pin39,e,39)
+ lg_pin(Chip.se_+(0,4*lg_pinsep),CK`'svg_small(2,75)(out),Pin37,e,37)
+ lg_pinseq(0,11,e,6,9+,A)
+ lg_pinseq(12,15,e,6,10+,A)
+ lg_pin(Chip.se+(0,23*lg_pinsep),,Pin4,eN,4)
+ "svg_small(IRQ,75)" wid textht*2.0 at (Chip.e,last line) rjust
+ { line left last "".wid from last "".ne+(-1,0)*textoffset }
+
+ ]')
+
+define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep
+ "6522" at Chip.sw+(0,-2bp__) below ljust
+ lg_pin(Chip.sw_+(0,lg_pinsep),V`'svg_small(SS,75),Pin1,w,1)
+ lg_pin(Chip.sw_+(0,3*lg_pinsep),CS1,Pin24,w,24)
+ lg_pin(Chip.sw_+(0,4*lg_pinsep),CK,Pin25,w,25)
+ lg_pin(Chip.sw_+(0,5*lg_pinsep),,Pin23,wN,23)
+ "svg_small(CS2,75)" wid textht*2.2 at (Chip.w,last line) ljust
+ { line right last "".wid from last "".nw+(1,0)*textoffset }
+
+ lg_pin(Chip.sw_+(0,7*lg_pinsep),RS0(A0),Pin38,w,38)
+ lg_pin(Chip.sw_+(0,8*lg_pinsep),RS1(A1),Pin37,w,37)
+ lg_pin(Chip.sw_+(0,9*lg_pinsep),RS2(A2),Pin36,w,36)
+ lg_pin(Chip.sw_+(0,10*lg_pinsep),RS3(A3),Pin35,w,35)
+ lg_pinseq(0,7,w,12,33-,D)
+ lg_pin(Chip.sw_+(0,21*lg_pinsep),,Pin22,w,22)
+ "svg_small(R/W,75)" wid textht*2.0 at (Chip.w,last line) ljust
+ { line right last "".wid/2 from last "".n+(2,0)*textoffset }
+
+ lg_pin(Chip.sw_+(0,22*lg_pinsep),,Pin21,wN,21)
+ "svg_small(IRQ,75)" wid textht*2.0 at (Chip.w,last line) ljust
+ { line right last "".wid from last "".nw+(1,0)*textoffset }
+
+ lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'svg_small(CC,75),Pin20,w,20)
+ lg_pinseq(0,7,e,1,10+,PB)
+ lg_pinseq(1,2,e,8,17+,CB)
+ lg_pinseq(0,7,e,12,2+,PA)
+ lg_pinseq(1,2,e,19,41-,CA)
+ lg_pin(Chip.se_+(0,23*lg_pinsep),,Pin34,eN,34)
+ "svg_small(RESET,75)" wid textht*3.8 at (Chip.e,last line) rjust
+ { line left last "".wid from last "".ne+(-1,0)*textoffset }
+
+ ]')
+
+define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep
+ "74LS138" at Chip.sw+(0,-2bp__) below ljust
+ lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin8,w,8)
+ lg_pin(Chip.sw_+(0,2*lg_pinsep),,Pin4,wN,4)
+ "svg_small(G2a,75)" wid textht*2.0 at (Chip.w,last line) ljust
+ { line right last "".wid from last "".nw+(1,0)*textoffset }
+
+ lg_pin(Chip.sw_+(0,3*lg_pinsep),,Pin5,wN,5)
+ "svg_small(G2b,75)" wid textht*2.0 at (Chip.w,last line) ljust
+ { line right last "".wid from last "".nw+(1,0)*textoffset }
+
+ lg_pin(Chip.sw_+(0,5*lg_pinsep),A,Pin1,w,1)
+ lg_pin(Chip.sw_+(0,6*lg_pinsep),B,Pin2,w,2)
+ lg_pin(Chip.sw_+(0,7*lg_pinsep),C,Pin3,w,3)
+ lg_pin(Chip.sw_+(0,9*lg_pinsep),G1,Pin6,w,6)
+ lg_pin(Chip.sw_+(0,10*lg_pinsep),V`'svg_small(CC,75),Pin16,w,16)
+ lg_pinseq(0,6,e,2,15-,Y,n)
+ lg_pin(Chip.se_+(0,9*lg_pinsep),Y7,Pin7,eN,7)
+ ]')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/lcctSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/lcctSVG.m4
new file mode 100644
index 00000000000..0a91b823ccc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/lcctSVG.m4
@@ -0,0 +1,195 @@
+.PS
+# lcctSVG.m4
+maxpswid = 10
+log_init(svg_font(sans-serif,11bp__,1bp__))
+include(icsSVG.m4)
+
+ textht = textht * 0.9
+
+define(`dimen_',0.5)
+define(`elen_',dimen_)
+define(`Groundtype',`')
+
+define(`breakout',` for i = 1 to `$1' do {
+ {line `$2' ifelse(`$4',,del,`$4')-jog/2 then `$2' jog/2 `$3' jog \
+ then `$3' lg_pinsep}
+ move `$3' lg_pinsep }
+ move `$2' ifelse(`$4',,del,`$4')-jog/2 then `$2' jog/2 `$3' jog ')
+
+del = lg_pinsep
+jog = del*2/3
+
+ right_
+IC1: ic6502
+
+Vcc: IC1.Pin8.end.x-del-elen_,IC1.Pin4.y+lg_pinsep+3*del
+Reset: IC1.Pin8.end.x-del,Vcc.y+del
+
+ resistor(up_ Vcc.y-IC1.Pin4.y from IC1.Pin4.end)
+
+ line left 2*del from IC1.Pin6.end
+ line up_ to (Here,Vcc) chop 0 chop elen_
+ resistor
+
+ line left del from IC1.Pin40.end
+ {line to (Here,Reset)}
+ move left elen_
+ {NOT_gate(right_ elen_)}
+ {reversed(`capacitor',to (Here,Vcc),C)}
+ down_; resistor; ground(,T,Groundtype)
+
+ line from IC1.Pin2.end to (IC1.Pin2.end,Vcc)
+
+ move to IC1.Pin26.end; breakout(8,left,down)
+ line to (Here,IC1.sw+(0,-del))
+ line down jog right jog/2
+Data: Here
+
+ line from IC1.Pin1.end down_ 2*lg_pinsep; ground(,T,Groundtype)
+
+ line left 2*del from IC1.Pin34.end
+ line to (Here,Data+(0,-del))
+RWB: Here
+
+ move to IC1.Pin25.end; breakout(16,right,down)
+ line to (Here,RWB)+(0,-del+jog) then down jog left jog/2
+Addr: Here
+
+ right_
+IC5: ic74LS138 with .Chip.nw at (IC1.Chip.w.x,Addr.y-2*del)
+ line from IC5.Pin5.end down_ 3*lg_pinsep ; ground(,T,Groundtype)
+ line from IC5.Pin16.end down_ 1.5*lg_pinsep ; ground(,T,Groundtype)
+ move to IC5.Pin1.end; breakout(3,left,up)
+ line to Here.x,Addr.y-jog then up jog right jog/2 then to Addr
+
+ line right_ 2*del from IC1.Pin39.end
+ { NOT_gate(right_ 3*del)
+C1: Here }
+ capacitor(up_ elen_*0.6)
+ {resistor(right_ 3*del)}
+ line up 2*(IC1.Pin37.y-Here.y)
+ {line from IC1.Pin37.end to (Here,IC1.Pin37)}
+ right_; xtal(right_ 3*del)
+
+IC2: ic6116 with .Chip.nw at Here.x+2*del+lg_plen*L_unit,IC1.Chip.n.y
+ line from IC2.Pin24.end up to (IC2.Pin24.end,Vcc)
+ right_
+Or1: OR_gate with .Out at IC2.Pin21.end
+ line from Or1.In2 left del then down del
+ line to (C1,Here) then to C1
+ line from Or1.In1 left del
+ line to (Here,IC2.Chip.nw+(0,del))
+RW: Here
+ move to IC2.Pin17.end; breakout(8,left,down)
+ line to (Here,Data)+(0,jog) then down jog left jog/2
+ line down_ lg_pinsep from IC2.Pin12.end ; ground(,T,Groundtype)
+ move to IC2.Pin19.end; breakout(11,right,down)
+ line to (Here,Addr) chop 0 chop jog
+ line down jog left jog/2
+ line down_ lg_pinsep from IC2.Pin20.end ; ground(,T,Groundtype)
+
+ right_
+IC3: ic6116 with .Chip.nw at IC2.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0)
+IC4: ic6522 with .Chip.nw at IC3.Chip.ne + (IC2.Chip.nw.x - IC1.Chip.ne.x-del,0)
+IC6: ic74LS138 with .Chip.nw at (IC3.Chip.nw,IC5.Chip.nw)
+
+ line from Vcc to (IC4.Pin34.end.x+del,Vcc.y)
+ line from Reset to (IC4.Pin34.end,Reset) then to IC4.Pin34.end
+
+ line right_ 2*del from (C1,IC4.Pin25); NOT_gate; line to IC4.Pin25.end
+ line right del from IC1.Pin4.end; line to Here.x,Vcc.y-del
+ line to (IC4.Pin21.end,Here)-(del,0) then to IC4.Pin21.end-(del,0) \
+ then to IC4.Pin21.end
+
+ line from IC3.Pin21.end to (IC3.Pin21.end,Vcc)
+ move to IC3.Pin17.end
+ breakout(8,left,down); line to (Here,Data)+(0,jog) then down jog left jog/2
+ move to IC3.Pin19.end
+ breakout(11,right,down); line to (Here,Addr)+(0,jog) then down jog left jog/2
+ move to IC4.Pin26.end
+ breakout(8,left,down,2*del);
+ line to (Here,Data)+(0,jog) then down jog left jog/2 then to Data
+ move to IC4.Pin35.end
+ breakout(4,left,down); line to (Here,Addr)+(0,jog) then down jog left jog/2 \
+ then to Addr
+ line from IC4.Pin20.end to (IC4.Pin20.end,Vcc)
+ line down_ lg_pinsep from IC4.Pin1.end; ground(,T,Groundtype)
+ line left 3*del from IC4.Pin23.end
+ line to (Here,IC6.Pin7) then to IC6.Pin7.end
+ line down_ 2*lg_pinsep from IC3.Pin18.end; ground(,T,Groundtype)
+
+ line down_ lg_pinsep from IC6.Pin8.end; ground(,T,Groundtype)
+ line up_ 2.5*lg_pinsep from IC6.Pin16.end \
+ then right_ lg_pinsep then down_ lg_pinsep/2; ground(,T,Groundtype)
+ move to IC6.Pin5.end; breakout(1,left,up); line up_ lg_pinsep
+ move to IC6.Pin1.end; breakout(3,left,up)
+ line to (Here,Addr)-(0,jog) then up jog left jog/2
+
+ line from RW to (IC3.Pin19.end+(2*del,0),RW)
+RWE: Here
+ line to (RWE,RWB) then to RWB
+ line from IC4.Pin22.end to (RWE,IC4.Pin22.end)
+
+ right_
+Or3: OR_gate with .Out at IC3.Pin20.end.x-del,IC1.Pin9.y
+ line from Or3.Out to (IC3.Pin20.end,Or3.Out) then to IC3.Pin20.end
+ left_
+Or2: OR_gate with .In2 at (IC2.Chip.se,Or3.In1)
+ line from Or2.Out to (IC2.Pin18.end-(3*del,0),Or2.Out)
+ line to (Here,IC2.Pin18) then to IC2.Pin18.end
+ line from Or2.In1 right del; line to (Here,IC1.Pin37)
+
+ line from Or3.In2 left del; line to (Here,IC1.Pin37)
+
+define(`addrlabel',`dnl
+ line invis right 4*del from IC5.Pin`$1'.end "svg_small(`$2')" above ')
+
+ addrlabel( 7,E000 - FFFF)
+ addrlabel( 9,C000 - DFFF)
+ addrlabel(10,A000 - BFFF)
+ addrlabel(11,8000 - 9FFF)
+ addrlabel(12,6000 - 7FFF)
+ addrlabel(13,4000 - 5FFF)
+ addrlabel(14,2000 - 3FFF)
+ addrlabel(15,0000 - 1FFF)
+
+ line from IC5.Pin7.end right 4*del
+K: Here; line to (K,IC5.Pin13)
+ line to (IC6.Pin4.end-(3*del,0),Here)
+ line to (Here,IC6.Pin4.end) then to IC6.Pin4.end
+
+Ands: [ right_
+ And1: AND_gate; line right del/2 then down del*3/2 \
+ then left And1.Out.x-And1.In1.x+del then down del then right_ del/2
+ And2: AND_gate with .In1 at Here
+ line from And2.Out right del/2 then down del then right_ del/2
+ And3: AND_gate with .In1 at Here
+ line right_ del/2 from And3.Out
+ NOT_gate
+ line right_ del/2
+ And4: AND_gate with .In1 at Here
+ ] with .And2.In1 at (K.x+2*del,IC5.Pin9.y)
+
+# line from Ands.And4.Out right del*3; line to (Here,Or3.In1) then to Or3.In1
+ line from Ands.And4.Out right IC6.Pin5.end.x-3*del-Ands.And4.Out.x
+ line to (Here,Or3.In1) then to Or3.In1
+ line from Ands.And4.In2 left del
+ line to (Here,IC5.Pin14) then to IC5.Pin14.end
+ line from IC5.Pin15.end to (IC2.Pin20.end.x+2*del,IC5.Pin15.y)
+ line to (Here,Or2.In2) then to Or2.In2
+ NOT_gate(right_ from (K,Ands.And3.In2) to Ands.And3.In2)
+ line from Ands.And2.In2 to (K+(del+jog/2,0),Ands.And2.In2)
+ line left jog/2 up jog; line to (Here.x,Addr.y-jog) then up jog left jog/2
+ line from Ands.And1.In1 to (K.x+del+jog/2,Ands.And1.In1.y) \
+ then left jog/2 up jog
+ line from Ands.And1.In2 to (K.x+del+jog/2,Ands.And1.In2.y) \
+ then left jog/2 up jog
+
+ line from IC6.Pin6.end left 2*del; line to (Here,IC4.Pin24)
+ line from IC4.Pin24.end to (IC2.Chip.se,IC4.Pin24)
+ move left dimen_; {NOT_gate(right_ dimen_)}
+ line left jog/2 down jog; line to (Here,Data) chop 0 chop jog
+ line down jog left jog/2
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/local_init.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/local_init.m4
new file mode 100644
index 00000000000..bf2dbda5976
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/local_init.m4
@@ -0,0 +1,2 @@
+command "<!-- local_init has been read -->"
+define(`Inkscape')
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/paletteSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/paletteSVG.m4
new file mode 100644
index 00000000000..2a26afdb991
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/paletteSVG.m4
@@ -0,0 +1,340 @@
+.PS
+# This is the source for a prototype svg library of electric circuit
+# elements. Each element is a compound svg object with corners on grid points.
+#
+# Processing svg.m4 and this file thought dpic -v gives
+# output that can be read into Inkscape.
+#
+define(`SIdefaults',`
+ scale = 25.4
+ arcrad = 5
+ arrowht = 2.5
+ arrowwid = arrowht/2
+ boxht = 12
+ boxrad = 0
+ boxwid = 20
+ circlerad = 5
+ dashwid = 1.5
+ ellipseht = 12
+ ellipsewid = 16
+ lineht = 12
+ linewid = 12
+ moveht = 12
+ movewid = 12
+ textht = ifsvg(3,0)
+ textoffset = 1
+ textwid = 0
+')
+
+log_init(svg_font(sans-serif,11bp__))
+SIdefaults
+
+ # Assume dpic scale is in mm
+gunit = 1 # Inkscape grid dimension
+divert(-1)
+define(`elen_',`(10*gunit)') # default 2-terminal element length
+define(`dimen_',`(10*gunit)')# reference dimension for element bodies
+define(`L_unit',`(2*gunit)') # logic gate grid size
+define(`N_diam',1) # L_unit size of `not' circles
+
+ # grid round and chop
+define(`g_round',`(int((`$1')/gunit+100000.5 )-100000)*gunit')
+define(`g_chop', `(int((`$1')/gunit+100000.9999)-100000)*gunit')
+ # snap to grid
+define(`g_snap',`(g_round((`$1').x),g_round((`$1').y))')
+
+# Box containing an element. The element must be in a box that is
+# intersected by a horizontal or vertical line from entry to exit.
+define(`Gridbox',`[ command "<g>"
+ S: Here; `$1'; F: Here
+ if S.y == F.y then {
+ move from (max(S.x,F.x),F.y+g_chop(last[].n.y-F.y)) \
+ to (min(S.x,F.x),F.y-g_chop(F.y-last[].s.y)) } \
+ else {
+ move from (F.x+g_chop(last[].e.x-F.x),max(S.y,F.y)) \
+ to (F.x-g_chop(F.x-last[].w.x),min(S.y,F.y)) }
+ command "</g>" ] ')
+
+# Place compound object corners at grid intersections
+define(`Below',
+ `with .n at g_snap(ifelse(`$1',,`last []',`$1').s)-(0,2*gunit)')
+define(`Right',
+ `with .w at g_snap(ifelse(`$1',,`last []',`$1').e)+(2*gunit,0)')
+
+# for debug
+define(`prpos',`print (`$1').x/gunit,(`$1').y/gunit')
+divert(0)dnl
+
+[
+
+rpoint_(down_ elen_)
+A:Gridbox( resistor )
+ Gridbox( resistor(down_ dimen_*1/2) ) Right
+ Gridbox( resistor(,,E) ) Right
+ Gridbox( resistor(,,Q) ) Right
+ Gridbox( resistor(,,H) ) Right
+ Gridbox( resistor(,,N) ) Right
+ Gridbox( inductor(,W) ) Right
+ Gridbox( inductor(,W,,M) ) Right
+ Gridbox( inductor(,L) ) Right
+ Gridbox( inductor ) Right
+ Gridbox( inductor(,,,M) ) Right
+ Gridbox( capacitor ) Right
+ Gridbox( capacitor(,C) ) Right
+ Gridbox( capacitor(,P) ) Right
+ Gridbox( capacitor(,E) ) Right
+ Gridbox( capacitor(,K) ) Right
+ Gridbox( diode ) Right
+ Gridbox( diode(,K) ) Right
+ Gridbox( diode(,Z) ) Right
+ Gridbox( diode(,S) ) Right
+ Gridbox( diode(,L) ) Right
+ Gridbox( diode(,V) ) Right
+ Gridbox( diode(,v) ) Right
+ Gridbox( diode(,T) ) Right
+ Gridbox( diode(,CR) ) Right
+ Gridbox( diode(,D) ) Right
+ Gridbox( diode(,B) ) Right
+ Gridbox( diode(,LE) ) Right
+ Gridbox( [circle diam dimen_*0.7] ) Right
+ Gridbox( xtal ) Right
+ dot(at g_snap(last [].e+(2*gunit,0)))
+
+A:Gridbox( source ) Below(A)
+ Gridbox( source(,I) ) Right
+ Gridbox( source(,i) ) Right
+ Gridbox( source(,V) ) Right
+ Gridbox( source(,v) ) Right
+ Gridbox( source(,AC) ) Right
+ Gridbox( source(,S) ) Right
+ Gridbox( source(,X) ) Right
+ Gridbox( source(,F) ) Right
+ Gridbox( source(,P) ) Right
+ Gridbox( source(,U) ) Right
+ Gridbox( source(,R) ) Right
+ Gridbox( source(,T) ) Right
+ Gridbox( source(,L) ) Right
+ Gridbox( nullator ) Right
+ Gridbox( norator ) Right
+ Gridbox( consource ) Right
+ Gridbox( consource(,I) ) Right
+ Gridbox( consource(,i) ) Right
+ Gridbox( consource(,V) ) Right
+ Gridbox( consource(,v) ) Right
+ Gridbox( source(,Q) ) Right
+ Gridbox( source(,G) ) Right
+
+A:Gridbox( battery(up_ elen_) ) Below(A)
+ Gridbox( battery(up_ elen_,3) ) Right
+ Gridbox( ttmotor ) Right
+ Gridbox( memristor ) Right
+ Gridbox( tline ) Right
+ Gridbox( fuse ) Right
+ Gridbox( fuse(,D) ) Right
+ Gridbox( fuse(,B) ) Right
+ Gridbox( fuse(,C) ) Right
+ Gridbox( fuse(,S) ) Right
+ Gridbox( fuse(,HB) ) Right
+ Gridbox( fuse(,HC) ) Right
+ Gridbox( cbreaker ) Right
+ Gridbox( cbreaker(,,D) ) Right
+ Gridbox([variable(`[]',A)]) Right
+ Gridbox([variable(`[]',P)]) Right
+ Gridbox([variable(`[]',L)]) Right
+ Gridbox([variable(`[]',N)]) Right
+ Gridbox([variable(`[]',uN)]) Right
+ Gridbox([line to Here+(Rect_(dimen_/6,45))]) Right
+ Gridbox([line up dimen_*0.06 then right dimen_*0.12 \
+ then up dimen_*0.06]) Right
+ Gridbox([em_arrows]) Right
+ Gridbox([em_arrows(N)]) Right
+ Gridbox([em_arrows(ND)]) Right
+ Gridbox([em_arrows(I)]) Right
+ Gridbox([em_arrows(ID)]) Right
+ Gridbox([em_arrows(E)]) Right
+ Gridbox([em_arrows(ED)]) Right
+
+A:Gridbox( [right_; ground] ) Below(A)
+ Gridbox( [right_; ground(,T)] ) Right
+ Gridbox( [right_; ground(,,F)] ) Right
+ Gridbox( [right_; ground(,,E)] ) Right
+ Gridbox( [right_; ground(,,S)] ) Right
+ Gridbox( [right_; ground(,,L)] ) Right
+ Gridbox( [right_; ground(,,P)] ) Right
+ Gridbox( transformer(right_ 6*gunit,L) ) Right
+ Gridbox( transformer(right_ 8*gunit,,2,8) ) Right
+ Gridbox( transformer(,,8,W,4) ) Right
+ Gridbox( transformer(,,9,AL) ) Right
+ Gridbox( transformer(,R,8,AW) ) Right
+
+ rpoint_(right_)
+A:Gridbox( switch ) Below(A)
+ Gridbox( switch(,,O) ) Right
+ Gridbox( switch(,,D) ) Right
+ Gridbox( switch(,,OD) ) Right
+ Gridbox( switch(,,C) ) Right
+ Gridbox( switch(,,B) ) Right
+ Gridbox( switch(,C,B) ) Right
+ Gridbox( dswitch ) Right
+ Gridbox( dswitch(,,WBK) ) Right
+ Gridbox( dswitch(,,WBuD) ) Right
+ Gridbox( dswitch(,,WBF) ) Right
+ Gridbox( dswitch(,,WBKF) ) Right
+ Gridbox( dswitch(,,WBL) ) Right
+ Gridbox( dswitch(,,WBKL) ) Right
+
+A:Gridbox( dswitch(,,WBT) ) Below(A)
+ Gridbox( dswitch(,,WdBKC) ) Right
+ Gridbox( dswitch(,,WBM) ) Right
+ Gridbox( dswitch(,,WBCO) ) Right
+ Gridbox( dswitch(,,WBCMP) ) Right
+ Gridbox( dswitch(,,WBCY) ) Right
+ Gridbox( dswitch(,,WBCZ) ) Right
+ Gridbox( dswitch(,,WBCE) ) Right
+ Gridbox( dswitch(,,WBRH) ) Right
+ Gridbox( dswitch(,,WBRdH) ) Right
+ Gridbox( dswitch(,,WBRHH) ) Right
+
+A:Gridbox( dswitch(,,WBMMR) ) Below(A)
+ Gridbox( dswitch(,,WBMM) ) Right
+ Gridbox( dswitch(,,WBMR) ) Right
+ Gridbox( dswitch(,,WBEL) ) Right
+ Gridbox( dswitch(,,WBLE) ) Right
+ Gridbox( dswitch(,,WBKEL) ) Right
+ Gridbox( antenna ) Right
+ Gridbox( antenna(,,L) ) Right
+ Gridbox( antenna(,,T) ) Right
+ Gridbox( antenna(,,S) ) Right
+ Gridbox( antenna(,,D) ) Right
+ Gridbox( antenna(,,P) ) Right
+ Gridbox( antenna(,,F) ) Right
+
+A:Gridbox( amp(right_ elen_*10/8) ) Below(A)
+D1:Gridbox( integrator ) Right
+ Gridbox( delay ) Right
+ Gridbox( opamp ) Right
+ Gridbox( opamp(,,,,T) ) Right
+ Gridbox( amp(,dimen_/2) ) Right
+ Gridbox( integrator(,dimen_/2) ) Right
+ Gridbox( delay(,delay_rad_) ) Right
+ Gridbox( opamp(,,,dimen_*2/3) ) Right
+ Gridbox( opamp(,,,dimen_*2/3,T) ) Right
+
+right_
+A:Gridbox( relay(2) ) Below(A)
+ Gridbox( relay(2,O) ) Right
+ Gridbox( relay(2,C) ) Right
+ Gridbox( relay ) Right
+ Gridbox( contact ) Right
+ Gridbox( contact(O) ) Right
+ Gridbox( contact(C) ) Right
+
+up_
+A:Gridbox( [circle rad 29/10*gunit] ) Below(A)
+ Gridbox( bi_tr ) Right
+ Gridbox( bi_tr(,R) ) Right
+ Gridbox( bi_tr(,,P) ) Right
+ Gridbox( bi_tr(,R,P) ) Right
+
+ Gridbox( j_fet ) Right
+ Gridbox( j_fet(,R) ) Right
+ Gridbox( j_fet(,,P,) ) Right
+ Gridbox( j_fet(,R,P,) ) Right
+ Gridbox( e_fet(,,,) ) Right
+ Gridbox( e_fet(,R,,) ) Right
+
+ Gridbox( e_fet(,,P,) ) Right
+ Gridbox( e_fet(,R,P,) ) Right
+ Gridbox( d_fet(,,,) ) Right
+ Gridbox( d_fet(,R,,) ) Right
+ Gridbox( d_fet(,,P,) ) Right
+ Gridbox( d_fet(,R,P,) ) Right
+
+A:Gridbox( igbt ) Below(A)
+ Gridbox( ujt ) Right
+ Gridbox( ujt(,,P) ) Right
+rpoint_(down_)
+ Gridbox( thyristor ) Right
+ Gridbox( thyristor(,B) ) Right
+ Gridbox( thyristor(,BG) ) Right
+ Gridbox( thyristor(,A) ) Right
+ Gridbox( thyristor(,C) ) Right
+rpoint_(up_)
+ Gridbox( j_fet ) Right
+ Gridbox( e_fet ) Right
+ Gridbox( e_fet(,,,S) ) Right
+ Gridbox( e_fet(,,P) ) Right
+ Gridbox( e_fet(,,P,S) ) Right
+ Gridbox( d_fet ) Right
+ Gridbox( d_fet(,,,S) ) Right
+ Gridbox( d_fet(,,P,) ) Right
+ Gridbox( d_fet(,,P,S) ) Right
+ Gridbox( j_fet ) Right
+ Gridbox( j_fet(,,P) ) Right
+ Gridbox( mosfet(,,uHSDF) ) Right
+
+rpoint_(right_)
+A:Gridbox( tgate ) Below(A)
+ Gridbox( tgate(,B) ) Right
+ Gridbox( ptrans ) Right
+
+A:Gridbox( AND_gate ) Below(A)
+ Gridbox( OR_gate ) Right
+ Gridbox( NAND_gate ) Right
+ Gridbox( NOR_gate ) Right
+ Gridbox( XOR_gate ) Right
+ Gridbox( NXOR_gate ) Right
+ Gridbox( BUFFER_gate ) Right
+ Gridbox( NOT_gate ) Right
+
+# input lines for OR-like gates.
+define(`OR_inlgth',`(-sqrt(OR_rad^2-G_hht^2)+sqrt(OR_rad^2-`$1'^2))*L_unit')
+
+ Gridbox( [ {move right_ gunit}
+ {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
+ {line right_ OR_inlgth(0)}
+ {line right_ OR_inlgth(2) from Here+svec_(0,2)}
+ {line same from Here-svec_(0,2)}
+ {line right_ OR_inlgth(1) from Here+svec_(0,1)}
+ {line same from Here-svec_(0,1)}] ) Right
+ Gridbox( [ {move right_ gunit}
+ {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
+ {line right_ OR_inlgth(0)}
+ {line right_ OR_inlgth(2) from Here+svec_(0,2)}
+ {line same from Here-svec_(0,2)}] ) Right
+ Gridbox( [ {move right_ gunit}
+ {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
+ {line right_ OR_inlgth(2) from Here+svec_(0,2)}
+ {line same from Here-svec_(0,2)}] ) Right
+ Gridbox( [ {move right_ gunit}
+ {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
+ {line right_ OR_inlgth(0)}] ) Right
+
+right_
+A:Gridbox( speaker ) Below(A)
+ Gridbox( speaker(,,H) ) Right
+ Gridbox( bell ) Right
+ Gridbox( microphone ) Right
+ Gridbox( buzzer ) Right
+ Gridbox( buzzer(,,C) ) Right
+ Gridbox( earphone ) Right
+ Gridbox( earphone(,,C) ) Right
+ Gridbox( nport ) Right
+ Gridbox( nterm ) Right
+
+A:Gridbox( FlipFlop(D)
+ { line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__) } ) Below(A)
+ Gridbox( FlipFlop(T)
+ { line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__) } ) Right
+ Gridbox( FlipFlop(RS)
+ { line right 5bp__ at last [] . 1nd last ""+(-7bp__,4bp__) } ) Right
+ Gridbox( FlipFlop(JK)
+ { line right 5bp__ at last [] . 2nd last ""+(-7bp__,4bp__) } ) Right
+
+ ] with .nw at (0,0)
+
+"A draft palette of elements for Inkscape using a 1 mm grid" \
+ ljust below at last [].sw
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/pwrsupplySVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/pwrsupplySVG.m4
new file mode 100644
index 00000000000..843c6660b5e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/pwrsupplySVG.m4
@@ -0,0 +1,42 @@
+.PS
+# Pwrsupply.m4
+cct_init
+ifdef(`m4pco',`resetrgb')
+ linewid = linewid*1.2
+
+ down_
+T:transformer
+ line left_ elen_/4 from T.P1
+ rgbdraw(0,0,255,fuse(left_ elen_/3,D))
+ reversed(`switch')
+ gap(down_ to (Here,T.P2))
+ { fuse(right_ 2*dimen_/5 at last []) }
+ line to T.P2
+ blen = dimen_/2
+W: T.TS+(dimen_,0)
+N: W+(blen,blen)
+S: W+(blen,-blen)
+E: S+(blen,blen)
+ diode(from W to N)
+ diode(from S to E)
+G:gap(from E+(dimen_*4/3,0) down_ (E.y-S.y)*5/4); llabel("+" wid 0.1*scale,,-)
+C:capacitor(down_ G.start.y-G.end.y from 0.5 between E and G.start,C)
+
+setrgb(255,0,0)
+ line from T.S1 to (T.S1,N); line to N
+ dot
+ diode(to E); dot
+ line from E to G.start; dot
+ dot(at C.start)
+resetrgb
+
+setrgb(0,255,0,,D)
+ dot(at C.end)
+ dot(at G.end)
+ ground
+ line to (W,Here); line to W; dot
+ diode(to S); dot
+ line to (T.S2,Here); line to T.S2
+resetrgb
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4
new file mode 100644
index 00000000000..7b63ec6db75
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/quickSVG.m4
@@ -0,0 +1,20 @@
+.PS # Pic input begins with .PS
+cct_init # Set defaults
+
+elen = 0.75 # Variables are allowed; default units are inches
+move right 0.4
+Origin: Here # Position names are capitalized
+ svgLink(SourcesSVG.svg,source(up_ elen))
+ llabel(-,v`'svg_sub(s),+)
+ svgLink(CctTableSVG.svg,resistor(right_ elen)); rlabel(,R,)
+ dot
+ { # Save current position and direction
+ capacitor(down_ to (Here,Origin)) #(Here,Origin) = (Here.x,Origin.y)
+ rlabel(+,v,-); llabel(,,C)
+ dot
+ } # Restore position and direction
+ line right_ elen*2/3
+ {move right 0.2}
+ inductor(down_ Here.y-Origin.y); rlabel(,L,); b_current("i")
+ line to Origin
+.PE # Pic input ends
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/randomSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/randomSVG.m4
new file mode 100644
index 00000000000..e482d9f1e47
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/randomSVG.m4
@@ -0,0 +1,98 @@
+.PS
+# randomSVG.m4
+gen_init(svg_font(sans-serif,9bp__))
+NeedDpicTools
+
+################################################################
+# hscale(right length,nlabels,
+# minlabel,maxlabel,[T][N])
+ define(`hscale',`[ define(`hs_nl',`ifelse(`$2',,5,`$2')')
+ A: line `$1' ; Start: A.start; End: A.end
+ td = 1/(hs_nl-1)*A.len/5
+ define(`hs_ud',`ifinstr(`$5',T,down,up)')
+# Major tics
+ for i=1 to hs_nl-2 do { line hs_ud graphsize/20 thick 0.4 \
+ from i/(hs_nl-1) between A.start and A.end }
+# Minor tics
+ for i=0 to hs_nl-2 do { Ts: i/(hs_nl-1) between A.start and A.end
+ for j=1 to 4 do { line thick 0.4 hs_ud graphsize/20/2 from Ts+(j*td,0) } }
+# Labels
+ ifinstr(`$5',N,,`for_(0,eval(hs_nl-1),1,
+ `Ts: m4x/(hs_nl-1) between A.start and A.end
+ s_box("%g",`$3'+m4x/(hs_nl-1)*(`$4'-(`$3'))) \
+ at Ts ifelse(`$5',T,above,below)') ')
+ ]')
+# vscale(up length,nlabels,
+# minlabel,maxlabel,[R][N] )
+ define(`vscale',`[ define(`vs_nl',`ifelse(`$2',,5,`$2')')
+ A: line `$1' ; Start: A.start; End: A.end
+ td = 1/(vs_nl-1)*A.len/5
+ define(`vs_lr',`ifinstr(`$5',R,left,right)')
+# Major tics
+ for i=1 to vs_nl-2 do { line vs_lr graphsize/20 thick 0.4 \
+ from i/(vs_nl-1) between A.start and A.end }
+# Minor tics
+ for i=0 to vs_nl-2 do { Ts: i/(vs_nl-1) between A.start and A.end
+ for j=1 to 4 do { line thick 0.4 vs_lr graphsize/20/2 from Ts+(0,j*td) } }
+# Labels
+ ifinstr(`$5',N,,`for_(0,eval(vs_nl-1),1,
+ `Ts: m4x/(vs_nl-1) between A.start and A.end
+ s_box("%g",`$3'+m4x/(vs_nl-1)*(`$4'-(`$3'))) \
+ at Ts ifelse(`$5',R,ljust,rjust)')')
+ ]')
+# f_gauss(x,mean,stddev)
+ define f_gauss`{ std_gauss(($1-($2))/($3))/($3) }'
+ define std_gauss`{ expe(-($1)^2/2)/sqrt(twopi_) }'
+################################################################
+
+[
+ n = 2000
+ stddev = 0.25
+ graphsize = 2
+
+ B: box wid graphsize ht graphsize ; { move left 0.4 from B.w }
+# Gemerate n Gaussian random numbers
+ randn(z,n,0,stddev)
+ m = 0
+ for i=1 to n-1 by 2 do { m +=1; x[m] = z[i]; y[m] = z[i+1]
+ dot(at B+(x[m],y[m]))
+ }
+
+ hscale(right B.wid,5,-1,1) with .Start at B.sw
+ hscale(right B.wid,5,-1,1,TN) with .Start at B.nw
+ vscale(up B.ht,5,-1,1) with .Start at B.sw
+ vscale(up B.ht,5,-1,1,RN) with .Start at B.se
+
+ N: box invis wid B.wid ht B.ht with .sw at B.nw+(0,graphsize/10)
+ nb = 20
+ binmax = n/5*0.5
+ dx = N.wid/nb
+ histbins(x,m,-1,1,nb,hbin)
+ for i=0 to nb-1 do { line up hbin[i]/binmax * N.ht \
+ from N.sw+((0.5+i)*dx,0) thick dx/(1bp__) outlined "gray" }
+ box wid N.wid ht N.ht at N
+# vscale(up N.ht,5,0,1) with .Start at N.sw
+
+ E: box invis wid B.wid ht B.ht with .sw at B.se+(graphsize/10,0)
+ nb = 20
+ binmax = n/5*0.5
+ dy = E.ht/nb
+ histbins(y,m,-1,1,nb,vbin)
+ for i=0 to nb-1 do { line right vbin[i]/binmax * E.wid \
+ from E.sw+(0,(0.5+i)*dy) thick dy/(1bp__) outlined "gray" }
+ box wid E.wid ht E.ht at E
+# hscale(right E.wid,5,0,1) with .Start at E.sw
+
+ng = 16
+for i=0 to ng do { x = i/ng*N.wid
+ U: x,(f_gauss(x,N.wid/2,stddev)*m*dx)/binmax*N.ht
+ X[i]: N.sw+U
+ Y[i]: E.nw+(U.y,-U.x) }
+ fitcurve(X,ng)
+ fitcurve(Y,ng)
+
+]
+#showbox_
+
+command "</g>"
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/recycleSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/recycleSVG.m4
new file mode 100644
index 00000000000..d6246cc9ab2
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/recycleSVG.m4
@@ -0,0 +1,128 @@
+.PS
+# recycle.m4
+gen_init
+copy "HOMELIB_`'dpictools.pic"
+[
+# Gradient fill and clipping are simply
+# done with PStricks or Tikz but the other
+# postprocessors don't all have this
+# facility so the following calculates
+# shading boundaries and lines.
+
+define ShadePoint { testexpr(i, $1<f1, $1<f2, $1<f3 )
+ Px: $1 between P0 and Pz
+ S: move from Px to Px+Up
+ case(i+1,
+ M4L: LCintersect(S,T1,stripwd/2)
+ M4R: ($1-f2)/(1-f2) between P9 and P8
+ ,
+ M4L: $1/f1 between P0 and P4
+ M4R: $1/f1 between P0 and P3
+ ,
+ M4L: Intersect_(S,M57)
+ M4R: LCintersect(S,P1,stripwd/2)
+ ,
+ M4L: Intersect_(S,M57)
+ M4R: ($1-f2)/(1-f2) between P9 and P8
+ )
+ line outlined rgbstring($2,$3,$4) from M4L to M4R
+ }
+
+define ShadeTail { testexpr(i, $1<g1, $1<g2, $1<g3 )
+ Px: $1 between T4 and Qz
+ S: move from Px to Px+AcrossTail
+ case(i+1,
+ M4L: LCintersect(S,T1,stripwd/2,R)
+ M4R: LCintersect(S,T1,stripwd/2)
+ ,
+ M4L: $1/g1 between T5 and T6
+ M4R: $1/g1 between T3 and T2
+ ,
+ M4L: LCintersect(S,T1,stripwd/2,R)
+ M4R: $1/g2 between T3 and P6
+ ,
+ M4L: LCintersect(S,T1,stripwd/2,R)
+ M4R: ($1-g2)/(g3-g2) between P6 and P7
+ )
+ line outlined rgbstring($2,$3,$4) from M4L to M4R
+ }
+
+# `recycle(width)'
+define(`recycle',`[ Origin: Here
+ space = 2*linethick pt__
+ stripwd = ($1-space)/3.765544
+ for angle=0 to 240 by 120 do {
+ Right: (dprot(angle*dtor_,stripwd,0))
+ Up: (dprot(angle*dtor_,0,stripwd/2))
+ P0: Here+Right*space/stripwd
+ Axis: move from P0 to P0+Right*3/4; P1: Here
+ P2: P1-Up
+ P3: 1.5 between P1 and P2
+ P4: P1 + (P1-P3)
+ P5: P1 + Up
+ P6: P5+Right/sqrt(3)/2
+ P7: P6+(P6-P5)
+ T1: 2 between P1 and P6
+ P8: T1+(dprot((angle-30)*dtor_,stripwd/2,0))
+ P9: P1+(P8-T1)
+ T2: T1+(dprot((angle+210)*dtor_,stripwd/2,0))
+ AcrossTail: T1-T2
+ T3: P6+(dprot((angle+120)*dtor_,stripwd,0))
+ T4: T3+AcrossTail
+ T5: 2 between T3 and T4
+ T6: 2 between T2 and T1
+ V: move from P8 to P8-Up; Pz: Intersect_(Axis,V)
+ t = distance(P0,Pz)
+ f1 = distance(P1,P0) / t
+ V: move from P9 to P9+Up; R: Intersect_(Axis,V); f2 = distance(P0,R) / t
+ V: move from P7 to P7-Up; R: Intersect_(Axis,V); f3 = distance(P0,R) / t
+ n = int(t/lthick*1.5)
+ M57: move from P5 to P7
+ ShadeObject( ShadePoint,n,
+ 0,1,1,1,
+ 1,0.5,0.5,0.5) with .Origin at Origin
+ point
+ J: move from T4 to T1; Qz: LCintersect(J,T1,stripwd/2,R)
+ u=distance(T4,Qz)
+ g1 = distance(T1,T4) / u
+ g2 = stripwd / u
+ V: move from P7 to P7+AcrossTail; R: Intersect_(V,J)
+ g3 = distance(R,T4) / u
+ m = int(u/lthick*1.5)
+ ShadeObject(ShadeTail,m,
+ 0,1,1,1,
+ 1,0.5,0.5,0.5) with .Origin at Origin
+ tail
+# { for i=0 to 9 do { exec sprintf("{\"P%g\" at P%g}",i,i) } }
+# { for i=1 to 6 do { exec sprintf("{\"T%g\" at T%g}",i,i) } }
+ move to T4
+ }
+ ]')
+define(`tail',`line from P7 to P6 then to T3 then to T5 then to T6
+ arc cw to P7 with .c at T1')
+
+define(`point',`line from P2 to P3 then to P0 then to P4 then to P5 then to P7
+ arc ccw to P8 with .c at T1
+ line to P9
+ arc cw to P2 with .c at P1')
+
+recycle(2)
+]
+[
+# yinyang.m4
+ifdpic(`
+circlerad = 0.5
+shade(0,
+A: arc ccw rad circlerad*2 to Here+(4*circlerad,0)
+ )
+B: circle colored "white" with .c at 1/4<A.w,A.e>
+ arc cw rad circlerad from B.e to B.w with .c at B.c
+ circle colored "black" with .c at 3/4<A.w,A.e>
+ circle rad circlerad*2 with .c at A.c
+ circle rad circlerad/3 fill_(0) at 0.5<A.w,A.c>
+ circle rad circlerad/3 fill_(1) at 0.5<A.c,A.e>
+',`
+box wid 1 ht 0.75 "Yinyang.m4" "requires" "dpic"
+')
+] with .w at last [].e+(0.2,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/roseSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/roseSVG.m4
new file mode 100644
index 00000000000..b386d9aea57
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/roseSVG.m4
@@ -0,0 +1,131 @@
+.PS
+# rose.m4
+gen_init
+ifelse(
+ifpstricks(T)`'ifmpost(T)`'ifpostscript(T)`'ifpdf(T)`'ifpgf(T)`'ifsvg(T),,
+`This diagram is for PSTricks, postscript, PDF, MetaPost, or SVG',
+`
+
+scale = 1.2
+define(`gold_',`1,0.84,0')
+
+define(`rose',`point_(`$2'); CC: (vec_(`$1',0)); rrad = `$3'
+ move to CC
+ tmp = rrad-stripwid
+ {circle shaded rgbstring(gold_) rad rrad-sthick at CC}
+ {circle shaded rgbstring(gold_) rad tmp-sthick at CC}
+ {line to rvec_(rrad,0) chop tmp chop 0 }
+ {line to rvec_(-rrad,0) chop tmp chop 0 }
+ {line to rvec_(0,rrad) chop tmp chop 0 }
+ {line to rvec_(0,-rrad) chop tmp chop 0 }
+ {line from rvec_(-tmp/sqrt(2),-tmp/sqrt(2)) to rvec_(tmp/sqrt(2),tmp/sqrt(2))}
+ {line from rvec_(-tmp/sqrt(2),tmp/sqrt(2)) to rvec_(tmp/sqrt(2),-tmp/sqrt(2))}
+ {circle shaded rgbstring(gold_) rad tmp-stripwid-sthick at CC}
+ tmp = last circle.rad/sqrt(2)
+ line thick stripthick from rvec_(-tmp,0) to rvec_(0,-tmp) \
+ then to rvec_(tmp,0) then to rvec_(0,tmp) then to rvec_(-tmp,0) \
+ shaded rgbstring(gold_)
+ ')
+
+define(`spt_',`/72.27')
+
+[ lsk = 1.2
+ sector = 360*dtor_/16
+ exterior = 2.49
+ outer_circle = exterior-0.55
+ inner_circle = 1.1
+ spoke_tail = 0.41
+ spokethick = 0.09/(1spt_) # points
+ stripwid = 0.05
+ stripthick = 1.6/1.2
+ midroserad = inner_circle*sin(sector/2)-stripwid/2
+ outerroserad = outer_circle*sin(sector/4)-stripwid/2
+ del = 0.05
+
+C: (0,0)
+ circle rad exterior fill_(0) at C
+ circle shaded rgbstring(gold_) rad outer_circle at C
+ circle rad spoke_tail fill_(0) at C
+ linethick = stripthick
+ sthick = linethick/2 spt_
+ for i=0 to 15 do {
+ move to rect_(spoke_tail+1.5*stripwid,sector*i);
+ for j=-1 to 1 by 2 do {
+ {point_(sector*(i+j*0.5))
+ line to rvec_(outer_circle-spoke_tail,0) }
+ { point_(sector*i)
+ move to rvec_(0,j*spokethick spt_)
+ line to rvec_(outer_circle-spoke_tail,0) \
+ chop outer_circle-inner_circle chop 0
+ }
+ }
+ crad = 0.25 +1.5*stripwid
+ cthick = 1.5*stripwid/(1spt_)
+ X: rect_(inner_circle+midroserad,sector*i)
+ circle outlined rgbstring(gold_) rad crad-(cthick/2 spt_) thick cthick at X
+ circle rad crad - sthick at X
+ }
+ for i=0 to 15 do {
+ X: rect_(inner_circle+midroserad,sector*i)
+ circle fill_(0) rad crad-1.5*stripwid-sthick at X
+
+ for j = -1 to 1 by 2 do { move to X+vec_(0.20,j*0.14)
+ point_(sector*(i+j*0.25))
+ line to rvec_(1.5*stripwid,0) }
+
+ circle shaded rgbstring(gold_) rad midroserad*2/3-sthick at X
+ circle rad midroserad*2/3-stripwid-sthick at X
+ line from X to -(midroserad*2/3/(inner_circle+midroserad))<X,C>
+ }
+
+ crad = spoke_tail+7*stripwid
+ cthick = 2*stripwid/(1spt_)
+ circle outlined rgbstring(gold_) rad crad-cthick/2 spt_ thick cthick at C
+ circle rad spoke_tail+1.5*stripwid-sthick at C
+ for i=5 to 7 do { circle rad spoke_tail+i*stripwid-sthick at C }
+ # Spokes and roses
+ for i=0 to 15 do {
+ rose(inner_circle,sector*i,midroserad)
+ line thick spokethick/lsk from C to rect_(outer_circle,sector*(i-0.5))
+ line thick spokethick/lsk from C to rect_(outer_circle,sector*i) \
+ chop inner_circle+midroserad*2 chop 0
+ for j=-1 to 1 by 2 do {
+ X: rect_(outer_circle+outerroserad-linethick spt_,sector*(i+j*0.25))
+ linethick = 1/lsk
+ circle colored rgbstring(gold_) rad outerroserad*1/2-1/lsk/2 spt_ at X
+ linethick = stripthick
+ circle fill_(0) rad outerroserad*1/3-sthick at X
+ point_(sector*(i+j*0.25))
+ line from X to X + vec_(outerroserad,0)
+ rose(outer_circle,sector*(i+j*0.25),outerroserad)
+ }
+ }
+ # Outer decorations
+ for i=0 to 31 do {
+ move to rect_(exterior-0.25,sector*i/2); point_(sector*i/2)
+ { line thick stripthick from rvec_(del,3.5*del) to rvec_(-del,0) \
+ then to rvec_(del,-3.5*del) then to rvec_(del,3.5*del) \
+ shaded rgbstring(gold_) }
+ circle rad stripwid-sthick at Here
+ }
+ smrad = 0.08
+ for i=0 to 7 do {
+ point_(sector*2*i)
+ move to C + vec_(midroserad+smrad/4,0)
+ { circle shaded rgbstring(gold_) rad smrad-sthick at Here}
+ { circle shaded rgbstring(gold_) rad smrad/2-sthick at Here}
+ line from rvec_(smrad/2,0) to rvec_(smrad,0)
+ }
+
+ tmp = midroserad-stripwid
+ circle shaded rgbstring(gold_) rad midroserad-sthick at C
+ circle shaded rgbstring(gold_) rad tmp-sthick at C
+ CQ: circle invis rad tmp-linethick*4/2 spt_ at C
+ line from CQ.e to CQ.n to CQ.w to CQ.s to CQ.e to CQ.n
+ CQ: 0.5<CQ.e,CQ.n>
+ tmp = (distance(CQ,C) - linethick*3/2 spt_)*sqrt(2)
+ box wid tmp ht tmp at C
+ ] with .sw at 1,1
+
+')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sfgSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sfgSVG.m4
new file mode 100644
index 00000000000..793db01ae86
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/sfgSVG.m4
@@ -0,0 +1,102 @@
+.PS
+# sfgSVG.m4
+gen_init(svg_font(Times,11bp__))
+sfg_init( 1.2 ) # scale default size by 1.2
+
+textht = textht*0.9
+
+# Graph 1
+move right 0.15
+T:[
+ Ft: sfgnode(,f(t),sfgbelow)
+ sfgline(,1/K)
+ Y1: sfgnode(,y`'svg_sub(1),sfgbelow rjust)
+ sfgline(,K/M)
+ DDY2: sfgnode(,y`'svg_sub(2),sfgbelow rjust)
+ {".." at DDY2 +(-3,-1)*textoffset}
+ sfgline(,1/s)
+ DY2: sfgnode(,y`'svg_sub(2) = x`'svg_sub(2),sfgbelow ljust)
+ {"." at DY2 +(2,-1)*textoffset}
+ sfgline(,1/s)
+ Y2: sfgnode(,y`'svg_sub(2) = x`'svg_sub(1),sfgbelow ljust)
+
+ sf = 1
+ sfgarc(from DY2 to DDY2,-B/M,below,,sf)
+ sfgarc(from Y2 to DDY2,-K/M,above,ccw,sf)
+ sfgarc(from Y2 to Y1,1,sfgabove,,sf)
+ ]
+
+# Graph 2
+B: [
+ R1: sfgnode(,r`'svg_sub(1),sfgabove)
+ sfgline(,1)
+ X1: sfgnode(,x`'svg_sub(1),ljust)
+ R2: sfgnode(at R1+(0,-1),r`'svg_sub(2),sfgabove)
+ sfgline(,1)
+ X2: sfgnode(,x`'svg_sub(2),ljust)
+ sfgarc(from X1 to X2,a`'svg_sub(21),rjust,ccw)
+ sfgarc(from X2 to X1,a`'svg_sub(12),ljust,ccw)
+
+ sfgself(at X1,,q`'svg_sub(11))
+ sfgself(at X1,R,a`'svg_sub(11),ljust,cw,1.5)
+ sfgself(at X2,-90,a`'svg_sub(22),sfgbelow)
+ ] with .w at T.e + (linewid/2,-linewid/4)
+
+# Graph 3
+G3: [
+ # change node spacing and increase node size
+ sfg_wid = 0.85; sfg_rad = 0.35/2
+ for_(1,4,1,`N`'m4x: sfgnode(,m4x,,fill_(0.9))
+ sfgself(at N`'m4x,-90,P`'svg_sub(m4x),,cw)
+ ifelse(m4x,4,,`sfgline(,G`'svg_sub(m4x),sfgbelow)') ')
+ sfgarc(from N2 to N1,F`'svg_sub(2),sfgabove,ccw,)
+ sfgarc(from N3 to N1,F`'svg_sub(3),sfgbelow,ccw,1.4)
+] with .nw at T.sw
+
+A: [ sfg_wid = 0.75; sfg_rad = 0.15
+ arrow right linewid*2/3
+ P: sfgnode(,p)
+ sfgself(,90,a,below,cw)
+ arrow from P.e "b" below
+ Q: sfgnode(,q)
+ R: sfgnode(at Q+(Q-P),r) # for dpic
+ sfgarc(from Q to R,c,above,cw)
+ sfgarc(from R to Q,d,below,cw)
+ sfgself(at R,-90,e,above,cw)
+ arrow right linewid*2/3 from R.e
+ ] with .w at G3.e+(linewid/2,0)
+
+define(`svg_choose',`[ P:"svg_fsize(( ),150)"
+ "svg_small(`$1')" at P+(0,7bp__)
+ "svg_small(`$2')" at P-(0,3bp__)
+ ]')
+
+G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and increase node size
+ s1 = 0.9
+ s2 = 1.2
+ N0: sfgnode(,svg_fsize(0,120),,invis)
+ sfgline(right_ sfg_wid,`svg_nu',below,->)
+ N1: sfgnode(,svg_fsize(1,120),,invis)
+ { sfgarc(to N0 ->,(1-p)`svg_gamma'+`svg_nu',above,ccw,s1) }
+ sfgline(right_ sfg_wid,`svg_nu'+`svg_lambda',below,->)
+ N2: sfgnode(,svg_fsize(2,120),,invis)
+ { sfgarc(to N1 ->,,,ccw,s1) }
+ { "p(1-p)svg_gamma+2`'svg_nu" at last [].M+(11bp__,0) above }
+ { svg_choose(2,1) at last [].M+(-29bp__,8bp__) }
+ { sfgarc(to N0 ->,(1-p)svg_sup(2)`svg_gamma',above,ccw,s2) }
+ sfgline(right_ sfg_wid,`svg_nu'+2`svg_lambda',below,->)
+ N3: sfgnode(,svg_fsize(3,120),,invis)
+ { sfgarc(to N2 ->,,,ccw,s1) }
+ { "p`'svg_sup(2)(1-p)svg_gamma+3`'svg_nu" at last [].M+(0bp__,0) above }
+ { svg_choose(3,2) at last [].M+(-43bp__,8bp__) }
+ { sfgarc(to N1 ->,,,ccw,s2) }
+ { "p(1-p)`'svg_sup(2)`'svg_gamma" at last [].M+(8bp__,0) above }
+ { svg_choose(3,1) at last [].M+(-26bp__,8bp__) }
+ { sfgarc(to N0 ->,(1-p)svg_sup(3)`svg_gamma',above,ccw,s2) }
+ sfgline(right_ sfg_wid*2/3,`svg_nu'+3`svg_lambda',below,->)
+ {"..." wid 0.3 ljust}
+ ] with .nw at G3.sw+(0,-0.1)
+
+ move from (T.w,G4.s)-(7bp__,6bp__) to B.ne+(15bp__,6bp__)
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/shapesSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/shapesSVG.m4
new file mode 100644
index 00000000000..08962e9f856
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/shapesSVG.m4
@@ -0,0 +1,202 @@
+.PS
+# shapes.m4
+threeD_init
+
+divert(-1)
+# shapes.m4
+# 3D structures with complex surfaces and hidden lines are the domain of more
+# sophisticated software packages, but basic shapes can be drawn with pic.
+#threeD_init
+
+#####################################################
+
+ `cylinder3D(xdispl,ydispl,zdispl,diameter,
+ [colored "color"])'
+define(`cylinder3D',`[ Start: (0,0)
+ xdispl = `$1'; ydispl = `$2'; zdispl = `$3'
+ diamc = ifelse(`$4',,(lenc/2),`$4') ; radc = diamc/2
+ define(`M4CL',`xdispl,ydispl,zdispl')dnl
+ lenc = length3D(M4CL)
+ cs = dot3D(View3D,M4CL)/lenc
+ End: (project(M4CL))
+ az = atan2(ydispl,xdispl)
+ ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2))
+ CL: line invis from Start to End; C: CL.c
+ nls = int(twopi_*radc/lthick)
+ define(`M4PP',`rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,0,0,radc)))')dnl
+ for i=0 to nls-1 do { if dot3D(View3D,M4PP) > 0 then {
+ P: (project(M4PP))
+ ql = sqrta(dot3D(Light3D,M4PP)/radc)
+ line from P to End+P outlined rgbstring(ql,ql,ql) `$5' } }
+ Perp: (vperp(CL,radc))
+ if cs > 0 then { T: End; B: Start } else { T: Start; B: End }
+ rpoint_(from Start to Perp)
+ css = sqrta(cs)
+ Top: rotellipse(diamc,diamc*cs,
+ thick linethick/3 shaded rgbstring(css,css,css)) with .c at T
+ W: line thick linethick/3 from T+Perp to B+Perp
+ Bot: ellipsearc(diamc,diamc*cs,pi_,twopi_,rp_ang,cw,
+ thick linethick/3) with .C at B
+ E: line thick linethick/3 from B-Perp to T-Perp
+ rpoint_(from Start to End)
+`$6']')
+
+ `cone3D(xdispl,ydispl,zdispl,diameter,
+ [colored "color"])'
+define(`cone3D',`[ Start: (0,0)
+ xdispl = `$1'; ydispl = `$2'; zdispl = `$3'
+ define(`M4CL',`xdispl,ydispl,zdispl')dnl
+ lenc = length3D(M4CL)
+ diamc = ifelse(`$4',,(lenc/2),`$4') ; radc = diamc/2
+ End: (project(M4CL))
+ cs = dot3D(View3D,M4CL)/lenc
+ az = atan2(ydispl,xdispl)
+ ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2))
+ CL: line invis from Start to End; C: CL.c
+ nls = int(twopi_*radc/lthick)
+ lt = sqrt(radc^2+lenc^2)
+ b = 0
+ for i=0 to nls-1 do { if dot3D(View3D,
+ rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,radc,0,lenc)))) > 0 then {
+ ql = sqrta(dot3D(Light3D,
+ rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,radc,0,lenc))))/lt)
+ P: (project(rot3Dz(az,rot3Dy(-ae,rot3Dx(-i/nls*twopi_,0,0,radc)))))
+ line from P to End outlined rgbstring(ql,ql,ql) `$5'
+ if !b then { WB: P; b = 1 }
+ } else { if b then { BW: P; b = 0 } } }
+ if vlength(CL.x,CL.y) != 0 then { Perp: (vperp(CL,radc,R)) } else { Perp: (radc,0) }
+ if cs >= 0 then { T: End; B: Start } else {T: Start; B: End }
+ rpoint_(from Start to Perp)
+ pout = (vlength(End.x,End.y) > abs(radc*cs))
+ if cs < 0 then { css = sqrta(cs)
+ if pout then { line thick linethick/3 from BW to End then to WB }
+ Bot: rotellipse(diamc,diamc*cs,thick linethick/3 \
+ ifelse(`$5',,`shaded rgbstring(css,css,css)',`$5')) with .c at T } \
+ else { if pout then {
+ line thick linethick/3 from BW to End then to WB
+ a = acos((WB.x*Perp.x+WB.y*Perp.y)/radc^2)
+ Bot: ellipsearc(diamc,diamc*cs,a,pi_-a,rp_ang,cw, thick linethick/3) \
+ with .C at B } \
+ else {
+ Bot: rotellipse(diamc,diamc*cs,thick linethick/3) with .c at B } }
+ rpoint_(from Start to End)
+`$6']')
+ `Arrow3D(xdispl,ydispl,zdispl,
+ diam,arrowwid,arrowht)'
+define(`Arrow3D',`[ diam_Ar = ifelse(`$4',,linewid/10,`$4')
+ wid_Ar = ifelse(`$5',,diam_Ar*2,`$5')
+ ht_Ar = ifelse(`$6',,wid_Ar*2,`$6')
+ x_Ar = ifelse(`$1',,1,`$1')
+ y_Ar = ifelse(`$2',,1,`$2')
+ z_Ar = ifelse(`$3',,1,`$3')
+ define(`M4Arrow3D',`x_Ar,y_Ar,z_Ar')dnl
+ len_Ar = length3D(M4Arrow3D)
+ len_Shaft = len_Ar - ht_Ar
+ cs_Ar = dot3D(View3D,M4Arrow3D)
+ if cs_Ar >= 0 then {
+ Shaft: cylinder3D(sprod3D(len_Shaft/len_Ar,M4Arrow3D),diam_Ar)
+ Head: cone3D(sprod3D(ht_Ar/len_Ar,M4Arrow3D),wid_Ar) \
+ with .Start at Shaft.End } \
+ else {
+ Head: cone3D(sprod3D(ht_Ar/len_Ar,M4Arrow3D),wid_Ar)
+ Shaft: cylinder3D(sprod3D(len_Shaft/len_Ar,M4Arrow3D),diam_Ar) \
+ with .End at Head.Start }
+ Start: Shaft.Start; End: Head.End
+ `$7']')
+
+define(`f2xyz3D',``$1'x = `$2'
+`$1'y = `$3'
+`$1'z = `$4' ')
+
+ `prism3D(xdispl,ydispl,zdispl,wid,ht,rotation (rad))'
+define(`prism3D',`[ Start: (0,0)
+ xdispl = ifelse(`$1',,linewid,`$1')
+ ydispl = ifelse(`$2',,linewid,`$2')
+ zdispl = ifelse(`$3',,linewid,`$3')
+ widp = ifelse(`$4',,(linewid/5),`$4')
+ htp = ifelse(`$5',,(linewid/10),`$5')
+ rotp = ifelse(`$6',,0,`$6')
+ End: (project(xdispl,ydispl,zdispl)); C: 0.5 between Start and End
+ lenp = length3D(xdispl,ydispl,zdispl)
+ az = atan2(ydispl,xdispl); ae = atan2(zdispl,sqrt(xdispl^2+ydispl^2))
+ wp2 = widp/2; hp2 = htp/2
+# corners
+ f2xyz3D(nwB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0,-wp2, hp2))))
+ f2xyz3D(swB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0,-wp2,-hp2))))
+ f2xyz3D(seB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0, wp2,-hp2))))
+ f2xyz3D(neB,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp, 0, wp2, hp2))))
+ f2xyz3D(nwF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp,-wp2, hp2))))
+ f2xyz3D(swF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp,-wp2,-hp2))))
+ f2xyz3D(seF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp, wp2,-hp2))))
+ f2xyz3D(neF,rot3Dz(az,rot3Dy(-ae,rot3Dx(rotp,lenp, wp2, hp2))))
+# facets
+ M4Facet3D(neF,nwF,swF,seF)
+ M4Facet3D(neB,seB,swB,nwB)
+ M4Facet3D(neF,seF,seB,neB)
+ M4Facet3D(neF,neB,nwB,nwF)
+ M4Facet3D(seF,swF,swB,seB)
+ M4Facet3D(nwF,nwB,swB,swF)
+`$7']')
+
+define(`M4Facet3D',`
+define(`PFacet',`cross3D(diff3D(`$2'x,`$2'y,`$2'z,`$1'x,`$1'y,`$1'z),
+ diff3D(`$3'x,`$3'y,`$3'z,`$2'x,`$2'y,`$2'z))')
+ if dot3D(View3D,PFacet) > 0 then {
+ fFacet = sqrta(dot3D(Light3D,PFacet)/length3D(PFacet))
+ P1: (project(`$1'x,`$1'y,`$1'z))
+ P2: (project(`$2'x,`$2'y,`$2'z))
+ P3: (project(`$3'x,`$3'y,`$3'z))
+ P4: (project(`$4'x,`$4'y,`$4'z))
+ line fill_(fFacet) invis from P1 to P2 then to P3 then to P4 then to P1
+ line from P1 to P2; round
+ line to P3; round
+ line to P4; round
+ line to P1; round } ')
+
+#####################################################
+divert(0)dnl
+
+azimuth = 60
+elev = 10
+setview(azimuth,elev)
+[ Orig: (0,0)
+ setlight
+ Arrow3D(1,0,0) with .Start at Orig; move left 12bp__ from last [].End "x"
+ Arrow3D(0,1,0) with .Start at Orig; "y" ljust at last [].End
+ Arrow3D(0,0,1.2) with .Start at Orig; "z" above at last [].End
+ setlight(0,0,0)
+ cylinder3D(1,1,1,0.6) with .Start at (project(0.5,0.5,0.5))
+]
+ Ball: shadedball(0.5) with .nw at last [].ne+(-0.25,0)
+[
+ setview(45,10)
+ setlight(40,70)
+ n = 9; len = 1.5; thmin = m4azim+pi_/2*0.8; thmax = thmin+twopi_
+ for i=0 to n do {
+ r = i/n*(thmax-thmin)+thmin
+ prism3D(rot3Dz(r,rot3Dy(pi_/4,len,0,0)),0.2,0.1) \
+ with .Start at (project(rot3Dz(r,rot3Dy(pi_/4,len*0.5,0,0)))) }
+] with .nw at last [].ne
+[
+ setlight(0,0)
+ movewid = 0.1
+ len = 1.5; ni = 5; nj = 5
+ for i=1 to ni-1 do {
+ {for j = 0 to nj by 2 do {
+ setview(0,i/ni*180-90,j/nj*90)
+ cylinder3D(0,0,len*(j+1)/(nj+1),0.4)
+ if j < nj then {move right} } }
+ if i < ni then {move down 0.85; right_} } #else { move down movewid } }
+] with .nw at 1st [].sw+(0,-0.1)
+[
+ setlight(0,0)
+ len = 1.5; ni = 4; nj = 6
+ for i=1 to ni do {
+ {for j = 0 to nj by 2 do {
+ setview(0,i/ni*180-90,j/nj*90)
+ cone3D(0,0,len*(j+1)/(nj+1),0.4)
+ if i==2 && j==(nj-2) then { move up_ 0.2 right_ -0.4 } \
+ else { if j < nj then {move right_ 0.1}} } }
+ if i < ni then {move down_ 0.75; right_} }
+] with .nw at last [].ne+(0.2,0)
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/thyristorSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/thyristorSVG.m4
new file mode 100644
index 00000000000..1301786a4c4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/thyristorSVG.m4
@@ -0,0 +1,119 @@
+.PS
+# `thyristorSVG.m4'
+cct_init(svg_font(sans-serif,11bp__,1.5bp__))
+
+define labels { {
+ "$1" $2 at last[].$1
+ "$3" $4 at last[].$3
+ "$5" $6 at last[].$5
+ "$7" $9 at (last[].s+(0,$8)) } }
+
+down_
+Row1: [
+ {thyristor
+ labels(A,above,K,below,G,ljust,`thyristor',-0.25,wid 0.75) }
+
+ move right 0.50 ; down_
+ {thyristor(,B)
+ labels(T1,above,T2,below,G,below ljust,`...(,B)',-0.35) }
+
+ move right 0.50 ; down_
+ {thyristor(down_ dimen_*0.8,BR)
+ labels(T1,above,T2,below,G,below rjust,`...(,BR)',-0.22) }
+
+ move right 0.60 ; down_
+ {thyristor(,BE)
+ labels(T1,above,T2,below,G,below ljust,`...(,BE)',-0.35) }
+
+ move right 0.50 ; down_
+ {thyristor(,A) at (Here,last [])
+ labels(A,above,K,below,G,ljust,`...(,A)',-0.35) }
+
+ move right 0.50 ; down_
+ {thyristor(,F) at (Here,last [])
+ labels(A,above,K,below,G,ljust,`...(,F)',-0.22) }
+
+ move right 0.65 ; down_
+ {thyristor(,BRE)
+ labels(T1,above,T2,below,G,below rjust,`...(,BRE)',-0.35) }
+
+ move right 0.75 ; down_
+ {thyristor(,UARE) at (Here,last [])
+ labels(A,above,K,below,G,rjust below,`...(,UARE)',-0.22) }
+
+ move right 0.50 ; down_
+ {thyristor(,AV,G: G+(0.1,0.1)) at (Here,last [])
+ thinlines_
+ spline -> from last[].G left 0.05 then left 0.05 down 0.1
+ thicklines_
+ labels(A,above,K,below,G,ljust,`...(,AV)',-0.35) }
+
+ move right 0.50 ; down_
+ {thyristor(,IEC)
+ labels(A,above ljust,K,below ljust,G,ljust,`...(,IEC)',-0.22) }
+ ]
+Row2: [
+ down_
+ {thyristor(,UAH)
+ labels(A,rjust above,K,rjust below,G,ljust,`...(,UAH)',-0.35,wid 0.65) }
+
+ move right 0.55 ; down_
+ {thyristor(,N) at (Here,last [])
+ labels(A,above,K,below,Ga,rjust,`...(,N)',-0.22) }
+
+ move right 0.55 ; down_
+ {thyristor(,UANRE) at (Here,last [])
+ labels(A,above,K,below,Ga,ljust above,`...(,UANRE)',-0.35) }
+ move right 0.55 ; down_
+ {thyristor(,SCR) at (Here,last [])
+ labels(A,above,K,below rjust,G,below ljust,`...(,SCR)',-0.22) }
+
+ move right 0.55 ; down_
+ {thyristor(,SCRE) at (Here,last [])
+ labels(A,above,K,below,G,ljust below,`...(SCRE)',-0.35) }
+
+ move right 0.65 ; down_
+ {thyristor(,SCRRE) at (Here,last [])
+ labels(A,above,K,below,G,rjust below,`...(SCRRE)',-0.22) }
+
+ move right 0.55 ; down_
+ {thyristor(,SCS) at (Here,last [])
+ labels(A,above,K,below,G,ljust,`...(SCS)',-0.35) }
+ { "Ga" rjust above at last[].Ga }
+
+ move right 0.55 ; down_
+ {thyristor(,SCSE) at (Here,last [])
+ labels(A,above,K,below,G,ljust below,`...(SCSE)',-0.22) }
+ { "Ga" rjust above at last[].Ga }
+
+ move right 0.65 ; down_
+ {thyristor(,SUSE) at (Here,last [])
+ labels(A,above,K,below,G,rjust,`...(SUSE)',-0.35) }
+
+ move right 0.65 ; down_
+ {thyristor(,SBSE) at (Here,last [])
+ labels(T1,above,T2,below,G,rjust,`...(SBSE)',-0.22,wid 50bp__) }
+
+ ] with .nw at Row1.sw + (0,-0.20)
+
+Twoterms: [ right_
+ { scr(,,Q) ; `"scr(,,Q)"' at last [].e ljust}
+ { "Q.G" at Q.G above }
+
+ move down 0.4; right_
+ { scs(,,Q2) ; `"scs(,,Q2)"' at last [].e ljust }
+ { "Q2.G" at Q2.G above }
+ { "Q2.Ga" at Q2.Ga below }
+ ] with .nw at Row2.sw+(0,-0.2)
+
+ [ right_
+ { sus(,RE,Q3) ; `"sus(,RE,Q3)"' at last [].e ljust}
+ { "Q3.G" at Q3.G above }
+
+ move right_ 1.2 from last line.end
+ { sbs(,E,Q4) ; `"sbs(,E,Q4)"' at last [].e ljust}
+ { "Q4.G" at Q4.G below }
+ ] with .w at last [].e+(1.0,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/tstSVG.htmx b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/tstSVG.htmx
new file mode 100644
index 00000000000..1dd990c82a5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/tstSVG.htmx
@@ -0,0 +1,212 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<HTML>
+<HEAD>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<meta http-equiv="Content-Style-Type" content="text/css">
+<!--meta http-equiv="Content-Script-Type" content="text/javascript"-->
+<TITLE>SVG Examples: Circuit_macros Version XXX</TITLE>
+<style type="text/css">
+</style>
+</HEAD>
+
+<BODY>
+<H2>SVG Circuit_macros examples, Version XXX</H2>
+<hr>
+
+<p>
+ These diagrams are in .svg format.
+ <A HREF="examples.pdf">Pdf</A>
+ and
+ <A HREF="examples.html">png</A>
+ versions are also available.
+ The PDF equivalent can be found in examples.pdf of the distribution.
+</p>
+ <p>
+ Click on the link to view the source of each diagram.
+</p>
+<hr>
+
+define(`cfig',`
+<p>
+<!--[if lt IE 9]><embed src="$1.svg" sinclude($1.siz)><![endif]-->
+
+<!--[if gte IE 9]>
+<object data="$1.svg" sinclude($1.siz) type="image/svg+xml" class="img">
+ </object> <![endif]-->
+
+<!--[if !IE]><!-->
+<object data="$1.svg" sinclude($1.siz) type="image/svg+xml" class="img">
+ </object> <!--<![endif]-->
+
+<br>
+<a href="$1.txt" TYPE="text/plain" TARGET="_blank">$1.m4</a>
+</p>
+<hr>')
+
+define(`m4tt',`<g style="font-family:monospace">')
+
+<!--
+<embed pluginspage="http://www.adobe.com/svg/viewer/install/" />
+-->
+
+<p>
+These diagrams have been adapted from the Circuit_macros examples in
+order to test the <em>experimental</em> svg output of dpic.
+Generating the line art is relatively straightforward, but
+the labeling is not created by a text processor and must, therefore, be
+more basic.
+</p>
+<p>
+<ul>
+ <ul>
+ <li>
+ m4tt`'svg_font(</g>font-face,height,textoffset,dpic commands`'m4tt)</g>:
+ Change font face, size, and dpic textoffset parameter.
+ If arg4 is blank, the font is changed and
+ requires m4tt`'command "&lt;/g&gt;"</g> to cancel the font change.
+ Examples: <br>
+ m4tt`'svg_font(Times)</g><br>
+ m4tt`'svg_font(Times,11bp__,1bp__,"text" at A)</g><br>
+ m4tt`'svg_font(font-family="Times")</g><br>
+ m4tt`'svg_font(font-family="Times" font-style="italic")</g><br>
+ m4tt`'svg_font(style="font-family:Times; font-style:italic")</g>
+ <li>m4tt svg_tspan(</g>text attributes`'m4tt)</g>;
+ e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%")</g>
+ <li>m4tt svg_it(</g>text`'m4tt)</g>: for italics
+ <li>m4tt svg_tt(</g>text`'m4tt)</g>: for monospace (courier)
+ <li>m4tt svg_norm(</g>text`'m4tt)</g>: for normal text
+ <li>m4tt svg_bf(</g>text`'m4tt)</g>: for bold face
+ <li>m4tt svg_small(</g>text, percent`'m4tt)</g>:
+ to set a smaller text size, default 66
+ <li>m4tt svg_fsize(</g>text, percent`'m4tt)</g>:
+ for setting larger or smaller text size, default 100
+ <li>m4tt svg_sub(</g>text, size percent, y displ, x displ`'m4tt)</g>:
+ subscript
+ <li>m4tt svg_sup(</g>text, size percent, y displ, x displ`'m4tt)</g>:
+ superscript
+ <li>m4tt svg_symbol(</g>text`'m4tt)</g>: allow quoted pound sign in text,
+ e.g., m4tt`'svg_symbol(10&&#96;&#35;&#39;176;)</g> produces 10&#176;
+ <li>m4tt svgLink(</g>URL, drawing object, m4tt[B])</g>:
+ link to external file using
+ &lt;a xlink:href=...&gt;...&lt;/a&gt; (default is
+ m4tt`'target="_blank"</g> unless
+ arg 3 = B)
+ <li>m4tt svgLinkString</g> as above but for strings attached to objects
+ <li> Greek and other symbols:
+
+<table cellpadding="0" cellspacing="0" width="100%" >
+<tr>
+<td width="7%"> m4tt svg_alpha</g>
+ <td align="left"> changecom(,)&`#'945;changecom(`#')
+<td width="7%"> m4tt svg_beta</g>
+ <td align="left"> changecom(,)&`#'946;changecom(`#')
+<td width="7%"> m4tt svg_chi</g>
+ <td align="left"> changecom(,)&`#'967;changecom(`#')
+<td width="7%"> m4tt svg_comma</g>
+ <td align="left"> changecom(,)&`#'44;changecom(`#')
+<td width="7%"> m4tt svg_Delta</g>
+ <td align="left"> changecom(,)&`#'916;changecom(`#')
+<td width="7%"> m4tt svg_delta</g>
+ <td align="left"> changecom(,)&`#'948;changecom(`#')
+<td width="7%"> m4tt svg_epsilon</g>
+ <td align="left"> changecom(,)&`#'949;changecom(`#')
+<td width="7%"> m4tt svg_eta</g>
+ <td align="left"> changecom(,)&`#'951;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_Gamma</g>
+ <td align="left"> changecom(,)&`#'915;changecom(`#')
+<td width="7%"> m4tt svg_gamma</g>
+ <td align="left"> changecom(,)&`#'947;changecom(`#')
+<td width="7%"> m4tt svg_iota</g>
+ <td align="left"> changecom(,)&`#'953;changecom(`#')
+<td width="7%"> m4tt svg_kappa</g>
+ <td align="left"> changecom(,)&`#'954;changecom(`#')
+<td width="7%"> m4tt svg_Lambda</g>
+ <td align="left"> changecom(,)&`#'923;changecom(`#')
+<td width="7%"> m4tt svg_lambda</g>
+ <td align="left"> changecom(,)&`#'955;changecom(`#')
+<td width="7%"> m4tt svg_micro</g>
+ <td align="left"> changecom(,)&`#'956;changecom(`#')
+<td width="7%"> m4tt svg_mu</g>
+ <td align="left"> changecom(,)&`#'956;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_nu</g>
+ <td align="left"> changecom(,)&`#'957;changecom(`#')
+<td width="7%"> m4tt svg_ohm</g>
+ <td align="left"> changecom(,)&`#'937;changecom(`#')
+<td width="7%"> m4tt svg_Omega</g>
+ <td align="left"> changecom(,)&`#'937;changecom(`#')
+<td width="7%"> m4tt svg_omega</g>
+ <td align="left"> changecom(,)&`#'969;changecom(`#')
+<td width="7%"> m4tt svg_Phi</g>
+ <td align="left"> changecom(,)&`#'934;changecom(`#')
+<td width="7%"> m4tt svg_phi</g>
+ <td align="left"> changecom(,)&`#'966;changecom(`#')
+<td width="7%"> m4tt svg_Pi</g>
+ <td align="left"> changecom(,)&`#'928;changecom(`#')
+<td width="7%"> m4tt svg_pi</g>
+ <td align="left"> changecom(,)&`#'960;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_Psi</g>
+ <td align="left"> changecom(,)&`#'936;changecom(`#')
+<td width="7%"> m4tt svg_psi</g>
+ <td align="left"> changecom(,)&`#'968;changecom(`#')
+<td width="7%"> m4tt svg_rho</g>
+ <td align="left"> changecom(,)&`#'961;changecom(`#')
+<td width="7%"> m4tt svg_Sigma</g>
+ <td align="left"> changecom(,)&`#'931;changecom(`#')
+<td width="7%"> m4tt svg_sigma</g>
+ <td align="left"> changecom(,)&`#'963;changecom(`#')
+<td width="7%"> m4tt svg_tau</g>
+ <td align="left"> changecom(,)&`#'964;changecom(`#')
+<td width="7%"> m4tt svg_Theta</g>
+ <td align="left"> changecom(,)&`#'920;changecom(`#')
+<td width="7%"> m4tt svg_theta</g>
+ <td align="left"> changecom(,)&`#'952;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_upsilon</g>
+ <td align="left"> changecom(,)&`#'965;changecom(`#')
+<td width="7%"> m4tt svg_Xi</g>
+ <td align="left"> changecom(,)&`#'926;changecom(`#')
+<td width="7%"> m4tt svg_xi</g>
+ <td align="left"> changecom(,)&`#'958;changecom(`#')
+<td width="7%"> m4tt svg_zeta</g>
+ <td align="left"> changecom(,)&`#'950;changecom(`#')
+<td width="7%"> m4tt svg_lt</g>
+ <td align="left"> changecom(,)&`#'60;changecom(`#')
+<td width="7%"> m4tt svg_gt</g>
+ <td align="left"> changecom(,)&`#'62;changecom(`#')
+<td width="7%"> m4tt svg_leq</g>
+ <td align="left"> changecom(,)&`#'8804;changecom(`#')
+<td width="7%"> m4tt svg_geq</g>
+ <td align="left"> changecom(,)&`#'8805;changecom(`#')
+<tr>
+<td width="7%"> m4tt svg_prime</g>
+ <td align="left"> changecom(,)&`#'8242;changecom(`#')
+<td width="7%"> m4tt svg_ensp</g>
+ <td align="left"> |changecom(,)&`#'8194;changecom(`#')|
+<td width="7%"> m4tt svg_emsp</g>
+ <td align="left"> |changecom(,)&`#'8195;changecom(`#')|
+<td width="7%"> m4tt svg_thinsp</g>
+ <td align="left"> |changecom(,)&`#'8201;changecom(`#')|
+<td width="7%"> m4tt svg_backsl</g>
+ <td align="left"> changecom(,)&`#'92;changecom(`#')
+</table>
+ </ul>
+ <li> Inkscape: It may be efficient to define elements by macro and to
+ place them using a WYSIWYG graphics editor. A draft page intended
+ for Inkscape is included. A reasonable variety of elements is defined
+ but should be customized for particular applications.
+ <li> Link experiments: Click on the resistor or source of quickSVG
+ to go to external
+ files in new windows. Click on "n-port" in NportSVG to replace the diagram
+ and then "back" to return.
+ <li> Some of the assumptions used to create this draft may be naive. Comments
+ are welcome.
+</ul>
+<hr>
+
+cfig(XXXXX)
+
+</BODY>
+</HTML>
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ujtSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ujtSVG.m4
new file mode 100644
index 00000000000..2672d38989a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/ujtSVG.m4
@@ -0,0 +1,31 @@
+.PS
+# `ujt.m4'
+cct_init(svg_font(sans-serif,11bp__))
+
+dwn = 1.0
+dsep = 0.15
+
+define(`demo_ujt',`up_
+ ujt(`$1',`$2',`$3',`$4')
+ "B1" ifelse(`$5',,below,ljust) at last [].B1
+ "E" at 1.5 between last [].Bulk.c and last [].E
+ "B2" ifelse(`$5',,above,ljust) at last [].B2
+ ')
+
+[demo_ujt(up_ dimen_,,,E,A)
+`"ujt(up_ dimen_,,,E)"' wid 1.3 at last [].s+(0,-0.2) below ]
+
+[demo_ujt(,,P,)
+`"ujt(,,P,)"' at last [].s+(0,-dsep) below] \
+with .sw at last [].se+(0.8,0)
+
+[demo_ujt(,R,,)
+`"ujt(,R,,)"' at last [].s+(0,-dsep) below] \
+with .sw at last [].se+(0.8,0)
+
+[demo_ujt(,R,P,)
+`"ujt(,R,P,)"' at last [].s+(0,-dsep) below] \
+with .sw at last [].se+(0.8,0)
+
+ command "</g>" # end font
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/wormSVG.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/wormSVG.m4
new file mode 100644
index 00000000000..79ac53f772a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/wormSVG.m4
@@ -0,0 +1,123 @@
+.PS
+# worm.m4
+ gen_init
+
+define(`svgcolor',`sprintf("rgb(%g,%g,%g)",`$1',`$2',`$3')')
+
+`define case { exec sprintf("$%g",floor($1+0.5)+1); }'
+
+`define hsvtorgb {
+ h_ = $1; s_ = $2; v_ = $3
+ f_ = h_/60-floor(h_/60)
+ p_ = v_*(1-s_)
+ q_ = v_*(1-f_*s_)
+ t_ = v_*(1-(1-f_)*s_)
+ case(pmod(floor(h_/60),6)+1,
+ $4 = v_; $5 = t_; $6 = p_,
+ $4 = q_; $5 = v_; $6 = p_,
+ $4 = p_; $5 = v_; $6 = t_,
+ $4 = p_; $5 = q_; $6 = v_,
+ $4 = t_; $5 = p_; $6 = v_,
+ $4 = v_; $5 = p_; $6 = q_)
+ $4 = int(($4)*255+0.5)
+ $5 = int(($5)*255+0.5)
+ $6 = int(($6)*255+0.5)
+ }'
+
+Worm: [
+ linethick_(0.1)
+ dimen = 1.25 # scale parameter; try dimen=2 for a larger picture
+ w = 0.15 * dimen # worm radius
+ nhues = 265
+ S: dimen,0
+ for inx = 1 to nhues +2 do {
+ theta = inx*360/nhues
+ R: dimen*cosd(3*theta), dimen*sind(2*theta)
+ D: R-(S.x,S.y)
+ t = sqrt(max(0,w^2/(D.x^2+D.y^2)-1/4))
+ Ra: 0.5<S,R> + (t*D.y,-t*D.x)
+ Rb: 0.5<S,R> - (t*D.y,-t*D.x)
+ if inx <= nhues then {
+ hsvtorgb(theta+120,1,1,r,g,b)
+ rgbfill( r,g,b,
+ arc cw from Ra to Rb rad w with .c at S
+ arc ccw from Rb to Ra rad w with .c at R )
+ } else {
+ arc cw from Ra to Rb rad w with .c at S
+ arc ccw from Rb to Ra rad w with .c at R }
+ S: R
+ }
+ ]
+
+ "svg_fsize(R,120)" at 0.9<Worm.se,Worm.ne> ljust
+ "svg_fsize(G,120)" at Worm.e ljust
+ "svg_fsize(B,120)" at 0.1<Worm.se,Worm.ne> ljust
+ "svg_fsize(Y,120)" at 0.1<Worm.sw,Worm.nw> rjust
+ "svg_fsize(M,120)" wid 0.2 at Worm.w rjust
+ "svg_fsize(C,120)" at 0.9<Worm.sw,Worm.nw> rjust
+ box invis ht Worm.ht wid Worm.wid+0.4 at Worm
+
+[ thicklines_
+ C: circle rad 1.5 at 0,0
+ smallrad = C.rad/2
+ for t=0 to 330 by 30 do {
+ line from Rect_(C.rad-0.05,90-t) to Rect_(C.rad+0.05,90-t)
+ sprintf("%g",t) at Rect_(C.rad+0.2,90-t)
+ }
+ "svg_fsize(R,120)" at Rect_(C.rad+0.45,90-0)
+ "svg_fsize(Y,120)" wid 0.2 at Rect_(C.rad+0.45,90-60)
+ "svg_fsize(G,120)" at Rect_(C.rad+0.45,90-120)
+ "svg_fsize(C,120)" at Rect_(C.rad+0.45,90-180)
+ "svg_fsize(B,120)" at Rect_(C.rad+0.45,90-240)
+ "svg_fsize(M,120)" at Rect_(C.rad+0.45,90-300)
+ linethick_(0)
+
+ for t = 1 to 90 do {
+ hsvtorgb(t/90*360,1,1,r,g,b)
+ line shaded svgcolor(r,g,b) outlined svgcolor(r,g,b) \
+ from C to Rect_(C.rad-0.05,90-(t-0.5)/90*360) \
+ then to Rect_(C.rad-0.05,90-(t+0.5)/90*360) \
+ then to C
+ }
+
+ R: circle diam C.rad at Rect_(C.rad*3/8,90) color "rgb(255,0,0)"
+ G: circle diam C.rad at Rect_(C.rad*3/8,-30) color "rgb(0,255,0)"
+ B: circle diam C.rad at Rect_(C.rad*3/8,-150) color "rgb(0,0,255)"
+
+ RG: cintersect(R,R.rad,G,G.rad)
+ GR: cintersect(R,R.rad,G,G.rad,R)
+ GB: cintersect(G,G.rad,B,B.rad)
+ BG: cintersect(G,G.rad,B,B.rad,R)
+ BR: cintersect(B,B.rad,R,R.rad)
+ RB: cintersect(B,B.rad,R,R.rad,R)
+
+# The following could be done other ways depending on the postprocessor
+`define lozenge {
+ arc from $1$2 to $2$1 with .c at $2
+ arc from $2$1 to $1$2 with .c at $1 }'
+
+# yellow
+linethick = 0.1; rgbfill(255,255,0,lozenge(R,G))
+linethick = 0.4; rgbdraw(255,255,0,lozenge(R,G))
+
+# cyan
+linethick = 0.1; rgbfill(0,255,255,lozenge(G,B))
+linethick = 0.4; rgbdraw(0,255,255,lozenge(G,B))
+
+# magenta
+linethick = 0.1; rgbfill(255,0,255,lozenge(B,R))
+linethick = 0.4; rgbdraw(255,0,255,lozenge(B,R))
+
+`define white {
+ arc cw from RB to GR with .c at R
+ arc cw from GR to BG with .c at G
+ arc cw from BG to RB with .c at B }'
+linethick = 0.1; rgbfill(255,255,255,white)
+linethick = 0.4; rgbdraw(255,255,255,white)
+setrgb(255,255,255)
+ line from RB to GR then to BG then to RB
+resetrgb
+
+] with .w at Worm.e+(0.5,0)
+
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/xx.html b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/xx.html
new file mode 100644
index 00000000000..6b4881d450f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/svg/xx.html
@@ -0,0 +1,11 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
+<g>
+ <text x = "10" y = "25" font-size = "20">
+ <tspan x = "10" y = "60">
+ T<tspan dy="10">i+2</tspan>
+ <tspan dy="-10">= T</tspan><tspan dy="10">i</tspan>
+ <tspan dy="-10">+ T</tspan><tspan dy="10">i+1</tspan>
+ </tspan>
+ </text>
+ </g>
+</svg>
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/test.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/test.m4
new file mode 100644
index 00000000000..82524ace0e8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/test.m4
@@ -0,0 +1,16 @@
+.PS
+# Test.m4
+cct_init
+# Use this file to do a quick test of diagrams you are developing.
+# Enter the drawing commands here and (if you have a "make" utility) type
+# make tst
+# Otherwise, to process a file called filename.m4, type one of
+# make filename.ps
+# make filename.eps
+# make filename.pdf
+# make filename.gif (requires ImageMagick convert)
+# make filename.png (requires ImageMagick convert)
+# make filename.tif (requires ImageMagick convert)
+# To perform tests in a new folder, copy the Makefile, this file,
+# and tst.tex (or your own equivalent) to that folder.
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/testpdf.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/testpdf.tex
new file mode 100644
index 00000000000..823b297b343
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/testpdf.tex
@@ -0,0 +1,15 @@
+% testpdf.tex
+% To test circuit files using pdflatex
+% 1. Use m4 and dpic -p to create test.tex as usual
+% 2. Type ps4pdf.sh testpdf
+% See http://www.tug.org/TUGboat/Articles/tb22-4/tb72voss4pdf.pdf
+%
+\documentclass[11pt]{article}
+\usepackage{ps4pdf}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\PSforPDF{ \usepackage{pstricks} }
+
+\pagestyle{empty} \thispagestyle{empty}
+\begin{document}
+\PSforPDF{ \input{test.tex} }
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/tikz.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/tikz.tex
new file mode 100644
index 00000000000..df8ae91f82d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/tikz.tex
@@ -0,0 +1,15 @@
+\documentclass[11pt]{article}
+\usepackage{tikz}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\usepackage[T1]{fontenc}
+\usepackage{boxdims}
+\addtolength{\textwidth}{2cm}
+\addtolength{\textheight}{3cm}
+\setlength{\oddsidemargin}{0pt}
+\setlength{\evensidemargin}{0pt}
+\setlength{\hoffset}{-0.5in}
+\pagestyle{empty}
+\thispagestyle{empty}
+\begin{document}
+ \noindent\vspace{2ex}\input{test.tex}
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/tst.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/tst.tex
new file mode 100644
index 00000000000..ef14d1a43c5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/tst.tex
@@ -0,0 +1,21 @@
+\documentclass[11pt]{article}
+% Custimize your packages here:
+\usepackage[dvips]{graphicx}
+\usepackage{pstricks,pst-slpe,pst-grad}
+\usepackage{boxdims}
+\usepackage{upgreek}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\usepackage{amssymb}
+%
+\addtolength{\textwidth}{2cm}
+\addtolength{\textheight}{3cm}
+\setlength{\oddsidemargin}{0pt}
+\setlength{\evensidemargin}{0pt}
+\setlength{\hoffset}{-0.5in}
+\newbox\graph
+\pagestyle{empty}
+\thispagestyle{empty}
+%
+\begin{document}
+ \noindent\vspace{2ex}\input{test.tex}\box\graph
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/tst1.tex b/Master/texmf-dist/doc/latex/circuit-macros/examples/tst1.tex
new file mode 100644
index 00000000000..95363d1d9cb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/tst1.tex
@@ -0,0 +1,12 @@
+%\documentclass{article}
+\documentclass[11pt]{article}
+\usepackage{graphicx}
+\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}
+\usepackage{boxdims}
+
+\pagestyle{empty}
+\thispagestyle{empty}
+%
+\begin{document}
+\includegraphics{test.1}
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/windows.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/windows.m4
new file mode 100644
index 00000000000..da6b9e0e512
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/windows.m4
@@ -0,0 +1,8 @@
+divert(-1)
+
+# Change the absolute Windwos path to your installation directory:
+
+define(`NeedDpicTools',`if "dpictools" != "1" then {
+ copy "D:\Dwight\lib\dpictools.pic" } define(`dfitcurve__') ')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/worm.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/worm.m4
new file mode 100644
index 00000000000..f7efc1c2e65
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/worm.m4
@@ -0,0 +1,99 @@
+.PS
+# worm.m4
+ gen_init
+ifdpic(`
+
+NeedDpicTools
+
+Worm: [
+ linethick_(0)
+ dimen = 1.25 # scale parameter; try dimen=2 for a larger picture
+ w = 0.15 * dimen # worm radius
+ nhues = 265
+ S: (dimen,0)
+ for inx = 1 to nhues do {
+ theta = inx/nhues*360
+ R: (dimen*cosd(3*theta), dimen*sind(2*theta))
+ D: R-S
+ t = sqrt(max(0,w^2/(D.x^2+D.y^2)-1/4))
+ Ra: 0.5<S,R> + (t*D.y,-t*D.x)
+ Rb: 0.5<S,R> - (t*D.y,-t*D.x)
+ hsvtorgb(theta+120,1,1,r,g,b)
+ rgbfill( r,g,b,
+ arc cw from Ra to Rb rad w with .c at S
+ arc ccw from Rb to Ra rad w with .c at R )
+ S: R
+ }
+ ]
+
+ "\large R" at 0.9<Worm.se,Worm.ne> ljust
+ "\large G" at Worm.e ljust
+ "\large B" at 0.1<Worm.se,Worm.ne> ljust
+ "\large Y" at 0.1<Worm.sw,Worm.nw> rjust
+ "\large M" at Worm.w rjust
+ "\large C" at 0.9<Worm.sw,Worm.nw> rjust
+ box invis ht Worm.ht wid Worm.wid+0.4 at Worm
+
+[ thicklines_
+ C: circle rad 1.5 at 0,0
+ smallrad = C.rad/2
+ for t=0 to 330 by 30 do {
+ line from Rect_(C.rad-0.05,90-t) to Rect_(C.rad+0.05,90-t)
+ sprintf("$%g^{\circ}$",t) at Rect_(C.rad+0.2,90-t)
+ }
+ "\large R" at Rect_(C.rad+0.45,90-0)
+ "\large Y" at Rect_(C.rad+0.45,90-60)
+ "\large G" at Rect_(C.rad+0.45,90-120)
+ "\large C" at Rect_(C.rad+0.45,90-180)
+ "\large B" at Rect_(C.rad+0.45,90-240)
+ "\large M" at Rect_(C.rad+0.45,90-300)
+ linethick_(0)
+
+ for t = 1 to 90 do {
+ hsvtorgb(t/90*360,1,1,r,g,b)
+ 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 C
+ resetrgb }
+
+ R: circle diam C.rad at Rect_(C.rad*3/8,90) color "red"
+ G: circle diam C.rad at Rect_(C.rad*3/8,-30) color "green"
+ B: circle diam C.rad at Rect_(C.rad*3/8,-150) color "blue"
+
+ RG: Cintersect(R,R.rad,G,G.rad)
+ GR: Cintersect(R,R.rad,G,G.rad,R)
+ GB: Cintersect(G,G.rad,B,B.rad)
+ BG: Cintersect(G,G.rad,B,B.rad,R)
+ BR: Cintersect(B,B.rad,R,R.rad)
+ RB: Cintersect(B,B.rad,R,R.rad,R)
+
+# The following could be done other ways depending on the postprocessor
+`define lozenge {
+ arc from $1$2 to $2$1 with .c at $2
+ arc from $2$1 to $1$2 with .c at $1 }'
+
+# yellow
+linethick = 0.1; rgbfill(1,1,0,lozenge(R,G))
+linethick = 0.4; rgbdraw(1,1,0,lozenge(R,G))
+
+# cyan
+linethick = 0.1; rgbfill(0,1,1,lozenge(G,B))
+linethick = 0.4; rgbdraw(0,1,1,lozenge(G,B))
+
+# magenta
+linethick = 0.1; rgbfill(1,0,1,lozenge(B,R))
+linethick = 0.4; rgbdraw(1,0,1,lozenge(B,R))
+
+`define innersegment {
+ arc cw from RB to GR with .c at R
+ arc cw from GR to BG with .c at G
+ arc cw from BG to RB with .c at B }'
+linethick = 0.1; rgbfill(1,1,1,innersegment)
+linethick = 0.4; rgbdraw(1,1,1,innersegment)
+
+] with .w at Worm.e+(0.5,0)
+
+',`box "worm.m4" "requires" "dpic"')
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/Makefile b/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/Makefile
new file mode 100644
index 00000000000..239c7a00d14
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/Makefile
@@ -0,0 +1,24 @@
+# The distribution directory
+LIBDIR = $$HOME/lib
+
+# DPIC = $$HOME/dpic/test/dpic
+DPIC = dpic
+
+# M4 = m4 -B16000
+M4 = m4 -I $(LIBDIR)
+
+LIB = xfiglib
+M4MACROS = xfig.m4
+
+.SUFFIXES: .m4 .pic .fig
+.m4.fig:
+ $(M4) $(M4MACROS) $*.m4 > $*.pic
+ $(DPIC) -x $*.pic > $*.fig
+
+$(LIB).fig: $(LIB).m4
+
+clobber: clean
+ rm -f *.fig
+
+clean:
+ rm -f *.pic
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
new file mode 100644
index 00000000000..a07a0885f81
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.fig
@@ -0,0 +1,755 @@
+#FIG 3.2
+Landscape
+Center
+Inches
+Letter
+100.00
+Single
+-2
+# dpic version 2019.04.10 option -x for Fig 3.2
+1200 2
+6 0 0 3975 5025
+6 0 0 3975 5025
+6 75 75 3900 4950
+6 75 75 225 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 10
+ 150 675 150 525 100 500 200 450 100 400 200 350 100 300 200 250 150 225 150 75
+-6
+6 375 75 600 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 525 675 525 545
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 525 545 3 3 528 545 528 545
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 491 525 545 441 478 546 452
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 546 452 3 3 549 452 549 452
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 414 546 452 440 414 546 375
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 546 375 3 3 549 375 549 375
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 336 546 375 440 336 546 298
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 546 298 3 3 549 298 549 298
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 500 259 546 298 441 272 525 205
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 525 205 3 3 528 205 528 205
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 525 205 525 75
+-6
+6 750 75 975 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 900 675 900 545
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 900 545 3 3 903 545 903 545
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 491 900 545 816 478 921 452
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 921 452 3 3 924 452 924 452
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 414 921 452 815 414 921 375
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 921 375 3 3 924 375 924 375
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 336 921 375 815 336 921 298
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 921 298 3 3 924 298 924 298
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 875 259 921 298 816 272 900 205
+1 3 0 0 0 -1 0 -1 -1 0 1 0.0 900 205 3 3 903 205 903 205
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 900 205 900 75
+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
+-6
+6 1125 75 1200 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1200 675 1200 525
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1200 488 1200 525 1163 488 1200 450
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1200 413 1200 450 1163 413 1200 375
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1200 338 1200 375 1163 338 1200 300
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1200 263 1200 300 1163 263 1200 225
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1200 225 1200 75
+-6
+6 1350 75 1500 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1500 675 1500 525
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1500 488 1500 525 1463 488 1500 450
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1500 413 1500 450 1463 413 1500 375
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1500 338 1500 375 1463 338 1500 300
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1500 263 1500 300 1463 263 1500 225
+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
+-6
+6 1650 75 1800 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1725 75 1725 345
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1650 345 1800 345
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1725 535 1650 405 1725 385 1800 405
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1725 385 1725 675
+-6
+6 1950 75 2250 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2100 675 2100 405
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2200 405 2000 405
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2200 345 2000 345
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2100 345 2100 75
+-6
+6 2400 75 2550 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2475 75 2475 332
+2 1 0 1 0 -1 0 -1 20 0 0 0 0 0 0 5
+ 2475 332 2525 332 2475 412 2425 332 2475 332
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2420 418 2530 418
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2475 418 2475 675
+-6
+6 2700 75 2850 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2775 75 2775 332
+2 1 0 1 0 -1 0 -1 20 0 0 0 0 0 0 5
+ 2775 332 2825 332 2775 412 2725 332 2775 332
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 2720 393 2720 418 2830 418 2830 443
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2775 418 2775 675
+-6
+6 3000 75 3150 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 75 3075 288
+2 1 0 1 0 -1 0 -1 20 0 0 0 0 0 0 5
+ 3075 288 3125 288 3075 368 3025 288 3075 288
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 3020 350 3020 375 3130 375 3130 400
+2 1 0 1 0 -1 0 -1 20 0 0 0 0 0 0 5
+ 3075 462 3125 462 3075 382 3025 462 3075 462
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 462 3075 675
+-6
+6 3300 75 3450 675
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3375 675 3375 425
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3425 425 3325 425
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 6
+ 3375 400 3300 400 3300 350 3450 350 3450 400 3375 400
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3425 325 3325 325
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3375 325 3375 75
+-6
+6 3600 75 3900 300
+6 3650 75 3850 300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3750 75 3750 225
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3850 225 3650 225
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3817 263 3683 263
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3793 300 3707 300
+-6
+-6
+6 3600 450 3900 600
+6 3650 450 3850 525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3850 450 3650 450
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3817 488 3683 488
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3793 525 3707 525
+-6
+-6
+6 3600 750 3750 900
+6 3651 801 3699 849
+1 3 0 1 0 -1 0 -1 20 0 1 0.0 3675 825 24 24 3699 825 3699 825
+-6
+-6
+6 75 825 375 1425
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 225 1425 225 1275
+1 3 0 1 0 -1 0 -1 -1 0 1 0.0 225 1125 150 150 375 1125 375 1125
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 225 975 225 825
+-6
+6 525 825 825 1425
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 675 1425 675 1275
+1 3 0 1 0 -1 0 -1 -1 0 1 0.0 675 1125 150 150 825 1125 825 1125
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 60 120
+ 675 1238 675 1013
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 675 975 675 825
+-6
+6 975 825 1275 1425
+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
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1075 1125 1025 1125 1075 1075 1125 1125
+5 1 0 1 0 -1 0 -1 -1 0 0 1 0 0 1175 1125 1125 1125 1175 1175 1225 1125
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1125 975 1125 825
+-6
+6 1425 825 1875 1425
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1650 1425 1650 1305
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 5
+ 1650 1305 1470 1125 1650 945 1830 1125 1650 1305
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1650 945 1650 825
+-6
+6 2025 825 2475 1425
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2250 1425 2250 1305
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 5
+ 2250 1305 2070 1125 2250 945 2430 1125 2250 1305
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 60 120
+ 2250 1260 2250 990
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2250 945 2250 825
+-6
+6 2625 825 2925 1425
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2775 1425 2775 1150
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2700 1150 2850 1150
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2625 1100 2925 1100
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2775 1100 2775 825
+-6
+6 3075 825 3375 1425
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3225 1425 3225 1250
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3150 1250 3300 1250
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 1200 3375 1200
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3150 1150 3300 1150
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 1100 3375 1100
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3150 1050 3300 1050
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 1000 3375 1000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3225 1000 3225 825
+-6
+6 3525 825 3675 1425
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3600 1425 3600 1275
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 6
+ 3600 975 3540 975 3540 1275 3660 1275 3660 975 3600 975
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3600 975 3600 825
+-6
+6 75 1575 675 1800
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 75 1725 275 1725
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 275 1725 425 1575
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 475 1725 675 1725
+-6
+6 75 1950 675 2175
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 75 2100 275 2100
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 275 2100 425 1950
+5 1 0 1 0 -1 0 -1 -1 0 0 1 1 0 148 2181 423 2126 384 2030 314 1955
+ 1 1 0.888889 42.4 64
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 475 2100 675 2100
+-6
+6 75 2325 675 2550
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 75 2475 275 2475
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 275 2475 425 2325
+5 1 0 1 0 -1 0 -1 -1 0 0 1 0 1 136 2532 420 2514 399 2424 350 2345
+ 1 1 0.888889 42.4 64
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 475 2475 675 2475
+-6
+6 750 1575 1500 2175
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 750 1875 825 1875
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 5
+ 1425 1875 825 1575 825 2175 1425 1875 1500 1875
+-6
+6 1650 1575 2250 2025
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1650 1800 1775 1800
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 1915 2010 1775 2010 1775 1590 1915 1590
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1915 1800 1915 1590 2125 1800 1915 2010
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2125 1800 2250 1800
+-6
+6 2400 1575 2700 2025
+6 2400 1575 2700 2025
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2400 1575 2400 1620
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2400 1665 2400 1620 2445 1665 2400 1710
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2400 1755 2400 1710 2445 1755 2400 1800
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2400 1845 2400 1800 2445 1845 2400 1890
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2400 1935 2400 1890 2445 1935 2400 1980
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2400 1980 2400 2025
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2505 1620 2505 1980
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2595 1620 2595 1980
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2700 2025 2700 1980
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2700 1935 2700 1980 2655 1935 2700 1890
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2700 1845 2700 1890 2655 1845 2700 1800
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2700 1755 2700 1800 2655 1755 2700 1710
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2700 1665 2700 1710 2655 1665 2700 1620
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2700 1620 2700 1575
+-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
+-6
+6 1275 2250 1650 2550
+6 1325 2250 1650 2550
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1450 2500 1450 2300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1325 2400 1450 2400
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1650 2550 1450 2460
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1 2
+ 1 1 0.888889 55.555556 83.333333
+ 1600 2528 1500 2483
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1650 2250 1450 2340
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1325 2400 1275 2400
+-6
+6 1800 2250 2175 2550
+6 1800 2250 2125 2550
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2000 2500 2000 2300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2125 2400 2000 2400
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1800 2550 2000 2460
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1 2
+ 1 1 0.888889 55.555556 83.333333
+ 1850 2528 1950 2483
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1800 2250 2000 2340
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2125 2400 2175 2400
+-6
+6 2325 2250 2700 2550
+6 2375 2250 2700 2550
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2500 2500 2500 2300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2375 2400 2500 2400
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2700 2550 2500 2460
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 55.555556 83.333333
+ 2650 2528 2550 2483
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2700 2250 2500 2340
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2375 2400 2325 2400
+-6
+6 2850 2250 3225 2550
+6 2850 2250 3175 2550
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3050 2500 3050 2300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3175 2400 3050 2400
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2850 2550 3050 2460
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 55.555556 83.333333
+ 2900 2528 3000 2483
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2850 2250 3050 2340
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3175 2400 3225 2400
+-6
+6 75 2700 525 3075
+6 131 2747 525 3031
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 525 2775 328 2775
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 328 3028 328 2747
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 62.5 93.75
+ 131 3000 328 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 525 3000 328 3000
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 131 3000 75 3000
+-6
+6 675 2700 1125 3075
+6 675 2747 1069 3031
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 675 2775 872 2775
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 872 3028 872 2747
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 62.5 93.75
+ 1069 3000 872 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 675 3000 872 3000
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1069 3000 1125 3000
+-6
+6 1275 2700 1725 3075
+6 1331 2747 1725 3031
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1725 2775 1528 2775
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1528 3028 1528 2747
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1528 3000 1331 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 62.5 93.75
+ 1453 3000 1359 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1725 3000 1528 3000
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1331 3000 1388 3000
+-6
+6 1875 2700 2325 3075
+6 1875 2747 2269 3031
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1875 2775 2072 2775
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2072 3028 2072 2747
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2072 3000 2269 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 62.5 93.75
+ 2147 3000 2241 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1875 3000 2072 3000
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2269 3000 2325 3000
+-6
+6 2475 2700 2925 3075
+6 2531 2747 2925 3028
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2925 2888 2728 2888
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 62.5 93.75
+ 2873 2888 2780 2888
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2925 2775 2728 2775
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2728 3028 2728 2944
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2728 2916 2728 2859
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2728 2831 2728 2747
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 3
+ 2672 2775 2672 3000 2531 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 2912 2888 2925 2888 2925 3000 2912 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2925 3000 2728 3000
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2531 3000 2588 3000
+-6
+6 3075 2700 3525 3075
+6 3075 2747 3469 3028
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 2888 3272 2888
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 62.5 93.75
+ 3127 2888 3220 2888
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 2775 3272 2775
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3272 3028 3272 2944
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3272 2916 3272 2859
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3272 2831 3272 2747
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 3
+ 3328 2775 3328 3000 3469 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 3088 2888 3075 2888 3075 3000 3088 3000
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 3000 3272 3000
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3469 3000 3525 3000
+-6
+6 75 3225 525 3600
+6 131 3272 525 3553
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 525 3413 328 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1 2
+ 1 1 0.888889 62.5 93.75
+ 473 3413 380 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 525 3300 328 3300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 328 3553 328 3469
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 328 3441 328 3384
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 328 3356 328 3272
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 3
+ 272 3300 272 3525 131 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 512 3413 525 3413 525 3525 512 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 525 3525 328 3525
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 131 3525 75 3525
+-6
+6 675 3225 1125 3600
+6 675 3272 1069 3553
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 675 3413 872 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1 2
+ 1 1 0.888889 62.5 93.75
+ 727 3413 820 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 675 3300 872 3300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 872 3553 872 3469
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 872 3441 872 3384
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 872 3356 872 3272
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 3
+ 928 3300 928 3525 1069 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 688 3413 675 3413 675 3525 688 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 675 3525 872 3525
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1069 3525 1125 3525
+-6
+6 1275 3225 1725 3600
+6 1331 3272 1725 3553
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1725 3413 1528 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 62.5 93.75
+ 1673 3413 1580 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1725 3300 1528 3300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1528 3553 1528 3272
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 3
+ 1472 3300 1472 3525 1331 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 1712 3413 1725 3413 1725 3525 1712 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1725 3525 1528 3525
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1331 3525 1275 3525
+-6
+6 1875 3225 2325 3600
+6 1875 3272 2269 3553
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1875 3413 2072 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 1 0 2
+ 1 1 0.888889 62.5 93.75
+ 1927 3413 2020 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1875 3300 2072 3300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2072 3553 2072 3272
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 3
+ 2128 3300 2128 3525 2269 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 1888 3413 1875 3413 1875 3525 1888 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1875 3525 2072 3525
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2269 3525 2325 3525
+-6
+6 2475 3225 2925 3600
+6 2531 3272 2925 3553
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2925 3413 2728 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1 2
+ 1 1 0.888889 62.5 93.75
+ 2873 3413 2780 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2925 3300 2728 3300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2728 3553 2728 3272
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 3
+ 2672 3300 2672 3525 2531 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 2912 3413 2925 3413 2925 3525 2912 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2925 3525 2728 3525
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2531 3525 2475 3525
+-6
+6 3075 3225 3525 3600
+6 3075 3272 3469 3553
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 3413 3272 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1 2
+ 1 1 0.888889 62.5 93.75
+ 3127 3413 3220 3413
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 3300 3272 3300
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3272 3553 3272 3272
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 3
+ 3328 3300 3328 3525 3469 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 3088 3413 3075 3413 3075 3525 3088 3525
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3075 3525 3272 3525
+-6
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 3469 3525 3525 3525
+-6
+6 75 3750 607 4350
+6 75 3824 607 4276
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 257 3826 75 3826
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 -393 4051 80 3824 132 4050 82 4276
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 75 4276 257 4276
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 257 4211 257 3826 465 3887 607 4051
+5 1 0 1 0 -1 0 -1 -1 0 0 1 0 0 257 3892 257 4276 465 4215 607 4051
+-6
+-6
+6 750 3750 1357 4350
+6 750 3824 1357 4276
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 932 3826 750 3826
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 282 4051 755 3824 807 4050 757 4276
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 750 4276 932 4276
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 932 4211 932 3826 1140 3887 1282 4051
+5 1 0 1 0 -1 0 -1 -1 0 0 1 0 0 932 3892 932 4276 1140 4215 1282 4051
+1 3 0 1 0 -1 0 -1 -1 0 1 0.0 1319 4051 38 38 1357 4051 1357 4051
+-6
+-6
+6 1500 3750 2100 4350
+6 1500 3824 2100 4276
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1026 4051 1500 3826 1551 4051 1500 4276
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1750 3826 1568 3826
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1101 4051 1574 3824 1626 4050 1575 4276
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 1568 4276 1750 4276
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1750 4211 1750 3826 1958 3887 2100 4051
+5 1 0 1 0 -1 0 -1 -1 0 0 1 0 0 1750 3892 1750 4276 1958 4215 2100 4051
+-6
+-6
+6 2250 3750 2925 4350
+6 2250 3824 2925 4276
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1776 4051 2250 3826 2301 4051 2250 4276
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2500 3826 2318 3826
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1851 4051 2324 3824 2376 4050 2325 4276
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2318 4276 2500 4276
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 2500 4211 2500 3826 2708 3887 2850 4051
+5 1 0 1 0 -1 0 -1 -1 0 0 1 0 0 2500 3892 2500 4276 2708 4215 2850 4051
+1 3 0 1 0 -1 0 -1 -1 0 1 0.0 2888 4051 38 38 2925 4051 2925 4051
+-6
+-6
+6 75 4500 150 4950
+6 75 4500 150 4950
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 75 4725 126 4725
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 75 4575 104 4575
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 75 4875 104 4875
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 75 4650 120 4650
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 75 4800 120 4800
+-6
+-6
+6 300 4500 375 4950
+6 300 4500 375 4950
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 300 4725 351 4725
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 300 4575 329 4575
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 300 4875 329 4875
+-6
+-6
+6 525 4500 600 4950
+6 525 4500 600 4950
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 525 4575 554 4575
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 525 4875 554 4875
+-6
+-6
+6 750 4500 825 4950
+6 750 4500 825 4950
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 750 4725 801 4725
+-6
+-6
+6 975 4500 1500 4950
+6 975 4500 1500 4950
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 1275 4950 975 4950 975 4500 1275 4500
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1275 4725 1275 4500 1500 4725 1275 4950
+-6
+-6
+6 1650 4500 2250 4950
+6 1650 4500 2250 4950
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 1950 4950 1650 4950 1650 4500 1950 4500
+5 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 1950 4725 1950 4500 2175 4725 1950 4950
+1 3 0 1 0 -1 0 -1 -1 0 1 0.0 2213 4725 38 38 2250 4725 2250 4725
+-6
+-6
+6 2400 4500 2700 4800
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2400 4650 2438 4650
+6 2438 4500 2700 4800
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 2700 4650 2438 4800 2438 4500 2700 4650
+-6
+-6
+6 2850 4500 3225 4800
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 2
+ 2850 4650 2888 4650
+6 2888 4500 3225 4800
+2 1 0 1 0 -1 0 -1 -1 0 0 0 0 0 0 4
+ 3150 4650 2888 4800 2888 4500 3150 4650
+1 3 0 1 0 -1 0 -1 -1 0 1 0.0 3188 4650 38 38 3225 4650 3225 4650
+-6
+-6
+-6
+-6
+-6
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.m4
new file mode 100644
index 00000000000..bfe21e08d21
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/xfig/xfiglib.m4
@@ -0,0 +1,161 @@
+.PS
+# This is the source for a prototype xfig library of electric circuit
+# elements. Each element is a compound xfig object with corners on grid points.
+# Connection points (to which lines may be drawn) should also be on grid
+# points.
+#
+# Processing postscript.m4 and this file thought dpic -r gives postscript
+# output that can be read into CorelDraw and, probably, Adobe Illustrator.
+#
+
+log_init
+
+
+gunit = 1/16 # default xfig grid dimension = (1/16) in
+divert(-1)
+define(`elen_',`8*gunit') # default 2-terminal element length
+define(`dimen_',`8*gunit') # reference dimension for element bodies
+define(`L_unit',`gunit') # logical gate grid size
+define(`N_diam',1) # L_unit size of `not' circles
+
+ # grid round and chop
+define(`g_round',`(int((`$1')/gunit+100000.5 )-100000)*gunit')
+define(`g_chop', `(int((`$1')/gunit+100000.9999)-100000)*gunit')
+ # snap to grid
+define(`g_snap',`(g_round((`$1').x),g_round((`$1').y))')
+
+# Box containing an element. The element must be in a box that is
+# intersected by a horizontal or vertical line from entry to exit.
+define(`Xfigbox',`[ S: Here; `$1' ; F: Here
+ if S.y == F.y then { move from (max(S.x,F.x),F.y+g_chop(last[].n.y-F.y)) \
+ to (min(S.x,F.x),F.y-g_chop(F.y-last[].s.y)) } \
+ else { move from (F.x+g_chop(last[].e.x-F.x),max(S.y,F.y))\
+ to (F.x-g_chop(F.x-last[].w.x),min(S.y,F.y))
+ } ] ')
+
+# Place compound object corners at grid intersections
+define(`Below',
+ `with .nw at g_snap(ifelse(`$1',,`last []',`$1').sw)-(0,2*gunit)')
+define(`Right',
+ `with .nw at g_snap(ifelse(`$1',,`last []',`$1').ne)+(2*gunit,0)')
+
+# for debug
+define(`prpos',`print (`$1').x/gunit,(`$1').y/gunit')
+divert(0)dnl
+
+[ [
+
+rpoint_(up_ elen_)
+A:Xfigbox( resistor )
+ Xfigbox( inductor(,W) ) Right
+ Xfigbox( inductor(,W,,M) ) Right
+ Xfigbox( inductor ) Right
+ Xfigbox( inductor(,,,M) ) Right
+ Xfigbox( capacitor(down_ elen_,C) ) Right
+ Xfigbox( capacitor ) Right
+ Xfigbox( diode(down_ elen_) ) Right
+ Xfigbox( diode(down_ elen_,Z) ) Right
+ Xfigbox( diode(down_ elen_,B) ) Right
+ Xfigbox( xtal ) Right
+ Xfigbox( down_ ; { [right_; ground] }; move down_ 3*gunit ) Right
+ Xfigbox( {move down_ gunit}; [right_; ground(,T)] ) Below
+ Xfigbox( move up_ 2*gunit; dot(at last move.c) ) Below
+
+B:Xfigbox( source ) Below(A)
+ Xfigbox( source(,I) ) Right
+ Xfigbox( source(,AC) ) Right
+ Xfigbox( consource ) Right
+ Xfigbox( consource(,I) ) Right
+ Xfigbox( battery ) Right
+ Xfigbox( battery(,3) ) Right
+ Xfigbox( ebox ) Right
+
+rpoint_(right_ elen_ from B)
+C:Xfigbox( switch ) Below(B)
+ Xfigbox( switch(,,O) ) Below
+D:Xfigbox( switch(,,C) ) Below
+ Xfigbox( amp(right_ elen_*10/8) ) with .nw at C.ne+(gunit,0)
+D1:Xfigbox( delay ) Right
+ Xfigbox(define(`dimen_',dimen_*6/5)dnl
+ transformer(down_ 6*gunit,L)
+ define(`dimen_',`8*gunit') ) Right
+
+define(`bi_tr_adj',`with .E at Here
+ line ifelse(`$1',,left,right) gunit*2/3 from last [].B')
+
+define(`dimen_',`5/6*8*gunit') # Adjust transistors to grid
+ Xfigbox( [move right_ g_chop(29/10*gunit*2)
+ circle rad 29/10*gunit at last move] ) Right
+up_
+ Xfigbox( {bi_tr bi_tr_adj}; move up_ gunit ) \
+ with .se at (g_round(D1.w.x),g_round(D.s.y))
+ Xfigbox( {bi_tr(,R) bi_tr_adj(R)}; move up_ gunit ) Right
+ Xfigbox( {bi_tr(,,P) bi_tr_adj}; move up_ gunit ) Right
+ Xfigbox( {bi_tr(,R,P) bi_tr_adj(R)}; move up_ gunit ) Right
+
+define(`dimen_',15/16*8*gunit)
+define(`fet_adj',`with .S at Here
+ line ifelse(`$1',,left,right) gunit*3/4 from last [].G')
+define(`fet_move',`move up_ 5*gunit from last [].S-(0,gunit)')
+
+E:Xfigbox( {j_fet fet_adj}; fet_move ) Below(D)
+ Xfigbox( {j_fet(,R) fet_adj(R)}; fet_move ) Right
+ Xfigbox( {j_fet(,,P,) fet_adj(R)}; fet_move ) Right
+ Xfigbox( {j_fet(,R,P,) fet_adj(R)}; fet_move ) Right
+ Xfigbox( {e_fet(,,,) fet_adj(R)}; fet_move ) Right
+ Xfigbox( {e_fet(,R,,) fet_adj(R)}; fet_move ) Right
+
+F:Xfigbox( {e_fet(,,P,) fet_adj}; fet_move ) Below(E)
+ Xfigbox( {e_fet(,R,P,) fet_adj(R)}; fet_move ) Right
+ Xfigbox( {d_fet(,,,) fet_adj}; fet_move ) Right
+ Xfigbox( {d_fet(,R,,) fet_adj(R)}; fet_move ) Right
+ Xfigbox( {d_fet(,,P,) fet_adj}; fet_move ) Right
+ Xfigbox( {d_fet(,R,P,) fet_adj(R)}; fet_move ) Right
+
+right_
+G:Xfigbox( OR_gate(1) ) Below(F)
+ Xfigbox( NOR_gate ) Right
+ Xfigbox( XOR_gate ) Right
+ Xfigbox( NXOR_gate ) Right
+
+# input lines for OR-like gates.
+define(`OR_inlgth',`(-sqrt(OR_rad^2-G_hht^2)+sqrt(OR_rad^2-`$1'^2))*L_unit')
+
+H:Xfigbox( [ {move right_ gunit}
+ {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
+ {line right_ OR_inlgth(0)}
+ {line right_ OR_inlgth(2) from Here+svec_(0,2)}
+ {line same from Here-svec_(0,2)}
+ {line right_ OR_inlgth(1) from Here+svec_(0,1)}
+ {line same from Here-svec_(0,1)}] ) Below(G)
+ Xfigbox( [ {move right_ gunit}
+ {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
+ {line right_ OR_inlgth(0)}
+ {line right_ OR_inlgth(2) from Here+svec_(0,2)}
+ {line same from Here-svec_(0,2)}] ) Right
+ Xfigbox( [ {move right_ gunit}
+ {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
+ {line right_ OR_inlgth(2) from Here+svec_(0,2)}
+ {line same from Here-svec_(0,2)}] ) Right
+ Xfigbox( [ {move right_ gunit}
+ {move from last move-svec_(0,G_hht) to last move+svec_(0,G_hht)}
+ {line right_ OR_inlgth(0)}] ) Right
+
+ Xfigbox( AND_gate ) Right
+ Xfigbox( NAND_gate ) Right
+ Xfigbox( line right_ L_unit/2; BUFFER_gate ) Right
+ Xfigbox( line right_ L_unit/2; NOT_gate ) Right
+
+# Deleted because of labels:
+#right_
+#textht = 10/72
+#I:Xfigbox( FlipFlop(D) ) Below(H)
+# Xfigbox( FlipFlop(T) ) Right
+#J:Xfigbox( FlipFlop(RS) ) Below(I)
+# Xfigbox( FlipFlop(JK) ) Right
+
+ ]
+ box invis wid last [].wid+2*gunit ht last [].ht+2*gunit at last []
+] with .sw at (1,1)
+#print last [].wid,last[].ht
+.PE
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/gpic.m4 b/Master/texmf-dist/doc/latex/circuit-macros/gpic.m4
new file mode 100644
index 00000000000..7202ce6e153
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/gpic.m4
@@ -0,0 +1,26 @@
+divert(-1)
+ gpic.m4 Initialization for gpic.
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`m4picprocessor',gpic)
+define(`m4postprocessor',tpic)
+
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')dnl
+
+define(`thinlines_',`linethick=0.4
+ arrowwid = 0.05*2/3*scale; arrowht = 0.1*2/3*scale;')
+
+define(`thicklines_',`linethick = 0.8
+ arrowwid = 0.05*scale; arrowht = 0.1*scale;')
+
+define(`linethick_',`linethick=ifelse(`$1',,`0.8',`$1')
+ arrowwid = ifelse(`$1',,`0.05',linethick/0.8*0.05)*scale; dnl
+ arrowht = ifelse(`$1',,`0.1',linethick/0.8*0.1)*scale;')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/lib3D.m4 b/Master/texmf-dist/doc/latex/circuit-macros/lib3D.m4
new file mode 100644
index 00000000000..68c0ca3ba36
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/lib3D.m4
@@ -0,0 +1,237 @@
+divert(-1)
+lib3D.m4 Macros for rotation, projection, and other
+ operations on argument triples representing
+ 3D vectors.
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`lib3D_')
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')
+
+=============================================================================
+
+ `setview(azimuth, elevation, rotation)
+ Set view angles (degrees) for projection onto
+ a plane. The view vector is obtained by looking
+ in along the x axis, then rotating about -x,
+ -y, and z in that order. 3D vectors are
+ projected onto the resulting yz plane
+ using the project() macro. If rotation = 0,
+ the projection matrix P is
+ P =( -sin(az), cos(az), 0 )
+ (-sin(el)cos(az),-sin(az)sin(el),cos(el))'
+define(`setview',`
+ m4azim=ifelse(`$1',,0,`$1',0,0,`prod_(`$1',dtor_)')
+ m4elev=ifelse(`$2',,0,`$2',0,0,`prod_(`$2',dtor_)')
+ m4rot =ifelse(`$3',,0,`$3',0,0,`prod_(`$3',dtor_)')
+ m4caz=ifelse(`$1',,1,`$1',0,1,`$1',90,0,`$1',-90, 0,cos(m4azim))
+ m4saz=ifelse(`$1',,0,`$1',0,0,`$1',90,1,`$1',-90,-1,sin(m4azim))
+ m4cel=ifelse(`$2',,1,`$2',0,1,`$2',90,0,`$2',-90, 0,cos(m4elev))
+ m4sel=ifelse(`$2',,0,`$2',0,0,`$2',90,1,`$2',-90,-1,sin(m4elev))
+ m4cro=ifelse(`$3',,1,`$3',0,1,`$3',90,0,`$3',-90, 0,cos(m4rot))
+ m4sro=ifelse(`$3',,0,`$3',0,0,`$3',90,1,`$3',-90,-1,sin(m4rot))
+ view3D1=m4caz*m4cel
+ view3D2=m4saz*m4cel
+ view3D3=m4sel dnl
+ ifdef(`setlight_',,`; light3D1=view3D1; light3D2=view3D2; light3D3=view3D3')
+')
+ The resulting view vector
+#efine(`View3D',`PtoBase3D(1,0,0)')
+define(`View3D',`view3D1,view3D2,view3D3')
+
+ `Extract the x-y, x-z, or y-z coordinate pair
+ from a triple'
+define(`Pr_xy',`$1,$2')
+define(`Pr_xz',`$1,$3')
+define(`Pr_yz',`$2,$3')
+
+ Projection coords back to orig 3D coords
+define(`PtoBase3D',
+ `rot3Dz(m4azim,rot3Dy(-m4elev,rot3Dx(-m4rot,`$1',`$2',`$3')))')
+
+ This does the 3D to 2D axonometric projection
+ i.e. project(x,y,z) produces coordinate pair
+ u,v on the 2D plane defined by the view angles.
+define(`project',
+`Pr_yz(rot3Dx(m4rot,rot3Dy(m4elev,rot3Dz(-m4azim,`$1',`$2',`$3'))))')
+
+ `Rotation about x axis rot3Dx(angle,x1,x2,x3)'
+define(`rot3Dx',``$2',diff_(prod_(cos(`$1'),`$3'),prod_(sin(`$1'),`$4')),dnl
+ sum_(prod_(sin(`$1'),`$3'),prod_(cos(`$1'),`$4'))')
+
+ `Rotation about y axis rot3Dy(angle,x1,x2,x3)'
+define(`rot3Dy',`sum_(prod_(cos(`$1'),`$2'),prod_(sin(`$1'),`$4')),`$3',dnl
+ diff_(prod_(cos(`$1'),`$4'),prod_(sin(`$1'),`$2'))')
+
+ `Rotation about z axis rot3Dz(angle,x1,x2,x3)'
+define(`rot3Dz',`diff_(prod_(cos(`$1'),`$2'),prod_(sin(`$1'),`$3')),dnl
+ sum_(prod_(sin(`$1'),`$2'),prod_(cos(`$1'),`$3')),`$4'')
+
+ `Cross product cross3D(x1,y1,z1,x2,y2,z2)'
+define(`cross3D',`diff_(prod_(`$2',`$6'),prod_(`$3',`$5')),dnl
+ diff_(prod_(`$3',`$4'),prod_(`$1',`$6')),dnl
+ diff_(prod_(`$1',`$5'),prod_(`$2',`$4'))')
+
+ `Dot product dot3D(x1,y1,z1,x2,y2,z2)'
+define(`dot3D',`(sum_(
+ sum_(prod_(`$1',`$4'),prod_(`$2',`$5')),prod_(`$3',`$6')))')
+ Vector addition, subtraction, scalar product
+define(`sum3D',`sum_(`$1',`$4'),sum_(`$2',`$5'),sum_(`$3',`$6')')
+define(`diff3D',`diff_(`$1',`$4'),diff_(`$2',`$5'),diff_(`$3',`$6')')
+define(`sprod3D',`prod_(`$1',`$2'),prod_(`$1',`$3'),prod_(`$1',`$4')')
+ Extract direction cosine
+ `eg v = dcosine3D(1,x,y,z) assigns x to v'
+define(`dcosine3D',`(ifelse(`$1',1,`$2',`$1',2,`$3',`$4'))')
+ Euclidian length
+define(`length3D',`sqrt((`$1')^2+(`$2')^2+(`$3')^2)')
+ Unit vector
+define(`unit3D',`sprod3D(1/length3D(`$1',`$2',`$3'),`$1',`$2',`$3')')
+ Assign the direction cosines to variables
+ `assign3D([u],[v],[w],x,y,z); eg
+ assign3D(u,v,w,cross3D(x1,y1,z1,x2,y2,z2))
+ assigns the 4th arg to u, the 5th to v,
+ and the 6th to w as u, v,or w are nonblank'
+define(`assign3D',
+`ifelse(`$1',,,`$1' = `$4')
+ ifelse(`$2',,,`$2' = `$5')
+ ifelse(`$3',,,`$3' = `$6')')
+
+ Write out the 3 arguments for debug
+define(`print3D',`print sprintf("`$1'(%g,%g,%g)",`$2',`$3',`$4')')
+
+ `setlightlight (azimuth, elevation, rotation)
+ Set angles (degrees) for 3D highlighting.
+ Defaults are the previous values for
+ setview(). The Light3D vector is defined
+ as for View3D.'
+define(`setlight',`define(`setlight_')
+ m4hzim=ifelse(`$1',,m4azim,`$1',0,0,`prod_(`$1',dtor_)')
+ m4hlev=ifelse(`$2',,m4elev,`$2',0,0,`prod_(`$2',dtor_)')
+ m4hot =ifelse(`$3',,m4rot,`$3',0,0,`prod_(`$3',dtor_)')
+ m4chz=ifelse(`$1',0,1,`$1',90,0,`$1',-90, 0,cos(m4hzim))
+ m4shz=ifelse(`$1',0,0,`$1',90,1,`$1',-90,-1,sin(m4hzim))
+ m4chl=ifelse(`$2',0,1,`$2',90,0,`$2',-90, 0,cos(m4hlev))
+ m4shl=ifelse(`$2',0,0,`$2',90,1,`$2',-90,-1,sin(m4hlev))
+ m4cho=ifelse(`$3',0,1,`$3',90,0,`$3',-90, 0,cos(m4hot))
+ m4sho=ifelse(`$3',0,0,`$3',90,1,`$3',-90,-1,sin(m4hot))
+ light3D1=m4chz*m4chl
+ light3D2=m4shz*m4chl
+ light3D3=m4shl
+')
+ The resulting vector
+#efine(`Light3D',`PtoBase3D(1,0,0)')
+define(`Light3D',
+ `ifdef(`setlight_',`light3D1,light3D2,light3D3',`view3D1,view3D2,view3D3')')
+
+ `Fector(x,y,z,nx,ny,nz) with .Origin at pos
+ Arrow with flat 3D head. The second vector,
+ (i.e. args nx,ny,nz) is the normal to the
+ head flat surface'
+define(`Fector',
+ `[ Origin: 0,0
+ define(`M4F_V',``$1',`$2',`$3'')dnl the whole vector V
+ lV = length3D(M4F_V)
+ define(`M4F_T',``$4',`$5',`$6'')dnl normal to the top surface
+ lT = length3D(M4F_T)
+ define(`M4F_Vn',`sprod3D(1/lV,M4F_V)')dnl unit vector Vn
+ aln = 0.15*scale ;dnl arrowhead length
+ awd = 0.09*scale ;dnl " width
+ adp = 0.0375*scale ;dnl " depth (thickness)
+ define(`M4F_Vt',`sprod3D((lV-aln),M4F_Vn)')dnl head base vector
+
+Start: Origin
+End: project(M4F_V)
+ rpoint_(from Origin to End)
+ lTdp = adp/2/lT
+ vtx = dcosine3D(1,M4F_Vt); vty = dcosine3D(2,M4F_Vt) # Vt coords
+ vtz = dcosine3D(3,M4F_Vt)
+dnl half-thickness vector in direction of T
+ tx = prod_(lTdp,`$4'); ty = prod_(lTdp,`$5')
+ tz = prod_(lTdp,`$6')
+dnl half-width vector right
+ rf = awd/2/lT/lV
+ rx = rf*dcosine3D(1,cross3D(M4F_V,M4F_T))
+ ry = rf*dcosine3D(2,cross3D(M4F_V,M4F_T))
+ rz = rf*dcosine3D(3,cross3D(M4F_V,M4F_T))
+dnl top and bottom points of V
+TV: project(sum3D(M4F_V, tx,ty,tz))
+BV: project(diff3D(M4F_V, tx,ty,tz))
+dnl top, bottom right, left of base
+TR: project(sum3D(vtx,vty,vtz, sum3D(tx,ty,tz,rx,ry,rz)))
+BR: project(sum3D(vtx,vty,vtz, diff3D(rx,ry,rz,tx,ty,tz)))
+BL: project(diff3D(vtx,vty,vtz, sum3D(rx,ry,rz,tx,ty,tz)))
+TL: project(diff3D(vtx,vty,vtz, diff3D(rx,ry,rz,tx,ty,tz)))
+ lthickness = linethick
+dnl base
+ if dot3D(M4F_V,View3D) < 0 then {
+ thinlines_
+ ifgpic(`gshade(0.5,BR,BL,TL,TR,BR,BL)',
+ `line thick 0 fill_(0.5) from BR to BL then to TL then to TR then to BR')
+ line from BR to BL ; line to TL ; line to TR ; line to BR
+ linethick_(lthickness)
+ }
+dnl shaft
+ linethick_(1.2)
+ psset_(arrows=c-c)
+ line from Origin to project(vtx,vty,vtz)
+ psset_(arrows=-)
+ thinlines_
+dnl top or bottom
+ if dot3D(M4F_T,View3D) > 0 then {
+ ifgpic(`gshade(1,TR,TL,TV,TR,TL)',
+ `line thick 0 fill_(1) from TV to TR then to TL then to TV')
+ line from TV to TR ; line to TL ; line to TV
+ } else {
+ ifgpic(`gshade(0,BR,BL,BV,BR,BL)',
+ `line thick 0 fill_(0) from BV to BR then to BL then to BV')
+ line from BV to BR ; line to BL ; line to BV
+ }
+dnl starboard normal; draw right face
+define(`M4F_S',
+ `cross3D(diff3D(sprod3D(aln,M4F_Vn),rx,ry,rz),M4F_T)')dnl
+ if dot3D(M4F_S,View3D) > 0 then {
+ ifgpic(`gshade(1,TV,BV,BR,TR,TV,BV)',
+ `line thick 0 fill_(1) from TV to BV then to BR then to TR then to TV')
+ line from TV to BV ; line to BR ; line to TR ; line to TV
+ }
+dnl port normal; draw left face
+define(`M4F_P',
+ `cross3D(M4F_T,sum3D(sprod3D(aln,M4F_Vn),rx,ry,rz))')dnl
+ if dot3D(M4F_P,View3D) > 0 then {
+ ifgpic(`gshade(1,TV,BV,BL,TL,TV,BV)',
+ `line thick 0 fill_(1) from TV to BV then to BL then to TL then to TV')
+ line from TV to BV ; line to BL ; line to TL ; line to TV
+ }
+ linethick_(lthickness)
+ `$7'] ') # End Fector
+
+ `shadedball( rad,
+ highlight rad, highlight degrees,
+ initial shade, final shade )
+ The highlight is by default at
+ radius rad*3/5 and angle 110 deg
+ (or arg2 deg); if setlight has been
+ invoked then the highlight is as
+ given by its azimuth and elevation arguments'
+define(`shadedball',`[ C: (0,0); r = ifelse(`$1',,circlerad,`$1')
+ ifdef(`setlight_',
+ `H: (project(sprod3D(r,light3D1,light3D2,light3D3)))
+ hr = distance(C,H)',
+ `hr = ifelse(`$2',,r*3/5,`$2'); ha = ifelse(`$3',,110,`$3')
+ H: (cosd(ha)*hr,sind(ha)*hr)')
+ u0 = ifelse(`$4',,1,`$4'); uf = ifelse(`$5',,0.25,`$5')
+ rm = r+hr; n = int(rm/(linethick bp__))
+ for i=1 to n-1 do { x = i/n*rm; u = u0+(i/n)^2*(uf-u0)
+ if x <= (r-hr) then {
+ circle rad x thick linethick*1.6 outlined rgbstring(u,u,u) at H } \
+ else { arc cw thick linethick*ifpgf(2,1.6) outlined rgbstring(u,u,u) \
+ from Cintersect(H,x,C,r) to Cintersect(H,x,C,r,R) with .c at H } }
+ circle rad r ifpgf(+linethick bp__/2) at C
+ `$6']')
+
+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
new file mode 100644
index 00000000000..52c9922402a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/libcct.m4
@@ -0,0 +1,3254 @@
+divert(-1)
+ libcct.m4
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`libcct_')
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')
+
+`==============================================================================
+HINTS:
+
+THE ARGUMENTS of circuit elements are optional; if omitted, default values
+ are assumed.
+
+TWO-TERMINAL ELEMENTS are constructed as follows, with variations:
+
+ # Draw the initial invisible line (default length rp_len), and set the
+ # direction cosines:
+ eleminit_(`$1')
+
+ # Element body height and width
+ define(`m4v',...)define(`m4h',...)
+
+ # Visible lines:
+ { line to rvec_(rp_len/2-m4h/2,0)
+ (element body lines)
+ line to rvec_(rp_len/2-m4h/2,0) }
+
+ # The invisible body block:
+ {[box invis ht_ m4v wid_ m4h ] at rvec_(rp_len/2,0)}
+
+ # The final invisible line:
+ line to rvec_(rp_len,0) invis
+
+A side effect of the eleminit_ macro is to change the current drawing angle.
+
+NON-TWO-TERMINAL ELEMENTS are usually constructed within a block:
+
+ set dimension parameters
+ [ set size and direction from the initial linespec argument
+ set orientation
+ draw internal elements
+ define internal locations
+ ]
+
+ If there is a linespec argument, it determines orientation
+ but not the placement of the element, since [] blocks are placed
+ as if they were boxes.
+
+==============================================================================
+CUSTOMIZATIONS:
+
+ The non-two-terminal circuit elements enclosed in [] blocks allow
+ a final argument not shown in the argument list. The last argument is
+ expanded just before exit from the [] block to allow custom additions
+ to the elements.
+
+ Subcomponents of a circuit element are drawn selectively according
+ to a "dna_" string and a sequence of calls to sc_draw(`dna_',arg2,arg3,arg4).
+ If the second argument of sc_draw is a substring of the first, it is deleted
+ 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
+
+==============================================================================
+ This file redefines default arrow dimensions and the dotrad_ macro.
+=============================================================================='
+
+ `capacitor( linespec,[char][+],R,height,wid )
+ char:
+ F or none: flat plates
+ C = polarized, curved plate
+ E = polarized rectangular plates
+ K = filled rectangular plates
+ M = rectangular plates
+ N = one rectangular plate
+ P = alternate polarized
+ + = polarity sign to right of drawing dir
+ +L =polarity sign to left
+ arg3 = R: reversed orientation
+ arg4 = height (defaults F: dimen_/3
+ C,P: dimen_/4, E,K: dimen_/5)
+ arg5 = wid (defaults F: height*0.3,
+ C,P: height*0.4, E,K: height) '
+define(`capacitor',
+ `ifelse(`$3',R,`reversed(`capacitor',`$1',`$2',,shift(shift(shift($@))))',
+ `eleminit_(`$1')
+ define(`m4ctype',ifelse(`$2',,F,`$2',+,F,`$2',+L,F,`$2'))dnl
+ m4_dna(`m4ctype',+L)`'m4_dna(`m4ctype',+)dnl
+ { ifelse(m4ctype,F,
+ `define(`m4cht',`ifelse(`$4',,`dimen_/3',`($4)')')dnl
+ define(`m4cwd',`ifelse(`$5',,`m4cht*0.3',`($5)')')dnl
+ line to rvec_(rp_len/2-m4cwd/2,0)
+ {line from rvec_(0,-m4cht/2) \
+ to rvec_(0,m4cht/2)}
+ move to rvec_(m4cwd,0)
+ {line from rvec_(0,-m4cht/2) \
+ to rvec_(0,m4cht/2)}
+ line to rvec_(rp_len/2-m4cwd/2,0) ',
+ m4ctype,C,
+ `define(`m4cht',`ifelse(`$4',,`dimen_/4',`($4)')')dnl
+ define(`m4cwd',`ifelse(`$5',,`m4cht*0.4',`($5)')')dnl
+ define(`m4cr',`dimen_*0.25')dnl
+ line to rvec_(rp_len/2-m4cwd/2,0)
+ {line from rvec_(0,-m4cht/2) \
+ to rvec_(0,m4cht/2)}
+ {arc cw from rvec_(m4cwd,-m4cht/2) \
+ to rvec_(m4cwd,m4cht/2) \
+ with .c at rvec_(m4cwd+sqrt((m4cr)^2-(m4cht/2)^2),0) }
+ line from last arc.c+vec_(-m4cr,0) \
+ to rvec_(rp_len/2+m4cwd/2,0) ',
+ m4ctype,P,
+ `define(`m4cht',`ifelse(`$4',,`dimen_/4',`($4)')')dnl
+ define(`m4cwd',`ifelse(`$5',,`m4cht*0.4',`($5)')')dnl
+ define(`m4cr',`dimen_*0.25')dnl
+ line to rvec_(rp_len/2-m4cwd/2,0)
+ {line from rvec_(m4cwd,-m4cht/2) \
+ to rvec_(0,-m4cht/2) \
+ then to rvec_(0,m4cht/2) \
+ then to rvec_(m4cwd,m4cht/2) }
+ {line from rvec_(m4cwd*2/3,-m4cht*3/8) \
+ to rvec_(m4cwd*2/3,m4cht*3/8)}
+ line from rvec_(m4cwd*2/3,0) \
+ to rvec_(rp_len/2+m4cwd/2,0) ',
+ m4ctype,E,
+ `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl
+ define(`m4cwd',`ifelse(`$5',,`m4cht',`($5)')')dnl
+ define(`m4cs',`(m4cwd/3.2)')dnl
+ line to rvec_(rp_len/2-m4cwd/2,0)
+ m4linethicktemp = linethick; thinlines_
+ { lbox(m4cs,m4cht) }
+ move to rvec_(m4cwd,0)
+ {ifsvg(`lbox(-m4cs,m4cht,fill_(0))',`m4fshade(m4fill,lbox(-m4cs,m4cht))')}
+ linethick_(m4linethicktemp)
+ line to rvec_(rp_len/2-m4cwd/2,0) ',
+ m4ctype,M,
+ `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl
+ define(`m4cwd',`ifelse(`$5',,`m4cht',`($5)')')dnl
+ define(`m4cs',`(m4cwd/3.2)')dnl
+ line to rvec_(rp_len/2-m4cwd/2,0)
+ m4linethicktemp = linethick; thinlines_
+ { lbox(m4cs,m4cht) }
+ move to rvec_(m4cwd,0)
+ { lbox(-m4cs,m4cht) }
+ linethick_(m4linethicktemp)
+ line to rvec_(rp_len/2-m4cwd/2,0) ',
+ m4ctype,K,
+ `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl
+ define(`m4cwd',`ifelse(`$5',,`m4cht',`($5)')')dnl
+ define(`m4cs',`(m4cwd/3.2)')dnl
+ line to rvec_(rp_len/2-m4cwd/2,0)
+ {ifsvg(`lbox(m4cs,m4cht,fill_(0))',`m4fshade(m4fill,lbox(m4cs,m4cht))')}
+ move to rvec_(m4cwd,0)
+ {ifsvg(`lbox(-m4cs,m4cht,fill_(0))',`m4fshade(m4fill,lbox(-m4cs,m4cht))')}
+ line to rvec_(rp_len/2-m4cwd/2,0) ',
+ m4ctype,N,
+ `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl
+ define(`m4cwd',`ifelse(`$5',,`m4cht*2/3',`($5)')')dnl
+ define(`m4cs',`(m4cwd/3.2*3/2)')dnl
+ line to rvec_(rp_len/2-m4cwd/2,0)
+ { lbox(m4cs,m4cht) }
+ move to rvec_(m4cwd,0)
+ {line from rvec_(0,m4cht/2) to rvec_(0,-m4cht/2) }
+ line to rvec_(rp_len/2-m4cwd/2,0) ')
+ }
+ ifinstr(`$2',+L,
+ `{ move to rvec_(rp_len/2-m4cwd/2-m4cht/3,m4cht/3)
+ {line thick 0.5 from rvec_(m4cht/6,0) \
+ to rvec_(-m4cht/6,0)}
+ line thick 0.5 from rvec_(0,m4cht/6) \
+ to rvec_(0,-m4cht/6)}',
+ `$2',+,
+ `{ move to rvec_(rp_len/2-m4cwd/2-m4cht/3,-m4cht/3)
+ {line thick 0.5 from rvec_(m4cht/6,0) \
+ to rvec_(-m4cht/6,0)}
+ line thick 0.5 from rvec_(0,m4cht/6) \
+ to rvec_(0,-m4cht/6)}')
+ {[box invis ht_ m4cht wid_ m4cwd ] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')')
+
+ `resistor( linespec, cycles, chars, cycle wid)
+ chars : E=ebox
+ ES=ebox with slash
+ Q=offset
+ H=squared (default 3 cycles)
+ N=IEEE (default 3 cycles)
+ V=varistor variant
+ R=to right of drawing direction
+ arg4: cycle width, default dimen_/6'
+define(`resistor',
+`define(`m4h',`ifelse(`$4',,`dimen_/6',`($4)')/4')dnl
+ ifinstr(
+ `$2',E,
+ `ebox(`$1',shift(shift($@)))',
+ `$3',ES,
+ `ebox(`$1',shift(shift(shift($@))))
+ {line from last line.c+vec_(m4wd*0.3,m4ht/2) \
+ to last line.c+vec_(-m4wd*0.3,-m4ht/2)}
+ line invis from 2nd last line.start to 2nd last line.end',
+ `$3',E,
+ `ebox(`$1',shift(shift(shift($@))))',
+ `$3',V,
+ `M4_varistor($@)',
+ `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:
+ define(`m4v',2)dnl
+ if m4h*m4n*2 > rp_len then { eleminit_(to rvec_(m4h*m4n*2,0)) }
+ tr_xy_init(last line.c, m4h, sc_draw(`dna_',R,-))dnl
+ { line from last line.start to tr_xy(-m4n,0)\
+ for_(2,m4n,2,
+ `then to tr_xy(eval(2*m4x-3-m4n), m4v) \
+ then to tr_xy(eval(2*m4x-1-m4n),-m4v) \')dnl
+ then to tr_xy(m4n, 0) \
+ then to last line.end
+ [box invis ht_ m4h*m4v*2 wid_ m4h*m4n*2] at 2nd last line.c
+ }')
+ sc_draw(`dna_',Q,
+ `define(`m4n',`ifelse(`$2',,6,`eval(2*($2))')')dnl
+ define(`m4v',2)dnl
+ if m4h*m4n*2 > rp_len then { eleminit_(to rvec_(m4h*m4n*2,0)) }
+ tr_xy_init(last line.c, m4h, sc_draw(`dna_',R,-))dnl
+ { line from last line.start to tr_xy(-m4n,0)\
+ for_(2,m4n,2,
+ `then to tr_xy(eval(2*m4x-2-m4n), m4v*2) \
+ then to tr_xy(eval(2*m4x-m4n),0) \')dnl
+ then to tr_xy(m4n, 0) \
+ then to last line.end
+ [box invis ht_ m4h*m4v*2 wid_ m4h*m4n*2] at 2nd last line.c + ta_xy(0,m4v)
+ }')
+ sc_draw(`dna_',H,
+ `define(`m4n',`ifelse(`$2',,5,`eval(2*($2)-1)')')dnl
+ define(`m4hh',`m4h*6/5')dnl
+ define(`m4v',7/3)dnl
+ if m4hh*m4n*2 > rp_len then { eleminit_(to rvec_(m4hh*m4n*2,0)) }
+ tr_xy_init(last line.c, m4hh, sc_draw(`dna_',R,-))dnl
+ { line from last line.start to tr_xy(-m4n,0)\
+ for_(-m4n,m4n,2,
+ `ifelse(eval(((m4x+m4n)/2)%2),0,
+ `then to tr_xy(m4x,m4v) \
+ then to tr_xy(eval(m4x+2),m4v) \',
+ `then to tr_xy(m4x,0) \
+ ifelse(m4x,m4n,,`then to tr_xy(eval(m4x+2),0)')\')')dnl
+ then to tr_xy(m4n, 0) \
+ then to last line.end
+ [box invis ht_ m4hh*m4v wid_ m4hh*m4n*2] at 2nd last line.c+(0,m4hh*m4v/2)
+ }')
+ line invis from 2nd last line.start to 2nd last line.end ')')
+
+define(`M4_varistor',`eleminit_(`$1')
+ define(`m4wd',`dimen_/2')dnl
+ define(`m4ht',`dimen_/4')dnl
+ {line to rvec_(max(0,rp_len/2-m4wd/2),0)
+ {m4fshade(m4fill,line to rvec_(0,ifinstr(`$3',R,,-)m4ht/2) \
+ then to rvec_(m4wd/2,0) \
+ then to Here)}
+ move to rvec_(m4wd,0)
+ m4fshade(m4fill,line to rvec_(0,ifinstr(`$3',R,-)m4ht/2) \
+ then to rvec_(-m4wd/2,0) \
+ then to Here)
+ line to rvec_(max(0,rp_len/2-m4wd/2),0) }
+ {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')
+
+ `potentiometer(linespec, cycles,
+ fractional pos, length, fractional pos, length,...)
+ Resistor in a block, tapped at fractional positions
+ with specified (possibly negative) arrow lengths.
+ Taps are labelled T1, T2, ...
+ Uses side effects of resistor macro'
+define(`potentiometer',`[R: resistor(`$1',`$2')
+ Start: R.start; End: R.end; C: 0.5 between Start and End
+ m4pot_arrows(1,ifelse(`$3',,0.5,`$3'),ifelse(`$4',,`dimen_*5/12',`$4'),
+ shift(shift(shift(shift($@)))))] ')
+define(`m4pot_arrows',`ifelse(`$2',,,`
+ x = (`$2')*2*m4n+1; x = (int(x)%4)+(x-int(x))
+ M4_Tmp: `$2' between last [].c-vec_(prod_(m4n,m4h),0) \
+ and last [].c+vec_(prod_(m4n,m4h),0)
+ T`$1': M4_Tmp + vec_(0,ifelse(`$3',,`dimen_*5/12',`$3'))
+ { arrow from T`$1' to M4_Tmp+vec_(0,m4h*m4v*(1-(x-2)*sign(x-2))) }
+ m4pot_arrows(incr($1),shift(shift(shift($@))))')')
+
+ `KelvinR(cycles,[R],cycle wid)
+ IEEE resistor with kelvin taps added
+ if arg1 is blank then a [] block is used'
+define(`KelvinR',`[
+ M4R: resistor(,`$1',,`$3') define(`m4kRm',`ifinstr(`$2',R,-,+)')
+ { dot(at tr_xy(-m4n,0),lthick)
+ line to tr_xy(-m4n-1,m4kRm`'2) then to tr_xy(-m4n-1,m4kRm`'4)
+ T1: Here
+ dot(at tr_xy(m4n,0),lthick)
+ line to tr_xy(m4n+1,m4kRm`'2) then to tr_xy(m4n+1,m4kRm`'4)
+ T2: Here }
+ Start: M4R.start; End: M4R.end; C: M4R.c
+ `$4' ]') ')
+
+ `FTcap(chars)
+ Feed-through capacitor; composite element
+ derived from a two-terminal element.
+ Defined points: .Start, .End, .C
+ chars: A|B|C|D element type'
+define(`FTcap',`[ define(`FTctyp',`ifelse(`$1',,A,`$1')')dnl
+ ifelse(FTctyp,A,
+ `capacitor(to vec_(dimen_*2/3,0))
+ Start: last line.start; End: last line.end; C: last line.c
+ Conductor: line from C+vec_(0,dimen_/3) to C+vec_(0,-dimen_/3)
+ T1: last line.start; T2: last line.end',
+ FTctyp,B,
+ `capacitor(to vec_(dimen_*2/3,0),C)
+ Start: last line.start; End: last line.end; C: last line.c
+ r = last arc.rad-hlth
+ T1: (0.5 between 2nd line.end and last arc.c-vec_(r,0)) + vec_(0,dimen_/3)
+ T2: T1+(0,-dimen_*2/3)
+ Conductor: line from T1 to T2',
+ FTctyp,C,
+ `line to vec_(dimen_*2/3,0)
+ Start: last line.start; End: last line.end; C: last line.c
+ rp_a = rp_ang
+ capacitor(from C to C-vec_(0,dimen_/10),C)
+ point_(rp_a)
+ line from last line.end to last line.end-vec_(0,dimen_/3)
+ T: Here',
+ FTctyp,D,
+ `Start: Here
+ capacitor(to rvec_(dimen_/3,0),C)
+ C: Here
+ { line to rvec_(0,-dimen_/3); T: Here }
+ End: rvec_(dimen_/3,0)
+ rp_a = rp_ang
+ capacitor(from End to Here,C)
+ point_(rp_a)')
+ `$2' ]')
+
+ `addtaps([ahead | type=ahead;name=Name],
+ fractional pos, length, fractional pos, length,...)
+ Tap names are Tap1, Tap2, ... or
+ Name1, Name2, ... if specified
+ ahead = blank or one of . - <- -> <-> '
+define(`addtaps',`
+ifelse(`$2',,`undefine(`m4tap_x')popdef(`m4type')popdef(`m4name')',
+ `ifdef(`m4tap_x',`define(`m4tap_x',incr(m4tap_x))',
+ `define(`m4tap_x',1) M4tap_w: last [].w_; M4tap_e: last [].e_
+ setkey_(`$1',type,`$1',N)setkey_(`$1',name,Tap,N)dnl
+ M4tap_xy: (last [].wid_,last [].ht_)')
+ {define(`m4tapl',`ifelse(`$3',,`dimen_/3',`$3')')dnl
+ move to (`$2' between M4tap_w and M4tap_e) + vec_(0,sign(m4tapl)*M4tap_xy.y/2)
+ ifinstr(m4type,.,`{dot(,lthick)}define(`m4type')');dnl
+ line ifelse(m4type,-,,m4type) to rvec_(0,m4tapl)
+ m4name`'m4tap_x: Here }
+ addtaps(,shift(shift(shift($@))))')')
+
+ `tapped(`two-terminal element',[. | <- | -> | <->],
+ fractional pos, length, fractional pos, length,...)
+ Draw the two-terminal element and taps in a [] block'
+define(`tapped',`[ $1
+ Start: last line.start; End: last line.end; C: last line.c
+ addtaps(shift($@)) ]')
+
+ `b_current( label, above_|below_, O[ut],
+ S[tart]|E[nd], frac )
+ Branch current for last-drawn element. The arrowhead
+ is drawn frac (default 2/3) of the way between
+ the line end and element body.'
+define(`b_current',
+ `define(`m4y',`ifelse(`$5',,2/3,`($5)')')dnl
+ define(`m4v',`ifinstr(`$4',E,
+ `ifinstr(`$3',O,-)',`ifinstr(`$3',O,,-)')arrowht')dnl
+ define(`m4h',`(rp_len-last [].wid_)/2')
+ { move to last line.start+vec_(ifinstr(`$4',E,`rp_len-')dnl
+ ifinstr(`$3',O,`(m4h-arrowht)*m4y',`(m4h*m4y+arrowht/3)'),0)
+ arrow <- m4c_l to rvec_(m4v,0) ifelse(`$1',,,
+ `m4lstring(`$1',"sp_`iflatex(`$ `$1'$',`$1')'sp_") \
+ ifelse(`$2',,`above_',`$2')')}')
+
+ `larrow( label, <-, separation )
+ Arrow alongside the left of the last-drawn
+ element'
+define(`larrow',`define(`m4h',`min(lin_leng(last line),linewid)/2')dnl
+ define(`m4v',`ifelse(`$3',,`5pt__',`($3)')')dnl
+ {arrow `$2' from last [].n_+vec_(-m4h,m4v) \
+ to last [].n_+vec_(m4h,m4v) \
+ m4lstring(`$1',"sp_`iflatex(`$ `$1'$',` $1')'sp_") above_}')
+
+ `rarrow( label, <-, separation )
+ Arrow alongside the right of the last-drawn
+ element'
+define(`rarrow',`define(`m4h',`min(lin_leng(last line),linewid)/2')dnl
+ define(`m4v',`ifelse(`$3',,`5pt__',`($3)')')dnl
+ {arrow `$2' from last [].s_+vec_(-m4h,-m4v) \
+ to last [].s_+vec_(m4h,-m4v) \
+ m4lstring(`$1',"sp_`iflatex(`$ `$1'$',` $1')'sp_") below_}')
+
+ `inductor( linespec,W|L,cycles,M|P,loop wid )
+ W=wide arcs (default narrow); L=looped arcs
+ M=metal core; P=powder core
+ loop wid defaults W,L: dimen_/5,
+ other: dimen_/8'
+define(`inductor',`eleminit_(`$1')
+ define(`m4hlw',`ifelse(`$5',,`dimen_/10',`($5)/2')')dnl half loop wid
+ define(`m4n',`ifelse(`$3',,4,`$3')')dnl
+ ifelse(`$2',W,
+ `m4Inductor',
+ `$2',L,
+ `m4Lnductor',
+ `m4inductor(,ifelse(`$5',,,`($5)/2'))')
+ ifelse(ifelse(`$4',M,T,`$4',P,T),T,`m4m_core(rvec_(rp_len/2,0),
+ m4wd,m4ht+dimen_/24,dimen_/16,ifelse(`$4',P,dashed m4wd/(2*m4n+1)))
+ define(`m4hs',`(dimen_/24+dimen_/16)')',`define(`m4hs',0)')
+ {[box invis ht_ m4ht+m4hs+m4dp wid_ m4wd] \
+ at rvec_(rp_len/2,(m4ht+m4hs-m4dp)/2)}
+ line to rvec_(rp_len,0) invis ')
+ `Wide loop inductor'
+define(`m4Inductor',`define(`m4ht',`(1+m4st)*m4hlw')dnl
+ define(`m4dp',`(m4s2t-m4st)*m4hlw')define(`m4wd',((2*m4n-2)*m4c2t+2)*m4hlw)dnl
+ { line to rvec_(rp_len/2-((m4n-1)*m4c2t+m4ct)*m4hlw,0); round
+ arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4st-m4s2t)) \
+ with .c at rvec_(vscal_(m4hlw,m4ct,m4st)); round
+ for m4i=3 to m4n do { arc cw from Here to rvec_(vscal_(m4hlw,2*m4c2t,0)) \
+ with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round }
+ arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4s2t-m4st)) \
+ with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round
+ line to rvec_(rp_len/2-((m4n-1)*m4c2t+m4ct)*m4hlw,0) } ')
+define(`m4ct',`Cos(25)')define(`m4st',`Sin(25)')
+define(`m4c2t',`Cos(50)')define(`m4s2t',`Sin(50)')
+ `Looped inductor'
+define(`m4Lnductor',`define(`m4ht',`m4hlw*10/8')dnl
+ define(`m4dp',`m4hlw/2')define(`m4wd',(m4n+1)*m4hlw)dnl
+ { line to rvec_(rp_len/2-m4wd/2,0); round
+ spline ifdpic(0.55) \
+ to rvec_(0,m4ht) for_(1,m4n,1,`\
+ then to rvec_((m4x+0.3)*m4hlw, m4ht) \
+ then to rvec_((m4x+0.3)*m4hlw,-m4dp) \
+ then to rvec_((m4x-0.3)*m4hlw,-m4dp) \
+ then to rvec_((m4x-0.3)*m4hlw, m4ht)\')\
+ then to rvec_(m4wd,m4ht) \
+ then to rvec_(m4wd,0)
+ round; line to rvec_(rp_len/2-m4wd/2,0) }')
+ `Narrow inductor'
+define(`m4inductor',`define(`m4ht',`ifelse(`$2',,`dimen_/16',`$2')')dnl
+ define(`m4dp',0)define(`m4wd',m4n*m4ht*2)dnl
+ ifelse(ifpstricks(T)`'ifmpost(T)`'ifpgf(T)`'ifsvg(T),T,
+ `define(`m4y')',`undefine(`m4y')')dnl
+ { line to rvec_((rp_len-m4wd)/2,0)
+ ifdef(`m4y',`{line to rvec_(0,-hlth)};')
+ for m4i=1 to m4n do {
+ arc cw from Here to rvec_(m4ht*2,0) with .c at rvec_(m4ht,0)
+ ifdef(`m4y',`{line to rvec_(0,-hlth)}') }
+ line to rvec_((rp_len-m4wd)/2,0)} ')
+
+ `m4m_core(bottom ctr, length, ht offset,
+ separation,linetype)
+ Two lines for the metal core'
+define(`m4m_core',`dnl
+ {M4Core1: line from `$1'+vec_(-(`$2')/2,`$3') \
+ to `$1'+vec_( (`$2')/2,`$3') `$5'
+ M4Core2: line from M4Core1.start+vec_(0,`$4') \
+ to M4Core1.end+vec_(0,`$4') `$5'}')
+
+ `transformer( linespec, L|R, np,
+ [A|P][W|L][D1|D2|D12|D21], ns )
+ 2-winding transformer or choke:
+ np = number of primary arcs
+ ns = number of secondary arcs
+ A = air core; P = powder (dashed) core
+ W = wide windings; L = looped windings
+ D1: phase dots at P1 and S1 ends; D2: dots
+ at P2 and S2 ends; D12: dots at P1 and S2
+ 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(`m4np',`ifelse(`$3',,4,(`$3'))')dnl
+ define(`m4ns',`ifelse(`$5',,4,(`$5'))')dnl
+ ifelse(`$1',,`mvw = max(\
+ ifelse(m4WL,W,`dimen_/5*((m4np-1)*m4c2t+m4ct)',`m4np*dimen_/8'),dimen_*2/3)
+ move to P1+vec_(mvw,0)',
+ move `$1' )
+ P2: Here
+ TP: 0.5 between P1 and P2
+ L1: inductor(from ifelse(`$2',R,`P2 to P1',`P1 to P2'),m4WL,`$3')
+ define(`m4WP',m4wd)dnl
+ define(`m4t',`ifelse(m4WL,W,((2*m4ns-2)*m4c2t+2)*m4hlw,m4WL,L,(m4ns+1)*m4hlw,
+ m4ns*m4ht*2)')dnl
+ ifinstr(`$4',A,
+ `move to last line.c+vec_(0,m4ht*ifelse(m4WL,W,3,m4WL,L,3,4))',
+ `m4m_core(rvec_(-(rp_len/2),0),max(m4wd,m4t),m4ht+dimen_/12,dimen_/8,
+ ifinstr(`$4',P,dashed m4wd/(2*m4n+1)))
+ move to last line.c+vec_(0,m4ht+dimen_/12)')
+ TS: Here
+ S2: rvec_( ifelse(`$2',R,-)(ifelse(`$5',,rp_len/2,m4t/2)), 0 )
+ S1: 2 between S2 and Here
+ L2: inductor(from ifelse(`$2',R,`S1 to S2',`S2 to S1'),m4WL,`$5')
+ rpoint_(from P1 to P2) define(`m4WS',m4wd)
+ ifinstr(`$4',D1,
+ `m4trdot(P1,P2,-,m4WP,ifelse(`$2',R,-),D1:)
+ ifinstr(`$4',D12,`m4trdot(S1,S2, ,m4WS,ifelse(`$2',R,,-),D2:)',
+ `m4trdot(S1,S2,-,m4WS,ifelse(`$2',R,,-),D2:)')',
+ `$4',D2,
+ `m4trdot(P1,P2,,m4WP,ifelse(`$2',R,-),D1:)
+ ifinstr(`$4',D21,`m4trdot(S1,S2,-,m4WS,ifelse(`$2',R,,-),D2:)',
+ `m4trdot(S1,S2, ,m4WS,ifelse(`$2',R,,-),D2:)')')
+ m4xpand(m4drt`'_)
+ `$6' ]')
+define(`m4trdot',`{`$6'dot(at (0.5 between `$1' and `$2') \
+ +vec_(`$3'(`$4'+m4hlw)/2,`$5'dimen_/16), dotrad_/2)}')
+
+ `delay( linespec, width )'
+define(`delay',`eleminit_(`$1')
+ define(`m4ht',`ifelse(`$2',,`delay_rad_*2',`($2)')')dnl
+ define(`m4wd',`m4ht*5/6')dnl
+ { line to rvec_(rp_len/2-m4wd/2,0)
+ { line from rvec_(m4ht/3,-m4ht/2) \
+ to rvec_(0,-m4ht/2)\
+ then to rvec_(0,m4ht/2) \
+ then to rvec_(m4ht/3,m4ht/2)
+ arc cw from Here to rvec_(0,-m4ht) with .c at rvec_(0,-m4ht/2) }
+ move to rvec_(m4wd,0)
+ line to rvec_(rp_len/2-m4wd/2,0) }
+ { [box invis ht_ m4ht wid_ m4wd ] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')
+
+ `crystal xtal( linespec )'
+define(`xtal',`eleminit_(`$1')
+ define(`m4ht',`dimen_/4')define(`m4wd',`m4ht*2/3')define(`m4cs',`m4ht/3')dnl
+ { line to rvec_(rp_len/2-m4wd/2,0)
+ {line from rvec_(0,-m4ht/3) \
+ to rvec_(0,m4ht/3)}
+ { move to rvec_(m4wd/2-m4cs/2,0)
+ line to rvec_(0,m4ht/2) \
+ then to rvec_(m4cs,m4ht/2) \
+ then to rvec_(m4cs,-m4ht/2) \
+ then to rvec_(0,-m4ht/2) \
+ then to Here }
+ move to rvec_(m4wd,0)
+ {line from rvec_(0,-m4ht/3) \
+ to rvec_(0,m4ht/3)}
+ line to rvec_(rp_len/2-m4wd/2,0) }
+ {[box invis ht_ m4ht wid_ m4wd ] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')
+
+ `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)
+ V = voltage source; v=alternate voltage source;
+ I = current source; i = alternate current source;
+ AC = AC source, B = bulb, F = fluorescent, G = generator,
+ Q = charge, L = lamp, N = neon, P = pulse, R = ramp,
+ SC = quarter arc, SE = arc; r = right orientation,
+ S = sinusoid,
+ T = triangle, X = interior X, U = square-wave,
+ other = custom interior label or waveform,
+ R = reversed polarity
+ arg 5 modifies the circle with e.g., color or fill'
+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($@)',
+ `{ line to rvec_(rp_len/2-m4h,0)
+ move to rvec_(m4h,0)
+ { Src_C: circle rad m4h `$5' at Here }
+ ifelse(`$2',,,
+ `$2',F,`{ line from rvec_(-m4h,0) \
+ to rvec_(-m4h/2,0)}
+ { line from rvec_(-m4h/2,-m4h/2) \
+ to rvec_(-m4h/2,m4h/2)}
+ { line from rvec_(m4h/2,-m4h/2) \
+ to rvec_(m4h/2,m4h/2)}
+ { line from rvec_(m4h,0) \
+ to rvec_(m4h/2,0)}',
+ `$2',I,`{arrow from rvec_(-m4h*3/4,0) \
+ to rvec_(m4h*3/4,0)}',
+ `$2',i,`{line from rvec_(0,-m4h) \
+ to rvec_(0,m4h)}',
+ `$2',B,`{line from rvec_(-m4h,0) \
+ to rvec_(-m4h*2/3,0)
+ round
+ arc ccw to rvec_(m4h*12/12,0) with .c at rvec_(m4h*12/24,0)
+ arc ccw to rvec_(-m4h*2/3,0) with .c at rvec_(-m4h*1/3,0)
+ arc ccw to rvec_(m4h*12/12,0) with .c at rvec_(m4h*12/24,0)
+ round
+ line to rvec_(m4h/3,0)}',
+ `$2',H,`{ line from Here+(-m4h/2,-m4h/3) \
+ to Here+(0,-m4h/3) \
+ then to Here+(0,m4h/3) \
+ then to Here+(m4h/2,m4h/3) }',
+ `$2',L,`{line from rvec_(-m4h,0) \
+ to rvec_(-m4h/4,0)
+ round
+ spline to rvec_(m4h/12,m4h*2/3) \
+ then to rvec_(m4h*5/12,m4h*2/3) \
+ then to rvec_(m4h/2,0)
+ round
+ line to rvec_(m4h*3/4,0)}',
+ `$2',N,`{ {line from rvec_(-m4h,0) \
+ to rvec_(-m4h/2,0)}
+ for_(70,250,180,
+ `{ line from rvec_(Rect_(m4h/2,-m4x)) \
+ to rvec_(Rect_(m4h/2,m4x))
+ round }
+ { arc cw from rvec_(Rect_(m4h/2,m4x)) \
+ to rvec_(Rect_(m4h/2,-m4x)) \
+ with .c at Here
+ round }')
+ {line from rvec_(m4h/2,0) \
+ to rvec_(m4h,0)}}',
+ `$2',V,`{"ifsvg(-,`$_-$')" at rvec_(-m4h/2,0) ifsvg(+(0,textht/10))}
+ {"ifsvg(svg_small(+),`$_+$')" \
+ at rvec_( m4h/2,0) ifsvg(+(0,textht/10))}',
+ `$2',v,`{line from rvec_(-m4h,0) \
+ to rvec_(m4h,0)}',
+ `$2',AC,`{
+ arc rad m4h/3 cw from Here-(m4h*2/3,0) \
+ to Here with .c at Here-(m4h/3,0)
+ arc rad m4h/3 ccw from Here to Here+(m4h*2/3,0) with .c at Here+(m4h/3,0)}',
+ `$2',P,`{ line from Here+(-m4h/2,-m4h/4) \
+ to Here+(-m4h/4,-m4h/4) \
+ then to Here+(-m4h/4,m4h/4) \
+ then to Here+(m4h/4,m4h/4) \
+ then to Here+(m4h/4,-m4h/4) \
+ then to Here+(m4h/2,-m4h/4) }',
+ `$2',U,`{ line from Here+(-m4h/2,0) \
+ to Here+(-m4h/2,m4h/3) \
+ then to Here+(0,m4h/3) \
+ then to Here+(0,-m4h/3) \
+ then to Here+(m4h/2,-m4h/3) \
+ then to Here+(m4h/2,0) }',
+ `$2',R,`{ line from Here+(-m4h*2/3,-m4h/3) \
+ to Here+(m4h/3,m4h/2) \
+ then to Here+(m4h/3,-m4h/3) }',
+ `$2',SCr,`{ arc cw from rvec_(-m4h,0) \
+ to rvec_(0,-m4h) \
+ with .c at rvec_(-m4h,-m4h) }',
+ `$2',SC,`{ arc from rvec_(-m4h,0) \
+ to rvec_(0,m4h) \
+ with .c at rvec_(-m4h,m4h) }',
+ `$2',SEr,`{ arc cw from Cintersect(Here,m4h,rvec_(0,-2*m4h),1.8*m4h,R) \
+ to Cintersect(Here,m4h,rvec_(0,-2*m4h),1.8*m4h) \
+ with .c at rvec_(0,-2*m4h) }',
+ `$2',SE,`{ arc from Cintersect(Here,m4h,rvec_(0,2*m4h),1.8*m4h) \
+ to Cintersect(Here,m4h,rvec_(0,2*m4h),1.8*m4h,R) \
+ with .c at rvec_(0,2*m4h) }',
+ `$2',S,`{ ifgpic(
+ `arc rad m4h/3 cw from Here-(m4h*2/3,0) \
+ to Here with .c at Here-(m4h/3,0)
+ arc rad m4h/3 ccw from Here to Here+(m4h*2/3,0) with .c at Here+(m4h/3,0)',
+ `savem4dir(`m4srcstack') right_
+ sinusoid(m4h/2,twopi_/(m4h),pi_/2,-m4h/2,m4h/2) with .Origin at Here
+ restorem4dir(`m4srcstack') ') }',
+ `$2',T,`{ line from Here+(-m4h*3/4,-m4h/4) \
+ to Here+(-m4h/4,m4h/4) \
+ then to Here+(m4h/4,-m4h/4) \
+ then to Here+(m4h*3/4,m4h/4) }',
+ `$2',X,`define(`m4v',`m4h/sqrt(2)')dnl
+ {line from rvec_(-m4v,m4v) \
+ to rvec_(m4v,-m4v)}
+ {line from rvec_(-m4v,-m4v) \
+ to rvec_(m4v,m4v)}',
+ `{$2}' )
+ line from rvec_(m4h,0) \
+ to rvec_(rp_len/2,0)} ')
+ { [box invis ht_ m4h*2 wid_ m4h*2] at rvec_(rp_len/2,0) }
+ line to rvec_(rp_len,0) invis ')')
+ `Internal to source macro:'
+define(`m4_sourceGQ',
+`{ line to rvec_(rp_len/2-3/2*m4h,0)
+ {[C1: circle rad m4h
+ L: C1+vec_(m4h/2, m4h*sqrt(3)/2)
+ R: C1+vec_(m4h/2,-m4h*sqrt(3)/2)
+ C2: ifelse(`$2',G,`circle rad m4h',`arc rad m4h from R to L') \
+ with .c at C1 +vec_(m4h,0)] at rvec_(m4h*3/2,0)}
+ line from rvec_(m4h*3,0) \
+ to rvec_(rp_len/2+3/2*m4h,0) } ')
+
+ `ttmotor( linespec, string, diameter, brushwid, brushht )'
+define(`ttmotor',`eleminit_(`$1')
+ define(`m4r',ifelse(`$3',,`sourcerad_',`($3)/2'))dnl
+ define(`m4w',ifelse(`$4',,`sourcerad_/4',`($4)'))dnl
+ define(`m4h',ifelse(`$5',,`sourcerad_/2',`($5)'))dnl
+ define(`m4cr',`(m4r-sqrt(max(m4r*m4r-m4h*m4h/4,0)))')dnl
+ { line to rvec_(max(rp_len/2-m4r-m4w,0),0)
+ { line from rvec_(m4w+m4cr,m4h/2) \
+ to rvec_(0,m4h/2) \
+ then to rvec_(0,-m4h/2) \
+ then to rvec_(m4w+m4cr,-m4h/2) }
+ { TTM_C: circle rad m4r \
+ at rvec_(m4w+m4r,0) ifelse(`$2',,,`m4lstring($2,"$2")') }
+ move to rvec_((m4w+m4r)*2,0)
+ { line from rvec_(-m4w-m4cr,m4h/2) \
+ to rvec_(0,m4h/2) \
+ then to rvec_(0,-m4h/2) \
+ then to rvec_(-m4w-m4cr,-m4h/2) }
+ line to rvec_(max(rp_len/2-m4r-m4w,0), 0) }
+ { [box invis ht_ m4r*2 wid_ (m4r+m4w)*2] at last circle.c }
+ line to rvec_(rp_len,0) invis ')
+
+ `Controlled source
+ consource( linespec ,V|I|v|i, R )
+ arg 4 can be used to modify the body with e.g.
+ color or fill'
+define(`consource',`ifelse(`$3',R,
+ `reversed(`consource',`$1',`$2',,shift(shift(shift($@))))',
+ `eleminit_(`$1')
+ {line to rvec_(rp_len/2-csdim_,0)
+ {line to rvec_(csdim_,csdim_) \
+ then to rvec_(2*csdim_,0)\
+ then to rvec_(csdim_,-csdim_) \
+ then to Here `$4' }
+ ifelse(`$2',I,
+ `{arrow from rvec_(csdim_/4,0) \
+ to rvec_(csdim_*7/4,0)}',
+ `$2',i,
+ `{line from rvec_(csdim_,csdim_) \
+ to rvec_(csdim_,-csdim_)}',
+ `$2',V,
+ `{"ifsvg(-,`$-$')" at rvec_(csdim_*0.5,0) ifsvg(+(0,textht/10))}
+ {"ifsvg(+,`$+$')" at rvec_(csdim_*1.5,0) ifsvg(+(0,textht/10))}',
+ `$2',v,
+ `{line to rvec_(2*csdim_,0)} ')
+ line from rvec_(2*csdim_,0) \
+ to rvec_(rp_len/2+csdim_,0) }
+ {[box invis ht_ 2*csdim_ wid_ 2*csdim_] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')')
+
+ `battery( linespec, n, R )
+ Arg 3: reversed polarity'
+define(`battery',`ifelse(`$3',R,
+ `reversed(`battery',`$1',`$2',,shift(shift(shift($@))))',
+ `eleminit_(`$1')
+ define(`m4n',`ifelse(`$2',,1,(`$2'))')define(`m4cs',`dimen_/12')dnl
+ define(`m4wd',`m4cs*(m4n*2-1)')define(`m4ht',`dimen_/2')dnl
+ { line to rvec_(rp_len/2-m4wd/2,0)
+ for m4i = 0 to 2*(m4n-1) by 2 do {
+ { line from rvec_(m4i*m4cs,m4ht/4) \
+ to rvec_(m4i*m4cs,-m4ht/4) }
+ { line from rvec_((m4i+1)*m4cs,m4ht/2) \
+ to rvec_((m4i+1)*m4cs,-m4ht/2) } }
+ line from rvec_(m4wd,0) \
+ to rvec_(rp_len/2+m4wd/2,0) }
+ {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')')
+
+ `ebox(linespec, length, ht, greyvalue)
+ Box element; length and ht are relative to
+ the direction of linespec'
+define(`ebox',`eleminit_(`$1')
+ define(`m4wd',ifelse(`$2',,`dimen_/2',`($2)'))dnl
+ define(`m4ht',ifelse(`$3',,`dimen_/5',`($3)'))dnl
+ {line to rvec_(max(0,rp_len/2-m4wd/2),0)
+ ifelse(`$4',,`lbox(m4wd,m4ht)',`m4fshade(`$4',lbox(m4wd,m4ht))')
+ line to rvec_(max(0,rp_len/2-m4wd/2),0)}
+ {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')
+
+ `fuse( linespec, chars, wid, ht )
+ chars A|B|C|D|S|HB|HC or dA (=D)'
+define(`fuse',`eleminit_(`$1')
+ define(`m4fusetype',`ifelse(`$2',,A,`$2',D,dA,`$2')')dnl
+ define(`m4ht',ifelse(`$4',,`dimen_/5'ifinstr(`$2',H,*5/3),`($4)'))dnl
+ define(`m4d',ifinstr(`$2',H,`m4ht/5',0))dnl
+ define(`m4wd',ifelse(`$3',,`m4ht*2',`($3)'))dnl
+ {line to rvec_(max(0,rp_len/2-m4wd/2),0)
+ sc_draw(`m4fusetype',HB,
+ `{move to rvec_(m4d,0); lbox(m4wd-2*m4d,m4ht-2*m4d)}
+ {lbox(m4wd,m4ht)}
+ line to rvec_(m4wd+max(0,rp_len/2-m4wd/2),0)}')
+ sc_draw(`m4fusetype',HC,
+ `{move to rvec_(m4d,0); {lbox(m4wd-2*m4d,m4ht-2*m4d)}
+ {line from rvec_((m4wd-2*m4d)/5,m4ht/2-m4d) \
+ to rvec_((m4wd-2*m4d)/5,-m4ht/2+m4d)}
+ line from rvec_((m4wd-2*m4d)*4/5,m4ht/2-m4d) \
+ to rvec_((m4wd-2*m4d)*4/5,-m4ht/2+m4d) }
+ {lbox(m4wd,m4ht)}
+ move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)}')
+ sc_draw(`m4fusetype',A,
+ `arc cw to rvec_(m4ht,0) rad m4ht/2 with .c at rvec_(m4ht/2,0)dnl
+ ifelse(m4a,d,`; {dot(at last arc.start,,1)}')
+ arc ccw to rvec_(m4ht,0) rad m4ht/2 with .c at rvec_(m4ht/2,0)
+ line to rvec_(max(0,rp_len/2-m4wd/2),0)dnl
+ ifelse(m4a,d,`; dot(at last line.start,,1)') }')
+ sc_draw(`m4fusetype',B,
+ `{lbox(m4wd,m4ht)}
+ line to rvec_(m4wd+max(0,rp_len/2-m4wd/2),0)}')
+ sc_draw(`m4fusetype',C,
+ `{lbox(m4wd,m4ht)}
+ {line from rvec_(m4wd/5,-m4ht/2) \
+ to rvec_(m4wd/5,m4ht/2)}
+ {line from rvec_(m4wd*4/5,-m4ht/2) \
+ to rvec_(m4wd*4/5,m4ht/2)}
+ move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)}')
+ sc_draw(`m4fusetype',S,
+ `{lbox(m4wd,m4ht)}
+ {m4fshade(m4fill,lbox(m4wd/5,m4ht))}
+ move to rvec_(m4wd,0); line to rvec_(max(0,rp_len/2-m4wd/2),0)}')
+ {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')
+
+ `memristor( linespec, wid, ht )'
+define(`memristor',`eleminit_(`$1')
+ define(`m4ht',ifelse(`$3',,`dimen_/5',`($3)'))define(`m4htx',`m4ht/4')dnl
+ define(`m4wd',ifelse(`$2',,`dimen_/2',`($2)'))define(`m4wdx',`m4wd*4/25')dnl
+ { line to rvec_(max(0,rp_len/2-m4wd/2),0)
+ {[lbox(m4wd,m4ht)] at rvec_(m4wd/2,0)}
+ line to rvec_(m4wdx,0) \
+ then to rvec_(m4wdx,m4htx) \
+ then to rvec_(m4wdx*2,m4htx) \
+ then to rvec_(m4wdx*2,-m4htx) \
+ then to rvec_(m4wdx*3,-m4htx) \
+ then to rvec_(m4wdx*3,m4htx) \
+ then to rvec_(m4wdx*4,m4htx) \
+ then to rvec_(m4wdx*4,0) \
+ then to rvec_(m4wdx*5,0)
+ m4fshade(m4fill,lbox(m4wd/4,m4ht))
+ line to rvec_(max(0,rp_len/2-m4wd/2),0) }
+ line invis to rvec_(rp_len,0)')
+
+ `heater( linespec, nparts, wid, ht )'
+define(`heater',`eleminit_(`$1')
+ define(`m4hn',ifelse(`$2',,4,`$2'))dnl
+ define(`m4wd',ifelse(`$3',,`dimen_/2',`($3)'))dnl
+ define(`m4ht',ifelse(`$4',,`dimen_/5',`($4)'))dnl
+ { line to rvec_(max(0,rp_len/2-m4wd/2),0)
+ {[lbox(m4wd,m4ht)] at rvec_(m4wd/2,0)}
+ for m4ix=1 to m4hn-1 do {
+ {line from rvec_(m4ix*m4wd/(m4hn),m4ht/2) \
+ to rvec_(m4ix*m4wd/(m4hn),-m4ht/2)}}
+ line from rvec_(m4wd,0) \
+ to rvec_(max(0,rp_len/2+m4wd/2),0) }
+ line invis to rvec_(rp_len,0)')
+
+ `thermocouple(linespec, wid, ht, L|R)
+ R=right orientation'
+define(`thermocouple',`eleminit_(`$1')
+ define(`m4wd',ifelse(`$2',,`dimen_/5',`($2)'))dnl
+ define(`m4ht',ifelse(`$3',,`dimen_/2',`($3)'))dnl
+ define(`m4ths',`ifinstr(`$4',R,-)')dnl
+ {line to rvec_(max(0,rp_len/2-m4wd/2),0) \
+ then to rvec_(max(0,rp_len/2-m4wd/2),m4ths`'(m4ht-m4wd/2)) \
+ then to rvec_(rp_len/2,m4ths`'m4ht) \
+ then to rvec_(max(0,rp_len/2-m4wd/2)+m4wd,m4ths`'(m4ht-m4wd/2)) \
+ then to rvec_(max(0,rp_len/2-m4wd/2)+m4wd,0) \
+ then to rvec_(rp_len,0)}
+ { dot(at rvec_(rp_len/2,m4ths`'m4ht)) }
+ {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,m4ths`'m4ht/2)}
+ line to rvec_(rp_len,0) invis ')
+
+ `lamp(linespec,[R])'
+define(`lamp',`define(`m4ng',ifinstr(`$2',R,-))define(`m4hw',`dimen_/10')dnl
+define(`m4dp',(m4ng`'m4hw/2))define(`m4ht',(m4ng`'dimen_/8))dnl
+eleminit_(`$1')
+ { line to rvec_(rp_len/2-m4hw,0) \
+ then to rvec_(rp_len/2-m4hw,m4ng`'dimen_/3.2)
+ spline ifdpic(ctension_) to rvec_(0,m4ht) \
+ then to rvec_(1.3*m4hw, m4ht) \
+ then to rvec_(1.3*m4hw,-m4dp) \
+ then to rvec_(0.7*m4hw,-m4dp) \
+ then to rvec_(0.7*m4hw, m4ht) \
+ then to rvec_(2*m4hw,m4ht) \
+ then to rvec_(2*m4hw,0)
+ line to rvec_(0,-(m4ng`'dimen_/3.2)) \
+ then to rvec_(rp_len/2-m4hw,-(m4ng`'dimen_/3.2)) }
+ { [ 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|T|TS )
+ circuit breaker to left or right of linespec,
+ D=with dots; T=thermal; TS=squared thermal'
+define(`cbreaker',`ifinstr(`$3',T,
+ `tbreaker($@)',
+ `mbreaker($@)')')
+
+define(`tbreaker',`eleminit_(`$1') define(`m4ho',0)
+ {ifinstr(`$3',TS,
+ `define(`m4h',`dimen_/5')define(`m4v',`m4h/2')define(`m4ho',`m4v/2')dnl
+ m4j = max(0,rp_len/2-m4h/2)
+ line to rvec_(m4j,0) \
+ then to rvec_(m4j,ifelse(`$2',R,-)m4h/2) \
+ then to rvec_(m4j+m4h,ifelse(`$2',R,-)m4h/2) \
+ then to rvec_(m4j+m4h,0) \
+ then to rvec_(m4j*2+m4h,0) ',
+ `define(`m4h',`dimen_*2/5')define(`m4v',`m4h/2')define(`m4ho',0)dnl
+ m4j = max(0,rp_len/2-m4h/2)
+ line to rvec_(m4j,0)
+ {round
+ arc cw to rvec_( m4h/4,0)+vec_(Rect_(m4h/4,-60)) with .c at rvec_( m4h/4,0)}
+ move to rvec_(m4h,0)
+ {round
+ arc cw to rvec_(-m4h/4,0)+vec_(Rect_(m4h/4,120)) with .c at rvec_(-m4h/4,0)}
+ line to rvec_(m4j,0)
+ ') }
+ {[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,-)')
+ define(`m4h',`dimen_/3') define(`m4cr',`((m4h+2*dimen_/32)*5/8)')dnl
+ define(`m4ht',`(m4cr-sqrt(m4cr^2-(m4h/2+dimen_/32)^2)+dimen_/16)')dnl
+ {line to rvec_(max(0,rp_len/2-m4h/2),0)
+ {ifelse(`$3',D,`dot(,,1)
+ move to rvec_(0,m4R`'dotrad_);')dnl
+ arc ifelse(`$2',R,c)cw from rvec_(-dimen_/32,m4R`'dimen_/16) \
+ to rvec_(m4h+dimen_/32,m4R`'dimen_/16) rad m4cr \
+ with .c at rvec_(m4h/2,m4R`'(m4ht-m4cr))}
+ {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)) }
+ line to rvec_(rp_len,0) invis ')
+
+ `gap( linespec,fill,A )
+ Gap with filled dots e.g.
+ gap(down_ linewid/2,1); rlabel(+,v_1,-)
+ A: chopped arrow between dots'
+define(`gap',`eleminit_(`$1')
+ dot(,,ifelse(`$2',,0,`$2')); dot(at last line.end,,ifelse(`$2',,0,`$2'))
+ ifelse(`$3',A,
+ `{arrow from last line.start to last line.end chop dotrad_*3}')
+ {[box invis ht_ 0 wid_ min(rp_len,(dimen_*4/9+rp_len)/3)] at last line.c}
+ ')
+
+ `arrowline( linespec )
+ line with midpoint arrowhead
+ e.g. arrowline(up 1 dotted); llabel(,I_2)'
+define(`arrowline',`line ifelse(`$1',,`to rvec_(elen_,0)',`$1')
+ { arrow from last line.start to last line.end \
+ chop lin_leng(last line)/2-arrowht/2
+ [box invis ht_ arrowwid wid_ arrowht] at last line.c }')
+
+ `ground( at position, T, N|F|S|L|P|E, D|U|L|R|degrees)
+ T=truncated stem; N=normal ground,
+ F=frame, S=signal, L=low-noise, P=protective,
+ E=European;
+ down (default), up, left, right, angle (deg)'
+define(`ground',`box invis ht 0 wid 0 with .c ifelse(`$1',,`at Here',`$1')
+ define(`m4v',`dimen_/6')define(`m4h',`dimen_/16')dnl
+ {setdir_(ifelse(`$4',,-90,`$4'))
+ ifelse(`$2',,`line from last box.c to rvec_(dimen_/4,0)')
+ ifelse(`$3',F,
+ `{line from rvec_(dimen_/8,m4v-dimen_/12) \
+ to rvec_(0,m4v) \
+ then to rvec_(0,-m4v) \
+ then to rvec_(dimen_/8,-m4v-dimen_/12)}
+ line to rvec_(dimen_/8,-dimen_/12)',
+ `$3',S,
+ `{line to rvec_(0,m4v) \
+ then to rvec_(m4v*1.5,0) \
+ then to rvec_(0,-m4v) \
+ then to Here }',
+ `$3',Q,
+ `{shade(0,line to rvec_(0,m4v) \
+ then to rvec_(m4v*1.5,0) \
+ then to rvec_(0,-m4v) \
+ then to Here) }',
+ `$3',L,
+ `{move to rvec_(m4h,0)
+ arc cw rad m4v*3/2 from rvec_(Rect_(m4v*3/2,-60)) \
+ to rvec_(Rect_(m4v*3/2,60)) with .c at Here}
+ ground(,T,,`$4')',
+ `$3',P,
+ `{Grnd_C: circle rad m4v*3/2 at rvec_(m4h,0)}
+ ground(,T,,`$4')',
+ `$3',E,
+ `{line from rvec_(0,m4v*2/3) \
+ to rvec_(0,-m4v*2/3) thick linethick*2}',
+ `{line from rvec_(0,m4v) \
+ to rvec_(0,-m4v)}
+ {line from rvec_(m4h,dimen_/9) \
+ to rvec_(m4h,-dimen_/9)}
+ line from rvec_(2*m4h,dimen_/14) \
+ to rvec_(2*m4h,-dimen_/14)')
+ resetdir_} ')
+
+ `antenna(at position, T, A|L|T|S|D|P|F, U|D|L|R|degrees)
+ arg2=T: truncate stem
+ arg3= A=aerial; L=loop, T=triangle, S=diamond,
+ D=dipole, P=phased, F=fork;
+ up (default), down, left, right, angle (deg)'
+define(`antenna',`[ T: Here
+ define(`m4v',`dimen_/2')define(`m4h',`dimen_/12')dnl
+ define(`m4atype',ifelse(`$3',,A,`$3'))dnl
+ setdir_(ifelse(`$4',,90,`$4'))
+ ifelse(
+ m4atype,L,
+ `T1: rvec_(0,m4h); T2: rvec_(0,-m4h)
+ ifelse(`$2',,`move to rvec_(m4h*2,0)')
+ line from T1 to rvec_(0,m4h) \
+ then to rvec_(0,m4v/2) \
+ then to rvec_(m4v-m4h,m4v/2) \
+ then to rvec_(m4v-m4h,-m4v/2+m4h) \
+ then to rvec_(m4h,-m4v/2+m4h) \
+ then to rvec_(m4h,m4v/2-m4h) \
+ then to rvec_(m4v,m4v/2-m4h) \
+ then to rvec_(m4v,-m4v/2) \
+ then to rvec_(0,-m4v/2) \
+ then to rvec_(0,-m4h) \
+ then to T2',
+ m4atype,T,
+ `ifelse(`$2',,`move to rvec_(m4h*2,0)')
+ line to rvec_(m4v*3/4,m4v*sqrt(3)/4) \
+ then to rvec_(m4v*3/4,-m4v*sqrt(3)/4) \
+ then to Here
+ line from rvec_(m4v*3/4,0) \
+ to T',
+ m4atype,S,
+ `T1: rvec_(0,m4h); T2: rvec_(0,-m4h)
+ ifelse(`$2',,`move to rvec_(m4h*2,0)')
+ line from T1 to rvec_(0,m4h) \
+ then to rvec_(m4v*3/4-m4h,m4v*3/4) \
+ then to rvec_(2*m4v*3/4-m4h,0) \
+ then to rvec_(m4v*3/4-m4h,-m4v*3/4) \
+ then to rvec_(0,-m4h) \
+ then to T2',
+ m4atype,D,
+ `T1: rvec_(0,m4h); T2: rvec_(0,-m4h)
+ ifelse(`$2',,`move to rvec_(m4v,0)')
+ { line from T1 to rvec_(0,m4h) \
+ then to rvec_(0,m4h*3) }
+ { line from T2 to rvec_(0,-m4h) \
+ then to rvec_(0,-m4h*3) }',
+ m4atype,P,
+ `ifelse(`$2',,`move to rvec_(m4v*2/3,0)')
+ line from T to Here
+ { line from rvec_(0,-m4v/3) \
+ to rvec_(0,m4v/3) }
+ { line from rvec_(m4h,-m4v*2/3) \
+ to rvec_(m4h,m4v*2/3) }',
+ m4atype,F,
+ `ifelse(`$2',,`move to rvec_(m4h*2,0)')
+ { line from rvec_(m4v*3/4,m4v*sqrt(3)/4) \
+ to rvec_(0,m4v*sqrt(3)/4) \
+ then to rvec_(0,-m4v*sqrt(3)/4) \
+ then to rvec_(m4v*3/4,-m4v*sqrt(3)/4)}
+ line from rvec_(m4v*3/4,0) \
+ to T',
+ m4atype,A,
+ `ifelse(`$2',,`move to rvec_(m4h*2,0)')
+ { line from rvec_(m4v*3/4, m4v*sqrt(3)/4) to Here \
+ then to rvec_(m4v*3/4,-m4v*sqrt(3)/4) }
+ line from rvec_(m4v*3/4,0) \
+ to T')
+ `$5'; resetdir_ ] with .T ifelse(`$1',,`at Here',`$1')')
+
+ `switch( linespec,L|R,[O|C][D],L|B|D )
+ Wrapper for bswitch, lswitch, dswitch
+ R=right orientation (default L=left)
+ if arg4=blank or L: arg3 = [O|C][D][K][A]
+ D=dotted points; K=closed switch;
+ 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'
+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_)')')
+
+ `bswitch( linespec,L|R,chars ) pushbutton switch
+ R=right orientation (default L=left)
+ chars: O= normally open, C=normally closed'
+define(`bswitch',`eleminit_(`$1') dnl
+ define(`m4h',`dimen_/3') define(`m4cs',`0.069186*dimen_')dnl (2.5pt)
+ define(`m4v',`ifelse(`$2',R,-m4cs,m4cs)')define(`dna_',`$3') dnl
+ {line to rvec_(rp_len/2-m4h/2,0) chop 0 chop m4cs}
+ { Bsw_T1: circle rad m4cs at rvec_(rp_len/2-m4h/2,0); move to last circle
+ { Bsw_T2: circle rad m4cs at rvec_(m4h,0) }; ifelse(`$4',,,`{`$4'}')
+ sc_draw(`dna_',C,dnl
+ `{ line from rvec_(-m4cs,-(m4v)) \
+ to rvec_(m4h+m4cs,-(m4v)) }
+ { line from rvec_(m4h/2,-(m4v)) \
+ to rvec_(m4h/2,m4v*3) }
+ {[box invis ht_ 4*m4cs wid_ m4h+2*m4cs] at rvec_(m4h/2,m4v)}',
+ `{ line from rvec_(-m4cs,m4v*2.5) \
+ to rvec_(m4h+m4cs,m4v*2.5) }
+ { line from rvec_(m4h/2,m4v*2.5) \
+ to rvec_(m4h/2,m4v*4.5) }
+ {[box invis ht_ 5.5*m4cs wid_ m4h+2*m4cs] at rvec_(m4h/2,m4v*1.75)}')
+ line from rvec_(m4h,0) \
+ to rvec_(m4h/2+rp_len/2,0) chop m4cs chop 0 }
+ line to rvec_(rp_len,0) invis ')
+
+ `lswitch( linespec,L|R,chars ) knife switch
+ R=right orientation (default L=left)
+ chars=[O|C][D][K][A]
+ D=dotted points; K=closed switch;
+ A=arrowhead on switch blade;
+ O=opening arrow; C=closing arrow'
+define(`lswitch',`eleminit_(`$1') dnl
+ define(`m4v',`dimen_/4')define(`m4cs',`dimen_/4*Sin(10)')dnl
+ define(`dna_',`$3')define(`m4d',-1)define(`m4k',15)dnl
+ m4t1 = arrowht; m4t2 = arrowwid;
+ arrowht = dimen_/0.75*0.08; arrowwid = dimen_/0.75*0.053
+ {line to rvec_(rp_len/2-dimen_/6,0)
+ sc_draw(`dna_',K,`define(`m4k',25)dnl
+ {{ifinstr(`$3',A,arrow m4c_l,line) \
+ to LCtangent(Here,rvec_(dimen_/3,0),dotrad_,`$2') chop 0 chop -dotrad_}
+ line from rvec_(dimen_/3,0) to rvec_(dimen_/3,ifelse(`$2',R,-)dotrad_)}',
+ `{ifinstr(`$3',A,arrow m4c_l,line) \
+ to rvec_(dimen_/4,ifelse(`$2',R,-)dimen_/4)}')
+ sc_draw(`dna_',D,`dot(,,1) define(`m4d',1)')
+ sc_draw(`dna_',C,`{ arc <- m4c_l ifelse(`$2',R,,`c')cw \
+ from rvec_(Rect_(dimen_/4,ifelse(`$2',R,,-)m4k))\
+ to rvec_(Rect_(dimen_/4,ifelse(`$2',R,-)60)) \
+ with .c at rvec_(Rect_(-dimen_/4,ifelse(`$2',R,-)(60-m4k)/2)) }')
+ sc_draw(`dna_',O, `{ arc -> m4c_l ifelse(`$2',R,,`c')cw \
+ from rvec_(Rect_(dimen_/4,ifelse(`$2',R,,-)10))\
+ to rvec_(Rect_(dimen_/4,ifelse(`$2',R,-)75)) \
+ with .c at rvec_(Rect_(-dimen_/4,ifelse(`$2',R,-)(75-10)/2)) }') }
+ { line from rvec_(rp_len/2+dimen_/6,0) \
+ to rvec_(rp_len,0)
+ ifelse(m4d,-1,,`dot(at last line.start,,1)') }
+ { [box invis ht_ dimen_/4+m4cs wid_ dimen_/3] \
+ with .c at rvec_(rp_len/2,ifelse(`$2',R,-)(m4v-(m4cs))/2)}
+ arrowht = m4t1 ; arrowwid = m4t2; ifelse(`$4',,,`{`$4'}')
+ line to rvec_(rp_len,0) invis ')
+
+ `dswitch(linespec,R,W[ud]B[K] chars)
+ Comprehensive IEEE-IEC single-pole switch:
+ arg2=R: orient to the right of drawing dir
+ arg 3:
+ blank means WB by default
+ W=baseline
+ B=contact 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
+
+ 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
+ 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
+ R = time-delay operating arm
+ T = thermal control linkage
+ Y = pull switch
+ Z = turn switch'
+define(`dswitch',`eleminit_(`$1')
+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
+ 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')
+ sc_draw(`dna_',B,
+ `define(`m4c',ifelse(m4a,d,-))dnl
+ M4B: line from tr_xy(-4,0) \
+ to tr_xy(5.5,m4c`'4)
+ M4Q: 2 between M4_xyO and M4B.c')
+ 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_',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))')
+ sc_draw(`dna_',LE,
+ `line from 0.99 along_(M4B) \
+ to M4B.end \
+ then to M4B.end + ta_xy(vperp(M4B,m4c`'2.5))')
+ sc_draw(`dna_',K,
+ `line from tr_xy(4,0) \
+ to tr_xy(4,m4c`'5)')
+ sc_draw(`dna_',F,
+ `M4dT: 3/16 along_(M4B); M4dQ: 11/16 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 ')
+ 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')
+ sc_draw(`dna_',T,
+ `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 ')
+ 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 ')
+ sc_draw(`dna_',O,
+ `line from M4T + ta_xy(-2.5,0) \
+ to M4T + ta_xy(2.5,0) ')
+ 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) ')
+ 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) ')
+ 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) ')
+ 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 ')
+ 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)
+ 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) ')
+ 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) ')
+ 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 to rvec_(rp_len,0) invis ')
+
+ `Amplifier amp( linespec,size )'
+define(`amp',`eleminit_(`$1') define(`m4wd',`ifelse(`$2',,`dimen_',`($2)')')dnl
+ {line to rvec_(max(0,rp_len/2-m4wd/2),0)
+ line from rvec_(m4wd,0) \
+ to rvec_(0,m4wd/2) \
+ then to rvec_(0,-m4wd/2) \
+ then to rvec_(m4wd,0) \
+ then to rvec_(max(m4wd,rp_len/2+m4wd/2),0) }
+ {[box invis ht_ m4wd wid_ m4wd] at rvec_(max(m4wd,rp_len)/2,0)}
+ line to rvec_(max(rp_len,m4wd),0) invis ')
+
+ `integrator( linespec,size )'
+define(`integrator',`eleminit_(`$1')
+ define(`m4wd',`ifelse(`$2',,`dimen_',`($2)')')dnl
+ {line from rvec_(m4wd/4,m4wd/2) \
+ to rvec_(0,m4wd/2) \
+ then to rvec_(0,-m4wd/2) \
+ then to rvec_(m4wd/4,-m4wd/2) }
+ {line from rvec_(m4wd*5/4,0) \
+ to rvec_(m4wd/4,m4wd/2) \
+ then to rvec_(m4wd/4,-m4wd/2) \
+ then to rvec_(m4wd*5/4,0) \
+ then to rvec_(max(rp_len,m4wd*5/4),0) }
+ { [box invis ht_ m4wd wid_ m4wd*5/4] at rvec_(m4wd*5/8,0) }
+ line to rvec_(max(rp_len,m4wd*5/4),0) invis ')
+
+ `opamp(linespec,
+ - label, + label, size, chars)
+ drawn as a []:
+ defined positions:
+ W, N, E, S, Out, E1, E1, In1, In2
+ 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
+define(`dna_',`$5')dnl
+ eleminit_(`$1',max(elen_-m4h/4,m4h))
+ W: Here
+ N: vec_(0,m4v/2)
+ S: vec_(0,-m4v/2)
+ E: vec_(m4h,0)
+ C: vec_(m4h/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) }
+ Out: Here }
+ E1: vec_(m4h/2,m4v/4)
+ E2: vec_(m4h/2,-m4v/4)
+ In1: vec_(0,m4v/4)
+ In2: vec_(0,-m4v/4)
+ { move to In`'ifinstr(dna_,R,2,1)
+ ifelse(`$2',,"ifsvg(-,`{\scriptsize$-$}')" \
+ at rvec_(4pt__,0) ifsvg(+(0,textht/10)),m4lstring(`$2',"`$2'"))}
+ { move to In`'ifinstr(dna_,R,1,2)
+ 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' ] ')
+
+ `dac(width,height,nIn,nN,nOut,nS)'
+define(`dac',`[
+ define(`dac_ht',`ifelse(`$2',,(dimen_),`$2')')dnl
+ define(`dac_wd',`ifelse(`$1',,(dimen_+dac_ht/2),`$1')')dnl
+In: Here
+C: rvec_((dac_wd-dac_ht/2)/2,0)
+NE: rvec_(dac_wd-dac_ht/2, dac_ht/2)
+Out:rvec_(dac_wd,0)
+SE: rvec_(dac_wd-dac_ht/2,-dac_ht/2)
+NW: rvec_(0,dac_ht/2)
+SW: rvec_(0,-dac_ht/2)
+ define(`m4dn',ifelse(`$3',,1,`eval($3)'))dnl
+ for_(1,m4dn,1,`In`'m4x: NW-vec_(0,dac_ht*(2*m4x-1)/(2*m4dn))')dnl
+ define(`m4dn',ifelse(`$4',,1,`eval($4)'))dnl
+ for_(1,m4dn,1,`N`'m4x: NW+vec_((dac_wd-dac_ht/2)*m4x/(m4dn+1),0)')dnl
+ define(`m4dn',ifelse(`$5',,1,`eval($5)'))dnl
+ for_(1,m4dn,1,`r = eval(2*m4x-1)/eval(m4dn*2)
+ Out`'m4x: Out-vec_(ifelse(eval((2*m4x-1)<m4dn),1,,-)dac_ht*(0.5-r),
+ dac_ht*(0.5-r))')dnl
+ define(`m4dn',ifelse(`$6',,1,`eval($6)'))dnl
+ for_(1,m4dn,1,`S`'m4x: SW+vec_((dac_wd-dac_ht/2)*m4x/(m4dn+1),0)')dnl
+ line to NW then to NE then to Out then to SE then to SW then to Here
+ `$7']')
+
+ `adc(width,height,nIn,nN,nOut,nS)'
+define(`adc',`[
+ define(`adc_ht',`ifelse(`$2',,(dimen_),`$2')')dnl
+ define(`adc_wd',`ifelse(`$1',,(dimen_+adc_ht/2),`$1')')dnl
+In: Here
+C: rvec_(adc_ht/4+adc_wd/2,0)
+NE: rvec_(adc_wd, adc_ht/2)
+Out:rvec_(adc_wd,0)
+SE: rvec_(adc_wd,-adc_ht/2)
+NW: rvec_(adc_ht/2, adc_ht/2)
+SW: rvec_(adc_ht/2,-adc_ht/2)
+ define(`m4dn',ifelse(`$3',,1,`eval($3)'))dnl
+ for_(1,m4dn,1,`r = eval(2*m4x-1)/eval(m4dn*2)
+ In`'m4x: In+vec_(ifelse(eval((2*m4x-1)<m4dn),1,,-)adc_ht*(0.5-r),
+ adc_ht*(0.5-r))')dnl
+ define(`m4dn',ifelse(`$4',,1,`eval($4)'))dnl
+ for_(1,m4dn,1,`N`'m4x: NW+vec_((adc_wd-adc_ht/2)*m4x/(m4dn+1),0)')dnl
+ define(`m4dn',ifelse(`$5',,1,`eval($5)'))dnl
+ for_(1,m4dn,1,`Out`'m4x: NE-vec_(0,adc_ht*(2*m4x-1)/(2*m4dn))')dnl
+ define(`m4dn',ifelse(`$6',,1,`eval($6)'))dnl
+ for_(1,m4dn,1,`S`'m4x: SW+vec_((adc_wd-adc_ht/2)*m4x/(m4dn+1),0)')dnl
+ line from Out to SE then to SW then to In then to NW then to NE then to Out
+ `$7']')
+
+ `diode(linespec,
+ B|CR|D|F|G|L|LE[R]|P[R]|S|Sh|T|V|v|w|Z|chars,
+ [R][E])
+ Adding K to arg2 draws open arrowheads
+ 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
+ { Diode_Env: circle diam m4dh at rvec_(rp_len/2,0) }')
+ define(`m4dm',
+ `ifelse(dma_,S,`m4dv/4',
+ dma_,Z,`(m4dv/4-linethick pt__/2)',
+ dma_,v,`m4dv/4',
+ dma_,w,`m4dv/4',
+ 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 '
+define(`m4gen_d',`{dnl
+ define(`m4dv',`dimen_/6')define(`m4dh',sqrt(3)*m4dv/2)dnl
+ define(`ddna_',`ifelse(`$1',,`LACR',`$1')')dnl
+ define(`ddf_',`ifelse(`$1',,f,`$2')')dnl
+ define(`m4tR',`ifinstr(`$2',R,(-1),1)')dnl
+ define(`m4dy',`(linethick pt__)*(sqrt(3)-1)/2')dnl
+ M4_s: last line.start; M4_e: last line.end
+ sc_draw(`ddna_',L,dnl left stem, uL = shortened
+ `line from M4_s to 0.5 between M4_s and M4_e \
+ chop 0 chop m4dh`'ifelse(m4a,,/2)')
+ dnl Elements drawn from left of body
+ sc_draw(`ddna_',E,dnl EM radiation arrows pointing out
+ `ifelse(m4a,d,
+ `{em_arrows(,rp_ang*rtod_-135) with .Tail at rvec_(-m4dh*0.3,-m4dv*0.8)}',
+ `{em_arrows(,rp_ang*rtod_+135) with .Tail at rvec_(-m4dh*0.3,m4dv*0.8)}')')
+ sc_draw(`ddna_',P,dnl EM radiation arrows
+ `ifelse(m4a,d,
+ `{em_arrows(,rp_ang*rtod_+45) with .Head at rvec_(-m4dh*0.3,-m4dv*0.8)}',
+ `{em_arrows(,rp_ang*rtod_-45) with .Head at rvec_(-m4dh*0.3, m4dv*0.8)}')')
+ sc_draw(`ddna_',G,dnl SCR gate
+ `{Gm: line to ifinstr(`$2',E,2,3/2) between Here and \
+ rvec_(m4dh,ifelse(m4a,d,-)m4dv/2) ifinstr(`$2',E,`then to \
+ rvec_(m4dh*2,ifelse(m4a,d,-)sqrt((4*dimen_/10)^2-(m4dh*2)^2))')
+ G: Here}')
+ sc_draw(`ddna_',F,dnl half arrowhead shifted up, down, or 0
+ `sc_draw(`ddna_',Fc,`define(`m4Fc')')sc_draw(`ddna_',F,`undefine(`m4Fc')')dnl
+ define(`m4dn',`ifelse(m4a,u,m4dv/2,m4a,d,-m4dv/2,0)')
+ define(`m4dFline',`Gm: line from rvec_(0,m4tR*m4dn) \
+ to rvec_(0,m4tR*(m4dn+m4dv/2)) \
+ then to rvec_(m4dh-linethick pt__/2,m4tR*m4dn) \
+ then to rvec_(0,m4tR*m4dn)')
+ { ifinstr(ddf_,f,`m4fshade(m4fill,m4dFline)',`m4dFline')
+ line to ifinstr(`$2',E,
+ `rvec_(0,-(m4tR*sqrt((dimen_*0.7/2)^2-(m4dh/2)^2)))',
+ `rvec_(0,-(m4tR*m4dv/2))')
+ G: Here }
+ ifdef(`m4Fc',`{line from rvec_(0,m4tR*m4dn) to rvec_(m4dh,m4tR*m4dn)}')
+ move to rvec_(m4dh,0) ')
+ ifinstr(ddna_,A,dnl Arrowhead shifted up, down, or 0
+ `sc_draw(`ddna_',Ac,`define(`m4Ac')')sc_draw(`ddna_',A,`undefine(`m4Ac')')dnl
+ define(`m4dn',`ifelse(m4a,u,m4dv/2,m4a,d,-m4dv/2,0)')dnl
+ define(`m4dFline',`line from rvec_(0,m4dn) \
+ to rvec_(0,m4dn+m4dv/2) \
+ then to rvec_(m4dh-linethick pt__/2,m4dn) \
+ then to rvec_(0,m4dn-m4dv/2) \
+ then to rvec_(0,m4dn)')
+ { ifinstr(ddf_,f,`m4fshade(m4fill,m4dFline)',`m4dFline')}
+ ifdef(`m4Ac',`{line from rvec_(0,m4dn) to rvec_(m4dh,m4dn)}')
+ 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
+ `Gm: line from rvec_(-m4dh/2, m4dv/4) \
+ to ifinstr(`$2',E,`rvec_(-m4dh/2, dimen_*0.35)',
+ `rvec_(-m4dh/2, m4dv*5/4+m4dy)')',
+ m4a,d,
+ `Gm: line from rvec_(-m4dh/2,-m4dv/4) \
+ to ifinstr(`$2',E,`rvec_(-m4dh/2,-dimen_*0.35)',
+ `rvec_(-m4dh/2,-m4dv*5/4-m4dy)')',
+ `Gm: line from rvec_(-m4dh/2,-m4dv/2-m4dy) \
+ to rvec_(-m4dh/2, m4dv/2+m4dy)
+ 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)}')
+ m4gen_d2($@)dnl
+ m4gen_d3($@)dnl
+}') dnl macro split to keep within m4 buffer size
+ define(`m4gen_d2',`dnl
+ dnl Elements drawn at right of body
+ sc_draw(`ddna_',rb,dnl Current regulator bars
+ `{line from rvec_(-m4dv/4,-m4dv/2-m4dy) \
+ to rvec_( m4dv/4,-m4dv/2-m4dy)}
+ {line from rvec_(-m4dv/4,m4dv/2+m4dy) \
+ to rvec_( m4dv/4,m4dv/2+m4dy)}')
+ sc_draw(`ddna_',H,dnl Double length double vertical bars
+ `{line from rvec_(0,-m4dv-m4dy) \
+ to rvec_(0, m4dv+m4dy)}
+ {line from rvec_(-m4dh,-m4dv-m4dy) \
+ to rvec_(-m4dh, m4dv+m4dy)}
+ move to rvec_(-m4dh,0)')
+ sc_draw(`ddna_',N,dnl thyristor gate at anode, label Ga
+ `{Gam: line from rvec_(-m4dh,-m4tR*m4dv/4) \
+ to rvec_(-m4dh*2,-m4tR*m4dv*3/4) ifinstr(`$2',E,`then to \
+ rvec_(-m4dh*2,-m4tR*sqrt((dimen_*0.7/2)^2-(m4dh*3/2)^2))')
+ Ga: Here}')
+ sc_draw(`ddna_',S,dnl S-shape vertical bar
+ `{line from rvec_(-m4dv/4,-m4dv/3) \
+ to rvec_(-m4dv/4,-m4dv/2-m4dy) \
+ then to rvec_(0,-m4dv/2-m4dy) \
+ then to rvec_(0, m4dv/2+m4dy) \
+ then to rvec_(m4dv/4,m4dv/2+m4dy) \
+ then to rvec_(m4dv/4,m4dv/3)}')
+ sc_draw(`ddna_',T,dnl T-diode vertical bar
+ `{line from rvec_(-m4dv/4,-m4dv/2-m4dy) \
+ to rvec_(0,-m4dv/2-m4dy) \
+ then to rvec_(0, m4dv/2+m4dy) \
+ then to rvec_(-m4dv/4,m4dv/2+m4dy)}')
+ sc_draw(`ddna_',v,dnl Variable capacitor curved plate
+ `ifelse(m4a,d,`define(`m4drad',`sqrt((m4dv/2+m4dy)^2+(m4dv)^2*3/4)')dnl
+ {arc cw from rvec_(-(m4drad-m4dv*sqrt(3)/2), m4dv/2+m4dy) \
+ to rvec_(-(m4drad-m4dv*sqrt(3)/2),-m4dv/2-m4dy) \
+ with .c at rvec_(-m4drad,0)}',
+ `{arc cw from rvec_(m4dv/3,-m4dv/2-m4dy) \
+ to rvec_(m4dv/3, m4dv/2+m4dy) \
+ with .c at rvec_(m4dv/3+m4dv*sqrt(3)/2,0)}
+ {line from rvec_(m4dv/3+m4dv*sqrt(3)/2-last arc.rad,0) \
+ to rvec_(m4dv/4,0)}')')
+ sc_draw(`ddna_',W,dnl cathode gate
+ `{Gm: line from rvec_(0,m4tR*m4dv/4) \
+ to rvec_(m4dh,m4tR*m4dv*3/4) ifinstr(`$2',E,
+ `then to rvec_(m4dh,\
+ m4tR*sqrt((dimen_*0.7/2)^2-(m4dh*3/2)^2))')
+ G: Here}')
+ sc_draw(`ddna_',X,dnl Variable capacitor plate
+ `{line from rvec_(m4dv/4,-m4dv/2-m4dy) \
+ to rvec_(m4dv/4, m4dv/2+m4dy)}')
+ sc_draw(`ddna_',Z,dnl Zener bar
+ `{line from rvec_(-m4dv/4,-m4dv/2-m4dy) \
+ to rvec_(0,-m4dv/2-m4dy) \
+ then to rvec_(0, m4dv/2+m4dy) \
+ then to rvec_(m4dv/4,m4dv/2+m4dy)}')
+ ifinstr(ddna_,Q,dnl left arrowhead
+ `sc_draw(`ddna_',Qc,`define(`m4Qc')')sc_draw(`ddna_',Q,`undefine(`m4Qc')')dnl
+ define(`m4dn',`ifelse(m4a,u,m4dv/2,m4a,d,-m4dv/2,0)')dnl
+ {move to rvec_(m4dh,0)
+ define(`m4dFline',`line from rvec_(0,m4dn) \
+ to rvec_(0,m4dn+m4dv/2) \
+ then to rvec_(-(m4dh-linethick pt__/2),m4dn) \
+ then to rvec_(0,m4dn-m4dv/2) \
+ then to rvec_(0,m4dn) ')
+ ifinstr(ddf_,f,`m4fshade(m4fill,m4dFline)',`m4dFline')}
+ ifdef(`m4Qc',`{line from rvec_(0,m4dn) \
+ to rvec_(-(m4dh-linethick pt__/2),m4dn)}')
+ move to rvec_(m4dh,0)')dnl
+') dnl macro split to keep within m4 buffer size
+ define(`m4gen_d3',`dnl
+ sc_draw(`ddna_',Y,dnl Bilateral switch
+ `define(`m4vt',`(m4tR*m4dv/2)')dnl
+ line from rvec_(0,-m4vt) to Here
+ define(`m4dFline',`line to rvec_(0,m4vt) \
+ then to rvec_(2*m4dh,0) \
+ then to rvec_(2*m4dh,-m4vt) then to Here ')
+ ifinstr(ddf_,f,`m4fshade(m4fill,m4dFline)',`m4dFline')
+ line from rvec_(2*m4dh,m4vt) to rvec_(2*m4dh,0)
+ { Gm: line from rvec_(-m4dh,m4vt) \
+ to ifinstr(`$2',E,`rvec_(-m4dh,-m4tR*dimen_*0.35)',
+ `rvec_(-m4dh,-m4tR*m4dv*5/4)')
+ G: Here }')
+ sc_draw(`ddna_',R,dnl right stem, uR = shortened
+ `line from 0.5 between M4_s and M4_e to M4_e \
+ chop m4dh ifelse(m4a,,/2,m4a,d,/2+m4dv/4) chop 0')
+ ')dnl
+
+ `em_arrows( type,degrees,length)
+ type=[N|I|E][D] N=nonionizing, I=ionizing,
+ E=simple; D=dot on arrow stem
+ degrees = absolute arrow direction'
+define(`em_arrows',`[ define(`m4dnm_',`ifelse($1,,N,$1)')dnl
+ arrowhead = em_arrowhead
+ define(`m4_len',
+ `ifelse(`$3',,`dimen_*ifinstr(`$1',E,0.25,0.46)',`($3)')')
+ ang = ifelse(`$2',,135,`($2)')*dtor_
+ sc_draw(`m4dnm_',N,
+ `{ A1: arrow m4c_l to rrot_(m4_len,0,ang) wid em_arrowwid ht em_arrowht }
+ move to rrot_(0,-em_arrowwid*9/8,ang)
+ { A2: arrow m4c_l to rrot_(m4_len,0,ang) wid em_arrowwid ht em_arrowht } ')
+ sc_draw(`m4dnm_',I,`m4_rad_arr(A1)
+ move to rrot_(0,-em_arrowwid*9/8,ang); m4_rad_arr(A2)')
+ sc_draw(`m4dnm_',E,
+ `{ A1: line to rrot_(m4_len,0,ang) \
+ then to rrot_(m4_len-dimen_/18,dimen_/18,ang) }
+ move to rrot_(0,-dimen_/8,ang)
+ { A2: line to rrot_(m4_len,0,ang) \
+ then to rrot_(m4_len-dimen_/18,dimen_/18,ang) }')
+ sc_draw(`m4dnm_',D,`dot(at A1.start); dot(at A2.start)')
+ Tail: 0.5 between A1.start and A2.start
+ Head: 0.5 between A1.end and A2.end
+ `$4']')
+define(`m4_rad_arr',`{{`$1': line invis to rrot_(m4_len,0,ang)}
+ for_(1,3,1,
+ `arc ifelse(m4x,2,c)cw to rrot_(dimen_/10,0,ang) \
+ with .c at rrot_(dimen_/20,0,ang)')
+ arrow m4c_l to `$1'.end wid em_arrowwid ht em_arrowht*3/4 }')
+
+ `thyristor(linespec,
+ [SCR|SCS|SUS|SBS|IEC][chars])
+ Composite element in [ ] block
+ SCR: silicon controlled rectifier (default)
+ SCS: silicon controlled switch
+ SUS: silicon unilateral switch
+ SBS: silicon bilateral switch
+ IEC: type IEC
+ chars:
+ A: arrowhead
+ F: half arrowhead
+ B: bidirectional diode
+ E: adds envelope
+ H: perpendicular gate, endpoint G
+ N: anode gate, endpoint Ga
+ R=right orientation
+ U: centre line in diodes
+ V: perpendicular gate at arrowhead centre
+ K: use open arrowheads'
+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
+ 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
+ define(`m4thAc',ifelse(m4thAc,,A,m4thAc)`'ifinstr(m4thx,U,c))dnl centerline
+ define(`m4thf',m4thf`'ifinstr(m4thx,A,,m4thx,F,,m4thx,K,,f))dnl fill
+ ifelse(m4thtype,,
+ `[define(`m4thyd',`dimen_*0.7') eleminit_(`$1',m4thyd); dnl no type code
+ A: last line.start; K: last line.end; T1:A; T2:K
+ define(`m4tha',`patsubst(patsubst(patsubst(patsubst(m4thx,UA,Ac),V,B),
+ H,ifinstr(m4thf,R,d,u)B),U,c)')dnl
+ ifelse(xtract(m4tha,A,F,Q),,`define(`m4tha',m4tha`'A)dnl
+ define(`m4thf',m4thf`'ifinstr(m4thx,K,,f))')dnl
+ ifelse(xtract(m4tha,B,G,H,N,W),,`define(`m4tha',m4tha`'W)')dnl
+ m4gen_d(LRC`'m4tha,m4thf)
+ ifinstr(m4thf,E,`Env: circle diam m4thyd with .c at rvec_(rp_len/2,0)')
+ `$3']',
+ m4thtype,IEC,`bi_trans(`$1',
+ ifinstr(m4thf,R,,R),uEdCBUT,xtract(m4thf,E),A:E;K:C;G:T;`$3')',
+ `[define(`m4thyd',`dimen_*0.7') eleminit_(`$1',m4thyd)
+ A: last line.start; K: last line.end; T1:A; T2:K
+ ifelse(m4thtype,SCR,
+ `m4gen_d(LCRW`'m4thAc,m4thf)',
+ m4thtype,SCS,
+ `m4gen_d(LCRWN`'m4thAc,m4thf)',
+ m4thtype,SUS,
+ `m4gen_d(LFR,m4thf)',
+ m4thtype,SBS,
+ `m4gen_d(uLYuR,m4thf)',
+ m4thtype,B,`ifinstr(m4thf,R,
+ `m4gen_d(LdG'xtract(m4thx,G)`dA`'m4thAc`'HuQ`'m4thAc`'R,m4thf)',
+ `m4gen_d( LG'xtract(m4thx,G)`uA`'m4thAc`'HdQ`'m4thAc`'R,m4thf)')')
+ ifinstr(m4thf,E,`Env: circle diam m4thyd with .c at rvec_(rp_len/2,0)')
+ `$3']')')')
+
+ `scr(linespec, [R][E], label) and similar
+ Place thyristor as a two-term element with
+ arg 3 as label of the [] block'
+define(`scr',`eleminit_(`$1'); M4_scrS: last line.start; M4_scrE: last line.end
+ ifelse(`$3',,,`$3:') thyristor(from M4_scrS to M4_scrE,SCR`'`$2',`$4') \
+ with .A at M4_scrS')
+define(`scs',`eleminit_(`$1'); M4_scrS: last line.start; M4_scrE: last line.end
+ ifelse(`$3',,,`$3:') thyristor(from M4_scrS to M4_scrE,SCS`'`$2'`',`$4') \
+ with .A at M4_scrS')
+define(`sus',`eleminit_(`$1'); M4_scrS: last line.start; M4_scrE: last line.end
+ ifelse(`$3',,,`$3:') thyristor(from M4_scrS to M4_scrE,SUS`'`$2'`',`$4') \
+ with .A at M4_scrS')
+define(`sbs',`eleminit_(`$1'); M4_scrS: last line.start; M4_scrE: last line.end
+ ifelse(`$3',,,`$3:') thyristor(from M4_scrS to M4_scrE,SBS`'`$2'`',`$4') \
+ with .A at M4_scrS')
+
+ `tgate( linespec, [B][R|L] ) Transmission gate
+ B= box form
+ L= left orientation'
+define(`tgate',`[ eleminit_(`$1') define(`m4tgm',ifinstr(`$2',L,-))
+ A: last line.start
+ B: last line.end
+ C: last line.center
+ ifinstr(`$2',B,
+ `ebox(from A to B)
+ Gb: C+vec_(0,m4tgm`'m4ht/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 \
+ at C+vec_(0,m4tgm`'m4dh/4*4/3)
+ L2: line from last circle+vec_(0,m4tgm`'m4dh/4) \
+ to C+vec_(0,m4tgm`'m4dh*3/2)
+ Gb: Here
+ L3: line from C to C-vec_(0,m4tgm`'m4dh) ')
+ G: Here
+ `$3']')
+ `ptrans( linespec, [R|L] ) Pass transistor
+ L= left orientation'
+define(`ptrans',`[ eleminit_(`$1') define(`m4ptm',ifinstr(`$2',L,-))
+ define(`m4pv',`dimen_/6')define(`m4pwd',m4pv*2)dnl
+ A: last line.start; Start: A
+ B: last line.end; End: B
+ C: last line.center
+ La1: line to rvec_(rp_len/2-m4pwd/2,0)
+ { La2: line to rvec_(m4pwd,m4pv) \
+ then to rvec_(m4pwd,neg_(m4pv)) \
+ then to Here }
+ { La3: line from rvec_(m4pwd,0) \
+ to rvec_(0,m4pv) \
+ then to rvec_(0,neg_(m4pv)) \
+ then to rvec_(m4pwd,0)
+ Circle: circle thick max(4pt__,linethick/2) rad m4pv/4 \
+ at C+vec_(0,m4ptm`'m4pv*5/6)
+ La4: line from last circle+vec_(0,m4ptm`'m4pv/4) \
+ to C+vec_(0,m4ptm`'m4pv*2)
+ Gb:Here
+ La5: line from C-vec_(0,m4ptm`'m4pv/2) \
+ to C-vec_(0,m4ptm`'m4pv*3/2)
+ G: Here }
+ La6: line from rvec_(m4pwd,0) \
+ to B
+ `$3']')
+ `tline( linespec, wid, len ) Transmission line'
+define(`tline',`eleminit_(`$1')
+ define(`m4v',`ifelse(`$2',,`dimen_/6',`($2)')')dnl
+ define(`m4h',`ifelse(`$3',,`dimen_*2/3',min(rp_len-m4v/2,`$3'))')dnl
+ {[box invis ht_ m4v wid_ m4h+m4v/2] at last line.c}
+ {line from last line.c+vec_(m4h/2+m4v/4,0) \
+ to last line.end}
+ {line to 2nd last line.c+vec_(-m4h/2,0); round
+ ifdpic(
+ `line from rvec_(0,-m4v/2) \
+ to rvec_(m4h,-m4v/2)
+ spline 0.5523 to rvec_(m4v/4,0) \
+ then to rvec_(m4v/4,m4v) \
+ to rvec_(0,m4v)
+ line to rvec_(-m4h,0)
+ spline 0.5523 to rvec_(-m4v/4,0) \
+ then to rvec_(-m4v/4,-m4v) \
+ then to rvec_(m4v/4,-m4v) \
+ then to rvec_(m4v/4,0) \
+ then to Here',
+ `line from rvec_(m4v/4,-m4v/2) \
+ to rvec_(m4h-m4v/4,-m4v/2)
+ spline to rvec_(m4v/2,0) \
+ then to rvec_(m4v/2,m4v) \
+ then to rvec_(0,m4v)
+ line to rvec_(-m4h+m4v/2,0)
+ spline to rvec_(-m4v/2,0) \
+ then to rvec_(-m4v/2,-m4v) \
+ then to rvec_(0,-m4v)\
+ then to Here \
+ then to rvec_(-m4v/2,0) \
+ then to rvec_(-m4v/2,-m4v)\
+ then to rvec_(0,-m4v)') }
+ line to 5th last line.end invis ')
+
+define(`m4_U',`dimen_/10') `Semiconductor grid size'
+define(`m4_Aht',`m4_U*10/6') `Semiconductor arrowhead ht and wd'
+define(`m4_Awd',`m4_U*10/9')
+
+ `Bipolar transistor bi_tr(linespec, L|R, P, E)'
+define(`bi_tr',`bi_trans(`$1',`$2',ifelse(`$3',P,u,d)EBCBU,`$4',`$5')')
+
+ `Darlington(L|R, chars)
+ arg2:
+ E= envelope
+ P= p-type,
+ B1= internal base lead,
+ R1= Q1 bias resistor; E1= ebox,
+ R2= Q2 bias resistor; E2= ebox,
+ D= damper diode
+ Z= zener bias diode
+ This macro would be somewhat simpler if the
+ joints had not been mitred (using Along_ and
+ mitre_)'
+define(`Darlington', `[ rpoint_(dimen_/10) define(`m4DR',`ifinstr(`$1',R,-)')
+ define(`m4Da',`$2') pushdef(`dimen_',((dimen_)*0.8))dnl Smaller internals
+ hp_ang = rp_ang
+ Q1: bi_trans(,`$1',ifinstr(m4Da,P,u,d)ECBU)
+ E: Q1.E
+ Q1B: line from Q1.Bulk.c to Q1.Bulk.c + vec_(0,m4DR`'m4_U)
+ Q2: bi_trans(,`$1',ifinstr(m4Da,P,u,d)EBCBU) with .E at Here
+ Mitre_(Q1B,Q2.Em0)
+ B: Q2.B
+ T: Q2.C+(Q2.Bulk.c.x-Q2.B.x,Q2.Bulk.c.y-Q2.B.y)
+ QC: intersect_(Q2.C,T,Q1.E,Q1.C)
+ C: QC
+ L1: line from Along_(Q2.Cm0,hlth) to Q2.C then to QC then to Q1.C \
+ then to Along_(Q1.Cm0,hlth)
+ define(`m4DE1')sc_draw(`m4Da',E1,`define(`m4DE1',E)define(`m4Da',R1`'m4Da)')
+ define(`m4DE2')sc_draw(`m4Da',E2,`define(`m4DE2',E)define(`m4Da',R2`'m4Da)')
+ ifinstr(m4Da,E,
+ `Env: circle rad 7.75*m4_U at Q1.Bulk.c+vec_(1.5*m4_U,m4DR`'(-0.1*m4_U))
+ line from Q1.E to Q1.E+vec_(-2.2*m4_U,0); E: Here
+ Mitre_(last line,Q1.Em0)
+ line from QC to QC+vec_(2.2*m4_U,0); C: Here
+ pushdef(`dotrad_',(dotrad_/2))dnl
+ ifelse(ifinstr(m4Da,B1,T,m4Da,R1,T,m4Da,R2,T),T,`dot(at Q2.E)')
+ ifelse(ifinstr(m4Da,R2,T,m4Da,Z,T),T,
+ `dot(at Q2.Bulk.c+vec_(0,m4DR`'m4_U))')
+ ifelse(ifinstr(m4Da,B1,T,m4Da,R1,T),T,`ifinstr(m4Da,R2,
+ `dot(at Q2.E+vec_(-m4_U,0))')')
+ ifinstr(m4Da,B1,
+ `ifinstr(m4Da,R1,`dot(at Q2.E-vec_(3*m4_U,0))')
+ B1: Q2.E+vec_(-3*m4_U,m4DR`'5.2*m4_U)
+ line from B1 to Q2.E+vec_(-3*m4_U,0); corner')
+ ifinstr(m4Da,Z,`dot(at QC+vec_(m4_U*3/2,0))')
+ dot(at QC)
+ ifinstr(m4Da,D,`dot(at Q1.E)')
+ ifinstr(m4Da,R1,`dot(at Q1.E-vec_(m4_U,0))')
+ popdef(`dotrad_')',
+ `ifinstr(m4Da,B1,`move to Q2.E-vec_(3*m4_U,0); line to rvec_(-m4_U,0)
+ B1: Here')')
+ ifelse(ifinstr(m4Da,B1,T,m4Da,R1,T,m4Da,R2,T),T,
+ `line from Q2.E to Q2.E-vec_(m4_U,0)
+ ifelse(ifinstr(m4Da,B1,T,m4Da,R1,T),T,
+ `line to rvec_(-2*m4_U,0)
+ ifinstr(m4Da,R1,
+ `line to rvec_(-m4_U,0); corner pushdef(`dimen_',((dimen_)*0.6))
+ R1: resistor(to Q1.E+vec_(-m4_U/0.6,0),,m4DE1) popdef(`dimen_')
+ ifinstr(m4Da,E,,`corner;E: Here; line from Q1.E to E')
+ point_(hp_ang)')')')
+ ifinstr(m4Da,R2,
+ `move to Q2.Bulk.c+vec_(0,m4DR`'m4_U)
+ line to rvec_(-4*m4_U,0); corner
+ pushdef(`dimen_',((dimen_)*0.6))dnl
+ R2: resistor(to Q2.E+vec_(-m4_U/0.6,0),,m4DE2) popdef(`dimen_')
+ point_(hp_ang)')
+ ifinstr(m4Da,D,
+ `DE: Q1.E + vec_(m4_U*3/2,m4DR`'(-m4_U*3/2))
+ DS: QC - vec_(m4_U*3/2,m4DR`'m4_U*3/2)
+ line from Q1.E to DE
+ line from QC to DS
+ mitre_(DS,DE,Q1.E)
+ mitre_(DE,DS,QC)
+ Diode: diode(ifinstr(m4Da,P,`from DS to DE',`from DE to DS'))
+ point_(hp_ang)')
+ ifinstr(m4Da,Z,
+ `ifinstr(m4Da,E,,
+ `line from QC to QC+vec_(m4_U*3/2,0); corner; C: Here')
+ move to Q2.Bulk.c+vec_(0,m4DR`'m4_U)
+ line to rvec_(2*m4_U,0) then to rvec_(4.5*m4_U,m4DR`'(-2*m4_U)) \
+ then to rvec_(4.5*m4_U,m4DR`'(-2*m4_U-lthick/4))
+ Zener: diode(ifinstr(m4Da,P,`to QC+vec_(m4_U*3/2,0)',
+ `from QC+vec_(m4_U*3/2,0) to Here'),Z)
+ point_(hp_ang)')
+ popdef(`dimen_') `$4' ]')
+
+ `igbt(linespec, L|R, [L][[d]D])
+ Arg 3: L = 2nd gate type, D = parallel diode,
+ dD = dotted connections'
+define(`igbt',`bi_trans(`$1',`$2',ifinstr(`$3',L,,GH)CBUdE`$3',,`$4')')
+
+ `Customizable bi_trans(linespec, L|R, chars, E)
+ chars
+ BU=bulk line
+ B=base line and label
+ uEn|dEn=emitters E0 to En
+ uE|dE=emitter line
+ Cn|uCn|dCn=collectors C0 to Cn (arrow u or d)
+ C|uC|dC=collector line (arrow u or d)
+ uT|dT=trigger line
+ G=gate line and location
+ H=gate line
+ L=L-gate line and location
+ S=Schottky
+ [d]D=named parallel diode, d=connection dots'
+define(`bi_trans',
+ `define(`m4R',`ifelse(`$2',R,-)')define(`dna_',`ifelse(`$3',,BCuEBU,`$3')')dnl
+ define(`m4n',0)define(`m4dE',)dnl
+[ ifelse(`$1',,`tr_xy_init(,m4_U,m4R); E: tr_xy(-3,0); C: tr_xy(3,0)',
+ `eleminit_(`$1'); tr_xy_init(last line.c,m4_U,m4R)
+ E: last line.start; line from E to tr_xy(-3,0) \
+ then to tr_xy(-3,0) + vec_( lthick*0.15,m4R`'lthick/3)
+ C: E+vec_(rp_len,0); line from C to tr_xy(3,0) \
+ then to tr_xy( 3,0) + vec_(-lthick*0.15,m4R`'lthick/3)')
+ Bulk: line sc_draw(`dna_',BU,,invis) from tr_xy(-2,4) \
+ to tr_xy(2,4)
+ sc_draw(`dna_',B,
+ `B: tr_xy(0,6.5); line from B to tr_xy(0,4)')
+ for_(1,8,1,
+ `sc_draw(`dna_',E`'m4x,`define(`m4n',m4x*1.5) define(`m4dE',m4a)
+ m4bi_Em(m4x,m4a,E)
+ line from tr_xy(-2,4) \
+ to tr_xy(-2-m4n,4)
+ Bulk: line invis from tr_xy(-2-m4n,4) \
+ to Bulk.end')')
+ sc_draw(`dna_',E,
+ `define(`m4dE',m4a) m4bi_Em(0,m4a,E)')
+ for_(1,8,1,
+ `sc_draw(`dna_',C`'m4x,`define(`m4n',m4x*1.5)
+ m4bi_Em(m4x,m4a,C)
+ line from tr_xy(2,4) \
+ to tr_xy(2+m4n,4)
+ Bulk: line invis from Bulk.start to tr_xy(2+m4n,4)')')
+ sc_draw(`dna_',C,
+ `m4bi_Em(0,m4a,C)')
+ sc_draw(`dna_',S,
+ `Bulk: line invis from Bulk.start+ta_xy(-1,0) \
+ to Bulk.end+ta_xy(1,0)
+ S1: line from Bulk.end+ta_xy(-1,0) \
+ to Bulk.end \
+ then to Bulk.end+ta_xy(0,-0.5) \
+ then to Bulk.end+ta_xy(-0.5,-0.5)
+ S2: line from Bulk.start+ta_xy(1,0) \
+ to Bulk.start \
+ then to Bulk.start+ta_xy(0,0.5) \
+ then to Bulk.start+ta_xy(0.5,0.5)')
+ sc_draw(`dna_',T,
+ `Tm: line from tr_xy(0,4) \
+ to tr_xy(2/3,(4 ifelse(m4a,u,+,-)4/1.8*2/3))
+ T: Here')
+ sc_draw(`dna_',G,
+ `G: tr_xy(0,6.5); line from G to tr_xy(0,4.7)')
+ sc_draw(`dna_',H,
+ `H1: line from tr_xy(-2,4.7) \
+ to tr_xy(2,4.7)')
+ sc_draw(`dna_',L,
+ `G: tr_xy(-1.5,6.2); line from G to tr_xy(-1.5,4.7) \
+ then to tr_xy(1.5,4.7)')
+ sc_draw(`dna_',D,
+ `D1: line from tr_xy(-5,0) \
+ to tr_xy(-5,-4)
+ D2: line from tr_xy( 5,0) \
+ to tr_xy( 5,-4)
+ ifelse(m4a,d,`dot(at tr_xy( 5,0)); dot(at tr_xy(-5,0))')
+ Diode: diode(ifelse(m4dE,d,from,to) tr_xy(-5,-4) \
+ ifelse(m4dE,d,to,from) tr_xy( 5,-4))
+ ifelse(m4dE,d,,rp_ang = rp_ang + pi_)
+ ifelse(`$1',,`E: tr_xy(-5,0); line from E to tr_xy(-3,0);
+ C: tr_xy(5,0); line from C to tr_xy(3,0)')')
+ ifinstr(`$4',E,
+ `A1: arc ifelse(`$2',R,c)cw from Bulk.end+ta_xy(-2,2.5) \
+ to Bulk.end+ta_xy(-2,-5.5) with .c at Bulk.end+ta_xy(-2,-1.5)
+ L1: line to Bulk.start+ta_xy(2,-5.5)
+ A2: arc ifelse(`$2',R,c)cw to Bulk.start+ta_xy(2,2.5) \
+ with .c at Bulk.start+ta_xy(2,-1.5)
+ L2: line to Bulk.end+ta_xy(-2,2.5)')
+ `$5'; manhattan ] ')
+ `emitters E0 ... En or collectors C0 ... Cn'
+define(`m4bi_Em',
+ ``$3'`$1': tr_xy(ifelse(`$3',E,-)(3+(`$1')*1.5),0)
+ `$3'm`$1': line from `$3'`$1' to tr_xy(ifelse(`$3',E,-)(1.2+(`$1')*1.5),4)
+ ifelse(`$2',,,`arrow m4c_l ht m4_Aht wid m4_Awd ifelse(`$2',d,<-) \
+ from 1/4 between `$3'm`$1'.start and `$3'm`$1'.end \
+ to 3/4 between `$3'm`$1'.start and `$3'm`$1'.end ')
+ ifelse(eval(`$1'>0),1,`m4bi_Em(eval(`$1'-1),`$2',`$3')')')
+
+ `Unijunction transistor ujt(linespec, R,P,E)
+ Bulk and terminals B1, B2, E defined
+ arg 2: drawn to the right of curr direction
+ arg 3: P-channel, default N
+ arg 4: envelope'
+define(`ujt',
+`[ ifelse(`$1',,,`eleminit_($1)')
+B1: Here
+ ifelse(`$1',,,`line to rvec_(rp_len/2-m4_U*2,0)')
+ Bl1: line to rvec_(0,ifelse(`$2',R,-)3.5*m4_U)
+Bulk: line from rvec_(-m4_U*0.5,0) \
+ to rvec_(m4_U*4.5,0)
+ Bl2: line from Bulk.end+vec_(-m4_U/2,0) \
+ to Bulk.end+vec_(-m4_U/2,ifelse(`$2',R,,-)3.5*m4_U) ifelse(`$1',,,`\
+ then to Bulk.c+vec_(rp_len/2,ifelse(`$2',R,,-)3.5*m4_U)')
+B2: Here
+E: Bulk.c+vec_(2*m4_U,ifelse(`$2',R,-)3.5*m4_U)
+ E1: line from E to Bulk.center
+ {arrow m4c_l from last line.ifelse(`$3',P,`end to 1',`start to 7')/8 \
+ between last line.start and last line.end wid m4_Awd ht m4_Aht }
+ ifelse(`$4',E,dnl
+ `Env: circle rad 4*m4_U with .c at Bulk.c')
+ `$5'; manhattan ] ')
+
+ `FETS: j_fet(linespec, R, P, E )
+ e_fet(linespec, R, P, E|S )
+ d_fet(linespec, R, P, E|S )
+ c_fet(linespec, R, P )
+ with terminals S, D, G.
+ arg 2: G pin drawn to right of curr direction
+ arg 3: P-channel, default N
+ arg 4: envelope'
+define(`j_fet',`mosfet(`$1',`$2',ifelse(`$3',P,u,d)GSDF,`$4',`$5')')
+ `Enhancement-mode FET e_fet(linespec,R,P,S,E)'
+define(`e_fet',`mosfet(`$1',`$2',
+ ifelse(`$4',S,`TFD'ifelse(`$3',P,u,d)S,`LEDSQ'ifelse(`$3',P,d,u)B),
+ `$4',`$5')')
+ `Depletion-mode FET d_fet(linespec,R,P,S,E)'
+define(`d_fet',`mosfet(`$1',`$2',
+ ifelse(`$4',S,`TFDR'ifelse(`$3',P,u,d)S,`LFDSQ'ifelse(`$3',P,d,u)B),
+ `$4',`$5')')
+ `Simplified switching c_fet(linespec,R,P)
+ arg 3: negated G pin'
+define(`c_fet',`mosfet(`$1',`$2',`ZSDF'ifelse(`$3',P,d)T,,`$4')')
+
+ ` The comprehensive mosfet(linespec,R,BDEFGLQRSTXZ,E)
+ Every drawn component is controlled by a letter or letter pair in arg 3;
+ adding or changing elements is easily done by adding a test for a letter
+ or letter sequence:
+ udB: center bulk connection pin; u or d arrow
+ D: D pin and lead
+ E: dashed substrate
+ F: solid-line substrate
+ udG: G pin to substrate at source; u or d arrow
+ udH: G pin to substrate at center; u or d arrow
+ L: G pin to channel (kept for compatibility
+ for now; the same as dM below)
+ udM: G pin to channel center or
+ u: pin at drain end, d: pin at source end
+ udMn: gates G0 to Gn as above
+ Pz: parallel zener diode
+ Q: connect B pin to S pin
+ R: thick channel
+ udS: S pin and lead; u or d arrow
+ dT: G pin to center of channel d: not circle
+ X: XMOSFET terminal
+ Z: simplified complementary MOS
+ arg 2: body drawn to right of curr direction
+ arg 4: envelope'
+define(`mosfet',
+ `define(`m4R',`ifelse(`$2',R,-)')dnl right orientation flag
+ define(`dna_',`ifelse(`$3',,DSEdMuBQ,`$3')')dnl
+ define(`m4s',ifinstr(dna_,Z,2.5,3.5))dnl size parameter
+[ ifelse(`$1',,
+ `tr_xy_init(,m4_U,m4R); S: tr_xy(-2,0); D: tr_xy(2,0)',
+ `eleminit_(`$1'); tr_xy_init(last line.c,m4_U,m4R)
+ S: last line.start; line from S to tr_xy(-2,0) \
+ then to tr_xy(-2,0)+vec_(0,m4R`'linethick pt__)
+ D: S+vec_(rp_len,0); line from D to tr_xy(2,0) \
+ then to tr_xy(2,0)+vec_(0,m4R`'linethick pt__)')
+ sc_draw(`dna_',B,
+ `B: tr_xy(0,0); Bl: line from B to tr_xy(0,m4s)
+ ifelse(m4a,,,`arrow m4c_l ht m4_Aht wid m4_Awd ifelse(m4a,d,<-) \
+ from tr_xy(0,m4s/2)-vec_(0,m4R`'m4_Aht/2) \
+ to tr_xy(0,m4s/2)+vec_(0,m4R`'m4_Aht/2) ')')
+ sc_draw(`dna_',D,
+ `Dl: line from tr_xy(2,0) \
+ to tr_xy(2,m4s)')
+ sc_draw(`dna_',E,
+ `Channel: line invis from tr_xy(-2.5,m4s) \
+ to tr_xy(2.5,m4s)
+ line from tr_xy(-2.5,m4s) \
+ to tr_xy(-1,m4s)
+ line from tr_xy(-0.5,m4s) \
+ to tr_xy(0.5,m4s)
+ line from tr_xy(1,m4s) \
+ to tr_xy(2.5,m4s)')
+ sc_draw(`dna_',F,
+ `Channel: line from ifinstr(dna_,Z,
+ `tr_xy(-2,m4s) \
+ to tr_xy(2,m4s)',
+ `tr_xy(-2.5,m4s) \
+ to tr_xy(2.5,m4s)')')
+ sc_draw(`dna_',G,
+ `G: tr_xy(-2,(m4s+3.5))
+ ifelse(m4a,,`Gl: line from tr_xy(-2,m4s) \
+ to G',
+ m4a,d,`Gl: arrow m4c_l from G to tr_xy(-2,m4s) ht m4_Aht wid m4_Awd',
+ m4a,u,`Gl: line from tr_xy(-2,m4s) \
+ to G; arrow m4c_l ht m4_Aht wid m4_Awd \
+ from tr_xy(-2,(m4s+3-m4_Aht/(m4_U))) \
+ to tr_xy(-2,(m4s+3))')')
+ sc_draw(`dna_',H,
+ `G: tr_xy(0,(m4s+4))
+ ifelse(m4a,,`Hl: line from tr_xy(0,m4s) \
+ to G',
+ m4a,d,`Hl: arrow m4c_l from G to tr_xy(0,m4s) ht m4_Aht wid m4_Awd',
+ m4a,u,`Hl: line from tr_xy(0,m4s) \
+ to G; arrow m4c_l ht m4_Aht wid m4_Awd \
+ from tr_xy(0,(m4s+3-m4_Aht/(m4_U))) \
+ to tr_xy(0,(m4s+3))')')
+ sc_draw(`dna_',L,
+ `G: tr_xy(-2,(m4s+3.5))
+ Ll: line from tr_xy(2,(m4s+1)) \
+ to tr_xy(-2,(m4s+1)) \
+ then to G')
+ for_(1,4,1,
+ `sc_draw(`dna_',M`'m4x,`m4mo_Mm(m4x,m4a,`$4',ifinstr(dna_,Z,2,2.5))')')
+ sc_draw(`dna_',M,`ifelse(
+ m4a,, `G: tr_xy(0,(m4s+4))
+ Glh: line from tr_xy(2,(m4s+1)) \
+ to tr_xy(-2,(m4s+1))
+ Glv: line from tr_xy(0,(m4s+1)) \
+ to G',
+ m4a,u,`G: tr_xy(2,(m4s+3.5))
+ Gl: line from tr_xy(-2,(m4s+1)) \
+ to tr_xy(2,(m4s+1)) \
+ then to G',
+ m4a,d,`G: tr_xy(-2,(m4s+3.5))
+ Gl: line from tr_xy(2,(m4s+1)) \
+ to tr_xy(-2,(m4s+1)) \
+ then to G')')
+ sc_draw(`dna_',Pz,
+ `define(`m4q',m4a)dnl
+ Diode: diode(ifelse(m4q,d,to,from) tr_xy(-2,-2) \
+ ifelse(m4q,d,from,to) tr_xy( 2,-2),Z)
+ ifelse(m4q,d,rp_ang = rp_ang + pi_)
+ line from tr_xy(-2,0) \
+ to tr_xy(-2,-2) \
+ then to tr_xy(2,-2) \
+ then to tr_xy(2,0)')
+ sc_draw(`dna_',Q,
+ `Ql: line from tr_xy(0,0)+vec_(0,m4R`'linethick pt__) \
+ to tr_xy(0,0) \
+ then to tr_xy(-2,0) \
+ then to tr_xy(-2,0)+vec_(0,m4R`'linethick pt__)')
+ sc_draw(`dna_',R,
+ `Rl: line thick 2*linethick from tr_xy(-2,m4s)\
+ -vec_(0,m4R`'linethick*3/2 pt__) \
+ to tr_xy(2,m4s)-vec_(0,m4R`'linethick*3/2 pt__) ')
+ sc_draw(`dna_',S,
+ `Sl: line from tr_xy(-2,0) \
+ to tr_xy(-2,m4s)
+ ifelse(m4a,,,`arrow m4c_l ht m4_Aht wid m4_Awd ifelse(m4a,d,<-) \
+ from tr_xy(-2,m4s/2)-vec_(0,m4R`'m4_Aht/2) \
+ to tr_xy(-2,m4s/2)+vec_(0,m4R`'m4_Aht/2) ')')
+ sc_draw(`dna_',T,
+ `Tl: line from tr_xy(-2,(m4s+1)) \
+ to tr_xy(2,(m4s+1))
+ ifelse(m4a,d,`Nt: circle rad m4_U*2/3 with .c at tr_xy(0,(m4s+1+2/3))')
+ Gl: line from tr_xy(0,`(m4s+1'`ifelse(m4a,d,+4/3))') \
+ to tr_xy(0,ifelse(`$4',E,(m4s+4),(m4s+4))); G: Here')
+ sc_draw(`dna_',X,dnl From Matteo Agostinelli
+ `B: tr_xy(0,0); Xv: line from B to tr_xy(0,m4s-1)
+ Xh: line from tr_xy(-1.5,m4s-1) \
+ to tr_xy(1.5,m4s-1)')
+ ifelse(`$4',E,`Env: circle rad 4*m4_U with .c at tr_xy(0,m4s)')
+ `$5'; manhattan ] ')
+define(`m4mo_Mm',dnl (m4n,m4a,[E])
+ `define(`m4mo_d',`eval((`$1')*2+1)')dnl
+ for_(0,`$1',1,
+ `define(`m4moc',`ifelse(`$2',u,
+ ` (`$4')-`$4'*4*m4x/m4mo_d',`-`$4'+`$4'*4*m4x/m4mo_d')')dnl
+ ifinstr(`$3',E,
+ `M4moM: move from tr_xy(m4moc,m4s) to tr_xy(m4moc,m4s+1)
+ G`'m4x: LCintersect(M4moM,tr_xy(0,m4s),4*m4_U,R)',
+ `G`'m4x: tr_xy(m4moc,m4s+4)')
+ Gm`'m4x: line from G`'m4x to tr_xy(m4moc,m4s+1) \
+ then to tr_xy(m4moc`'ifelse(`$2',u,-,+)2*`$4'/m4mo_d,m4s+1) ') ')
+
+ `Macro-internal coordinates adjusted for L|R'
+define(`ta_xy',`vec_(vscal_(m4_xyU,`$1',ifelse(`$2',0,0,m4_xyS`($2)')))')
+ `Relative adjusted macro-internal coordinates'
+define(`tr_xy',`M4_xyO+vec_(vscal_(m4_xyU,`$1',ifelse(`$2',0,0,m4_xyS`($2)')))')
+ `Initialize tr_xy_init(origin,unit,-)'
+define(`tr_xy_init',`M4_xyO: ifelse(`$1',,Here,`$1')
+define(`m4_xyU',`$2')dnl
+define(`m4_xyS',`$3')')
+
+ `Extract substring plus preceding char if u or d'
+define(`m4_dna',`define(`m4I_',index($1,`$2'))dnl
+ifelse(m4I_,-1,`define(`m4t',0)',`define(`m4t',eval(m4I_+len($2)))dnl
+define(`m4a',ifelse(substr($1,decr(m4I_),1),u,`define(`m4I_',decr(m4I_))'u,
+ substr($1,decr(m4I_),1),d,`define(`m4I_',decr(m4I_))'d))dnl
+define(`$1',substr($1,0,m4I_)`'substr($1,m4t))')')dnl
+
+ `Conditional subcomponent draw
+ sc_draw(dna string, chars, iftrue, iffalse)'
+define(`sc_draw',`m4_dna(`$1',`$2')ifelse(m4I_,-1,`$4',`$3')')
+
+ `Element labels to the left, right, centre of
+ the current direction. Labels are spaced and
+ treated as math, but copied literally if double
+ quoted or defined by sprintf'
+ `The hash (pound sign) is used in svg text so
+ we temporarily turn off comments for svg'
+define(`rlabel',`ifsvg(`changecom(,)')dnl
+m4label(`$1',`$2',`$3',.s_,below_,`$4')`'ifsvg(`changecom(`#',)')')
+define(`llabel',`ifsvg(`changecom(,)')dnl
+m4label(`$1',`$2',`$3',.n_,above_,`$4')`'ifsvg(`changecom(`#',)')')
+define(`clabel',`ifsvg(`changecom(,)')dnl
+m4label(`$1',`$2',`$3',,,`$4')`'ifsvg(`changecom(`#',)')')
+ labels at centre and both ends of an element `dimen_' long
+define(`m4label',`dnl
+ ifelse(`$1',,,
+ `{m4lstring(`$1',"sp_`'iflatex(`$ `$1'$',`$1')`'sp_") \
+ at last [].w_ $5 rjust_ $6};')dnl
+ ifelse(`$2',,,
+ `{m4lstring(`$2',"sp_`'iflatex(`$ `$2'$',`$2')`'sp_") \
+ at last []$4 $5 $6};')dnl
+ ifelse(`$3',,,
+ `{m4lstring(`$3',"sp_`'iflatex(`$ `$3'$',`$3')`'sp_") \
+ at last [].e_ $5 ljust_ $6};')dnl
+ ')
+ `Labels for oblique or aligned elements
+ dlabel(long,lateral,label,label,label,chars)
+ long, lateral: dispacement with respect to
+ drawing direction
+ chars:
+ X 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'
+define(`dlabel',`ifsvg(`changecom(,)')dnl
+ ifelse(`$3',,,
+ `{m4lstring(`$3',"iflatex(`$ `$3'$',` $3')") \
+ at last ifinstr(`$6',X,line,[]).c+vec_(-(`$1'),`$2') \
+ ifinstr(`$6',L,ljust,`$6',R,rjust) dnl
+ ifinstr(`$6',A,above,`$6',B,below) };') dnl
+ ifelse(`$4',,,
+ `{m4lstring(`$4',"iflatex(`$ `$4'$',` $4')") \
+ at last ifinstr(`$6',X,line,[]).c+vec_(0,`$2') \
+ ifinstr(`$6',L,ljust,`$6',R,rjust) dnl
+ ifinstr(`$6',A,above,`$6',B,below) };') dnl
+ ifelse(`$5',,,
+ `{m4lstring(`$5',"iflatex(`$ `$5'$',` $5')") \
+ at last ifinstr(`$6',X,line,[]).c+vec_(`$1',`$2') \
+ ifinstr(`$6',L,ljust,`$6',R,rjust) dnl
+ ifinstr(`$6',A,above,`$6',B,below) };') ifsvg(`changecom(`#',)')')
+
+ `eleminit_( linespec, default length )
+ compute element direction and length.
+ Eleminit_ defines the position, length,
+ and angle of two-terminal elements. It calls
+ rpoint_ with its linespec or circuit-element
+ default. The rpoint_ macro draws the invisible
+ line determined by its argument, calculates the
+ length and angle, and gives the angle to the
+ point_ macro to set the rotation parameters used
+ by vec_ and rvec_.'
+define(`eleminit_',
+ `rpoint_(ifelse(`$1',,`to rvec_(ifelse(`$2',,`elen_',`$2'),0)',`$1'))')
+
+ `parallel_(`elementspec', `elementspec', ...
+ Parallel combination of two-terminal elements
+ in a [ ] block. Each elementspec is quoted and
+ of the form
+ [Sep=val;][Label:] element; [attributes]
+ where an attribute is of the form
+ [llabel(...);]|[rlabel(...);][b_current(...);]
+ 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.
+ An argument may also be series_(args) or
+ parallel_(args) without attributes or quotes.
+ example:
+ define(`elen_',dimen_) setdir_(Down)
+ parallel_(
+ `resistor;llabel(,R);inductor(,W);llabel(,L)',
+ `capacitor;rlabel(,C)')
+'
+define(`parallel_',
+`[ ifdef(`m4rp_ang',rp_ang = m4rp_ang;) pwid = 0
+ stackargs_(`m4parR',$@) stackexec_(`m4parR',`m4parS')dnl
+ define(`m4br',0) define(`m4parsep',`m4sepdefault')dnl
+ stackdo_(`m4parS',
+ `define(`m4pel',m4parS)
+ setkey_(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): [
+ Start: Here
+ m4pel
+ End: Here
+ C: 0.5 between Start and End
+ ] ifelse(m4br,0,,`with .C at C`'m4br-vec_(0,m4Sep)')
+ define(`m4br',incr(m4br))dnl
+ Start`'m4br: E`'m4br.Start; End`'m4br: E`'m4br.End; C`'m4br: E`'m4br.C
+ pwid = max(pwid,distance(Start`'m4br,End`'m4br))
+ ')
+ U: Vdiff_(End1,Start1)
+ d = vlength(U.x,U.y); if d==0 then { d=1 } else { d = 1/d }
+ Unit: Vsprod_(U,d)
+ line from C1-(Vsprod_(Unit,pwid/2)) to C`'m4br-(Vsprod_(Unit,pwid/2)) \
+ chop -lthick/2
+ Start: last line.c
+ line from C1+Vsprod_(Unit,pwid/2) to C`'m4br+Vsprod_(Unit,pwid/2) \
+ chop -lthick/2
+ End: last line.c; C: 0.5 between Start and End
+ for_(1,m4br,1,`
+ line from Start`'m4x to C`'m4x-Vsprod_(Unit,pwid/2)
+ line from End`'m4x to C`'m4x+Vsprod_(Unit,pwid/2)')
+ ] with .Start at Here; move to last [].End
+')
+
+ `par_( element, element, separation )
+ Parallel combination of two branches that have
+ the same direction and length. The
+ branch arguments must be quoted, e.g.
+ par_(`resistor',`capacitor',dimen_)'
+` ***WARNING: this macro is considered obsolete'
+define(`par_',`[Start: Here; r = ifelse(`$3',,`dimen_',`$3')
+ { move to Start + vec_(0,r/2); $1 }
+ line from Start + vec_(0,r/2) \
+ to Start + vec_(0,-r/2) ; $2
+ line to rvec_(0,r)
+ End: last line.c; `$4'] with .Start at Here
+ move to last [].End')
+
+ `gpar_( element, element, separation )
+ Parallel combination of two branches that have
+ the same direction, e.g.:
+ down_; gpar_(
+ resistor;llabel(,R_1);resistor;llabel(,R_2),
+ capacitor;rlabel(,C))
+ This macro trades simplicity for generality
+ and robustness to gpic'
+` ***WARNING: this macro is considered obsolete'
+define(`gpar_',
+ `[ M4_B1: Here; `$1'; M4_E1: Here
+ M4_C: 0.5 between M4_B1 and M4_E1; eleminit_(from M4_B1 to M4_E1)
+ E2:[ M4_B: Here; `$2'; M4_E: Here; `$4'] \
+ with .c at M4_C + (rect_(ifelse(`$3',,`dimen_',`$3'),rp_ang-pi_/2))
+ M4_B2: E2.M4_B; M4_E2: E2.M4_E
+ s = distance(M4_B2,M4_E2)
+ if rp_len*s == 0 then { r = 1 } else { r = (1+max(rp_len/s, s/rp_len))/2 }
+ if rp_len < s then { Tmp:M4_B2; M4_B2:M4_B1; M4_B1:Tmp
+ Tmp:M4_E2; M4_E2:M4_E1; M4_E1:Tmp }
+ line from M4_B2 to r between M4_E2 and M4_B2
+ Start: 0.5 between Here and M4_B1; line to M4_B1
+ line from M4_E2 to r between M4_B2 and M4_E2
+ End: 0.5 between Here and M4_E1
+ C: 0.5 between Start and End; line to M4_E1 ] with .Start at Here
+ move to last [].End ')
+
+define(`m4sepdefault',`dimen_') `Default separation in the parallel_ macro'
+define(`m4lendefault',`dimen_') `Default length in the series_ macro'
+
+ `series_(elementspec, elementspec, ... )
+ 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
+ automatically.'
+define(`series_',
+`[ pushdef(`elen_',m4lendefault)dnl
+ stackargs_(`m4serR',$@) stackexec_(`m4serR',`m4serS')dnl
+ ifdef(`m4rp_ang',rp_ang = m4rp_ang;) Start: Here
+ stackdo_(`m4serS',`m4serS
+') End: Here;
+ C: 0.5 between Start and End
+ popdef(`elen_')] with .Start at Here; move to last [].End
+')
+
+
+ `reversed(`macro name in quotes', macro args)
+ reverse polarity of two-terminal element'
+define(`reversed',`eleminit_(`$2')
+ $1(from last line.end to last line.start,shift(shift($@)))
+ rp_ht = -rp_ht; rp_wid = -rp_wid; rp_ang = rp_ang - pi_
+ line invis to last line.start ')
+
+ `resized(factor,`macro name in quotes',args)
+ multiply element body size by factor'
+define(`resized',`define(`m4resiztmp',dimen_)define(`dimen_',(dimen_)*(`$1'))dnl
+ $2(shift(shift($@))) define(`dimen_',m4resiztmp)')
+
+ `variable(`element', type, angle, length)
+ overlaid arrow or line on two-terminal element
+ to show variablility: type = [A|P|L|[u]N][C|S]
+ A=arrow, P=preset, L=linear, N=nonlinear,
+ C=continuous, S=setpwise'
+define(`variable',`$1
+ {[ define(`dna_',`ifelse($2,,A,$2)') ang = ifelse(`$3',,45,`$3')
+ M4_T: Here+(Rect_(ifelse(`$4',,`dimen_*0.8',`$4'),ang))
+ sc_draw(`dna_',P,`Line: line to M4_T
+ [line to (Rect_(dimen_/6,ang-90))] at Line.end')
+ sc_draw(`dna_',L,`Line: line to M4_T')
+ sc_draw(`dna_',N,`Line: line to M4_T
+ ifelse(m4a,u,`line up dimen_/6 from Line.end',
+ `line left dimen_/6 from Line.start')')
+ sc_draw(`dna_',A,`Line: arrow to M4_T')
+ sc_draw(`dna_',C,`move to Line.end+(dimen_*0.10,-dimen_*0.06)
+ line to Here+(Rect_(dimen_/6,ang))')
+ sc_draw(`dna_',S,`move to Line.end+(dimen_*0.10,-dimen_*0.12)
+ line up dimen_*0.06 then right dimen_*0.12 then up dimen_*0.06')
+ `$5'] with .Line.c at last [].c } ')
+
+ `Line hopping over named 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,
+ `hlth',0)')dnl
+ ifelse(`$2',,,
+ `line to intersect_(last line.start,M4_Tmp,`$2'.start,`$2'.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($@)))')')
+
+ `NPDT(npoles,chars) Double throw switch
+ chars:
+ R = right orientation'
+define(`NPDT',`[define(`m4np',`ifelse(`$1',,1,`$1')')dnl
+define(`m4xR',ifinstr(`$2',R,R))define(`m4SR',ifelse(m4xR,R,-))dnl
+ for_(1,m4np,1,
+ `{ L`'ifelse(eval(m4np>1),1,m4x): dot(at rvec_(-dimen_/3,0),,1) }
+ { X: Here
+ T`'ifelse(eval(m4np>1),1,m4x): circle invis rad dotrad_ at X
+ lswitch(from X to X+vec_(dimen_/3,0),m4xR,D)
+ R`'ifelse(eval(m4np>1),1,m4x): circle invis rad dotrad_ at Here }
+ ifelse(eval(m4x<m4np),1,`move to rvec_(0,m4SR`'dimen_/2)') ')
+ ifelse(eval(m4np>1),1,`move to vec_(dimen_/6,m4SR`'dimen_/10)
+ DL: line dashed to rvec_(0,m4SR`'(m4np-3/4)*dimen_/2)')
+`$3']')
+
+ `relay(npoles,chars,[L|R])
+ arg1: Number of poles (max 10)
+ chars:
+ O = normally open
+ C = normally closed
+ P = three position
+ neither = double-throw (default)
+ L = drawn left (default)
+ R = drawn right
+ T = thermal
+ arg3: deprecated, kept for compatibility
+ L = drawn left (default)
+ R = drawn right '
+define(`relay',`[ define(`m4n',`ifinstr(`$2',R,-,`$3',R,-,0+)')
+V1: Here
+ L1: line to rvec_(dimen_/5,0)
+ Box: lbox(dimen_/5,dimen_/2)
+ ifinstr(`$2',T,`{move to rvec_(-dimen_/10,0)
+ line from rvec_(-dimen_/20,dimen_/6) \
+ to rvec_(-dimen_/20,dimen_/20) \
+ then to rvec_(dimen_/20,dimen_/20) \
+ then to rvec_(dimen_/20,-dimen_/20) \
+ then to rvec_(-dimen_/20,-dimen_/20) \
+ then to rvec_(-dimen_/20,-dimen_/6)}')
+ L2: line to rvec_(ifinstr(`$2',P,,2*)dimen_/5,0)
+V2: Here
+ move to V2+vec_(0,m4n (dimen_/4+dimen_/5))
+ m4_contacts(1,ifelse(`$1',,1,`$1'),
+ ifinstr(`$2',O,O,`$2',C,C)`'ifinstr(`$2',P,P)`'ifinstr(`$2',I,I),
+ ifinstr(`$3',R,R,`$2',R,R))
+ ifelse(`$1',,,`ifelse(eval(`$1'>1),1,`DL: line dashed \
+ from P1+vec_(dimen_*0.261,-(m4n dimen_/10)) \
+ to P`'ifelse(`$1',,1,`$1')+vec_(dimen_*0.261,m4n dimen_/10)')')
+ `$4'] ')
+define(`m4_contacts',`contact(`$3',`$4') with .O at Here
+ define(`m4v',`ifelse(`$1',,1,`$1')')dnl
+ P`$1': circle invis rad dotrad_ at last [].P
+ ifelse(`$3',O,,C`$1': last [].C)
+ ifelse(`$3',C,,O`$1': last [].O)
+ ifelse(m4v,`$2',,
+ `move to last[].C+(0,m4n dimen_/5)
+ ifelse(eval(m4v<11),1,`m4_contacts(incr(m4v),`$2',`$3',`$4')')')')
+
+ `reed(linespec,wid,ht,box attributes,[R][C])
+ Enclosed two-terminal reed contact;
+ R=right orientation;
+ C=closed;
+ e.g. reed(,,dimen_/5,shaded "lightgreen"'
+define(`reed',`eleminit_(`$1')
+ define(`m4wd',ifelse(`$2',,`dimen_*0.8',`($2)'))dnl
+ define(`m4ht',ifelse(`$3',,`dimen_*0.3',`($3)'))dnl
+ define(`m4ng',`ifinstr(`$5',R,-)')dnl
+ {line to rvec_(max(0,rp_len/2-m4wd/2),0)
+ {rotbox(m4wd,m4ht,$4,r=m4ht/2)}
+ {line to rvec_(m4wd*0.2,0) then to \
+ rvec_(m4wd*0.6,m4ng`'ifinstr(`$5',C,lthick,m4ht/3))}
+ line from rvec_(m4wd*0.5,0) to rvec_(m4wd,0)
+ line to rvec_(max(0,rp_len/2-m4wd/2),0)}
+ {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')
+
+ `contact(chars [,R]) Relay contact switch
+ Arg 2 deprecated, kept for compatibility
+ chars:
+ P|O|C= three position, normally open,
+ normally closed
+ R= right orientation (default left)
+ I= open circles for contacts'
+define(`contact',`[define(`m4n',`ifelse(ifinstr(`$1',R,R,`$2',R,R),R,-,0+)')dnl
+ define(`m4dr',`dotrad_')dnl
+ P: dot(,m4dr,1); line to rvec_(dimen_/2,0) chop m4dr chop 0
+ T: P+vec_(dimen_/2-dimen_/12,0)
+ O: circle invis rad dotrad_ at T+vec_(dimen_/5,-(m4n dotrad_))
+ C: circle invis rad dotrad_ at T+vec_(dimen_/5,m4n dotrad_)
+ ifinstr(`$1',O,,`move to T ifinstr(`$1',P,`+vec_(0,m4n`'dimen_/8)')
+ ifinstr(`$1',I,
+ `C: dot(at rvec_(0,m4n`'(m4dr`'ifinstr(`$1',P,*2)+lthick/2)),m4dr,1)',
+ `arrow m4c_l <- ht dimen_/6 wid dimen_/6 \
+ to rvec_(0,m4n`'dimen_/4) \
+ then to rvec_(dimen_/5,m4n`'dimen_/4)
+ C: Here')')
+ ifinstr(`$1',C,,`move to T+vec_(0,-(m4n`'dimen_/8))
+ ifinstr(`$1',I,
+ `O: dot(at rvec_(0,m4n`'(-m4dr*2)),m4dr,1)',
+ `arrow m4c_l <- ht dimen_/6 wid dimen_/6 \
+ to rvec_(0,-(m4n`'dimen_/4)) \
+ then to rvec_(dimen_/5,-(m4n`'dimen_/4))
+ O: Here')'); `$3'] ')
+
+
+ `ccoax(at location,M|F,diameter)'
+define(`ccoax',`[define(`m4cd',ifelse(`$3',,`dimen_*0.4',`$3'))dnl
+ S: circle diam m4cd
+ C: circle diam m4cd/3 fill_(ifinstr(`$2',F,1,0)) at S
+ `$4'] with .c ifelse(`$1',,`at Here',`$1')')
+
+ `tconn( linespec, >|>>|<|<<|O[F], wid)
+ terminal connector
+ O=node (circle); OF=filled circle
+ > (default) or >> =output
+ < or << =input
+ arg3 is arrowhead width or circle diam'
+define(`tconn',
+ `define(`m4ph',`ifelse(`$3',,`dimen_/6',`($3)/2')')dnl
+ define(`m4ps',`dimen_/8') define(`m4cd',`ifelse(`$3',,`dimen_/5',`$3')')dnl
+ eleminit_(`$1',dimen_*3/4)
+ M4Ss: last line.start; M4Se: last line.end
+ ifelse(ifinstr(`$2',0,O,`$2'),O,
+ `{circle diam m4cd ifinstr(`$2',OF,`fill_(0)') ifinstr(`$2',0F,`fill_(0)') \
+ at (m4cd)/2/distance(M4Ss,M4Se) between M4Se and M4Ss}
+ {line to last line.end chop 0 chop m4cd}',
+ `$2',<<,
+ `{line to last line.end chop 0 chop m4ps+m4ph
+ {line from rvec_(m4ph,m4ph) to Here then to rvec_(m4ph,-m4ph)}
+ move to rvec_(m4ps,0)
+ line from rvec_(m4ph,m4ph) to Here then to rvec_(m4ph,-m4ph)}',
+ `$2',<,
+ `{line to last line.end chop 0 chop m4ph
+ line from rvec_(m4ph,m4ph) to Here then to rvec_(m4ph,-m4ph)}',
+ `$2',>>,
+ `{line to last line.end chop 0 chop m4ps
+ {line from rvec_(-m4ph,m4ph) to Here then to rvec_(-m4ph,-m4ph)}
+ move to rvec_(m4ps,0)
+ line from rvec_(-m4ph,m4ph) to Here then to rvec_(-m4ph,-m4ph)}',
+ `{line to last line.end
+ line from rvec_(-m4ph,m4ph) to Here then to rvec_(-m4ph,-m4ph)}')
+ line invis to M4Se')
+
+ `tbox( text,wid,ht,<|>|<>,type )
+ Pointed terminal box.
+ text is placed at centre of rectangle in math mode
+ unless it starts with a double quote or sprintf
+ arg4= > point on right end (default)
+ < point on left end; <> both ends
+ Defaults: wid dimen_*2/3 ht dimen_/3
+ type= eg dotted outlined "red"
+ eg tbox(`$V_2$', 30pt__, 15pt__,,fill_(0.9) )'
+define(`tbox',`[ define(`m4td',`ifelse(`$4',,>,`$4')')
+ pushdef(`m4tw2',`ifelse(`$2',,(dimen_*0.4),`(($2)/2)')')dnl
+ pushdef(`m4th2',`ifelse(`$3',,(dimen_/6),`(($3)/2)')')dnl
+ N: vec_(0,m4th2)
+ NE: N+vec_(m4tw2 ifinstr(m4td,>,-m4th2),0)
+ E: vec_(m4tw2,0)
+ SE: NE+vec_(0,-m4th2*2)
+ NW: N-vec_(m4tw2 ifinstr(m4td,<,-m4th2),0)
+ W: vec_(-m4tw2,0)
+ SW: NW+vec_(0,-m4th2*2)
+ C: 0.5 between SW and NE
+ line from N to NE ifinstr(m4td,>,then to E) then to SE \
+ then to SW ifinstr(m4td,<,then to W) then to NW then to N `$5'
+ move to C
+ ifelse(`$1',,,`m4lstring(`$1',`"iflatex(`$ `$1'$',` $1')"')')
+ `$6' popdef(`m4th2') popdef(`m4tw2') ]')
+
+ `pconnex(R|L|U|D|degrees,chars)
+ arg1: drawing direction
+ chars:
+ R=right orientation
+ M|F= male, female
+ A[B]|AC =115V 3-prong, B=box (default), C=circle
+ P= PC connector
+ D= 2-pin connector
+ G[B]|GC= 3-pin, B=default, C=circle
+ J= 110V 2-pin '
+define(`pconnex',
+ `[ define(`m4sgn',ifinstr(`$2',F,,-))define(`m4R_',ifinstr(`$2',R,-))dnl
+ setdir_(`$1')
+ define(`m4na_',`ifelse(`$2',,A,`$2')')dnl
+ ifinstr(m4na_,A,`
+ Base: ifinstr(m4na_,AC,`circle diam dimen_',`[lbox(dimen_,dimen_) ]')
+ N: m4pconpin(dimen_/12,dimen_*0.3,m4na_) \
+ at Base+vec_(m4sgn`'(-dimen_*0.2),m4R_`'dimen_*0.15)
+ H: m4pconpin(dimen_/12,dimen_*0.25,m4na_) \
+ at Base+vec_(m4sgn`'(dimen_*0.2),m4R_`'dimen_*0.15)
+ gd = dimen_/12
+ G: [ifelse(ifgpic(T)`'ifinstr(m4na_,F,,T),TT,
+ `circle fill_(m4fill) rad gd at vec_(0,m4R_`'gd/2)
+ box fill_(m4fill) wid 2*gd ht gd at vec_(0,0)',
+ `arc ifinstr(m4na_,R,,c)cw rad gd from vec_(gd,m4R_`'gd/2) \
+ to vec_(-gd,m4R_`'gd/2) with .c \
+ at vec_(0,m4R_`'gd/2) ifinstr(m4na_,F,,
+ `ifdef(`r_',`shaded rgbstring(r_,g_,b_)',`fill_(m4fill)')')
+ line from vec_(-gd,m4R_`'gd/2) \
+ to vec_(-gd,m4R_`'(-gd/2)) \
+ then to vec_(gd,m4R_`'(-gd/2)) \
+ then to vec_(gd,m4R_`'gd/2) ifinstr(m4na_,F,,
+ `ifdef(`r_',`shaded rgbstring(r_,g_,b_)',`fill_(m4fill)')')')
+ ] at Base+vec_(0,m4R_`'(-dimen_*0.25))',
+ m4na_,P,
+ `wd = dimen_; hd = wd*3/4
+ Base: [line to vec_(-wd/2,0) \
+ then to vec_(-wd/2,-hd*2/3) \
+ then to vec_(-wd/2+hd/3,-hd) \
+ then to vec_(wd/2-hd/3,-hd) \
+ then to vec_(wd/2,-hd*2/3) \
+ then to vec_(wd/2,0) \
+ then to Here]
+ N: m4pconpin(dimen_/12,dimen_*0.25,m4na_) \
+ at Base+vec_(m4sgn`'(-dimen_*0.2),m4R_`'dimen_*0.15)
+ H: m4pconpin(dimen_/12,dimen_*0.25,m4na_) \
+ at Base+vec_(m4sgn`'(dimen_*0.2),m4R_`'dimen_*0.15)
+ G: m4pconpin(dimen_/12,dimen_*0.20,m4na_) \
+ at Base+vec_(0,m4R_`'(-dimen_*0.15))',
+ m4na_,D,
+ `wd = dimen_*1.2; hd = wd/2
+ Base: [line to vec_(wd-hd,0)
+ arc rad hd/2 ccw to rvec_(0,hd) with .c at rvec_(0,hd/2)
+ line to rvec_(hd-wd,0)
+ arc rad hd/2 ccw to rvec_(0,-hd) with .c at rvec_(0,-hd/2) ]
+ H: m4pcrpin(dimen_/6,m4na_) at Base.c+vec_( (wd-hd)/2,0)
+ N: m4pcrpin(dimen_/6,m4na_) at Base.c+vec_(-(wd-hd)/2,0)',
+ m4na_,G,
+ `wd = dimen_*1.3; hd = dimen_*1.2
+ Base: ifinstr(m4na_,GC,`circle diam wd',
+ `[line to vec_(wd/2,0) \
+ then to vec_(wd/2,-hd*0.3) \
+ then to vec_(hd*0.15,-hd) \
+ then to vec_(-hd*0.15,-hd)\
+ then to vec_(-wd/2,-hd*0.3) \
+ then to vec_(-wd/2,0) \
+ then to Here ]')
+ H: m4pconpin(dimen_*0.25,dimen_/8,m4na_) \
+ at Base.c+vec_(-dimen_/3,dimen_*0.3)
+ N: m4pconpin(dimen_*0.25,dimen_/8,m4na_) \
+ at Base.c+vec_( dimen_/3,dimen_*0.3)
+ G: m4pconpin(dimen_/8,dimen_*0.25,m4na_) \
+ at Base.c+vec_(0,-dimen_/3)',
+ m4na_,J,
+ `wd = dimen_; hd = wd/2
+ Base: [line to vec_(wd/2,0) \
+ then to vec_(wd/2,hd) \
+ then to vec_(-wd/2,hd) \
+ then to vec_(-wd/2,0) \
+ then to Here ]
+ H: m4pconpin(dimen_/12,dimen_*0.25,m4na_) at Base.c+vec_( wd/4,0)
+ N: m4pconpin(dimen_/12,dimen_*0.25,m4na_) at Base.c+vec_(-wd/4,0)
+ ')
+ `$3' ; resetdir_ ]')
+define(`m4pconpin',`[ifinstr(`$3',F,`lbox(`$1',`$2')',
+ `m4fshade(m4fill,lbox(`$1',`$2'))')]')
+define(`m4pcrpin',`[ifinstr(`$2',F,`circle diam `$1'',
+ `m4fshade(m4fill,circle diam `$1')')]')
+
+ `Header(1|2,rows,wid,ht,type)
+ arg1: number of columns
+ arg2: pins per column
+ arg3,4: custom sizes
+ arg5: eg fill_(0.9)'
+define(`Header',
+`[define(`m4Hm',`ifelse(`$2',,2,`$2')')define(`m4Hn',`ifelse(`$1',,1,`$1')')dnl
+ define(`m4Hw',`ifelse(`$3',,`m4Hn*L_unit*3',`($3)')')dnl
+ define(`m4Hh',`ifelse(`$4',,`m4Hm*L_unit*3',`($4)')')dnl
+ Block: rotbox(m4Hw,m4Hh,`$5')
+ define(`m4Hct',1)dnl
+ for_(1,m4Hm,1,
+ `HeaderPin(Block.NW+vec_(L_unit*3/2,-(m4x-1/2)*m4Hh/m4Hm),
+ eval(m4Hct-1), P`'m4Hct,w) define(`m4Hct',incr(m4Hct))
+ ifelse(m4Hn,2,`HeaderPin(Block.NE+vec_(-L_unit*3/2,-(m4x-1/2)*m4Hh/m4Hm),
+ 1, P`'m4Hct,e) define(`m4Hct',incr(m4Hct))') ')
+ `$6' ]')
+ `HeaderPin(location,type,Picname,
+ n|e|s|w,length)'
+define(`HeaderPin',`define(`m4Hpl',`ifelse(`$5',,`lg_plen*L_unit',`$5')')dnl
+ move to `$1'
+ line to ifelse(`$4',n,`rvec_(0,m4Hpl)',
+ `$4',e,`rvec_(m4Hpl,0)',`$4',s,`rvec_(0,-m4Hpl)',`rvec_(-m4Hpl,0)')
+ ifelse(`$3',,,`$3': Here)
+ ifelse(`$3',,,Pin`$3':) ifelse(`$2',0,
+ `rotbox(L_unit,L_unit,fill_(1))',
+ `circle diam L_unit fill_(1)') at last line.start ')
+
+ `nport(box specs; other commands,
+ nw,nn,ne,ns,
+ space ratio,pin lgth,style,other commands)
+ 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'
+define(`nport',`[Box: box `$1'
+ r = ifelse(`$6',,2.0,`$6')
+ plg = ifelse(`$7',,`dimen_/4',`$7')
+# `West side'
+ define(`m4n',`ifelse(`$2'`$3'`$4'`$5',,1,`$2',,0,`($2)')')
+ d = Box.ht/(m4n*(r+1)+1)
+ move to Box.nw+(0,-d); down_
+ m4portpins(-plg,d*r,d,W,`$8')
+# `North side'
+ ifelse(`$3',,,`define(`m4n',`($3)')
+ d = Box.wid/(m4n*(r+1)+1)
+ move to Box.nw+(d,0); right_
+ m4portpins(plg,d*r,d,N,`$8')')
+# `East side'
+ define(`m4n',`ifelse(`$2'`$3'`$4'`$5',,1,`$4',,0,`($4)')')
+ d = Box.ht/(m4n*(r+1)+1)
+ move to Box.ne+(0,-d); down_
+ m4portpins(plg,d*r,d,E,`$8')
+# `South side'
+ ifelse(`$5',,,`define(`m4n',`($5)')
+ d = Box.wid/(m4n*(r+1)+1)
+ move to Box.sw+(d,0); right_
+ m4portpins(-plg,d*r,d,S,`$8')')
+ `$9']')
+define(`m4portpins',`for_(1,m4n,1,
+ `{ if (`$1' != 0) then { line to rvec_(0,`$1') }
+ `$4'`'m4x`'a: ifelse(xtract(`$5',N),N,Here,`dot') }
+ move to rvec_(`$2',0)
+ { if (`$1' != 0) then { line to rvec_(0,`$1') }
+ `$4'`'m4x`'b: ifelse(xtract(`$5',N),N,Here,`dot') }
+ ifelse(m4x,m4n,,`move to rvec_(`$3',0)')')')
+
+ `gyrator(box specs,space ratio,pin lgth,style)
+ 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
+ sc_draw(`m4dna_',H,
+ `nport(ifelse(`$1',,wid boxht,`$1'),1,,1,,`$2',`$3',`$4',
+ line from (Box,W1a)+(-Box.wid/2,0) \
+ left -Box.wid/4 then down W1a.y-W1b.y then right -Box.wid/4
+ arcd(Box+(-Box.wid/4,0),(W1a.y-W1b.y)/3,-90,-270)
+ line from (Box,W1a)+(Box.wid/2,0) \
+ left Box.wid/4 then down W1a.y-W1b.y then right Box.wid/4
+ arcd(Box+(Box.wid/4,0),(W1a.y-W1b.y)/3,90,270)
+ `$5')')dnl
+ sc_draw(`m4dna_',V,
+ `nport(ifelse(`$1',,wid boxht,`$1'),,1,,1,`$2',`$3',`$4',
+ line from (N1a,Box)+(0,-Box.ht/2) \
+ down -Box.ht/4 then right N1b.x-N1a.x then up -Box.ht/4
+ arcd(Box+(0,-Box.ht/4),(N1b.x-N1a.x)/3,-90+90,-90+270)
+ line from (N1a,Box)+(0,Box.ht/2) \
+ down Box.ht/4 then right N1b.x-N1a.x then up Box.ht/4
+ arcd(Box+(0,Box.ht/4),(N1b.x-N1a.x)/3,90+90,90+270)
+ `$5')') ')
+
+ `nullator(linespec, wid, ht)'
+define(`nullator',`eleminit_(`$1')
+ define(`m4wd',ifelse(`$2',,`dimen_/2',`($2)'))dnl
+ define(`m4ht',ifelse(`$3',,`dimen_/4',`($3)'))dnl
+ {line to rvec_(max(0,rp_len/2-m4wd/2),0)
+ move to rvec_(m4wd/2,0)
+ { spline ifdpic(0.58) from rvec_(ifdpic(0,-m4wd/20),m4ht/2) \
+ to rvec_(m4wd/20*3,m4ht/2) \
+ then to rvec_(m4wd/2,m4ht/4) \
+ then to rvec_(m4wd/2,-m4ht/4) \
+ then to rvec_(m4wd/20*3,-m4ht/2) \
+ then to rvec_(-m4wd/20*3,-m4ht/2) \
+ then to rvec_(-m4wd/2,-m4ht/4) \
+ then to rvec_(-m4wd/2,m4ht/4) \
+ then to rvec_(-m4wd/20*3,m4ht/2) \
+ then to rvec_(ifdpic(0,m4wd/20),m4ht/2)
+ }
+ line from rvec_(m4wd/2,0) \
+ to rvec_(max(0,rp_len/2),0)}
+ {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')
+ `norator(linespec, wid, ht)'
+define(`norator',`eleminit_(`$1')
+ define(`m4wd',ifelse(`$2',,`dimen_/2',`($2)'))dnl
+ define(`m4ht',ifelse(`$3',,`dimen_/4',`($3)'))dnl
+ {line to rvec_(max(0,rp_len/2-m4wd/2),0)
+ move to rvec_(m4wd/2,0)
+ for i=-1 to 1 by 2 do { {
+ spline to rvec_(i*m4wd/4,m4ht/2) \
+ then to rvec_(i*m4wd/2,m4ht/2) \
+ then to rvec_(i*m4wd/2,-m4ht/2) \
+ then to rvec_(i*m4wd/4,-m4ht/2) \
+ then to Here } }
+ line from rvec_(m4wd/2,0) \
+ to rvec_(max(0,rp_len/2),0)}
+ {[box invis ht_ m4ht wid_ m4wd] at rvec_(rp_len/2,0)}
+ line to rvec_(rp_len,0) invis ')
+
+ `n-terminal box
+ nterm(box specs; other commands,
+ nw,nn,ne,ns,
+ pin lgth,style,other commands)
+ The default is three-terminal. 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) '
+define(`nterm',`[Box: box ifelse(`$1',,wid dimen_ ht dimen_*2/3,`$1')
+ plg = ifelse(`$6',,`dimen_/4',`$6')
+# `West side'
+ define(`m4n',`ifelse(`$2'`$3'`$4'`$5',,1,`$2',,0,`($2)')')
+ d = Box.ht/(m4n+1)
+ move to Box.nw+(0,-d); down_
+ m4termpins(-plg,d,W,`$7')
+# `North side'
+ ifelse(`$3',,,`define(`m4n',`($3)')
+ d = Box.wid/(m4n+1)
+ move to Box.nw+(d,0); right_
+ m4termpins(plg,d,N,`$7')')
+# `East side'
+ define(`m4n',`ifelse(`$2'`$3'`$4'`$5',,1,`$4',,0,`($4)')')
+ d = Box.ht/(m4n+1)
+ move to Box.ne+(0,-d); down_
+ m4termpins(plg,d,E,`$7')
+# `South side'
+ define(`m4n',`ifelse(`$2'`$3'`$4'`$5',,1,`$5',,0,`($5)')')
+ d = Box.wid/(m4n+1)
+ move to Box.sw+(d,0); right_
+ m4termpins(-plg,d,S,`$7')
+ `$8']')
+define(`m4termpins',`for_(1,m4n,1,
+ `{ if (`$1' != 0) then { line to rvec_(0,`$1') }
+ `$3'`'m4x: ifelse(xtract(`$4',N),N,Here,`dot') }
+ ifelse(m4x,m4n,,`move to rvec_(`$2',0)')')')
+
+ `speaker(U|D|L|R|degrees, vert size, type)
+ type=H horn'
+define(`speaker',`[setdir_($1,R)
+ define(`m4v',`ifelse(`$2',,`dimen_/3',`($2)/4')')dnl
+ define(`m4h',`m4v*sqrt(2)')dnl
+ ifelse(`$3',H,
+ `{H1: line from rvec_(m4h,m4v/2) \
+ to rvec_(m4h*3/2,m4v*7/8) \
+ then to rvec_(m4h*3/2,-m4v*7/8) \
+ then to rvec_(m4h,-m4v/2)}',
+ `{H1: line from rvec_(m4h,m4v) \
+ to rvec_(m4h*2,m4v*2) \
+ then to rvec_(m4h*2,-m4v*2) \
+ then to rvec_(m4h,-m4v)}')
+ {lbox(m4h,m4v*2)}
+ {Box: box invis ht_ m4v*2 wid_ m4h at rvec_(m4h/2,0)}
+ In1: rvec_(0,m4v/2)
+ In2: Here
+ In3: rvec_(0,-m4v/2)
+ In4: rvec_(m4h/4,m4v)
+ In5: rvec_(m4h*3/4,m4v)
+ In6: rvec_(m4h/4,-m4v)
+ In7: rvec_(m4h*3/4,-m4v)
+ `$4'; resetdir_ ]')
+
+ `bell(U|D|L|R|degrees, vert size)'
+define(`bell',`[setdir_($1,R)
+ define(`m4h',`ifelse(`$2',,`dimen_/2',`($2)')')dnl
+ {lbox(m4h,m4h)}
+ {Box: box invis ht_ m4h wid_ m4h at rvec_(m4h/2,0)}
+ {Circle: circle diameter m4h at rvec_(m4h*3/2,0)}
+ In1: rvec_(0,m4h/4)
+ In2: Here
+ In3: rvec_(0,-m4h/4)
+ `$3'; resetdir_ ]')
+ `microphone(U|D|L|R|degrees, vert size)'
+define(`microphone',`[setdir_($1,R)
+ define(`m4h',`ifelse(`$2',,`dimen_/2',`($2)')')dnl
+ {L1: line from rvec_(m4h,-m4h/2) \
+ to rvec_(m4h,m4h/2)}
+ {Circle: circle diameter m4h at rvec_(m4h/2,0)}
+ In1: rvec_(m4h*(2-sqrt(3))/4,m4h/4)
+ In2: Here
+ In3: rvec_(m4h*(2-sqrt(3))/4,-m4h/4)
+ `$3'; resetdir_ ]')
+ `buzzer(U|D|L|R|degrees, vert size,[C])'
+define(`buzzer',`[setdir_($1,R)
+ ifelse(`$3',,
+ `define(`m4h',`ifelse(`$2',,`dimen_/2',`($2)')')dnl
+ {L1: line from rvec_(m4h,0) \
+ to rvec_(m4h,m4h/2) \
+ then to rvec_(0,m4h/2) \
+ then to rvec_(0,-m4h/2) \
+ then to rvec_(m4h,-m4h/2) \
+ then to rvec_(m4h,0)}
+ {Box: box invis ht_ m4h wid_ m4h at rvec_(m4h/2,0)}
+ {L2: line from rvec_(m4h,m4h/2) \
+ to rvec_(m4h,m4h/2)+vec_(Rect_(m4h,-75))}
+ In1: rvec_(0,m4h/4)
+ In2: Here
+ In3: rvec_(0,-m4h/4)',
+ `$3',C,`define(`m4h',`ifelse(`$2',,`(dimen_/3)',`(($2)/2)')')dnl
+ {Face: line from rvec_(m4h,-m4h) \
+ to rvec_(m4h,m4h)}
+ {arc ccw from Face.end to Face.start with .c at Face.c}
+ In1: rvec_(m4h-sqrt(m4h^2-(m4h/3)^2),m4h/3)
+ In2: Here
+ In3: rvec_(m4h-sqrt(m4h^2-(m4h/3)^2),-m4h/3)')
+ `$4'; resetdir_ ]')
+ `earphone(U|D|L|R|degrees, size, [C][R])
+ earphone pair if arg3 contains C'
+define(`earphone',`[ setdir_($1,R)
+ define(`m4h',`ifelse(`$2',,`dimen_',`($2)')')dnl
+ ifinstr(`$3',C,
+ `L: circle diam m4h*0.4
+ R: circle diam m4h*0.4 at L+vec_(m4h,0)
+ C: 0.5 between L and R
+ N: C+(vscal_(m4h/2,Vperp(L,R)))
+ Lx: Cintersect(L,L.rad,C,m4h/2,`$3')
+ Rx: Cintersect(C,m4h/2,R,R.rad,`$3')
+ arc ifinstr(`$3',R,c)cw rad m4h/2 from Lx to Rx with .c at C',
+ `{lbox(m4h/3,m4h/2)}
+ {Box: box invis ht_ m4h/2 wid_ m4h/3 at rvec_(m4h/6,0)}
+ {L1: line thick 2*linethick from rvec_(m4h/3+linethick pt__,-m4h/3) \
+ to rvec_(m4h/3+linethick pt__, m4h/3) }
+ In1: rvec_(0,m4h/8)
+ In2: Here
+ In3: rvec_(0,-m4h/8)')
+ `$4'; resetdir_ ]')
+ `Signal-flow graph macros: labeled node,
+ directed labeled chopped straight line,
+ directed labeled chopped arc, and a self
+ loop. All are contained in [] blocks.'
+
+ `Signal-flow graph initialization macro
+ sfg_init(line len, node rad, arrowhd len, arrowhd wid)'
+ifdef(`sfg_init',,
+`define(`sfg_init',`cct_init
+ sfg_wid = ifelse(`$1',,`(linewid/0.75*(2.5+0.25)/4)',(`$1'))# default line len
+ sfg_rad = ifelse(`$2',,(0.25/4/2),(`$2')) # node radius
+ sfg_aht = ifelse(`$3',,(0.25/4),(`$3')) # arrow height (arrowhead length)
+ sfg_awid = ifelse(`$4',,`sfg_aht',(`$4')) # arrowhead width
+ ')')
+ `sfgline(linespec,
+ text,sfgabove|sfgbelow|ljust|rjust,
+ attributes)
+ Draw a straight line with linespec, chopped by
+ node radius, with optional label'
+define(`sfgline',`eleminit_(`$1',sfg_wid)
+[ L1: line to rvec_(rp_len,0) chop sfg_rad `$4'
+Start: last line.start
+End: Here
+ move to last line.c
+ ifelse(ifinstr(`$4',->,T,`$4',<-,T),,
+ `{ arrow m4c_l ht sfg_aht wid sfg_awid from rvec_(-sfg_aht/2,0) \
+ to rvec_(sfg_aht/2,0) }')
+ ifelse(`$2',,,`"iflatex(`$ `$2'$',` $2')" ifelse(`$3',,`sfgabove',`$3')')
+ ] with .Start at rvec_(sfg_rad,0)
+ move to last [].End
+ ')
+ `Like above_ or below_ but adding extra space
+ to put text above or below arrowheads or nodes'
+define(`sfgabove',`at Here+(0,sfg_awid/2) above')
+define(`sfgbelow',`at Here+(0,-sfg_awid/2) below')
+
+ `sfgnode(at pos,text,above_,circle options)
+ Node: a white circle, possibly labelled. The
+ default label position is inside if the
+ diameter is bigger than textht and textwid'
+define(`sfgnode',
+ `[C: circle fill_(1) rad sfg_rad ifelse(`$4',,`thickness 0.5',`$4')] with .c \
+ ifelse(`$1',,`at rvec_(sfg_rad,0)',`$1')
+ move to last [].c
+ ifelse(`$2',,,
+ `if 2*sfg_rad > Max(textwid,textht,10pt__) \
+ then { {"iflatex(`$ `$2'$',` $2')" `$3'} } \
+ else { {"iflatex(`$ `$2'$',` $2')" ifelse(`$3',,`sfgabove',`$3')} }')
+ ')
+ `sfgarc(linespec,label,above_,cw|ccw,sfact)
+ An arc between nodes at the endpoints of the
+ linespec. The resulting positions Start, End,
+ C (arc center) and M (arc midpoint) are defined.
+ The fifth argument scales the arc height above
+ its chord.'
+define(`sfgarc',`eleminit_(`$1',sfg_wid)
+[ Start: Here
+ End: Start + vec_(rp_len,0)
+ chordht = (rp_len/sqrt(2)-rp_len/2)ifelse(`$5',,,`*($5)')
+ arcrd = (chordht^2+(rp_len)^2/4)/chordht/2
+ C: 0.5 between Start and End; C: C+vec_(0,ifelse(`$4',ccw,,-)(arcrd-chordht))
+ M: C + vec_( 0,ifelse(`$4',ccw,-)arcrd)
+ ifelse(ifinstr(`$1',->,T)ifinstr(`$1',<-,T),,
+ `arc -> m4c_l ifelse(`$4',ccw,ccw,cw) \
+ from Cintersect(Start,sfg_rad,C,arcrd,ifelse(`$4',ccw,R)) \
+ to Cintersect(C,arcrd,M,sfg_aht/2,ifelse(`$4',ccw,,R)) \
+ ht sfg_aht wid sfg_awid with .c at C
+ arc m4c_l ifelse(`$4',ccw,ccw,cw) from M \
+ to Cintersect(C,arcrd,End,sfg_rad,ifelse(`$4',ccw,R)) with .c at C',
+ `arc m4c_l patsubst(patsubst(`$1',.*<-,<-),->.*$,->) ifelse(`$4',ccw,ccw,cw)\
+ from Cintersect(Start,sfg_rad,C,arcrd,ifelse(`$4',ccw,R)) \
+ to Cintersect(C,arcrd,End,sfg_rad,ifelse(`$4',ccw,R)) with .c at C')
+ ifelse(`$2',,,`{move to M; "iflatex(`$ `$2'$',` $2')" ifelse(`$3',,
+ `sfgabove',`$3')}')
+ ] with .Start at last line.start
+ move to last line.end
+ ')
+ `sfgself(at position,U|D|L|R|degrees,label,above_,cw|ccw,sfact,
+ [-> | <- | <->])
+ A teardrop-shaped self-loop drawn at "angle"
+ degrees from "positon". The resulting Origin
+ and M (arc midpoint) are defined. The sixth
+ argument scales the loop. The seventh puts
+ the arrowhead at the beginning, end, or both'
+define(`sfgself',`[ Origin: Here
+ setdir_(`$2',U)
+ d = ifelse(`$6',,,`($6)*') sfg_wid/2; d = d * max(1,sfg_rad/(0.3605*d))
+ { m4sfgselfcurve(-,
+ ifelse(`$5',ccw,`ifinstr(`$7',<-,<-)',`ifinstr(`$7',->,<-)'))
+ M: Here
+ ifelse(`$7',,`{ arrow m4c_l from rvec_(0,ifelse(`$5',cw,,-)sfg_aht/2) \
+ to rvec_(0,ifelse(`$5',cw,-)sfg_aht/2) ht sfg_aht wid sfg_awid }')
+ ifelse(`$3',,,
+ `"iflatex(`$ `$3'$',` $3')" ifelse(`$4',,`sfgabove',`$4')') }
+ m4sfgselfcurve(,
+ ifelse(`$5',ccw,`ifinstr(`$7',->,<-)',`ifinstr(`$7',<-,<-)'))
+ resetdir_ ] with .Origin ifelse(`$1',,at Here,`$1')
+ move to last [].Origin
+ ')
+define(`m4sfgselfcurve',`spline `$2' m4c_l from rvec_(Rect_(sfg_rad,`$1'30)) \
+ to rvec_(0.3*d,`$1'0.2*d) \
+ then to rvec_(0.6*d,`$1'0.35*d) \
+ then to rvec_(0.9*d,`$1'0.35*d) \
+ then to rvec_(d,`$1'0.2*d) \
+ then to rvec_(d,0)')
+
+ `winding(L|R,diam, pitch, nturns, core wid, core color )
+ The complete spline is drawn, then parts of it are
+ 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'
+define(`winding',`[ define(`m4rt',`ifinstr(`$1',R,-)')
+ d = ifelse(`$2',,`dimen_',`$2')
+ p = ifelse(`$3',,d/4,`$3')
+ define(`m4n0',`ifelse(`$4',,1,`eval(`$4'-1)')')dnl
+ w = ifelse(`$5',,d*3/4,`$5')
+ W: spline from (0,0) to (0,0) dnl
+ for_(0,m4n0,1,
+ `then to vec_(m4rt`'(m4x*p),d) \
+ then to vec_(m4rt`'(m4x*p+p/2),d) \
+ then to vec_(m4rt`'(m4x*p+p/2),0)`'ifelse(m4x,m4n0,,` \
+ then to vec_(m4rt`'(m4x*p+p),0) \')')
+ if w > 0 then {
+ dx = sign(p)*(linethick+0.5)/2 bp__
+ vx = p*min(w/d/8+dx/p,0.25)
+ for i=0 to m4n0 do {
+ line color ifelse(`$6',,rgbstring(1,1,1),m4lstring(`$6',"`$6'")) \
+ thick max(w/(1bp__)-linethick,0) \
+ from vec_(m4rt`'(i*p-dx),d/2) \
+ to vec_(m4rt`'(i*p+vx),d/2)
+ dx = vx }
+ }
+ T1: W.ifinstr(`$1',R,end,start)
+ T2: W.ifinstr(`$1',R,start,end)
+ `$7']')
+
+ `tstrip(U|D|L|R|degrees, n, chars)
+ Terminal strip
+ n=integer number of terminals (default 4)
+ chars:
+ I=invisible terminals
+ C=circle terminals (default)
+ D=dot terminals
+ O=omitted internal lines
+ wid=val; total strip width
+ ht=val; strip height '
+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
+ {Box: [shade(1,lbox(m4wid,m4ht))] }
+ bw = m4wid/(m4n)
+ ifinstr(`$3',O,,`for i=1 to m4n-1 do {
+ {move to rvec_(i*bw,-m4ht/2); line to rvec_(0,m4ht)}}')
+ 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')
+ resetdir_ ]')
+
+ `jack(U|D|L|R|degrees, chars)
+ Phone jack; arg1 sets drawing direction
+ chars:
+ L|LM|LB|LMB=long and aux contacts; M|B make|break arrows
+ S|SM|SB|SMB=short and aux contacts; M|B make|break arrows
+ R=right orientation with respect to drawing direction '
+define(`jack',`[ setdir_(`$1')
+ define(`dna_',`ifelse(`$2',,L,`$2',R,L,`$2')')dnl
+ s=ifinstr(dna_,R,-1,1)
+ ght = dimen_/2
+ {Sleeve: [shade(1,lbox(dimen_/12,ght))] }
+ G: Sleeve+vec_(0,-ght/2*s)
+ F: Sleeve+vec_(dimen_/24,0)
+ aht = dimen_/8
+ Q: Sleeve+vec_(-dimen_*0.7,s*(ght*0.45-aht*3))
+ define(`m4jbm',) m4auxcontacts(`dna_',L,s,)
+ Q: Sleeve+vec_(-dimen_*0.7,(aht*3-ght*0.45)*s)
+ define(`m4jbm',) m4auxcontacts(`dna_',S,-s,)
+ `$3'; resetdir_ ] ')
+
+define(`m4auxcontacts',`ifinstr($1,$2,
+ `define(`m4I_',index($1,$2))dnl
+ define(`m4abm',ifelse(substr($1,incr(m4I_),1),M,
+ M`'ifelse(substr($1,eval(2+m4I_),1),B,B),
+ substr($1,incr(m4I_),1),B,
+ B`'ifelse(substr($1,eval(2+m4I_),1),M,M)))dnl
+ define(`$1',substr($1,0,m4I_)`'substr($1,eval(m4I_+len(m4abm)+1)))dnl
+ cht = aht*ifelse(ifinstr(m4jbm,M,T)`'ifinstr(m4abm,B,T),TT,3.9,3)
+ Z: jackcontact(ifelse(`$2',S,0.5,0.6)*dimen_,m4abm`'ifelse($4,,,H),$3) \
+ with .T at Q+vec_(0,$3*cht)
+ $2`'$4: Z.T; Q: $2`'$4 define(`m4jbm',m4abm)
+ ifinstr(m4abm,M, $2`'M`'$4: Z.M) ifinstr(m4abm,B,; $2`'B`'$4: Z.B)
+ m4auxcontacts(`$1',$2,$3,ifelse($4,,1,`incr($4)'))')')
+
+ `jackcontact(length,chars,sign)
+ Phone jack contact to left
+ chars:
+ R: right orientation to drawing direction
+ M|B: make|break contact arrows '
+define(`jackcontact',`[ Point: (0,0)
+ line from Point ifinstr(`$2',H,`-vec_(dimen_/10,0)',
+ `to vec_(-dimen_/16,neg_(`$3')*dimen_/16) \
+ then to vec_(-dimen_/8,0) then') \
+ to vec_(neg_(`$1'),0)
+ T: dot(,,1)
+ C: T+vec_(dimen_/5,0)
+ ifinstr(`$2',H,`
+ Connector: [shade(1,lbox(dimen_/24,cht))] \
+ at T+vec_((`$1')-dimen_*0.16,neg_(`$3')*cht/2)')dnl
+ ifinstr(`$2',M,`
+ M: C+vec_(0,`$3'*aht*1.9)
+ arrow m4c_l <- ht aht wid aht from C+vec_(0,`$3'*aht*0.4) \
+ to M ')dnl
+ ifinstr(`$2',B,`
+ B: C+vec_(0,neg_(`$3')*aht*1.5)
+ arrow m4c_l <- ht aht wid aht from C to B ') ; `$4' ] ')
+
+ `plug(U|D|L|R|degrees, chars)
+ Phone plug; arg1 sets drawing direction
+ chars:
+ 2|3= two|three conductor
+ R= right orientation wrt drawing direction '
+define(`plug',`[ setdir_(`$1')
+ s=ifinstr(`$2',R,-1,1)
+ ght = ifinstr(`$2',3,`dimen_*0.5',`dimen_*0.4')
+ A: Here
+ AA: line to rvec_(dimen_*0.3,0) \
+ then to rvec_(dimen_*0.3,s*ght/3) \
+ then to rvec_(dimen_*0.7,s*ght/3); TA: dot(,,1)
+ ifinstr(`$2',3,`
+ C: A+vec_(0,s*ght/2)
+ TC: line from C to C+vec_(dimen_*0.6,0); TC: Here
+ B: 2 between A and C',`B: A+vec_(0,s*ght)')
+ BB: line from B to B+vec_(dimen_*0.3,0) \
+ then to B+vec_(dimen_*0.3,-s*ght/3) \
+ then to B+vec_(dimen_*0.6,-s*ght/3); TB: Here
+ `$3'; resetdir_ ]')
+
+ `A dabble in quantum circuits:
+ SQUID(n,diameter,initial angle,cw|ccw)
+ 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_'
+define(`SQUID',
+`[ define(`m4sqn',`ifelse(`$1',,2,`$1')')dnl
+ define(`m4ssz',`ifelse(`$2',,`dimen_',`$2')')dnl
+ define(`m4sof',`ifelse(`$3',,-90,`$3')')dnl
+ define(`m4ssg',`ifelse(`$4',,+,`$4',ccw,+,-)(m4x-1)/(m4sqn)*360')dnl
+ define(`m4sxlen',C.rad/4)dnl
+
+ C: circle diam m4ssz
+ for_(1,m4sqn,1,
+ `move to C+vec_(Rect_(C.rad,m4sof`'m4ssg))
+ J`'m4x: Here
+ { line from rvec_(Rect_(m4sxlen,m4sof`'m4ssg+45)) \
+ to rvec_(Rect_(m4sxlen,m4sof`'m4ssg+225)) }
+ { line from rvec_(Rect_(m4sxlen,m4sof`'m4ssg-45)) \
+ to rvec_(Rect_(m4sxlen,m4sof`'m4ssg-225)) }')
+ `$5' ]')
+
+`==============================================================================
+ Customizations:
+ The size and style parameters below can be
+ 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'
+
+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
new file mode 100644
index 00000000000..0b7212b513f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/libgen.m4
@@ -0,0 +1,1680 @@
+divert(-1)
+
+ libgen.m4 Base macros for dpic and gpic diagrams
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+==========================================================================
+
+define(`libgen_')
+ Change gpic to e.g., pgf or pstricks to
+ redefine the default configuration file:
+
+ifdef(`m4picprocessor',,`include(gpic.m4)divert(-1)
+define(`m4defaultproc',m4picprocessor)')
+
+==========================================================================
+
+ HOMELIB_ is the absolute path to the directory
+ containing libgen.m4. Circuit macros do not
+ need it because m4 reads installation files
+ automatically if invoked correctly; this macro
+ allows the path to be passed to the pic
+ processor, e.g., put the following line in the
+ diagram source to read dpictools.pic:
+ copy "HOMELIB_`'dpictools.pic"
+ or invoke the macro NeedDpicTools.
+ The following definition of HOMELIB_ works for
+ GNU m4 which defines `__file__'; otherwise
+ change the blank in the third line below to the
+ absolute path of the installation directory.
+ifdef(`__file__',
+`define(`HOMELIB_',patsubst(__file__,libgen\.m4,))',
+`define(`HOMELIB_', )')
+ To use the Mingw-compiled version of dpic,
+ change HOMELIB_ to the absolute Windows path of
+ the installation folder, e.g.
+dnl define(`HOMELIB_',`D:\Dwight\lib')
+
+define(`NeedDpicTools',`if "dpictools" != "1" then {
+ copy "HOMELIB_`'dpictools.pic" } define(`dfitpoints__') define(`dfitcurve__') ')
+ Processor shortcuts
+define(`ifdpic',`ifelse(m4picprocessor,dpic,`$1',`$2')')
+define(`ifgpic',`ifelse(m4picprocessor,gpic,`$1',`$2')')
+
+define(`ifmfpic',`ifelse(m4postprocessor,mfpic,`$1',`$2')')
+define(`ifmpost',`ifelse(m4postprocessor,mpost,`$1',`$2')')
+define(`ifpdf',`ifelse(m4postprocessor,pdf,`$1',`$2')')
+define(`ifpgf',`ifelse(m4postprocessor,pgf,`$1',`$2')')
+define(`ifpostscript',`ifelse(m4postprocessor,postscript,`$1',`$2')')
+define(`ifpstricks',`ifelse(m4postprocessor,pstricks,`$1',`$2')')
+define(`ifsvg',`ifelse(m4postprocessor,svg,`$1',`$2')')
+define(`iftpic',`ifelse(m4postprocessor,tpic,`$1',`$2')')
+define(`ifxfig',`ifelse(m4postprocessor,xfig,`$1',`$2')')
+#efine(`ifpsfrag',ifinstr(ifdef(`psfrag',T)`'ifdef(`psfrag_',T),T,`$1',`$2'))
+define(`ifpsfrag',ifelse(ifdef(`psfrag',T,`ifdef(`psfrag_',T)'),T,`$1',`$2'))
+
+ `iflatex(latextrue,latexfalse)
+ Test for LaTeX text including
+ postscript with psfrag'
+define(`iflatex',`ifelse(
+ ifpdf(F)`'ifpostscript(`ifpsfrag(,F)')`'ifsvg(F)`'ifxfig(F),F,`$2',`$1')')
+==========================================================================
+
+ Initializations (one of the following must
+ be invoked at the beginning of a diagram):
+
+ libcct.m4
+ifdef(`cct_init',,
+`define(`cct_init',
+ `m4announceprocessor(`$0')
+ ifdef(`libcct_',,`include(libcct.m4)')
+ gen_init
+ psset_(arrowsize=1.1pt 4,arrowlength=1.64,arrowinset=0)
+dnl Customizations can be put here or in arg1
+`$1'
+`# cct'_init end
+')')
+
+ libgen.m4
+ifdef(`gen_init',,
+`define(`gen_init',
+ `m4announceprocessor(`$0')
+ ifdef(`libgen_',,`include(libgen.m4)')
+
+ define(`if_rpoint__')`define rpoint__' {
+ rp_wid = last line.end.x-last line.start.x
+ rp_ht = last line.end.y-last line.start.y
+ rp_len = vlength(rp_wid,rp_ht); move to last line.start
+ifgpic(` if (rp_len == 0) then { rp_ang=0 } else {')dnl
+ rp_ang = atan2(rp_ht,rp_wid)ifgpic(` }') }
+
+ define(`rtod__',`57.295779513082323')`rtod_' = rtod__;dnl
+ define(`dtor__',`0.017453292519943295')`dtor_' = dtor__
+ define(`twopi__',`6.2831853071795862')`twopi_' = twopi__;dnl
+ define(`pi__',`(twopi_/2)')`pi_' = pi__
+ rp_ang = 0; right_
+ define(`ctension_',`0.551784')dnl
+
+ ifmpost(`defineRGBprimaries')
+ ifpostscript(`defineRGBprimaries
+ command " 0.8 setlinewidth"',
+ `thicklines_')
+ ifpstricks(M4PatchPSTricks)
+ ifgpic(linethick = 0.8)
+dnl Insert customizations as desired,
+dnl e.g. ifmpost(` ... ') etc
+ifdef(`local_init',`
+`# local'_init start
+local_init
+`# local'_init end
+') `$1' dnl Customizations in arg1
+`# gen'_init end
+')')
+
+ darrow.m4
+ifdef(`darrow_init',,
+`define(`darrow_init',
+ `m4announceprocessor(`$0')
+ ifdef(`darrow_',,`include(darrow.m4)')
+`# darrow_init begin'
+ gen_init
+`$1'
+`# darrow_init end'')')
+
+ liblog.m4
+ifdef(`log_init',,
+`define(`log_init',
+ `m4announceprocessor(`$0')
+ ifdef(`liblog_',,`include(liblog.m4)')
+`# log_init begin'
+ gen_init
+`$1'
+`# log_init end'')')
+
+ lib3D.m4
+ifdef(`threeD_init',,
+`define(`threeD_init',
+ `m4announceprocessor(`$0')
+ ifdef(`lib3D_',,`include(lib3D.m4)')
+`# threeD_init begin'
+ gen_init
+ setview(20,20,0)
+`$1'
+`# threeD_init end'')')
+
+ sfg graphs in libcct.m4
+define(`sfg_init',`cct_init
+ sfg_wid = ifelse(`$1',,`(linewid/0.75*(2.5+0.25)/4)',(`$1'))# default line len
+ sfg_rad = ifelse(`$2',,(0.25/4/2),(`$2')) # node radius
+ sfg_aht = ifelse(`$3',,(0.25/4),(`$3')) # arrow height (arrowhead length)
+ sfg_awid = ifelse(`$4',,`sfg_aht',(`$4')) # arrowhead width
+ ')
+==========================================================================
+
+ Pic SI defaults
+ Slightly smaller lengths than for inches
+define(`SIdefaults',
+`scale = 25.4 # Coordinates in mm
+ # Set defaults to integer values of mm
+ lineht = 12
+ linewid = 12
+ moveht = 12
+ movewid = 12
+ arcrad = 6
+ circlerad = 6
+ boxht = 12
+ boxwid = 18
+ ellipseht = 12
+ ellipsewid = 18
+ dashwid = 2
+ maxpswid = 8.5*25.4
+ maxpsht = 11.5*25.4
+')
+
+ `Conditionally add mpost code for latex command'
+define(`latexcommand',`command "ifmpost(verbatimtex) `$1' ifmpost(etex)"')
+
+define(`m4announceprocessor',`dnl Do not change the format of the next line:
+`#' `$1' Version 9.0: ifelse(m4picprocessor,gpic,`Gpic',
+ m4postprocessor,pstricks,`PSTricks',
+ m4postprocessor,pgf,`TikZ PGF',
+ m4postprocessor,mfpic,`Mfpic',
+ m4postprocessor,xfig,`Xfig',
+ m4postprocessor,svg,`SVG',
+ m4postprocessor,postscript,`Postscript',
+ m4postprocessor,pdf,`PDF',
+ m4postprocessor,mpost,`MetaPost',
+ `Default') m4 macro settings.ifelse(m4defaultproc,gpic,`
+`#' 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(`left_',`define(`m4dir',left)define(`m4rp_ang',pi_)dnl
+define(`m4a_',(-1))define(`m4b_',0)define(`m4c_',0)define(`m4d_',(-1)) m4dir')
+
+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(`down_',`define(`m4dir',down)define(`m4rp_ang',(-pi_/2))dnl
+define(`m4a_',0)define(`m4b_',(-1))define(`m4c_',1)define(`m4d_',0) m4dir')
+
+ `savem4dir([`stackname'])
+ Save the current m4 direction parameters'
+define(`savem4dir',`define(`m4ss_',`ifelse(`$1',,savm4dir`'_,`$1')')
+pushdef(m4ss_`'_,m4dir)dnl
+pushdef(m4ss_`'_,m4a_)dnl
+pushdef(m4ss_`'_,m4b_)dnl
+pushdef(m4ss_`'_,m4c_)dnl
+pushdef(m4ss_`'_,m4d_)')
+ `restorem4dir([`stackname'])
+ Restore the current m4 direction parameters'
+define(`restorem4dir',`define(`m4ss_',`ifelse(`$1',,savm4dir`'_,`$1')')
+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_`'_)')
+
+ 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(`m4c_',`neg_(m4b_)')dnl
+define(`m4d_',`m4a_')')
+ Default current coordinates
+define(`m4tx',Here.x)
+define(`m4ty',Here.y)
+ Arbitrary direction cosines
+ `Point_(integer degrees,[D])'
+ `D in the second argument simplifies
+ output for common angles and is useful
+ for debug but requires care when
+ the result is used inside dpic looping'
+define(`Point_',`ifinstr(`$2',D,`ifelse(dnl
+`$1',0,`rp_ang = 0; right_',
+`$1',90,`rp_ang = pi_/2; up_',
+`$1',-90,`rp_ang = -pi_/2; down_',
+`$1',180,`rp_ang = pi_; left_',
+`$1',-180,`rp_ang = pi_; left_',
+`$1',270,`rp_ang = -pi_/2; down_',
+`$1',-270,`rp_ang = pi_/2; up_',
+`rp_ang = prod_(`$1',dtor_);dnl
+define(`m4a_',cos(rp_ang))define(`m4b_',sin(rp_ang))dnl
+define(`m4c_',(-sin(rp_ang)))define(`m4d_',cos(rp_ang))')',
+`rp_ang = prod_(`$1',dtor_);undefine(`m4rp_ang')dnl
+define(`m4a_',cos(rp_ang))define(`m4b_',sin(rp_ang))dnl
+define(`m4c_',(-sin(rp_ang)))define(`m4d_',cos(rp_ang))')')
+
+ `setdir_( U|D|L|R|degrees,default R|L|U|D|degrees )
+ set direction and default direction'
+define(`setdir_',
+ `pushdef(`m4sdir',`ifelse(`$1',,`ifelse(`$2',,R,`$2')',`$1')')dnl
+ m4sd_ang = rp_ang; pushdef(`m4tdir',m4dir)dnl
+ifinstr(
+ m4sdir,R,`rp_ang = 0; right_',
+ m4sdir,L,`rp_ang = pi_; left_',
+ m4sdir,U,`rp_ang = pi_/2; up_',
+ m4sdir,D,`rp_ang = -pi_/2; down_',
+`rp_ang = prod_(`$1',dtor_)undefine(`m4rp_ang')dnl
+ define(`m4a_',cos(rp_ang))define(`m4b_',sin(rp_ang))dnl
+ define(`m4c_',(-sin(rp_ang)))define(`m4d_',cos(rp_ang))');dnl
+ popdef(`m4sdir')')
+ `restore direction'
+define(`resetdir_',`m4xpand(m4tdir`'_) popdef(`m4tdir'); point_(m4sd_ang)')
+
+ `point_(radians)'
+define(`point_',
+`ifelse(`$1',rp_ang,,`rp_ang = `$1'')undefine(`m4rp_ang')
+ define(`m4a_',cos(rp_ang))define(`m4b_',sin(rp_ang))dnl
+ define(`m4c_',(-sin(rp_ang)))define(`m4d_',cos(rp_ang))dnl
+')
+ `rpoint_( linespec )
+ (Gpic returns NaN for atan2(0,0)):'
+define(`rpoint_',`line invis ifelse(`$1',,linewid/10,`$1')
+ ifdef(`if_rpoint__',`rpoint__',
+ `rp_wid = last line.end.x-last line.start.x
+ rp_ht = last line.end.y-last line.start.y
+ rp_len = vlength(rp_wid,rp_ht); move to last line.start
+ ifgpic(`if (rp_len == 0) then { rp_ang=0 } else { ')dnl
+ rp_ang = atan2(rp_ht,rp_wid) ifgpic(` }')')
+ point_(rp_ang)' )
+ `direction_( U|D|L|R|degrees,default R|L|U|D|degrees )
+ obsolete but kept for compatibility'
+define(`direction_',`setdir_($@)')
+
+ Evaluate the argument as a macro
+define(`m4xpand',`$1')
+ `Enclose dpic position in parentheses
+ to allow position expressions as arguments'
+ifdpic(
+`define(`M4Pos',`($1)')',
+`define(`M4Pos',`$1')')
+ `Polar to rectangular coords, returning a pair
+ rect_(radius,radians)'
+define(`rect_',`vscal_(`$1',cos(`$2'),sin(`$2'))')
+ `Rect_(radius,degrees)'
+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
+define(`Polar_',`vlength(`$1',`$2'),rtod_*atan2(`$2',`$1')')
+
+ `arcr( position, radius,
+ start radians, end radians,
+ modifiers, ht)
+ Unique ccw arc. If arg 5 contains -> or <-
+ then a midpoint arrowhead of ht given by arg6
+ is added. Modifiers following the macro apply
+ to the main arc only. Examples:
+ arcr((5,0),0.5,0,pi_/2)
+ arcr((5,0),1,0,pi_/2,dotted outlined "red" -> wid 5bp__ ,4bp__) ->
+'
+define(`arcr',`define(`M4arcrC',`M4Pos(ifelse(`$1',,Here,`$1'))')dnl
+ define(`m4arad',`ifelse(`$2',,arcrad,`$2')')dnl
+ define(`m4Sang',`ifelse(`$3',,0,`$3')')dnl
+ define(`m4Eang',`ifelse(`$4',,pi_/2,`$4')')dnl
+ arc invis from M4arcrC+(rect_(m4arad,m4Sang)) \
+ to M4arcrC+(rect_(m4arad,m4Eang)) \
+ rad m4arad with .c at M4arcrC
+ M4aCtr: last arc.c; M4aStart: last arc.start; M4aEnd: last arc.end
+ ifelse(ifinstr(`$5',->,T,`$5',<-,T),T,
+ `{ if m4arad == 0 then { m4and = arcrad } else { m4and = m4arad }
+ m4aang = ifelse(`$6',,arrowht,`$6')/m4and
+ m4ama = (m4Sang+(m4Eang))/2; if `$4' < `$3' then { m4ama = m4ama+pi_ }
+ arc `$5' from M4aCtr+(rect_(m4arad,m4ama-m4aang/2)) \
+ to M4aCtr+(rect_(m4arad,m4ama+m4aang/2)) rad m4arad \
+ with .c at M4aCtr ifelse(`$6',,,ht `$6') }')
+ arc patsubst(patsubst(`$5',->,),<-,) \
+ from M4aStart to M4aEnd rad m4arad with .c at M4aCtr ')
+
+ `arcd( position, radius,
+ start degrees, end degrees,
+ attributes, ht)
+ Like arcr but with angles in degrees:
+ eg arcd(Here,0.5,0,90) dashed'
+define(`arcd',`arcr(`$1',`$2',
+ ifelse(`$3',,,(`$3')*dtor_),
+ ifelse(`$4',,,(`$4')*dtor_),
+ `$5',`$6')')
+
+ `arca(absolute chord linespec, ccw|cw, radius,
+ modifiers)
+ Unique acute-angle arc, obtuse if radius is -ve,
+ drawn in a [] block.'
+define(`arca',`[Chord: line invis `$1'
+ dy = Chord.end.y-Chord.start.y; dx = Chord.end.x-Chord.start.x
+ ssq = max(0,dx*dx+dy*dy)
+ drad = max(sqrt(ssq)/2,ifelse(`$3',,arcrad,abs(`$3')))
+ if ssq==0 then { dfac = 1 } else { dfac = sqrt(max(0,drad^2/ssq-0.25)) }
+ ifelse(`$3',,,`dfac = sign(`$3')*dfac;')dnl
+ arc `$2' `$4' from Chord.start to Chord.end rad drad \
+ with .c at Chord.c ifelse(`$2',cw,-,+)(-dy*dfac,dx*dfac)
+ Origin: (0,0) ] with .Origin at (0,0) ')
+
+ `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')')')
+
+ `Integer m4 while loop: while_(`test',`actions')
+ eg define(`i',5)
+ while_(`i>0',`print i; define(`i',decr(i))') '
+define(`while_',`ifelse(eval($1),1,`$2`'while_(`$1',`$2')')')
+
+ `Loopover_(`variable',actions,value1,value2,...)
+ Repeat actions with variable set to each of
+ value1, value2, ... in succession, setting
+ 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
+Loopover_(`$1',`$2',shift(shift(shift($@))))popdef(`m4Lx')popdef(`$1')')')
+
+ `Transfer m4 stack to new stack performing arg3
+ stackexec_(`Source',`Dest',`actions')'
+define(`stackexec_',`ifdef(`$1',`$3`'dnl
+ifelse(`$2',,,`pushdef(`$2',$1)')popdef(`$1')stackexec_(`$1',`$2',`$3')')')
+
+ Empty a stack to first blank, executing arg2
+define(`stackdo_',`ifdef(`$1',`ifelse(`$1',,`popdef(`$1')',
+`$2`'popdef(`$1')stackdo_(`$1',`$2')')')')dnl
+
+ `Print out m4 stack contents
+ stackprint_(`Stackname' [,label])'
+define(`stackprint_',`print ""
+print ifelse(`$2',,"`stack `$1':'","`$2'")
+stackexec_(`$1',`m4stp__',`
+print ifelse(`$1',,"blank","`$1'")')
+stackexec_(`m4stp__',`$1')')
+
+ `Message to the terminal during m4 execution'
+define(`m4msg',`syscmd(echo "$@" >/dev/stderr)')
+ `Dump stack to the terminal during m4 execution'
+define(`m4stackmsg',`stackexec_(`$1',`m4Btmp',
+`syscmd(echo $1 >/dev/console)')dnl
+stackexec_(`m4Btmp',`$1')')
+
+ `Copy m4 stack
+ stackcopy_(`Source',`Dest',[`count'])'
+define(`stackcopy_',`undefine(`$2')ifelse(`$3',,,`define(`$3',0)')dnl
+stackexec_(`$1',`m4C__',`ifelse(`$3',,,`define(`$3',incr($3))')')dnl
+stackexec_(`m4C__',`$1',`pushdef(`$2',m4C__)')')
+
+ `stackreverse_(`Stackname')
+ Reverse m4 stack'
+define(`stackreverse_',`stackexec_(`$1',`m4R__')stackexec_(`m4R__',`m4S__')dnl
+stackexec_(`m4S__',`$1')')
+
+ `stacksplit_(`Stackname',string,sep)
+ Stack fields of arg2 separated by nonblank
+ substring (default .) left to right'
+define(`stacksplit_',`define(`m4sep',`ifelse(`$3',,.,`$3')')dnl
+ifinstr(`$2',m4sep,`pushdef(`$1',substr(`$2',0,index(`$2',m4sep)))dnl
+stacksplit_(`$1',substr(`$2',incr(index(`$2',m4sep))),m4sep)',
+`pushdef(`$1',`$2')')')
+
+ `basename_(path,sep)
+ Extract rightmost name from arg2-separated
+ path, default dot (.)'
+define(`basename_',`ifelse(index($1,ifelse(`$2',,.,`$2')),-1,`$1',
+`basename_(substr($1,incr(index($1,ifelse(`$2',,.,`$2')))))')')
+
+ `stackargs_(`Stackname',args)
+ Stack arg2, arg3, ... onto the named stack'
+define(`stackargs_',
+`ifelse(`$2',,,`pushdef(`$1',`$2')stackargs_(`$1',shift(shift($@)))')')
+
+ `Intersect_(Name1,Name2)
+ Intersection of named lines'
+define(`Intersect_',`intersect_($1.start,$1.end,$2.start,$2.end)')
+
+ `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')')
+
+ `Dashed line drawn in detail
+ dashline(linespec,
+ thickness|<-|->|<->|color,
+ dash len, gap len,G)
+ Arg5=G ends (but does not start)
+ the line with a gap'
+define(`dashline',`rpoint_(`$1')define(`m4opts',`$2')
+ define(`m4dsh',`ifelse(`$3',,dashwid,abs(`$3'))')dnl
+ define(`m4ssv',`ifelse(`$4',,m4dsh/2,abs(`$4'))')dnl
+ define(`m4lar',)define(`m4rar',)dnl
+ ifelse(m4xtract(`m4opts',<->),1,`define(`m4lar',<-)define(`m4rar',->)',
+ m4xtract(`m4opts',<-),1,`define(`m4lar',<-)',
+ m4xtract(`m4opts',->),1,`define(`m4rar',->)')dnl
+ if (m4dsh+m4ssv)==0 then { dashline_n = 1 } \
+ else {dashline_n = max(1,\
+ int(abs((rp_len ifelse(`$5',G,,+m4ssv))/(m4dsh+m4ssv))))}
+ dashline_f = (rp_len-(dashline_n ifelse(`$5',G,,-1))*m4ssv)/dashline_n
+ for m4ti=1 to dashline_n do {
+ if m4ti==1 then { line m4opts m4lar to rvec_(dashline_f,0) } \
+ else { if m4ti==dashline_n then { line m4opts m4rar to rvec_(dashline_f,0)}\
+ else { line m4opts to rvec_(dashline_f,0) }}
+ ifelse(`$5',G,,
+ `if m4ti < dashline_n then {')move to rvec_(m4ssv,0)ifelse(`$5',G,,})
+ } ')
+
+ `round(at location,line thickness,attributes)
+ filled circle for rounded corners'
+define(`round',`{ circle thick ifelse(`$2',,`linethick/2',(`$2')/2) \
+ diameter ifelse(`$2',,`linethick',`($2)')/2 pt__ \
+ ifelse(`$1',,`at Here',`$1') $3} ifelse(`$1',,,`; move to last circle .c')')
+
+ `corner(line thickness,attributes,turn radians)
+ arg1 default: current thickness
+ arg2: e.g. outlined "string"; if arg2 starts
+ with at position ... then a manhattan corner
+ is drawn
+ arg3 default: filled square to make 90
+ degree angle
+ arg3= radians (turn angle, +ve is ccw)'
+define(`corner',`define(`m4lth',`ifelse(`$1',,linethick,`($1)')')dnl
+define(`m4lfr',`(m4lth bp__)/lin_leng(last line)/2')dnl
+ ifelse(substr(`$2',0,2),at,
+ `line m4lth bp__ thick m4lth with .c $2; move to last line.c',
+ `{ifelse(`$3',,
+ `line thick m4lth from Along_(last line,m4lth bp__/2,R) \
+ to 1+m4lfr along_(last line) $2',
+ `line thick m4lth from Along_(last line,m4lth bp__/2,R) to Here \
+ then to Here+(rect_((m4lth bp__/2),lin_ang(last line)+(`$3'))) $2')}' )')
+
+ `mitre_(Position1,Position2,Position3,
+ length,line attributes)
+ eg mitre_(A,B,C) draws angle ABC with legs
+ of length arg4 (default linethick bp__/2)
+ sets Here to Position2'
+define(`mitre_',`{[ define(`m4lth2',`ifelse(`$4',,hlth,`$4')')dnl
+ M4mA: line invis from `$2' to `$1'
+ M4mC: line invis from `$2' to `$3'
+ line `$5' from Along_(M4mA,m4lth2) to `$2' then to Along_(M4mC,m4lth2)
+ ] with .M4mA.start at `$2'}
+ move to `$2'')
+
+ `Mitre_(Line1,Line2,length,line attributes)
+ eg mitre_(L,M) draws angle with legs
+ of length arg3 (default linethick bp__/2)
+ sets Here to intersection of Line1 and Line2'
+define(`Mitre_',
+ `M4TpA: `$1'.c
+ M4TpB: Intersect_(`$1',`$2')
+ M4TpC: `$2'.c
+ mitre_(M4TpA,M4TpB,M4TpC,shift(shift($@)))')
+
+ `Technical drawing centerline:
+ centerline_(linespec, thickness|color,
+ minimum long dash len, short dash len,
+ gap len)'
+define(`centerline_',`rpoint_(`$1')
+ M4start: last line.start
+ M4end: last line.end
+ define(`m4h',`ifelse(`$3',,linewid,abs(`$3'))')dnl
+ define(`m4v',`ifelse(`$4',,dashwid,abs(`$4'))')dnl
+ define(`m4w',`ifelse(`$4',,dashwid/2,abs(`$5'))')dnl
+ if (m4h+m4v+m4w*2)==0 then { centerline_n = 1 } \
+ else { centerline_n = max(1,int(rp_len/(m4h+m4v+m4w*2))) }
+ centerline_f = (rp_len-(centerline_n-1)*(m4v+m4w*2))/centerline_n
+ for m4ti=1 to centerline_n do {
+ line `$2' to rvec_(centerline_f,0)
+ if m4ti < centerline_n then {
+ move to rvec_(m4w,0)
+ line `$2' to rvec_(m4v,0)
+ move to rvec_(m4w,0)}
+ }
+ line invis from M4start to M4end
+ ')
+
+ `m4xtract(str1,str2)
+ Return value 1 if str2 present in str1 else 0,
+ delete str2 from str1'
+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)')
+
+ Generalized attributes and coordinates that work
+ exactly provided the current direction is up,
+ down, left or right. Macros for elements need
+ only be written once assuming a default
+ 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)')
+ 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)')
+ 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))')
+ 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)')
+
+ Binary operations giving simplified readable
+ expressions for obvious cases.
+define(`prod_',`ifelse($1,0,0,$1,-0,0,$2,0,0,$2,-0,0,$1,1,`$2',$2,1,`$1',
+ $1,-1,`-($2)',$2,-1,`-($1)',`($1)*($2)')')
+define(`sum_',`ifelse($1,0,`$2',$1,-0,`$2',$2,0,`$1',$2,-0,`$1',
+ index($2,-),0,`$1$2',`($1+$2)')')
+define(`diff_',`ifelse($2,0,`$1',$2,-0,`$1',$1,0,`-($2)',$1,-0,`-($2)',
+ `($1-($2))')')
+ Like prod_ but parentheses are *not* added
+ to the first argument, which is assumed to be
+ a variable name without minus
+define(`Prod_',`ifelse($1,0,0,$1,-0,0,$2,0,0,$2,-0,0,$1,1,`$2',$2,1,`$1',
+ $1,-1,`-($2)',$2,-1,`-$1',`$1*($2)')')
+
+ Unary arithmetic operations (for single terms:
+ use parentheses when necessary!)
+define(`abs_',`ifelse(index($1,-),0,`substr($1,1)',`$1')')
+define(`neg_',`ifelse($1,0,0,index($1,-),0,`substr($1,1)',-`$1')')
+define(`sign_',`ifelse(index($1,-),0,-,)')
+
+ `Vector sum: Vsum_(A,B) evaluates to A+(B) with
+ dpic, A+(B.x,B.y) with gpic'
+define(`Vsum_',`ifdpic(`$1'+`$2',
+ ``$1'+(`$2'.x,`$2'.y)')')
+ `Vector difference: evaluates to A-(B) with
+ dpic, A-(B.x,B.y) with gpic'
+define(`Vdiff_',`ifdpic(`$1'-(`$2'),
+ ``$1'-(`$2'.x,`$2'.y)')')
+ `Product of vector and scalar: (V)*(s) with dpic,
+ (V.x*s,V.y*s) with gpic'
+define(`Vsprod_',`ifdpic((`$1')*(`$2'),
+ `(prod_(`$1'.x,`$2'),prod_(`$1'.y,`$2'))')')
+
+ `binary_(n,[m])
+ binary representation of n, padded to m bits
+ if arg2 is nonblank'
+define(`binary_',`ifelse(`$2',,
+ `ifelse(eval(`$1'/2>0),1,`binary_(eval(`$1'/2))')eval(`$1'%2)',
+ `ifelse(eval(`$2'>1),1,`binary_(eval(`$1'/2),decr(`$2'))')eval(`$1'%2)')')
+
+ `hexadecimal_(n,[m])
+ hexadecimal value of n, padded to m hex digits
+ if arg2 is nonblank'
+define(`hexadecimal_',`ifelse(`$2',,
+ `ifelse(eval(`$1'/16>0),1,
+ `hexadecimal_(eval(`$1'/16))')`'hex_digit(eval(`$1'%16))',
+ `ifelse(eval(`$2'>1),1,
+ `hexadecimal_(eval(`$1'/16),decr(`$2'))')`'hex_digit(eval(`$1'%16))')')
+
+ `hex_digit(n)
+ hexadecimal digit for 0 <= n <= 15'
+define(`hex_digit',`ifelse(eval(`$1'<10),1,`$1',
+ `$1',10,A,`$1',11,B,`$1',12,C,`$1',13,D,`$1',14,E,`$1',15,F)')
+
+ Vector rotation: returns a pair
+ `vrot_(x,y,ct,st)'
+define(`vrot_',
+ `diff_(prod_($3,$1),prod_($4,$2)),sum_(prod_($4,$1),prod_($3,$2))')
+ `rot_(x,y,t)'
+define(`rot_',`vrot_($1,$2,cos($3),sin($3))')
+ `rrot_(x,y,t)'
+define(`rrot_',`Here+(rot_($1,$2,$3))')
+
+ Vector scaling: returns a pair
+ `vscal_(scalefactor,x,y)'
+define(`vscal_',`prod_($1,$2),prod_($1,$3)')
+ Relative position
+define(`rpos_',`Here+`$1'')
+ Absolute and relative vector determined by
+ current direction numbers
+define(`vec_',
+ `(sum_(prod_($1,m4a_),prod_($2,m4c_)),sum_(prod_($1,m4b_),prod_($2,m4d_)))')
+define(`rvec_',`Here+vec_($1,$2)')
+
+ Sine and cosine of integer degrees with
+ simplified values for special cases
+define(`Sin',`ifelse(eval(`$1'<0),1,`neg_(Sin(abs_(eval(`$1'))))',dnl
+eval(`$1'>180),1,`Sin(eval(`$1'-360))',dnl
+eval(`$1'>90),1,`Sin(eval(180-(`$1')))',dnl
+eval(`$1'==90),1,1,eval(`$1'==30),1,0.5,eval(`$1'==0),1,0,sin((`$1')*`dtor_'))')
+define(`Cos',`Sin(eval($1+90))')
+
+ Sine and cosine of arbitrary argument in degrees
+define(`sind',`ifelse(`$1',0,0,`$1',90,1,`$1',-90,-1,sin((`$1')*`dtor_'))')
+define(`cosd',`ifelse(`$1',0,1,`$1',90,0,`$1',-90, 0,cos((`$1')*`dtor_'))')
+
+ Constants
+define(`dtor_',`ifdef(`dtor__',`dtor`'_',`0.017453292519943295')') Deg to rad
+define(`rtod_',`ifdef(`rtod__',`rtod`'_',`57.295779513082323')') Rad to deg
+define(`twopi_',`ifdef(`twopi__',`twopi`'_',`6.2831853071795862')') 2*pi
+define(`pi_',`ifdef(`pi__',`pi`'_',`(twopi_/2)')') pi
+define(`E__', `2.718281828459045') e
+define(`log10E_',`0.434294481903252') `log10(E__)'
+
+ Max, min of an arbitrary number of arguments
+define(`Max',`ifelse(`$2',,`$1',`max(`$1',Max(shift($@)))')')
+define(`Min',`ifelse(`$2',,`$1',`min(`$1',Min(shift($@)))')')
+
+ Dpic May 2001 or later has these built in
+ifgpic(`
+define(`abs',`max(`$1',-(`$1'))')
+define(`sign',`((`$1')/abs(`$1'))')
+define(`floor',`int(`$1')') `old versions of gpic use the floor function'
+define(`Int_',`(sign(`$1')*int(abs(`$1')))') `corrected int() fn'
+define(`loge',`(log(`$1')/log10E_)')
+define(`expe',`(exp((`$1')*log10E_))')
+define(`tan', `(sin(`$1')/cos(`$1'))')
+define(`acos',`atan2(sqrt(1-(`$1')^2),`$1')') `acos(ratio)'
+define(`asin',`atan2(`$1',sqrt(1-(`$1')^2))') `asin(ratio)'
+define(`pmod',`((((`$1')%(`$2'))+`$2')%(`$2'))') `+ve mod(M,N) eg pmod(-3,5)=2'
+',`
+define(`Int_',`int(`$1')')
+')
+
+define(`ceiling_',`(-floor(-(`$1')))')
+define(`round_',`int(`$1'+sign(`$1')/2)')
+define(`sqrta',`sqrt(abs(`$1'))')
+
+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(`px__', `*(scale/ifsvg(dpPPI,96))') Absolute pixels
+define(`lthick',`(linethick bp__)') Current linethick in drawing units
+define(`hlth',`(linethick bp__/2)') Half of current linethick in drawing units
+
+ `Use with \boxdim to get the dimensions of a
+ TeX \hbox
+ boxdim(label, h|w|d|v, default length)'
+define(`boxdim',`ifelse(`$2',v,`sum_(boxdim(`$1',h,`$3'),boxdim(`$1',d,0))',
+ ifdef(`$1_$2',`$1_$2',ifelse(`$3',,0,`$3')))')
+
+ `Automatic index generation:
+ P[m4inx]; P[m4inx] ... becomes P[1]; P[2] ...
+ with m4x the final count'
+define(`m4inx',`define(`m4x',ifdef(`m4x',`incr(m4x)',1))m4x')
+
+ `String conveniences start here:'
+ `xtract(string,substr1,substr2,...)
+ extract substrings without deletion'
+define(`xtract',`ifelse(index(`$1',`$2'),-1,,`$2')`'ifelse(`$3',,,
+`xtract(`$1',shift(shift($@)))')')
+
+ `Test if in string
+ ifinstr(str,substr,in,str,substr,in,...,notin)'
+define(`ifinstr',`ifelse(`$2',,`$1',index(`$1',`$2'),-1,
+ `ifinstr(shift(shift(shift($@))))',`$3')')
+
+ `m4dupstr(string,n,`name')
+ Concatenate string n>0 times in name
+ eg m4dupstr(P,4,`X') defines X to be PPPP'
+define(`m4dupstr',`define(`$3',)for_(1,ifelse(`$2',,1,`$2'),1,
+`define(`$3',$3`$1')dnl')')
+
+ `m4Delch(string,char)'
+ Delete the first char (default _) from a string
+ if the char matches arg2'
+define(`m4Delch',
+`ifelse(substr(`$1',0,1),ifelse(`$2',,_,`$2'),`substr(`$1',1)',`$1')')
+
+ `setkey_(string,key,default,[N])
+ pushdef macro m4key equal to val when
+ string contains key=val;
+ default if not in string
+ arg4= blank defines m4key as (val)'
+define(`setkey_',
+ `pushdef(`m4xt',index(`$1',`$2'=))ifelse(m4xt,-1,
+ `pushdef(`m4'$2,`ifelse(`$3',,,ifelse(`$4',,(`$3'),`$3'))')',
+ `define(`m4sktmp',substr(`$1',eval(m4xt+len(`$2')+1)))dnl m4sktmp used later
+ ifelse(index(m4sktmp,;),-1,
+ `pushdef(`m4'$2,ifelse(`$4',,(m4sktmp),m4sktmp))',
+ `pushdef(`m4'$2,ifelse(`$4',,(substr(m4sktmp,0,index(m4sktmp,;))),
+ substr(m4sktmp,0,index(m4sktmp,;))))')')dnl
+ popdef(`m4xt')')
+
+ `String with exact typeset dimensions:
+ Requires s_init(name), sinclude(filename.dim),
+ boxdims.sty, and processing twice. If there
+ are two or more args they are given to
+ sprintf(...); e.g. s_box($x^%g_%g$,3,4)'
+define(`s_box',
+`ifsvg(`ifelse(`$2',,,`sprintf(')"ifelse(index(`$1',"),0,
+`substr(`$1',1,eval(len(`$1')-2))',`$1')"ifelse(`$2',,,`,shift($@))')',
+`define(`m4_k',ifdef(`m4_k',incr(m4_k),1))dnl
+ifelse(`$2',,,`sprintf(')"ifdef(`s_name',,`{\bf !!}')dnl
+\boxdims{s_name`'_`'m4_k}{dnl
+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)
+ `Like s_box but text is rotated text_ang degrees
+ (requires PSTricks or pgf)'
+define(`rs_box',
+`define(`m4_k',ifdef(`m4_k',incr(m4_k),1))dnl
+ifelse(`$2',,,`sprintf(')"ifdef(`s_name',,`{\bf !!}')dnl
+\defboxdim{s_name`'_`'m4_k}{dnl
+ifelse(index(`$1',"),0,`substr(`$1',1,eval(len(`$1')-2))',`$1')}dnl
+ifpstricks(`\rput[c]{text_ang}(0,0)')ifpgf(`\pgftext[rotate=text_ang]'){dnl
+ifelse(index(`$1',"),0,`substr(`$1',1,eval(len(`$1')-2))',`$1')}"dnl
+ifelse(`$2',,,`,shift($@),shift($@))') \
+ wid s_wd(,textwid)*cosd(text_ang) + (s_ht(,textht)+s_dp)*sind(text_ang) \
+ ht (s_ht(,textht)+s_dp)*cosd(text_ang)+s_wd(,textwid)*sind(text_ang)')
+
+ `Initialize string index: s_init(name)'
+define(`s_init',`define(`s_name',`$1')')
+
+ `Dimensions of the most recent s_box
+ (or corresponding to the first argument)'
+define(`s_ht',`boxdim(ifelse(`$1',,`s_name`'_`'m4_k',`$1'),h,`$2')')
+define(`s_wd',`boxdim(ifelse(`$1',,`s_name`'_`'m4_k',`$1'),w,`$2')')
+define(`s_dp',`boxdim(ifelse(`$1',,`s_name`'_`'m4_k',`$1'),d,`$2')')
+
+ `f_box( boxspec, labelargs ) Evaluates to
+ box boxspec s_box(labelargs)
+ or, if there is only one argument, to
+ box invis fill_(1) s_box(arg1)
+ Like s_box but overlays text on a box
+ specified by the first argument, eg
+ f_box( invis fill_(0.9), labelargs)'
+define(`f_box',`box ifelse(`$2',,
+ `invis fill_(1) s_box($1)',
+ `$1 s_box(shift($@))')')
+
+ `dot(at location,radius,fill)'
+define(`dotrad_',(0.02*scale))
+define(`dot',`[define(`m4ft',`ifelse(`$3',,0,(`$3'))')dnl
+ ifgpic(`circle rad ifelse(`$2',,`dotrad_',`$2') fill_(m4ft)',
+ `ifdef(`r_',`rgbfill(r_+(1-r_)*m4ft, g_+(1-g_)*m4ft, b_+(1-b_)*m4ft,
+ circle rad ifelse(`$2',,`dotrad_',`$2'))',
+ `circle rad ifelse(`$2',,`dotrad_',`$2') fill_(m4ft)')')
+ `$4'] with .c ifelse(`$1',,`at Here',`$1')
+ move to last [].c')
+ `cross(at location); assumes that a
+ cross always has manhattan directions'
+define(`crosswd_',(0.05*scale))
+define(`cross',`[{line from Here+(0,neg_(crosswd_)) to Here+(0,crosswd_)}
+ line from Here+(neg_(crosswd_),0) to Here+(crosswd_,0)
+ `$2'] with .c ifelse(`$1',,`at Here',`$1'); move to last [].c')
+
+ `boxcoord(name,xfraction,yfraction)
+ internal position in a named planar object'
+define(`boxcoord',
+ `(`$2' between `$1'.w and `$1'.e,`$3' between `$1'.s and `$1'.n)')
+
+ `shadebox(box boxspec,shadewid)' Shaded box
+define(`shadebox',` $1
+ m4t1 = linethick
+ define(`m4h',`ifelse(`$2',,m4t1*5/4,`($2)')')dnl
+ define(`m4v',`(m4h+m4t1)/2 bp__')dnl
+ {line thickness m4h outlined "gray" from last box.sw+(m4v,neg_(m4v)) \
+ to last box.se+(m4v,neg_(m4v)) then to last box.ne+(m4v,neg_(m4v))}
+ {move to last box.se+(m4v,neg_(m4v))+(m4h/2 bp__,neg_(m4h)/2 bp__)}
+ ')
+
+ `hatchbox(boxspec,hashsep,hatchspec,ang)'
+ `manhattan box with hatching at ang degrees'
+define(`hatchbox',`[ a = pmod((ifelse(`$4',,45,`$4')+90),180)-90
+ if a >=0 then { B: box invis `$1' with .nw at (0,0) } \
+ else { B: box invis `$1' with .sw at (0,0) }
+ ds = ifelse(`$2',,0.075*scale,`$2')
+ ifelse(`$3',,`thicktemp = linethick; thinlines_')
+ 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 {
+ 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
+ for lp=1 to 0 by -1 do { T: T+(ds*sa,-ds*ca); Q: T+(ca*d,sa*d)
+ S: (0,intersect_(T,Q,B.nw,B.sw).y)
+ if (-S.y) > B.ht then { S: (intersect_(T,Q,B.sw,B.se).x,-B.ht) }
+ F: (intersect_(T,S,B.nw,B.ne).x,0)
+ if F.x > B.wid then { F: (B.wid,intersect_(T,S,B.ne,B.se).y) }
+ lp=((-F.y)<=B.ht && F.x<=B.wid)
+ # Use this with dpic-2017.08.24 or later:
+# if lp then { line from S to F `$3' }
+ line from S*lp to F*lp `$3'
+ }
+ } else { T: B.sw
+ for lp=1 to 0 by -1 do { T: T+(-ds*sa,ds*ca); Q: T+(-ca*d,-sa*d)
+ S: intersect_(T,Q,B.nw,B.sw)
+ if S.y > B.ht then { S: (intersect_(T,Q,B.nw,B.ne).x,B.ht) }
+ F: intersect_(T,S,B.sw,B.se)
+ if F.x > B.wid then { F: (B.wid,intersect_(T,S,B.ne,B.se).y) }
+ lp=(F.y<=B.ht && F.x<=B.wid)
+ # Use this with dpic-2017.08.24 or later:
+# if lp then { line from S to F `$3' }
+ line from S*lp to F*lp `$3'
+ }
+ } } }
+ ifelse(`$3',,`linethick_(thicktemp)')
+ box wid B.wid ht B.ht at B `$1'
+ `$5' ]' )
+
+ `lbox(wid,ht,type)
+ box oriented in current direction;
+ type= eg dotted'
+define(`lbox',`pushdef(`m4bwd',ifelse(`$1',,boxwid,(`$1')))dnl
+ pushdef(`m4bht',ifelse(`$2',,boxht,(`$2')))dnl
+ line from rvec_(m4bwd,0) \
+ to rvec_(m4bwd,m4bht/2) \
+ then to rvec_(0,m4bht/2) \
+ then to rvec_(0,neg_(m4bht)/2) \
+ then to rvec_(m4bwd,neg_(m4bht)/2) \
+ then to rvec_(m4bwd,0) `$3' popdef(`m4bwd')popdef(`m4bht') ')
+
+ `rotbox(wid,ht,type,[r=val|t=val])
+ box oriented in current direction in [] block;
+ wd and ht are distances between line centers.
+ type= eg dotted shaded "green"
+ if arg4 is r=val then the corner radius is val
+ if arg4 is t=val then a "superellipse"
+ is drawn using a spline of tension val
+ (dpic only),
+ e.g. Point_(30); rotbox(,,dashed,t=0.8)
+ If a spline is used, the bounding box is
+ approximate'
+define(`rotbox',`[
+ pushdef(`m4bw2',ifelse(`$1',,(boxwid/2),`(($1)/2)'))dnl
+ pushdef(`m4bh2',ifelse(`$2',,(boxht/2) ,`(($2)/2)'))dnl
+ N: vec_(0, m4bh2)
+ 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)
+ sectors = 9
+ C[0]: (m4bw2-brad,m4bh2-brad)
+ C[1]: (-m4bw2+brad,m4bh2-brad)
+ C[2]: (-m4bw2+brad,-m4bh2+brad)
+ C[3]: (m4bw2-brad,-m4bh2+brad)
+ for j=0 to 3 do {
+ for i=0 to sectors do { T: C[j]+(Rect_(brad,j*90+i*90/sectors))
+ P[i]: vec_(T.x,T.y) }
+ 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
+ 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)
+ SE: vec_( m4bw2,-m4bh2)
+ NW: vec_(-m4bw2,m4bh2)
+ SW: vec_(-m4bw2,-m4bh2)
+ line from E to NE then to NW then to SW then to SE then to E `$3' ')
+ popdef(`m4bw2')popdef(`m4bh2') `$5' ]')
+
+ `rotellipse(wid,ht,type)
+ ellipse oriented in current direction and
+ enclosed in a [] block, e.g.
+ Point_(45); rotellipse(,,dotted fill_(0.9))'
+define(`rotellipse',
+ `[define(`m4ehw',(ifelse(`$1',,ellipsewid,`($1)')/2))dnl
+ define(`m4ehh',(ifelse(`$2',,ellipseht,`($2)')/2))dnl
+ N: vec_(0,m4ehh); E: vec_(m4ehw,0); S: vec_(0,-m4ehh); W: vec_(-m4ehw,0)
+ spline ifdpic(
+ `ctension_ from S to vec_(m4ehw,-m4ehh) \
+ then to vec_(m4ehw,m4ehh) then to vec_(-m4ehw,m4ehh) \
+ then to vec_(-m4ehw,-m4ehh) then to S',
+ `from S to vec_(m4ehw/64,-m4ehh) \
+ for_(1,31,1,
+ `then to vec_(m4ehw*sin(twopi_*m4x/32),-m4ehh*cos(twopi_*m4x/32))\')\
+ then to vec_(-m4ehw/64,-m4ehh) then to S') \
+ `$3'] wid 2*sqrt((m4a_*m4ehw)^2+(m4b_*m4ehh)^2) \
+ ht 2*sqrt((m4c_*m4ehw)^2+(m4d_*m4ehh)^2)')
+
+ `ellipsearc(wid,ht,startrads,endrads,
+ rotangle,cw|ccw,linetype)
+ e.g. ellipsearc(2,1,0,pi_,pi_/4,,dashed)
+ arg5 is the angle of the wid axis
+ Internal locations Start, End, C'
+define(`ellipsearc',`[ C: (0,0)
+ a_earc = ifelse(`$1',,ellipsewid,`($1)')/2
+ b_earc = ifelse(`$2',,ellipseht,`($2)')/2
+ sa_earc = ifelse(`$3',,0,`$3')
+ ea_earc = ifelse(`$4',,pi_/2,`$4')
+ define(`m4ca',`ifelse(`$5',,1,cos(`$5'))')dnl
+ define(`m4sa',`ifelse(`$5',,0,sin(`$5'))')dnl
+ ifinstr(`$6',ccw,`define(`m4cw',ccw)',
+ `ifinstr(`$6',cw,`define(`m4cw',cw)',`define(`m4cw',ccw)')')
+ ifelse(m4cw,ccw,
+ `if ea_earc < sa_earc then { ea_earc += twopi_ }',
+ `if ea_earc > sa_earc then { ea_earc -= twopi_ }')
+ n = max(4,floor(abs((ea_earc-sa_earc)/(10*dtor_)))+1)
+ for i=0 to n do { aa = sa_earc+i/n*(ea_earc-sa_earc)
+ P[i]: (vrot_(a_earc*cos(aa),b_earc*sin(aa),m4ca,m4sa)) }
+ Start: P[0]
+ End: P[n]
+ fitcurve(P,n,`$7') ]')
+
+ Small space for string justification
+define(`sp_',`ifgpic(`\hbox{$\:$}')')
+
+ `Select arg 1 if it begins with " or sprintf,
+ else arg 2'
+define(`m4lstring',`ifelse(
+ index(`$1',"),0,`$1',index(`$1',sprintf),0,`$1',`$2')')
+
+ `Dimensioning for diagrams:
+ dimension_(linespec, vert offset, label,
+ D|H|W|blank width, tic offset, <-|->)
+ If arg 3 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 height of arg3 + textoffset*2
+ W: blank width is width of arg3 + textoffset*2
+ otherwise: arg4 is absolute blank width '
+define(`dimension_',`rpoint_(`$1') ; {
+ define(`m4g',ifelse(`$4',,0,
+ `$4',W,(s_wd + ifdpic(textoffset,`2 bp__')*2),
+ `$4',H,(s_ht + s_dp + ifdpic(textoffset,`2 bp__')*2),
+ `$4',D,vlength(s_wd,s_ht),`($4)'))dnl
+ define(`m4h',`(rp_len ifelse((`$4'),(),,neg_(m4g)))')dnl
+ ifelse((`$2'),(),,`if (`$2') != 0 then {
+ m4toff = sign(`$2')*ifelse(`$5',,`3.6bp__',(`$5'))
+ {move to rvec_(0, m4toff); line to rvec_(0,`$2')}
+ {move to rvec_(rp_len,m4toff); line to rvec_(0,`$2')}
+ move to rvec_(0,`$2') }')
+ if m4h > 2*arrowht then {
+ { line ifelse(`$6',,<-,index($6,<),0,<-) to rvec_(m4h/2,0)
+ ifelse((`$4'),(),,`move to rvec_(m4g,0)')
+ line ifelse(`$6',,->,eval(index($6,>)>0),1,->) to rvec_(m4h/2,0) }
+ } else {
+ { arrow from rvec_(-arrowht*1.5,0) to Here
+ arrow from rvec_(rp_len+arrowht*1.5,0) to rvec_(rp_len,0) }
+ }
+ ifelse(`$3',,,
+ `m4lstring(`$3',"`$3'") at rvec_(rp_len/2,0)')
+ }')
+ `Dimensioning for arcs:
+ arcdimension_(arcspec, outward radial offset, label,
+ D|H|W|blank width, tic offset, <-|->)
+ Like dimension_ but arg1 defines the arc to be
+ dimensioned as "arc invis $1" and arg2 is the
+ outward radial distance, possibly negative, of the
+ dimensioning arrow. If arg 3 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 height of arg3 + textoffset*2
+ W: blank width is width of arg3 + textoffset*2
+ otherwise: arg4 is absolute blank width '
+define(`arcdimension_',`arc invis `$1' ; {
+ M4ArcC: last arc.c
+ m4Arcr = last arc.rad
+ m4sang = atan2(last arc.start.y-M4ArcC.y,last arc.start.x-M4ArcC.x)
+ m4eang = atan2(last arc.end.y-M4ArcC.y,last arc.end.x-M4ArcC.x)
+ m4hang = (m4sang+m4eang)/2
+ m4voff = ifelse(`$2',,0,`$2')
+ m4hr = m4Arcr+m4voff
+ define(`m4g',`ifelse(`$4',,0,
+ `$4',W,(s_wd + ifdpic(textoffset,`2 bp__')*2),
+ `$4',H,(s_ht + s_dp + ifdpic(textoffset,`2 bp__')*2),
+ `$4',D,vlength(s_wd,s_ht),
+ `($4)')')dnl
+ m4ah = abs((m4eang-m4sang)*m4Arcr) ifelse(`$4',,,neg_(m4g))
+ if m4voff != 0 then {
+ m4toff = sign(m4voff)*ifelse(`$5',,`3.6bp__',(`$5'))
+ { line from M4ArcC+(rect_(m4Arcr+m4toff,m4sang)) \
+ to M4ArcC+(rect_(m4hr+m4toff,m4sang)) }
+ { line from M4ArcC+(rect_(m4Arcr+m4toff,m4eang)) \
+ to M4ArcC+(rect_(m4hr+m4toff,m4eang)) } }
+ if m4ah > 2*arrowht then {
+ define(`m4cw',`ifinstr(patsubst(|`$1'|,` ',|),|cw|,cw)')
+ m4gang = ifelse(m4cw,,-)atan2(m4g/2,m4Arcr)
+ { arc m4cw ifelse(`$6',,<-,index(`$6',<),0,<-) \
+ from M4ArcC+(rect_(m4hr,m4sang)) \
+ to M4ArcC+(rect_(m4hr,m4hang+m4gang)) rad m4hr with .c at M4ArcC
+ arc m4cw ifelse(`$6',,->,eval(index(`$6',>)>0),1,->) \
+ from M4ArcC+(rect_(m4hr,m4hang-m4gang)) \
+ to M4ArcC+(rect_(m4hr,m4eang)) rad m4hr with .c at M4ArcC }
+ } else {
+ m4aht = ifelse(m4cw,,-)atan2(arrowht*1.5,m4Arcr)
+ { arc -> m4cw from M4ArcC+(rect_(m4hr,m4sang+m4aht)) \
+ to M4ArcC+(rect_(m4hr,m4sang)) rad m4hr with .c at M4ArcC
+ arc -> ifelse(m4cw,,cw) from M4ArcC+(rect_(m4hr,m4eang-m4aht)) \
+ to M4ArcC+(rect_(m4hr,m4eang)) rad m4hr with .c at M4ArcC } }
+ ifelse(`$3',,,`m4lstring(`$3',"`$3'") at M4ArcC+(rect_(m4hr,m4hang))')
+ }')
+ `shade(gray value,closed line specs)
+ Fill an arbitray closed curve with a gray value
+ 0=black, 1=white,
+ (requires gpic, pstricks, or postscript out)'
+define(`shade',`beginshade(`$1')
+ `$2'
+ endshade')
+
+# Graduated shading is probably best done using the built-in functions
+# of PSTricks or the somewhat equivalent tikz capabilities. Other
+# postprocessors do not have the same functionality so the following
+# demonstrates how it can be done in the pic language with m4 macros.
+#
+# `ShadedPolygon(vertexseq,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,1,0,0)'
+#
+define(`ShadedPolygon',`[ Origin: Here
+define ShadedPline {
+ if $`'1 > d[pL] then { qL = pL; pL = qL + 1; if pL > nverts then {pL = 1}
+ dL = d[pL]-d[qL] }
+ if $`'1 > d[pR] then { qR = pR; pR = qR - 1; if pR < 1 then {pR = nverts}
+ dR = d[pR]-d[qR] }
+ if (dL != 0) && (dR != 0) then {
+ M4L: ($`'1-d[qL])/dL between V[qL] and V[pL]
+ M4R: ($`'1-d[qR])/dR between V[qR] and V[pR]
+ line outlined rgbstring($`'2,$`'3,$`'4) from M4L to M4R }
+ }
+ m4shadedpverts(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 }; dL = d[pL]-d[qL]
+ qR = p0; pR = qR - 1; if pR < 1 then { pR = nverts }; dR = d[pR]-d[qR]
+ nlines = int(1.5*dmx/lthick)
+ NeedDpicTools
+ 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(`m4shadedpverts',`
+ifelse($3,,,`$1[$2]: patsubst(`$3',|,`,') define(`m4vx',$2)
+m4shadedpverts(`$1',incr(`$2'),shift(shift(shift($@))))')')
+
+define(`color255',`round_((`$1')*255),round_((`$2')*255),round_((`$3')*255)')
+
+ `like shade(,) but without the argument:
+ beginshade(gray value)
+ closed line specs
+ endshade'
+define(`beginshade',`define(`m4_shade',`ifelse(`$1',,`fillval',`($1)')')dnl
+ ifelse(m4picprocessor,gpic,
+ `command sprintf("\special{sh %g}",1-m4_shade)',
+ m4postprocessor,mfpic,
+ `ifelse(`$1',0,
+ `command "\gfill\draw\lclosed"',
+ `if (m4_shade<0.99) then {
+ command sprintf(`"\shade[%gpt]\draw\lclosed"',expe((m4_shade-0.3)*2))}')',
+ m4postprocessor,mpost,
+ `command "def Y="',
+ m4postprocessor,svg,
+ `command sprintf("<g fill=\"rgb(%g,%g,%g)\">",\
+ color255(m4_shade,m4_shade,m4_shade) )',
+ m4postprocessor,pgf,
+ `command "\global\let\dpicshdraw=\dpicdraw\global\def\dpicdraw{}"
+ command "\global\def\dpicstop{--}"
+ command sprintf("\dpicshdraw[fill=white!%g!black]",m4_shade*100)',
+ m4postprocessor,pstricks,
+ `command sprintf("\newgray{m4fillv}{%g}",m4_shade)
+ command sprintf("\pscustom[fillstyle=solid,fillcolor=m4fillv]{%%")',
+ m4postprocessor,postscript,
+ `command "/endstroke {}def /npath {}def newpath"')dnl
+')')
+
+define(`endshade',
+ `ifelse(m4postprocessor,pstricks,
+ `command "}%"',
+ m4postprocessor,postscript,
+ `command sprintf(" gsave %g setgray fill grestore",m4_shade)
+ command "/endstroke {ostroke} def /npath {newpath} def endstroke"',
+ m4postprocessor,pgf,
+ `command "cycle; \global\let\dpicdraw=\dpicshdraw\global\def\dpicstop{;}"',
+ m4postprocessor,svg,
+ `command "</g>"',
+ m4postprocessor,mpost,
+ `command "enddef; def drw= enddef; def X=--enddef;"
+ command sprintf("fill Y cycle withcolor %gwhite;",m4_shade)
+ command "def drw=draw enddef; def X=;enddef; Y;"dnl
+')')
+ `gshade(gray value,A,B,...,Z,A,B) (Note last
+ two arguments). Shade a polygon with named
+ vertices, attempting to avoid sharp corners.'
+define(`gshade',`m4tmp = linethick; linethick = 0
+ shade(`$1',line from 0.5 between `$2' and `$3' \
+ to gpolyline(.004,shift($@)) \
+ then to 0.5 between `$2' and `$3')
+ linethick = m4tmp')
+define(`gpolyline',`1-(`$1') between `$2' and `$3' \
+ then to `$1' between `$3' and `$4' ifelse(`$5',,,`\
+ then to gpolyline(`$1',shift(shift($@)))')')
+
+ `m4fshade(gray value,closed curve) internal'
+ifelse(m4picprocessor,gpic,
+ `define(`m4fshade',`shade(ifelse(`$1',,0,`$1'),`$2')')',
+m4postprocessor,xfig,
+ `define(`m4fshade',``$2' fill ifelse(`$1',,0,`$1')')',
+m4postprocessor,svg,
+ `define(`m4fshade',
+ `ifdef(`r_',`rgbfill(color255(r_,g_,b_),`$2')',
+ `shade(ifelse(`$1',,0,`$1'),`$2')')')',
+`define(`m4fshade',
+ `ifdef(`r_',`rgbfill(r_,g_,b_,`$2')',
+ `shade(ifelse(`$1',,0,`$1'),`$2')')')')
+
+ `open_arrow(linespec, ht, wid)
+ arrow with outlined head'
+define(`open_arrow',`arrow invis `$1'
+ m4oatx = Here.x - last arrow.start.x; m4oaty = Here.y - last arrow.start.y
+ m4oatr = (ifelse(`$3',,arrowwid,`$3'))/vlength(m4oatx,m4oaty)/2
+ line from last arrow.start to Here chop 0 chop ifelse(`$2',,arrowht,`$2')
+ line from last arrow.end to Here+(-m4oaty*m4oatr,m4oatx*m4oatr) \
+ then to Here-(-m4oaty*m4oatr,m4oatx*m4oatr) then to last arrow.end ')
+
+ `elchop(E,A) chop for ellipses
+ evaluates to "chop r" where r is the distance
+ from the centre of ellipse E to the
+ intersection of E with a line from E.c to A'
+ `e.g., E:ellipse at (0,0); A:(1,2)
+ line from A to E chop 0 elchop(E,A)'
+define(`elchop',`chop 0.5 * `$1'.wid * `$1'.ht * sqrt(\
+ ((`$2'.x-`$1'.x)^2 + (`$2'.y-`$1'.y)^2) /\
+ ( ((`$2'.x-`$1'.x)*`$1'.ht)^2 + ((`$2'.y-`$1'.y)*`$1'.wid)^2 ) ) ')
+
+ `vlength(x,y) 2-D vector length'
+define(`vlength',`sqrt(abs((`$1')^2+(`$2')^2))')
+
+ `distance(Pos1,Pos2)' distance between positions
+define(`distance',
+ `vlength(M4Pos(`$1').x-M4Pos(`$2').x,M4Pos(`$1').y-M4Pos(`$2').y)')
+
+ `lin_leng(linear object)' calculates length
+define(`lin_leng',`distance(`$1'.start,`$1'.end)')
+ `lin_ang(linear object)' calculates angle
+define(`lin_ang',
+ `atan2(`$1'.end.y-`$1'.start.y,`$1'.end.x-`$1'.start.x)')
+
+ `inner_prod(linear obj,linear obj)'
+define(`inner_prod',`(sum_(dnl
+ prod_(`$1'.end.x-`$1'.start.x,`$2'.end.x-`$2'.start.x),dnl
+ prod_(`$1'.end.y-`$1'.start.y,`$2'.end.y-`$2'.start.y)))')
+
+ `vperp(linear object, length, [R] )
+ Vector pair CCW (CW if arg3=R)
+ perpendicular to linear object. The result
+ has length
+ 1 if arg2 is blank
+ of arg1 if arg2 is `0'
+ arg2 otherwise'
+define(`vperp',
+`define(`m4pdx',`(`$1'.end.x-`$1'.start.x)')dnl
+ define(`m4pdy',`(`$1'.end.y-`$1'.start.y)')dnl
+ define(`m4pdl',`ifelse(`$2',,`/vlength(m4pdx,m4pdy)',`$2',0,,
+ `*(`$2')/vlength(m4pdx,m4pdy)')')dnl
+ ifinstr(`$3',R,
+ `(m4pdy`'m4pdl),(-m4pdx`'m4pdl)',`(-m4pdy`'m4pdl),(m4pdx`'m4pdl)')')
+
+ `Vperp(Pos1,Pos2, length, [R])
+ Vector pair CCW (CW if arg4=R)
+ perpendicular to line joining two named
+ positions. The result has length
+ 1 if arg3 is blank
+ distance arg1 to arg2 if arg3 is `0'
+ arg3 otherwise'
+define(`Vperp',
+ `define(`m4pdx',`(`$2'.x-`$1'.x)')dnl
+ define(`m4pdy',`(`$2'.y-`$1'.y)')dnl
+ define(`m4pdl',`ifelse(`$3',,`/vlength(m4pdx,m4pdy)',`$3',0,,
+ `*(`$3')/vlength(m4pdx,m4pdy)')')dnl
+ ifinstr(`$4',R,,-)m4pdy`'m4pdl,\
+ m4pdx`'m4pdl')
+
+ `Equidist3(Pos1,Pos2,Pos3,Result)
+ Result is the name of the point equidistant
+ from named Pos1, Pos2, Pos3
+ eg Equidist3(A,B,C,D)
+ arc from A to C with .c at D'
+define(`Equidist3',`
+ M4tmp_P1: 0.5 between `$1' and `$2'
+ M4tmp_T1: M4tmp_P1+(Vperp(`$1',`$2'))
+ M4tmp_P2: 0.5 between `$2' and `$3'
+ M4tmp_T2: M4tmp_P2+(Vperp(`$2',`$3'))
+ `$4': intersect_(M4tmp_P1,M4tmp_T1,M4tmp_P2,M4tmp_T2)
+ ')
+ `Cintersect(Pos1,rad1,Pos2,rad2,[R])
+ Upper (lower if arg5=R) intersection of
+ circles at Pos1 and Pos2, radius rad1 and rad2
+ Supercedes obsolete cintersect which is kept
+ for consistnecy'
+define(`Cintersect',
+ `define(`m4Cr1',`ifelse(`$2',,circlerad,(`$2'))')dnl
+ define(`m4Cr2',`ifelse(`$4',,circlerad,(`$4'))')dnl
+ define(`m4cdx',`(M4Pos(`$3').x-M4Pos(`$1').x)')dnl
+ define(`m4cdy',`(M4Pos(`$3').y-M4Pos(`$1').y)')dnl
+ define(`m4cls',`(m4cdx^2+m4cdy^2)')dnl
+ define(`m4cq',`((m4cls+m4Cr1^2-m4Cr2^2)/2)')dnl
+ (m4cq/m4cls between `$1' and `$3') ifinstr(`$5',R,-,+)\
+ (vscal_(sqrt(max(0,m4cls*m4Cr1^2-m4cq^2))/m4cls,-m4cdy,m4cdx))')
+define(`cintersect',`Cintersect($@)')
+
+ `LCintersect(Name of line,Centre,rad,[R])
+ First (second if arg4 is R) intersection
+ of a line V with a circle at C:
+ solves |V.start+tV-C| = r '
+ifdpic(
+define(`LCintersect',
+`define(`M4LcX',`$1'.start)define(`M4LcC',`($2)')dnl
+define(`M4LcV',`(`$1'.end-M4LcX)')define(`M4LcD',`(M4LcX-M4LcC)')dnl
+define(`m4Lca',`(M4LcV.x^2+M4LcV.y^2)')dnl
+define(`m4Lcb',`(2*(M4LcV.x*M4LcD.x+M4LcV.y*M4LcD.y))')dnl
+define(`m4Lcc',`(M4LcD.x^2+M4LcD.y^2-ifelse(`$3',,circlerad,`($3)')^2)')dnl
+define(`m4Lct',
+ `(-m4Lcb ifinstr(`$4',R,+,-) sqrta(m4Lcb^2-4*m4Lca*m4Lcc))/(2*m4Lca)')dnl
+(m4Lct between `$1'.start and `$1'.end)')
+
+ `LEintersect(Name of line,
+ Centre,ellipsewd,ellipseht, [R])
+ First (second if arg5 is R) intersection
+ of a line (or move) and ellipse at C'
+define(`LEintersect',
+`define(`M4LEX',`$1'.start)define(`M4LEC',`($2)')dnl
+define(`M4LEV',`(`$1'.end-M4LEX)')define(`M4LED',`(M4LEX-M4LEC)')dnl
+define(`m4LEqa',`(ifelse(`$3',,ellipsewid,`($3)')/2)')dnl
+define(`m4LEqb',`(ifelse(`$4',,ellipseht,`($4)')/2)')dnl
+define(`m4LEa',`(M4LEV.x^2/m4LEqa^2+M4LEV.y^2/m4LEqb^2)')dnl
+define(`m4LEba',`(M4LEV.x*M4LED.x/m4LEqa^2+M4LEV.y*M4LED.y/m4LEqb^2)')dnl
+define(`m4LEc',`(M4LED.x^2/m4LEqa^2+M4LED.y^2/m4LEqb^2-1)')dnl
+define(`m4LEt',
+ `(-m4LEba ifinstr(`$5',R,+,-) sqrta(m4LEba^2-m4LEa*m4LEc))/m4LEa')dnl
+(m4LEt between `$1'.start and `$1'.end)')
+)
+
+ `LCtangent(Pos,Center,rad,[R])
+ Left (right if arg4=R) tangent point of line
+ from Pos to circle at Center with radius arg3'
+define(`LCtangent',`ifdpic(
+`define(`m4dx',`((`$1').x-(`$2').x)')define(`m4dy',`((`$1').y-(`$2').y)')',
+`define(`m4dx',`(`$1'.x-`$2'.x)')define(`m4dy',`(`$1'.y-`$2'.y)')')dnl
+define(`m4lcr',`ifelse(`$3',,circlerad,`($3)')')dnl
+define(`m4dsq',`(m4dx^2+m4dy^2)')dnl
+(`$2'+\
+(m4dx*m4lcr^2/m4dsq ifinstr(`$4',R,-,+)m4dy*m4lcr*sqrt(m4dsq-m4lcr^2)/m4dsq,\
+ m4dy*m4lcr^2/m4dsq ifinstr(`$4',R,+,-)m4dx*m4lcr*sqrt(m4dsq-m4lcr^2)/m4dsq))')
+
+ `LEtangent(Pos,Center,ellipsewid,ellipseht,[R])
+ Left (right if arg5=R) tangent point of line
+ from Pos to ellipse at Center'
+define(`LEtangent',
+`define(`m4LEta',`(ifelse(`$3',,ellipsewid,`($3)')/2)')dnl
+define(`m4LEtb',`(ifelse(`$4',,ellipseht, `($4)')/2)')dnl
+define(`M4LP',`($1-($2))')dnl
+define(`M4LET',`LCtangent((M4LP.x/m4LEta,M4LP.y/m4LEtb),`(0,0)',1,`$5')')dnl
+(`$2'+(M4LET.x*m4LEta,M4LET.y*m4LEtb))')
+
+ `Convenience fraction along a linear obj'
+define(`along_',`between `$1'.start and `$1'.end')
+
+ `Along_(LinearObj,distance,[R])
+ position along a linear obj from start to end
+ arg3=R: from end to start'
+define(`Along_',`(ifelse(`$2',,1,`(`$2')/lin_leng(`$1')') between \
+ `$1'.ifelse(`$3',R,end,start) and `$1'.ifelse(`$3',R,start,end))')
+
+ `showbox_(planar object,boxspec)
+ Convenience to draw the bounding box of an obj
+ (default last []),
+ e.g. showbox_(B,dotted "Box B")'
+define(`showbox_',
+ `{box wid ifelse(`$1',,last [],`$1').wid \
+ ht ifelse(`$1',,last [],`$1').ht \
+ at ifelse(`$1',,last [],`$1') `$2'}')
+
+ `use continue if dpic, otherwise line or other'
+define(`contline',`ifdpic(continue,ifelse(`$1',,line,`$1'))')
+
+ `arcto(pos1,pos2,radius,attributes)
+ line toward pos1 with arc toward pos2,
+ similar to Postscript arcto.'
+define(`arcto',
+ `H_arcto: Here; X_arcto:`$1'; Y_arcto:`$2'
+ U_arcto: X_arcto-(H_arcto.x,H_arcto.y)
+ V_arcto: Y_arcto-(X_arcto.x,X_arcto.y)
+ L_arcto: (vlength(U_arcto.x,U_arcto.y),vlength(V_arcto.x,V_arcto.y))
+ S_arcto: (U_arcto.x*V_arcto.y-U_arcto.y*V_arcto.x, \
+ U_arcto.x*V_arcto.x+U_arcto.y*V_arcto.y)
+ if ("`$3'"=="") then { r_arcto = min(L_arcto.x,L_arcto.y)/2 } \
+ else { r_arcto = `$3' }
+ if (S_arcto.x==0) && (S_arcto.y==0) then { S_arcto:(r_arcto,0) } \
+ else { S_arcto:(r_arcto,atan2(S_arcto.x,S_arcto.y)) }
+ a_arcto = S_arcto.x*tan(abs(S_arcto.y)/2)
+ if S_arcto.x*S_arcto.y*L_arcto.x*L_arcto.y == 0 \
+ then { TX_arcto: X_arcto; TY_arcto: X_arcto; C_arcto: X_arcto } \
+ else {
+ TX_arcto: a_arcto/L_arcto.x between X_arcto and H_arcto
+ TY_arcto: a_arcto/L_arcto.y between X_arcto and Y_arcto
+ C_arcto: TX_arcto + (vscal_(sign(S_arcto.y)*S_arcto.x/L_arcto.x,
+ -U_arcto.y,U_arcto.x)) }
+ Arcto_line: line `$4' from H_arcto \
+ to TX_arcto ifpstricks(`chop -min(1,linethick)bp__')
+ if S_arcto.y >= 0 then { Arcto_arc: arc `$4' ccw rad r_arcto \
+ from TX_arcto to TY_arcto with .c at C_arcto } \
+ else { Arcto_arc: arc `$4' cw rad r_arcto \
+ from TX_arcto to TY_arcto with .c at C_arcto } ')
+
+ `m4scale_(linespec,[Bp,Pt,In,Cm])
+ Draw a scale along a line for debugging'
+define(`m4scale_',`define(`m4SC',`ifelse(`$2',,I,`substr(`$2',0,1)')')dnl
+ M4line: rpoint_(ifelse(`$1',,`to rvec_(5,0)',`$1'))
+ m4slen = lin_leng(M4line)/(1 dnl
+ ifelse(m4SC,B,bp__,m4SC,P,pt__,m4SC,I,,mm__))
+ m4ltht = linethick
+ thinlines_
+ ifelse(ifelse(m4SC,B,T,m4SC,P,T),T,
+ `define(`m4unit',`ifelse(m4SC,B,bp__,pt__)')dnl
+ for i=10 to m4slen-9.9 by 10 do {
+ line up 0.05 from M4line.start+vec_(i m4unit,0) }
+ for i=50 to m4slen-49 by 100 do {
+ line up 0.08 from M4line.start+vec_(i m4unit,0) }
+ for i=0 to m4slen by 100 do {
+ line up 0.1 from M4line.start+vec_(i m4unit,0)
+ sprintf("%g",i) ht 8 m4unit at last line.start below }',
+ m4SC,C,
+ `for i=2 to m4slen-1 by 2 do {
+ line up 0.05 from M4line.start+vec_(i mm__,0) }
+ for i=0 to m4slen by 10 do {
+ line up 0.1 from M4line.start+vec_(i mm__,0)
+ sprintf("%g",i/10) ht 8bp__ at last line.start below }',
+ `for i=1 to m4slen*10-0.9 do {
+ line up 0.05 from M4line.start+vec_(i/10,0) }
+ for i=0.5 to m4slen-0.49 by 0.5 do {
+ line up 0.08 from M4line.start+vec_(i,0) }
+ for i=0 to m4slen do {
+ line up 0.1 from M4line.start+vec_(i,0)
+ sprintf("%g",i) ht 8 bp__ at last line.start below }')
+ linethick_(m4ltht)
+ ')
+
+ `fitpoints(V,n,m,P,mP)'
+ Compute the controls in P[mP], P[mP+1]... for
+ the spline passing throught points V[m]...V[n]
+ Defines dpic macro dfitpoints() with the
+ same arguments'
+ifdpic(`
+define(`fitpoints',`defdfitpoints
+dfitpoints($@)')
+define(`defdfitpoints',`ifdef(`dfitpoints__',,`define(`dfitpoints__')dnl
+patsubst(`define dfitpoints {
+ if "|3"=="" then { m_dfit=0 } else { m_dfit=|3 }
+ if "|5"=="" then { mP_dfit=0 } else { mP_dfit=|5 }
+ n_dfit = |2; np_dfit = n_dfit-m_dfit
+ |4[mP_dfit]: |1[m_dfit]
+ for i_dfit=m_dfit+1 to n_dfit-1 do {
+ |4[mP_dfit+i_dfit-m_dfit]: |1[i_dfit]*(4/3) }
+ |4[mP_dfit+np_dfit]: |1[n_dfit]
+ |4[mP_dfit+1]: |4[mP_dfit+1]-|4[mP_dfit+0]/6 # forward substitution
+ d_dfit[1] = 1
+ for i_dfit = 2 to np_dfit-1 do { |4[mP_dfit+i_dfit]: \
+ |4[mP_dfit+i_dfit]-|4[mP_dfit+i_dfit-1]/d_dfit[i_dfit-1]/6
+ d_dfit[i_dfit] = 1-1/d_dfit[i_dfit-1]/36 }
+ for i_dfit= np_dfit-1 to 1 by -1 do { # backward substitution
+ |4[mP_dfit+i_dfit]: \
+ (|4[mP_dfit+i_dfit]-|4[mP_dfit+i_dfit+1]/6)/d_dfit[i_dfit] }
+ }',|,$) ') ') ')
+
+ `fitcurve(V,n,linetype,m (default 0))
+ Draw a spline through V[m],...V[n]
+ linetype=eg dotted. Works only with dpic.
+ The calculated control points P[i] satisfy
+ approximately:
+ P[0] = V[0]
+ P[i-1]/8 + P[i]*3/4 + P[i+1]/8 = V[i]
+ P[n] = V[n]
+ Defines dpic macro dfitcurve() with the
+ same arguments'
+ifdpic(`
+define(`fitcurve',`ifdef(`dfitcurve__',,`define(`dfitcurve__')dnl
+defdfitpoints
+patsubst(`define case_dfit { exec sprintf("|%g",floor(|1+0.5)+1); }
+define dfitcurve { if "|4"=="" then { m_dfit=0 } else { m_dfit=|4 }
+ n_dfit = |2; np_dfit = n_dfit-m_dfit
+ M4P_[0]: |1[m_dfit]
+ case_dfit( min(max(np_dfit,-1),3)+1,
+ spline 0.551784 |3 from M4P_[0] to M4P_[0],
+ spline 0.551784 |3 from M4P_[0] to |1[n_dfit],
+ M4P_[3]: |1[n_dfit]; Q_dfit: (M4P_[3]-M4P_[0])/4
+ M4P_[1]: |1[m_dfit+1]-Q_dfit; M4P_[2]: |1[m_dfit+1]+Q_dfit
+ spline 0.551784 |3 from M4P_[0] to M4P_[1] then to M4P_[2] then to M4P_[3],
+ fitpoints(|1,|2,|4,M4P_,0)
+ # draw using computed control points
+ spline 0.551784 |3 from M4P_[0] to 11/32 between M4P_[0] and M4P_[1] \
+ then to 5/32 between M4P_[1] and M4P_[2]
+ for i_dfit=2 to np_dfit-2 do { continue to M4P_[i_dfit] }
+ continue to 27/32 between M4P_[np_dfit-2] and M4P_[np_dfit-1] \
+ then to 21/32 between M4P_[np_dfit-1] and M4P_[np_dfit] \
+ then to M4P_[np_dfit]) }',|,$) ')
+ dfitcurve($@) ')
+')
+
+ `Sinusoids and lollipop signals
+ Cosine( amplitude, freq, time, phase )'
+define(`Cosine',`(`$1')*cos((`$2')*(`$3')ifelse((`$4'),(),,`+(`$4')'))')
+
+ `lpop(xcoord, ycoord, radius, fill, zeroht)
+ for lollipop graphs'
+define(`lpop',`dot(at (`$1',`$2'),`$3',`$4')
+ line to (`$1',ifelse(`$5',,0,`$5')) chop ifelse(`$3',,`dotrad_',`$3') chop 0')
+
+ `sinc(x) the sinc function'
+define(`sinc',`sin(max(pi_*abs(`$1'),1e-6))/max(pi_*abs(`$1'),1e-6)')
+
+ `sinusoid(amplitude, frequency, phase,
+ tmin,tmax, linetype )
+ in the current direction (only with dpic) in [ ]
+ brackets; e.g., to draw a dashed sine curve,
+ amplitude a, of n cycles over length 0 to x:
+ sinusoid(a,twopi_*n/x,-pi_/2,0,x,dashed) \
+ with [.Start|.End|.Origin] at position'
+ifdpic(`
+define(`sinusoid',
+ `define(`m4s_a',`ifelse(`$1',,linewid,(`$1'))')dnl
+ define(`m4s_ph',`ifelse(`$3',,0,(`$3'))')dnl
+ define(`m4s_m',`ifelse(`$4',,0,(`$4'))')dnl
+ define(`m4s_M',`ifelse(`$5',,linewid,(`$5'))')dnl
+ [ Origin: (0,0)
+ Tmin: vec_(m4s_m,0) ; Tmax: vec_(m4s_M,0)
+ h = m4s_M-m4s_m
+ ifelse(`$2',,`if h==0 then { f = twopi_ } else { f = twopi_/h }',`f = `$2'')
+ tm = 2*f
+ w0 = tm*m4s_m + 2*m4s_ph
+ h0 = -m4_t_fun(-1,h,m4s_a/2)/h;
+ n = (int(h/(twopi_/(tm/2)))+1)*12
+ for i = 0 to n do {
+ t = m4s_m+m4_t_fun(h0,h*i/n,m4s_a/2);
+ M4S_[i]: vec_(t,Cosine(m4s_a,f,t,m4s_ph)) }
+ Start: M4S_[0]
+ End: M4S_[n]
+ fitcurve(M4S_,n,`$6')
+ `$7' ]')
+ define(`m4_t_fun',
+ `((`$1'+(`$3'))*(`$2')-(`$3')/tm*(sin(tm*(`$2')+w0)-sin(w0)))') ')
+
+define(`def_bisect',`NeedDpicTools') # This macro is obsolete
+
+ Normally redefined in initialization macros:
+ifelse(ifgpic(,F)`'ifpstricks(,F)`'ifmfpic(,F)`'ifpgf(,F)`'ifsvg(,F),,`
+define(`thinlines_',`
+command "\thinlines%"
+') TeX commands are written on separate lines
+define(`thicklines_',`
+command "\thicklines%"
+')')
+ `Colour routines:'
+ `graystring(value in [0,1])'
+define(`graystring',`rgbstring(`$1',`$1',`$1')')
+
+ `rgbstring(color triple: values in [0,1])
+ (example rgbstring(0.2,0.3,0.4) )
+ or, when allowed by the postprocessor,
+ rgbstring(color name)
+ xcolor example: rgbstring(blue!20!black!30)
+ evaluates to a string for use in
+ `outlined string' or `shaded string'
+ (mpost,PSTricks,pdf,tikz-pgf,postscript,svg
+ only)'
+ifelse(
+m4postprocessor,pstricks,`define(`rgbstring',`ifelse(`$2',,`"$1"',
+ `sprintf("{rgb,1:red,%7.5f;green,%7.5f;blue,%7.5f}",`$1',`$2',`$3')')')',
+m4postprocessor,pgf, `define(`rgbstring',`ifelse(`$2',,`"$1"',
+ `sprintf("{rgb,1:red,%7.5f;green,%7.5f;blue,%7.5f}",`$1',`$2',`$3')')')',
+m4postprocessor,svg, `define(`rgbstring',
+ `sprintf("rgb(%g,%g,%g)",color255(`$1',`$2',`$3'))')',
+m4postprocessor,mpost, `define(`rgbstring',`ifelse(`$2',,`"$1"',
+ `sprintf("(%g,%g,%g)",`$1',`$2',`$3')')')',
+m4postprocessor,pdf, `define(`rgbstring',
+ `sprintf("%g %g %g",`$1',`$2',`$3')')',
+m4postprocessor,postscript,`define(`rgbstring',
+ `sprintf("%g %g %g",`$1',`$2',`$3')')',
+`define(`rgbstring',"")')
+
+ `setrgb(red value, green value, blue value,
+ [name],[D][F])
+ define colour for lines and text.
+ arg5 (svg only): D=draw, F=fill
+ SVG values are 0 to 255
+ see also \usepackage{latexcolors} and
+ latexcolor.com'
+define(`setrgb',`pushdef(`r_',`$1')pushdef(`g_',`$2')pushdef(`b_',`$3')dnl
+pushdef(`m4cl_',ifelse(`$4',,lcspec,`$4'))dnl
+ifelse(m4postprocessor,pstricks,
+ `command sprintf("\definecolor{m4cl_}{rgb}{%7.5f,%7.5f,%7.5f}%%",r_,g_,b_)
+ command sprintf("\color[rgb]{%7.5f,%7.5f,%7.5f}%%",r_,g_,b_)
+ command "\psset{linecolor=m4cl_}%%" ',
+m4postprocessor,svg,`
+ command "<g " \
+ ifinstr(`$5',F,,
+ `+ sprintf("stroke=\"rgb(%g,%g,%g)\" ",round_(r_),round_(g_),round_(b_))') \
+ ifinstr(`$5',D,,
+ `+ sprintf("fill=\"rgb(%g,%g,%g)\"", round_(r_),round_(g_),round_(b_))') \
+ + ">"',
+m4postprocessor,pgf,`
+ command sprintf("\definecolor{m4cl_}{rgb}{%7.5f,%7.5f,%7.5f}%%",r_,g_,b_)
+ command sprintf("\color[rgb]{%7.5f,%7.5f,%7.5f}%%",r_,g_,b_)
+ ifdef(`m4pco',,
+ `command "\global\let\dpiclidraw=\dpicdraw\global\let\dpicfidraw=\filldraw"
+ command "\global\def\dpicdraw{\dpiclidraw[color=m4cl_]}"
+ command "\global\def\filldraw{\dpicfidraw[color=m4cl_]}"pushdef(`m4pco')')',
+m4postprocessor,mpost,`
+ command "def drw=draw enddef; def X=lcolr;enddef;"
+ command sprintf("def m4cl_=(%7.5f,%7.5f,%7.5f)enddef;",r_,g_,b_)
+ command "def lcolr=withcolor m4cl_ enddef;"'
+)')
+ `resetrgb: reset to previous colour definitions'
+define(`resetrgb',`popdef(`m4cl_')popdef(`r_')popdef(`g_')popdef(`b_')dnl
+ifelse(m4postprocessor,pstricks,`ifdef(`r_',
+ `command sprintf("\definecolor{m4cl_}{rgb}{%7.5f,%7.5f,%7.5f}%%",r_,g_,b_)
+ command sprintf("\color[rgb]{%7.5f,%7.5f,%7.5f}%%",r_,g_,b_)
+ command "\psset{linecolor=m4cl_}%%" ',
+ `command "\psset{linecolor=black}\color{black}%"') ',
+m4postprocessor,svg,`
+ command "</g>" ',
+m4postprocessor,pgf,` popdef(`m4pco')
+ ifdef(`m4pco',
+ `command sprintf("\definecolor{lcspec}{rgb}{%7.5f,%7.5f,%7.5f}%%",r_,g_,b_)
+ command sprintf("\color[rgb]{%7.5f,%7.5f,%7.5f}%%",r_,g_,b_)',
+ `command "\color{black}\global\let\dpicdraw=\dpiclidraw%"
+ command "\global\let\filldraw=\dpicfidraw"') ',
+m4postprocessor,mpost,`
+ command "def X=;enddef; def lcolr= enddef;"'
+)')
+
+ `rgbdraw(color triple, drawing commands)
+ SVG: 0 to 255'
+define(`rgbdraw',`setrgb(`$1',`$2',`$3',,ifsvg(D))
+shift(shift(shift($@)))
+resetrgb
+')
+ `rgbfill(color triple, closed path)
+ (PSTricks,svg,pgf-tikz,mpost)
+ SVG colors: 0 to 255 '
+define(`rgbfill',`
+ifelse(m4postprocessor,pstricks,
+ `command sprintf("\definecolor{fcspec}{rgb}{%7.5f,%7.5f,%7.5f}%%",\
+ `$1',`$2',`$3')
+ command sprintf("\pscustom[fillcolor=fcspec,fillstyle=solid]{%%")
+ shift(shift(shift($@)))
+ command "}%"',
+m4postprocessor,svg,
+ `setrgb(`$1',`$2',`$3',,ifsvg(F))
+ shift(shift(shift($@)))
+ resetrgb',
+m4postprocessor,pgf,
+ `command \
+ sprintf("\definecolor{fcspec}{rgb}{%7.5f,%7.5f,%7.5f}%%",`$1',`$2',`$3')
+ command "\global\def\dpicstop{--}"
+ command "\global\let\dpicfdraw=\dpicdraw\global\def\dpicdraw{}"
+ command "\path[fill=fcspec]"
+ {`$4'}
+ command "cycle; \global\let\dpicdraw=\dpicfdraw\global\def\dpicstop{;}"
+ `$4'',
+m4postprocessor,mpost,
+ `command "def Y="
+ shift(shift(shift($@)))
+ command "enddef; def drw= enddef; def X=--enddef;"
+ command sprintf("fill Y cycle withcolor (%7.5f,%7.5f,%7.5f);",`$1',`$2',`$3')
+ command "def drw=draw enddef; def X=;enddef; Y;"'
+)')
+ Pstricks conditional command
+define(`psset_',`ifpstricks(`dnl
+command sprintf("\psset{$@}%%")
+')')
+
+ Kludge for SVG color-filled line
+ifsvg(
+`define(`m4c_l',`ifdef(`r_',`colored rgbstring(r_,g_,b_)')')',
+`define(`m4c_l',)')
+
+ Adjust fill value if gpic is used
+define(`fill_',`dnl
+ fill ifgpic(`1-(')ifelse(`$1',,fillval,`$1') ifgpic(`)')')
+
+define(`m4dir',right)
+define(`m4_k',0)
+
+ Define m4x_ etc for horiz and vert lines
+manhattan
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/liblog.m4 b/Master/texmf-dist/doc/latex/circuit-macros/liblog.m4
new file mode 100644
index 00000000000..2e9b7baca4f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/liblog.m4
@@ -0,0 +1,1053 @@
+divert(-1)
+ liblog.m4 Logic gates
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`liblog_')
+
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')
+ifdef(`libcct_',,`include(libcct.m4)divert(-1)')
+
+`Notes: ==================================================================
+ Gates other than BUFFER and NOT have an optional integer argument N
+ that sets the number of input locations, which then have labels In1
+ to InN.
+
+ BUFFER and NOT gates have In1 only. If there is a first argument, it
+ is a line specification and the gate is drawn along the line as for a
+ two-terminal element.
+
+ NEGATED inputs are obtained if the second argument is N (uppercase n).
+
+ DEBUGGING: The statement
+ print "`$0'($@)" ;
+ inserted into a macro will display the macro name and current arguments
+ ========================================================================='
+
+ `Size parameter for logic and grid mesh'
+define(`L_unit',`(linewid/10)')
+
+ `Dimensions in L_units, also for external use:'
+define(`G_hht',3) `gate half-height'
+define(`AND_ht',`(2*G_hht)') `gate heights and widths ...'
+define(`AND_wd',7)
+define(`BUF_ht',4)
+define(`BUF_wd',3.5)
+define(`OR_rad',7) `OR input radius'
+define(`XOR_off',1) `XOR and NXOR parameter'
+define(`N_diam',(3/2)) `not-circle diameter'
+define(`N_rad',`(N_diam/2)') `not-circle radius'
+define(`NOT_rad',`(N_rad*L_unit)') `scaled radius eg line chop NOT_rad'
+define(`H_ht',2) `Hysteresis symbol dimen'
+define(`Mx_pins',6) `max number of gate input pins without extensions
+ Possibly 4 is better for negated inputs'
+define(`FF_wid',12) `Bistable (flipflop)'
+define(`FF_ht',18)
+define(`Mux_wid',8) `Multiplexer defaults'
+define(`Mux_ht',18)
+
+define(`lg_plen',4) `Logic pin'
+define(`lg_pintxt',
+ `"ifxfig(`$1',`ifsvg(`svg_small(`$1',75)',`sp_{\scriptsize `$1'}sp_')')"')
+ `Logic pin text with bar where possible'
+define(`lg_bartxt',`iflatex(`$\overline{\hbox{`$1'}}$',`$1')')
+ `The comma has to be at the top level'
+define(`m4_pattocomma',`patsubst(`$1',`$2',`,')')
+
+ `Scale grid coordinates to world coordinates'
+define(`grid_',`(vscal_(L_unit,`$1',`$2'))')
+ `Scale and rotate grid coords to world coords'
+define(`svec_',`vec_(vscal_(L_unit,`$1',`$2'))')
+ `Relative svec_'
+define(`rsvec_',`Here+svec_(`$1',`$2')')
+
+ `NOT_circle
+ convenience for drawing NOT circles'
+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)
+ line to svec_(H_ht,0) \
+ then to svec_(1.1*H_ht,m4Hs)
+ line from rsvec_(0.4*H_ht,0) \
+ to rsvec_(-0.6*H_ht,0) \
+ then to rsvec_(-0.7*H_ht,-(m4Hs))
+ `$2'; resetdir_ ] ')
+
+ `LT_symbol(U|D|L|R|degrees)
+ triangle_symbol'
+define(`LT_symbol', `[ setdir_(`$1',R)
+ line to svec_(0,H_ht*5/8) then to svec_(H_ht,0) \
+ then to svec_(0,-H_ht*5/8) then to Here
+ `$2'; resetdir_ ] ')
+
+ `BOX_gate(inputs,output,swid,sht,label)
+ drawn in the current direction
+ args 3 and 4 are L_unit values
+ inputs=[P|N]* output=P|N'
+define(`BOX_gate',`dnl
+define(`m4m',`ifelse(`$1',,2,len(`$1'))')define(`m4a',`$1')dnl
+define(`m4h',`ifelse(`$3',,AND_wd,`$3')')dnl
+define(`m4v',`ifelse(`$4',,AND_wd,`$4')')dnl
+[ Box: [Outline: line to svec_(0,m4v/2) then to svec_(m4h,m4v/2) \
+ then to svec_(m4h,-m4v/2) then to svec_(0,-m4v/2) then to (0,0) ] \
+ with .Outline.start at (0,0)
+ ifelse(`$5',,,`{ move to Box.n+(0,-5pt__)
+ m4lstring($5,"ifsvg(`svg_small($5,75)',`{\scriptsize$ $5 $}')") }')
+ IOdefs(from svec_(0,m4v/2) to svec_(0,-m4v/2),In,`$1',R)
+ Out: svec_(m4h,0) ifelse(`$2',N,`+svec_(N_diam,0)
+ N_Out: NOT_circle \
+ at Out-svec_(N_rad,0)'); `$6']')
+
+ `AND_gate(n,[N][B],wid,ht)
+ drawn in the current direction
+ 0 <= n <= 16; N=negated inputs, B=box shape
+ or
+ AND_gate(chars,[B],wid,ht)
+ arg1 is one or more of N|P '
+define(`AND_gate',`define(`m4arg1',ifelse(`$1',,2,`$1'))dnl
+ifelse(ifinstr(m4arg1,N,1)`'ifinstr(m4arg1,P,1),,
+`m4dupstr(ifinstr(`$2',N,N,P),m4arg1,`m4PN')',`define(`m4PN',m4arg1)')dnl
+ifinstr(`$2',B,
+`BOX_gate(m4PN,ifinstr(`$2',N,N,P),ifelse(`$3',,,`($3)/(L_unit)'),
+ ifelse(`$4',,,`($4)/(L_unit)'),ifsvg(`&```amp''';',`\&'),`$5')',
+`AND_gen(m4PN,ifelse(`$2',N,N)IBAONESEC,`$3',`$4',`$5')')')
+
+ `NAND_gate(n,[N][B],wid,ht)
+ 0 <= n <= 16; N=negated inputs, B=box shape
+ or
+ NAND_gate(chars,[B],wid,ht)
+ arg1 is one or more of N|P '
+define(`NAND_gate',`define(`m4arg1',ifelse(`$1',,2,`$1'))dnl
+ifelse(ifinstr(m4arg1,N,1)`'ifinstr(m4arg1,P,1),,
+`m4dupstr(ifinstr(`$2',N,N,P),m4arg1,`m4PN')',`define(`m4PN',m4arg1)')dnl
+ifinstr(`$2',B,
+`BOX_gate(m4PN,ifelse(`$2',N,N,P),ifelse(`$3',,,`($3)/(L_unit)'),
+ ifelse(`$4',,,`($4)/(L_unit)'),ifsvg(`&```amp''';',`\&'),`$5')',
+`AND_gen(m4PN,ifelse(`$2',N,N)IBANONESEC,`$3',`$4',`$5')')')
+
+ `AND_gen(n,chars,[wid,[ht]])
+ 0 <= n <= 16
+ 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 location
+ or
+ AND_gen(chars,chars,[wid,[ht]])
+ arg1 is one or more of N|P
+ eg PPPP defines 4 inputs,
+ NPNP negates the first and third;
+ arg2 as above except [N]I is ignored '
+define(`AND_gen',`define(`m4arg1',ifelse(`$1',,2,`$1'))dnl
+ifelse(ifinstr(m4arg1,N,1)`'ifinstr(m4arg1,P,1),,
+ `m4dupstr(ifinstr(`$2',N,N,P),m4arg1,`m4PN')',`define(`m4PN',m4arg1)')dnl
+ define(`m4hor',`ifelse(`$3',,AND_wd,`($3)/(L_unit)')')dnl
+ define(`m4ver',`ifelse(`$4',,ifelse(`$3',,AND_ht,AND_ht/(AND_wd)*m4hor),
+ `($4)/(L_unit)')')define(`dna_',ifelse(`$2',,IBAONESEC,`$2'))dnl
+ [ sc_draw(`dna_',B,`Bm: line from svec_(m4hor-m4ver/2,-m4ver/2) \
+ to svec_(0,-m4ver/2) \
+ then to svec_(0,m4ver/2) then \
+ to svec_(m4hor-m4ver/2,m4ver/2)
+ ')dnl
+ sc_draw(`dna_',A,`Arc: arc cw rad m4ver/2 \
+ to rsvec_(0,-m4ver) \
+ with .c at rsvec_(0,-m4ver/2)
+ ')dnl
+ sc_draw(`dna_',NNE,
+ `NNE: svec_(m4hor-m4ver/2,0)+svec_(Rect_(m4ver/2+N_diam,45))
+ N_NNE: NOT_circle \
+ at svec_(m4hor-m4ver/2,0)+svec_(Rect_(m4ver/2+N_rad,45))
+ ')dnl
+ sc_draw(`dna_',NSE,
+ `NSE: svec_(m4hor-m4ver/2,0)+svec_(Rect_(m4ver/2+N_diam,-45))
+ N_NSE: NOT_circle \
+ at svec_(m4hor-m4ver/2,0)+svec_(Rect_(m4ver/2+N_rad,-45))
+ ')dnl
+ sc_draw(`dna_',NE, `NE: svec_(m4hor-m4ver/2,0)+svec_(Rect_(m4ver/2,45))
+ ')dnl
+ ifelse(ifinstr(`$1',N,1)`'ifinstr(`$1',P,1),,
+ `sc_draw(`dna_',NI, `m4A_defs(ifelse(`$1',,2,`$1'),N)')
+ ')dnl
+ sc_draw(`dna_',SE, `SE: svec_(m4hor-m4ver/2,0)+svec_(Rect_(m4ver/2,-45))
+ ')dnl
+ sc_draw(`dna_',NN, `N_NN: NOT_circle \
+ at svec_((m4hor-m4ver/2)/2,m4ver/2+N_rad)
+ NN: svec_((m4hor-m4ver/2)/2,m4ver/2+N_diam)
+ ')dnl
+ sc_draw(`dna_',NS, `N_NS: NOT_circle \
+ at svec_((m4hor-m4ver/2)/2,-m4ver/2-N_rad)
+ NS: svec_((m4hor-m4ver/2)/2,-m4ver/2-N_diam)
+ ')dnl
+ sc_draw(`dna_',NO, `N_Out: NOT_circle \
+ at svec_(m4hor+N_rad,0)
+ Out: svec_(m4hor+N_diam,0)
+ ')dnl
+ sc_draw(`dna_',O, `Out: svec_(m4hor,0)
+ ')dnl
+ sc_draw(`dna_',N, `N: svec_(0,m4ver/2)
+ ')dnl
+ ifelse(ifinstr(`$1',N,1)`'ifinstr(`$1',P,1),,
+ `sc_draw(`dna_',I, `m4A_defs(ifelse(`$1',,2,`$1'))')',
+ `m4A_defs(`$1')')
+ sc_draw(`dna_',S, `S: svec_(0,-m4ver/2)
+ ')dnl
+ sc_draw(`dna_',C, `C: svec_(m4hor/2,0)')
+ `$5']')
+
+ `Input locations, flat face
+ m4A_defs(n,[N]) or m4A_defs(string)
+ string = one or more N|P
+ otherwise n inputs (negated if arg2 is N)
+ Input points are defined as Inx
+ and NOT circles as N_Inx where x is integer'
+ `What about the IOdefs macro?'
+define(`m4A_defs',`define(`m4arg1',ifelse(`$1',,2,`$1'))dnl
+ ifelse(ifinstr(m4arg1,N,1)`'ifinstr(m4arg1,P,1),,
+ `m4dupstr(ifinstr(`$2',N,N,P),m4arg1,`m4AI')define(`m4AnI',m4arg1)',
+ `define(`m4AI',m4arg1)define(`m4AnI',len(m4arg1))')dnl
+ define(`m4m',`m4ver/2/min(m4AnI,Mx_pins-1)*min(m4AnI,3*(Mx_pins-1))')dnl
+ ifelse(eval(m4AnI>Mx_pins),1,
+ `line from svec_(0, m4m) \
+ to svec_(0,m4ver/2)
+ line from svec_(0,-m4m) \
+ to svec_(0,-m4ver/2)')
+ for_(1,m4AnI,1,`ifelse(substr(m4AI,0,1),N,
+ `N_In`'m4x: NOT_circle at \
+ svec_(-N_rad,m4ver/min(m4AnI,Mx_pins-1)*((m4AnI+1)/2-m4x))
+ In`'m4x: svec_(-N_diam,m4ver/min(m4AnI,Mx_pins-1)*((m4AnI+1)/2-m4x)) ',
+ `In`'m4x: svec_(0,m4ver/min(m4AnI,Mx_pins-1)*((m4AnI+1)/2-m4x))')dnl
+ define(`m4AI',substr(m4AI,1)) ') ')
+
+ `OR_gate or NOR_gate or XOR_gate or NXOR_gate
+ drawn in the current direction
+ args = (n,[N][B],wid,ht)
+ 0 <= n <= 16; N=negated inputs, B=box shape
+ or
+ args = (chars,[B],wid,ht)
+ arg1 is one or more of N|P '
+define(`OR_gate',`m4_OR(OR,$@)')
+define(`NOR_gate',`m4_OR(NOR,$@)')
+define(`XOR_gate',`m4_OR(XOR,$@)')
+define(`NXOR_gate',`m4_OR(NXOR,$@)')
+
+define(`m4_OR',`define(`m4arg1',ifelse(`$2',,2,`$2'))dnl
+ifelse(ifinstr(m4arg1,N,1)`'ifinstr(m4arg1,P,1),,
+ `m4dupstr(ifinstr(`$3',N,N,P),m4arg1,`m4PN')',`define(`m4PN',m4arg1)')dnl
+ifinstr(`$3',B,
+`BOX_gate(m4PN,ifinstr(`$3',N,N,P),
+ ifelse(`$4',,,`($4)/(L_unit)'),ifelse(`$5',,,`($5)/(L_unit)'),
+ ifinstr(`$1',XOR,`=',`ifsvg(`>=1',`\geq 1')'),`$6')',
+`OR_gen(m4PN,
+ ifinstr(`$1',XOR,P)`'ifelse(`$3',N,N)IBA`'ifelse(substr(`$1',0,1),N,N)ONESEC,
+ shift(shift(shift($@))))')')
+
+ `OR_gen(n,chars,[wid,[ht]])
+ 0 <= n <= 16
+ B=base and straight sides; A=Arc;
+ [N]NE,[N]SE,[N]I,[N]N,[N]S=inputs or circles,
+ [N]P=XOR arc; [N]O=output; C=center
+ or
+ OR_gen(chars,chars,[wid,[ht]])
+ arg1 is one or more of N|P
+ eg PPPP defines 4 inputs,
+ NPNP negates the first and third;
+ arg2 as above except [N]I is ignored '
+define(`OR_gen',`[define(`m4arg1',ifelse(`$1',,2,`$1'))dnl
+ifelse(ifinstr(m4arg1,N,1)`'ifinstr(m4arg1,P,1),,
+ `m4dupstr(ifinstr(`$2',N,N,P),m4arg1,`m4PN')',`define(`m4PN',m4arg1)')dnl
+ define(`m4hor',`ifelse(`$3',,AND_wd,`($3)/(L_unit)')')define(`m4o',0)dnl
+ define(`m4ver',`ifelse(`$4',,ifelse(`$3',,AND_ht,AND_ht/(AND_wd)*m4hor),
+ `($4)/(L_unit)')')define(`dna_',ifelse(`$2',,IBAONESEC,`$2'))dnl
+ sc_draw(`dna_',P,`define(`m4o',XOR_off*m4ver/(AND_ht))dnl
+ Parc: arc cw from svec_(0,m4ver/2) \
+ to svec_(0,-m4ver/2) \
+ with .c at svec_(-sqrt((OR_rad*m4ver/(AND_ht))^2-(m4ver/2)^2),0)
+ ')dnl
+ sc_draw(`dna_',B,dnl
+ `Bt: line from svec_(m4o+m4hor/3,m4ver/2) \
+ to svec_(m4o,m4ver/2) ifdpic(chop 0 chop -hlth)
+ ArcB: arc cw to svec_(m4o,-m4ver/2) \
+ with .c at svec_(m4o-sqrt((OR_rad*m4ver/(AND_ht))^2-(m4ver/2)^2),0)
+ Bb: line to svec_(m4o+m4hor/3,-m4ver/2) ifdpic(chop -hlth chop 0)
+ ')dnl
+ sc_draw(`dna_',A,`define(`m4m',`((m4hor*2/3)^2-(m4ver/2)^2)/(m4ver)')dnl
+ ArcN: arc cw from svec_(m4o+m4hor/3, m4ver/2) \
+ to svec_(m4o+m4hor,0) \
+ with .c at svec_(m4o+m4hor/3,-m4m)
+ ArcS: arc ccw from svec_(m4o+m4hor/3,-m4ver/2) \
+ to svec_(m4o+m4hor,0) \
+ with .c at svec_(m4o+m4hor/3,m4m)
+ ')dnl
+ sc_draw(`dna_',NNE,
+ `N_NNE: NOT_circle \
+ at svec_(m4o+m4hor/3,-m4m)+svec_(Rect_(m4ver/2+m4m+N_rad,60))
+ NNE: svec_(m4o+m4hor/3,-m4m)+svec_(Rect_(m4ver/2+m4m+N_diam,60))
+ ')dnl
+ sc_draw(`dna_',NSE,
+ `N_NSE: NOT_circle \
+ at svec_(m4o+m4hor/3,m4m)+svec_(Rect_(m4ver/2+m4m+N_rad,-60))
+ NSE: svec_(m4o+m4hor/3,m4m)+svec_(Rect_(m4ver/2+m4m+N_diam,-60))
+ ')dnl
+ sc_draw(`dna_',NE, `NE: svec_(m4o+m4hor/3,-m4m)+svec_(Rect_(m4ver/2+m4m,60))
+ ')dnl
+ sc_draw(`dna_',SE, `SE: svec_(m4o+m4hor/3,m4m)+svec_(Rect_(m4ver/2+m4m,-60))
+ ')dnl
+ ifelse(ifinstr(`$1',N,1)`'ifinstr(`$1',P,1),,
+ `sc_draw(`dna_',NI, `m4O_defs(ifelse(`$1',,2,`$1'),N)')
+ ')dnl
+ sc_draw(`dna_',NN, `N_NN: NOT_circle \
+ at svec_(m4o+m4hor/6,m4ver/2+N_rad)
+ NN: svec_(m4o+m4hor/6,m4ver/2+N_diam)
+ ')dnl
+ sc_draw(`dna_',NS, `N_NS: NOT_circle \
+ at svec_(m4o+m4hor/6,-m4ver/2-N_rad)
+ NS: svec_(m4o+m4hor/6,-m4ver/2-N_diam)
+ ')dnl
+ sc_draw(`dna_',NO, `N_Out: NOT_circle \
+ at svec_(m4o+m4hor+N_rad,0)
+ Out: svec_(m4o+m4hor+N_diam,0)
+ ')dnl
+ sc_draw(`dna_',O, `Out: svec_(m4o+m4hor,0)
+ ')dnl
+ sc_draw(`dna_',N, `N: svec_(m4o+m4hor/6,m4ver/2)
+ ')dnl
+ ifelse(ifinstr(`$1',N,1)`'ifinstr(`$1',P,1),,
+ `sc_draw(`dna_',I, `m4O_defs(ifelse(`$1',,2,`$1'))')',
+ `m4O_defs(`$1')')
+ sc_draw(`dna_',S, `S: svec_(m4o+m4hor/6,-m4ver/2)
+ ')dnl
+ sc_draw(`dna_',C, `C: svec_(m4o+m4hor/2,0)')
+ `$5']')
+
+ `Input locations, curved face
+ m4O_defs(n,[N]) or m4O_defs(string)
+ string = one or more N|P
+ otherwise n inputs (negated if arg2 is N)
+ Input points are defined as Inx
+ and NOT circles as N_Inx where x is integer'
+define(`m4O_defs',`define(`m4arg1',ifelse(`$1',,2,`$1'))dnl
+ ifelse(ifinstr(m4arg1,N,1)`'ifinstr(m4arg1,P,1),,
+ `m4dupstr(ifinstr(`$2',N,N,P),m4arg1,`m4OI')define(`m4OnI',m4arg1)',
+ `define(`m4OI',m4arg1)define(`m4OnI',len(m4arg1))')dnl
+ define(`m4om',`m4ver/2/min(m4OnI,Mx_pins-1)*min(m4OnI,3*(Mx_pins-1))')dnl
+ ifelse(eval(m4OnI>Mx_pins),1,
+ `arc ccw from svec_(0,m4ver/2) \
+ to svec_(0,m4ver) + M4O_pos(m4om-m4ver) \
+ with .c at svec_(-M4O_dst,m4ver)
+ arc cw from svec_(0,-m4ver/2) \
+ to svec_(0,-m4ver) +M4O_pos(-(m4om-m4ver))\
+ with .c at svec_(-M4O_dst,-m4ver)
+ ')dnl
+ define(`m4on',`(eval((m4OnI-Mx_pins+1)/2))')dnl
+ for_(1,m4OnI,1,
+ `define(`m4oq',`m4ver/2/min(m4OnI,Mx_pins-1)*(m4OnI+1-2*m4x)')dnl
+ In`'m4x: ifelse(eval(m4x<=m4on),1,`svec_(0, m4ver)+M4O_pos(m4oq-m4ver)',
+ eval(m4x>(m4OnI-m4on)),1, `svec_(0,-m4ver)+M4O_pos(m4oq+m4ver)',
+ `M4O_pos(m4oq)')
+ ifelse(substr(m4OI,0,1),N,
+ `N_In`'m4x: NOT_circle \
+ at In`'m4x+svec_(-N_rad,0)
+ In`'m4x: In`'m4x+svec_(-N_diam,0)
+ ')dnl
+ define(`m4OI',substr(m4OI,1))dnl
+ ')
+ ')
+define(`M4O_dst',`sqrt((OR_rad*m4ver/(AND_ht))^2-(m4ver/2)^2)')
+define(`M4O_pos',`svec_(-M4O_dst+sqrt((OR_rad*m4ver/(AND_ht))^2-(`$1')^2),
+ `$1')')
+
+ `IOdefs(linespec,label,[P|N]*,L|R)
+ Distribute named locations with optional NOT
+ circles along a line
+ eg IOdefs(up 1,Z,PNN,R) defines Z1 at 1/6
+ along the line, NOT circles N_Z2 and N_Z3 to
+ the right at 1/2 and 5/6 along the line with
+ Z2 and Z3 labeled at their right edges'
+define(`IOdefs',`define(`m4dm',`ifelse(`$3',,1,len(`$3'))')
+ define(`m4da',`$3')define(`m4dv',`ifelse(`$2',,In,`$2')')
+ M4TL: move `$1'
+ M4PL: vperp(M4TL,L_unit)
+ for_(1,m4dm,1,
+ `m4dv`'m4x: ((m4x-1/2)/m4dm between M4TL.start and M4TL.end) dnl
+ ifelse(substr(m4da,0,1),N,`\
+ ifelse(`$4',R,-,+)(M4PL.x*N_diam,M4PL.y*N_diam)
+ {N_`'m4dv`'m4x: NOT_circle \
+ at m4dv`'m4x ifelse(`$4',R,+,-)(M4PL.x*N_rad,M4PL.y*N_rad)}')
+ define(`m4da',substr(m4da,1))') ')
+
+ `BUFFER_gen(chars,wd,ht,[N|P]*,[N|P]*,[N|P]*)
+ chars: T=triangle (default),
+ [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 define In, NE,
+ and SE argument sequences'
+define(`BUFFER_gen',
+ `define(`m4h',`ifelse(`$2',,BUF_wd,`($2)/(L_unit)')')define(`m4y',m4h)dnl
+ define(`m4v',`ifelse(`$3',,BUF_ht,`($3)/(L_unit)')')dnl
+ define(`dna_',ifelse(`$1',,ITOCNESE,`$1'))dnl
+ define(`m4z',`N_rad/vlength(m4h,m4v/2)')dnl
+ [sc_draw(`dna_',T,`Tm: line from svec_(m4h,0) \
+ to svec_(0,-m4v/2) \
+ then to svec_(0,m4v/2) \
+ then to svec_(m4h,0)
+ Tc: svec_(m4h/2,0)
+ ')dnl
+ sc_draw(`dna_',NNE,`N_NNE: NOT_circle \
+ at svec_(m4h/2,m4v/4)+svec_(m4v/2*m4z,m4h*m4z)
+ NNE: svec_(m4h/2,m4v/4)+svec_(m4v*m4z,m4h*2*m4z)
+ ')dnl
+ sc_draw(`dna_',NSE,`N_NSE: NOT_circle \
+ at svec_(m4h/2,-m4v/4)-svec_(-m4v/2*m4z,m4h*m4z)
+ NSE: svec_(m4h/2,-m4v/4)-svec_(-m4v*m4z,m4h*2*m4z)
+ ')dnl
+ sc_draw(`dna_',NI,`define(`m4y',m4y+N_diam) In1: svec_(-N_diam,0)
+ N_In1: NOT_circle \
+ at svec_(-N_rad,0)
+ ')dnl
+ sc_draw(`dna_',NE, `NE: svec_(m4h/2,m4v/4)
+ ')dnl
+ sc_draw(`dna_',SE, `SE: svec_(m4h/2,-m4v/4)
+ ')dnl
+ sc_draw(`dna_',NN, `N_NN: NOT_circle \
+ at svec_(0,m4v/2+N_rad)
+ NN: svec_(0,m4v/2+N_diam)
+ ')dnl
+ sc_draw(`dna_',NS, `N_NS: NOT_circle \
+ at svec_(0,-m4v/2-N_rad)
+ NS: svec_(0,-m4v/2-N_diam)
+ ')dnl
+ sc_draw(`dna_',NO,`define(`m4y',m4y+N_diam) Out: svec_(m4h+N_diam,0)
+ N_Out: NOT_circle \
+ at svec_(m4h+N_rad,0)
+ ')dnl
+ sc_draw(`dna_',N, `N: svec_(0,m4v/2)
+ ')dnl
+ sc_draw(`dna_',S, `S: svec_(0,-m4v/2)
+ ')dnl
+ sc_draw(`dna_',O, `Out: svec_(m4h,0)
+ ')dnl
+ sc_draw(`dna_',I, `In1: (0,0)
+ ')dnl
+ sc_draw(`dna_',C, `C: svec_(m4h/3,0)
+ ')dnl
+ ifelse(`$4',,,`IOdefs(from svec_(0,m4v/2) to svec_(0,-m4v/2),In,`$4',R)')
+ ifelse(`$5',,,`IOdefs(from svec_(0,m4v/2) to svec_(m4h,0),NE,`$5')')
+ ifelse(`$6',,,`IOdefs(from svec_(0,-m4v/2) to svec_(m4h,0),SE,`$6',R)')
+ `$7']')
+
+ `BUFFER_gate(linespec,[N|B],wid,ht,
+ [N|P]*,[N|P]*)
+ When linespec is blank then the element is
+ composite and In1, Out, C, NE, and SE are
+ defined; otherwise the element is drawn as
+ two-terminal
+ arg2: B=box gate'
+ Args 5 and 6 define NE and SE argument
+ sequences'
+define(`BUFFER_gate',`ifinstr(`$2',B,
+ `BOX_gate(ifinstr(`$2',N,N,P),P,ifelse(`$3',,,`($3)/(L_unit)'),
+ ifelse(`$4',,,`($4)/(L_unit)'),1,`$5')',
+ `ifelse(`$1',,
+ `BUFFER_gen(ifelse(`$2',N,N)ITOCNESE,`$3',`$4',,`$5',`$6',`$7')',
+ `eleminit_(`$1')
+ { BUFFER_gen(ifelse(`$2',N,N)ITOC,`$3',`$4',,`$5',`$6',`$7') \
+ with .Tc at last line.c }
+ { line to last [].In1; line from last [].Out to 2nd last line.end }
+ line invis to rvec_(rp_len,0)')')')
+
+ `NOT_gate(linespec,[B][N|n],wid,ht)
+ When linespec is blank then the element is
+ composite and In1, Out, C, NE, and SE are
+ defined; otherwise the element is drawn as
+ two-terminal
+ arg2: B=box gate, N=negated input and
+ output, n=negated input only'
+define(`NOT_gate',`ifinstr(`$2',B,
+ `BOX_gate(ifinstr(`$2',N,N,`$2',n,N,P),ifinstr(`$2',n,P,N),
+ ifelse(`$3',,,`($3)/(L_unit)'),ifelse(`$4',,,`($4)/(L_unit)'),1,`$5')',
+ `ifelse(`$1',,
+ `BUFFER_gen(ifinstr(`$2',N,N,`$2',n,N)IT`'ifinstr(`$2',n,,N)OCNESE,
+ `$3',`$4',,,,`$5')',
+ `eleminit_(`$1')
+ { BUFFER_gen(ifinstr(`$2',N,N,`$2',n,N)IT`'ifinstr(`$2',n,,N)OC,
+ `$3',`$4',,,,`$5') \
+ with .C at last line.c }
+ { line to last [].In1; line from last [].Out to 2nd last line.end }
+ line invis to rvec_(rp_len,0)')')')
+
+ `The comprehensive logic pin:
+ lg_pin(location, label, Picname, n|e|s|w [L|M|I|O][N][E], pinno, optlen)
+ n|e|s|w=orientation;
+ L=active low out; M=active low in; I=inward arrow; O=outward arrow
+ N=negated; E=edge trigger'
+define(`lg_pin',`ifelse(`$1',,,`move to $1')
+ define(`dna_',`substr(`$4',1)')define(`m4lE',)define(`m4lN',)dnl
+ define(`m4ld',`ifelse(`$4',,e,`substr(`$4',0,1)')')dnl
+ define(`m4lph',`ifelse(m4ld,n,0,m4ld,w,-1,m4ld,s,0,1)')dnl
+ define(`m4lpv',`ifelse(m4ld,n,1,m4ld,w,0,m4ld,s,-1,0)')dnl
+ define(`m4lpl',`ifelse(`$6',,`lg_plen',`$6')')dnl
+ sc_draw(`dna_',E,`define(`m4lE',1)dnl
+ { line from rsvec_(lp_xy(0,N_rad)) \
+ to rsvec_(lp_xy(-N_diam*sqrt(3)/2,0)) then to rsvec_(lp_xy(0,-N_rad)) }')
+ ifelse(`$2',,,
+ `{ lg_pintxt(`$2') ifelse(m4ld,w,`ljust_', m4ld,n,`below_',
+ m4ld,s,`above_',`rjust_') at Here dnl
+ ifxfig(`+(lp_xy(-0.72bp__,0))') dnl
+ ifelse(m4lE,1,`+svec_(lp_xy(-N_diam*sqrt(3)/2,0))') }')
+ sc_draw(`dna_',N,`define(`m4lN',N)
+ { NOT_circle \
+ at rsvec_(lp_xy(N_rad,0)) }')
+ sc_draw(`dna_',L,`define(`m4lN',M)
+ {line from rsvec_(lp_xy(0,
+ ifelse(m4ld,w,-,m4ld,s,-)N_rad*3/2)) to rsvec_(lp_xy(N_rad*2.5,0)) }')
+ sc_draw(`dna_',M,`define(`m4lN',M)
+ { line to rsvec_(lp_xy(N_rad*2.5,
+ ifelse(m4ld,w,-,m4ld,s,-)N_rad*3/2)) then to rsvec_(lp_xy(N_rad*2.5,0))}')
+ {ifelse(`$3',,,`$3':) line to rsvec_(lp_xy(m4lpl,0))dnl
+ ifelse(m4lN,N,`chop N_diam*L_unit chop 0')dnl
+ ifinstr(dna_,I,` <- wid linethick*5.6bp__ ht linethick*7.2bp__ ')dnl
+ ifinstr(dna_,O,` -> wid linethick*5.6bp__ ht linethick*7.2bp__ ')
+ ifelse(`$5',,,`lg_pintxt(`$5') dnl
+ at rsvec_(lp_xy(vscal_(1/(L_unit),1pt__,0))) dnl
+ ifgpic(
+ `ifelse(m4ld,n,`+svec_(lp_xy(4pt__/(L_unit),0)) rjust_ below_',
+ m4ld,w,`+svec_(lp_xy(vscal_(1/(L_unit),1pt__,3pt__))) \
+ ljust_ above_',
+ m4ld,s,`+svec_(lp_xy(2pt__/(L_unit),0)) rjust_ above_',
+ `+svec_(lp_xy(0,-3pt__/(L_unit))) rjust_ above_') ',
+ `ifelse(m4ld,n,`rjust_ below_', m4ld,w,`ljust_ above_',
+ `rjust_ above_')')') dnl
+ } ')
+define(`lp_xy',`vrot_(`$1',`$2',m4lph,m4lpv)')
+
+ `Mux(ni, label,
+ [L][B|H|X][N[n]|S[n]][[N]OE],wid,ht)
+ ni = number of inputs (default 2)
+ The input pins are lines named
+ In0, In1, ... In<ni-1>
+ chars:
+ L reverses pin numbering,
+ B pin number labels in binary form,
+ H pin number labels in hex form,
+ X disable pin labels
+ N[n] puts pin Sel or pins Sel0 .. Seln
+ at the top (with respect to the drawing
+ direction)
+ S[n] puts the Sel inputs at the
+ bottom (default)
+ OE adds the OE input, NOE negated '
+define(`Mux',`[
+ define(`m4Mwid',`ifelse(`$4',,Mux_wid,((`$4')/(L_unit)))')dnl
+ define(`m4Mht',`ifelse(`$5',,Mux_ht,((`$5')/(L_unit)))')dnl
+ W: (0,0)
+ C: svec_(m4Mwid/2,0)
+ E: svec_(m4Mwid,0)
+ NW: svec_(0,m4Mht/2)
+ SW: svec_(0,-m4Mht/2)
+ NE: svec_(m4Mwid,m4Mht/2-2)
+ SE: svec_(m4Mwid,-m4Mht/2+2)
+ line from W to NW then to NE then to SE then to SW then to W
+ ifelse(`$2',,,`"ifsvg(`svg_small($2,75)',`\scriptsize $2')" at C')
+ lg_pin(E,,Out,e)
+ define(`m4Mdna',`$3')define(`m4MOE')dnl
+ sc_draw(`m4Mdna',L,`define(`m4ML',-)',`define(`m4ML')')dnl
+ define(`m4MN')define(`m4MSel',S)dnl
+ sc_draw(`m4Mdna',B,`define(`m4MN',B)')dnl
+ sc_draw(`m4Mdna',H,`define(`m4MN',H)')dnl
+ sc_draw(`m4Mdna',X,`define(`m4MN',X)')dnl
+ sc_draw(`m4Mdna',NOE,`define(`m4MOE',N)')dnl
+ sc_draw(`m4Mdna',OE,`define(`m4MOE',O)')dnl
+ sc_draw(`m4Mdna',N,`define(`m4MSel',N)')dnl
+ sc_draw(`m4Mdna',S,`define(`m4MSel',S)')dnl
+ define(`m4Mn',`ifelse(`$1',,2,`ifelse(m4MOE,,`$1',incr(eval(`$1')))')')dnl
+ ifinstr(m4MSel,N, dnl Draw Sel pins
+ `ifelse(m4Mdna,,`lg_pin((0.5 between NW and NE),,Sel,n)',`for_(1,m4Mdna,1,`
+ lg_pin((m4x-0.5)/m4Mdna between NW and NE,,Sel`'eval(m4x-1),n)')')',
+ `ifelse(m4Mdna,,`lg_pin((0.5 between SW and SE),,Sel,s)',`for_(1,m4Mdna,1,`
+ lg_pin((m4x-0.5)/m4Mdna between SW and SE,,Sel`'eval(m4x-1),s)')')')
+ for_(1,m4Mn,1,`lg_pin( dnl Draw In pins
+ svec_(0,m4ML`'m4Mht*(0.5+(0.5-m4x)/m4Mn)),
+ define(`m4MNO',`ifelse(m4x,m4Mn,ifelse(m4MOE,,,N))')dnl
+ ifelse(m4MNO,,
+ `ifelse(m4MN,X,,
+ m4MN,B,`define(`m4dg',`ifelse(eval(`$1'>8),1,4,eval(`$1'>4),1,3,
+ eval(`$1'>2),1,2,1)') binary_(decr(m4x),m4dg)',
+ m4MN,H,`define(`m4dg',`ifelse(eval(`$1'>16),1,2,1)')dnl
+ hexadecimal_(decr(m4x),m4dg)',
+ decr(m4x))',
+ `ifelse(m4MN,X,,`ifelse(m4MOE,N,lg_bartxt(OE),OE)')'),
+ ifelse(m4MNO,,In`'decr(m4x),ifelse(m4MOE,N,N)OE),
+ w`'ifelse(m4MNO,,,ifelse(m4MOE,N,N)))')
+ `$6']')
+
+ `Demux(no, label,
+ [L][B|H|X][N[n]|S[n]][[N]OE],wid,ht)
+ no = number of outputs (default 2)
+ The output pins are lines named
+ Out0, Out1, ... Out<ni-1>
+ chars:
+ L reverses pin numbering,
+ B displays binary pin numbers,
+ H displays hexadecimal pin numbers,
+ X disable pin labels
+ N[n] puts Sel or Sel0 .. Seln at the top
+ (with respect to the drawing direction)
+ S[n] puts the Sel inputs at the
+ bottom (default)
+ OE adds the OE input, NOE negated '
+define(`Demux',`[
+ define(`m4Dwid',`ifelse(`$4',,Mux_wid,((`$4')/(L_unit)))')dnl
+ define(`m4Dht',`ifelse(`$5',,Mux_ht,((`$5')/(L_unit)))')dnl
+ W: (0,0)
+ C: svec_(m4Dwid/2,0)
+ E: svec_(m4Dwid,0)
+ NW: svec_(0,m4Dht/2-2)
+ SW: svec_(0,-m4Dht/2+2)
+ NE: svec_(m4Dwid,m4Dht/2)
+ SE: svec_(m4Dwid,-m4Dht/2)
+ line from W to NW then to NE then to SE then to SW then to W
+ ifelse(`$2',,,`"ifsvg(`svg_small($2,75)',`\scriptsize $2')" at C')
+# lg pin(location, label, Picname, n|e|s|w [L|M|I|O][N][E], pinno, optlen)
+ lg_pin(W,,In,w)
+ define(`m4Ddna',`$3')define(`m4DOE')dnl
+ sc_draw(`m4Ddna',L,`define(`m4DL',-)',`define(`m4DL')')dnl
+ define(`m4DN')define(`m4DSel',S)dnl
+ sc_draw(`m4Ddna',B,`define(`m4DN',B)')dnl
+ sc_draw(`m4Ddna',H,`define(`m4DN',H)')dnl
+ sc_draw(`m4Ddna',X,`define(`m4DN',X)')dnl
+ sc_draw(`m4Ddna',NOE,`define(`m4DOE',N)')dnl
+ sc_draw(`m4Ddna',OE,`define(`m4DOE',O)')dnl
+ sc_draw(`m4Ddna',N,`define(`m4DSel',N)')dnl
+ sc_draw(`m4Ddna',S,`define(`m4DSel',S)')dnl
+ define(`m4Dn',`ifelse(`$1',,2,`$1')')dnl
+ ifinstr(m4DSel,N,
+ `ifelse(m4Ddna,,`lg_pin((0.5 between NW and NE),,Sel,n)',`for_(1,m4Ddna,1,`
+ lg_pin((m4x-0.5)/m4Ddna between NW and NE,,Sel`'eval(m4x-1),n)')')',
+ `ifelse(m4Ddna,,`lg_pin((0.5 between SW and SE),,Sel,s)',`for_(1,m4Ddna,1,`
+ lg_pin((m4x-0.5)/m4Ddna between SW and SE,,Sel`'eval(m4x-1),s)')')')
+# lg pin(location, label, Picname, n|e|s|w [L|M|I|O][N][E], pinno, optlen)
+ for_(1,m4Dn,1,`lg_pin(
+ svec_(m4Dwid,m4DL`'m4Dht*(0.5+(0.5-m4x)/m4Dn)),
+ ifelse(m4DN,X,,
+ m4DN,B,`define(`m4dg',`ifelse(eval(`$1'>8),1,4,eval(`$1'>4),1,3,
+ eval(`$1'>2),1,2,1)') binary_(decr(m4x),m4dg)',
+ m4DN,H,`define(`m4dg',`ifelse(eval(`$1'>16),1,2,1)')dnl
+ hexadecimal_(decr(m4x),m4dg)',
+ decr(m4x)),
+ Out`'decr(m4x),
+ e)')
+ ifelse(m4DOE,,,`ifelse(m4DOE,N,
+ `lg_pin(svec_(0,m4Dht*(0.5+(1-m4Dn)/m4Dn)),lg_bartxt(OE),NOE,wN)',
+ `lg_pin(svec_(0,m4Dht*(0.5+(1-m4Dn)/m4Dn)),OE,OE,w)')')
+ `$6']')
+
+###########################################################################
+ Autogate allowable functions (plus the ~ operator)
+define(`And',`_AutoGate(AND,$@)')
+define(`Or',`_AutoGate(OR,$@)')
+define(`Not',`_AutoGate(NOT,$@)')
+define(`NNot',`_AutoGate(NNOT,$@)')
+define(`Buffer',`_AutoGate(BUFFER,$@)')
+define(`Xor',`_AutoGate(XOR,$@)')
+define(`Nand',`_AutoGate(NAND,$@)')
+define(`Nor',`_AutoGate(NOR,$@)')
+define(`Nxor',`_AutoGate(NXOR,$@)')
+dnl Custom subcircuit template:
+dnl define(`Mygate',`_AutoGate(My,$@)')
+dnl define(`My_gate',`[ ...
+dnl Out: ...
+dnl In1: ...
+dnl In2: ... ]')
+dnl Not gate with negated input for NNOT above
+define(`NNOT_gate',`BUFFER_gate(,N)')
+
+ Style parameters
+define(`gatelineth',linethick) #define(`gatelineth',1.0) use absolute pt
+define(`lineth',linethick) #define(`lineth',0.5)
+define(`autoinputsep',`(BUF_ht*L_unit*5/4)') # distance between inputs
+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)
+dnl Count the arguments (inputs) (could use $# )
+ Loopover_(`arg',`define(`m4nargs',incr(m4nargs))',shift($@))dnl
+ `#' m4Delch(`$1') gate(m4nargs)
+# Draw the gate
+ linethick = gatelineth
+ ifelse(m4Delch(`$1'),NOT,`Q: NOT_gate()',
+ m4Delch(`$1'),BUFFER,`Q: BUFFER_gate()',
+ `Q: m4Delch($1)_gate(m4nargs)') `#' End Q
+ linethick = lineth
+ ifelse(substr(m4Delch(`$1'),0,1),N,
+ `Out: Q.Out',
+ `line thick lineth from Q.Out m4dirt N_diam*L_unit; Out: Here')
+ pushdef(`AutoOutNames',m4Path.Out)
+ T: ifelse(m4dirt,right,`Q.w-(2*lu,0)',`Q.e+(2*lu,0)')
+# Sublayer Sg containing gates G1, G2,... with
+# output vertical median at the height of Q.c
+ Sg: [ pushdef(`m4_nct',0)dnl
+ pushdef(`m4Path',m4Path.Sg)dnl
+ Loopover_(`arg',
+ `define(`m4_nct',incr(m4_nct))dnl
+# Variable or a sublayer gate
+# Inputs are labelled In<var>_N or In<var>_X
+# Remove initial white space; detect a name or gate
+ pushdef(`m4Path',m4Path.G`'m4_nct)dnl
+ m4ifboolvar_(arg,
+ `G`'m4_nct: [dnl
+ ifelse(substr(arg,0,1),~,
+ `define(`m4xg',substr(arg,1))dnl
+ pushdef(`m4InNames',m4Path.In`'m4xg`'_N)define(N_`'m4xg)dnl
+ In`'m4xg`'_N: Here',
+ `pushdef(`m4InNames',m4Path.In`'arg`'_X)define(X_`'arg)dnl
+ In`'arg`'_X: Here ')
+ Out: Here ] dnl
+ ht ifelse(m4nargs,1,`2*autovsep',`abs(Q.In1.y-Q.In2.y)-autovsep')',
+ `pushdef(`AutoOutNames',m4Path.Out)dnl
+ G`'m4_nct: m4Delch(arg)') ifelse(m4_nct,1,,`ifelse(m4dirt,right, \
+ `with .ne at last [].se',`with .nw at last [].sw')+(0,-autovsep)')
+ popdef(`m4Path') ',
+ shift($@))
+ MidOut: 0.5 between G`'eval((m4_nct+1)/2).Out and G`'eval((m4_nct+2)/2).Out
+ popdef(`m4_nct')dnl
+ popdef(`m4Path')dnl
+ ] with .MidOut at T+(ifelse(m4dirt,right,-)m4nargs*lu,0) # end Sg
+# Draw the connecting lines
+ define(`m4hhv',`(m4nargs-1)/2')dnl
+ ifelse(m4dirt,right,
+ `for_(1,m4nargs,1,`line thick lineth from Q.In`'m4x \
+ left Q.In`'m4x.x-T.x+(m4hhv-abs(m4x-m4hhv-1))*lu \
+ then up Sg.G`'m4x.Out.y-Q.In`'m4x.y \
+ then to Sg.G`'m4x.Out')',
+ `for_(1,m4nargs,1,`line thick lineth from Q.In`'eval(m4nargs+1-m4x) \
+ right T.x-Q.In`'eval(m4nargs+1-m4x).x+(m4hhv-abs(m4x-m4hhv-1))*lu \
+ then up Sg.G`'m4x.Out.y-Q.In`'eval(m4nargs+1-m4x).y \
+ then to Sg.G`'m4x.Out')')
+ popdef(`m4nargs') m4xpand(m4dirt`'_) ]')
+
+define(`m4ifboolvar_',
+`ifelse(substr(`$1',0,1),_,`$3',`ifdef(`$1',`$3',`$2')')')
+
+ Empty a stack while nonblank, executing arg2
+define(`m4stackdump',`ifdef(`$1',`ifelse($1,,`popdef(`$1')',
+`$2`'popdef(`$1')m4stackdump(`$1',`$2')')')')dnl
+
+# ****Obsolete `Define positions In1, In2, ... equal to
+# positions stacked in `arg2', prefixed by arg1.
+# If arg3 is not null then In is replaced by arg3.
+# eg H:And(x,y); stackpromote_(H,`AutoInNames',In_)'
+#define(`stackpromote_',`define(`m4nct',0)
+#`#' Promoting stack `$2':
+#stackexec_(`$2',`m4R_',`ifelse($2,,,`define(`m4nct',incr(m4nct))
+#ifelse(`$3',,In,$3)`'m4nct: ifelse(`$1',,,$1.)$2')')
+#stackexec_(`m4R_',`$2')')
+
+define(`DrawIn',`
+# Draw and label input $1
+ PrevInput: PrevInput-ifdef(`m4LI',`(0,autoinputsep)',
+ `(ifelse(m4dir,left,-)autoinputsep,0)')
+ In`'$1: PrevInput define(`m4dirt',m4dir)
+ifinstr(`$2',N,
+` line thick lineth from PrevInput ifdef(`m4LI',m4dir`'_,down_) dimen_/2
+ linethick = gatelineth
+ NOT_gate
+ linethick = lineth
+ InNt`'$1: Here',
+ `line thick lineth from PrevInput ifdef(`m4LI',m4dir,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
+ ifdef(`m4LI',`PrevInput: PrevInput-(0,autoinputsep)')
+ Int`'$1: dot
+ line thick lineth ifdef(`m4LI',down,m4dir) autoinputsep \
+ then ifdef(`m4LI',m4dir`'_,down_) dimen_/4
+ linethick = gatelineth
+ NOT_gate
+ linethick = lineth
+ InNt`'$1: Here; m4xpand(m4dirt`'_)
+ ')
+
+dnl `Autologic(Boolean function, ****Obsolete
+dnl [N[oconnect]][L[eftinputs]][R][V][;offset=val])'
+
+` Example: Autologic(`Nor(`And(x,y)',`And(~x,z)')')
+ Second example, (the same function):
+ Autologic(ZNor(ZAnd(x,y),ZAnd(~x,z)))
+'
+define(`Autologic',
+ `print `"*** Circuit_macros warning: Autologic is obsolete; use Autologix"'
+ Autologix($@)')
+############################
+
+ `Autologix(FunctionSpec;FunctionSpec;... ,
+ [M[irror]]
+ [N[oconnect]]
+ [L[eftinputs]]
+ [R][V]
+ [;offset=val])
+ FunctionSpec =
+ Boolean-fn(args) [@ location attribute]'
+` e.g. HalfAdder: Autologix(Xor(x,y);And(x,y),LVR)
+
+ Drawing single gates is not enough; more general Boolean expressions
+ in function notation can be drawn automatically. This macro draws
+ one or more trees of gates with the output or outputs
+ (roots) to the right (on the left if the M[irror] option is used).
+ The predefined functions are And, Or, Not, Nand, Nor, Xor, Nxor,
+ and Buffer, and may be nested; e.g., Or(And(x,~y),And(~x,y)).
+ Function notation does not model internal connections such as
+ feedback. However, internal nodes can be accessed.
+
+ The exact appearance of a tree depends on the order in which
+ terms and variables appear in the expressions. Gates can be placed
+ relative to previously drawn objects using the @ location construct;
+ e.g. @with .nw at last [].sw+(0,-dimen_).
+
+ Autologix locates the distinct input variables (with NOT gates for
+ variables preceded by ~) in a row or column and connects them to
+ the internal gates. If x1 (for example) appears as a variable,
+ then the corresponding input location is Inx1.
+
+ Inputs are placed in a row from right to left by default, in the
+ order in which the variables first appear in the expressions.
+ An R in the second argument reverses their order and a V reverses
+ the order in which variables are scanned in the expresssions. An
+ N in the second argument draws the expression tree or trees only,
+ suppresses drawing of the inputs, and defines the gate inputs as
+ In1, In2, ...
+
+ Placing inputs in a column on the left using the L option introduces
+ graphic complexity that is incompletely handled. Hand tuning
+ may be required for complex expressions; putting offset=value in
+ arg2 shifts the array of inputs. Time will tell whether this can
+ be improved.
+
+ Arbitrary subcircuits with inputs In1, In2, ... on the left and at
+ least one output Out on the right can be included (see the example
+ containing SRff).
+
+ Internal blocks:
+ Fx contains all the FunctionSpec trees; the input connections
+ are drawn external to Fx
+ Each Txi contains an input variable or a function tree
+ Function tree i is drawn by the `AutoGate' macro.
+'
+define(`Autologix',
+`[ # Auto logix
+dnl Split arg1 into FunctionSpecs
+ undefine(`m4BooleanR')stacksplit_(`m4BooleanR',`$1',;)dnl
+dnl
+ ifinstr(`$2',L,`define(`m4LI')',`undefine(`m4LI')')dnl
+ undefine(`m4InNames')undefine(`AutoOutNames')define(`m4Path',)dnl
+ define(`m4nbf',0)undefine(`m4BooleanFn')undefine(`m4locattr')dnl
+dnl Separate functions from location attributes
+ stackexec_(`m4BooleanR',,
+ `define(`m4nbf',incr(m4nbf))define(`m4xi',regexp(m4BooleanR,[a-zA-Z_~]))dnl
+ ifinstr(m4BooleanR,@,`define(`m4xc',index(m4BooleanR,@))dnl
+ pushdef(`m4BooleanFn',substr(m4BooleanR,m4xi,eval(m4xc-m4xi)))dnl
+ pushdef(`m4locattr',substr(m4BooleanR,incr(m4xc)))',
+ `pushdef(`m4BooleanFn',substr(m4BooleanR,m4xi))dnl
+ pushdef(`m4locattr')')dnl
+ ')dnl
+dnl
+dnl Sublayer of functions, outputs Out1, Out2,..
+ pushdef(`m4Path',ifelse(m4Path,,,m4Path.)Fx)
+Fx: [ define(`m4fno',0)dnl
+ ifinstr(`$2',M,`left_ define(`m4corner',e)',`right_ define(`m4corner',w)')
+dnl
+ stackexec_(`m4BooleanFn',,
+ `define(`m4fno',incr(m4fno))dnl
+ pushdef(`m4Path',m4Path.Tx`'m4fno)dnl
+dnl Simple variable or gate
+ m4ifboolvar_(m4BooleanFn,
+ `Tx`'m4fno: [ifelse(substr(m4BooleanFn,0,1),~,
+ `define(`m4xg',substr(m4BooleanFn,1))dnl
+ pushdef(`m4InNames',m4Path.In`'m4xg`'_N)define(N_`'m4xg)
+ In`'m4xg`'_N: Here',
+ `pushdef(`m4InNames',m4Path.In`'m4BooleanFn`'_X)dnl
+ define(X_`'m4BooleanFn)dnl
+ In`'m4BooleanFn`'_X: Here'); Out: Here ] ht 2*autovsep',
+ `Tx`'m4fno: m4Delch(m4BooleanFn)') ifelse(m4fno,1,,
+ `ifelse(m4locattr,,`with .n`'ifinstr(`$2',M,w,e) \
+ at Tx`'eval(m4fno-1).s`'ifinstr(`$2',M,w,e)+(0,-dimen_/4)',
+ m4locattr)')dnl
+ pushdef(`AutoOutNames',m4Path.Out)dnl
+ popdef(`m4locattr') `#' End Tx`'m4fno
+ popdef(`m4Path')dnl
+dnl Functions drawn
+dnl Out and Out1, Out2, ...
+ pushdef(`AutoOutNames',m4Path.Out`'m4fno)dnl
+ Out`'m4fno: Tx`'m4fno.Out
+ ifelse(m4nbf,1,`; Out: Tx1.Out')
+ ') ] `#' End Fx
+ popdef(`m4Path')dnl
+ stackreverse_(`m4InNames')dnl
+ define(`M4TopInput',m4InNames)dnl
+dnl
+dnl Delete blank names; mark top and bottom inputs
+ stackexec_(`m4InNames',,`ifelse(m4InNames,,,
+ `pushdef(`m4R',m4InNames)define(`m4bn',basename_(m4R))dnl
+ ifdef(Top`'m4bn,,`define(Top`'m4bn,m4R)')define(Bot`'m4bn,m4R)')')
+dnl
+dnl Check V option
+ ifinstr(`$2',V,
+ `stackexec_(`m4R',`m4TAL')stackexec_(`m4TAL',`m4InNames')',
+ `stackexec_(`m4R',`m4InNames')')
+dnl
+dnl Count and extract bare input names
+ undefine(`m4r')undefine(`m4f')define(`m4nargs',0)undefine(`m4N_')dnl
+ stackexec_(`m4InNames',`m4R',
+ `define(`m4nargs',incr(m4nargs))define(`m4bn',basename_(`m4InNames'))dnl
+ ifelse(substr(m4bn,decr(len(m4bn))),N,`define(`m4N_')')dnl
+ pushdef(`m4r',substr(m4bn,2,eval(len(m4bn)-4)))')dnl
+ stackexec_(`m4R',`m4InNames')stackexec_(`m4r',`m4f')
+dnl
+dnl Unique bare input names in forward order
+ stackexec_(`m4f',,`ifdef(D_`'m4f,,`pushdef(`m4r',m4f)define(D_`'m4f)')')
+ stackexec_(`m4r',`m4f',`undefine(D_`'m4r)')
+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
+dnl Place reference for row or column of inputs
+PrevInput: ifdef(`m4LI',dnl
+ `ifinstr(`$2',M,
+ `(Fx.e.x+dimen_/2+m4nargs*2*L_unit`'ifdef(`m4N_',`+(BUF_wd+N_diam)*L_unit'),\
+ M4TopInput.y+autoinputsep+m4offset)',
+ `(Fx.w.x-dimen_/2-m4nargs*2*L_unit`'ifdef(`m4N_',`-(BUF_wd+N_diam)*L_unit'),\
+ M4TopInput.y+autoinputsep+m4offset)')',
+ `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
+# 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)')')')
+ stackexec_(`m4r',,`undefine(N_`'m4r)undefine(X_`'m4r)')
+dnl
+dnl Show the internal inputs in comment lines
+`# Internal input names' (m4nargs):dnl
+stackexec_(`m4InNames',`m4R',`
+`#' m4InNames')
+stackexec_(`m4R',`m4InNames')
+dnl
+# Promote the In and Out locations to the top level
+ define(`m4ix',0)dnl
+ stackexec_(`AutoOutNames',,`define(`m4ix',incr(m4ix))
+ Out`'m4ix: AutoOutNames')
+ define(`m4ix',0)dnl
+ stackexec_(`m4InNames',`m4R',`define(`m4ix',incr(m4ix))
+ In`'m4ix: m4InNames')
+ stackexec_(`m4R',`m4InNames')
+# Connect the gates to the inputs and clean up
+ ifinstr(`$2',N,,
+ `m4AutoConnex(Fx,`m4InNames',ifdef(`m4LI',`ifinstr(`$2',V,Top,Bot)',Bot))')
+ stackexec_(`m4TAL',,
+ `define(`m4bn',basename_(m4TAL))undefine(Bot`'m4bn)undefine(Top`'m4bn)')
+# Define the inputs
+ ifelse(m4nbf,1,`Out: Fx.Out')
+ for_(1,m4nbf,1,`Out`'m4x: Fx.Out`'m4x')
+ `$3' ] ')
+
+define(`m4AutoConnex',`define(`m4cx',0)dnl
+define(`m4ltn',`substr(`$2',decr(len(`$2')))')dnl
+stackexec_(`$2',`m4TAL',
+`define(`m4ltn',substr($2,decr(len($2))))dnl
+ifelse(ifelse(m4ltn,N,T,m4ltn,X,T),T,
+`define(`m4bn',basename_($2))dnl
+define(`m4hn',substr(m4bn,2,eval(len(m4bn)-4)))dnl
+define(`m4cx',incr(m4cx))dnl
+ifdef(`m4LI',
+ `Vx: ($1.w.x-(m4nargs-m4cx)*L_unit*2,$2.y)
+ Tx: In`'ifelse(m4ltn,N,N)t`'m4hn
+ line thick lineth from $2 to Vx \
+ then to (Vx,Tx) ifelse($2,m4xpand($3`'m4bn),` then to Tx',`
+ dot') ',
+ `Tx: In`'ifelse(m4ltn,N,N)t`'m4hn
+ line thick lineth from $2 \
+ to (Tx,$2) ifelse($2,m4xpand($3`'m4bn),` then to Tx',`
+ dot')')
+ ')dnl
+')')
+
+############################
+
+ `FlipFlop( D|T|RS|JK, label, boxspec )'
+define(`FlipFlop',`ifelse(
+`$1',D, `FlipFlopX(`$3',`$2',
+ : D:PinD;E:CK:PinCK, , :Q:PinQ;:lg_bartxt(Q):PinNQ,, `$4')',
+`$1',T, `FlipFlopX(`$3',`$2',
+ : T:PinT;E:CK:PinCK, , :Q:PinQ;:lg_bartxt(Q):PinNQ,, `$4')',
+`$1',RS, `FlipFlopX(`$3',`$2',
+ : R:PinR;: S:PinS, , :Q:PinQ;:lg_bartxt(Q):PinNQ,, `$4')',
+`$1',SR, `FlipFlopX(`$3',`$2',
+ : S:PinS;: R:PinR, , :Q:PinQ;:lg_bartxt(Q):PinNQ,, `$4')',
+`$1',JK, `FlipFlopX(`$3',`$2',
+ : J:PinJ;NE:CK:PinCK;: K:PinK, N:CLR:PinCLR,
+ :Q:PinQ;:lg_bartxt(Q):PinNQ, N:PR:PinPR, `$4')',
+`FlipFlopX(`$3',`$2', ::Pin;, , :Q:PinQ;:lg_bartxt(Q):PinNQ, ,`$4')')')
+
+ `FlipFlopX( boxspec, center label,
+ leftpins, toppins, rightpins, bottompins)
+ General flipflop. Each of args 3 to 6 is null or
+ a string of pinspecs separated by semicolons (;).
+ Pinspecs are 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 eg \char59{} instead,
+ and to put a bar over a label, use
+ lg_bartxt(label). The pinopts are [L|M|I|O][N][E]
+ L=active low out; M=active low in;
+ I=inward arrow; O=outward arrow;
+ N=pin with not circle; E=edge trigger'
+define(`FlipFlopX',`[
+ Chip: box ifelse(`$1',,`wid_ FF_wid*L_unit ht_ FF_ht*L_unit',`$1')
+dnl Center label
+ ifelse(`$2',,,"ifsvg(`svg_small($2,75)',`\scriptsize $2')" at Chip.c)
+ ifelse(`$3',,,
+ `m4_ffside(`(m4x-0.5)/m4_pc between Chip.nw_ and Chip.sw_',`$3',W,w)')
+ ifelse(`$4',,,
+ `m4_ffside(`(m4x-0.5)/m4_pc between Chip.nw_ and Chip.ne_',`$4',N,n)')
+ ifelse(`$5',,,
+ `m4_ffside(`(m4x-0.5)/m4_pc between Chip.ne_ and Chip.se_',`$5',E,e)')
+ ifelse(`$6',,,
+ `m4_ffside(`(m4x-0.5)/m4_pc between Chip.sw_ and Chip.se_',`$6',S,s)')
+ `$7' ]')
+dnl `Stack, count, and draw the pins on the given side'
+define(`m4_ffside',
+`stacksplit_(`m4pr',`$2',;)define(`m4_pc',0)dnl
+ stackexec_(`m4pr',`m4pspec',`define(`m4_pc',incr(m4_pc))')dnl
+ for_(1,m4_pc,1,
+ `ifinstr(m4pspec,:,
+ `m4drawpin(`$1',`$3'm4x,`$4'm4_pattocomma(m4pspec,:))')dnl
+ popdef(`m4pspec')')')dnl
+define(`m4drawpin',`lg_pin(`$1',`$4',ifelse(`$5',,`$2',`$5'),`$3')')
+
+###########################################################################
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/mfpic.m4 b/Master/texmf-dist/doc/latex/circuit-macros/mfpic.m4
new file mode 100644
index 00000000000..d9c7ccc767f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/mfpic.m4
@@ -0,0 +1,26 @@
+divert(-1)
+ mfpic.m4 Initialization for mfpic.
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`m4picprocessor',dpic)
+define(`m4postprocessor',mfpic)
+
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')dnl
+
+define(`thinlines_',`linethick = 0.4
+ command "\pen{0.4pt}"
+ arrowwid = 0.04*scale; arrowht = 0.2/3*scale;')
+define(`thicklines_',`linethick = 0.8
+ command "\pen{0.9pt}"
+ arrowwid = 0.05*scale; arrowht = 0.1*scale;')
+define(`linethick_',`linethick = ifelse(`$1',,`0.8',`$1')
+ command sprintf("\pen{%gpt}",ifelse(`$1',,`0.9',linethick))
+ arrowwid = ifelse(`$1',,`0.05',linethick/16)*scale; dnl
+ arrowht = ifelse(`$1',,`0.1',linethick/8)*scale;')
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/mpost.m4 b/Master/texmf-dist/doc/latex/circuit-macros/mpost.m4
new file mode 100644
index 00000000000..bb528c067ec
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/mpost.m4
@@ -0,0 +1,43 @@
+divert(-1)
+ mpost.m4 Initialization for metapost.
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`m4picprocessor',dpic)
+define(`m4postprocessor',mpost)
+
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')dnl
+
+# Note: dpic uses Adobe points for line widths to conform to PSTricks
+define(`thinlines_',`linethick = 0.4
+ arrowwid = 0.04*scale; arrowht = 0.2/3*scale;')
+define(`thicklines_',`linethick = 0.8
+ arrowwid = 0.05*scale; arrowht = 0.1*scale;')
+define(`linethick_',`linethick = ifelse(`$1',,`0.8',`$1')
+ arrowwid = ifelse(`$1',,`0.05',linethick/16)*scale; dnl
+ arrowht = ifelse(`$1',,`0.1',linethick/8)*scale;')
+
+ Define some primary colors
+define(`defineRGBprimaries',`
+define(`white',`(1,1,1)')dnl
+define(`lightgrey',`(0.75,0.75,0.75)')dnl
+define(`lightgray',`(0.75,0.75,0.75)')dnl
+define(`grey',`(0.5,0.5,0.5)')dnl
+define(`gray',`(0.5,0.5,0.5)')dnl
+define(`darkgrey',`(0.25,0.25,0.25)')dnl
+define(`darkgray',`(0.25,0.25,0.25)')dnl
+define(`black',`(0,0,0)')dnl
+define(`red',`(1,0,0)')dnl
+define(`green',`(0,1,0)')dnl
+define(`blue',`(0,0,1)')dnl
+define(`cyan',`(0,1,1)')dnl
+define(`magenta',`(1,0,1)')dnl
+define(`yellow',`(1,1,0)')dnl
+')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/pgf.m4 b/Master/texmf-dist/doc/latex/circuit-macros/pgf.m4
new file mode 100644
index 00000000000..13767bed060
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/pgf.m4
@@ -0,0 +1,44 @@
+divert(-1)
+ pgf.m4 Initialization for Tikz-pgf.
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`m4picprocessor',dpic)
+define(`m4postprocessor',pgf)
+
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')dnl
+
+define(`ultrathinlines_',`linethick = 0.1
+ arrowwid = 0.03*scale; arrowht = 0.04*scale ')
+define(`verythinlines_',`linethick = 0.2
+ arrowwid = 0.04*scale; arrowht = 0.05*scale ')
+define(`thinlines_',`linethick = 0.4
+ arrowwid = 0.04*scale; arrowht = 0.2/3*scale ')
+define(`semithicklines_',`linethick = 0.6
+ arrowwid = 0.045*scale; arrowht = 0.8*scale ')
+define(`thicklines_',`linethick = 0.8
+ arrowwid = 0.05*scale; arrowht = 0.1*scale ')
+define(`verythicklines_',`linethick = 1.2
+ arrowwid = 0.05*3/2*scale; arrowht = 0.1*3/2*scale ')
+define(`ultrathicklines_',`linethick = 1.6
+ arrowwid = 0.05*2*scale; arrowht = 0.1*2*scale ')
+ `linethick_(x) set line width to x pt'
+define(`linethick_',`linethick = ifelse(`$1',,`0.8',`$1'); dnl
+ arrowwid = ifelse(`$1',,`0.05',linethick/16)*scale; dnl
+ arrowht = ifelse(`$1',,`0.1',linethick/8)*scale;')
+
+dnl `tikznode(tikz_node_name,[location],[string])
+dnl Define a tikz node at location (default Here)
+dnl Must be used in the outermost scope of a pic
+dnl diagram, and .PS <number> scaling is not allowed
+dnl (thanks to Arnold Knott).'
+define(`tikznode',`command dnl
+ sprintf("\draw (%g,%g) node[inner sep=0pt, minimum size=0pt](`$1'){`$3'};",dnl
+ ifelse(`$2',,Here,`($2)').x/scale,ifelse(`$2',,Here,`($2)').y/scale)')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/postscript.m4 b/Master/texmf-dist/doc/latex/circuit-macros/postscript.m4
new file mode 100644
index 00000000000..4a8d9b7ec0a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/postscript.m4
@@ -0,0 +1,74 @@
+divert(-1)
+ postscript.m4 Initialization for Postscript output.
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`m4picprocessor',dpic)
+define(`m4postprocessor',postscript)
+
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')dnl
+
+ Color utilities
+define(`setrgb',`pushdef(`r_',`$1')pushdef(`g_',`$2')pushdef(`b_',`$3')dnl
+pushdef(`m4cl_',ifelse(`$4',,lcspec,`$4'))dnl
+ command sprintf(" /m4cl_ {%7.5f %7.5f %7.5f} def",r_,g_,b_)
+ command " m4cl_ setrgbcolor"')
+
+define(`resetrgb',`popdef(`m4cl_')popdef(`r_')popdef(`g_')popdef(`b_')dnl
+ ifdef(`r_',
+ `command sprintf(" %7.5f %7.5f %7.5f setrgbcolor",r_,g_,b_)',
+ `command " 0 0 0 setrgbcolor"') ')
+
+ `rgbdraw(color triple, drawing commands)'
+define(`rgbdraw',`setrgb(`$1',`$2',`$3')
+ shift(shift(shift($@)))
+ resetrgb')
+ `rgbfill(color triple, closed path)'
+define(`rgbfill',
+ `command " npath /npath {} def /endstroke {} def"
+ ifm4_rgbtestcomma(`$1',
+ `shift($@)
+ command "gsave `$1' setrgbcolor"',
+ `shift(shift(shift($@)))
+ command sprintf("gsave %7.5f %7.5f %7.5f setrgbcolor", `$1',`$2',`$3')')
+ command " fill grestore ostroke"
+ command " /endstroke {ostroke} def /npath {newpath} def"')
+ `Top-level test for comma'
+define(`ifm4_rgbtestcomma',`ifinstr(`$1',`,',`$2',`$3')')
+
+ Define some primary colors
+define(`defineRGBprimaries',`
+command "/white {1 1 1} def
+/lightgrey {0.75 0.75 0.75} def
+/lightgray {0.75 0.75 0.75} def
+/grey {0.5 0.5 0.5} def
+/gray {0.5 0.5 0.5} def
+/darkgrey {0.25 0.25 0.25} def
+/darkgray {0.25 0.25 0.25} def
+/black {0 0 0} def
+/red {1 0 0} def
+/green {0 1 0} def
+/blue {0 0 1} def
+/cyan {0 1 1} def
+/magenta {1 0 1} def
+/yellow {1 1 0} def"')
+
+define(`thinlines_',`linethick = 0.4
+ arrowwid = 0.04*scale; arrowht = 0.2/3*scale
+ command " 0.4 setlinewidth";')
+define(`thicklines_',`linethick = 0.8
+ arrowwid = 0.05*scale; arrowht = 0.1*scale
+ command " 0.8 setlinewidth";')
+ `linethick_(x)
+ set line width to x pt (default 0.8)
+ and scale arrowhead parameters'
+define(`linethick_',`linethick = ifelse(`$1',,`0.8',`$1'); dnl
+ arrowwid = ifelse(`$1',,`0.05',linethick/16)*scale; dnl
+ arrowht = ifelse(`$1',,`0.1',linethick/8)*scale;')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/psfrag.m4 b/Master/texmf-dist/doc/latex/circuit-macros/psfrag.m4
new file mode 100644
index 00000000000..3088c5670a6
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/psfrag.m4
@@ -0,0 +1,15 @@
+divert(-1)
+ psfrag.m4 Initialization for dpic -f processing:
+ Postscript with psfrag strings
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`psfrag_')
+ifelse(m4postprocessor,postscript,,`include(postscript.m4)divert(-1)')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/pstricks.m4 b/Master/texmf-dist/doc/latex/circuit-macros/pstricks.m4
new file mode 100644
index 00000000000..ef7bb03d7cc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/pstricks.m4
@@ -0,0 +1,47 @@
+divert(-1)
+ pstricks.m4 Initialization for PSTricks.
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`m4picprocessor',dpic)
+define(`m4postprocessor',pstricks)
+
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')dnl
+
+define(`thinlines_',`linethick = 0.4
+ arrowwid = 0.04*scale; arrowht = 0.2/3*scale
+ command "\psset{linewidth=0.4pt}%";')
+
+define(`thicklines_',`linethick = 0.8
+ arrowwid = 0.05*scale; arrowht = 0.1*scale
+ command "\psset{linewidth=0.8pt}%";')
+
+ `linethick_(x)
+ Set line width to x pt and default
+ arrowhead parameters'
+define(`linethick_',`linethick = ifelse(`$1',,`0.8',`$1'); dnl
+ arrowwid = ifelse(`$1',,`0.05',linethick/16)*scale; dnl
+ arrowht = ifelse(`$1',,`0.1',linethick/8)*scale;')
+
+ `Patch PSTricks to use all coordinate pairs
+ inside \pscustom'
+ `Older version for PSTricks prior to Aug 2010:'
+define(`M4PatchPSTricks',
+`command "\makeatletter\@ifundefined{ifPst@noCurrentPoint}%
+{\@ifundefined{MPS@Patch}{\gdef\MPS@Patch{}%
+ \typeout{ Dpic -p: patching psbezier in pstricks.tex (some versions) }%
+ \def\psbezier@ii{\addto@pscode{%
+ \ifshowpoints true \else false \fi\tx@OpenBezier%
+ \ifshowpoints\tx@BezierShowPoints\fi}\end@OpenObj}}{}}%
+{\@ifundefined{MPS@PatchMsg}{\gdef\MPS@PatchMsg{}%
+ \typeout{ Dpic -p: Setting noCurrentPoint to use all coord pairs }}{}%
+ \psset{noCurrentPoint}}\makeatother%"')
+ `For PSTricks since Aug 2010'
+define(`M4PatchPSTricks',`command "\psset{noCurrentPoint}%"')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/svg.m4 b/Master/texmf-dist/doc/latex/circuit-macros/svg.m4
new file mode 100644
index 00000000000..4676222c40c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/svg.m4
@@ -0,0 +1,169 @@
+divert(-1)
+ svg.m4 Initialization for SVG output.
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`m4picprocessor',dpic)
+define(`m4postprocessor',svg)
+ Default is to produce svg for web documents
+ifdef(`m4textprocessor',,`define(`m4textprocessor',xml)')
+
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')dnl
+
+# The following definitions are still subject to change.
+# The use of changecom may cause difficulty for non-GNU m4.
+# ---------------------------------------------------------------------------#
+#
+# If either nosvgformat or Inkscape is defined then the svg formatting
+# macros are turned off. Text formatting can then be done in Inkscape.
+
+dnl Put define(`Inkscape') in the source for Inkscape input
+ifelse(ifdef(`Inkscape',T)`'ifdef(`nosvgformat',T),T,
+`define(`svg_it',`$1')
+define(`svg_tt',`$1')
+define(`svg_norm',`$1')
+define(`svg_bf',`$1')
+define(`svg_small',`$1')
+define(`svg_fsize',`$1')
+define(`svg_sub',`$1')
+define(`svg_sup',`$1')
+define(`svg_font',`$1')
+define(`svg_symbol',`$1')
+define(`svg_micro',`$1')
+define(`svg_ohm',`$1')
+define(`svg_lt',`$1')
+define(`svg_gt',`$1')
+',
+`define(`svg_tspan',`patsubst(<tspan `$1'
+>`$2'</tspan>,",\\")')
+define(`svg_font',`
+command "<g patsubst(ifelse(`$1',,,
+index(`$1',font),0,`$1',
+index(`$1',style),0,`$1',
+style="font-family:`$1'")
+,",\\")>"
+ ifelse(`$2',,,`textht=(`$2')*dptextratio; ')dnl
+ ifelse(`$3',,,`textoffset=`$3'; ')dnl
+ `$4'
+ ifelse(`$4',,,`command "</g>"')')
+`e.g. svg_font(Times)
+ svg_font(Times,11bp__,1bp__,"text" at A)
+ svg_font(font-family="Times")
+ svg_font(font-family="Times" font-style="italic")
+ svg_font(style="font-family:Times; font-style:italic")
+Some fairly safe choices: Arial, Helvetica, Times, Courier, Verdana, Georgia,
+ Palatino, Garamond, Bookman, Cursive, Trebuchet MS, Arial Black, Impact.
+'
+`see http://www.ascii.cl/htmlcodes.htm
+ and http://webdesign.about.com/od/localization/l/blhtmlcodes-gr.htm'
+define(`svg_symbol',`changecom(,)`$1'changecom(`#',)')
+define(`svg_it',`<tspan font-style=\"italic\">`$1'</tspan>')
+define(`svg_tt',`<tspan font-family=\"Courier\">`$1'</tspan>')
+define(`svg_norm',`<tspan font-style=\"normal\">`$1'</tspan>')
+define(`svg_bf',`<tspan font-style=\"bold\">`$1'</tspan>')
+
+dnl To get %% in a sprintf string, set the size explicitly,
+dnl eg sprintf("x`'svg_sub(%g,50%)",i)
+
+define(`svg_small',`svg_fsize(`$1',ifelse(`$2',,66,`$2'))')
+define(`svg_fsize',`<tspan font-size=\"ifelse(`$2',,100,`$2')%\">`$1'</tspan>')
+
+dnl This is black magic but seems necessary to work with Firefox
+dnl Arg 2: size of subscript font in percent
+dnl Arg 3: vertical shift, e.g. svg_sub(1,,0.5ex)
+dnl Arg 4 shifts the subscript horizontally e.g., svg_sup(1,,,-0.5ex)
+define(`svg_sup',`<tspan font-size=\"ifelse(`$2',,70,`$2')%\"
+ dy=\"-ifelse(`$3',,1.5ex,`$3')\" dx=\"ifelse(`$4',,,`$4')\">`$1'</tspan><tspan
+ font-size=\"ifelse(`$2',,70,`$2')%\" dy=\"ifelse(`$3',,1.5ex,`$3')\"
+ dx=\"-0.5ex\"> </tspan>')dnl note the space
+
+dnl This is black magic but seems necessary to work with Firefox
+dnl Arg 2: size of subscript font in percent
+dnl Arg 3: vertical shift, e.g. svg_sub(1,,0.5ex)
+dnl Arg 4 shifts the subscript horizontally
+define(`svg_sub',`<tspan font-size=\"ifelse(`$2',,70,`$2')%\"
+ dy=\"ifelse(`$3',,0.66ex,`$3')\" dx=\"ifelse(`$4',,,`$4')\">`$1'</tspan><tspan
+ font-size=\"ifelse(`$2',,70,`$2')%\" dy=\"-ifelse(`$3',,0.66ex,`$3')\"
+ dx=\"-0.5ex\"> </tspan>')dnl note the space
+
+define(`svg_alpha',`svg_symbol(&`#'945;)')
+define(`svg_beta',`svg_symbol(&`#'946;)')
+define(`svg_chi',`svg_symbol(&`#'967;)')
+define(`svg_comma',`svg_symbol(&`#'44;)')
+define(`svg_Delta',`svg_symbol(&`#'916;)')
+define(`svg_delta',`svg_symbol(&`#'948;)')
+define(`svg_epsilon',`svg_symbol(&`#'949;)')
+define(`svg_eta',`svg_symbol(&`#'951;)')
+define(`svg_Gamma',`svg_symbol(&`#'915;)')
+define(`svg_gamma',`svg_symbol(&`#'947;)')
+define(`svg_iota',`svg_symbol(&`#'953;)')
+define(`svg_kappa',`svg_symbol(&`#'954;)')
+define(`svg_Lambda',`svg_symbol(&`#'923;)')
+define(`svg_lambda',`svg_symbol(&`#'955;)')
+define(`svg_micro',`svg_symbol(&`#'956;`$1')')
+define(`svg_mu',`svg_symbol(&`#'956;)')
+define(`svg_nu',`svg_symbol(&`#'957;)')
+define(`svg_ohm',`svg_symbol(&`#'937;)')
+define(`svg_Omega',`svg_symbol(&`#'937;)')
+define(`svg_omega',`svg_symbol(&`#'969;)')
+define(`svg_Phi',`svg_symbol(&`#'934;)')
+define(`svg_phi',`svg_symbol(&`#'966;)')
+define(`svg_Pi',`svg_symbol(&`#'928;)')
+define(`svg_pi',`svg_symbol(&`#'960;)')
+define(`svg_Psi',`svg_symbol(&`#'936;)')
+define(`svg_psi',`svg_symbol(&`#'968;)')
+define(`svg_rho',`svg_symbol(&`#'961;)')
+define(`svg_Sigma',`svg_symbol(&`#'931;)')
+define(`svg_sigma',`svg_symbol(&`#'963;)')
+define(`svg_tau',`svg_symbol(&`#'964;)')
+define(`svg_Theta',`svg_symbol(&`#'920;)')
+define(`svg_theta',`svg_symbol(&`#'952;)')
+define(`svg_upsilon',`svg_symbol(&`#'965;)')
+define(`svg_Xi',`svg_symbol(&`#'926;)')
+define(`svg_xi',`svg_symbol(&`#'958;)')
+define(`svg_zeta',`svg_symbol(&`#'950;)')
+define(`svg_lt',`svg_symbol(&`#'60;)')
+define(`svg_gt',`svg_symbol(&`#'62;)')
+define(`svg_leq',`svg_symbol(&`#'8804;)')
+define(`svg_geq',`svg_symbol(&`#'8805;)')
+define(`svg_prime',`svg_symbol(&`#'8242;)')
+define(`svg_ensp',`svg_symbol(&`#'8194;)')
+define(`svg_emsp',`svg_symbol(&`#'8195;)')
+define(`svg_thinsp',`svg_symbol(&`#'8201;)')
+define(`svg_backsl',`svg_symbol(&`#'92;)')
+')
+
+define(`svgcolor',`sprintf("rgb(%g,%g,%g)",\
+round_(`$1'),round_(`$2'),round_(`$3'))')
+
+# Obsolete but kept for compatibility. Use `rgbstring(r,g,b)'
+define(`svgcolor255',
+ `svgcolor(round_((`$1')*255),round_((`$2')*255),round_((`$3')*255))')
+
+define(`svgLink',`command "<a xlink:href=\"`$1'\"dnl
+ ifelse(`$3',,`target=\"_blank\"',`$3',B,,`$3')>
+ <g stroke=\"rgb(0,0,255)\">"
+ `$2'
+ command "</g></a>"')
+define(`svgLinkString',`"<a xlink:href=\"`$1'\"dnl
+ ifelse(`$3',,`target=\"_blank\"',`$3',B,,`$3') dnl
+ stroke=\"rgb(0,0,255)\">dnl
+ `$2' dnl
+ </a>"')
+# ---------------------------------------------------------------------------#
+
+define(`thinlines_',`linethick = 0.4
+ arrowwid = 0.04*scale; arrowht = 0.2/3*scale')
+define(`thicklines_',`linethick = 0.8
+ arrowwid = 0.05*scale; arrowht = 0.1*scale')
+ `linethick_(x) set line width to x pt'
+define(`linethick_',`linethick = ifelse(`$1',,`0.8',`$1'); dnl
+ arrowwid = ifelse(`$1',,`0.05',linethick/16)*scale; dnl
+ arrowht = ifelse(`$1',,`0.1',linethick/8)*scale;')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/xfig.m4 b/Master/texmf-dist/doc/latex/circuit-macros/xfig.m4
new file mode 100644
index 00000000000..44bd0dc7a7a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/xfig.m4
@@ -0,0 +1,24 @@
+divert(-1)
+ xfig.m4 Initialization for xfig.
+
+* Circuit_macros Version 9.0, copyright (c) 2019 J. D. Aplevich under *
+* the LaTeX Project Public License. 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. *
+
+define(`m4picprocessor',dpic)
+define(`m4postprocessor',xfig)
+
+ifdef(`libgen_',,`include(libgen.m4)divert(-1)')dnl
+
+define(`thinlines_',`linethick = 0.4
+ arrowwid = 0.05*2/3*scale; arrowht = 0.1*2/3*scale; ')
+define(`thicklines_',`linethick = 0.8
+ arrowwid = 0.05*scale; arrowht = 0.1*scale; ')
+define(`linethick_',`linethick = ifelse(`$1',,`0.8',`$1'); dnl
+ arrowwid = ifelse(`$1',,`0.05',linethick/0.8*0.05)*scale; dnl
+ arrowht = ifelse(`$1',,`0.1',linethick/0.8*0.1)*scale; ')
+
+divert(0)dnl
diff --git a/Master/texmf-dist/tex/latex/circuit-macros/boxdims.sty b/Master/texmf-dist/tex/latex/circuit-macros/boxdims.sty
new file mode 100644
index 00000000000..22b76d73fd9
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/circuit-macros/boxdims.sty
@@ -0,0 +1,33 @@
+%
+% boxdims.sty, for use with m4 preprocessors. Last modified 30 Apr 2004.
+%
+% \boxdims{arg1}{arg2} expands to arg2, but writes into file \jobname.dim
+% the m4 definitions for macros arg1_h, arg1_w, arg1_d, the height, width
+% and depth of \hbox{arg2}.
+%
+% \defboxdim{arg1}{arg2} writes the definitions but expands to nothing.
+%
+% \boxdimfile{filename} sets the output file to filename, default \jobname.dim
+%
+\ProvidesPackage{boxdims}
+ [2004/04/30 v2.0 Macros: boxdimfile, boxdims, defboxdim (DA)]
+
+\newwrite\@dimensionfile
+\newif\if@dimfile
+\newbox\dimbox
+
+\def\boxdimfile#1{\immediate\openout\@dimensionfile=#1\global\@dimfiletrue%
+ \typeout{ boxdims.sty v2.0: Writing dimension file #1 }}%
+
+\def\boxdims#1#2{\defboxdim{#1}{#2}#2}
+
+\def\defboxdim#1#2{\if@dimfile\else%
+ \immediate\openout\@dimensionfile=\jobname.dim\global\@dimfiletrue%
+ \typeout{ boxdims.sty v2.0: Writing dimension file \jobname.dim }\fi%
+ \setbox\dimbox=\hbox{#2}%
+ \begingroup\@sanitize\edef\@tempa{\write\@dimensionfile{%
+ \@defboxdim{#1}}}\expandafter\endgroup\@tempa}
+\def\@defboxdim#1{%
+define(`#1_w',\the\wd\dimbox__)%
+define(`#1_h',\the\ht\dimbox__)%
+define(`#1_d',\the\dp\dimbox__)dnl}
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 6cd89e22f9c..f16a8bd3a74 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -157,7 +157,7 @@ my @TLP_working = qw(
chicago chicago-annote chickenize childdoc chivo
chkfloat chletter chngcntr chordbars chordbox chronology
chronosys chs-physics-report chscite churchslavonic
- cinzel circ circuitikz
+ cinzel circ circuit-macros circuitikz
cite citeall citeref cje cjhebrew cjk cjk-gs-integrate cjk-ko cjkpunct
classics classpack classicthesis
cleanthesis clearsans clefval cleveref clipboard
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index a7c7363f11b..243868ae675 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -254,8 +254,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`);
'chktex', "die 'skipping, merge into Build'",
'chngpage', "die 'skipping, use changepage'",
'circle', "die 'skipping, noinfo license, author unfindable'",
- 'circuit-macros', "die 'skipping, needs m4'",
- 'circuit_macros', "die 'skipping, needs m4'",
+ 'circuit_macros', "die 'skipping, use circuit-macros'",
'circuitikz', "&MAKEcopy",
'cirth', "die 'skipping, nosell license'",
'cjk', "&MAKEcjk",
@@ -2478,7 +2477,8 @@ $standardsource = '(\.(bat|c|drv|dtx|fea|fdd|ins|sfd)'
'burmese', '\.pl',
'carlisle', '\.dtx|\.ins|ltxtable\.tex',
'chemarrow', '\.mp|\.vfb',
- 'cluttex', 'NULL', # keep Makefile wit others
+ 'circuit-macros', 'NULL', # leave Makefile
+ 'cluttex', 'NULL', # leave Makefile
'cmextra', 'NULL',
'concmath-fonts', 'NULL',
'crossword', $standardsource . '|AcrossLite',
diff --git a/Master/tlpkg/tlpsrc/circuit-macros.tlpsrc b/Master/tlpkg/tlpsrc/circuit-macros.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/circuit-macros.tlpsrc
diff --git a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
index e0b7da429e1..4a83c349faa 100644
--- a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
@@ -26,6 +26,7 @@ depend callouts
depend celtic
depend chemfig
depend combinedgraphics
+depend circuit-macros
depend circuitikz
depend curve
depend curve2e