# Electric circuits in TeX, LaTeX, and Friends

What are some ways to draw electric circuits in TeX systems?

I'm making this community wiki since I haven't found a question related to this.

I was thinking along the lines of circuitikz. What do you think of that? Other examples are more than welcome, of course.

-
I'd be interested to see examples comparing the different approaches, as well. –  Will Robertson Sep 29 '10 at 4:55
Well after a look into the manuals, Circuitikz is the most complete package in term of components. –  s__C Feb 1 '13 at 7:54

From version 2.10 on, TikZ has a `circuits` library. It seems to be based on CircuiTikz.

-

Have a look at cirkuit. This kde editor for tikZ circuit macros provides live preview, snippets and more.

-

I would recommend circuit macros (https://ece.uwaterloo.ca/~aplevich/Circuit_macros/).

It is not a LaTeX plugin as circuitikz. The circuit drawing makes use of m4 (macro language) and dpic (PIC drawing language) to reach a LaTeX drawing file (e.g. tikz pgf commands actually).

The extra steps gives a lot of power and flexibility. And indeed the circuit symbols in Dwight Aplevich's M4 circuit macros look more pleasing. (https://ece.uwaterloo.ca/~aplevich/Circuit_macros/html/examples.html)

-
The biggest disadvantage is the multi-step processing. Besides than that it looks interesting and I'll have a look at it. –  s__C Jan 31 '13 at 21:46
The symbols look cool and the diagrams are beautiful, but the syntax is unintuitive. To place an element, you have to write something like `{R18: resistor(up_ elen_*1.2); llabel(,R_{18}) }` where 1.2 is the vertical shift from the current point (I think). –  Luigi Feb 4 '13 at 8:40
Access here and look for Examples and Advanced Examples for a big feature of circuit_macros. There are some souces and some tips. –  jotagah Dec 29 '14 at 1:40

I have seen two Metapost-based circuit drawing environments:

1. Tomasz Cholewo's mpcirc, which is a suite of four minimally documented Metapost libraries to support writing Metapost to layout circuits. The examples are impressively compact, but I don't understand the code;
2. Gustavo Argañaraz' makecirc, which is a pair of Metapost libraries, to handle circuit layout and creating Latex labels. The code is much more what one would expect, and there is a user guide.

Makecirc is somewhat tied to Latex, because its label creation library uses latex-specific code to create parametric label ranges. Mpcirc should work with Context.

-

My guess would be to actually use a normal cad program, and then export into a format that could be used by LaTeX (and friends). Preferable a format like svg (scalable vector graphics) so that you could zoom in the resulting pdf.

I checked over at chiphacker for cad programs:

And maybe kicad can be useful since that seem to have svn export, but I have not tried it my self.

-
The usual reasons for wanting to do figures from a tex-aware programme apply. 1) You want the fonts and line-weights of the labels to match with the body text; 2) You want to be able to use tex mathmode facilities for the labelling; 3) You want to be able to use macros for the labels so you can redefine your notation for the whole document with a single change to a `\newcommand`. A normal CAD programme + export to eps + psfrag may work, but is generally more work than you would like, due to fine-tuning positioning of labels. –  Lev Bishop Sep 29 '10 at 15:24

For users of Asymptote, there seems to be a new package for doing this, discussed here.

-
Thanks Will. I've been using Asymptote for a year now and really love it. Although I almost never use it inside of LateX. I generate the image in its own file and import it. Up to now I've been drawing my own circuit elements with it. –  bev Nov 26 '10 at 9:57

You may also want to have a look the pst-circ package from the pstricks family.

-

Since somebody has to do it, it might as well be me. How about TikZ or here?

-
+1; totally agree `:)` –  Geoffrey Jones Sep 29 '10 at 4:41
Considering that the examples do a `\usepackage{...}`, are these documented in `texdoc pgfmanual`? –  Kit Oct 4 '10 at 6:58
@Kit: I'm not sure. Take a look in the documentation. –  TH. Oct 4 '10 at 7:53