Circuit_macro examples, Version 8.3

These diagrams are in .png format. Pdf and svg versions are also available. The Postcript equivalent can be found in of the distribution.

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

quick diagram

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

CctTable diagram

CctTable.m4: Two-terminal elements, showing some variations

Diodes diagram

Diodes.m4: Diodes

Emarrows diagram

Emarrows.m4: Radiation arrows

Sources diagram

Sources.m4: Sources and source-like elements

Variable diagram

Variable.m4: Arrows and marks indicating variability

AmpTable diagram

AmpTable.m4: Macros amp, delay, and integrator

Fuses diagram

Fuses.m4: Macros fuse and cbreaker

Switches diagram

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

Grounds diagram

Grounds.m4: Ground symbols

Antennas diagram

Antennas.m4: Antenna symbols

Audio diagram

Audio.m4: Audio elements

Opamp diagram

Opamp.m4: The opamp

Xform diagram

Xform.m4: The transformer element, drawing direction down

Relay diagram

Relay.m4: The contact and relay macros

NPDT diagram

NPDT.m4: Double throw with the NPDT macro

Jack diagram

Jack.m4: The jack and plug macros

Conn diagram

Conn.m4: The tstrip and ccoax macros

Pconn diagram

Pconn.m4: The pconnex macro

Headers diagram

Headers.m4: The Header macro

fet diagram

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

ujt diagram

ujt.m4: UJT examples

thyristor diagram

thyristor.m4: Thyristor examples

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


Timer diagram

Timer.m4: Two simple labeled circuits

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

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)

MC diagram

MC.m4: A three-phase switched AC-AC converter

ex10 diagram


bistable diagram

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

Three diagram

Three.m4: Three-phase oscillator

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

ex02 diagram

ex02.m4: Elements at obtuse angles

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

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

ex00 diagram

ex00.m4: Line diagrams

Crossbar diagram

Crossbar.m4: A crossbar switch

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

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. A sort algorithm is employed to determine plotting order

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

ex05 diagram

ex05.m4: Use of darrow

control diagram

control.m4: Control-system block diagrams that do not require m4

ex06 diagram

ex06.m4: Crosshatching by for loops

Loglog diagram

Loglog.m4: A graph drawn using the pic language

csc diagram

csc.m4: Conestoga Sailing Club (illustrating the filling of arbitrary shapes)

rose diagram

rose.m4: Redrawn from a detail of the set design for the musical Dracula, used for testing dpic. This diagram consumes much LaTeX main memory but can be produced as the raw postscript output of dpic -r since no text formatting is required

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

Sierpinski diagram

Sierpinski.m4: The Sierpinski triangle: a test of pic macro recursion

recycle diagram

recycle.m4: Modest repetition and partial fill

ex15 diagram

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

Counting diagram

Counting.m4: An example of enumeration

Crow diagram

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

Flow diagram

Flow.m4: A flowchart sampler

Btree diagram

Btree.m4: A binary tree

Incleps diagram

Incleps.m4: Overlaying a figure with line graphics

Dwight Aplevich
Contact the author: last name at domain

Examples and hints by Alan Robert Clark: Using Circuit Macros

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,
Gordon C. Andrews, J. Dwight Aplevich, Roydon A. Fraser, Carolyn G. MacGregor, Introduction to Professional Engineering in Canada, (fourth edition) Toronto: Prentice Hall, Pearson Education Canada, Inc., 2014.

Circuit_macros home page.