SlideShare a Scribd company logo
CircuiTikZ 
version 0.3.0 
Massimo A. Redaelli 
December 30, 2012 
Contents 
1 Introduction 2 
1.1 About . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 
1.2 Loading the package . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 
1.3 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 
1.4 Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 
1.5 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 
1.6 Incompatible packages . . . . . . . . . . . . . . . . . . . . . . . . . 3 
1.7 Introduction to version 0.3.0 . . . . . . . . . . . . . . . . . . . . . . 3 
1.8 Introduction to version 0.2.3 . . . . . . . . . . . . . . . . . . . . . . 4 
1.9 ConTEXt compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . 4 
2 Options 5 
3 The components 6 
3.1 Monopoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 
3.2 Bipoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 
3.2.1 Instruments . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 
3.2.2 Basic resistive bipoles . . . . . . . . . . . . . . . . . . . . . . 8 
3.2.3 Resistors and the like . . . . . . . . . . . . . . . . . . . . . . 9 
3.2.4 Stationary sources . . . . . . . . . . . . . . . . . . . . . . . . 11 
3.2.5 Diodes and such . . . . . . . . . . . . . . . . . . . . . . . . . 12 
3.2.6 Basic dynamical bipoles . . . . . . . . . . . . . . . . . . . . . 13 
3.2.7 Sinusoidal sources . . . . . . . . . . . . . . . . . . . . . . . . 15 
3.2.8 Square sources . . . . . . . . . . . . . . . . . . . . . . . . . . 15 
3.2.9 Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 
3.3 Tripoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 
3.3.1 Controlled sources . . . . . . . . . . . . . . . . . . . . . . . 15 
3.3.2 Transistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 
3.3.3 Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 
3.3.4 Other bipole-like tripoles . . . . . . . . . . . . . . . . . . . . 20 
3.3.5 Misc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 
3.4 Double bipoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 
3.5 Logic gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 
3.6 Amplifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 
3.7 Support shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 
1
4 Usage 24 
4.1 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 
4.2 Currents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 
4.3 Voltages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 
4.3.1 European style . . . . . . . . . . . . . . . . . . . . . . . . . . 27 
4.3.2 American style . . . . . . . . . . . . . . . . . . . . . . . . . . 27 
4.4 Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 
4.5 Special components . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 
4.6 Integration with siunitx . . . . . . . . . . . . . . . . . . . . . . . . 30 
4.7 Mirroring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 
4.8 Putting them together . . . . . . . . . . . . . . . . . . . . . . . . . . 31 
5 Not only bipoles 32 
5.1 Anchors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 
5.1.1 Logical ports . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 
5.1.2 Transistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 
5.1.3 Other tripoles . . . . . . . . . . . . . . . . . . . . . . . . . . 34 
5.1.4 Operational amplifier . . . . . . . . . . . . . . . . . . . . . . 35 
5.1.5 Double bipoles . . . . . . . . . . . . . . . . . . . . . . . . . . 36 
5.2 Transistor paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 
6 Customization 37 
6.1 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 
6.2 Components size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 
6.3 Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 
7 FAQ 41 
8 Examples 42 
9 Revision history 45 
Index of the components 48 
1 Introduction 
After two years of little exposure only on my personal website1, I did a major rehaul-ing 
of the code of CircuiTikZ, fixing several problems and converting everything to 
TikZ version 2:0. 
I’m not too sure about the result, because my (La)TEX skills are much to be 
improved, but it seems it’s time for more user feedback. So, here it is… 
I know the documentation is somewhat scant. Hope to have time to improve it a 
bit. 
1Now the package is moved to its own git repository: https://github.com/mredaelli/ 
circuitikz. Contributions are welcome. 
2
1.1 About 
This package provides a set of macros for naturally typesetting electrical and (some-what 
less naturally, perhaps) electronical networks. 
It was born mainly for writing my own exercise book and exams sheets for the 
Elettrotecnica courses at Politecnico di Milano, Italy. I wanted a tool that was easy 
to use, with a lean syntax, native to LATEX, and supporting directly PDF output format. 
So I based everything with the very impressive (if somewhat verbose at times) 
TikZ package. 
1.2 Loading the package 
usepackage{circuitikz} 
TikZ will be automatically loaded. 
1.3 License 
Copyright © 2007–2011 Massimo Redaelli. This package is author-maintained. Per-mission 
is granted to copy, distribute and/or modify this software under the terms 
of the LATEXProject Public License, version 1.3.1, or the GNU Public License. This soft-ware 
is provided ‘as is’, without warranty of any kind, either expressed or implied, 
including, but not limited to, the implied warranties of merchantability and fitness 
for a particular purpose. 
1.4 Feedback 
Much appreciated: k mailto:m.redaelli@gmail.com. Although I don’t guarantee 
quick answers. 
1.5 Requirements 
• tikz, version  2; 
• xstring, not older than 2009/03/13; 
• siunitx, if using siunitx option. 
1.6 Incompatible packages 
None, as far as I know. 
1.7 Introduction to version 0.3.0 
Probably nobody is hoping or caring for a new version of the package at this point, 
seeing how long it took me for this next release. But here it is, fixing a big problem 
(voltage labels in the wrong place, in some cases) and adding several components. 
Thanks for bug reporting and suggesting improvements. 
3
1.8 Introduction to version 0.2.3 
Having waited a long time before updating the package, many feature requests piled 
on my desk. They should all be implemented now. 
There are a number of backward incompatibilities—I’m sorry, but I had to make 
a choice in order not to have a schizophrenic interface. They are mostly, in my 
opinion, minor problems that can be dealt with with appropriate package options: 
• potentiometer is now the standard resistor-with-arrow-in-the-middle; the 
old potentiometer is now known as variable resistor (or vR), similarly to 
variable inductor and variable capacitor; 
• american inductor was not really the standard american inductor. The old 
american inductor has been renamed cute inductor; 
• transformer, transformer core and variable inductor are now linked 
with the chosen type of inductor; 
• styles for selecting shape variants (like [american resistors]) are now in 
the plural to avoid conflict with paths (like to[american resistor]). 
1.9 ConTEXt compatibility 
As requested by some users, I fixed the package for it to be compatible with ConTEXt. 
Just use usemodule[circuitikz] in your preamble and include the code between 
startcircuitikz and endcircuitikz. Please notice that the package siunitx 
in not available for ConTEXt: the option siunitx simply defines a few measurement 
units typical in electric sciences. 
In actually using CircuiTikZ with TikZ version 2 in ConTEXt an error comes up, 
saying something like 
! Undefined control sequence. 
tikz@cc@mid@checks - pgfutil@ifnextchar! 
The solution has been suggested to me by Aditya Mahajan, and involves modifying 
a file in TikZ: 
Here is the fix. In tikzlibrarycalc.code.tex change 
deftikz@cc@mid@checks{ 
pgfutil@ifnextchar !{%AM: Added space 
tikz@cc@mid% 
}{% 
advancepgf@xa bytikz@cc@factorpgf@xb% 
advancepgf@ya bytikz@cc@factorpgf@yb% 
tikz@cc@parse% continue 
}% 
} 
deftikz@cc@mid !{%AM Added space 
pgfutil@ifnextchar({% 
tikz@scan@one@pointtikz@cc@project% 
4
}{% 
tikz@cc@mid@num% 
}% 
} 
As far as I know, this is a bug in TikZ, and I notified the author, but until he fixes 
it, you know the workaround. 
2 Options 
• europeanvoltages: uses arrows to define voltages, and uses european-style 
voltage sources; 
• americanvoltages: usesand+to define voltages, and uses american-style 
voltage sources; 
• europeancurrents: uses european-style current sources; 
• americancurrents: uses american-style current sources; 
• europeanresistors: uses rectangular empty shape for resistors, as per eu-ropean 
standards; 
• americanresistors: uses zig-zag shape for resistors, as per american stan-dards; 
• europeaninductors: uses rectangular filled shape for inductors, as per eu-ropean 
standards; 
• americaninductors: uses ”4-bumps” shape for inductors, as per american 
standards; 
• cuteinductors: uses my personal favorite, ”pig-tailed” shape for inductors; 
• americanports: uses triangular logic ports, as per american standards; 
• europeanports: uses rectangular logic ports, as per european standards; 
• european: equivalent to europeancurrents, europeanvoltages, europeanresistors, 
europeaninductors, europeanports; 
• american: equivalent to americancurrents, americanvoltages, americanresistors, 
americaninductors, americanports; 
• siunitx: integrates with SIunitx package. If labels, currents or voltages are 
of the form #1#2 then what is shown is actually SI{#1}{#2}; 
• nosiunitx: labels are not interpreted as above; 
• fulldiodes: the various diodes are drawn and filled by default, i.e. when 
using styles such as diode, D, sD, …Un-filled diode can always be forced with 
Do, sDo, … 
• emptydiodes: the various diodes are drawn but not filled by default, i.e. when 
using styles such as diode, D, sD, …Filled diode can always be forced with D*, 
sD*, … 
5
• arrowmos: pmos and nmos have arrows analogous to those of pnp and npn 
transistors; 
• noarrowmos: pmos and nmos do not have arrows analogous to those of pnp 
and npn transistors; 
• straighlabels: labels on bipoles are always printed straigh up, i.e. with 
horizontal baseline; 
• rotatelabels: labels on bipoles are always printed aligned along the bipole; 
• smartlabels: labels on bipoles are rotated along the bipoles, unless the 
rotation is very close to multiples of 90°. 
The old options in the singular (like american voltage) are still available for 
compatibility, but are discouraged. 
Loading the package with no options is equivalent to my own personal liking, 
that is to the following options: 
[europeancurrents, europeanvoltages, americanresistors, cuteinductors, 
americanports, nosiunitx, noarrowmos, smartlabels]. 
In ConTEXt the options are similarly specified: current=european|american, 
voltage=european|american, resistor=american|european, inductor=cute|american|european, 
logic=american|european, siunitx=true|false, arrowmos=false|true. 
3 The components 
Here follows the list of all the shapes defined by CircuiTikZ. These are all pgf nodes, 
so they are usable in both pgf and TikZ. 
Each bipole (plus triac and thyristors) are shown using the following command, 
where #1 is the name of the component2: 
begin{center}begin{circuitikz} draw 
(0,0) to[ #1 ] (2,0) 
; end{circuitikz} end{center} 
The other shapes are shown with: 
begin{center}begin{circuitikz} draw 
(0,0) node[ #1 ] {} 
; end{circuitikz} end{center} 
Please notice that for user convenience transistors can also be inputted using 
the syntax for bipoles. See section 5.2. 
If using the tikzexternalize feature, as of Tikz 2.1 all pictures must end 
with end{tikzpicture}. Thus you cannot use the circuitikz environment. 
Which is ok: just use tikzpicture: everything will work there just fine. 
2 If #1 is the name of the bipole/the style, then the actual name of the shape is #1shape. 
6
3.1 Monopoles 
• Ground (ground) 
• Reference ground (rground) 
• Signal ground (sground) 
• Noiseless ground (nground) 
• Protective ground (pground) 
• Chassis ground3 (cground) 
• Antenna (antenna) 
• Transmitting antenna (rxantenna) 
3 These last three were contributed by Luigi «Liverpool») 
7
• Receiving antenna (txantenna) 
• Transmission line stub (tlinestub) 
3.2 Bipoles 
3.2.1 Instruments 
• Ammeter (ammeter) 
A 
• Voltmeter (voltmeter) 
V 
3.2.2 Basic resistive bipoles 
• Short circuit (short) 
• Open circuit (open) 
• Lamp (lamp) 
• Generic (symmetric) bipole (generic) 
• Tunable generic bipole (tgeneric) 
8
• Generic asymmetric bipole (ageneric) 
• Generic asymmetric bipole (full) (fullgeneric) 
• Tunable generic bipole (full) (tfullgeneric) 
• Memristor (memristor, or Mr) 
3.2.3 Resistors and the like 
If (default behaviour) americanresistors option is active (or the style [american 
resistors] is used), the resistor is displayed as follows: 
• Resistor (R, or american resistor) 
• Variable resistor (vR, or american variable resistor) 
• Potentiometer (pR, or american potentiometer) 
If instead europeanresistors option is active (or the style [european resistors] 
is used), the resistors, variable resistors and potentiometers are displayed as follows: 
• Resistor (R, or european resistor) 
9
• Variable resistor (vR, or european variable resistor) 
• Potentiometer (pR, or european potentiometer) 
Other miscellaneous resistor-like devices: 
• Varistor (varistor) 
U 
• Photoresistor (phR, or photoresistor) 
• Thermocouple (thermocouple) 
• Thermistor (thR, or thermistor) 
• PTC thermistor (thRp, or thermistor ptc) 
# 
• NTC thermistor (thRn, or thermistor ntc) 
# 
• Fuse (fuse) 
• Asymmetric fuse (afuse, or asymmetric fuse) 
10
3.2.4 Stationary sources 
• Battery (battery) 
• Single battery cell (battery1) 
• Voltage source (european style) (european voltage source) 
• Voltage source (american style) (american voltage source) 
+ 
 
• Current source (european style) (european current source) 
• Current source (american style) (american current source) 
If (default behaviour) europeancurrents option is active (or the 
style [european currents] is used), the shorthands current source, 
isource, and I are equivalent to european current source. Otherwise, if 
americancurrents option is active (or the style [american currents] is 
used) they are equivalent to american current source. 
Similarly, if (default behaviour) europeanvoltages option is active (or 
the style [european voltages] is used), the shorthands voltage source, 
vsource, and V are equivalent to european voltage source. Otherwise, if 
americanvoltages option is active (or the style [american voltages] is 
used) they are equivalent to american voltage source. 
11
3.2.5 Diodes and such 
• Empty diode (empty diode, or Do) 
• Empty Schottky diode (empty Schottky diode, or sDo) 
• Empty Zener diode (empty Zener diode, or zDo) 
• Empty tunnel diode (empty tunnel diode, or tDo) 
• Empty photodiode (empty photodiode, or pDo) 
• Empty led (empty led, or leDo) 
• Empty varcap (empty varcap, or VCo) 
• Full diode (full diode, or D*) 
• Full Schottky diode (full Schottky diode, or sD*) 
• Full Zener diode (full Zener diode, or zD*) 
12
• Full tunnel diode (full tunnel diode, or tD*) 
• Full photodiode (full photodiode, or pD*) 
• Full led (full led, or leD*) 
• Full varcap (full varcap, or VC*) 
The options fulldiodes and emptydiodes (and the styles [full diodes] 
and [empty diodes]) define which shape will be used by abbreviated com-mands 
such that D, sD, zD, tD, pD, leD, and VC. 
• Squid (squid) 
• Barrier (barrier) 
3.2.6 Basic dynamical bipoles 
• Capacitor (capacitor, or C) 
• Polar capacitor (polar capacitor, or pC) 
13
• Variable capacitor (variable capacitor, or vC) 
If (default behaviour) cuteinductors option is active (or the style [cute inductors] 
is used), the inductors are displayed as follows: 
• Inductor (L, or cute inductor) 
• Variable inductor (vL, or variable cute inductor) 
If americaninductors option is active (or the style [american inductors] is 
used), the inductors are displayed as follows: 
• Inductor (L, or american inductor) 
• Variable inductor (vL, or variable american inductor) 
Finally, if europeaninductors option is active (or the style [european inductors] 
is used), the inductors are displayed as follows: 
• Inductor (L, or european inductor) 
• Variable inductor (vL, or variable european inductor) 
There is also a transmission line: 
• Transmission line (TL, or transmission line, tline) 
14
3.2.7 Sinusoidal sources 
Here because I was asked for them. But how do you distinguish one from the other?! 
• Sinusoidal voltage source (sinusoidal voltage source, or vsourcesin, 
sV) 
• Sinusoidal current source (sinusoidal current source, or isourcesin, 
sI) 
3.2.8 Square sources 
• Square voltage source (square voltage source, or vsourcesquare, sqV) 
3.2.9 Switch 
• Closing switch (closing switch, or cspst) 
• Opening switch (opening switch, or ospst) 
• Push button (push button) 
3.3 Tripoles 
3.3.1 Controlled sources 
Admittedly, graphically they are bipoles. But I couldn’t… 
• Controlled voltage source (european style) (european controlled voltage 
source) 
15
• Controlled voltage source (american style) (american controlled voltage 
source) 
+ 
 
• Controlled current source (european style) (european controlled current 
source) 
• Controlled current source (american style) (american controlled current 
source) 
If (default behaviour) europeancurrents option is active (or the 
style [european currents] is used), the shorthands controlled current 
source, cisource, and cI are equivalent to european controlled current 
source. Otherwise, if americancurrents option is active (or the style 
[american currents] is used) they are equivalent to american controlled 
current source. 
Similarly, if (default behaviour) europeanvoltages option is active (or the 
style [european voltages] is used), the shorthands controlled voltage 
source, cvsource, and cV are equivalent to european controlled voltage 
source. Otherwise, if americanvoltages option is active (or the style 
[american voltages] is used) they are equivalent to american controlled 
voltage source. 
• Controlled sinusoidal voltage source (controlled sinusoidal voltage 
source, or controlled vsourcesin, cvsourcesin, csV) 
• Controlled sinusoidal current source (controlled sinusoidal current 
source, or controlled isourcesin, cisourcesin, csI) 
16
3.3.2 Transistors 
• nmos (nmos) 
• pmos (pmos) 
• npn (npn) 
• pnp (pnp) 
• npigbt (nigbt) 
• pigbt (pigbt) 
If the option arrowmos is used (or after the commant ctikzset{tripoles/mos style/arrows} 
is given), this is the output: 
• nmos (nmos) 
17
• pmos (pmos) 
nfets and pfets have been incorporated based on code provided by Clemens 
Helfmeier and Theodor Borsche: 
• nfet (nfet) 
• nigfete (nigfete) 
• nigfetd (nigfetd) 
• pfet (pfet) 
• pigfete (pigfete) 
18
• pigfetd (pigfetd) 
njfet and pjfet have been incorporated based on code provided by Danilo Piazza-lunga: 
• njfet (njfet) 
• pjfet (pjfet) 
isfet 
• isfet (isfet) 
3.3.3 Switch 
• spdt (spdt) 
• Toggle switch (toggle switch) 
19
3.3.4 Other bipole-like tripoles 
The following tripoles are entered with the usual command of the form 
• triac (triac, or Tr) 
• thyristor (thyristor, or Ty) 
3.3.5 Misc 
• Mixer (mixer) 
3.4 Double bipoles 
Transformers automatically use the inductor shape currently selected. These are 
the three possibilities: 
• Transformer (cute inductor) (transformer) 
• Transformer (american inductor) (transformer) 
• Transformer (european inductor) (transformer) 
20
Transformers with core are also available: 
• Transformer core (cute inductor) (transformer core) 
• Transformer core (american inductor) (transformer core) 
• Transformer core (european inductor) (transformer core) 
• Gyrator (gyrator) 
3.5 Logic gates 
• American and port (american and port) 
• American or port (american or port) 
21
• American not port (american not port) 
• American nand port (american nand port) 
• American nor port (american nor port) 
• American xor port (american xor port) 
• American xnor port (american xnor port) 
• European and port (european and port) 
 
• European or port (european or port) 
 1 
• European not port (european not port) 
1 
• European nand port (european nand port) 
22
• European nor port (european nor port) 
 1 
• European xor port (european xor port) 
= 1 
• European xnor port (european xnor port) 
= 1 
If (default behaviour) americanports option is active (or the style 
[american ports] is used), the shorthands and port, or port, not port, 
nand port, not port, xor port, and xnor port are equivalent to the ameri-can 
version of the respective logic port. 
If otherwise europeanports option is active (or the style [european 
ports] is used), the shorthands and port, or port, not port, nand port, 
not port, xor port, and xnor port are equivalent to the european version 
of the respective logic port. 
3.6 Amplifiers 
• Operational amplifier (op amp) 
 
+ 
• Fully differential operational amplifier4 (fd op amp) 
 
+ 
+ 
 
4 Contributed by Kristofer M. Monisit. 
23
• Plain amplifier (plain amp) 
• Buffer (buffer) 
3.7 Support shapes 
• Arrows (current and voltage) (currarrow) 
• Connected terminal (circ) 
• Unconnected terminal (ocirc) 
4 Usage 
R1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, l =$R_1$] (2,0); 
3 end{ circuitikz } 
R1 
1 begin{ circuitikz } 
2 draw (0,0) to [R=$R_1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i =$i _1$] (2,0); 
3 end{ circuitikz } 
v1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, v=$v_1$] (2,0); 
3 end{ circuitikz } 
R1 
v1 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R=$R_1$, i =$i _1$, v=$v_1$] (2,0); 
3 end{ circuitikz } 
24
R1 
v1 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R=$R_1$, i =$i _1$, v=$v_1$] (2,0); 
3 end{ circuitikz } 
Long names/styles for the bipoles can be used: 
1 kΩ 
1 begin{ circuitikz }draw 
2 (0,0) to [ resistor =1 kilo ohm] (2,0) 
3 ; end{ circuitikz } 
4.1 Labels 
R1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, l ^=$R_1$] (2,0); 
3 end{ circuitikz } 
R1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, l _=$R_1$] (2,0); 
3 end{ circuitikz } 
The default orientation of labels is controlled by the options smartlabels, rotatelabels 
and straightlabels (or the corresponding label/align keys). Here are examples 
to see the differences: 
0 
90 45 
135 
180 
-90 
-45 
-135 
1 begin{ circuitikz } 
2  ctikzset { label /align = straight } 
3 defDIR{0,45,90,135,180,90,45,135} 
4 foreach i in DIR { 
5 draw (0,0) to [R=i , *o] ( i :2.5); 
6 } 
7 end{ circuitikz } 
0 
45 
90 
135 
180 
-90 
-45 
-135 
1 begin{ circuitikz } 
2  ctikzset { label /align = rotate } 
3 defDIR{0,45,90,135,180,90,45,135} 
4 foreach i in DIR { 
5 draw (0,0) to [R=i , *o] ( i :2.5); 
6 } 
7 end{ circuitikz } 
25
0 
45 
90 
135 
180 
-90 
-45 
-135 
1 begin{ circuitikz } 
2  ctikzset { label /align = smart} 
3 defDIR{0,45,90,135,180,90,45,135} 
4 foreach i in DIR { 
5 draw (0,0) to [R=i , *o] ( i :2.5); 
6 } 
7 end{ circuitikz } 
4.2 Currents 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i ^=$i_1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i _=$i _1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i ^=$i_1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i _=$i _1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i ^=$i_1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i _=$i _1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i ^=$i_1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i _=$i _1$] (2,0); 
3 end{ circuitikz } 
Also 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i =$i _1$] (2,0); 
3 end{ circuitikz } 
26
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i =$i _1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i ^=$i_1$] (2,0); 
3 end{ circuitikz } 
i1 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i _=$i_1$] (2,0); 
3 end{ circuitikz } 
4.3 Voltages 
4.3.1 European style 
The default, with arrows. Use option europeanvoltage or style [european voltages]. 
v1 
1 begin{ circuitikz }[ european voltages] 
2 draw (0,0) to [R, v^=$v_1$] (2,0); 
3 end{ circuitikz } 
v1 
1 begin{ circuitikz }[ european voltages] 
2 draw (0,0) to [R, v^=$v_1$] (2,0); 
3 end{ circuitikz } 
v1 
1 begin{ circuitikz }[ european voltages] 
2 draw (0,0) to [R, v_=$v_1$] (2,0); 
3 end{ circuitikz } 
v1 
1 begin{ circuitikz }[ european voltages] 
2 draw (0,0) to [R, v_=$v_1$] (2,0); 
3 end{ circuitikz } 
4.3.2 American style 
For those who like it (not me). Use option americanvoltage or set [american voltages]. 
 v1 + 
