Circuit_macro examples, Version 10.1

Home > Examples

These diagrams are in svg format, obtained by first producing pdf using pdflatex and then converting using dvisvgm --pdf. The pdf equivalent can be found in examples.pdf. Sources for producing similar figures as svg using dpic -v without invoking LaTeX or equivalent can be found in examples/dpv of the the distribution or here.

Click on the link to view the source of each diagram. Read the manual Circuit_macros.pdf for a complete explanation. Browse and enjoy!


quick diagram

quick.m4: The quick-start example from the manual


Resistors diagram

Resistors.m4: Resistors, showing some variations and the ebox


Capacitors diagram

Capacitors.m4: Capacitors


Inductors diagram

Inductors.m4: Inductors


Diodes diagram

Diodes.m4: Diodes: appending a K to the second argument draws an open arrowhead


Emarrows diagram

Emarrows.m4: Radiation arrows


Variable diagram

Variable.m4: Arrows and marks for showing variability


Sources diagram

Sources.m4: Sources and source-like elements


AmpTable diagram

AmpTable.m4: Macros amp, delay, and integrator


Fuses diagram

Fuses.m4: Macros fuse and cbreaker


Arresters diagram

Arresters.m4: The arrester macro


MoreTable diagram

MoreTable.m4: Additional two-terminal elements


Grounds diagram

Grounds.m4: Ground symbols


Switches diagram

Switches.m4: The switch macros; switch(,,,L|B|D) is a wrapper for lswitch, bswitch, and dswitch


Antennas diagram

Antennas.m4: Antenna symbols


Opamp diagram

Opamp.m4: The opamp


Audio diagram

Audio.m4: Audio elements


Xform diagram

Xform.m4: Some variations of the transformer element, drawing direction down


NPDT diagram

NPDT.m4: Double throw with the NPDT macro


Contact diagram

Contact.m4: A non-exhaustive sampling of contact macro variations


Contacts diagram

Contacts.m4: The contacts macro


relaycoil diagram

relaycoil.m4: The relaycoil macro


Relay diagram

Relay.m4: Some variants of relay


Jack diagram

Jack.m4: The jack and plug macros


Conn diagram

Conn.m4: The tstrip, ccoax, tconn, and tbox macros


Pconn diagram

Pconn.m4: The pconnex macro


EVplugs diagram

EVplugs.m4: Electric vehicle charging plug patterns make extensive use of key=value pairs to set options


Headers diagram

Headers.m4: The Header macro


Connectors diagram

Connectors.m4: Some connectors with simple geometry and lists of labels


Chips diagram

Chips.m4: IC package outlines


fet diagram

fet.m4: FETs, showing programmable components and example customizations


ujt diagram

ujt.m4: UJT examples


thyristor diagram

thyristor.m4: Thyristor examples. The thyristor is a 3- or 4-terminal composite element


Bip diagram

Bip.m4: Bipolar transistors (drawing direction: up)


Tgate diagram

Tgate.m4: The tgate and ptrans elements


Nport diagram

Nport.m4: The nport and nterm macros


NLG diagram

NLG.m4: Some customizations of nport


Windings diagram

Windings.m4: The macro winding(L|R,diam,pitch,turns,core wid,core color)


ex01 diagram

ex01.m4: Two simple labeled circuits


ex02 diagram

ex02.m4: Elements at obtuse angles


Optoiso diagram

Optoiso.m4: Optical isolator: a circuit with right or left orientation


Mixer diagram

Mixer.m4: A balanced mixer, using mosfet and a custom transformer


PushPull diagram

PushPull.m4: A push-pull mixer, showing FETs with multiple gates


Quantum diagram

Quantum.m4: A quantum circuit


SQUID diagram

SQUID.m4: Superconducting quantum interface device (drawing direction down)


Sixpole diagram

Sixpole.m4: A six-pole filter


ex18 diagram

ex18.m4: Precision half-wave rectifier and a tunnel diode circuit (illustrating opamp, diode, resistor, ground, and labels)


ex10 diagram

ex10.m4: Non-planar graph and bistable circuit (illustrating the crossover macro and colored elements)


Three diagram

Three.m4: Three-phase oscillator


MC diagram

MC.m4: A three-phase switched AC-AC converter and a DC-DC converter


ex17 diagram

ex17.m4: A repetitive network created by Pic looping and a skewed circuit used to test the macro parallel_


ex12 diagram

ex12.m4: A CMOS NAND gate, a test circuit, and an XMOSFET example


pwrsupply diagram

pwrsupply.m4: An elementary power supply circuit with colored elements, and a multiple-winding transformer with 3-phase rectifier


TTLnand diagram

TTLnand.m4: TTL NAND gate illustrating a transistor with multiple emitters


I2L diagram

I2L.m4: Gate circuit and equivalent embedded I2L components illustrating multiple collectors


Schottky diagram

Schottky.m4: A 4-input NAND circuit illustrating the S (Schottky) option of bi_trans


ex11 diagram

ex11.m4: Transistor radio audio chain


ex04 diagram

ex04.m4: Labels on non-manhattan elements


Csource diagram

Csource.m4: Realization of a controlled source (illustrating stacked element labels)


Drive diagram

Drive.m4: Synchronous machine driven by variable-speed drive and rectifier


ex16 diagram

ex16.m4: A rate 1/2 binary convolutional coder and its state diagram


ex03 diagram

ex03.m4: Digital filter


MotorControl diagram

MotorControl.m4: Motor control connections


Rectifiers diagram

Rectifiers.m4: Rectifier circuits and waveforms


Heathkit diagram

