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 | |
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')
15 files changed, 4662 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} + + + + + + + diff --git a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty new file mode 100644 index 00000000000..e3feb982875 --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty @@ -0,0 +1,603 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + + +\NeedsTeXFormat{LaTeX2e} + +\def\pgfcircversion{0.2} + +\ProvidesPackage{circuitikz}% + [2009/04/17 The CircuiTikz circuit drawing package version \pgfcircversion] + +%% Version 2.0 of pgf/TikZ is required +\RequirePackage{tikz} +\RequirePackage{xstring} +\usetikzlibrary{calc} +\usepgflibrary{decorations.pathmorphing} + + +%% Options + +\DeclareOption{fulldiode}{ + \ctikzset{full diode=true} +} + +\DeclareOption{emptydiode}{ + \ctikzset{full diode=false} +} + +\DeclareOption{europeanvoltage}{ + \ctikzset{european voltage=true} +} + +\DeclareOption{americanvoltage}{ + \ctikzset{european voltage=false} +} + +\DeclareOption{europeancurrent}{ + \ctikzset{european current=true} +} + +\DeclareOption{americancurrent}{ + \ctikzset{european current=false} +} + +\DeclareOption{europeanvoltage}{ + \ctikzset{european voltage=true} +} + +\DeclareOption{european}{ + \ctikzset{european voltage=true} \ctikzset{european current=true} +} + +\DeclareOption{american}{ + \ctikzset{european voltage=false} \ctikzset{european current=false} +} + +\DeclareOption{siunitx}{ + \pgf@circ@siunitxtrue +} + +\DeclareOption{nosiunitx}{ + \pgf@circ@siunitxfalse +} + +%% Keys + +\newcommand{\pgf@circ@comment}[1]{} + +\def\circuitikzbasekey{/tikz/circuitikz} + +\pgfkeys{\circuitikzbasekey/.is family} + +\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}} +\let\ctikzset\circuitikzset +\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}} +\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}} + +\ctikzset{bipoles/.is family} +\ctikzset{bipoles/border margin/.initial=1.1} +\ctikzset{bipoles/thickness/.initial=2} +\ctikzset{bipoles/length/.initial=1.4cm} +\ctikzset{nodes width/.initial=.04} +\newdimen\pgf@circ@Rlen +\ctikzset{bipoles/resistor/height/.initial=.3} +\ctikzset{bipoles/resistor/width/.initial=.8} +\ctikzset{bipoles/potentiometer/height/.initial=.6} +\ctikzset{bipoles/potentiometer/width/.initial=.8} +\ctikzset{bipoles/inductor/height/.initial=.3} +\ctikzset{bipoles/inductor/width/.initial=.8} +\ctikzset{bipoles/inductor/coils/.initial=6} +\ctikzset{bipoles/isource/height/.initial=.60} +\ctikzset{bipoles/isource/width/.initial=.60} +\ctikzset{bipoles/isourceam/height/.initial=.60} +\ctikzset{bipoles/isourceam/width/.initial=.60} +\ctikzset{bipoles/vsource/height/.initial=.60} +\ctikzset{bipoles/vsource/width/.initial=.60} +\ctikzset{bipoles/vsourceam/height/.initial=.60} +\ctikzset{bipoles/vsourceam/width/.initial=.60} +\ctikzset{bipoles/vsourceam/margin/.initial=.7} +\ctikzset{bipoles/isourcesin/height/.initial=.60} +\ctikzset{bipoles/isourcesin/width/.initial=.60} +\ctikzset{bipoles/vsourcesin/height/.initial=.60} +\ctikzset{bipoles/vsourcesin/width/.initial=.60} +\ctikzset{bipoles/cisource/height/.initial=.7} +\ctikzset{bipoles/cisource/width/.initial=.7} +\ctikzset{bipoles/cisourceam/height/.initial=.7} +\ctikzset{bipoles/cisourceam/width/.initial=.7} +\ctikzset{bipoles/cvsource/height/.initial=.7} +\ctikzset{bipoles/cvsource/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/height/.initial=.7} +\ctikzset{bipoles/cvsourceam/width/.initial=.7} +\ctikzset{bipoles/cvsourceam/margin/.initial=.7} +\ctikzset{bipoles/cvsourceam/text scale/.initial=1} +\ctikzset{bipoles/cisourcesin/width/.initial=.7} +\ctikzset{bipoles/cvsourcesin/height/.initial=.7} +\ctikzset{bipoles/cvsourcesin/width/.initial=.7} +\ctikzset{bipoles/capacitor/height/.initial=.6} +\ctikzset{bipoles/capacitor/width/.initial=.2} +\ctikzset{bipoles/battery/height/.initial=.6} +\ctikzset{bipoles/battery/width/.initial=.3} +\ctikzset{bipoles/diode/height/.initial=.50} +\ctikzset{bipoles/diode/width/.initial=.40} +\ctikzset{bipoles/varcap/height/.initial=.50} +\ctikzset{bipoles/varcap/width/.initial=.45} +\ctikzset{bipoles/interr/height/.initial=.35} +\ctikzset{bipoles/interr/width/.initial=.35} +\ctikzset{bipoles/interr/height 2/.initial=.08} +\ctikzset{bipoles/generic/height/.initial=.15} +\ctikzset{bipoles/generic/width/.initial=1} +\ctikzset{bipoles/open/height/.initial=.25} +\ctikzset{bipoles/open/width/.initial=.8} +\ctikzset{bipoles/ammeter/height/.initial=.60} +\ctikzset{bipoles/ammeter/width/.initial=.60} +\ctikzset{bipoles/voltmeter/height/.initial=.60} +\ctikzset{bipoles/voltmeter/width/.initial=.60} +\ctikzset{bipoles/generic/height/.initial=.30} +\ctikzset{bipoles/generic/width/.initial=.80} +\ctikzset{bipoles/not port/width/.initial=1} +\ctikzset{bipoles/not port/height/.initial=.8} +\ctikzset{bipoles/not port/circle width/.initial=.15} + +\ctikzset{tripoles/nmos/width/.initial=.7} +\ctikzset{tripoles/nmos/gate height/.initial=.35} +\ctikzset{tripoles/nmos/base height/.initial=.5} +\ctikzset{tripoles/nmos/height/.initial=1.1} +\ctikzset{tripoles/nmos/base width/.initial=.5} +\ctikzset{tripoles/nmos/gate width/.initial=.6} +\ctikzset{tripoles/pmos/width/.initial=.7} +\ctikzset{tripoles/pmos/gate height/.initial=.35} +\ctikzset{tripoles/pmos/base height/.initial=.5} +\ctikzset{tripoles/pmos/height/.initial=1.1} +\ctikzset{tripoles/pmos/base width/.initial=.5} +\ctikzset{tripoles/pmos/gate width/.initial=.6} + +\ctikzset{tripoles/npn/width/.initial=.6} +\ctikzset{tripoles/npn/gate height/.initial=.45} +\ctikzset{tripoles/npn/gate height 2/.initial=.15} +\ctikzset{tripoles/npn/base height/.initial=.4} +\ctikzset{tripoles/npn/height/.initial=1.1} +\ctikzset{tripoles/npn/gate width/.initial=.5} + +\ctikzset{tripoles/pnp/width/.initial=.6} +\ctikzset{tripoles/pnp/gate height/.initial=.45} +\ctikzset{tripoles/pnp/gate height 2/.initial=.15} +\ctikzset{tripoles/pnp/base height/.initial=.4} +\ctikzset{tripoles/pnp/height/.initial=1.1} +\ctikzset{tripoles/pnp/gate width/.initial=.5} + +\ctikzset{tripoles/and port/width/.initial=1.1} +\ctikzset{tripoles/and port/height/.initial=.8} +\ctikzset{tripoles/and port/port width/.initial=.7} +\ctikzset{tripoles/and port/input height/.initial=.5} +\ctikzset{tripoles/nand port/width/.initial=1.1} +\ctikzset{tripoles/nand port/height/.initial=.8} +\ctikzset{tripoles/nand port/port width/.initial=.7} +\ctikzset{tripoles/nand port/circle width/.initial=.15} +\ctikzset{tripoles/nand port/input height/.initial=.5} +\ctikzset{tripoles/or port/width/.initial=1.1} +\ctikzset{tripoles/or port/height/.initial=.8} +\ctikzset{tripoles/or port/port width/.initial=.7} +\ctikzset{tripoles/or port/input height/.initial=.5} +\ctikzset{tripoles/or port/input skip/.initial=.25} +\ctikzset{tripoles/or port/aaa/.initial=.6} +\ctikzset{tripoles/or port/bbb/.initial=.4} +\ctikzset{tripoles/or port/ccc/.initial=.5} +\ctikzset{tripoles/or port/ddd/.initial=.0} +\ctikzset{tripoles/nor port/width/.initial=1.1} +\ctikzset{tripoles/nor port/height/.initial=.8} +\ctikzset{tripoles/nor port/port width/.initial=.7} +\ctikzset{tripoles/nor port/input height/.initial=.5} +\ctikzset{tripoles/nor port/input skip/.initial=.25} +\ctikzset{tripoles/nor port/circle width/.initial=.15} +\ctikzset{tripoles/nor port/aaa/.initial=.6} +\ctikzset{tripoles/nor port/bbb/.initial=.4} +\ctikzset{tripoles/nor port/ccc/.initial=.5} +\ctikzset{tripoles/nor port/ddd/.initial=.0} +\ctikzset{tripoles/xor port/width/.initial=1.1} +\ctikzset{tripoles/xor port/height/.initial=.8} +\ctikzset{tripoles/xor port/port width/.initial=.7} +\ctikzset{tripoles/xor port/input height/.initial=.5} +\ctikzset{tripoles/xor port/input skip/.initial=.15} +\ctikzset{tripoles/xor port/distance/.initial=.1} +\ctikzset{tripoles/xor port/aaa/.initial=.6} +\ctikzset{tripoles/xor port/bbb/.initial=.4} +\ctikzset{tripoles/xor port/ccc/.initial=.5} +\ctikzset{tripoles/xor port/ddd/.initial=.0} +\ctikzset{tripoles/xnor port/width/.initial=1.1} +\ctikzset{tripoles/xnor port/height/.initial=.8} +\ctikzset{tripoles/xnor port/port width/.initial=.7} +\ctikzset{tripoles/xnor port/input height/.initial=.5} +\ctikzset{tripoles/xnor port/input skip/.initial=.15} +\ctikzset{tripoles/xnor port/distance/.initial=.1} +\ctikzset{tripoles/xnor port/aaa/.initial=.6} +\ctikzset{tripoles/xnor port/bbb/.initial=.4} +\ctikzset{tripoles/xnor port/ccc/.initial=.5} +\ctikzset{tripoles/xnor port/ddd/.initial=.0} +\ctikzset{tripoles/xnor port/circle width/.initial=.15} + +\ctikzset{quadpoles/transformer/width/.initial=1.5} +\ctikzset{quadpoles/transformer/height/.initial=1.5} +\ctikzset{quadpoles/gyrator/width/.initial=1.5} +\ctikzset{quadpoles/gyrator/height/.initial=1.5} + +\ctikzset{bipole/.is family} +\ctikzset{bipole/direction/.initial = 0} +\ctikzset{bipole/kind/.initial = } +\ctikzset{bipole/name/.initial = } +\newif\ifpgf@circuit@bipole@reversed +\ctikzset{bipole/reversed/.is if=pgf@circuit@bipole@reversed} +\newif\ifpgf@circuit@bipole@isvoltage +\ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage} +\newif\ifpgf@circuit@bipole@iscurrent +\ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent} + +\ctikzset{bipole/voltage/.is family} +\newif\ifpgf@circuit@bipole@voltage@backward +\ctikzset{bipole/voltage/direction/.is choice} +\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}} +\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}} +\newif\ifpgf@circuit@bipole@voltage@below +\ctikzset{bipole/voltage/position/.is choice} +\ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}} +\ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}} + +\ctikzset{bipole/voltage/label/unit/.initial=} +\ctikzset{bipole/voltage/label/name/.initial=} + +\ctikzset{bipole/current/.is family} +\newif\ifpgf@circuit@bipole@current@backward +\ctikzset{bipole/current/direction/.is choice} +\ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}} +\ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}} +\newif\ifpgf@circuit@bipole@current@before +\ctikzset{bipole/current/x position/.is choice} +\ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}} +\ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}} +\newif\ifpgf@circuit@bipole@current@below +\ctikzset{bipole/current/y position/.is choice} +\ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}} +\ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}} + +\ctikzset{bipole/current/label/unit/.initial=} +\ctikzset{bipole/current/label/name/.initial=} + +\ctikzset{bipole/label/.is family} +\ctikzset{bipole/label/position/.initial=90} +\ctikzset{bipole/label/unit/.initial=} +\ctikzset{bipole/label/name/.initial=} + + + +\ctikzset{bipole/nodes/.is family} +\ctikzset{bipole/nodes/left/.is choice} +\ctikzset{bipole/nodes/left/none/.code={\ctikzsetvalof{bipole/nodes/left}{none}}} +\ctikzset{bipole/nodes/left/empty/.code={\ctikzsetvalof{bipole/nodes/left}{empty}}} +\ctikzset{bipole/nodes/left/full/.code={\ctikzsetvalof{bipole/nodes/left}{full}}} +\ctikzset{bipole/nodes/right/.is choice} +\ctikzset{bipole/nodes/right/none/.code={\ctikzsetvalof{bipole/nodes/right}{none}}} +\ctikzset{bipole/nodes/right/empty/.code={\ctikzsetvalof{bipole/nodes/right}{empty}}} +\ctikzset{bipole/nodes/right/full/.code={\ctikzsetvalof{bipole/nodes/right}{full}}} + + +\newif\ifpgf@circuit@europeanvoltage +\ctikzset{european voltage/.is if=pgf@circuit@europeanvoltage} +\newif\ifpgf@circuit@europeancurrent +\ctikzset{european current/.is if=pgf@circuit@europeancurrent} +\newif\ifpgf@circuit@fulldiode +\ctikzset{full diode/.is if=pgf@circuit@fulldiode} +\ctikzset{thickness/.initial=2} +\ctikzset{color/.initial=black} +\pgfkeys{/tikz/color/.add code={}{\ctikzset{color=#1}}} + +\tikzset{european voltage/.code= {\ctikzset{european voltage=true} } } +\tikzset{european current/.code= {\ctikzset{european current=true} } } +\tikzset{american voltage/.code= {\ctikzset{european voltage=false} } } +\tikzset{american current/.code= {\ctikzset{european current=false} } } +\tikzset{american/.code= {\ctikzset{european current=false} \ctikzset{european voltage=false}} } +\tikzset{european/.code= {\ctikzset{european current=true} \ctikzset{european voltage=true}} } +\tikzset{full diode/.code= {\ctikzset{full diode=true} } } +\tikzset{empty diode/.code= {\ctikzset{full diode=false} } } + +\newif\ifpgf@circ@siunitx +\newif\ifpgf@circ@siunitx@res + +\ctikzset{voltage/.is family} +\ctikzset{voltage/distance from node/.initial=.5} %\pgf@circ@Rlen units +\ctikzset{voltage/distance from line/.initial=.08} % pos, tra 0 e 1 +\ctikzset{voltage/bump a/.initial=1.2} +\ctikzset{voltage/bump b/.initial=1.5} +\ctikzset{voltage/european label distance/.initial=1.4} +\ctikzset{voltage/american label distance/.initial=1.1} + +\ctikzset{current/.is family} +\ctikzset{current/distance/.initial = .5} + + + +%% dependencies + + +\input pgfcircutils.sty +\input pgfcircmath.sty + +\input pgfcircshapes.sty +\input pgfcircmonopoles.sty +\input pgfcircbipoles.sty +\input pgfcirctripoles.sty +\input pgfcircquadpoles.sty + +\input pgfcirclabel.sty +\input pgfcircvoltage.sty +\input pgfcirccurrent.sty + + + +\ExecuteOptions{european, nosiunitx} + +\ProcessOptions + +\ifpgf@circ@siunitx + \RequirePackage{siunitx} +\fi + + + +%%%%%%%%%%%% +%% Dimensions + +% coordinate bipoli +\newdimen\pgf@circ@res@up \newdimen\pgf@circ@res@down \newdimen\pgf@circ@res@zero +\newdimen\pgf@circ@res@left \newdimen\pgf@circ@res@right +\newdimen\pgf@circ@res@other +\newdimen\pgf@circ@res@step + +% thickness iniziale +\newdimen \pgfstartlinewidth + +\pgf@circ@Rlen = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + + +% Initialize paths +\def\pgfcircresetpath{ + \ctikzset{bipole/name=, bipole/direction=, bipole/label/name=, bipole/label/position=90, + bipole/reversed=false, bipole/kind=, + bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below, + bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false, + bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after, + bipole/current/y position=above, bipole/current/direction=forward } +} + + +%% Generic bipole path +\def\pgf@circ@bipole@path#1#2{ + \pgfextra{ + \pgf@circ@Rlen = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \ctikzset{bipole/kind = #1} + \def\pgf@temp{open} + \def\pgf@circ@temp{#1} + \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} + \ctikzset{bipole/name = #2\pgf@circ@rand} + } + \ifpgf@circuit@bipole@reversed + (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {} + (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {} + \else + (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {} + (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {} + \fi + \pgfextra{ + \pgf@circ@slope{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}} + {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}} + \edef\pgf@circ@direction{\pgfmathresult} + \ctikzset{bipole/direction = \pgfmathresult} + } + ($(\tikztostart)!.5!(\tikztotarget)$) + node[#1shape, rotate=\pgf@circ@direction] (\ctikzvalof{bipole/name}) {} + \ifx\pgf@temp\pgf@circ@temp % if it is an open + \else + (\ctikzvalof{bipole/name}start.center) -- (\ctikzvalof{bipole/name}.left) + (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center) + \fi + \pgf@circ@ifkeyempty{bipole/label/name}\else + \pgf@circ@drawlabel\fi + \drawpoles + \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi + \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi + % reset + \pgfextra{ + \pgfcircresetpath + } + (\tikztotarget) \tikztonodes % e si continua +} + + +%% Path definitions + +\def\pgf@circ@resistor@path#1{\pgf@circ@bipole@path{resistor}{#1}} +\def\pgf@circ@potentiometer@path#1{\pgf@circ@bipole@path{potentiometer}{#1}} +\def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} +\def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}} +\def\pgf@circ@inductor@path#1{\pgf@circ@bipole@path{inductor}{#1}} +\def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}} +\def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}} +\def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}} +\def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}} +\def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}} +\def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}} +\def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}} +\def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}} +\def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}} +\def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}} +\def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}} +\def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}} +\def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}} +\def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}} +\def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}} +\def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}} +\def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}} +\def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}} +\def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}} +\def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}} +\def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}} +\def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}} +\def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}} +\def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}} +\def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}} +\def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}} +\def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}} +\def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}} +\def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}} +\def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}} +\def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}} +\def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}} +\def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}} +\def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}} +\def\pgf@circ@empty@path#1{} + + +%% Styles + +\tikzset{resistor/.style= {to path=\pgf@circ@resistor@path, l=#1}} +\tikzset{ammeter/.style= {to path=\pgf@circ@ammeter@path, l=#1}} +\tikzset{voltmeter/.style= {to path=\pgf@circ@voltmeter@path, l=#1}} +\tikzset{potentiometer/.style = {to path=\pgf@circ@potentiometer@path, l=#1}} +\tikzset{capacitor/.style = {to path=\pgf@circ@capacitor@path, l=#1}} +\tikzset{battery/.style = {to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\tikzset{inductor/.style = {to path=\pgf@circ@inductor@path, l=#1}} +\tikzset{european voltage source/.style = {to path=\pgf@circ@vsource@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\tikzset{american voltage source/.style = {to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\tikzset{european current source/.style = {to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\tikzset{american current source/.style = {to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\tikzset{european controlled voltage source/.style = {to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\tikzset{american controlled voltage source/.style = {to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\tikzset{european controlled current source/.style = {to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\tikzset{american controlled current source/.style = {to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\tikzset{sinusoidal voltage source/.style = {to path=\pgf@circ@vsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, v=#1 }} +\tikzset{sinusoidal current source/.style = {to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} +\tikzset{controlled sinusoidal voltage source/.style = {to path=\pgf@circ@cvsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\tikzset{controlled sinusoidal current source/.style = {to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}} + +\tikzset{voltage source/.style = {\ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\tikzset{current source/.style = {\ifpgf@circuit@europeancurrent european \else american \fi current source, \circuitikzbasekey/bipole/is current=true, i=#1}} +\tikzset{controlled voltage source/.style = {\ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}} +\tikzset{controlled current source/.style = {\ifpgf@circuit@europeancurrent european \else american \fi controlled current source, \circuitikzbasekey/bipole/is current=true, i=#1}} + + +\tikzset{generic/.style = {to path=\pgf@circ@generic@path, l=#1}} +\tikzset{ageneric/.style = {to path=\pgf@circ@ageneric@path, l=#1}} +\tikzset{short/.style = {to path=\pgf@circ@short@path}} +\tikzset{open/.style = {to path=\pgf@circ@open@path}} + +\tikzset{full diode/.style = {to path=\pgf@circ@fulldiode@path}} +\tikzset{full Schottky diode/.style = {to path=\pgf@circ@fullsdiode@path}} +\tikzset{full Zener diode/.style = {to path=\pgf@circ@fullzdiode@path}} +\tikzset{full tunnel diode/.style = {to path=\pgf@circ@fulltdiode@path}} +\tikzset{full photodiode/.style = {to path=\pgf@circ@fullpdiode@path}} +\tikzset{full led/.style = {to path=\pgf@circ@fulllediode@path}} +\tikzset{full varcap/.style = {to path=\pgf@circ@fullvarcap@path}} + +\tikzset{empty diode/.style = {to path=\pgf@circ@emptydiode@path}} +\tikzset{empty Schottky diode/.style = {to path=\pgf@circ@emptysdiode@path}} +\tikzset{empty Zener diode/.style = {to path=\pgf@circ@emptyzdiode@path}} +\tikzset{empty tunnel diode/.style = {to path=\pgf@circ@emptytdiode@path}} +\tikzset{empty photodiode/.style = {to path=\pgf@circ@emptypdiode@path}} +\tikzset{empty led/.style = {to path=\pgf@circ@emptylediode@path}} +\tikzset{empty varcap/.style = {to path=\pgf@circ@emptyvarcap@path}} + + \tikzset{Schottky diode/.style = {\ifpgf@circuit@fulldiode full \else empty \fi Schottky diode}} + \tikzset{Zener diode/.style = {\ifpgf@circuit@fulldiode full \else empty \fi Zener diode}} + \tikzset{tunnel diode/.style = {\ifpgf@circuit@fulldiode full \else empty \fi tunnel diode}} + \tikzset{photodiode/.style = {\ifpgf@circuit@fulldiode full \else empty \fi photodiode}} + \tikzset{led/.style = {\ifpgf@circuit@fulldiode full \else empty \fi led}} + \tikzset{varcap/.style = {\ifpgf@circuit@fulldiode full \else empty \fi varcap}} + \tikzset{diode/.style = {\ifpgf@circuit@fulldiode full \else empty \fi diode}} + +\tikzset{closing switch/.style = {to path=\pgf@circ@cspst@path, l=#1}} +\tikzset{opening switch/.style = {to path=\pgf@circ@ospst@path, l=#1}} + +\tikzset{ammeter/.style = {to path=\pgf@circ@ammeter@path}} +\tikzset{voltmeter/.style = {to path=\pgf@circ@voltmeter@path}} + +% short forms +\tikzset{vsource/.style = {voltage source = #1}} +\tikzset{isource/.style = {current source = #1}} +\tikzset{cisource/.style = {controlled current source = #1}} +\tikzset{cvsource/.style = {controlled voltage source = #1}} +\tikzset{vsourcesin/.style = {sinusoidal voltage source = #1}} +\tikzset{isourcesin/.style = {sinusoidal current source = #1}} +\tikzset{cisourcesin/.style = {controlled sinusoidal current source = #1}} +\tikzset{cvsourcesin/.style = {controlled sinusoidal voltage source = #1}} + +\tikzset{controlled vsource/.style = {controlled voltage source = #1}} +\tikzset{controlled isource/.style = {controlled current source = #1}} +\tikzset{controlled vsourcesin/.style = {controlled sinusoidal voltage source = #1}} +\tikzset{controlled isourcesin/.style = {controlled sinusoidal current source = #1}} + +\tikzset{R/.style= {resistor = #1}} +\tikzset{pR/.style= {potentiometer = #1}} +\tikzset{C/.style = {capacitor = #1}} +\tikzset{L/.style = {inductor = #1}} +\tikzset{V/.style = {voltage source = #1}} +\tikzset{cV/.style = {controlled voltage source = #1}} +\tikzset{sV/.style = {sinusoidal voltage source = #1}} +\tikzset{csV/.style = {controlled sinusoidal voltage source = #1}} +\def\pgf@temp#1{ + \tikzset{V#1/.style = {voltage source, v#1=##1} } + \tikzset{cV#1/.style = {controlled voltage source, v#1=##1} } + \tikzset{sV#1/.style = {sinusoidal voltage source, v#1=##1} } + \tikzset{csV#1/.style = {controlled sinusoidal voltage source, v#1=##1} } +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} +\tikzset{I/.style = {current source = #1}} +\tikzset{cI/.style = {controlled current source = #1}} +\tikzset{sI/.style = {sinusoidal current source = #1}} +\tikzset{csI/.style = {controlled sinusoidal current source = #1}} +\def\pgf@temp#1{ + \tikzset{I#1/.style = {current source, i#1=##1} } + \tikzset{cI#1/.style = {controlled current source, i#1=##1} } + \tikzset{sI#1/.style = {sinusoidal current source, i#1=##1} } + \tikzset{csI#1/.style = {controlled sinusoidal current source, i#1=##1} } +} +\pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<} +\pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^} +\pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_} +\tikzset{Do/.style = {empty diode}} +\tikzset{tDo/.style = {empty tunnel diode}} +\tikzset{zDo/.style = {empty Zener diode}} +\tikzset{sDo/.style = {empty Schottky diode}} +\tikzset{pDo/.style = {empty photodiode}} +\tikzset{leDo/.style = {empty led}} +\tikzset{VCo/.style = {empty varcap}} +\tikzset{D*/.style = {full diode}} +\tikzset{tD*/.style = {full tunnel diode}} +\tikzset{zD*/.style = {full Zener diode}} +\tikzset{sD*/.style = {full Schottky diode}} +\tikzset{pD*/.style = {full photodiode}} +\tikzset{leD*/.style = {full led}} +\tikzset{VC*/.style = {full varcap}} +\tikzset{D/.style = {diode}} +\tikzset{tD/.style = {tunnel diode}} +\tikzset{zD/.style = {Zener diode}} +\tikzset{sD/.style = {Schottky diode}} +\tikzset{pD/.style = {photodiode}} +\tikzset{leD/.style = {led}} +\tikzset{VC/.style = {varcap}} + +\tikzset{cspst/.style = {closing switch = #1}} +\tikzset{ospst/.style = {opening switch = #1}} + +%% The environment + +\newenvironment{circuitikz}{ +\begin{tikzpicture}}{\end{tikzpicture}} + +\endinput + diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcircbipoles.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcircbipoles.sty new file mode 100644 index 00000000000..9568064834e --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcircbipoles.sty @@ -0,0 +1,1160 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + +%% Generic macro for defining a bipole shape +% #1 - lower y-size of the bipole (from the center). If empty, same ad #3 +% #2 - #shape is the name of the shape +% #3 - upper y-size of the bipole (from the center) +% #4 - macros drawing the bipole + + +\newcommand{\pgfcircdeclarebipole}[5][]{ + \pgfdeclareshape{#2shape}{ + + \savedanchor{\northeast}{ + \pgf@y=#3\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=#4\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\northeastborder}{ + \pgf@y=#3\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=#4\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwestborder}{ + \pgf@y=-#1\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y + \pgf@x=-#4\pgf@circ@Rlen + \pgf@x=.5\pgf@x + \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x + } + \savedanchor{\southwest}{ + \pgf@y=-#1\pgf@circ@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-#4\pgf@circ@Rlen + \pgf@x=.5\pgf@x + } + \savedanchor{\centerpoint}{ + \pgf@circ@res@down=-#1\pgf@circ@Rlen + \pgf@circ@res@up=#3\pgf@circ@Rlen + \pgfpointorigin + \pgf@y=\pgf@circ@res@up + \advance\pgf@y by\pgf@circ@res@down + \pgf@y=.5\pgf@y + } + \anchor{center}{\pgfpointorigin} + \anchor{n}{ + \ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi + \pgf@x=0cm + } + \anchor{ne}{ + \ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi + } + \anchor{nw}{ + \ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi + \pgf@x=-\pgf@x + } + \anchor{e}{% + \ifpgf@circuit@bipole@reversed\else\southwest\northeast\fi + \pgf@y=0cm + } + \anchor{s}{% + \ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi + \pgf@x=0cm + } + \anchor{se}{% + \ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi + \pgf@x=-\pgf@x + } + \anchor{sw}{% + \ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi + } + \anchor{w}{ + \ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi + \pgf@y=0cm + } + \anchor{north}{ + \ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi + \pgf@x=0cm + } + \anchor{east}{% + \ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi + \pgf@y=0cm + } + \anchor{south}{% + \ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi + \pgf@x=0cm + } + \anchor{west}{ + \ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi + \pgf@y=0cm + } + \anchor{right}{ + \ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi + \pgf@y=0cm + } + \anchor{above}{ + \ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi + \pgf@x=0cm + } + \anchor{left}{% + \ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi + \pgf@y=0cm + } + \anchor{below}{% + \ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi + \pgf@x=0cm + } + \anchor{a}{% + \ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi + \pgf@y=0cm + } + \anchor{b} { + \ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi + \pgf@y=0cm + } + \savedanchor{\textanchor}{% + \pgf@y=\ht\pgfnodeparttextbox + \pgf@x=-.5\wd\pgfnodeparttextbox + } + \anchor{text}{% + \textanchor + } + \anchorborder{% + \def\pgf@temp{false} + \ifpgf@circuit@bipole@reversed\pgf@temp + \pgf@circ@res@left=-\pgf@x + \pgf@circ@res@right=-\pgf@y + \else + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@right=\pgf@y + \fi + \ifdim\pgf@circ@res@right>0cm + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\northeastborder} + \else + \southwestborder + \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\pgfpoint{-\pgf@x}{-\pgf@y}} + \fi + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northeast + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@zero = 0cm + \pgf@circ@res@left = -\pgf@x + \pgf@circ@res@right = \pgf@x + \southwest + \pgf@circ@res@down = \pgf@y + + \pgfstartlinewidth=\pgflinewidth + + #5 + + \pgfsetlinewidth{\pgfstartlinewidth} + } + } +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Standard bipole shapes declarations + +%% Resistor +\pgfcircdeclarebipole[\ctikzvalof{bipoles/resistor/height}]{resistor}{\ctikzvalof{bipoles/resistor/height}}{\ctikzvalof{bipoles/resistor/width}}{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 12 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + +%% Potentiometer + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/potentiometer/height}]{potentiometer}{\ctikzvalof{bipoles/potentiometer/height}}{\ctikzvalof{bipoles/potentiometer/width}}{ + \pgf@circ@res@step = \ctikzvalof{bipoles/potentiometer/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 12 + \def\myfrac{.5} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@down}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@up}} + \advance\pgf@circ@res@other by 2\pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@down}} + \advance\pgf@circ@res@other by \pgf@circ@res@step + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{to} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + + + +%% Capacitor + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/capacitor/height}]{capacitor}{\ctikzvalof{bipoles/capacitor/height}}{\ctikzvalof{bipoles/capacitor/width}}{ + \pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 5 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + +%% Battery + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/battery/height}]{battery}{\ctikzvalof{bipoles/battery/height}}{\ctikzvalof{bipoles/battery/width}}{ + \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 6 + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} +} + + + +%% Inductor + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/inductor/height}]{inductor}{\ctikzvalof{bipoles/inductor/height}}{\ctikzvalof{bipoles/inductor/width}}{ + \pgf@circ@res@step=\ctikzvalof{bipoles/inductor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by \ctikzvalof{bipoles/inductor/coils} + + \pgfdecorationsegmentamplitude=\ctikzvalof{bipoles/inductor/height}\pgf@circ@Rlen + \pgfdecorationsegmentamplitude=.5\pgfdecorationsegmentamplitude + \pgfdecorationsegmentlength = \pgf@circ@res@step + \pgfdecorationsegmentaspect=.6 + + \begin{pgfdecoration}{{coil}{\pgfdecoratedremainingdistance}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \end{pgfdecoration} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfusepath{stroke} +} + +%% Independent voltage source + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/vsource/height}]{vsource}{\ctikzvalof{bipoles/vsource/height}}{\ctikzvalof{bipoles/vsource/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + +%% Independent voltage source - American style + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/vsourceam/height}]{vsourceAM}{\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/vsourceam/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + + + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$} + + \pgfusepath{draw} +} + + + +%% Independent sinusoidal voltage source + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/vsourcesin/height}]{vsourcesin}{\ctikzvalof{bipoles/vsourcesin/height}}{\ctikzvalof{bipoles/vsourcesin/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + +%% Independent current source + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/isource/height}]{isource}{\ctikzvalof{bipoles/isource/height}}{\ctikzvalof{bipoles/isource/width}}{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + + + + +%% Independent current source - American + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/isourceam/height}]{isourceAM}{\ctikzvalof{bipoles/isourceam/height}}{\ctikzvalof{bipoles/isourceam/width}}{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope +} + + + + +%% Independent sinusoidal current source + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/isource/height}]{isourcesin}{\ctikzvalof{bipoles/isource/height}}{\ctikzvalof{bipoles/isource/width}}{ + \pgfpointorigin + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + + +%% Controlled voltage source + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/cvsource/height}]{cvsource}{\ctikzvalof{bipoles/cvsource/height}}{\ctikzvalof{bipoles/cvsource/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} +} + + + + +%% Controlled voltage source - American + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/cvsourceam/height}]{cvsourceAM}{\ctikzvalof{bipoles/cvsourceam/height}}{\ctikzvalof{bipoles/cvsourceam/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$} + \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$} + \pgfusepath{draw} +} + + +%% Controlled sinusoidal voltage source + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/cvsourcesin/height}]{cvsourcesin}{\ctikzvalof{bipoles/cvsourcesin/height}}{\ctikzvalof{bipoles/cvsourcesin/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + + +%% Controlled sinusoidal current source + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/cvsourcesin/height}]{cisourcesin}{\ctikzvalof{bipoles/cvsourcesin/height}}{\ctikzvalof{bipoles/cvsourcesin/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \endpgfscope + + \pgf@circ@res@up = .5\pgf@circ@res@up + \pgfscope + \pgftransformrotate{90} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}} + \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + + + + +%% Controlled current source + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/cisource/height}]{cisource}{\ctikzvalof{bipoles/cisource/height}}{\ctikzvalof{bipoles/cisource/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfusepath{draw} +} + + + + +%% Controlled current source - American + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/cisourceam/height}]{cisourceAM}{\ctikzvalof{bipoles/cisourceam/height}}{\ctikzvalof{bipoles/cisourceam/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + \pgfscope + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{draw}} + \endpgfscope +} + +%% Black generic diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{fulldiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Black Zener diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{fullzdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black Schottky diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{fullsdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{.8\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Black tunnel diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{fulltdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black light emitting diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{fulllediode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{to} + \pgfpathmoveto{\pgfpoint{.1\pgf@circ@res@up}{.7\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@up}{\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@up}{.8\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Black photodiode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{fullpdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{to} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@up}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.1\pgf@circ@res@up}{.7\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@up}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Black varcap + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/varcap/height}]{fullvarcap}{\ctikzvalof{bipoles/varcap/height}}{\ctikzvalof{bipoles/varcap/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{0pt}} + \pgfusepath{draw,fill} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \endpgfscope +} + +%% Empty generic diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{emptydiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + +%% Empty Zener diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{emptyzdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty Schottky diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{emptysdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{.8\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{.8\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope + +} + +%% Empty tunnel diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{emptytdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty light emitting diode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{emptylediode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{to} + \pgfpathmoveto{\pgfpoint{.1\pgf@circ@res@up}{.7\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@up}{\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@up}{.8\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty photodiode + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/diode/height}]{emptypdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \endpgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfsetarrowsend{to} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@up}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.1\pgf@circ@res@up}{.7\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@up}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@up}{.5\pgf@circ@res@up}} + \pgfusepath{draw} + \endpgfscope +} + +%% Empty varcap + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/varcap/height}]{emptyvarcap}{\ctikzvalof{bipoles/varcap/height}}{\ctikzvalof{bipoles/varcap/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfscope + \pgftransformxshift{\pgf@circ@res@left} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfusepath{draw} + + \endpgfscope +} + +%% Closing SPST + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/interr/height 2}]{cspst}{\ctikzvalof{bipoles/interr/height}}{\ctikzvalof{bipoles/interr/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@left}{.9\pgf@circ@res@up}} + \pgfpatharc{65}{15}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/interr/width}\pgf@circ@Rlen} + \pgfsetarrowsend{to} + \pgfusepath{draw} + +} + +%% Opening SPST + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/interr/height 2}]{ospst}{\ctikzvalof{bipoles/interr/height}}{\ctikzvalof{bipoles/interr/width}}{ + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@right}{.1\pgf@circ@res@down}} + \pgfpatharc{15}{65}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/interr/width}\pgf@circ@Rlen} + \pgfsetarrowsend{to} + \pgfusepath{draw} + +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% Ammeter + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/ammeter/height}]{ammeter}{\ctikzvalof{bipoles/ammeter/height}}{\ctikzvalof{bipoles/ammeter/width}}{ + \def\pgf@circ@temp{right} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \def\pgf@circ@temp{below} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \pgf@circ@res@step=1.2\pgf@circ@res@up + \fi + \fi + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@up} + \pgfusepath{draw} + \endpgfscope + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.8\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfnode{circle}{center}{\textbf{A}}{}{} + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{.8\pgf@circ@res@up}} + \pgftransformrotate{45} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfusepath{stroke} +} + +%% Voltmeter + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/voltmeter/height}]{voltmeter}{\ctikzvalof{bipoles/voltmeter/height}}{\ctikzvalof{bipoles/voltmeter/width}}{ + \def\pgf@circ@temp{right} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \def\pgf@circ@temp{below} + \ifx\tikz@res@label@pos\pgf@circ@temp + \pgf@circ@res@step=-1.2\pgf@circ@res@up + \else + \pgf@circ@res@step=1.2\pgf@circ@res@up + \fi + \fi + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@up} + \pgfusepath{draw} + \endpgfscope + + \pgfsetlinewidth{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.8\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfnode{circle}{center}{\textbf{V}}{}{} + \pgfscope + \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{.8\pgf@circ@res@up}} + \pgftransformrotate{45} + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgfusepath{draw} + + \pgfusepath{stroke} +} + +%% Short circuit + +\pgfcircdeclarebipole[0]{short}{0}{0}{ } + +%% Open circuit + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/open/height}]{open}{\ctikzvalof{bipoles/open/height}}{\ctikzvalof{bipoles/open/width}}{ + +} + +%% Generic bipole - used as resistor by some (bleah) + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/generic/height}]{generic}{\ctikzvalof{bipoles/generic/height}}{\ctikzvalof{bipoles/generic/width}}{ + + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfusepath{draw} +} + +%% Generic asymmetric bipole + +\pgfcircdeclarebipole[\ctikzvalof{bipoles/generic/height}]{ageneric}{\ctikzvalof{bipoles/generic/height}}{\ctikzvalof{bipoles/generic/width}}{ + \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen + \divide \pgf@circ@res@step by 14 + + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfusepath{draw} + + \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{stroke,fill} +} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Handling of terminals + + +%% Easily usable styles + +\tikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=none}} +\tikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=empty}} +\tikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=full}} +\tikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=none}} +\tikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=empty}} +\tikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=full}} +\tikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=empty}} +\tikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=full}} + +\tikzset{reversed/.style = {\circuitikzbasekey/bipole/reversed=true}} + + +%% The output routine + +\def\drawpoles{ + \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{empty} } + \ifx\pgf@temp\pgf@circ@temp + { (\tikztostart) node[ocirc] {} } + \else + \pgfextra{ \def\pgf@temp{full} } + \ifx\pgf@temp\pgf@circ@temp + { (\tikztostart) node[circ] {} } + \fi + \fi + \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} \def\pgf@temp{empty} } + \ifx\pgf@temp\pgf@circ@temp + { (\tikztotarget) node[ocirc] {} } + \else + \pgfextra{ \def\pgf@temp{full} } + \ifx\pgf@temp\pgf@circ@temp + { (\tikztotarget) node[circ] {} } + \fi + \fi +} + + + + + + + + + + + + + + + +\pgfdeclareshape{not port} + { + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@y + \pgf@y=.5\pgf@y + \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@x + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \northwest + \pgf@y=-\pgf@y + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgfsetlinewidth{2\pgflinewidth} + \pgftransformxshift{.7\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{.5\pgf@circ@res@other}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@other}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + + } + } + + + + + +\endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcirccurrent.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcirccurrent.sty new file mode 100644 index 00000000000..c86d57635da --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcirccurrent.sty @@ -0,0 +1,239 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Current handling + +%% Options + + +\tikzset{i^>/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = after, + \circuitikzbasekey/bipole/current/y position = above + } +} + +\tikzset{i_>/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = after, + \circuitikzbasekey/bipole/current/y position = below + } +} + +\tikzset{i>^/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = before, + \circuitikzbasekey/bipole/current/y position = above + } +} + +\tikzset{i>_/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = before, + \circuitikzbasekey/bipole/current/y position = below + } +} + +\tikzset{i^</.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = backward, + \circuitikzbasekey/bipole/current/x position = after, + \circuitikzbasekey/bipole/current/y position = above + } +} + +\tikzset{i_</.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = backward, + \circuitikzbasekey/bipole/current/x position = after, + \circuitikzbasekey/bipole/current/y position = below + } +} + +\tikzset{i<^/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = backward, + \circuitikzbasekey/bipole/current/x position = before, + \circuitikzbasekey/bipole/current/y position = above + } +} + +\tikzset{i<_/.style = { + i = #1, + \circuitikzbasekey/bipole/current/direction = backward, + \circuitikzbasekey/bipole/current/x position = before, + \circuitikzbasekey/bipole/current/y position = below + } +} + +\tikzset{i/.code = { +% \ifpgf@circuit@bipole@iscurrent +% \pgfkeys{\circuitikzbasekey/bipole/current/position=above} +% \else +% \pgfkeys{\circuitikzbasekey/bipole/current/position=below} +% \fi + \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward, + \circuitikzbasekey/bipole/current/x position = after, + \circuitikzbasekey/bipole/current/y position = above } + \pgfkeys{/tikz/circuitikz/bipole/current/label/name=#1} + \ctikzsetvalof{bipole/current/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +} +} + +\tikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward } } +\tikzset{i_/.style = { i = #1, \circuitikzbasekey/bipole/current/y position = below } } +\tikzset{i>/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } } +\tikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } } + + +\def\pgf@circ@drawnormalcurrent{ + \ifpgf@circuit@bipole@current@before + \ifpgf@circuit@bipole@current@backward + { (\ctikzvalof{bipole/name}.left) -- + node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} + (\tikztostart) + } + \else + { (\tikztostart) -- + node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} + (\ctikzvalof{bipole/name}.left) + } + \fi + \else + \ifpgf@circuit@bipole@current@backward + { (\tikztotarget) -- + node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} + (\ctikzvalof{bipole/name}.right) + } + \else + { (\ctikzvalof{bipole/name}.right) -- + node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} + (\tikztotarget) + } + \fi + \fi +} + +%% Output routine +%% #1 - node name + +\def\pgf@circ@drawcurrent{ + \pgfextra{ + \edef\pgf@circ@ffffff{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <256 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >284 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south} + \fi + \fi + + \ifpgf@circuit@bipole@current@below + \def\pgf@circ@bipole@current@label@where{-90} + \else + \def\pgf@circ@bipole@current@label@where{+90} + \fi + } + + + \pgfextra{ \def\pgf@temp{short} \edef\pgf@circ@temp{\ctikzvalof{bipole/kind}} } + + \ifx\pgf@circ@temp\pgf@temp % caso di corrente (centrata) su un corto + \ifpgf@circuit@bipole@current@backward + { (\tikztotarget) -- + node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} + (\tikztostart) } + \else + { (\tikztostart) -- + node [currarrow, pos=\ctikzvalof{current/distance}, sloped, allow upside down] (Iarrow) {} + (\tikztotarget) } + \fi + + \else % altri bipoli - e quindi tra nodo e target + + \ifpgf@circuit@bipole@iscurrent + \ifpgf@circuit@europeancurrent + \pgf@circ@drawnormalcurrent + \else + \fi + \else + \pgf@circ@drawnormalcurrent + \fi + \fi + + \ifpgf@circuit@bipole@iscurrent + node [anchor=\pgf@circ@dir] at (\ctikzvalof{bipole/name}.\pgf@circ@bipole@current@label@where) + { \pgf@circ@finallabel{current/} } + \else + (Iarrow.\pgf@circ@bipole@current@label@where) node [anchor=\pgf@circ@dir] + { \pgf@circ@finallabel{current/} } + \fi + +} + +\endinput + + + diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty new file mode 100644 index 00000000000..436bd941666 --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcirclabel.sty @@ -0,0 +1,109 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Bipole label positioning + +%% Options +\tikzset{label/.style = { l=#1 } } +\tikzset{l/.code = { + \pgfkeys{/tikz/circuitikz/bipole/label/name=#1} + \ctikzsetvalof{bipole/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp} + \else + \fi + \else + \fi +}} + +\tikzset{label above/.code = { + l=#1, + \circuitikzbasekey/bipole/label/position=90 } +} +\tikzset{l^/.style = { + l=#1, + \circuitikzbasekey/bipole/label/position=90 } +} + +\tikzset{label below/.code = { + l=#1, + \circuitikzbasekey/bipole/label/position=-90 } +} +\tikzset{l_/.style = { + l=#1, + \circuitikzbasekey/bipole/label/position=-90 } +} + +%% Output routing +%% #1 - node name + +\def\pgf@circ@drawlabel{ + \pgfextra{ + \def\pgf@circ@temp{\ctikzvalof{bipole/label/position}} + \edef\pgf@circ@ffffff{\pgf@circ@direction} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{south east} \else \def\pgf@circ@dir{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{east} \else \def\pgf@circ@dir{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{north east} \else \def\pgf@circ@dir{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{north} \else \def\pgf@circ@dir{south} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <256 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{north west}\else \def\pgf@circ@dir{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >284 \ifnum\pgfcircmathresult <356 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{south west} \else \def\pgf@circ@dir{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{south} \else \def\pgf@circ@dir{north} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifnum\pgf@circ@temp>0 + \def\pgf@circ@dir{south} \else \def\pgf@circ@dir{north} + \fi + \fi + } + node [anchor=\pgf@circ@dir] at (\ctikzvalof{bipole/name}.\pgf@circ@temp) { + \pgf@circ@finallabel{} + } +} + +\endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcircmath.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcircmath.sty new file mode 100644 index 00000000000..f7095d337a2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcircmath.sty @@ -0,0 +1,42 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Math routines + +\def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1} + +% angle between 0 and 360 +\def\pgf@circ@slope#1#2{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#2}% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \ifdim\pgf@x=0pt + \ifdim\pgf@y<0pt + \def\pgfmathresult{-90.0} + \else + \def\pgfmathresult{+90.0} + \fi + \else + \pgfmathdivide{\pgf@y}{\pgf@x} + \pgfmathatan{\pgfmathresult} + \ifdim\pgf@x<0pt + \pgfmathsubtract{\pgfmathresult}{+180} + \fi + \fi + \pgf@x=\pgfmathresult pt + \ifdim\pgf@x<0pt + \pgfmathadd{\pgfmathresult}{+360} + \fi + } + +\endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcircmonopoles.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcircmonopoles.sty new file mode 100644 index 00000000000..4d24bd2d13e --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcircmonopoles.sty @@ -0,0 +1,55 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Monopoles + +%% Ground symbol + +\pgfdeclareshape{ground}{ + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \pgf@circ@Rlen + \divide \pgf@circ@res@step by 4 + + + \pgfpathmoveto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfstartlinewidth=\pgflinewidth + %\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}} + \pgfusepath{draw} + + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{-.8\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@step}{-1.2\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.4\pgf@circ@res@step}} + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.6\pgf@circ@res@step}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw} + + + \pgfsetlinewidth{\pgfstartlinewidth} + + \endpgfscope + } + +} + +\endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcircquadpoles.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcircquadpoles.sty new file mode 100644 index 00000000000..29a8eb327f3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcircquadpoles.sty @@ -0,0 +1,169 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Quadripoles + +\newcommand{\pgfcircdeclarequadpole}[2]{ + \pgfdeclareshape{#1} + { + \anchor{center}{ + \northwest + \pgf@x=0pt + } + \savedanchor\northwest{% + \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@y + \pgf@y=.5\pgf@y + \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@x=.5\pgf@x + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x + } + \anchor{south west}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{north east}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{north west}{ + \northwest + } + \anchor{south east}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{A2}{ + \northwest + \pgf@y=-\pgf@y + } + \anchor{B1}{ + \northwest + \pgf@x=-\pgf@x + } + \anchor{A1}{ + \northwest + } + \anchor{B2}{ + \northwest + \pgf@x=-\pgf@x + \pgf@y=-\pgf@y + } + \anchor{north}{ + \northwest + \pgf@x=0pt + } + \anchor{base}{ + \northwest + \pgf@x=0pt + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgf@circ@Rlen=\pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + + #2 + + } + } +} + + + + + + +\pgfcircdeclarequadpole{transformer}{ + + \def\stretto{.4} + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@up}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@left}% + {\pgf@circ@res@down}% + } + \pgfnode{inductorshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \endpgfscope + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@down}% + }{% + \pgfpoint + {\stretto\pgf@circ@res@right}% + {\pgf@circ@res@up}% + } + \pgfnode{inductorshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@inductor1}{b}} + + \pgfpathmoveto{\pgfpointanchor{pgf@inductor1}{a}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpointanchor{pgf@inductor2}{a}} + + \pgfpathmoveto{\pgfpointanchor{pgf@inductor2}{b}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + + +} + + + +\pgfcircdeclarequadpole{gyrator}{ + + \def\stretto{.4} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfusepath{draw} + + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{.7*\stretto\pgf@circ@res@down}} + \pgfpatharc{90}{270}{.7*\stretto\pgf@circ@res@down} + + \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{.7*\stretto\pgf@circ@res@up}} + \pgfpatharc{-90}{90}{.7*\stretto\pgf@circ@res@down} + \pgfusepath{draw} + +} diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcircshapes.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcircshapes.sty new file mode 100644 index 00000000000..c2f1826db5a --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcircshapes.sty @@ -0,0 +1,107 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Other shapes + + +%% Nothing + +\pgfdeclareshape{emptyshape}{ + \savedanchor{\northeast}{% + \pgf@x=.5\wd\pgfnodeparttextbox% + \pgf@y=.5\ht\pgfnodeparttextbox% + } + \anchor{north}{ + \northeast + \pgf@x=0cm + } + \anchor{east}{% + \northeast + \pgf@y=0cm + } + \anchor{south}{% + \northeast + \pgf@y=-\pgf@y + \pgf@x=0cm + } + \anchor{west}{ + \northeast + \pgf@y=0cm + \pgf@x=-\pgf@x + } + \anchor{text}{% + \pgfpointorigin + } + \anchor{center}{ + \pgfpointorigin + } +} + +%% Full terminal + +\pgfdeclareshape{circ}{ + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgfkeysvalueof{/tikz/circuitikz/bipoles/length}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Empty terminal + +\pgfdeclareshape{ocirc}{ + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + + \pgfscope + \pgfpathcircle{\pgfpointorigin}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgfkeysvalueof{/tikz/circuitikz/bipoles/length}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfsetfillcolor{white} + \pgfusepath{draw,fill} + \endpgfscope + + } +} + +%% Current arrow + +\pgfdeclareshape{currarrow}{ + \anchor{center}{ + \pgfpointorigin + } + \behindforegroundpath{ + + \pgfscope + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \divide \pgf@circ@res@step by 16 + + \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw,fill} + + \endpgfscope + } + +} + +\endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcirctripoles.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcirctripoles.sty new file mode 100644 index 00000000000..641dd0c40e6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcirctripoles.sty @@ -0,0 +1,749 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Tripoles + + + +\newcommand{\pgfcircdeclarelogicport}[2]{ + \pgfdeclareshape{#1 port} + { + \savedanchor\northwest{% + \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/height}\pgf@y + \pgf@y=.5\pgf@y + \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/width}\pgf@x + \pgf@x=.5\pgf@x + } + \anchor{south}{ + \north + \pgf@y=-\pgf@y + } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOne{% + \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/height}\pgf@y + \pgf@y=.5\pgf@y + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/input height}\pgf@y + \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1 port/width}\pgf@x + \pgf@x=.5\pgf@x + } + \anchor{in 1}{ + \inOne + } + \anchor{in 2}{ + \inOne + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \northwest + \pgf@y=0pt + \pgf@x=-.8\pgf@x + } + + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + #2 + + } + } +} + + +\pgfcircdeclarelogicport{and}{ + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@down}} + \pgfpathcurveto + {\pgfpoint{.0\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@right} + {.5\pgf@circ@res@down}} + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@right} + {0pt}} + \pgfpathcurveto + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@right} + {.5\pgf@circ@res@up}} + {\pgfpoint{.0\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + \pgfusepath{draw} +} + + + +\pgfcircdeclarelogicport{nand}{ + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + + \pgfsetlinewidth{2\pgflinewidth} + + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/circle width}\pgf@circ@res@right + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@right + + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathcurveto + {\pgfpoint{.0\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{.5\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{.5\pgf@circ@res@up}} + {\pgfpoint{.0\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgfusepath{draw} +} + + +\pgfcircdeclarelogicport{nor}{ + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/port width}\pgf@circ@res@right + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/nand port/circle width}\pgf@circ@res@right + + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/nor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgfusepath{draw} +} + + + + +\pgfcircdeclarelogicport{or}{ + + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/port width}\pgf@circ@res@right + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/aaa}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/aaa}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ddd}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/or port/ddd}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfusepath{draw} +} + + +\pgfcircdeclarelogicport{xor}{ + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/port width}\pgf@circ@res@right + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \def\pgf@circ@temp{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/distance}\pgf@circ@res@right+} + \pgfpathmoveto{\pgfpoint{\pgf@circ@temp-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \pgfpathcurveto + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/aaa}\pgf@circ@res@left}{.95*\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xor port/aaa}\pgf@circ@res@left}{.95*\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@temp-\pgf@circ@res@other}{.95*\pgf@circ@res@down}} + + \pgfusepath{draw} +} + + + +\pgfcircdeclarelogicport{xnor}{ + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input height}\pgf@circ@res@up}} + + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input height}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint + {(\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/port width}-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input skip})*\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/input height}\pgf@circ@res@down}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/port width}\pgf@circ@res@right} + {0pt}} + + \pgfusepath{draw} + \pgf@circ@res@other=\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/port width}\pgf@circ@res@right + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/circle width}\pgf@circ@res@right + + \pgfsetlinewidth{2\pgflinewidth} + \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/aaa}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}} + + \pgfpathcurveto + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ddd}\pgf@circ@res@left}{\pgf@circ@res@up}} + {\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \def\pgf@circ@temp{-\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/distance}\pgf@circ@res@right+} + \pgfpathmoveto{\pgfpoint{\pgf@circ@temp-\pgf@circ@res@other}{\pgf@circ@res@up}} + + \pgfpathcurveto + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/aaa}\pgf@circ@res@left}{.95*\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@up}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{0pt}} + \pgfpathcurveto + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/bbb}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/ccc}\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@temp\pgfkeysvalueof{/tikz/circuitikz/tripoles/xnor port/aaa}\pgf@circ@res@left}{.95*\pgf@circ@res@down}} + {\pgfpoint{\pgf@circ@temp-\pgf@circ@res@other}{.95*\pgf@circ@res@down}} + + + \pgfpathellipse + {\pgfpoint{\pgf@circ@res@other-.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{.5\pgf@circ@res@step}{0pt}} + {\pgfpoint{0pt}{.5\pgf@circ@res@step}} + + \pgfusepath{draw} +} + + + + + +\newcommand{\pgfcircdeclaretransistor}[3]{ + \pgfdeclareshape{#1} + { + \anchor{center}{\pgfpointorigin} + \savedanchor\north{% + \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/height}\pgf@y + \pgf@y=.5\pgf@y + \pgf@x=0pt + } + \anchor{south}{ + \north + \pgf@y=-\pgf@y + } + \savedanchor\left{% + \pgf@y=0pt + \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/width}\pgf@x + } + #2 + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + + + \north + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = \pgf@x + \left + \pgf@circ@res@left = \pgf@x + + #3 + + } + } +} + + + + + + +\newcommand{\pgfcircdeclaremos}[3]{ + \pgfcircdeclaretransistor{#1}{ + \anchor{G}{ + \left + } + \anchor{gate}{ + \left + } + \anchor{B}{ + \left + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@x + } + \anchor{base}{ + \left + \pgf@x=\pgfkeysvalueof{/tikz/circuitikz/tripoles/#1/base width}\pgf@x + } + #2 + } + {#3} +} + + + + + + + + + +\pgfcircdeclaremos{nmos}{ + \anchor{D}{ + \north + } + \anchor{drain}{ + \north + } + \anchor{S}{ + \north + \pgf@y=-\pgf@y + } + \anchor{source}{ + \north + \pgf@y=-\pgf@y + } +}{% + \pgfmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base height}\pgf@circ@res@down}} + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/nmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} +} + + +\pgfcircdeclaremos{pmos}{ + \anchor{S}{ + \north + } + \anchor{source}{ + \north + } + \anchor{D}{ + \north + \pgf@y=-\pgf@y + } + \anchor{drain}{ + \north + \pgf@y=-\pgf@y + } +}{% + \pgfmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/base width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate height}\pgf@circ@res@down}} + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pmos/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} +} + + + + + + + +\pgfcircdeclaretransistor{pnp}{ + \anchor{E}{ + \north + } + \anchor{emitter}{ + \north + } + \anchor{B}{ + \left + } + \anchor{base}{ + \left + } + \anchor{C}{ + \north + \pgf@y=-\pgf@y + } + \anchor{collector}{ + \north + \pgf@y=-\pgf@y + } +}{ + \pgfmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/base height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height 2}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height}\pgf@circ@res@up}% + }{% + \pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate height 2}\pgf@circ@res@up}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/pnp/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + + +} + + + + + + +\pgfcircdeclaretransistor{npn}{ + \anchor{C}{ + \north + } + \anchor{collector}{ + \north + } + \anchor{B}{ + \left + } + \anchor{base}{ + \left + } + \anchor{E}{ + \north + \pgf@y=-\pgf@y + } + \anchor{emitter}{ + \north + \pgf@y=-\pgf@y + } +}{ + \pgfmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height 2}\pgf@circ@res@up}} + \pgfusepath{draw} + + \pgfscope + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/base height}\pgf@circ@res@up}} + \pgflineto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/base height}\pgf@circ@res@down}} + \pgfsetlinewidth{2\pgflinewidth} + \pgfusepath{draw} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height 2}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right} + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height}\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgftransformlineattime{.5}{% + \pgfpoint% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height 2}\pgf@circ@res@down}% + }{% + \pgfpoint{\pgf@circ@res@right}% + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate height}\pgf@circ@res@down}% + } + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} + \endpgfscope + + \pgfmoveto{\pgfpoint + {\pgfkeysvalueof{/tikz/circuitikz/tripoles/npn/gate width}\pgf@circ@res@left} + {\pgf@circ@res@up+\pgf@circ@res@down}} + \pgflineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}} + \pgfusepath{draw} + + +} + + +\endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcircutils.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcircutils.sty new file mode 100644 index 00000000000..7fa55c85998 --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcircutils.sty @@ -0,0 +1,49 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + + +\def\pgf@circ@handleSI#1{ + \noexpandarg + \def\pgf@temp{} + \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit] + \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len] + + \ifnum\pgf@circ@handleSI@unit@len=0 + \pgf@circ@siunitx@resfalse + \else + \IfEndWith{#1}{>}{ + \pgf@circ@siunitx@restrue +% \noexpandarg + \StrBefore{#1}{<}[\pgf@circ@handleSI@val] + }{ + \pgf@circ@siunitx@resfalse + } + \fi +} + +\def\pgf@circ@finallabel#1{% + \edef\pgf@temp{}% + \edef\pgf@circ@temp{\ctikzvalof{bipole/#1label/unit}}% + \ifx\pgf@temp\pgf@circ@temp% + \ctikzvalof{bipole/#1label/name}% + \else% + $\SI{\ctikzvalof{bipole/#1label/name}}{\ctikzvalof{bipole/#1label/unit}}$% + \fi% +} + +\def\pgf@circ@ifkeyempty#1{ + \pgfextra{ + \ctikzset{#1/.get=\pgf@circ@temp} + \edef\pgf@temp{} + } + \ifx\pgf@circ@temp\pgf@temp +} + + +\endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/pgfcircvoltage.sty b/Master/texmf-dist/tex/latex/circuitikz/pgfcircvoltage.sty new file mode 100644 index 00000000000..ecd97c2869b --- /dev/null +++ b/Master/texmf-dist/tex/latex/circuitikz/pgfcircvoltage.sty @@ -0,0 +1,248 @@ +% Copyright 2007-2009 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. +% +% See the file doc/LICENSE for more details. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Voltage management + + +\tikzset{v^>/.style = { + v = #1, + \circuitikzbasekey/bipole/voltage/direction = forward, + \circuitikzbasekey/bipole/voltage/position = above + } +} + +\tikzset{v^</.style = { + v = #1, + \circuitikzbasekey/bipole/voltage/direction = backward, + \circuitikzbasekey/bipole/voltage/position = above + } +} + +\tikzset{v_>/.style = { + v = #1, + \circuitikzbasekey/bipole/voltage/direction = forward, + \circuitikzbasekey/bipole/voltage/position = below + } +} + +\tikzset{v_</.style = { + v = #1, + \circuitikzbasekey/bipole/voltage/direction = backward, + \circuitikzbasekey/bipole/voltage/position = below + } +} + + +% Default position varies whether the component is a voltage source +% or not +\tikzset{v/.code = { + \ifpgf@circuit@bipole@isvoltage + \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above, + \circuitikzbasekey/bipole/voltage/direction=forward} + \else + \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below, + \circuitikzbasekey/bipole/voltage/direction=backward} + \fi + \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name=#1} + \ctikzsetvalof{bipole/voltage/label/unit}{} + \ifpgf@circ@siunitx + \pgf@circ@handleSI{#1} + \ifpgf@circ@siunitx@res + \edef\pgf@temp{\pgf@circ@handleSI@val} + \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp} + \edef\pgf@temp{\pgf@circ@handleSI@unit} + \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp} + \else + \fi + \else + \fi + } +} + +\tikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = below} } +\tikzset{v^/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = above} } +\tikzset{v>/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} } +\tikzset{v</.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = backward} } + + +%% Output routine for generic bipoles + +\def\pgf@circ@drawvoltagegeneric{ + \pgfextra{ + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@voltage@angle{90} + \else + \def\pgf@circ@voltage@angle{-90} + \fi + } + + coordinate (pgfcirc@mid) at ($(\tikztostart)! + \ctikzvalof{voltage/distance from node}! + (\ctikzvalof{bipole/name}.left) $) + coordinate (pgfcirc@Vfrom) at ($ (pgfcirc@mid)! + -\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen! + \pgf@circ@voltage@angle: + (\ctikzvalof{bipole/name}.left) $) + + coordinate (pgfcirc@mid) at ($(\tikztotarget)! + \ctikzvalof{voltage/distance from node} ! + (\ctikzvalof{bipole/name}.right)$) + coordinate (pgfcirc@Vto) at ($ (pgfcirc@mid)! + \ctikzvalof{voltage/distance from line}\pgf@circ@Rlen! + \pgf@circ@voltage@angle: + (\ctikzvalof{bipole/name}.right) $) + + \ifpgf@circuit@bipole@voltage@below + coordinate (pgfcirc@Vcont1) at ($ (\ctikzvalof{bipole/name}.center) ! + \ctikzvalof{voltage/bump b} ! + (\ctikzvalof{bipole/name}.-110) $) + coordinate (pgfcirc@Vcont2) at ($ (\ctikzvalof{bipole/name}.center) ! + \ctikzvalof{voltage/bump b} ! + (\ctikzvalof{bipole/name}.-70) $) + \else + coordinate (pgfcirc@Vcont1) at ($ (\ctikzvalof{bipole/name}.center) ! + \ctikzvalof{voltage/bump b} ! + (\ctikzvalof{bipole/name}.110) $) + coordinate (pgfcirc@Vcont2) at ($ (\ctikzvalof{bipole/name}.center) ! + \ctikzvalof{voltage/bump b} ! + (\ctikzvalof{bipole/name}.70) $) + \fi + + \ifpgf@circuit@europeanvoltage + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vto) .. controls (pgfcirc@Vcont2) and (pgfcirc@Vcont1) .. + node[currarrow, sloped, allow upside down, pos=1] {} + (pgfcirc@Vfrom) + \else + (pgfcirc@Vfrom) .. controls (pgfcirc@Vcont1) and (pgfcirc@Vcont2) .. + node[currarrow, sloped, allow upside down, pos=1] {} + (pgfcirc@Vto) + \fi + \else + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vfrom) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$+$} + (pgfcirc@Vto) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$-$} + \else + (pgfcirc@Vfrom) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$-$} + (pgfcirc@Vto) node[inner sep=0, anchor=\pgf@circ@bipole@voltage@label@anchor]{$+$} + \fi + \fi +} + +%% Output routine for voltage sources + +\def\pgf@circ@drawvoltagegenerator{ + \ifpgf@circuit@europeanvoltage + \ifpgf@circuit@bipole@voltage@below + coordinate (pgfcirc@Vcont1) at ($ (\ctikzvalof{bipole/name}.center) ! + \ctikzvalof{voltage/bump a} ! + (\ctikzvalof{bipole/name}.-120) $) + coordinate (pgfcirc@Vcont2) at ($ (\ctikzvalof{bipole/name}.center) ! + \ctikzvalof{voltage/bump a} ! + (\ctikzvalof{bipole/name}.-60) $) + \else + coordinate (pgfcirc@Vcont1) at ($ (\ctikzvalof{bipole/name}.center) ! + \ctikzvalof{voltage/bump a} ! + (\ctikzvalof{bipole/name}.120) $) + coordinate (pgfcirc@Vcont2) at ($ (\ctikzvalof{bipole/name}.center) ! + \ctikzvalof{voltage/bump a} ! + (\ctikzvalof{bipole/name}.60) $) + \fi + + \ifpgf@circuit@bipole@voltage@backward + (pgfcirc@Vcont2) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vcont1) + \else + (pgfcirc@Vcont1) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vcont2) + \fi + \fi +} + +%% Output routine + +\def\pgf@circ@drawvoltage{ % node name + \pgfextra{ + \edef\pgf@circ@ffffff{\ctikzvalof{bipole/direction}} + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil} + + \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north west} + \else \def\pgf@circ@bipole@voltage@label@anchor{south east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{west} + \else \def\pgf@circ@bipole@voltage@label@anchor{east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south west} + \else \def\pgf@circ@bipole@voltage@label@anchor{north east} + \fi + \fi\fi + \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south} + \else\def\pgf@circ@bipole@voltage@label@anchor{north} + \fi + \fi\fi + \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <256 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{south east} + \else\def\pgf@circ@bipole@voltage@label@anchor{north west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{east} + \else \def\pgf@circ@bipole@voltage@label@anchor{west} + \fi + \fi\fi + \ifnum\pgfcircmathresult >284 \ifnum\pgfcircmathresult <356 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north east} + \else\def\pgf@circ@bipole@voltage@label@anchor{south west} + \fi + \fi\fi + \ifnum\pgfcircmathresult <5 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi + \ifnum\pgfcircmathresult >355 + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@anchor{north} + \else\def\pgf@circ@bipole@voltage@label@anchor{south} + \fi + \fi + + \ifpgf@circuit@bipole@voltage@below + \def\pgf@circ@bipole@voltage@label@where{-90} + \else + \def\pgf@circ@bipole@voltage@label@where{90} + \fi + } + + \ifpgf@circuit@bipole@isvoltage + \pgf@circ@drawvoltagegenerator + \else + \pgf@circ@drawvoltagegeneric + \fi + + coordinate (Vlab) at ($(\ctikzvalof{bipole/name}.center)! + \ifpgf@circuit@europeanvoltage\ctikzvalof{voltage/european label distance}\else\ctikzvalof{voltage/american label distance}\fi! + (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where)$) + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=0] + at (Vlab) { \pgf@circ@finallabel{voltage/} } +} + |