1 begin{ circuitikz }[ american voltages] 
2 draw (0,0) to [R, v^=$v_1$] (2,0); 
3 end{ circuitikz } 
+  v1 
1 begin{ circuitikz }[ american voltages] 
2 draw (0,0) to [R, v^=$v_1$] (2,0); 
3 end{ circuitikz } 
 v + 1 
1 begin{ circuitikz }[ american voltages] 
2 draw (0,0) to [R, v_=$v_1$] (2,0); 
3 end{ circuitikz } 
+ v  1 
1 begin{ circuitikz }[ american voltages] 
2 draw (0,0) to [R, v_=$v_1$] (2,0); 
3 end{ circuitikz } 
27
4.4 Nodes 
1 begin{ circuitikz } 
2 draw (0,0) to [R, oo] (2,0); 
3 end{ circuitikz } 
1 begin{ circuitikz } 
2 draw (0,0) to [R, o] (2,0); 
3 end{ circuitikz } 
1 begin{ circuitikz } 
2 draw (0,0) to [R, o] (2,0); 
3 end{ circuitikz } 
1 begin{ circuitikz } 
2 draw (0,0) to [R, **] (2,0); 
3 end{ circuitikz } 
1 begin{ circuitikz } 
2 draw (0,0) to [R, *] (2,0); 
3 end{ circuitikz } 
1 begin{ circuitikz } 
2 draw (0,0) to [R, *] (2,0); 
3 end{ circuitikz } 
1 begin{ circuitikz } 
2 draw (0,0) to [R, o*] (2,0); 
3 end{ circuitikz } 
1 begin{ circuitikz } 
2 draw (0,0) to [R, *o] (2,0); 
3 end{ circuitikz } 
4.5 Special components 
For some components label, current and voltage behave as one would expect: 
a1 1 begin{ circuitikz } 
2 draw (0,0) to [ I=$a_1$] (2,0); 
3 end{ circuitikz } 
a1 1 begin{ circuitikz } 
2 draw (0,0) to [ I , i =$a_1$] (2,0); 
3 end{ circuitikz } 
k  a1 1 begin{ circuitikz } 
2 draw (0,0) to [ cI=$kcdot a_1$] (2,0); 
3 end{ circuitikz } 
28
a1 1 begin{ circuitikz } 
2 draw (0,0) to [ sI =$a_1$] (2,0); 
3 end{ circuitikz } 
k  a1 1 begin{ circuitikz } 
2 draw (0,0) to [ csI =$kcdot a_1$] (2,0); 
3 end{ circuitikz } 
The following results from using the option americancurrent or using the style 
[american currents]. 
a1 1 begin{ circuitikz }[ american currents] 
2 draw (0,0) to [ I=$a_1$] (2,0); 
3 end{ circuitikz } 
a1 1 begin{ circuitikz }[ american currents] 
2 draw (0,0) to [ I , i =$a_1$] (2,0); 
3 end{ circuitikz } 
k  a1 1 begin{ circuitikz }[ american currents] 
2 draw (0,0) to [ cI=$kcdot a_1$] (2,0); 
3 end{ circuitikz } 
a1 1 begin{ circuitikz }[ american currents] 
2 draw (0,0) to [ sI =$a_1$] (2,0); 
3 end{ circuitikz } 
k  a1 1 begin{ circuitikz }[ american currents] 
2 draw (0,0) to [ csI =$kcdot a_1$] (2,0); 
3 end{ circuitikz } 
The same holds for voltage sources: 
a1 1 begin{ circuitikz } 
2 draw (0,0) to [V=$a_1$] (2,0); 
3 end{ circuitikz } 
a1 1 begin{ circuitikz } 
2 draw (0,0) to [V, v=$a_1$] (2,0); 
3 end{ circuitikz } 
k  a1 
1 begin{ circuitikz } 
2 draw (0,0) to [cV=$kcdot a_1$] (2,0); 
3 end{ circuitikz } 
29
a1 1 begin{ circuitikz } 
2 draw (0,0) to [sV=$a_1$] (2,0); 
3 end{ circuitikz } 
k  a1 
1 begin{ circuitikz } 
2 draw (0,0) to [csV=$kcdot a_1$] (2,0); 
3 end{ circuitikz } 
The following results from using the option americanvoltage or the style 
[american voltages]. 
a1 1 begin{ circuitikz }[ american voltages] 
+ 
 
2 draw (0,0) to [V=$a_1$] (2,0); 
3 end{ circuitikz } 
a1 1 begin{ circuitikz }[ american voltages] 
+ 
 
2 draw (0,0) to [V, v=$a_1$] (2,0); 
3 end{ circuitikz } 
k  a1 1 begin{ circuitikz }[ american voltages] 
+ 
 
