Index of /tex-archive/graphics/circuit_macros

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -
[TXT]CHANGES30-Jan-2014 16:42 8.8K
[TXT]Copying30-Jan-2014 16:42 456
[TXT]Makefile30-Jan-2014 16:42 1.5K
[TXT]README30-Jan-2014 16:42 16K
[TXT]boxdims.sty30-Jan-2014 16:42 1.2K
[TXT]darrow.m430-Jan-2014 16:42 15K
[DIR]doc/30-Jan-2014 16:42 -
[DIR]examples/30-Jan-2014 16:42 -
[TXT]gpic.m430-Jan-2014 16:42 1.0K
[TXT]lib3D.m430-Jan-2014 16:42 7.4K
[TXT]libcct.m430-Jan-2014 16:42 114K
[TXT]libgen.m430-Jan-2014 16:42 50K
[TXT]liblog.m430-Jan-2014 16:42 40K
[TXT]mfpic.m430-Jan-2014 16:42 1.1K
[TXT]mpost.m430-Jan-2014 16:42 1.0K
[TXT]pgf.m430-Jan-2014 16:42 1.5K
[TXT]postscript.m430-Jan-2014 16:42 2.4K
[TXT]pstricks.m430-Jan-2014 16:42 1.9K
[TXT]svg.m430-Jan-2014 16:42 2.9K
[TXT]xfig.m430-Jan-2014 16:42 1.0K

* Circuit_macros Version 7.8, copyright (c) 2014 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 TeX, LaTeX, web, or similar documents, with support for
  SVG and other formats.  Fundamental electric circuit elements and
  basic logic gate 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 are similar to those
  of TeX itself, which is macro-based and non-wysiwyg, with ordinary
  text input.

  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, significant geometric calculations,
  repetition, or recursion.  Arbitrary text for formatting by LaTeX can
  be placed at will in the diagram. Free interpreters for m4 and pic
  are readily available.

Preferred setup:
  GNU m4, dpic (see below), LaTeX, PSTricks, dvips
  m4, dpic, LaTeX or PDFLaTeX, TikZ-PGF

  The dpic interpreter can translate pic input into several forms:
  a .tex file for processing by latex with PSTicks or pgf/Tikz (also
  pict2e or eepicemu for simple diagrams), or an mfpic, MetaPost, xfig,
  SVG, or postscript file.

  The GNU m4 macro processor is assumed since its -I option and M4PATH
  environment variable simplify file inclusion.  Previous versions
  of these macros did not use the -I option but required absolute path
  names to be used in include statements, which is still possible.

  m4, GNU pic (gpic), TeX or LaTeX, and a driver recognizing tpic specials
   (eg dvips)

  The GNU pic interpreter 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, Postscript

  First-time users should read at least the Quick Start section of

  The following describes basic usage. See below for integration
  with other tools:

  A source file, for example cct.m4, is processed as shown:
    m4 -I <path> pstricks.m4 cct.m4 | dpic -p > cct.tex
  where <path> is the path (location) of the installed macros; e.g.,
    m4 -I ~/lib pstricks.m4 cct.m4 | dpic -p > cct.tex
  if the macros are in $HOME/lib. This command can be simplified to
    m4 -I <path> cct.m4 | dpic -p > cct.tex
  if the first line of cct.m4 is include(pstricks.m4).

  To use the gpic processor, the command is
    m4 -I <path> cct.m4 | gpic -t > cct.tex

  If your m4 installation recognizes the M4PATH envirionment variable
  and it has been set to the directory containing the macros, then in
  the above, the -I <path> option for m4 can be omitted.

  The file cct.tex is processed by LaTeX or, more typically, inserted
  into a document to be processed by LaTeX, and the resulting dvi file
  is printed using dvips.

  In the case of PGF, the command is
    m4 -I <path> pgf.m4 cct.m4 | dpic -g > cct.tex
  or, using include lines in cct.m4,
    m4 -I <path> cct.m4 | dpic -g > cct.tex
  and the document is processed either by LaTeX to produce postscript
  or PDFLaTeX to produce pdf.

  1.  Decide where you will be installing the .m4 library files:
      $HOME/Circuit_macros or c:\localtexmf\Circuit_macros, for
      example. Copy libcct.m4 and the other .m4 files in the
      top-level directory of the distribution to the installation
      directory, or simply expand the .tar.gz or .zip distribution
      file in the installation directory.

  2.  Copy boxdims.sty (see Section 9 of the manual) to where LaTeX
      will find it, typically in localtexmf/tex/latex/local/ or
      C:\localtexmf\tex\latex\local, and refresh the LaTeX filename

  3.  This is optional. You can change the definition of the default
      processor to dpic with (for example) PSTricks or pgf (ie tikz)
      by editing the include command near the top of libgen.m4.  To do
      this automatically, copy Makefile from the top-level directory to
      the installation directory and type
        "make psdefault"  to make dpic with PSTricks the default
        "make pgfdefault" to make dpic with Tikz pgf the default
        "make gpicdefault" to restore gpic as the default.

