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.m4
:
The quick-start example from the manual

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

Capacitors.m4
:
Capacitors

Inductors.m4
:
Inductors

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

Emarrows.m4
:
Radiation arrows

Variable.m4
:
Arrows and marks for showing variability

Sources.m4
:
Sources and source-like elements

AmpTable.m4
:
Macros amp, delay, and integrator

Fuses.m4
:
Macros fuse, cbreaker, and jumper

Arresters.m4
:
The arrester macro

MoreTable.m4
:
Additional two-terminal elements

Grounds.m4
:
Ground symbols

Antennas.m4
:
Antenna symbols

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

Opamp.m4
:
The opamp

Audio.m4
:
Audio elements

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

NPDT.m4
:
Double throw with the NPDT macro

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

Contacts.m4
:
The contacts macro

relaycoil.m4
:
The relaycoil macro

Relay.m4
:
Some variants of relay

Jack.m4
:
The jack and plug macros

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

Pconn.m4
:
The pconnex macro

cbresistor.m4
:
Color-coded through-hole resistors. All are
10 percent tolerance except the last,
which illustrates 5 percent

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

Headers.m4
:
The Header macro

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

Chips.m4
:
IC package outlines and examples

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

ujt.m4
:
UJT examples

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

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

Tgate.m4
:
The tgate and ptrans elements

Nport.m4
:
The nport and nterm macros

NLG.m4
:
Some customizations of nport

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

ex01.m4
:
Two simple labeled circuits

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

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

PS50.m4
:
An unregulated 50V power supply

Reg723.m4
:
A 723 regulator circuit with a heat sink

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

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

Quantum.m4
:
A quantum circuit and a
superconducting quantum interface device (drawing direction down)

Sixpole.m4
:
A six-pole filter

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

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

Three.m4
:
Three-phase oscillator

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

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

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

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

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

ex11.m4
:
Transistor radio audio chain

LT3724.m4
:
IC controller and auxiliary elements of a step-down converter

ex04.m4
:
Labels on non-manhattan elements

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

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

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

ex03.m4
:
Digital filter

MotorControl.m4
:
Motor control connections

OneLine.m4
:
Single line distribution 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.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.m4
:
An Arduino UNO circuit adapted and redrawn

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.m4
:
Signal-flow graphs

Logic.m4
:
Basic logic gates

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

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

ex21.m4
:
Some flip-flops

Multiplexer.m4
:
Multiplexer

Demultiplexer.m4
:
Demultiplexer

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

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

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

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.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.m4
:
Realizations of the XOR function using Autologix

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

ex05.m4
:
Use of darrow and Darc

GrayCode.m4
:
The power of looping and branching:
Gray code 10-bit encoder disk pattern and a crossbar switch

control.m4
:
Control-system block diagrams

Byte.m4
:
Elementary splines

Sevensegment.m4
:
A customizable seven-segment display showing the
numbered segments, a custom shape, and the numerals from 0 to 9

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

Shadowed.m4
:
Embellishments: the top row illustrates
shadowed(box|circle|ellipse|line,[at position],keys)
and the second row
ColoredV(box|circle|ellipse,(r,g,b)|((colorseq)),attributes)

Loglog.m4
:
A graph and crosshatching example drawn using the pic language

Geometry.m4
:
Some geometrical constructions

Smithchart.m4
:
A Smith chart

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.m4
:
Dimensioning with tolerances

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

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.m4
:
Plotting surfaces using gray scales

shapes.m4
:
Basic shapes

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

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.m4
:
Variations on M. Goossens, S. Rahtz, and F. Mittelbach,
The LaTeX Graphics Companion, Addison-Wesley 1997, pp. 57-58

worm.m4
:
An exercise in calculating RGB colours

Buttons.m4
:
Shading in color

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

Dini.m4
:
Dini surface, an icosahedron, and a sphere with inscribed cylinder

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

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

recycle.m4
:
Modest repetition and partial fill

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

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

Flow.m4
:
A flowchart sampler

Btree.m4
:
Trees

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.