2 draw (0,0) to [cV=$kcdot a_1$] (2,0); 
3 end{ circuitikz } 
a1 1 begin{ circuitikz }[ american voltages] 
2 draw (0,0) to [sV=$a_1$] (2,0); 
3 end{ circuitikz } 
k  a1 1 begin{ circuitikz }[ american voltages] 
2 draw (0,0) to [csV=$kcdot a_1$] (2,0); 
3 end{ circuitikz } 
4.6 Integration with siunitx 
If the option siunitx is active (and not in ConTEXt), then the following are equivalent: 
1 kΩ 
1 begin{ circuitikz } 
2 draw (0,0) to [R, l =1 kilo ohm] (2,0); 
3 end{ circuitikz } 
1 kΩ 
1 begin{ circuitikz } 
2 draw (0,0) to [R, l =$SI {1}{ kilo ohm}$] (2,0); 
3 end{ circuitikz } 
1 mA 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i =1 milli ampere] (2,0); 
3 end{ circuitikz } 
30
1 mA 
1 begin{ circuitikz } 
2 draw (0,0) to [R, i =$SI {1}{ milli ampere}$] (2,0); 
3 end{ circuitikz } 
1 V 
1 begin{ circuitikz } 
2 draw (0,0) to [R, v=1volt ] (2,0); 
3 end{ circuitikz } 
1 V 
1 begin{ circuitikz } 
2 draw (0,0) to [R, v=$SI {1}{ volt }$] (2,0); 
3 end{ circuitikz } 
4.7 Mirroring 
1 begin{ circuitikz } 
2 draw (0,0) to [pD] (2,0); 
3 end{ circuitikz } 
1 begin{ circuitikz } 
2 draw (0,0) to [pD, mirror] (2,0); 
3 end{ circuitikz } 
At the moment, placing labels and currents on mirrored bipoles works: 
T 
1 begin{ circuitikz } 
2 draw (0,0) to [ ospst=T] (2,0); 
3 end{ circuitikz } 
T 
i1 1 begin{ circuitikz } 
2 draw (0,0) to [ ospst=T, mirror, i =$i _1$] (2,0); 
3 end{ circuitikz } 
But voltages don’t: 
v 1 begin{ circuitikz } 
T 
2 draw (0,0) to [ ospst=T, mirror, v=v] (2,0); 
3 end{ circuitikz } 
Sorry about that. 
4.8 Putting them together 
1 kΩ 
1 mA 
1 begin{ circuitikz } 
2 draw (0,0) to [R=1kiloohm, 
3 i _=1 milli ampere, o*] (3,0); 
4 end{ circuitikz } 
vD 
1 mA 
1 begin{ circuitikz } 
2 draw (0,0) to [D*, v=$v_D$, 
3 i =1 milli ampere, o*] (3,0); 
4 end{ circuitikz } 
31
5 Not only bipoles 
Since only bipoles (but see section 5.2) can be placed ”along a line”, components 
with more than two terminals are placed as nodes: 
1  tikz node[npn] at (0,0) {}; 
5.1 Anchors 
In order to allow connections with other components, all components define anchors. 
5.1.1 Logical ports 
All logical ports, except not, have two inputs and one output. They are called 
respectively in 1, in 2, out: 
1 
2 
3 
1 begin{ circuitikz } draw 
2 (0,0) node[and port] (myand) {} 
3 (myand.in 1) node[anchor=east] {1} 
4 (myand.in 2) node[anchor=east] {2} 
5 (myand.out) node[anchor=west] {3} 
6 ; end{ circuitikz } 
1 begin{ circuitikz } draw 
2 (0,2) node[and port] (myand1) {} 
3 (0,0) node[and port] (myand2) {} 
4 (2,1) node[xnor port] (myxnor) {} 
5 (myand1.out) | (myxnor.in 1) 
6 (myand2.out) | (myxnor.in 2) 
7 ; end{ circuitikz } 
In the case of not, there are only in and out (although for compatibility reasons 
in 1 is still defined and equal to in): 
1 begin{ circuitikz } draw 
2 (1,0) node[not port] (not1) {} 
3 (3,0) node[not port] (not2) {} 
4 (0,0)  (not1.in) 
5 (not2.in )  (not1.out) 
6 ++(0,1) node[ground] {} to [C] (not1.out) 
7 (not2.out) | (4,1) | (0,0) 
8 ; end{ circuitikz } 
5.1.2 Transistors 
For nmos, pmos, nfet, nigfete, nigfetd, pfet, pigfete, and pigfetd transistors one has 
base, gate, source and drain anchors (which can be abbreviated with B, G, S and 
D): 
32
G B 
D 
S 
1 begin{ circuitikz } draw 
2 (0,0) node[nmos] (mos) {} 
3 (mos.base) node[anchor=west] {B} 
4 (mos.gate) node[anchor=east] {G} 
5 (mos.drain) node[anchor=south] {D} 
6 (mos.source) node[anchor=north] {S} 
7 ; end{ circuitikz } 
B 
G 
D 
S 
1 begin{ circuitikz } draw 
2 (0,0) node[pigfete ] ( pigfete ) {} 
3 ( pigfete . B) node[anchor=west] {B} 
4 ( pigfete . G) node[anchor=east] {G} 
5 ( pigfete . D) node[anchor=south] {D} 
6 ( pigfete . S) node[anchor=north] {S} 
7 ; end{ circuitikz } 
Similarly njfet and pjfet have gate, source and drain anchors (which can be 
abbreviated with G, S and D): 
G 
S 1 begin{ circuitikz } draw 
D 
2 (0,0) node[pjfet ] ( pjfet ) {} 
3 ( pjfet . G) node[anchor=east] {G} 
4 ( pjfet . D) node[anchor=north] {D} 
5 ( pjfet . S) node[anchor=south] {S} 
6 ; end{ circuitikz } 
For npn, pnp, nigbt, and pigbt transistors the anchors are base, emitter and 
collector anchors (which can be abbreviated with B, E and C): 
B 
C 
E 
1 begin{ circuitikz } draw 
2 (0,0) node[npn] (npn) {} 
3 (npn.base) node[anchor=east] {B} 
4 (npn. collector ) node[anchor=south] {C} 
5 (npn.emitter) node[anchor=north] {E} 
6 ; end{ circuitikz } 
B 
E 1 begin{ circuitikz } draw 
C 
2 (0,0) node[pigbt] ( pigbt ) {} 
3 ( pigbt . B) node[anchor=east] {B} 
4 ( pigbt . C) node[anchor=north] {C} 
5 ( pigbt . E) node[anchor=south] {E} 
6 ; end{ circuitikz } 
Here is one composite example (please notice that the xscale=-1 style would 
also reflect the label of the transistors, so here a new node is added and its text is 
used, instead of that of pnp1): 
33
2 
1 
1 begin{ circuitikz } draw 
2 (0,0) node[pnp] (pnp2) {2} 
3 (pnp2.B) node[pnp, xscale=1, anchor=B] (pnp1) {} 
4 (pnp1) node {1} 
5 (pnp1.C) node[npn, anchor=C] (npn1) {} 
6 (pnp2.C) node[npn, xscale=1, anchor=C] (npn2) {} 
7 (pnp1.E)  (pnp2.E) (npn1.E)  (npn2.E) 
8 (pnp1.B) node[circ ] {} | (pnp2.C) node[circ ] {} 
9 ; end{ circuitikz } 
Similarly, transistors and other components can be reflected vertically: 
B 
G 
S 
D 
1 begin{ circuitikz } draw 
2 (0,0) node[pigfete , yscale=1] ( pigfete ) {} 
3 ( pigfete . B) node[anchor=west] {B} 
4 ( pigfete . G) node[anchor=east] {G} 
5 ( pigfete . D) node[anchor=north] {D} 
6 ( pigfete . S) node[anchor=south] {S} 
7 ; end{ circuitikz } 
R1 
1 begin{ circuitikz } 
2 draw (0,2) 
3 node[rground, yscale=1] {} 
4 to [R=$R_1$] (0,0) 
5 node[sground] {}; 
6 end{ circuitikz } 
5.1.3 Other tripoles 
When inserting a thrystor, a triac or a potentiometer, one needs to refer to the third 
node—gate (gate or G) for the former two; wiper (wiper or W) for the latter one. 
This is done by giving a name to the bipole: 
1 begin{ circuitikz } draw 
2 (0,0) to [Tr, n=TRI] (2,0) 
3 to [pR, n=POT] (4,0); 
4 draw[dashed] (TRI.G) | (POT.wiper) 
5 ; end{ circuitikz } 
As for the switches: 
in 
out 1 
out 2 
1 begin{ circuitikz } draw 
2 (0,0) node[spdt] (Sw) {} 
3 (Sw.in) node[ left ] {in } 
4 (Sw.out 1) node[right] {out 1} 
5 (Sw.out 2) node[right] {out 2} 
6 ; end{ circuitikz } 
34
1 begin{ circuitikz } draw 
2 (0,0) to [C] (1,0) to [ toggle switch , n=Sw] (2.5,0) 
3  (2.5,1) to [ battery 1] (1.5,1) to [R] (0,1) | (0,0) 
4 (Sw.out 2) | (2.5, 1) to [R] (0,1)  (0,0) 
5 ; end{ circuitikz } 
And the mixer: 
in 1 
in 2 
out 
1 begin{ circuitikz } draw 
2 (0,0) node[mixer] (mix) {} 
3 (mix.in 1) node[ left ] {in 1} 
4 (mix.in 2) node[below] {in 2} 
5 (mix.out) node[right] {out} 
6 ; end{ circuitikz } 
5.1.4 Operational amplifier 
The op amp defines the inverting input (-), the non-inverting input (+) and the 
output (out) anchors: 
 
v 
v+ + 
vo 
1 begin{ circuitikz } draw 
2 (0,0) node[op amp] (opamp) {} 
3 (opamp.+) node[ left ] {$v_+$} 
4 (opamp.) node[left] {$v_$} 
5 (opamp.out) node[right] {$v_o$} 
6 ; end{ circuitikz } 
There are also two more anchors defined, up and down, for the power supplies: 
 
v 
v+ + 
vo 
12 V 
1 begin{ circuitikz } draw 
2 (0,0) node[op amp] (opamp) {} 
3 (opamp.+) node[ left ] {$v_+$} 
4 (opamp.) node[left] {$v_$} 
5 (opamp.out) node[right] {$v_o$} 
6 (opamp.down) node[ground] {} 
7 (opamp.up) ++ (0,.5) node[above] { SI {12}{ volt }} 
8  (opamp.up) 
9 ; end{ circuitikz } 
The fully differential op amp defines two outputs: 
v  
out + 
+ 
+ 
 
