diff options
author | Karl Berry <karl@freefriends.org> | 2009-04-18 16:42:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-04-18 16:42:44 +0000 |
commit | 9fbcb733dd11b3c8375ec9997391296abbc6d79d (patch) | |
tree | 7c139328d5c1b332a5a5311bebd0bf665d18b11c /Master/texmf-dist/doc/latex/circuitikz | |
parent | 6e3c22d01092e6a41b9147068d2719a44d5ac16f (diff) |
new pgf package circuitikz (17apr09)
git-svn-id: svn://tug.org/texlive/trunk@12745 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/circuitikz')
-rw-r--r-- | Master/texmf-dist/doc/latex/circuitikz/CHANGELOG | 15 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/circuitikz/README | 35 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf | bin | 0 -> 259777 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex | 1082 |
4 files changed, 1132 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/circuitikz/CHANGELOG b/Master/texmf-dist/doc/latex/circuitikz/CHANGELOG new file mode 100644 index 00000000000..fd3ead44653 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuitikz/CHANGELOG @@ -0,0 +1,15 @@ +CircuiTikz - Changelog + +* Version 0.2 - 20090417 +First public release on CTAN + - *Backward incompatibility*: labels ending with \texttt{:}\textit{angle} are not parsed for positioning anymore. + - Full use of \TikZ\ keyval features. + - White background is not filled anymore: now the network can be drawn on a background picture as well. + - Several new components added (logical ports, transistors, double bipoles, \ldots). + - Color support. + - Integration with {\ttfamily siunitx}. + - Voltage, american style. + - Better code, perhaps. General cleanup at the very least. + +* Version 0.1 - 2007-10-29 +First public release diff --git a/Master/texmf-dist/doc/latex/circuitikz/README b/Master/texmf-dist/doc/latex/circuitikz/README new file mode 100644 index 00000000000..78ee622c266 --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuitikz/README @@ -0,0 +1,35 @@ +This is CircuiTikz, version 0.2. + +This package provides a set of macros for naturally typesetting electrical and (somewhat 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. + +-------------- + +** Requirements +Tikz graphics library + + +** Installation +Unpack everything in a directory in the TeX search path and refresh the TeX db. + +** Usage +Just place + + \usepackage{circuitikz} + +in the preamble and compile away, both with PS and PDF target output. + +** Contact the author +mredaelli@elet.polimi.it + +------------- + +Copyright 2007-9 by Massimo Redaelli + +This file may be distributed and/or modified + +1. under the LaTeX Project Public License and/or +2. under the GNU Public License. diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf Binary files differnew file mode 100644 index 00000000000..a5c6bd193ea --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex new file mode 100644 index 00000000000..3a81f19564f --- /dev/null +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex @@ -0,0 +1,1082 @@ +\documentclass{article} + +\usepackage[siunitx]{circuitikz} +\usepackage{showexpl} +\usepackage{framed} +\usepackage{hyperref} +\hypersetup{ + bookmarks=false, % show bookmarks bar? + pdftitle={CircuitTikZ v. 2.0 - manual}, % title + pdfauthor={Massimo Redaelli}, % author + pdfsubject={CircuitTikZ manual}, % subject of the document + pdfkeywords={}, % list of keywords + colorlinks=true, % false: boxed links; true: colored links + linkcolor=black, % color of internal links + citecolor=black, % color of links to bibliography + filecolor=black, % color of file links + urlcolor=black % color of external links +} + +\def\circuititem#1#2#3{\item #2 (\texttt{#1}) \par \begin{center}\begin{circuitikz} \draw (0,0) node[#1] {}; \end{circuitikz} \end{center} +\par} + +\newcommand{\circuititembip}[3]{\item #2 (\texttt{#1}% +\ifthenelse{\equal{#3}{}}{% +}{% +, or \texttt{#3}% +}% +)\par \begin{center}\begin{circuitikz} \draw (0,0) to[#1] (2,0); \end{circuitikz} \end{center}\par} + +\begin{document} +\def\TikZ{Ti\emph{k}Z} +\lstset{frameround=fttt} +\lstloadlanguages{TeX} + +\title{Circui\TikZ \\{\large version 0.2}} +\author{Massimo A. Redaelli} +\date{\today} + +\maketitle + +\tableofcontents + +\section{Introduction} +After two years of little exposure only on my personal website\footnote{\url{http://home.dei.polimi.it/mredaelli}.}, I did a major rehauling of the code of Circui\TikZ, 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\ldots + +\medskip + +I know the documentation is somewhat scant. Hope to have time to improve it a bit. + +\subsection{About} +This package provides a set of macros for naturally typesetting electrical and (somewhat 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. + +\subsection{Loading the package} +\verb!\usepackage{circuitikz}! + +\TikZ\ will be automatically loaded. + +\subsection{License} +Copyright \copyright\ 2007--2009 Massimo Redaelli. This package is author-maintained. +Permission is granted to copy, distribute and/or modify this software under the +terms of the \LaTeX Project Public License, version 1.3.1, or the GNU Public License. This software 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. + +\subsection{Feedback} +Much appreciated: \href{mailto:mredaelli@elet.polimi.it}{\texttt{mredaelli@elet.polimi.it}}. Although I don't guarantee quick answers. + + +\subsection{Requirements} +\begin{itemize} + \item \texttt{tikz}, version $\ge 2$; + \item \texttt{xstring}; + \item \texttt{siunitx}, if using \texttt{siunitx} option. +\end{itemize} + +\subsection{Incompatible packages} + +None, as far as I know. + + + +\section{Options} + +\begin{itemize} + \item \texttt{europeanvoltage}: uses arrows to define voltages, and uses european-style voltage sources; + \item \texttt{americanvoltage}: uses $-$ and $+$ to define voltages, and uses american-style voltage sources; + \item \texttt{europeancurrent}: uses european-style current sources; + \item \texttt{americanvoltage}: uses american-style current sources; + \item \texttt{european}: equivalent to \texttt{europeancurrent} and \texttt{europeanvoltage}; + \item \texttt{american}: equivalent to \texttt{americancurrent} and \texttt{americanvoltage}; + \item \texttt{siunitx}: integrates with \texttt{SIunitx} package. If labels, currents or voltages are of the form \verb!#1<#2>! then what is shown is actually \verb!\SI{#1}{#2}!; + \item \texttt{nosiunitx}: labels are not interpreted as above; + \item \texttt{fulldiode}: the various diodes are drawn \emph{and} filled by default, i.e. when using styles such as \texttt{diode}, \texttt{D}, \texttt{sD}, \ldots Un-filled diode can always be forced with \texttt{Do}, \texttt{sDo}, \ldots + \item \texttt{emptydiode}: the various diodes are drawn \emph{but not} filled by default, i.e. when using styles such as \texttt{diode}, \texttt{D}, \texttt{sD}, \ldots Filled diode can always be forced with \texttt{D*}, \texttt{sD*}, \ldots +\end{itemize} + +\section{The components} + +Here follows the list of all the shapes defined by Circui\TikZ. These are all \texttt{pgf} nodes, so they are usable in both \texttt{pgf} and \TikZ. + +\medskip + +Each bipole is shown using the following command, where \verb!#1! is the name of the component\footnote{If \texttt{\#1} is the name of the bipole/the style, then the actual name of the shape is \texttt{\#1shape}.}: + +\begin{verbatim} +\begin{center}\begin{circuitikz} \draw + (0,0) to[ #1 ] (2,0) +; \end{circuitikz} \end{center} +\end{verbatim} + +The other shapes are shown with: +\begin{verbatim} +\begin{center}\begin{circuitikz} \draw + (0,0) node[ #1 ] {} +; \end{circuitikz} \end{center} +\end{verbatim} + +\subsection{Monopoles} +\begin{itemize} + \circuititem{ground}{Ground}{} +\end{itemize} + + +\subsection{Bipoles} + +\paragraph{Instruments} +\begin{itemize} + \circuititembip{ammeter}{Ammeter}{} + \circuititembip{voltmeter}{Voltmeter}{} +\end{itemize} + +\paragraph{Basic resistive bipoles} +\begin{itemize} + \circuititembip{short}{Short circuit}{} + \circuititembip{open}{Open circuit}{} + + \circuititembip{R}{Resistor}{resistor} + \circuititembip{pR}{Potentiometer}{potentiometer} + \circuititembip{generic}{Generic (symmetric) bipole}{} + \circuititembip{ageneric}{Generic asymmetric bipole}{} +\end{itemize} + +\paragraph{Stationary sources} +\begin{itemize} + \circuititembip{battery}{Battery}{} + \circuititembip{european voltage source}{Voltage source (european style)}{} + \circuititembip{american voltage source}{Voltage source (american style)}{} + \circuititembip{european current source}{Current source (european style)}{} + \circuititembip{american current source}{Current source (american style)}{} +\end{itemize} + +\begin{framed} +The options \texttt{europeancurrent} [resp. \texttt{europeanvoltage}] (the default) and \texttt{americancurrent} [resp. \texttt{americanvoltage}] define which current [resp. voltage] source is selected by default when the abbreviated styles \texttt{current source}, \texttt{csource}, \texttt{I} [resp. \texttt{voltage source}, \texttt{vsource}, \texttt{V}] are used. + +One can also use the related styles \texttt{[european current]} [resp. \texttt{[european voltage]}] and \texttt{[american current]} [resp. \texttt{[american voltage]}]. +\end{framed} + +\paragraph{Diodes and such} +\begin{itemize} + \circuititembip{empty diode}{Empty diode}{Do} + \circuititembip{empty Schottky diode}{Empty Schottky diode}{sDo} + \circuititembip{empty Zener diode}{Empty Zener diode}{zDo} + \circuititembip{empty tunnel diode}{Empty tunnel diode}{tDo} + \circuititembip{empty photodiode}{Empty photodiode}{pDo} + \circuititembip{empty led}{Empty led}{leDo} + \circuititembip{empty varcap}{Empty varcap}{VCo} + \circuititembip{full diode}{Full diode}{D*} + \circuititembip{full Schottky diode}{Full Schottky diode}{sD*} + \circuititembip{full Zener diode}{Full Zener diode}{zD*} + \circuititembip{full tunnel diode}{Full tunnel diode}{tD*} + \circuititembip{full photodiode}{Full photodiode}{pD*} + \circuititembip{full led}{Full led}{leD*} + \circuititembip{full varcap}{Full varcap}{VC*} + \end{itemize} + +\begin{framed} +The options \texttt{fulldiode} and \texttt{emptydiode} (and the styles \texttt{[full diode]} and \texttt{[full diode]}) define which shape will be used by abbreviated commands such that \texttt{D}, \texttt{sD}, \texttt{zD}, \texttt{tD}, \texttt{pD}, \texttt{leD}, and \texttt{VC}. +\end{framed} + +\paragraph{Basic dynamical bipoles} +\begin{itemize} + \circuititembip{capacitor}{Capacitor}{C} + \circuititembip{inductor}{Inductor}{L} +\end{itemize} + +\paragraph{Sinusoidal sources} Here because I was asked for them. But how do you distinguish one from the other?! +\begin{itemize} + \circuititembip{sinusoidal voltage source}{Sinusoidal voltage source}{vsourcesin, sV} + \circuititembip{sinusoidal current source}{Sinusoidal current source}{isourcesin, sI} +\end{itemize} + +%\begin{framed} +%The options \texttt{europeancurrent} [resp. \texttt{europeanvoltage}] (the default) and \texttt{americancurrent} [resp. \texttt{americanvoltage}] define which sinusoidal current [resp. voltage] source is selected by default when the abbreviated styles \texttt{sinusoidal current source}, \texttt{csourcesin}, \texttt{cI} [resp. \texttt{sinusoidal voltage source}, \texttt{vsourcesin}, \texttt{cV}] are used. + +%One can also use the related styles \texttt{[european current]} [resp. \texttt{[european voltage]}] and \texttt{[american current]} [resp. \texttt{[american voltage]}]. +%\end{framed} + +\paragraph{Switch} +\begin{itemize} + \circuititembip{closing switch}{Closing switch}{cspst} + \circuititembip{opening switch}{Opening switch}{ospst} +\end{itemize} + + + +\subsection{Tripoles} +\paragraph{Controlled sources} Admittedly, graphically they are bipoles. But I couldn't\ldots +\begin{itemize} + \circuititembip{european controlled voltage source}{Controlled voltage source (european style)}{} + \circuititembip{american controlled voltage source}{Controlled voltage source (american style)}{} + \circuititembip{european controlled current source}{Controlled current source (european style)}{} + \circuititembip{american controlled current source}{Controlled current source (american style)}{} +\end{itemize} + +\begin{framed} +The options \texttt{europeancurrent} [resp. \texttt{europeanvoltage}] (the default) and \texttt{americancurrent} [resp. \texttt{americanvoltage}] define which controlled current [resp. voltage] source is selected by default when the abbreviated styles are used. + +One can also use the related styles \texttt{[european current]} [resp. \texttt{[european voltage]}] and \texttt{[american current]} [resp. \texttt{[american voltage]}]. +\end{framed} + +\begin{itemize} + \circuititembip{controlled sinusoidal voltage source}{Controlled sinusoidal voltage source}{controlled vsourcesin, cvsourcesin, csV} + \circuititembip{controlled sinusoidal current source}{Controlled sinusoidal current source}{controlled isourcesin, cisourcesin, csI} + \end{itemize} + + + +\paragraph{Transistors} +\begin{itemize} + \circuititem{nmos}{nmos}{} + \circuititem{pmos}{pmos}{} + \circuititem{npn}{npn}{} + \circuititem{pnp}{pnp}{} +\end{itemize} + +\subsection{Double bipoles} + +\begin{itemize} + \circuititem{transformer}{Transformer}{} + \circuititem{gyrator}{Gyrator}{} +\end{itemize} + + + +\subsection{Logic gates} + +\begin{itemize} + \circuititem{and port}{AND port}{} + \circuititem{or port}{OR port}{} + \circuititem{not port}{NOT port}{} + \circuititem{nand port}{NAND port}{} + \circuititem{nor port}{NOR port}{} + \circuititem{xor port}{XOR port}{} + \circuititem{xnor port}{XNOR port}{} +\end{itemize} + + +\subsection{Support shapes} + +\begin{itemize} + \circuititem{currarrow}{Arrows (current and voltage)}{} + \circuititem{circ}{Connected terminal}{} + \circuititem{ocirc}{Unconnected terminal}{} +\end{itemize} + + + +\section{Usage} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, l=$R_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R=$R_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, v=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R=$R_1$, i=$i_1$, v=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R=$R_1$, i=$i_1$, v=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +Long names/styles for the bipoles can be used: +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}\draw + (0,0) to[resistor=1<\kilo\ohm>] (2,0) +;\end{circuitikz} +\end{LTXexample} + +\subsection{Labels} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, l^=$R_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, l_=$R_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + + + +\subsection{Currents} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i^>=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i_>=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i^<=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i_<=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i>^=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i>_=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i<^=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i<_=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +Also + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i<=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i>=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i^=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i_=$i_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + + +\subsection{Voltages} + +\paragraph{European style} The default, with arrows. Use option \texttt{europeanvoltage} or style \verb![european voltage]!. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[european voltage] + \draw (0,0) to[R, v^>=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[european voltage] + \draw (0,0) to[R, v^<=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[european voltage] + \draw (0,0) to[R, v_>=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[european voltage] + \draw (0,0) to[R, v_<=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\paragraph{American style} For those who like it (not me). Use option \texttt{americanvoltage} or set \verb![american voltage]!. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltage] + \draw (0,0) to[R, v^>=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltage] + \draw (0,0) to[R, v^<=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltage] + \draw (0,0) to[R, v_>=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltage] + \draw (0,0) to[R, v_<=$v_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + + +\subsection{Nodes} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, o-o] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, -o] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, o-] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, *-*] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, -*] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, *-] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, o-*] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, *-o] (2,0); +\end{circuitikz} +\end{LTXexample} + +\subsection{Special components} + +For some components label, current and voltage behave as one would expect: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[I=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[I, i=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[cI=$k\cdot a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[sI=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[csI=$k\cdot a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +The following results from using the option \texttt{americancurrent} or using the style \verb![american current]!. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american current] + \draw (0,0) to[I=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american current] + \draw (0,0) to[I, i=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american current] + \draw (0,0) to[cI=$k\cdot a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american current] + \draw (0,0) to[sI=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american current] + \draw (0,0) to[csI=$k\cdot a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +The same holds for voltage sources: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[V=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[V, v=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[cV=$k\cdot a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[sV=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[csV=$k\cdot a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +The following results from using the option \texttt{americanvoltage} or the style \verb![american voltage]!. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltage] + \draw (0,0) to[V=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltage] + \draw (0,0) to[V, v=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltage] + \draw (0,0) to[cV=$k\cdot a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltage] + \draw (0,0) to[sV=$a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltage] + \draw (0,0) to[csV=$k\cdot a_1$] (2,0); +\end{circuitikz} +\end{LTXexample} + + +\subsection{Integration with {\ttfamily siunitx}} + +If the option {\ttfamily siunitx} is active, then the following are equivalent: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, l=1<\kilo\ohm>] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, l=$\SI{1}{\kilo\ohm}$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i=1<\milli\ampere>] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, i=$\SI{1}{\milli\ampere}$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, v=1<\volt>] (2,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, v=$\SI{1}{\volt}$] (2,0); +\end{circuitikz} +\end{LTXexample} + +\subsection{Putting them together} +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R=1<\kilo\ohm>, + i>_=1<\milli\ampere>, o-*] (3,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[D*, v=$v_D$, + i=1<\milli\ampere>, o-*] (3,0); +\end{circuitikz} +\end{LTXexample} + +%} %comment + + +\section{Not only bipoles} + +Since only bipoles can be placed "along a line", components with more than two terminals are placed as nodes: +\begin{LTXexample}[varwidth=true] +\tikz \node[npn] at (0,0) {}; +\end{LTXexample} + +\subsection{Anchors} + +In order to allow connections with other components, all components define anchors. + +\paragraph{Logical ports} All logical ports, except NOT, have to inputs and one output. They are called respectively \texttt{in 1}, \texttt{in 2}, \texttt{out}: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) node[and port] (myand) {} + (myand.in 1) node[anchor=east] {1} + (myand.in 2) node[anchor=east] {2} + (myand.out) node[anchor=west] {3} +;\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,2) node[and port] (myand1) {} + (0,0) node[and port] (myand2) {} + (2,1) node[xnor port] (myxnor) {} + (myand1.out) -| (myxnor.in 1) + (myand2.out) -| (myxnor.in 2) +;\end{circuitikz} +\end{LTXexample} + +In the case of NOT, there are only \texttt{in} and \texttt{out}: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (1,0) node[not port] (not1) {} + (3,0) node[not port] (not2) {} + (0,0) -- (not1.in) + (not2.in) -- (not1.out) + ++(0,-1) node[ground] {} to[C] (not1.out) + (not2.out) -| (4,1) -| (0,0) +;\end{circuitikz} +\end{LTXexample} + +\paragraph{Transistors} For MOS transistors one has \texttt{base}, \texttt{gate}, \texttt{source} and \texttt{drain} anchors (which can be abbreviated with \texttt{B}, \texttt{G}, \texttt{S} and \texttt{D}): + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) node[nmos] (mos) {} + (mos.base) node[anchor=west] {B} + (mos.gate) node[anchor=east] {G} + (mos.drain) node[anchor=south] {D} + (mos.source) node[anchor=north] {S} +;\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) node[pmos] (mos) {} + (mos.B) node[anchor=west] {B} + (mos.G) node[anchor=east] {G} + (mos.D) node[anchor=north] {D} + (mos.S) node[anchor=south] {S} +;\end{circuitikz} +\end{LTXexample} + +For BJT transistors the anchors are \texttt{base}, \texttt{emitter} and \texttt{collector} anchors (which can be abbreviated with \texttt{B}, \texttt{E} and \texttt{C}): + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) node[npn] (npn) {} + (npn.base) node[anchor=east] {B} + (npn.collector) node[anchor=south] {C} + (npn.emitter) node[anchor=north] {E} +;\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) node[pnp] (pnp) {} + (pnp.B) node[anchor=east] {B} + (pnp.C) node[anchor=north] {C} + (pnp.E) node[anchor=south] {E} +;\end{circuitikz} +\end{LTXexample} + +Here is one composite example: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) node[pnp] (pnp2) {} + (pnp2.B) node[pnp, xscale=-1, anchor=B] (pnp1) {} + (pnp1.C) node[npn, anchor=C] (npn1) {} + (pnp2.C) node[npn, xscale=-1, anchor=C] (npn2) {} + (pnp1.E) -- (pnp2.E) (npn1.E) -- (npn2.E) + (pnp1.B) node[circ] {} |- (pnp2.C) node[circ] {} +;\end{circuitikz} +\end{LTXexample} + +\paragraph{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 \texttt{A}, having the anchors \texttt{A1} (up) and \texttt{A2} (down); same for port \texttt{B}. They also expose the \texttt{base} anchor, for labelling: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) node[transformer] (T) {} + (T.A1) node[anchor=east] {A1} + (T.A2) node[anchor=east] {A2} + (T.B1) node[anchor=west] {B1} + (T.B2) node[anchor=west] {B2} + (T.base) node{K} +;\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) node[gyrator] (G) {} + (G.A1) node[anchor=east] {A1} + (G.A2) node[anchor=east] {A2} + (G.B1) node[anchor=west] {B1} + (G.B2) node[anchor=west] {B2} + (G.base) node{K} +;\end{circuitikz} +\end{LTXexample} + +\section{Customization} + +\subsection{Parameters} + +Pretty much all Circui\TikZ\ relies heavily on \texttt{pgfkeys} for value handling and configuration. Indeed, at the beginning of \texttt{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 \verb!\ctikzset! command, anywhere in the code: + +\begin{LTXexample}[varwidth=true] +\tikz \draw (0,0) to[R=1<\ohm>] (2,0); \par +\ctikzset{bipoles/resistor/height=.6} +\tikz \draw (0,0) to[R=1<\ohm>] (2,0); +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\tikz \draw (0,0) to[C=1<\farad>] (2,0); \par +\ctikzset{bipoles/thickness=1} +\tikz \draw (0,0) to[C=1<\farad>] (2,0); +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\tikz \draw (0,0) to[R, v=1<\volt>] (2,0); \par +\ctikzset{voltage/distance from node=.1} +\tikz \draw (0,0) to[R, v=1<\volt>] (2,0); +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\tikz \draw (0,0) node[nand port] {}; \par +\ctikzset{tripoles/nand port/input height=.2} +\ctikzset{tripoles/nand port/port width=.2} +\tikz \draw (0,0) node[nand port] {}; +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\tikz \draw (0,0) to[C, i=$\imath$] (2,0); \par +\ctikzset{current/distance = .2} +\tikz \draw (0,0) to[C, i=$\imath$] (2,0); +\end{LTXexample} + + +Admittedly, not all graphical properties have understandable names, but for the time it will have to do: +\begin{LTXexample}[varwidth=true] +\tikz \draw (0,0) node[xnor port] {}; +\ctikzset{tripoles/xnor port/aaa=.2} +\ctikzset{tripoles/xnor port/bbb=.6} +\tikz \draw (0,0) node[xnor port] {}; +\end{LTXexample} + +\subsection{Components size} +Perhaps the most important parameter is \verb!\circuitikzbasekey/bipoles/length!, which +can be interpreted as the length of a resistor (including reasonable connections): all other lenghts are relative to this value. For instance: + +\begin{LTXexample}[pos=t,varwidth=true] +\ctikzset{bipoles/length=1.4cm} +\begin{circuitikz}[scale=1.2]\draw + (0,0) node[anchor=east] {B} + to[short, o-*] (1,0) + to[R=20<\ohm>, *-*] (1,2) + to[R=10<\ohm>, v=$v_x$] (3,2) -- (4,2) + to[cI=$\frac{\siemens}{5} v_x$, *-*] (4,0) -- (3,0) + to[R=5<\ohm>, *-*] (3,2) + (3,0) -- (1,0) + (1,2) to[short, -o] (0,2) node[anchor=east]{A} +;\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[pos=t,varwidth=true] +\ctikzset{bipoles/length=.8cm} +\begin{circuitikz}[scale=1.2]\draw + (0,0) node[anchor=east] {B} + to[short, o-*] (1,0) + to[R=20<\ohm>, *-*] (1,2) + to[R=10<\ohm>, v=$v_x$] (3,2) -- (4,2) + to[cI=$\frac{\siemens}{5} v_x$, *-*] (4,0) -- (3,0) + to[R=5<\ohm>, *-*] (3,2) + (3,0) -- (1,0) + (1,2) to[short, -o] (0,2) node[anchor=east]{A} +;\end{circuitikz} +\end{LTXexample} + +\subsection{Colors} + +The color of the components is stores in the key \verb!\circuitikzbasekey/color!. Circui\TikZ\ 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 \verb![red]!, but rather assign the style \verb![color=red]!. + +Compare for instance +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw[red] + (0,2) node[and port] (myand1) {} + (0,0) node[and port] (myand2) {} + (2,1) node[xnor port] (myxnor) {} + (myand1.out) -| (myxnor.in 1) + (myand2.out) -| (myxnor.in 2) +;\end{circuitikz} +\end{LTXexample} + +and + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw[color=red] + (0,2) node[and port] (myand1) {} + (0,0) node[and port] (myand2) {} + (2,1) node[xnor port] (myxnor) {} + (myand1.out) -| (myxnor.in 1) + (myand2.out) -| (myxnor.in 2) +;\end{circuitikz} +\end{LTXexample} + +One can of course change the color \emph{in medias res}: +\begin{LTXexample}[pos=t, varwidth=true] +\begin{circuitikz} \draw + (0,0) node[pnp, color=blue] (pnp2) {} + (pnp2.B) node[pnp, xscale=-1, anchor=B, color=brown] (pnp1) {} + (pnp1.C) node[npn, anchor=C, color=green] (npn1) {} + (pnp2.C) node[npn, xscale=-1, anchor=C, color=magenta] (npn2) {} + (pnp1.E) -- (pnp2.E) (npn1.E) -- (npn2.E) + (pnp1.B) node[circ] {} |- (pnp2.C) node[circ] {} +;\end{circuitikz} +\end{LTXexample} + +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 \texttt{to}: +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) to[V=1<\volt>] (0,2) + { to[R=1<\ohm>, color=red] (2,2) } + to[C=1<\farad>] (2,0) -- (0,0) +;\end{circuitikz} +\end{LTXexample} + +Which, for some bipoles, can be frustrating: +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0){to[V=1<\volt>, color=red] (0,2) } + to[R=1<\ohm>] (2,2) + to[C=1<\farad>] (2,0) -- (0,0) +;\end{circuitikz} +\end{LTXexample} + +The only way out is to specify different paths: +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw[color=red] + (0,0) to[V=1<\volt>, color=red] (0,2); + \draw (0,2) to[R=1<\ohm>] (2,2) + to[C=1<\farad>] (2,0) -- (0,0) +;\end{circuitikz} +\end{LTXexample} + +And yes: this is a bug and \emph{not} a feature\ldots + +\section{Examples} +\begin{LTXexample}[pos=t,varwidth=true] +\begin{circuitikz}[scale=1.4]\draw + (0,0) to[C, l=10<\micro\farad>] (0,2) -- (0,3) + to[R, l=2.2<\kilo\ohm>] (4,3) -- (4,2) + to[L, l=12<\milli\henry>, i=$i_1$] (4,0) -- (0,0) + (4,2) { to[D*, *-*, color=red] (2,0) } + (0,2) to[R, l=1<\kilo\ohm>, *-] (2,2) + to[cV, v=$\SI{.3}{\kilo\ohm} i_1$] (4,2) + (2,0) to[I, i=1<\milli\ampere>, -*] (2,2) +;\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[pos=t,varwidth=true] +\begin{circuitikz}[scale=1.2]\draw + (0,0) node[ground] {} + to[V=$e(t)$, *-*] (0,2) to[C=4<\nano\farad>] (2,2) + to[R, l_=1/4<\kilo\ohm>, *-*] (2,0) + (2,2) to[R=1<\kilo\ohm>] (4,2) + to[C, l_=2<\nano\farad>, *-*] (4,0) + (5,0) to[I, i_=$a(t)$, -*] (5,2) -- (4,2) + (0,0) -- (5,0) + (0,2) -- (0,3) to[L, l=2<\milli\henry>] (5,3) -- (5,2) + + {[anchor=south east] (0,2) node {1} (2,2) node {2} (4,2) node {3}} +;\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[pos=t,varwidth=true] +\begin{circuitikz}[scale=1.2]\draw + (0,0) node[anchor=east] {B} + to[short, o-*] (1,0) + to[R=20<\ohm>, *-*] (1,2) + to[R=10<\ohm>, v=$v_x$] (3,2) -- (4,2) + to[cI=$\frac{\siemens}{5} v_x$, *-*] (4,0) -- (3,0) + to[R=5<\ohm>, *-*] (3,2) + (3,0) -- (1,0) + (1,2) to[short, -o] (0,2) node[anchor=east]{A} +;\end{circuitikz} +\end{LTXexample} + + + \begin{LTXexample}[pos=t,varwidth=true] +\begin{circuitikz}[scale=1.2, american]\draw + (0,2) to[I=1<\milli\ampere>] (2,2) + to[R, l_=2<\kilo\ohm>, *-*] (0,0) + to[R, l_=2<\kilo\ohm>] (2,0) + to[V, v_=2<\volt>] (2,2) + to[cspst, l=$t_0$] (4,2) -- (4,1.5) + to [generic, i=$i_1$, v=$v_1$] (4,-.5) -- (4,-1.5) + (0,2) -- (0,-1.5) to[V, v_=4<\volt>] (2,-1.5) + to [R, l=1<\kilo\ohm>] (4,-1.5); + + \begin{scope}[xshift=6.5cm, yshift=.5cm] + \draw [->] (-2,0) -- (2.5,0) node[anchor=west] {$v_1 [\volt]$}; + \draw [->] (0,-2) -- (0,2) node[anchor=west] {$i_1 [\SI{}{\milli\ampere}]$} ; + \draw (-1,0) node[anchor=north] {-2} (1,0) node[anchor=south] {2} + (0,1) node[anchor=west] {4} (0,-1) node[anchor=east] {-4} + (2,0) node[anchor=north west] {4} + (-1.5,0) node[anchor=south east] {-3}; + \draw [thick] (-2,-1) -- (-1,1) -- (1,-1) -- (2,0) -- (2.5,.5); + \draw [dotted] (-1,1) -- (-1,0) (1,-1) -- (1,0) + (-1,1) -- (0,1) (1,-1) -- (0,-1); + \end{scope} +\end{circuitikz} +\end{LTXexample} + +\section{Revision history} + +\begin{itemize} +\item[\itshape version 0.2] First public release on CTAN (20090417). + \begin{enumerate} + \item \textbf{Backward incompatibility}: labels ending with \texttt{:}\textit{angle} are not parsed for positioning anymore. + \item Full use of \TikZ\ keyval features. + \item White background is not filled anymore: now the network can be drawn on a background picture as well. + \item Several new components added (logical ports, transistors, double bipoles, \ldots). + \item Color support. + \item Integration with {\ttfamily siunitx}. + \item Voltage, american style. + \item Better code, perhaps. General cleanup at the very least. + \end{enumerate} +\item[\itshape version 0.1] First public release (2007). +\end{itemize} + +\end{document} + + + + + + + |