Heathkit.m4: The power supply of a Heathkit AR-15 (Now, that was a receiver!) with custom transformer and other elements, drawn on a grid (partially shown) to aid in placement


lcct diagram

lcct.m4: 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


UNO diagram

UNO.m4: An Arduino UNO circuit adapted and redrawn


Tubediags diagram

Tubediags.m4: Electron-tube diagrams: a few bottom-view base diagrams, a generic triode test circuit, and a 25-watt audio amplifier adapted from F. Langford-Smith, Radiotron Designer's Handbook, fourth edition, Harrison, NJ: Radio Corporation of America, 1952


sfg diagram

sfg.m4: Signal-flow graphs


Logic diagram

Logic.m4: Basic logic gates


ex08 diagram

ex08.m4: General-purpose latch: a small logic circuit


Decoder diagram

Decoder.m4: Decoder logic, constructed using the for_ macro


ex21 diagram

ex21.m4: Some flip-flops


Multiplexer diagram

Multiplexer.m4: Multiplexer


Demultiplexer diagram

Demultiplexer.m4: Demultiplexer


ShiftR diagram

ShiftR.m4: A 5-bit shift register drawn using a custom flip-flop


Adder diagram

Adder.m4: A full adder and a cascade of n-bit adders


CanLogic diagram

CanLogic.m4: A way of automatically drawing two-layer logic diagrams


Alogix diagram

Alogix.m4: The Autologix(Boolean expression; Boolean expression... , options) 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.


ABlogix diagram

ABlogix.m4: The Autologix macro can draw inputs on the left but the added drawing complexity may require hand tuning with second-argument options: L puts the inputs on the left, R reverses their order, V scans the input arguments in reverse order, and offset=value displaces the array of inputs


XOR diagram

XOR.m4: Realizations of the XOR function using Autologix


ex00 diagram

ex00.m4: Line diagrams


EEP diagram

EEP.m4: A test of experimental single-line diagram macros


ex05 diagram

ex05.m4: Use of darrow and Darc


GrayCode diagram

GrayCode.m4: Gray code 10-bit encoder disk pattern and a crossbar switch


control diagram

control.m4: Control-system block diagrams


Byte diagram

Byte.m4: Elementary splines


Rotbox diagram

Rotbox.m4: The macro rotbox(wid,ht,type,[r|t=val]) draws a box in the current direction


ex06 diagram

ex06.m4: Crosshatching


Geometry diagram

Geometry.m4: Some geometrical constructions


Loglog diagram

Loglog.m4: A graph drawn using the pic language


Smithchart diagram

Smithchart.m4: A Smith chart


ex09 diagram

ex09.m4: Illustrating the macro dimension_(linespec, offset, label, D|H|W|blank width, tic offset,<-|->). A negative second argument implies an offset to the right of the linespec direction. A label starting with " or sprintf is copied literally. If label is an s_box(...) then setting argument 4 to H, W, or D tailors the blank width to the s_box height, width, or diagonal respectively; i.e., W is equivalent to s_wd+textoffset*2. The macro 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.


Plate diagram

Plate.m4: Dimensioning with tolerances


random diagram

random.m4: Testing random number generation using dpic macro randn(array name, n, mean, std dev{tt)} which calls pic built-in rand()


exp diagram

exp.m4: Test of project and other lib3D macros, showing the projection of a solid onto the y1,z1 plane by sighting along the x1 axis.


graysurf diagram

graysurf.m4: Plotting surfaces using gray scales


shapes diagram

shapes.m4: Basic shapes


csc diagram

csc.m4: Conestoga Sailing Club (illustrating the filling of arbitrary shapes) and an antique clock face with shading and rotated text


rose diagram

rose.m4: The left object, used for testing dipic, is redrawn from a detail of the set design for the musical Dracula. This consumes much LaTeX main memory but can be produced directly as pdf using dpic -d, as svg using dpic -v, or as postscript using dpic -r since no text formatting is required. The right object adjusts the size of dots to produce a halftone effect


diamond diagram

diamond.m4: Variations on M. Goossens, S. Rahtz, and F. Mittelbach, The LaTeX Graphics Companion, Addison-Wesley 1997, pp. 57-58


worm diagram

worm.m4: An exercise in calculating RGB colours


Buttons diagram

Buttons.m4: Shading in color


keyboard diagram

keyboard.m4: This diagram has been produced as svg with dpic -v (then converted to pdf for inclusion in examples.pdf)


Dini diagram

Dini.m4: Dini surface and an icosahedron


Sierpinski diagram

Sierpinski.m4: The Sierpinski triangle and a Cayley graph: tests of pic macro recursion


Escher diagram

Escher.m4: Penrose stairs and an Escher-like object


recycle diagram

recycle.m4: Modest repetition and partial fill


ex15 diagram

ex15.m4: Simple diagrams that are easily drawn by looping


Crow diagram

Crow.m4: Illustrating shadebox and a custom crowfoot line termination


Flow diagram

Flow.m4: A flowchart sampler


Btree diagram

Btree.m4: Trees


Incleps diagram

Incleps.m4: Overlaying a figure with line graphics })


Dwight Aplevich
Contact the author: last name at domain
Domain: uwaterloo.ca

See the README file for information about sources, manuals, installation, integration with other tools, and output formats.

For more examples in the context of textbooks, see:
J. Dwight Aplevich, The Essentials of Linear State-Space Systems, New York: John Wiley & Sons Inc., 2000,
or
Gordon C. Andrews, J. Dwight Aplevich, Roydon A. Fraser, Carolyn G. MacGregor, Introduction to Professional Engineering in Canada, (fifth edition) Toronto: Prentice Hall, Pearson Education Canada, Inc., 2018.


Circuit_macros home page.