v+ 
out - 
1 begin{ circuitikz } draw 
2 (0,0) node[fd op amp] (opamp) {} 
3 (opamp.+) node[ left ] {$v_+$} 
4 (opamp.) node[left] {$v_$} 
5 (opamp.out +) node[right] {out +} 
6 (opamp.out ) node[right] {out } 
7 (opamp.down) node[ground] {} 
8 ; end{ circuitikz } 
35
5.1.5 Double bipoles 
All the (few, actually) double bipoles/quadrupoles have the four anchors, two for 
each port. The first port, to the left, is port A, having the anchors A1 (up) and A2 
(down); same for port B. They also expose the base anchor, for labelling: 
A1 
A2 
B1 
B2 
K 
1 begin{ circuitikz } draw 
2 (0,0) node[transformer] (T) {} 
3 (T.A1) node[anchor=east] {A1} 
4 (T.A2) node[anchor=east] {A2} 
5 (T.B1) node[anchor=west] {B1} 
6 (T.B2) node[anchor=west] {B2} 
7 (T.base) node{K} 
8 ; end{ circuitikz } 
A1 
A2 
B1 
B2 
K 
1 begin{ circuitikz } draw 
2 (0,0) node[gyrator] (G) {} 
3 (G.A1) node[anchor=east] {A1} 
4 (G.A2) node[anchor=east] {A2} 
5 (G.B1) node[anchor=west] {B1} 
6 (G.B2) node[anchor=west] {B2} 
7 (G.base) node{K} 
8 ; end{ circuitikz } 
5.2 Transistor paths 
For syntactical convenience transistors can be placed using the normal path notation 
used for bipoles. The transitor type can be specified by simply adding a “T” (for 
transistor) in front of the node name of the transistor. It will be placed with the 
base/gate orthogonal to the direction of the path: 
2 3 1 begin{ circuitikz } draw 
1 
2 (0,0) node[njfet ] {1} 
3 (1,2) to [ Tnjfet =2] (1,2) 
4 to [ Tnjfet =3, mirror] (3,2); 
5 ; end{ circuitikz } 
Access to the gate and/or base nodes can be gained by naming the transistors 
with the n or name path style: 
36
1 begin{ circuitikz } draw[yscale =1.1, xscale =.8] 
2 (2,4.5)  (0,4.5) to [Tpmos, n=p1] (0,3) 
3 to [Tnmos, n=n1] (0,1.5) 
4 to [Tnmos, n=n2] (0,0) node[ground] {} 
5 (2,4.5) to [Tpmos,n=p2] (2,3) to [short , *] (0,3) 
6 (p1.G)  (n1.G) to[short , *o] ($( n1.G )+(3,0)$) 
7 (n2.G) ++(2,0) node[circ ] {} | (p2.G) 
8 (n2.G) to [short , o] ($( n2.G )+(3,0)$) 
9 (0,3) to [short , o] (1,3) 
10 ; end{ circuitikz } 
The name property is available also for bipoles, although this is useful mostly for 
triac, potentiometer and thyristor (see 3.3.4). 
6 Customization 
6.1 Parameters 
Pretty much all CircuiTikZ relies heavily on pgfkeys for value handling and con-figuration. 
Indeed, at the beginning of circuitikz.sty a series of key definitions 
can be found that modify all the graphical characteristics of the package. 
All can be varied using the ctikzset command, anywhere in the code. 
Shape of the components (on a per-component-class basis) 
1 Ω 
1 Ω 
1  tikz draw (0,0) to [R=1ohm] (2,0); par 
2  ctikzset { bipoles/ resistor /height =.6} 
3  tikz draw (0,0) to [R=1ohm] (2,0); 
1  tikz draw (0,0) node[nand port] {}; par 
2  ctikzset { tripoles /american nand port/input height =.2} 
3  ctikzset { tripoles /american nand port/port width=.2} 
4  tikz draw (0,0) node[nand port] {}; 
Thickness of the lines (globally) 
1 F 
1 F 
1  tikz draw (0,0) to [C=1farad] (2,0); par 
2  ctikzset { bipoles/thickness=1} 
3  tikz draw (0,0) to [C=1farad] (2,0); 
37
Global properties Of voltage and current 
1 V 
1 V 
1  tikz draw (0,0) to [R, v=1volt ] (2,0); par 
2  ctikzset { voltage/distance from node=.1} 
3  tikz draw (0,0) to [R, v=1volt ] (2,0); 
{ 
{ 
1  tikz draw (0,0) to [C, i =$imath$] (2,0); par 
2  ctikzset {current/distance = .2} 
3  tikz draw (0,0) to [C, i =$imath$] (2,0); 
However, you can override the properties voltage/distance from node5, voltage/bump b6 
and voltage/european label distance7 on a per-component basis, in order to 
fine-tune the voltages: 
1 V 
2 V 
1 V 
2 V 
1  tikz draw (0,0) to [R, v=1volt ] (1.5,0) 
2 to [C, v=2volt ] (3,0); par 
3  ctikzset { bipoles/capacitor/voltage/% 
4 distance from node/. initial =.7} 
5  tikz draw (0,0) to [R, v=1volt ] (1.5,0) 
6 to [C, v=2volt ] (3,0); par 
Admittedly, not all graphical properties have understandable names, but for the 
time it will have to do: 
1  tikz draw (0,0) node[xnor port] {}; 
2  ctikzset { tripoles /american xnor port/aaa=.2} 
3  ctikzset { tripoles /american xnor port/bbb=.6} 
4  tikz draw (0,0) node[xnor port] {}; 
6.2 Components size 
Perhaps the most important parameter is circuitikzbasekey/bipoles/length, 
which can be interpreted as the length of a resistor (including reasonable connec-tions): 
all other lenghts are relative to this value. For instance: 
5 That is, how distant from the initial and final points of the path the arrow starts and ends. 
6 Controlling how high the bump of the arrow is — how curved it is. 
7 Controlling how distant from the bipole the voltage label will be. 
38
B 
20 Ω 
10 Ω 
vx 
S 
5 Ω 5vx 
A 
1  ctikzset { bipoles/length=1.4cm} 
2 begin{ circuitikz }[ scale =1.2] draw 
3 (0,0) node[anchor=east] {B} 
4 to [short , o*] (1,0) 
5 to [R=20ohm, **] (1,2) 
6 to [R=10ohm, v=$v_x$] (3,2)  (4,2) 
7 to [ cI=$frac{ si {siemens}}{5} v_x$, **] (4,0)  (3,0) 
8 to [R=5ohm, **] (3,2) 
9 (3,0)  (1,0) 
10 (1,2) to [short , o] (0,2) node[anchor=east]{A} 
11 ; end{ circuitikz } 
B 
20 Ω 
10 Ω 
vx 
S 
55 Ω vx 
A 
1  ctikzset { bipoles/length=.8cm} 
2 begin{ circuitikz }[ scale =1.2] draw 
3 (0,0) node[anchor=east] {B} 
4 to [short , o*] (1,0) 
5 to [R=20ohm, **] (1,2) 
6 to [R=10ohm, v=$v_x$] (3,2)  (4,2) 
7 to [ cI=$frac{siemens}{5} v_x$, **] (4,0)  (3,0) 
8 to [R=5ohm, **] (3,2) 
9 (3,0)  (1,0) 
10 (1,2) to [short , o] (0,2) node[anchor=east]{A} 
11 ; end{ circuitikz } 
6.3 Colors 
The color of the components is stored in the key circuitikzbasekey/color. 
CircuiTikZ tries to follow the color set in TikZ, although sometimes it fails. If you 
change color in the picture, please do not use just the color name as a style, like 
[red], but rather assign the style [color=red]. 
Compare for instance 
39
1 begin{ circuitikz } draw[red] 
2 (0,2) node[and port] (myand1) {} 
3 (0,0) node[and port] (myand2) {} 
4 (2,1) node[xnor port] (myxnor) {} 
5 (myand1.out) | (myxnor.in 1) 
6 (myand2.out) | (myxnor.in 2) 
7 ; end{ circuitikz } 
and 
1 begin{ circuitikz } draw[color=red] 
2 (0,2) node[and port] (myand1) {} 
3 (0,0) node[and port] (myand2) {} 
4 (2,1) node[xnor port] (myxnor) {} 
5 (myand1.out) | (myxnor.in 1) 
6 (myand2.out) | (myxnor.in 2) 
7 ; end{ circuitikz } 
One can of course change the color in medias res: 
1 begin{ circuitikz } draw 
2 (0,0) node[pnp, color=blue] (pnp2) {} 
3 (pnp2.B) node[pnp, xscale=1, anchor=B, color=brown] (pnp1) {} 
4 (pnp1.C) node[npn, anchor=C, color=green] (npn1) {} 
5 (pnp2.C) node[npn, xscale=1, anchor=C, color=magenta] (npn2) {} 
6 (pnp1.E)  (pnp2.E) (npn1.E)  (npn2.E) 
7 (pnp1.B) node[circ ] {} | (pnp2.C) node[circ ] {} 
8 ; end{ circuitikz } 
The all-in-one stream of bipoles poses some challanges, as only the actual body 
of the bipole, and not the connecting lines, will be rendered in the specified color. 
Also, please notice the curly braces around the to: 
1 V 
1 Ω 
1 F 
1 begin{ circuitikz } draw 
2 (0,0) to [V=1volt] (0,2) 
3 { to [R=1ohm, color=red] (2,2) } 
4 to [C=1farad] (2,0)  (0,0) 
5 ; end{ circuitikz } 
Which, for some bipoles, can be frustrating: 
40
1 V 
1 Ω 
1 F 
1 begin{ circuitikz } draw 
2 (0,0){ to [V=1volt, color=red] (0,2) } 
3 to [R=1ohm] (2,2) 
4 to [C=1farad] (2,0)  (0,0) 
5 ; end{ circuitikz } 
The only way out is to specify different paths: 
1 V 
1 Ω 
1 F 
1 begin{ circuitikz } draw[color=red] 
2 (0,0) to [V=1volt, color=red] (0,2); 
3 draw (0,2) to [R=1ohm] (2,2) 
4 to [C=1farad] (2,0)  (0,0) 
5 ; end{ circuitikz } 
And yes: this is a bug and not a feature… 
7 FAQ 
Q: When using tikzexternalize I get the following error: 
! Emergency stop. 
A: The TikZ manual states: 
Furthermore, the library assumes that all LATEX pictures are ended 
with end{tikzpicture}verb. 
Just substitute every occurrence of the environment circuitikz with tikzpicture. 
They are actually pretty much the same. 
Q: How do I draw the voltage between two nodes? 
A: Between any two nodes there is an open circuit! 
v 
1 begin{ circuitikz } draw 
2 node[ocirc] (A) at (0,0) {} 
3 node[ocirc] (B) at (2,1) {} 
4 (A) to [open, v=$v$] (B) 
5 ; end{ circuitikz } 
Q: I cannot write to[R = $R_1=12V$] nor to[ospst = open, 3s]: I get errors. 
A: It is a limitation of the TikZ parser. Use to[R = $R_1{=}12V$] and to[ospst = open{,} 3s] 
instead. 
41
8 Examples 
10 μF 
2:2 kΩ 
12 mH 
i1 
1 kΩ 
0:3 kΩi1 
1 mA 
1 begin{ circuitikz }[ scale =1.4] draw 
2 (0,0) to [C, l =10microfarad] (0,2)  (0,3) 
3 to [R, l =2.2 kilo ohm] (4,3)  (4,2) 
4 to [L , l =12 milli henry, i =$i _1$] (4,0)  (0,0) 
5 (4,2) { to [D*, **, color=red] (2,0) } 
6 (0,2) to [R, l =1 kilo ohm, *] (2,2) 
7 to [cV, v=$SI {.3}{ kilo ohm} i_1$] (4,2) 
8 (2,0) to [ I , i =1 milli ampere, *] (2,2) 
9 ; end{ circuitikz } 
42
e(t) 
4 nF 
0:25 kΩ 
1 kΩ 
2 nF a(t) 
2 mH 
1 2 3 
1 begin{ circuitikz }[ scale =1.2] draw 
2 (0,0) node[ground] {} 
3 to [V=$e(t )$, **] (0,2) to [C=4nanofarad] (2,2) 
4 to [R, l _=.25 kilo ohm, **] (2,0) 
5 (2,2) to [R=1kiloohm] (4,2) 
6 to [C, l _=2nanofarad, **] (4,0) 
7 (5,0) to [ I , i _=$a(t )$, *] (5,2)  (4,2) 
8 (0,0)  (5,0) 
9 (0,2)  (0,3) to [L , l =2 milli henry] (5,3)  (5,2) 
10 
11 {[ anchor=south east] (0,2) node {1} (2,2) node {2} (4,2) node {3}} 
12 ; end{ circuitikz } 
B 
20 Ω 
10 Ω 
vx 
S 
5 Ω 5vx 
A 
1 begin{ circuitikz }[ scale =1.2] draw 
2 (0,0) node[anchor=east] {B} 
3 to [short , o*] (1,0) 
4 to [R=20ohm, **] (1,2) 
5 to [R=10ohm, v=$v_x$] (3,2)  (4,2) 
6 to [ cI=$frac{siemens}{5} v_x$, **] (4,0)  (3,0) 
7 to [R=5ohm, **] (3,2) 
8 (3,0)  (1,0) 
9 (1,2) to [short , o] (0,2) node[anchor=east]{A} 
10 ; end{ circuitikz } 
43
1 begin{ circuitikz }[ scale =1]draw 
2 (0,0) node[transformer] (T) {} 
3 (T.B2) to [pD] ($( T.B 2)+(2,0)$) | (3.5, 1) 
4 (T.B1) to [pD] ($( T.B 1)+(2,0)$) | (3.5, 1) 
5 ; end{ circuitikz } 
 
Cd1 
Rd Rd 
Uwe + 
Cd2 
Uwy 
1 begin{ circuitikz }[ scale =1]draw 
2 (5,.5) node [op amp] (opamp) {} 
3 (0,0) node [ left ] {$U_{we}$} to [R, l =$R_d$, o*] (2,0) 
4 to [R, l =$R_d$, **] (opamp.+) 
5 to [C, l _=$C_{d2}$, *] ($( opamp.+)+(0,2)$) node [ground] {} 
6 (opamp.out) | (3.5,2) to [C, l _=$C_{d1}$, *] (2,2) to [short] (2,0) 
7 (opamp.) | (3.5,2) 
8 (opamp.out) to [short , *o] (7,.5) node [ right ] {$U_{wy}$} 
9 ; end{ circuitikz } 
44
1 mA 
2 kΩ 
2 kΩ 
+ 
 2 V 
t0 
+ 
v1 
 
i1 
+ 
 
4 V 
1 kΩ 
v1/V 
i1/mA 
-2 
2 
4 
-4 
4 
-3 
1 begin{ circuitikz }[ scale =1.2, american]draw 
2 (0,2) to [ I=1 milli ampere] (2,2) 
3 to [R, l _=2kiloohm, **] (0,0) 
4 to [R, l _=2kiloohm] (2,0) 
5 to [V, v_=2volt ] (2,2) 
6 to [ cspst , l =$t_0$] (4,2)  (4,1.5) 
7 to [generic , i =$i _1$, v=$v_1$] (4,.5)  (4,1.5) 
8 (0,2)  (0,1.5) to [V, v_=4volt ] (2,1.5) 
9 to [R, l =1 kilo ohm] (4,1.5); 
10 
11 begin{scope}[ xshift =6.5cm, yshift =.5 cm] 
12 draw [] (2,0)  (2.5,0) node[anchor=west] {$v_1/volt $}; 
13 draw [] (0,2)  (0,2) node[anchor=west] {$i_1/SI {}{ milli ampere}$} ; 
14 draw (1,0) node[anchor=north] {2} (1,0) node[anchor=south] {2} 
15 (0,1) node[anchor=west] {4} (0,1) node[anchor=east] {4} 
16 (2,0) node[anchor=north west] {4} 
17 (1.5,0) node[anchor=south east] {3}; 
18 draw [thick ] (2,1)  (1,1)  (1,1)  (2,0)  (2.5,.5); 
19 draw [dotted] (1,1)  (1,0) (1,1)  (1,0) 
20 (1,1)  (0,1) (1,1)  (0,1); 
21 end{scope} 
22 end{ circuitikz } 
9 Revision history 
version 0.3.0 (20121229) 
1. fixed gate node for a few transistors 
2. added mixer 
3. added fully differential op amp (by Kristofer M. Monisit) 
4. now general settings for the drawing of voltage can be overridden for 
specific components 
45
5. made arrows more homogeneous (either the current/voltage one, or 
latex’ by pgf) 
6. added the single battery cell 
7. added fuse and asymmetric fuse 
8. added toggle switch 
9. added varistor, photoresistor, thermocouple, push button 
10. added thermistor, thermistor ptc, thermistor ptc 
11. fixed misalignment of voltage label in vertical bipoles with names 
12. added isfet 
13. added noiseless, protective, chassis, signal and reference grounds (Luigi 
Luigi «Liverpool») 
version 0.2.4 (20110911). 
1. added square voltage source (contributed by Alistair Kwan) 
2. added buffer and plain amplifier (contributed by Danilo Piazzalunga) 
3. added squid and barrier (contributed by Cor Molenaar) 
4. added antenna and transmission line symbols contributed by Leonardo 
Azzinnari 
5. added the changeover switch spdt (suggestion of Fabio Maria Antoniali) 
6. rename of context.tex and context.pdf (thanks to Karl Berry) 
7. updated the email address 
8. in documentation, fixed wrong (non-standard) labelling of the axis in an 
example (thanks to prof. Claudio Beccaria) 
9. fixed scaling inconsistencies in quadrupoles 
10. fixed division by zero error on certain vertical paths 
11. introduced options straighlabels, rotatelabels, smartlabels 
version 0.2.3 (20091118). 
1. fixed compatibility problem with label option from tikz 
2. Fixed resizing problem for shape ground 
3. Variable capacitor 
4. polarized capacitor 
5. ConTeXt support (read the manual!) 
6. nfet, nigfete, nigfetd, pfet, pigfete, pigfetd (contribution of Clemens 
Helfmeier and Theodor Borsche) 
7. njfet, pjfet (contribution of Danilo Piazzalunga) 
8. pigbt, nigbt 
9. backward incompatibility potentiometer is now the standard resistor-with-arrow- 
in-the-middle; the old potentiometer is now known as variable 
resistor (or vR), similarly to variable inductor and variable capacitor 
10. triac, thyristor, memristor 
46
11. new property ”name” for bipoles 
12. fixed voltage problem for batteries in american voltage mode 
13. european logic gates 
14. backward incompatibility new american standard inductor. Old american 
inductor now called ”cute inductor” 
15. backward incompatibility transformer now linked with the chosen type of 
inductor, and version with core, too. Similarly for variable inductor 
16. backward incompatibility styles for selecting shape variants now end are 
in the plural to avoid conflict with paths 
17. new placing option for some tripoles (mostly transistors) 
18. mirror path style 
version 0.2.2 (20090520). 
1. Added the shape for lamps. 
2. Added options europeanresistor, europeaninductor, americanresistor 
and americaninductor, with corresponding styles. 
3. Fixed: error in transistor arrow positioning and direction under negative 
xscale and yscale. 
version 0.2.1 (20090503). 
1. Op-amps added. 
2. Added options arrowmos and noarrowmos. 
version 0.2 First public release on CTAN (20090417). 
1. Backward incompatibility: labels ending with :angle are not parsed for 
positioning anymore. 
2. Full use of TikZ keyval features. 
3. White background is not filled anymore: now the network can be drawn 
on a background picture as well. 
4. Several new components added (logical ports, transistors, double bipoles, 
…). 
5. Color support. 
6. Integration with siunitx. 
7. Voltage, american style. 
8. Better code, perhaps. General cleanup at the very least. 
version 0.1 First public release (2007). 
47
Index of the components 
afuse, 10 
ageneric, 9 
american and port, 21 
american controlled current source, 
16 
american controlled voltage source, 
16 
american current source, 11 
american inductor, see L 
american nand port, 22 
american nor port, 22 
american not port, 22 
american or port, 21 
american potentiometer, see pR 
american resistor, see R 
american variable resistor, see vR 
american voltage source, 11 
american xnor port, 22 
american xor port, 22 
ammeter, 8 
antenna, 7 
asymmetric fuse, see afuse 
barrier, 13 
battery, 11 
battery1, 11 
buffer, 24 
C, see capacitor 
capacitor, 13 
cground, 7 
circ, 24 
cisourcesin, see controlled sinusoidal 
current source 
closing switch, 15 
controlled isourcesin, see controlled 
sinusoidal current source 
controlled sinusoidal current source, 
16 
controlled sinusoidal voltage source, 
16 
controlled vsourcesin, see controlled 
sinusoidal voltage source 
csI, see controlled sinusoidal current 
source 
cspst, see closing switch 
csV, see controlled sinusoidal voltage 
source 
currarrow, 24 
cute inductor, see L 
cvsourcesin, see controlled sinusoidal 
voltage source 
D*, see full diode 
Do, see empty diode 
empty diode, 12 
empty led, 12 
empty photodiode, 12 
empty Schottky diode, 12 
empty tunnel diode, 12 
empty varcap, 12 
empty Zener diode, 12 
european and port, 22 
european controlled current source, 
16 
european controlled voltage source, 
15 
european current source, 11 
european inductor, see L 
european nand port, 22 
european nor port, 23 
european not port, 22 
european or port, 22 
european potentiometer, see pR 
european resistor, see R 
european variable resistor, see vR 
european voltage source, 11 
european xnor port, 23 
european xor port, 23 
fd op amp, 23 
full diode, 12 
full led, 13 
full photodiode, 13 
full Schottky diode, 12 
full tunnel diode, 13 
full varcap, 13 
full Zener diode, 12 
fullgeneric, 9 
fuse, 10 
generic, 8 
ground, 7 
gyrator, 21 
isfet, 19 
48
isourcesin, see sinusoidal current 
source 
L, 14 
lamp, 8 
leD*, see full led 
leDo, see empty led 
memristor, 9 
mixer, 20 
Mr, see memristor 
nfet, 18 
nground, 7 
nigbt, 17 
nigfetd, 18 
nigfete, 18 
njfet, 19 
nmos, 17 
npn, 17 
ocirc, 24 
op amp, 23 
open, 8 
opening switch, 15 
ospst, see opening switch 
pC, see polar capacitor 
pD*, see full photodiode 
pDo, see empty photodiode 
pfet, 18 
pground, 7 
photoresistor, see phR 
phR, 10 
pigbt, 17 
pigfetd, 19 
pigfete, 18 
pjfet, 19 
plain amp, 24 
pmos, 17, 18 
pnp, 17 
polar capacitor, 13 
pR, 9, 10 
push button, 15 
R, 9 
rground, 7 
rxantenna, 7 
sD*, see full Schottky diode 
sDo, see empty Schottky diode 
sground, 7 
short, 8 
sI, see sinusoidal current source 
sinusoidal current source, 15 
sinusoidal voltage source, 15 
spdt, 19 
square voltage source, 15 
squid, 13 
sqV, see square voltage source 
sV, see sinusoidal voltage source 
tD*, see full tunnel diode 
tDo, see empty tunnel diode 
tfullgeneric, 9 
tgeneric, 8 
thermistor, see thR 
thermistor ntc, see thRn 
thermistor ptc, see thRp 
thermocouple, 10 
thR, 10 
thRn, 10 
thRp, 10 
thyristor, 20 
TL, 14 
tline, see TL 
tlinestub, 8 
toggle switch, 19 
Tr, see triac 
transformer, 20 
transformer core, 21 
transmission line, see TL 
triac, 20 
txantenna, 8 
Ty, see thyristor 
variable american inductor, see vL 
variable capacitor, 14 
variable cute inductor, see vL 
variable european inductor, see vL 
varistor, 10 
vC, see variable capacitor 
VC*, see full varcap 
VCo, see empty varcap 
vL, 14 
voltmeter, 8 
vR, 9, 10 
vsourcesin, see sinusoidal voltage 
source 
vsourcesquare, see square voltage 
source 
zD*, see full Zener diode 
zDo, see empty Zener diode 
49

More Related Content

PDF
Circuitikzmanual
PDF
Assembly Codes in C Programmes - A Short Notes by Arun Umrao
PDF
Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...
PDF
Notes of 8085 micro processor Programming for BCA, MCA, MSC (CS), MSC (IT) &...
PDF
Circuitikzmanual
PDF
2016.10.24 halvledere - pdf v.01 - DIODE TRANSISTOR SEMICONDUCTOR - Sven ...
PDF
Wavelet ug
PDF
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Circuitikzmanual
Assembly Codes in C Programmes - A Short Notes by Arun Umrao
Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...
Notes of 8085 micro processor Programming for BCA, MCA, MSC (CS), MSC (IT) &...
Circuitikzmanual
2016.10.24 halvledere - pdf v.01 - DIODE TRANSISTOR SEMICONDUCTOR - Sven ...
Wavelet ug
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...

What's hot (19)

PDF
c programming
PDF
Tinyos programming
PDF
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 1 of 5 by...
PDF
Lesson in electric circuits v3
PDF
Discovering st32
PDF
Direct Current (DC)
PDF
XORP manual
PDF
AIX 5L Differences Guide Version 5.3 Edition
PDF
Introduction to Arduino
PDF
Alternating Current (AC)
PDF
Modlica an introduction by Arun Umrao
PDF
Notes and Description for Xcos Scilab Block Simulation with Suitable Examples...
PDF
The C Preprocessor
PDF
Advanced cardiovascular exercites
PDF
Cac he dong luc hoc rat hay
PDF
Math for programmers
PDF
IBM Flex System Interoperability Guide
c programming
Tinyos programming
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 1 of 5 by...
Lesson in electric circuits v3
Discovering st32
Direct Current (DC)
XORP manual
AIX 5L Differences Guide Version 5.3 Edition
Introduction to Arduino
Alternating Current (AC)
Modlica an introduction by Arun Umrao
Notes and Description for Xcos Scilab Block Simulation with Suitable Examples...
The C Preprocessor
Advanced cardiovascular exercites
Cac he dong luc hoc rat hay
Math for programmers
IBM Flex System Interoperability Guide
Ad

Similar to Circuitikzmanual (1) (20)

PDF
Electrical circuits dc
PDF
PDF
szza009 (1).pdfdsrgggsdggggggggggggggggggggggg
PDF
Power Failure Detection System and Intimation over Internet
PDF
Practical electrical engineering
PDF
Circuit Analysis With Devices Theory And Practice 3rd Edition Allan H Robbins
PDF
Design and Detection of Underground Cable Fault Using Raspberry Pi and IoT Sy...
PDF
Underground Cable Fault Detection Using Arduino
PDF
PPTX
Wireless sensor networks
PDF
digital.pdf
PDF
Electrónica básica de Grob's 12th Edición Mitchel E. Schultz.pdf
PDF
IRJET - Zigbee based Street Light Control System
PDF
Microwave Engineering
PDF
PDF
Grob s Basic Electronics 11th Edition Mitchel E. Schultz
PDF
Circuit Theory and Transmission Lines 2nd Edition Ravish R. Singh
PDF
Innovative Computing Ic 2020 1st Ed Chaotung Yang Yan Pei
Electrical circuits dc
szza009 (1).pdfdsrgggsdggggggggggggggggggggggg
Power Failure Detection System and Intimation over Internet
Practical electrical engineering
Circuit Analysis With Devices Theory And Practice 3rd Edition Allan H Robbins
Design and Detection of Underground Cable Fault Using Raspberry Pi and IoT Sy...
Underground Cable Fault Detection Using Arduino
Wireless sensor networks
digital.pdf
Electrónica básica de Grob's 12th Edición Mitchel E. Schultz.pdf
IRJET - Zigbee based Street Light Control System
Microwave Engineering
Grob s Basic Electronics 11th Edition Mitchel E. Schultz
Circuit Theory and Transmission Lines 2nd Edition Ravish R. Singh
Innovative Computing Ic 2020 1st Ed Chaotung Yang Yan Pei
Ad

Recently uploaded (20)

PPTX
Overview of calcium in human muscles.pptx
PDF
Sciences of Europe No 170 (2025)
PDF
Assessment of environmental effects of quarrying in Kitengela subcountyof Kaj...
PDF
Looking into the jet cone of the neutrino-associated very high-energy blazar ...
DOCX
Q1_LE_Mathematics 8_Lesson 5_Week 5.docx
PPTX
Seminar Hypertension and Kidney diseases.pptx
PPTX
Fluid dynamics vivavoce presentation of prakash
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PDF
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
PPT
Heredity-grade-9 Heredity-grade-9. Heredity-grade-9.
PPTX
BODY FLUIDS AND CIRCULATION class 11 .pptx
PPTX
Introduction to Cardiovascular system_structure and functions-1
PPTX
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
PDF
BET Eukaryotic signal Transduction BET Eukaryotic signal Transduction.pdf
PDF
. Radiology Case Scenariosssssssssssssss
PPT
1. INTRODUCTION TO EPIDEMIOLOGY.pptx for community medicine
PDF
Cosmic Outliers: Low-spin Halos Explain the Abundance, Compactness, and Redsh...
PPTX
CORDINATION COMPOUND AND ITS APPLICATIONS
PDF
Placing the Near-Earth Object Impact Probability in Context
PDF
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
Overview of calcium in human muscles.pptx
Sciences of Europe No 170 (2025)
Assessment of environmental effects of quarrying in Kitengela subcountyof Kaj...
Looking into the jet cone of the neutrino-associated very high-energy blazar ...
Q1_LE_Mathematics 8_Lesson 5_Week 5.docx
Seminar Hypertension and Kidney diseases.pptx
Fluid dynamics vivavoce presentation of prakash
Phytochemical Investigation of Miliusa longipes.pdf
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
Heredity-grade-9 Heredity-grade-9. Heredity-grade-9.
BODY FLUIDS AND CIRCULATION class 11 .pptx
Introduction to Cardiovascular system_structure and functions-1
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
BET Eukaryotic signal Transduction BET Eukaryotic signal Transduction.pdf
. Radiology Case Scenariosssssssssssssss
1. INTRODUCTION TO EPIDEMIOLOGY.pptx for community medicine
Cosmic Outliers: Low-spin Halos Explain the Abundance, Compactness, and Redsh...
CORDINATION COMPOUND AND ITS APPLICATIONS
Placing the Near-Earth Object Impact Probability in Context
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...

Circuitikzmanual (1)

  • 1. CircuiTikZ version 0.3.0 Massimo A. Redaelli December 30, 2012 Contents 1 Introduction 2 1.1 About . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 Loading the package . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.4 Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.5 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.6 Incompatible packages . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.7 Introduction to version 0.3.0 . . . . . . . . . . . . . . . . . . . . . . 3 1.8 Introduction to version 0.2.3 . . . . . . . . . . . . . . . . . . . . . . 4 1.9 ConTEXt compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2 Options 5 3 The components 6 3.1 Monopoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2 Bipoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.2.1 Instruments . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.2.2 Basic resistive bipoles . . . . . . . . . . . . . . . . . . . . . . 8 3.2.3 Resistors and the like . . . . . . . . . . . . . . . . . . . . . . 9 3.2.4 Stationary sources . . . . . . . . . . . . . . . . . . . . . . . . 11 3.2.5 Diodes and such . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2.6 Basic dynamical bipoles . . . . . . . . . . . . . . . . . . . . . 13 3.2.7 Sinusoidal sources . . . . . . . . . . . . . . . . . . . . . . . . 15 3.2.8 Square sources . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.2.9 Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.3 Tripoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.3.1 Controlled sources . . . . . . . . . . . . . . . . . . . . . . . 15 3.3.2 Transistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3.3 Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.3.4 Other bipole-like tripoles . . . . . . . . . . . . . . . . . . . . 20 3.3.5 Misc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.4 Double bipoles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.5 Logic gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.6 Amplifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.7 Support shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 1
  • 2. 4 Usage 24 4.1 Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.2 Currents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.3 Voltages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.3.1 European style . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.3.2 American style . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.4 Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.5 Special components . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.6 Integration with siunitx . . . . . . . . . . . . . . . . . . . . . . . . 30 4.7 Mirroring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.8 Putting them together . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5 Not only bipoles 32 5.1 Anchors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1.1 Logical ports . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1.2 Transistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1.3 Other tripoles . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.1.4 Operational amplifier . . . . . . . . . . . . . . . . . . . . . . 35 5.1.5 Double bipoles . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.2 Transistor paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 6 Customization 37 6.1 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 6.2 Components size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6.3 Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 7 FAQ 41 8 Examples 42 9 Revision history 45 Index of the components 48 1 Introduction After two years of little exposure only on my personal website1, I did a major rehaul-ing of the code of CircuiTikZ, fixing several problems and converting everything to TikZ version 2:0. I’m not too sure about the result, because my (La)TEX skills are much to be improved, but it seems it’s time for more user feedback. So, here it is… I know the documentation is somewhat scant. Hope to have time to improve it a bit. 1Now the package is moved to its own git repository: https://github.com/mredaelli/ circuitikz. Contributions are welcome. 2
  • 3. 1.1 About This package provides a set of macros for naturally typesetting electrical and (some-what less naturally, perhaps) electronical networks. It was born mainly for writing my own exercise book and exams sheets for the Elettrotecnica courses at Politecnico di Milano, Italy. I wanted a tool that was easy to use, with a lean syntax, native to LATEX, and supporting directly PDF output format. So I based everything with the very impressive (if somewhat verbose at times) TikZ package. 1.2 Loading the package usepackage{circuitikz} TikZ will be automatically loaded. 1.3 License Copyright © 2007–2011 Massimo Redaelli. This package is author-maintained. Per-mission is granted to copy, distribute and/or modify this software under the terms of the LATEXProject Public License, version 1.3.1, or the GNU Public License. This soft-ware is provided ‘as is’, without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. 1.4 Feedback Much appreciated: k mailto:m.redaelli@gmail.com. Although I don’t guarantee quick answers. 1.5 Requirements • tikz, version 2; • xstring, not older than 2009/03/13; • siunitx, if using siunitx option. 1.6 Incompatible packages None, as far as I know. 1.7 Introduction to version 0.3.0 Probably nobody is hoping or caring for a new version of the package at this point, seeing how long it took me for this next release. But here it is, fixing a big problem (voltage labels in the wrong place, in some cases) and adding several components. Thanks for bug reporting and suggesting improvements. 3
  • 4. 1.8 Introduction to version 0.2.3 Having waited a long time before updating the package, many feature requests piled on my desk. They should all be implemented now. There are a number of backward incompatibilities—I’m sorry, but I had to make a choice in order not to have a schizophrenic interface. They are mostly, in my opinion, minor problems that can be dealt with with appropriate package options: • potentiometer is now the standard resistor-with-arrow-in-the-middle; the old potentiometer is now known as variable resistor (or vR), similarly to variable inductor and variable capacitor; • american inductor was not really the standard american inductor. The old american inductor has been renamed cute inductor; • transformer, transformer core and variable inductor are now linked with the chosen type of inductor; • styles for selecting shape variants (like [american resistors]) are now in the plural to avoid conflict with paths (like to[american resistor]). 1.9 ConTEXt compatibility As requested by some users, I fixed the package for it to be compatible with ConTEXt. Just use usemodule[circuitikz] in your preamble and include the code between startcircuitikz and endcircuitikz. Please notice that the package siunitx in not available for ConTEXt: the option siunitx simply defines a few measurement units typical in electric sciences. In actually using CircuiTikZ with TikZ version 2 in ConTEXt an error comes up, saying something like ! Undefined control sequence. tikz@cc@mid@checks - pgfutil@ifnextchar! The solution has been suggested to me by Aditya Mahajan, and involves modifying a file in TikZ: Here is the fix. In tikzlibrarycalc.code.tex change deftikz@cc@mid@checks{ pgfutil@ifnextchar !{%AM: Added space tikz@cc@mid% }{% advancepgf@xa bytikz@cc@factorpgf@xb% advancepgf@ya bytikz@cc@factorpgf@yb% tikz@cc@parse% continue }% } deftikz@cc@mid !{%AM Added space pgfutil@ifnextchar({% tikz@scan@one@pointtikz@cc@project% 4
  • 5. }{% tikz@cc@mid@num% }% } As far as I know, this is a bug in TikZ, and I notified the author, but until he fixes it, you know the workaround. 2 Options • europeanvoltages: uses arrows to define voltages, and uses european-style voltage sources; • americanvoltages: usesand+to define voltages, and uses american-style voltage sources; • europeancurrents: uses european-style current sources; • americancurrents: uses american-style current sources; • europeanresistors: uses rectangular empty shape for resistors, as per eu-ropean standards; • americanresistors: uses zig-zag shape for resistors, as per american stan-dards; • europeaninductors: uses rectangular filled shape for inductors, as per eu-ropean standards; • americaninductors: uses ”4-bumps” shape for inductors, as per american standards; • cuteinductors: uses my personal favorite, ”pig-tailed” shape for inductors; • americanports: uses triangular logic ports, as per american standards; • europeanports: uses rectangular logic ports, as per european standards; • european: equivalent to europeancurrents, europeanvoltages, europeanresistors, europeaninductors, europeanports; • american: equivalent to americancurrents, americanvoltages, americanresistors, americaninductors, americanports; • siunitx: integrates with SIunitx package. If labels, currents or voltages are of the form #1#2 then what is shown is actually SI{#1}{#2}; • nosiunitx: labels are not interpreted as above; • fulldiodes: the various diodes are drawn and filled by default, i.e. when using styles such as diode, D, sD, …Un-filled diode can always be forced with Do, sDo, … • emptydiodes: the various diodes are drawn but not filled by default, i.e. when using styles such as diode, D, sD, …Filled diode can always be forced with D*, sD*, … 5
  • 6. • arrowmos: pmos and nmos have arrows analogous to those of pnp and npn transistors; • noarrowmos: pmos and nmos do not have arrows analogous to those of pnp and npn transistors; • straighlabels: labels on bipoles are always printed straigh up, i.e. with horizontal baseline; • rotatelabels: labels on bipoles are always printed aligned along the bipole; • smartlabels: labels on bipoles are rotated along the bipoles, unless the rotation is very close to multiples of 90°. The old options in the singular (like american voltage) are still available for compatibility, but are discouraged. Loading the package with no options is equivalent to my own personal liking, that is to the following options: [europeancurrents, europeanvoltages, americanresistors, cuteinductors, americanports, nosiunitx, noarrowmos, smartlabels]. In ConTEXt the options are similarly specified: current=european|american, voltage=european|american, resistor=american|european, inductor=cute|american|european, logic=american|european, siunitx=true|false, arrowmos=false|true. 3 The components Here follows the list of all the shapes defined by CircuiTikZ. These are all pgf nodes, so they are usable in both pgf and TikZ. Each bipole (plus triac and thyristors) are shown using the following command, where #1 is the name of the component2: begin{center}begin{circuitikz} draw (0,0) to[ #1 ] (2,0) ; end{circuitikz} end{center} The other shapes are shown with: begin{center}begin{circuitikz} draw (0,0) node[ #1 ] {} ; end{circuitikz} end{center} Please notice that for user convenience transistors can also be inputted using the syntax for bipoles. See section 5.2. If using the tikzexternalize feature, as of Tikz 2.1 all pictures must end with end{tikzpicture}. Thus you cannot use the circuitikz environment. Which is ok: just use tikzpicture: everything will work there just fine. 2 If #1 is the name of the bipole/the style, then the actual name of the shape is #1shape. 6
  • 7. 3.1 Monopoles • Ground (ground) • Reference ground (rground) • Signal ground (sground) • Noiseless ground (nground) • Protective ground (pground) • Chassis ground3 (cground) • Antenna (antenna) • Transmitting antenna (rxantenna) 3 These last three were contributed by Luigi «Liverpool») 7
  • 8. • Receiving antenna (txantenna) • Transmission line stub (tlinestub) 3.2 Bipoles 3.2.1 Instruments • Ammeter (ammeter) A • Voltmeter (voltmeter) V 3.2.2 Basic resistive bipoles • Short circuit (short) • Open circuit (open) • Lamp (lamp) • Generic (symmetric) bipole (generic) • Tunable generic bipole (tgeneric) 8
  • 9. • Generic asymmetric bipole (ageneric) • Generic asymmetric bipole (full) (fullgeneric) • Tunable generic bipole (full) (tfullgeneric) • Memristor (memristor, or Mr) 3.2.3 Resistors and the like If (default behaviour) americanresistors option is active (or the style [american resistors] is used), the resistor is displayed as follows: • Resistor (R, or american resistor) • Variable resistor (vR, or american variable resistor) • Potentiometer (pR, or american potentiometer) If instead europeanresistors option is active (or the style [european resistors] is used), the resistors, variable resistors and potentiometers are displayed as follows: • Resistor (R, or european resistor) 9
  • 10. • Variable resistor (vR, or european variable resistor) • Potentiometer (pR, or european potentiometer) Other miscellaneous resistor-like devices: • Varistor (varistor) U • Photoresistor (phR, or photoresistor) • Thermocouple (thermocouple) • Thermistor (thR, or thermistor) • PTC thermistor (thRp, or thermistor ptc) # • NTC thermistor (thRn, or thermistor ntc) # • Fuse (fuse) • Asymmetric fuse (afuse, or asymmetric fuse) 10
  • 11. 3.2.4 Stationary sources • Battery (battery) • Single battery cell (battery1) • Voltage source (european style) (european voltage source) • Voltage source (american style) (american voltage source) + • Current source (european style) (european current source) • Current source (american style) (american current source) If (default behaviour) europeancurrents option is active (or the style [european currents] is used), the shorthands current source, isource, and I are equivalent to european current source. Otherwise, if americancurrents option is active (or the style [american currents] is used) they are equivalent to american current source. Similarly, if (default behaviour) europeanvoltages option is active (or the style [european voltages] is used), the shorthands voltage source, vsource, and V are equivalent to european voltage source. Otherwise, if americanvoltages option is active (or the style [american voltages] is used) they are equivalent to american voltage source. 11
  • 12. 3.2.5 Diodes and such • Empty diode (empty diode, or Do) • Empty Schottky diode (empty Schottky diode, or sDo) • Empty Zener diode (empty Zener diode, or zDo) • Empty tunnel diode (empty tunnel diode, or tDo) • Empty photodiode (empty photodiode, or pDo) • Empty led (empty led, or leDo) • Empty varcap (empty varcap, or VCo) • Full diode (full diode, or D*) • Full Schottky diode (full Schottky diode, or sD*) • Full Zener diode (full Zener diode, or zD*) 12
  • 13. • Full tunnel diode (full tunnel diode, or tD*) • Full photodiode (full photodiode, or pD*) • Full led (full led, or leD*) • Full varcap (full varcap, or VC*) The options fulldiodes and emptydiodes (and the styles [full diodes] and [empty diodes]) define which shape will be used by abbreviated com-mands such that D, sD, zD, tD, pD, leD, and VC. • Squid (squid) • Barrier (barrier) 3.2.6 Basic dynamical bipoles • Capacitor (capacitor, or C) • Polar capacitor (polar capacitor, or pC) 13
  • 14. • Variable capacitor (variable capacitor, or vC) If (default behaviour) cuteinductors option is active (or the style [cute inductors] is used), the inductors are displayed as follows: • Inductor (L, or cute inductor) • Variable inductor (vL, or variable cute inductor) If americaninductors option is active (or the style [american inductors] is used), the inductors are displayed as follows: • Inductor (L, or american inductor) • Variable inductor (vL, or variable american inductor) Finally, if europeaninductors option is active (or the style [european inductors] is used), the inductors are displayed as follows: • Inductor (L, or european inductor) • Variable inductor (vL, or variable european inductor) There is also a transmission line: • Transmission line (TL, or transmission line, tline) 14
  • 15. 3.2.7 Sinusoidal sources Here because I was asked for them. But how do you distinguish one from the other?! • Sinusoidal voltage source (sinusoidal voltage source, or vsourcesin, sV) • Sinusoidal current source (sinusoidal current source, or isourcesin, sI) 3.2.8 Square sources • Square voltage source (square voltage source, or vsourcesquare, sqV) 3.2.9 Switch • Closing switch (closing switch, or cspst) • Opening switch (opening switch, or ospst) • Push button (push button) 3.3 Tripoles 3.3.1 Controlled sources Admittedly, graphically they are bipoles. But I couldn’t… • Controlled voltage source (european style) (european controlled voltage source) 15
  • 16. • Controlled voltage source (american style) (american controlled voltage source) + • Controlled current source (european style) (european controlled current source) • Controlled current source (american style) (american controlled current source) If (default behaviour) europeancurrents option is active (or the style [european currents] is used), the shorthands controlled current source, cisource, and cI are equivalent to european controlled current source. Otherwise, if americancurrents option is active (or the style [american currents] is used) they are equivalent to american controlled current source. Similarly, if (default behaviour) europeanvoltages option is active (or the style [european voltages] is used), the shorthands controlled voltage source, cvsource, and cV are equivalent to european controlled voltage source. Otherwise, if americanvoltages option is active (or the style [american voltages] is used) they are equivalent to american controlled voltage source. • Controlled sinusoidal voltage source (controlled sinusoidal voltage source, or controlled vsourcesin, cvsourcesin, csV) • Controlled sinusoidal current source (controlled sinusoidal current source, or controlled isourcesin, cisourcesin, csI) 16
  • 17. 3.3.2 Transistors • nmos (nmos) • pmos (pmos) • npn (npn) • pnp (pnp) • npigbt (nigbt) • pigbt (pigbt) If the option arrowmos is used (or after the commant ctikzset{tripoles/mos style/arrows} is given), this is the output: • nmos (nmos) 17
  • 18. • pmos (pmos) nfets and pfets have been incorporated based on code provided by Clemens Helfmeier and Theodor Borsche: • nfet (nfet) • nigfete (nigfete) • nigfetd (nigfetd) • pfet (pfet) • pigfete (pigfete) 18
  • 19. • pigfetd (pigfetd) njfet and pjfet have been incorporated based on code provided by Danilo Piazza-lunga: • njfet (njfet) • pjfet (pjfet) isfet • isfet (isfet) 3.3.3 Switch • spdt (spdt) • Toggle switch (toggle switch) 19
  • 20. 3.3.4 Other bipole-like tripoles The following tripoles are entered with the usual command of the form • triac (triac, or Tr) • thyristor (thyristor, or Ty) 3.3.5 Misc • Mixer (mixer) 3.4 Double bipoles Transformers automatically use the inductor shape currently selected. These are the three possibilities: • Transformer (cute inductor) (transformer) • Transformer (american inductor) (transformer) • Transformer (european inductor) (transformer) 20
  • 21. Transformers with core are also available: • Transformer core (cute inductor) (transformer core) • Transformer core (american inductor) (transformer core) • Transformer core (european inductor) (transformer core) • Gyrator (gyrator) 3.5 Logic gates • American and port (american and port) • American or port (american or port) 21
  • 22. • American not port (american not port) • American nand port (american nand port) • American nor port (american nor port) • American xor port (american xor port) • American xnor port (american xnor port) • European and port (european and port) • European or port (european or port) 1 • European not port (european not port) 1 • European nand port (european nand port) 22
  • 23. • European nor port (european nor port) 1 • European xor port (european xor port) = 1 • European xnor port (european xnor port) = 1 If (default behaviour) americanports option is active (or the style [american ports] is used), the shorthands and port, or port, not port, nand port, not port, xor port, and xnor port are equivalent to the ameri-can version of the respective logic port. If otherwise europeanports option is active (or the style [european ports] is used), the shorthands and port, or port, not port, nand port, not port, xor port, and xnor port are equivalent to the european version of the respective logic port. 3.6 Amplifiers • Operational amplifier (op amp) + • Fully differential operational amplifier4 (fd op amp) + + 4 Contributed by Kristofer M. Monisit. 23
  • 24. • Plain amplifier (plain amp) • Buffer (buffer) 3.7 Support shapes • Arrows (current and voltage) (currarrow) • Connected terminal (circ) • Unconnected terminal (ocirc) 4 Usage R1 1 begin{ circuitikz } 2 draw (0,0) to [R, l =$R_1$] (2,0); 3 end{ circuitikz } R1 1 begin{ circuitikz } 2 draw (0,0) to [R=$R_1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i =$i _1$] (2,0); 3 end{ circuitikz } v1 1 begin{ circuitikz } 2 draw (0,0) to [R, v=$v_1$] (2,0); 3 end{ circuitikz } R1 v1 i1 1 begin{ circuitikz } 2 draw (0,0) to [R=$R_1$, i =$i _1$, v=$v_1$] (2,0); 3 end{ circuitikz } 24
  • 25. R1 v1 i1 1 begin{ circuitikz } 2 draw (0,0) to [R=$R_1$, i =$i _1$, v=$v_1$] (2,0); 3 end{ circuitikz } Long names/styles for the bipoles can be used: 1 kΩ 1 begin{ circuitikz }draw 2 (0,0) to [ resistor =1 kilo ohm] (2,0) 3 ; end{ circuitikz } 4.1 Labels R1 1 begin{ circuitikz } 2 draw (0,0) to [R, l ^=$R_1$] (2,0); 3 end{ circuitikz } R1 1 begin{ circuitikz } 2 draw (0,0) to [R, l _=$R_1$] (2,0); 3 end{ circuitikz } The default orientation of labels is controlled by the options smartlabels, rotatelabels and straightlabels (or the corresponding label/align keys). Here are examples to see the differences: 0 90 45 135 180 -90 -45 -135 1 begin{ circuitikz } 2 ctikzset { label /align = straight } 3 defDIR{0,45,90,135,180,90,45,135} 4 foreach i in DIR { 5 draw (0,0) to [R=i , *o] ( i :2.5); 6 } 7 end{ circuitikz } 0 45 90 135 180 -90 -45 -135 1 begin{ circuitikz } 2 ctikzset { label /align = rotate } 3 defDIR{0,45,90,135,180,90,45,135} 4 foreach i in DIR { 5 draw (0,0) to [R=i , *o] ( i :2.5); 6 } 7 end{ circuitikz } 25
  • 26. 0 45 90 135 180 -90 -45 -135 1 begin{ circuitikz } 2 ctikzset { label /align = smart} 3 defDIR{0,45,90,135,180,90,45,135} 4 foreach i in DIR { 5 draw (0,0) to [R=i , *o] ( i :2.5); 6 } 7 end{ circuitikz } 4.2 Currents i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i ^=$i_1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i _=$i _1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i ^=$i_1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i _=$i _1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i ^=$i_1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i _=$i _1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i ^=$i_1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i _=$i _1$] (2,0); 3 end{ circuitikz } Also i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i =$i _1$] (2,0); 3 end{ circuitikz } 26
  • 27. i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i =$i _1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i ^=$i_1$] (2,0); 3 end{ circuitikz } i1 1 begin{ circuitikz } 2 draw (0,0) to [R, i _=$i_1$] (2,0); 3 end{ circuitikz } 4.3 Voltages 4.3.1 European style The default, with arrows. Use option europeanvoltage or style [european voltages]. v1 1 begin{ circuitikz }[ european voltages] 2 draw (0,0) to [R, v^=$v_1$] (2,0); 3 end{ circuitikz } v1 1 begin{ circuitikz }[ european voltages] 2 draw (0,0) to [R, v^=$v_1$] (2,0); 3 end{ circuitikz } v1 1 begin{ circuitikz }[ european voltages] 2 draw (0,0) to [R, v_=$v_1$] (2,0); 3 end{ circuitikz } v1 1 begin{ circuitikz }[ european voltages] 2 draw (0,0) to [R, v_=$v_1$] (2,0); 3 end{ circuitikz } 4.3.2 American style For those who like it (not me). Use option americanvoltage or set [american voltages]. v1 + 1 begin{ circuitikz }[ american voltages] 2 draw (0,0) to [R, v^=$v_1$] (2,0); 3 end{ circuitikz } + v1 1 begin{ circuitikz }[ american voltages] 2 draw (0,0) to [R, v^=$v_1$] (2,0); 3 end{ circuitikz } v + 1 1 begin{ circuitikz }[ american voltages] 2 draw (0,0) to [R, v_=$v_1$] (2,0); 3 end{ circuitikz } + v 1 1 begin{ circuitikz }[ american voltages] 2 draw (0,0) to [R, v_=$v_1$] (2,0); 3 end{ circuitikz } 27
  • 28. 4.4 Nodes 1 begin{ circuitikz } 2 draw (0,0) to [R, oo] (2,0); 3 end{ circuitikz } 1 begin{ circuitikz } 2 draw (0,0) to [R, o] (2,0); 3 end{ circuitikz } 1 begin{ circuitikz } 2 draw (0,0) to [R, o] (2,0); 3 end{ circuitikz } 1 begin{ circuitikz } 2 draw (0,0) to [R, **] (2,0); 3 end{ circuitikz } 1 begin{ circuitikz } 2 draw (0,0) to [R, *] (2,0); 3 end{ circuitikz } 1 begin{ circuitikz } 2 draw (0,0) to [R, *] (2,0); 3 end{ circuitikz } 1 begin{ circuitikz } 2 draw (0,0) to [R, o*] (2,0); 3 end{ circuitikz } 1 begin{ circuitikz } 2 draw (0,0) to [R, *o] (2,0); 3 end{ circuitikz } 4.5 Special components For some components label, current and voltage behave as one would expect: a1 1 begin{ circuitikz } 2 draw (0,0) to [ I=$a_1$] (2,0); 3 end{ circuitikz } a1 1 begin{ circuitikz } 2 draw (0,0) to [ I , i =$a_1$] (2,0); 3 end{ circuitikz } k a1 1 begin{ circuitikz } 2 draw (0,0) to [ cI=$kcdot a_1$] (2,0); 3 end{ circuitikz } 28
  • 29. a1 1 begin{ circuitikz } 2 draw (0,0) to [ sI =$a_1$] (2,0); 3 end{ circuitikz } k a1 1 begin{ circuitikz } 2 draw (0,0) to [ csI =$kcdot a_1$] (2,0); 3 end{ circuitikz } The following results from using the option americancurrent or using the style [american currents]. a1 1 begin{ circuitikz }[ american currents] 2 draw (0,0) to [ I=$a_1$] (2,0); 3 end{ circuitikz } a1 1 begin{ circuitikz }[ american currents] 2 draw (0,0) to [ I , i =$a_1$] (2,0); 3 end{ circuitikz } k a1 1 begin{ circuitikz }[ american currents] 2 draw (0,0) to [ cI=$kcdot a_1$] (2,0); 3 end{ circuitikz } a1 1 begin{ circuitikz }[ american currents] 2 draw (0,0) to [ sI =$a_1$] (2,0); 3 end{ circuitikz } k a1 1 begin{ circuitikz }[ american currents] 2 draw (0,0) to [ csI =$kcdot a_1$] (2,0); 3 end{ circuitikz } The same holds for voltage sources: a1 1 begin{ circuitikz } 2 draw (0,0) to [V=$a_1$] (2,0); 3 end{ circuitikz } a1 1 begin{ circuitikz } 2 draw (0,0) to [V, v=$a_1$] (2,0); 3 end{ circuitikz } k a1 1 begin{ circuitikz } 2 draw (0,0) to [cV=$kcdot a_1$] (2,0); 3 end{ circuitikz } 29
  • 30. a1 1 begin{ circuitikz } 2 draw (0,0) to [sV=$a_1$] (2,0); 3 end{ circuitikz } k a1 1 begin{ circuitikz } 2 draw (0,0) to [csV=$kcdot a_1$] (2,0); 3 end{ circuitikz } The following results from using the option americanvoltage or the style [american voltages]. a1 1 begin{ circuitikz }[ american voltages] + 2 draw (0,0) to [V=$a_1$] (2,0); 3 end{ circuitikz } a1 1 begin{ circuitikz }[ american voltages] + 2 draw (0,0) to [V, v=$a_1$] (2,0); 3 end{ circuitikz } k a1 1 begin{ circuitikz }[ american voltages] + 2 draw (0,0) to [cV=$kcdot a_1$] (2,0); 3 end{ circuitikz } a1 1 begin{ circuitikz }[ american voltages] 2 draw (0,0) to [sV=$a_1$] (2,0); 3 end{ circuitikz } k a1 1 begin{ circuitikz }[ american voltages] 2 draw (0,0) to [csV=$kcdot a_1$] (2,0); 3 end{ circuitikz } 4.6 Integration with siunitx If the option siunitx is active (and not in ConTEXt), then the following are equivalent: 1 kΩ 1 begin{ circuitikz } 2 draw (0,0) to [R, l =1 kilo ohm] (2,0); 3 end{ circuitikz } 1 kΩ 1 begin{ circuitikz } 2 draw (0,0) to [R, l =$SI {1}{ kilo ohm}$] (2,0); 3 end{ circuitikz } 1 mA 1 begin{ circuitikz } 2 draw (0,0) to [R, i =1 milli ampere] (2,0); 3 end{ circuitikz } 30
  • 31. 1 mA 1 begin{ circuitikz } 2 draw (0,0) to [R, i =$SI {1}{ milli ampere}$] (2,0); 3 end{ circuitikz } 1 V 1 begin{ circuitikz } 2 draw (0,0) to [R, v=1volt ] (2,0); 3 end{ circuitikz } 1 V 1 begin{ circuitikz } 2 draw (0,0) to [R, v=$SI {1}{ volt }$] (2,0); 3 end{ circuitikz } 4.7 Mirroring 1 begin{ circuitikz } 2 draw (0,0) to [pD] (2,0); 3 end{ circuitikz } 1 begin{ circuitikz } 2 draw (0,0) to [pD, mirror] (2,0); 3 end{ circuitikz } At the moment, placing labels and currents on mirrored bipoles works: T 1 begin{ circuitikz } 2 draw (0,0) to [ ospst=T] (2,0); 3 end{ circuitikz } T i1 1 begin{ circuitikz } 2 draw (0,0) to [ ospst=T, mirror, i =$i _1$] (2,0); 3 end{ circuitikz } But voltages don’t: v 1 begin{ circuitikz } T 2 draw (0,0) to [ ospst=T, mirror, v=v] (2,0); 3 end{ circuitikz } Sorry about that. 4.8 Putting them together 1 kΩ 1 mA 1 begin{ circuitikz } 2 draw (0,0) to [R=1kiloohm, 3 i _=1 milli ampere, o*] (3,0); 4 end{ circuitikz } vD 1 mA 1 begin{ circuitikz } 2 draw (0,0) to [D*, v=$v_D$, 3 i =1 milli ampere, o*] (3,0); 4 end{ circuitikz } 31
  • 32. 5 Not only bipoles Since only bipoles (but see section 5.2) can be placed ”along a line”, components with more than two terminals are placed as nodes: 1 tikz node[npn] at (0,0) {}; 5.1 Anchors In order to allow connections with other components, all components define anchors. 5.1.1 Logical ports All logical ports, except not, have two inputs and one output. They are called respectively in 1, in 2, out: 1 2 3 1 begin{ circuitikz } draw 2 (0,0) node[and port] (myand) {} 3 (myand.in 1) node[anchor=east] {1} 4 (myand.in 2) node[anchor=east] {2} 5 (myand.out) node[anchor=west] {3} 6 ; end{ circuitikz } 1 begin{ circuitikz } draw 2 (0,2) node[and port] (myand1) {} 3 (0,0) node[and port] (myand2) {} 4 (2,1) node[xnor port] (myxnor) {} 5 (myand1.out) | (myxnor.in 1) 6 (myand2.out) | (myxnor.in 2) 7 ; end{ circuitikz } In the case of not, there are only in and out (although for compatibility reasons in 1 is still defined and equal to in): 1 begin{ circuitikz } draw 2 (1,0) node[not port] (not1) {} 3 (3,0) node[not port] (not2) {} 4 (0,0) (not1.in) 5 (not2.in ) (not1.out) 6 ++(0,1) node[ground] {} to [C] (not1.out) 7 (not2.out) | (4,1) | (0,0) 8 ; end{ circuitikz } 5.1.2 Transistors For nmos, pmos, nfet, nigfete, nigfetd, pfet, pigfete, and pigfetd transistors one has base, gate, source and drain anchors (which can be abbreviated with B, G, S and D): 32
  • 33. G B D S 1 begin{ circuitikz } draw 2 (0,0) node[nmos] (mos) {} 3 (mos.base) node[anchor=west] {B} 4 (mos.gate) node[anchor=east] {G} 5 (mos.drain) node[anchor=south] {D} 6 (mos.source) node[anchor=north] {S} 7 ; end{ circuitikz } B G D S 1 begin{ circuitikz } draw 2 (0,0) node[pigfete ] ( pigfete ) {} 3 ( pigfete . B) node[anchor=west] {B} 4 ( pigfete . G) node[anchor=east] {G} 5 ( pigfete . D) node[anchor=south] {D} 6 ( pigfete . S) node[anchor=north] {S} 7 ; end{ circuitikz } Similarly njfet and pjfet have gate, source and drain anchors (which can be abbreviated with G, S and D): G S 1 begin{ circuitikz } draw D 2 (0,0) node[pjfet ] ( pjfet ) {} 3 ( pjfet . G) node[anchor=east] {G} 4 ( pjfet . D) node[anchor=north] {D} 5 ( pjfet . S) node[anchor=south] {S} 6 ; end{ circuitikz } For npn, pnp, nigbt, and pigbt transistors the anchors are base, emitter and collector anchors (which can be abbreviated with B, E and C): B C E 1 begin{ circuitikz } draw 2 (0,0) node[npn] (npn) {} 3 (npn.base) node[anchor=east] {B} 4 (npn. collector ) node[anchor=south] {C} 5 (npn.emitter) node[anchor=north] {E} 6 ; end{ circuitikz } B E 1 begin{ circuitikz } draw C 2 (0,0) node[pigbt] ( pigbt ) {} 3 ( pigbt . B) node[anchor=east] {B} 4 ( pigbt . C) node[anchor=north] {C} 5 ( pigbt . E) node[anchor=south] {E} 6 ; end{ circuitikz } Here is one composite example (please notice that the xscale=-1 style would also reflect the label of the transistors, so here a new node is added and its text is used, instead of that of pnp1): 33
  • 34. 2 1 1 begin{ circuitikz } draw 2 (0,0) node[pnp] (pnp2) {2} 3 (pnp2.B) node[pnp, xscale=1, anchor=B] (pnp1) {} 4 (pnp1) node {1} 5 (pnp1.C) node[npn, anchor=C] (npn1) {} 6 (pnp2.C) node[npn, xscale=1, anchor=C] (npn2) {} 7 (pnp1.E) (pnp2.E) (npn1.E) (npn2.E) 8 (pnp1.B) node[circ ] {} | (pnp2.C) node[circ ] {} 9 ; end{ circuitikz } Similarly, transistors and other components can be reflected vertically: B G S D 1 begin{ circuitikz } draw 2 (0,0) node[pigfete , yscale=1] ( pigfete ) {} 3 ( pigfete . B) node[anchor=west] {B} 4 ( pigfete . G) node[anchor=east] {G} 5 ( pigfete . D) node[anchor=north] {D} 6 ( pigfete . S) node[anchor=south] {S} 7 ; end{ circuitikz } R1 1 begin{ circuitikz } 2 draw (0,2) 3 node[rground, yscale=1] {} 4 to [R=$R_1$] (0,0) 5 node[sground] {}; 6 end{ circuitikz } 5.1.3 Other tripoles When inserting a thrystor, a triac or a potentiometer, one needs to refer to the third node—gate (gate or G) for the former two; wiper (wiper or W) for the latter one. This is done by giving a name to the bipole: 1 begin{ circuitikz } draw 2 (0,0) to [Tr, n=TRI] (2,0) 3 to [pR, n=POT] (4,0); 4 draw[dashed] (TRI.G) | (POT.wiper) 5 ; end{ circuitikz } As for the switches: in out 1 out 2 1 begin{ circuitikz } draw 2 (0,0) node[spdt] (Sw) {} 3 (Sw.in) node[ left ] {in } 4 (Sw.out 1) node[right] {out 1} 5 (Sw.out 2) node[right] {out 2} 6 ; end{ circuitikz } 34
  • 35. 1 begin{ circuitikz } draw 2 (0,0) to [C] (1,0) to [ toggle switch , n=Sw] (2.5,0) 3 (2.5,1) to [ battery 1] (1.5,1) to [R] (0,1) | (0,0) 4 (Sw.out 2) | (2.5, 1) to [R] (0,1) (0,0) 5 ; end{ circuitikz } And the mixer: in 1 in 2 out 1 begin{ circuitikz } draw 2 (0,0) node[mixer] (mix) {} 3 (mix.in 1) node[ left ] {in 1} 4 (mix.in 2) node[below] {in 2} 5 (mix.out) node[right] {out} 6 ; end{ circuitikz } 5.1.4 Operational amplifier The op amp defines the inverting input (-), the non-inverting input (+) and the output (out) anchors: v v+ + vo 1 begin{ circuitikz } draw 2 (0,0) node[op amp] (opamp) {} 3 (opamp.+) node[ left ] {$v_+$} 4 (opamp.) node[left] {$v_$} 5 (opamp.out) node[right] {$v_o$} 6 ; end{ circuitikz } There are also two more anchors defined, up and down, for the power supplies: v v+ + vo 12 V 1 begin{ circuitikz } draw 2 (0,0) node[op amp] (opamp) {} 3 (opamp.+) node[ left ] {$v_+$} 4 (opamp.) node[left] {$v_$} 5 (opamp.out) node[right] {$v_o$} 6 (opamp.down) node[ground] {} 7 (opamp.up) ++ (0,.5) node[above] { SI {12}{ volt }} 8 (opamp.up) 9 ; end{ circuitikz } The fully differential op amp defines two outputs: v out + + + v+ out - 1 begin{ circuitikz } draw 2 (0,0) node[fd op amp] (opamp) {} 3 (opamp.+) node[ left ] {$v_+$} 4 (opamp.) node[left] {$v_$} 5 (opamp.out +) node[right] {out +} 6 (opamp.out ) node[right] {out } 7 (opamp.down) node[ground] {} 8 ; end{ circuitikz } 35
  • 36. 5.1.5 Double bipoles All the (few, actually) double bipoles/quadrupoles have the four anchors, two for each port. The first port, to the left, is port A, having the anchors A1 (up) and A2 (down); same for port B. They also expose the base anchor, for labelling: A1 A2 B1 B2 K 1 begin{ circuitikz } draw 2 (0,0) node[transformer] (T) {} 3 (T.A1) node[anchor=east] {A1} 4 (T.A2) node[anchor=east] {A2} 5 (T.B1) node[anchor=west] {B1} 6 (T.B2) node[anchor=west] {B2} 7 (T.base) node{K} 8 ; end{ circuitikz } A1 A2 B1 B2 K 1 begin{ circuitikz } draw 2 (0,0) node[gyrator] (G) {} 3 (G.A1) node[anchor=east] {A1} 4 (G.A2) node[anchor=east] {A2} 5 (G.B1) node[anchor=west] {B1} 6 (G.B2) node[anchor=west] {B2} 7 (G.base) node{K} 8 ; end{ circuitikz } 5.2 Transistor paths For syntactical convenience transistors can be placed using the normal path notation used for bipoles. The transitor type can be specified by simply adding a “T” (for transistor) in front of the node name of the transistor. It will be placed with the base/gate orthogonal to the direction of the path: 2 3 1 begin{ circuitikz } draw 1 2 (0,0) node[njfet ] {1} 3 (1,2) to [ Tnjfet =2] (1,2) 4 to [ Tnjfet =3, mirror] (3,2); 5 ; end{ circuitikz } Access to the gate and/or base nodes can be gained by naming the transistors with the n or name path style: 36
  • 37. 1 begin{ circuitikz } draw[yscale =1.1, xscale =.8] 2 (2,4.5) (0,4.5) to [Tpmos, n=p1] (0,3) 3 to [Tnmos, n=n1] (0,1.5) 4 to [Tnmos, n=n2] (0,0) node[ground] {} 5 (2,4.5) to [Tpmos,n=p2] (2,3) to [short , *] (0,3) 6 (p1.G) (n1.G) to[short , *o] ($( n1.G )+(3,0)$) 7 (n2.G) ++(2,0) node[circ ] {} | (p2.G) 8 (n2.G) to [short , o] ($( n2.G )+(3,0)$) 9 (0,3) to [short , o] (1,3) 10 ; end{ circuitikz } The name property is available also for bipoles, although this is useful mostly for triac, potentiometer and thyristor (see 3.3.4). 6 Customization 6.1 Parameters Pretty much all CircuiTikZ relies heavily on pgfkeys for value handling and con-figuration. Indeed, at the beginning of circuitikz.sty a series of key definitions can be found that modify all the graphical characteristics of the package. All can be varied using the ctikzset command, anywhere in the code. Shape of the components (on a per-component-class basis) 1 Ω 1 Ω 1 tikz draw (0,0) to [R=1ohm] (2,0); par 2 ctikzset { bipoles/ resistor /height =.6} 3 tikz draw (0,0) to [R=1ohm] (2,0); 1 tikz draw (0,0) node[nand port] {}; par 2 ctikzset { tripoles /american nand port/input height =.2} 3 ctikzset { tripoles /american nand port/port width=.2} 4 tikz draw (0,0) node[nand port] {}; Thickness of the lines (globally) 1 F 1 F 1 tikz draw (0,0) to [C=1farad] (2,0); par 2 ctikzset { bipoles/thickness=1} 3 tikz draw (0,0) to [C=1farad] (2,0); 37
  • 38. Global properties Of voltage and current 1 V 1 V 1 tikz draw (0,0) to [R, v=1volt ] (2,0); par 2 ctikzset { voltage/distance from node=.1} 3 tikz draw (0,0) to [R, v=1volt ] (2,0); { { 1 tikz draw (0,0) to [C, i =$imath$] (2,0); par 2 ctikzset {current/distance = .2} 3 tikz draw (0,0) to [C, i =$imath$] (2,0); However, you can override the properties voltage/distance from node5, voltage/bump b6 and voltage/european label distance7 on a per-component basis, in order to fine-tune the voltages: 1 V 2 V 1 V 2 V 1 tikz draw (0,0) to [R, v=1volt ] (1.5,0) 2 to [C, v=2volt ] (3,0); par 3 ctikzset { bipoles/capacitor/voltage/% 4 distance from node/. initial =.7} 5 tikz draw (0,0) to [R, v=1volt ] (1.5,0) 6 to [C, v=2volt ] (3,0); par Admittedly, not all graphical properties have understandable names, but for the time it will have to do: 1 tikz draw (0,0) node[xnor port] {}; 2 ctikzset { tripoles /american xnor port/aaa=.2} 3 ctikzset { tripoles /american xnor port/bbb=.6} 4 tikz draw (0,0) node[xnor port] {}; 6.2 Components size Perhaps the most important parameter is circuitikzbasekey/bipoles/length, which can be interpreted as the length of a resistor (including reasonable connec-tions): all other lenghts are relative to this value. For instance: 5 That is, how distant from the initial and final points of the path the arrow starts and ends. 6 Controlling how high the bump of the arrow is — how curved it is. 7 Controlling how distant from the bipole the voltage label will be. 38
  • 39. B 20 Ω 10 Ω vx S 5 Ω 5vx A 1 ctikzset { bipoles/length=1.4cm} 2 begin{ circuitikz }[ scale =1.2] draw 3 (0,0) node[anchor=east] {B} 4 to [short , o*] (1,0) 5 to [R=20ohm, **] (1,2) 6 to [R=10ohm, v=$v_x$] (3,2) (4,2) 7 to [ cI=$frac{ si {siemens}}{5} v_x$, **] (4,0) (3,0) 8 to [R=5ohm, **] (3,2) 9 (3,0) (1,0) 10 (1,2) to [short , o] (0,2) node[anchor=east]{A} 11 ; end{ circuitikz } B 20 Ω 10 Ω vx S 55 Ω vx A 1 ctikzset { bipoles/length=.8cm} 2 begin{ circuitikz }[ scale =1.2] draw 3 (0,0) node[anchor=east] {B} 4 to [short , o*] (1,0) 5 to [R=20ohm, **] (1,2) 6 to [R=10ohm, v=$v_x$] (3,2) (4,2) 7 to [ cI=$frac{siemens}{5} v_x$, **] (4,0) (3,0) 8 to [R=5ohm, **] (3,2) 9 (3,0) (1,0) 10 (1,2) to [short , o] (0,2) node[anchor=east]{A} 11 ; end{ circuitikz } 6.3 Colors The color of the components is stored in the key circuitikzbasekey/color. CircuiTikZ tries to follow the color set in TikZ, although sometimes it fails. If you change color in the picture, please do not use just the color name as a style, like [red], but rather assign the style [color=red]. Compare for instance 39
  • 40. 1 begin{ circuitikz } draw[red] 2 (0,2) node[and port] (myand1) {} 3 (0,0) node[and port] (myand2) {} 4 (2,1) node[xnor port] (myxnor) {} 5 (myand1.out) | (myxnor.in 1) 6 (myand2.out) | (myxnor.in 2) 7 ; end{ circuitikz } and 1 begin{ circuitikz } draw[color=red] 2 (0,2) node[and port] (myand1) {} 3 (0,0) node[and port] (myand2) {} 4 (2,1) node[xnor port] (myxnor) {} 5 (myand1.out) | (myxnor.in 1) 6 (myand2.out) | (myxnor.in 2) 7 ; end{ circuitikz } One can of course change the color in medias res: 1 begin{ circuitikz } draw 2 (0,0) node[pnp, color=blue] (pnp2) {} 3 (pnp2.B) node[pnp, xscale=1, anchor=B, color=brown] (pnp1) {} 4 (pnp1.C) node[npn, anchor=C, color=green] (npn1) {} 5 (pnp2.C) node[npn, xscale=1, anchor=C, color=magenta] (npn2) {} 6 (pnp1.E) (pnp2.E) (npn1.E) (npn2.E) 7 (pnp1.B) node[circ ] {} | (pnp2.C) node[circ ] {} 8 ; end{ circuitikz } The all-in-one stream of bipoles poses some challanges, as only the actual body of the bipole, and not the connecting lines, will be rendered in the specified color. Also, please notice the curly braces around the to: 1 V 1 Ω 1 F 1 begin{ circuitikz } draw 2 (0,0) to [V=1volt] (0,2) 3 { to [R=1ohm, color=red] (2,2) } 4 to [C=1farad] (2,0) (0,0) 5 ; end{ circuitikz } Which, for some bipoles, can be frustrating: 40
  • 41. 1 V 1 Ω 1 F 1 begin{ circuitikz } draw 2 (0,0){ to [V=1volt, color=red] (0,2) } 3 to [R=1ohm] (2,2) 4 to [C=1farad] (2,0) (0,0) 5 ; end{ circuitikz } The only way out is to specify different paths: 1 V 1 Ω 1 F 1 begin{ circuitikz } draw[color=red] 2 (0,0) to [V=1volt, color=red] (0,2); 3 draw (0,2) to [R=1ohm] (2,2) 4 to [C=1farad] (2,0) (0,0) 5 ; end{ circuitikz } And yes: this is a bug and not a feature… 7 FAQ Q: When using tikzexternalize I get the following error: ! Emergency stop. A: The TikZ manual states: Furthermore, the library assumes that all LATEX pictures are ended with end{tikzpicture}verb. Just substitute every occurrence of the environment circuitikz with tikzpicture. They are actually pretty much the same. Q: How do I draw the voltage between two nodes? A: Between any two nodes there is an open circuit! v 1 begin{ circuitikz } draw 2 node[ocirc] (A) at (0,0) {} 3 node[ocirc] (B) at (2,1) {} 4 (A) to [open, v=$v$] (B) 5 ; end{ circuitikz } Q: I cannot write to[R = $R_1=12V$] nor to[ospst = open, 3s]: I get errors. A: It is a limitation of the TikZ parser. Use to[R = $R_1{=}12V$] and to[ospst = open{,} 3s] instead. 41
  • 42. 8 Examples 10 μF 2:2 kΩ 12 mH i1 1 kΩ 0:3 kΩi1 1 mA 1 begin{ circuitikz }[ scale =1.4] draw 2 (0,0) to [C, l =10microfarad] (0,2) (0,3) 3 to [R, l =2.2 kilo ohm] (4,3) (4,2) 4 to [L , l =12 milli henry, i =$i _1$] (4,0) (0,0) 5 (4,2) { to [D*, **, color=red] (2,0) } 6 (0,2) to [R, l =1 kilo ohm, *] (2,2) 7 to [cV, v=$SI {.3}{ kilo ohm} i_1$] (4,2) 8 (2,0) to [ I , i =1 milli ampere, *] (2,2) 9 ; end{ circuitikz } 42
  • 43. e(t) 4 nF 0:25 kΩ 1 kΩ 2 nF a(t) 2 mH 1 2 3 1 begin{ circuitikz }[ scale =1.2] draw 2 (0,0) node[ground] {} 3 to [V=$e(t )$, **] (0,2) to [C=4nanofarad] (2,2) 4 to [R, l _=.25 kilo ohm, **] (2,0) 5 (2,2) to [R=1kiloohm] (4,2) 6 to [C, l _=2nanofarad, **] (4,0) 7 (5,0) to [ I , i _=$a(t )$, *] (5,2) (4,2) 8 (0,0) (5,0) 9 (0,2) (0,3) to [L , l =2 milli henry] (5,3) (5,2) 10 11 {[ anchor=south east] (0,2) node {1} (2,2) node {2} (4,2) node {3}} 12 ; end{ circuitikz } B 20 Ω 10 Ω vx S 5 Ω 5vx A 1 begin{ circuitikz }[ scale =1.2] draw 2 (0,0) node[anchor=east] {B} 3 to [short , o*] (1,0) 4 to [R=20ohm, **] (1,2) 5 to [R=10ohm, v=$v_x$] (3,2) (4,2) 6 to [ cI=$frac{siemens}{5} v_x$, **] (4,0) (3,0) 7 to [R=5ohm, **] (3,2) 8 (3,0) (1,0) 9 (1,2) to [short , o] (0,2) node[anchor=east]{A} 10 ; end{ circuitikz } 43
  • 44. 1 begin{ circuitikz }[ scale =1]draw 2 (0,0) node[transformer] (T) {} 3 (T.B2) to [pD] ($( T.B 2)+(2,0)$) | (3.5, 1) 4 (T.B1) to [pD] ($( T.B 1)+(2,0)$) | (3.5, 1) 5 ; end{ circuitikz } Cd1 Rd Rd Uwe + Cd2 Uwy 1 begin{ circuitikz }[ scale =1]draw 2 (5,.5) node [op amp] (opamp) {} 3 (0,0) node [ left ] {$U_{we}$} to [R, l =$R_d$, o*] (2,0) 4 to [R, l =$R_d$, **] (opamp.+) 5 to [C, l _=$C_{d2}$, *] ($( opamp.+)+(0,2)$) node [ground] {} 6 (opamp.out) | (3.5,2) to [C, l _=$C_{d1}$, *] (2,2) to [short] (2,0) 7 (opamp.) | (3.5,2) 8 (opamp.out) to [short , *o] (7,.5) node [ right ] {$U_{wy}$} 9 ; end{ circuitikz } 44
  • 45. 1 mA 2 kΩ 2 kΩ + 2 V t0 + v1 i1 + 4 V 1 kΩ v1/V i1/mA -2 2 4 -4 4 -3 1 begin{ circuitikz }[ scale =1.2, american]draw 2 (0,2) to [ I=1 milli ampere] (2,2) 3 to [R, l _=2kiloohm, **] (0,0) 4 to [R, l _=2kiloohm] (2,0) 5 to [V, v_=2volt ] (2,2) 6 to [ cspst , l =$t_0$] (4,2) (4,1.5) 7 to [generic , i =$i _1$, v=$v_1$] (4,.5) (4,1.5) 8 (0,2) (0,1.5) to [V, v_=4volt ] (2,1.5) 9 to [R, l =1 kilo ohm] (4,1.5); 10 11 begin{scope}[ xshift =6.5cm, yshift =.5 cm] 12 draw [] (2,0) (2.5,0) node[anchor=west] {$v_1/volt $}; 13 draw [] (0,2) (0,2) node[anchor=west] {$i_1/SI {}{ milli ampere}$} ; 14 draw (1,0) node[anchor=north] {2} (1,0) node[anchor=south] {2} 15 (0,1) node[anchor=west] {4} (0,1) node[anchor=east] {4} 16 (2,0) node[anchor=north west] {4} 17 (1.5,0) node[anchor=south east] {3}; 18 draw [thick ] (2,1) (1,1) (1,1) (2,0) (2.5,.5); 19 draw [dotted] (1,1) (1,0) (1,1) (1,0) 20 (1,1) (0,1) (1,1) (0,1); 21 end{scope} 22 end{ circuitikz } 9 Revision history version 0.3.0 (20121229) 1. fixed gate node for a few transistors 2. added mixer 3. added fully differential op amp (by Kristofer M. Monisit) 4. now general settings for the drawing of voltage can be overridden for specific components 45
  • 46. 5. made arrows more homogeneous (either the current/voltage one, or latex’ by pgf) 6. added the single battery cell 7. added fuse and asymmetric fuse 8. added toggle switch 9. added varistor, photoresistor, thermocouple, push button 10. added thermistor, thermistor ptc, thermistor ptc 11. fixed misalignment of voltage label in vertical bipoles with names 12. added isfet 13. added noiseless, protective, chassis, signal and reference grounds (Luigi Luigi «Liverpool») version 0.2.4 (20110911). 1. added square voltage source (contributed by Alistair Kwan) 2. added buffer and plain amplifier (contributed by Danilo Piazzalunga) 3. added squid and barrier (contributed by Cor Molenaar) 4. added antenna and transmission line symbols contributed by Leonardo Azzinnari 5. added the changeover switch spdt (suggestion of Fabio Maria Antoniali) 6. rename of context.tex and context.pdf (thanks to Karl Berry) 7. updated the email address 8. in documentation, fixed wrong (non-standard) labelling of the axis in an example (thanks to prof. Claudio Beccaria) 9. fixed scaling inconsistencies in quadrupoles 10. fixed division by zero error on certain vertical paths 11. introduced options straighlabels, rotatelabels, smartlabels version 0.2.3 (20091118). 1. fixed compatibility problem with label option from tikz 2. Fixed resizing problem for shape ground 3. Variable capacitor 4. polarized capacitor 5. ConTeXt support (read the manual!) 6. nfet, nigfete, nigfetd, pfet, pigfete, pigfetd (contribution of Clemens Helfmeier and Theodor Borsche) 7. njfet, pjfet (contribution of Danilo Piazzalunga) 8. pigbt, nigbt 9. backward incompatibility potentiometer is now the standard resistor-with-arrow- in-the-middle; the old potentiometer is now known as variable resistor (or vR), similarly to variable inductor and variable capacitor 10. triac, thyristor, memristor 46
  • 47. 11. new property ”name” for bipoles 12. fixed voltage problem for batteries in american voltage mode 13. european logic gates 14. backward incompatibility new american standard inductor. Old american inductor now called ”cute inductor” 15. backward incompatibility transformer now linked with the chosen type of inductor, and version with core, too. Similarly for variable inductor 16. backward incompatibility styles for selecting shape variants now end are in the plural to avoid conflict with paths 17. new placing option for some tripoles (mostly transistors) 18. mirror path style version 0.2.2 (20090520). 1. Added the shape for lamps. 2. Added options europeanresistor, europeaninductor, americanresistor and americaninductor, with corresponding styles. 3. Fixed: error in transistor arrow positioning and direction under negative xscale and yscale. version 0.2.1 (20090503). 1. Op-amps added. 2. Added options arrowmos and noarrowmos. version 0.2 First public release on CTAN (20090417). 1. Backward incompatibility: labels ending with :angle are not parsed for positioning anymore. 2. Full use of TikZ keyval features. 3. White background is not filled anymore: now the network can be drawn on a background picture as well. 4. Several new components added (logical ports, transistors, double bipoles, …). 5. Color support. 6. Integration with siunitx. 7. Voltage, american style. 8. Better code, perhaps. General cleanup at the very least. version 0.1 First public release (2007). 47
  • 48. Index of the components afuse, 10 ageneric, 9 american and port, 21 american controlled current source, 16 american controlled voltage source, 16 american current source, 11 american inductor, see L american nand port, 22 american nor port, 22 american not port, 22 american or port, 21 american potentiometer, see pR american resistor, see R american variable resistor, see vR american voltage source, 11 american xnor port, 22 american xor port, 22 ammeter, 8 antenna, 7 asymmetric fuse, see afuse barrier, 13 battery, 11 battery1, 11 buffer, 24 C, see capacitor capacitor, 13 cground, 7 circ, 24 cisourcesin, see controlled sinusoidal current source closing switch, 15 controlled isourcesin, see controlled sinusoidal current source controlled sinusoidal current source, 16 controlled sinusoidal voltage source, 16 controlled vsourcesin, see controlled sinusoidal voltage source csI, see controlled sinusoidal current source cspst, see closing switch csV, see controlled sinusoidal voltage source currarrow, 24 cute inductor, see L cvsourcesin, see controlled sinusoidal voltage source D*, see full diode Do, see empty diode empty diode, 12 empty led, 12 empty photodiode, 12 empty Schottky diode, 12 empty tunnel diode, 12 empty varcap, 12 empty Zener diode, 12 european and port, 22 european controlled current source, 16 european controlled voltage source, 15 european current source, 11 european inductor, see L european nand port, 22 european nor port, 23 european not port, 22 european or port, 22 european potentiometer, see pR european resistor, see R european variable resistor, see vR european voltage source, 11 european xnor port, 23 european xor port, 23 fd op amp, 23 full diode, 12 full led, 13 full photodiode, 13 full Schottky diode, 12 full tunnel diode, 13 full varcap, 13 full Zener diode, 12 fullgeneric, 9 fuse, 10 generic, 8 ground, 7 gyrator, 21 isfet, 19 48
  • 49. isourcesin, see sinusoidal current source L, 14 lamp, 8 leD*, see full led leDo, see empty led memristor, 9 mixer, 20 Mr, see memristor nfet, 18 nground, 7 nigbt, 17 nigfetd, 18 nigfete, 18 njfet, 19 nmos, 17 npn, 17 ocirc, 24 op amp, 23 open, 8 opening switch, 15 ospst, see opening switch pC, see polar capacitor pD*, see full photodiode pDo, see empty photodiode pfet, 18 pground, 7 photoresistor, see phR phR, 10 pigbt, 17 pigfetd, 19 pigfete, 18 pjfet, 19 plain amp, 24 pmos, 17, 18 pnp, 17 polar capacitor, 13 pR, 9, 10 push button, 15 R, 9 rground, 7 rxantenna, 7 sD*, see full Schottky diode sDo, see empty Schottky diode sground, 7 short, 8 sI, see sinusoidal current source sinusoidal current source, 15 sinusoidal voltage source, 15 spdt, 19 square voltage source, 15 squid, 13 sqV, see square voltage source sV, see sinusoidal voltage source tD*, see full tunnel diode tDo, see empty tunnel diode tfullgeneric, 9 tgeneric, 8 thermistor, see thR thermistor ntc, see thRn thermistor ptc, see thRp thermocouple, 10 thR, 10 thRn, 10 thRp, 10 thyristor, 20 TL, 14 tline, see TL tlinestub, 8 toggle switch, 19 Tr, see triac transformer, 20 transformer core, 21 transmission line, see TL triac, 20 txantenna, 8 Ty, see thyristor variable american inductor, see vL variable capacitor, 14 variable cute inductor, see vL variable european inductor, see vL varistor, 10 vC, see variable capacitor VC*, see full varcap VCo, see empty varcap vL, 14 voltmeter, 8 vR, 9, 10 vsourcesin, see sinusoidal voltage source vsourcesquare, see square voltage source zD*, see full Zener diode zDo, see empty Zener diode 49