WORKFLOW: The basic commands given above suffice for documents of moderate
  size and complexity; otherwise, a "make" facility or equivalent can be
  used or, for modest documents, diagram processing can be controlled from
  within the document source as described in the manual.  Special-purpose
  editors and project tools such as TeXnicCenter or Cirkuit can be used.
  Otherwise, a scripting language can automate the steps as done by
  Latexmk, for example.

  NOTE: One of the configuration files (gpic.m4, pstricks.m4, pgf.m4,
  postscript.m4, mpost.m4, mfpic.m4, svg.m4, or xfig.m4) should be
  read by m4 before (or at the beginning of) any of the other files,
  depending on the required form of pic output. Otherwise, libgen.m4 can
  be read first to use the default configuration file, which is gpic.m4
  in the distribution.

  To test your installation, go to the examples 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  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" to process name.m4.
  If these tests work to your satisfaction, try typing simply "make" to
  produce  To test .pdf files, go to the pgf directory,
  copy name.m4 there, and type either "make" or "make name.pdf"
  to test the file under pdflatex and TikZ PGF.

  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

  Before release, the macros are tested on a PC with Cygwin, MiKTeX,
  and dpic.

  M4 is widely available on Unix systems.  PC source and executables are
  also available:
  A large set of Unix-like Windows tools, including m4, is available via
  DJGPP versions are available as (where NN is the current
  release number) on web archives and at

  There are several sources of hints on m4 usage; some places to look are
  The m4 (computer language) article in Wikipedia gives a concise overview.
  An academic discussion of the language can be found in

  Gpic is part of the GNU groff distribution, for which the latest
  source is available from, but there are
  mirror sites that archive these sources, and others that distribute

  Dpic is not included here you say?  If you want to try the LaTeX
  picture objects, mfpic, PSTricks, TikZ-PGF, MetaPost, xfig, SVG, or
  Postscript output provided by dpic, the current free source and
  Windows executable can be obtained from

  View or print CMman.pdf in the doc directory.

  The original pic manual can be obtained at  A more extensive
  manual is found in the documentation that comes with GNU pic, which
  is typically installed as gpic.  The latest version can be found in
  the groff package at .  A pdf copy
  is included with the dpic distribution and a version can be found
  on the web at

  The dpic distribution includes a manual containing a summary of the pic
  language and discussion of features unique to dpic.

  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 CMman.pdf and view or print the file in the
  examples directory.  For the possibly unstable development version, try

  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, pdflatex, pgf,
  psfrag, and xfig examples.

  Installation and usage of the macros has evolved a little since the
  beginning so archived instructions on the net may be slightly more
  complicated than currently necessary.

  A set of examples and hints intended for his colleagues has been
  produced by Alan Robert Clark at

  A website describing usage and tools for Circuit_macros has been created
  by Peter-Jan Randewijk at
  The site includes examples ranging from basic circuits to block diagrams.
  Tools for creating pdf and web diagrams are included, along with
  Circuit_macro customizations for the Kile LaTeX editor, which are described at

  A KDE interface created by Matteo Agostinelli can be found at

  Mac users:
  A previewer script written by Collin J. Delker is available at

  An introduction to installation and use on OS X by Felipe Cavalcanti is at

  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," (Third edition)
  Toronto:  Prentice Hall, Pearson Education Canada, Inc., 2008.  Some
  samples from these books can be found at

  For an example of the use of dpic in a wiki (thanks to Jason Grout),
  Another web-based pic application can be found at

  A collection of pic resources and related material is available at Some of the example pic
  macros found there need minor tuning to work under dpic.

  A pic tutorial on the web is found at

  The examples in this distribution include some flowchart elements
  in Flow.m4.  For a pic-only version that does not require m4, look at

  The use of the pic language and pic macros for drawing graphs is
  described at

MetaPost examples:  Go to the examples/mpost directory.  Check the
  Makefile as described in the README file, type "make", and stand well back.

TikZ-PGF: Check the Makefile in the examples/pgf directory as described
  in the README file, and type "make" or "make examples.pdf".

PDFLaTeX: Check the Makefile in the examples/pdflatex directory as described
  in the README file, and type "make".  These examples use Metafont as an
  intermediate format and are made somewhat obselete by the above TikZ-PGF

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.  A switch in these
  macros deletes explicit LaTeX markup from the defined elements and provides
  other macros in svg.m4 for xml text formatting.

  If SVG is the ultimate goal, then it may be advisable to use the tool
  dvisvgm to convert dvi to svg. I haven't tried it yet.

  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.  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.

  A basic library of circuit elements created from these macros for
  importing into Inkscape is found in examples/svg/svglib.m4.

  The file examples/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.

  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.

  The file libgen.m4 contains basic macro definitions and is included
  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.

  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 duties 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