summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex')
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex244
1 files changed, 197 insertions, 47 deletions
diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
index b9808d3ba7..d2606034ff 100644
--- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
+++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
@@ -138,7 +138,7 @@
(a2-|GND);
\draw (C.pin 3) to[D, fill=green] ++(0,-5)-- ++(0.5,0) to[R] ++(2,0)
coordinate(a3) to[short, -*]
- node[above left, blue]{Stefan Erhart}
+ node[above left, blue]{Stefan Erhardt}
node[below left,]{\email{stefan.erhardt@fau.de}}
(a3-|GND);
\draw (C.pin 1) to[D, fill=yellow] ++(0,-7)-- ++(0.5,0) to[R] ++(2,0)
@@ -358,7 +358,7 @@ somewhere in your document preamble. It will load automatically the needed packa
Let's say we want to prepare a circuit to teach how a current shunt works; the idea is to draw a current generator, a couple of resistors in parallel, and the indication of currents and voltages for the discussion.
-A circuit in \Circuitikz is drawn into a \texttt{circuitikz} environment (which is really an alias for \texttt{tikzpicture}). In this first example we will use absolute coordinates.
+A circuit in \Circuitikz{} is drawn into a \texttt{circuitikz} environment (which is really an alias for \texttt{tikzpicture}). In this first example we will use absolute coordinates.
The electrical components can be divided in two main categories: the one that are bipoles and are placed along a path (also known as \texttt{to}-style component, for their usage), and components that are nodes and can have any number of poles or connections.
Let's start with the first type of component, and build a basic mesh:
@@ -1362,7 +1362,7 @@ You can change the scale of the inductors by setting the key \texttt{inductors/s
You can change the width of these components (all the inductors together, unless you use style or scoping) by setting the key \texttt{inductors/width} to something different from the default, which is \texttt{0.8} for american and european inductors, and \texttt{0.6} for cute inductors.
Moreover, you can change the number of ``coils'' drawn by setting the key
-\texttt{inductors/coils} (default value \texttt{5} for cute inductors and \texttt{4} for american ones).
+\texttt{inductors/coils} (default value \texttt{5} for cute inductors and \texttt{4} for american ones). \textbf{Notice} that the minimum number of \texttt{coils} is \texttt{1} for american inductors, and \texttt{2} for cute ones.
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[
@@ -1942,11 +1942,13 @@ The size of the crossing elements can be changed with the key \texttt{bipoles/cr
\subsection{Arrows}\label{sec:arrows}
-These are pseudo-arrows used in lot of places in the packages (for transistors, flows, currents, and so on).
+These are pseudo-arrows used in lot of places in the packages (for transistors, flows, currents, and so on). The first three arrows are magnified by a factor~3 in the boxes below; for the \texttt{trarrow}, the anchor \texttt{tip} is exactly on the tip and \texttt{btip} is slightly receded.
\begin{groupdesc}
- \circuitdesc{currarrow}{Arrows (current and voltage)}{}(center/0/0.2)
- \circuitdesc{inputarrow}{Arrow to draw at its tip, useful for block diagrams.}{}(center/0/0.2)
+ \circuitdesc[3]{currarrow}{Arrow for current and voltage}{}(center/0/0.2)
+ \circuitdesc[3]{inputarrow}{Arrow that is anchored at its tip, useful for block diagrams.}{}(center/0/0.2)
+ \circuitdesc[3]{trarrow}{Arrow the same size of \texttt{currarrow} but only filled.}{}(center/90/0.2, tip/0/0.2, btip/-90/0.2)
+ \circuitdesc{flowarrow}{Arrow used for the flows, with a \texttt{text} anchor}{$I_p$}(center/-90/0.2, east/0/0.2, west/180/0.2, text/45/0.2)
\end{groupdesc}
\subsubsection{Arrows size}\label{sec:currarrow-size}
@@ -2193,10 +2195,9 @@ To show that a device is optional, you can dash it. The inner symbol will be kep
\subsection{Transistors}
+\subsubsection{Standard bipolar transistors}
+
\begin{groupdesc}
- \circuitdesc{nmos}{nmos}{}( G/180/0.2,D/0/0.2,S/0/0.2 )
- \circuitdesc{pmos}{pmos}{}
- \circuitdesc{hemt}{hemt}{}
\circuitdesc{npn}{npn}{}( B/180/0.2,C/0/0.2,E/0/0.2 )
\circuitdesc{pnp}{pnp}{}
\circuitdesc{npn,photo}{npn}{}( nobase/0/0.4 )
@@ -2207,7 +2208,69 @@ To show that a device is optional, you can dash it. The inner symbol will be kep
\circuitdesc{Lpigbt}{Lpigbt}{}
\end{groupdesc}
-For all transistors a body diode (or freewheeling diode) can automatically be drawn. Just use the global option bodydiode, or for single transistors, the tikz-option bodydiode:
+\subsubsection{Multi-terminal bipolar transistors}
+
+In addition to the standard BJTs transistors, since version~\texttt{0.9.6} the \texttt{bjtnpn} and \texttt{bjtpnp} are also available; these are devices where you can have more collectors and emitters (on the other hand, they have no \texttt{photo} nor \texttt{bodydiode} options --- they are silently ignored).
+
+Basically they are the same as the normal \texttt{npn} and \texttt{pnp}, and they (by default) have similar sizes; the options \texttt{collectors} and \texttt{emitters} will change the number of the relative terminals. The base terminal is connected midway from the collector and the emitter, \emph{not} on the center of the base; a \texttt{cbase} anchor is available if you prefer to use it. The label of the component (the text) is set on the right side, vertically centered around the base terminal.
+
+\begin{groupdesc}
+ \circuitdesc{bjtnpn, collectors=1, emitters=2}{bjt npn}{Q}(B/180/0.2, C/45/0.2, E/-45/0.2, C1/0/0.4, E1/0/0.4, E2/0/0.4, nobase/135/0.4, cbase/-135/0.4, center/0/0.6)
+ \circuitdesc{bjtpnp, collectors=3, emitters=2}{bjt pnp}{Q}(B/180/0.2, C/-45/0.2, E/45/0.2, C1/0/0.4, C2/0/0.4, C3/0/0.4, E1/0/0.4, E2/0/0.4, nobase/135/0.4, cbase/-135/0.4)
+\end{groupdesc}
+
+\subsubsection{Field-effect transistors}
+
+\begin{groupdesc}
+ \circuitdesc{nmos}{nmos}{}( G/180/0.2,D/0/0.2,S/0/0.2 )
+ \circuitdesc{pmos}{pmos}{}
+ \circuitdesc{hemt}{hemt}{}
+\end{groupdesc}
+
+\textsc{nfet}s and \textsc{pfet}s have been incorporated based on code provided by Clemens Helfmeier and Theodor Borsche. Use the package options \texttt{fetsolderdot}/\texttt{nofetsolderdot} to enable/disable solderdot at some fet-transistors. Additionally, the solderdot option can be enabled/disabled for single transistors with the option "solderdot" and "nosolderdot", respectm ively.
+
+\begin{groupdesc}
+ \circuitdesc{nfet}{nfet}{}
+ \circuitdesc{nigfete}{nigfete}{}
+ \circuitdesc{nigfete,solderdot}{nigfete}{}
+ \circuitdesc{nigfetebulk}{nigfetebulk}{}
+ \circuitdesc{nigfetd}{nigfetd}{}
+ \circuitdesc{pfet}{pfet}{}
+ \circuitdesc{pigfete}{pigfete}{}
+ \circuitdesc{pigfetebulk}{pigfetebulk}{}
+ \circuitdesc{pigfetd}{pigfetd}{}
+\end{groupdesc}
+
+\textsc{njfet} and \textsc{pjfet} have been incorporated based on code provided by Danilo Piazzalunga:
+\begin{groupdesc}
+ \circuitdesc{njfet}{njfet}{}
+ \circuitdesc{pjfet}{pjfet}{}
+\end{groupdesc}
+
+\textsc{isfet}
+\begin{groupdesc}
+ \circuitdesc{isfet}{isfet}{}
+\end{groupdesc}
+
+\subsubsection{Transistors customization}\label{sec:styling-transistors}
+
+The default position of the arrows in transistors is somewhat in the middle of the terminal; if you prefer you can move them to the end with the style key \texttt{transistors/arrow pos=end} (the default value is \texttt{legacy}).
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}
+ \ctikzset{tripoles/mos style=arrows}
+ \ctikzset{transistors/arrow pos=end}
+ \draw (0,0) node[npn, ](npn){};
+ \draw (2,0) node[pnp, ](npn){};
+ \draw (0,-2) node[nmos, ](npn){};
+ \draw (2,-2) node[pmos, ](npn){};
+\end{circuitikz}
+\end{LTXexample}
+
+You can change the scale of all the transistors by setting the key \texttt{transistors/scale} (default \texttt{1.0}).
+The size of the arrows (if any) is controlled by the same parameters as \texttt{currarrow} (see section~\ref{sec:currarrow-size}) and the dots on P-type transistors (if any) are the same as the nodes/poles (see section~\ref{sec:bipole-nodes}).
+
+For all transistors (minus \texttt{bjtnpn} and \texttt{bjtpnp}) a body diode (or freewheeling diode) can automatically be drawn. Just use the global option bodydiode, or for single transistors, the tikz-option bodydiode:
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
@@ -2246,6 +2309,14 @@ To draw the PMOS circle non-solid, use the option \texttt{emptycircle} or the co
\circuitdesc{pmos,nocircle,arrowmos}{pmos}{}
\end{groupdesc}
+You can add a bulk terminal\footnote{Thanks to Burak Kelleci <kellecib@hotmail.com>.} to \texttt{nmos} and \texttt{pmos} using the key \texttt{bulk} in the node (and \texttt{nobulk} if you set the bulk terminal by default); additional anchors \texttt{bulk} and \texttt{nobulk} are added (in the next example, \texttt{tripoles/mos style/arrows} is enacted, too):
+
+\begin{groupdesc}
+ \ctikzset{tripoles/mos style/arrows}
+ \circuitdesc{nmos, bulk}{pmos}{}(bulk/45/0.3, nobulk/-30/.4)
+ \circuitdesc{pmos, bulk}{pmos}{}
+\end{groupdesc}
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[
info/.style={left=1cm, blue, text width=5em, align=right},]
@@ -2262,30 +2333,14 @@ To draw the PMOS circle non-solid, use the option \texttt{emptycircle} or the co
node[pmos]{} (2,-8) node[nmos]{};
\end{circuitikz}\end{LTXexample}
-\textsc{nfet}s and \textsc{pfet}s have been incorporated based on code provided by Clemens Helfmeier and Theodor Borsche. Use the package options \texttt{fetsolderdot}/\texttt{nofetsolderdot} to enable/disable solderdot at some fet-transistors. Additionally, the solderdot option can be enabled/disabled for single transistors with the option "solderdot" and "nosolderdot", respectm ively.
+\subsubsection{Multiple terminal transistors customization}
-\begin{groupdesc}
- \circuitdesc{nfet}{nfet}{}
- \circuitdesc{nigfete}{nigfete}{}
- \circuitdesc{nigfete,solderdot}{nigfete}{}
- \circuitdesc{nigfetebulk}{nigfetebulk}{}
- \circuitdesc{nigfetd}{nigfetd}{}
- \circuitdesc{pfet}{pfet}{}
- \circuitdesc{pigfete}{pigfete}{}
- \circuitdesc{pigfetebulk}{pigfetebulk}{}
- \circuitdesc{pigfetd}{pigfetd}{}
-\end{groupdesc}
+You can create completely ``bare'' transistors (without the connection leads to the \texttt{B}, \texttt{C} y \texttt{E} terminals), by changing the parameter \texttt{tripoles/bjt/pins width} (default \texttt{0.3}; it is expressed as a fraction of the basic (scaled) length) or using the style \texttt{bjt pins width}; and you can change the distance between multiple collectors/emitters setting with \verb|\ctikzset{}| the parameter \texttt{tripoles/bjt/multi height/} (default \texttt{0.5}) or the style \texttt{bjt multi height}.
-\textsc{njfet} and \textsc{pjfet} have been incorporated based on code provided by Danilo Piazzalunga:
\begin{groupdesc}
- \circuitdesc{njfet}{njfet}{}
- \circuitdesc{pjfet}{pjfet}{}
+ \circuitdesc{bjtnpn, collectors=2, emitters=2, bjt pins width=0, bjt multi height=0.8}{bjt npn with parameters}{Q}(B/180/0.2, C/45/0.2, E/-45/0.2, C1/0/0.4, C2/0/0.4, E1/0/0.4, E2/0/0.4, nobase/-135/0.4, cbase/135/0.4)
\end{groupdesc}
-\textsc{isfet}
-\begin{groupdesc}
- \circuitdesc{isfet}{isfet}{}
-\end{groupdesc}
\subsubsection{Transistors anchors}
@@ -2341,6 +2396,55 @@ For \textsc{npn}, \textsc{pnp}, \textsc{nigbt} and \textsc{pigbt} transistors, t
;\end{circuitikz}
\end{LTXexample}
+Finally, all transistors, except the multi-terminal \texttt{bjtnpn} and \texttt{bjtpnp}, (since \texttt{0.9.6}) have internal nodes on the terminal corners, called \texttt{inner up} and \texttt{inner down}; you do not normally need them, but they are here for special applications:
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}
+ \node [npn](A) at(0,2) {};
+ \node [pmos](B) at(0,0) {};
+ \foreach \e in {A, B}
+ \foreach \a in {inner up, inner down} {
+ \node[red, circle, inner sep=1pt, draw]
+ at (\e.\a) {};
+ \node [right, font=\tiny, blue]
+ at (\e.\a) {\a};
+ }
+\end{circuitikz}
+\end{LTXexample}
+
+
+The multi-terminal transistors have all the geographical anchors; note though that the \texttt{center} anchor is not the geometrical center of the component, but the logical one (at the same height than the base).
+The additional anchors \texttt{vcenter} (vertical geometric center of the collector--emitter zone) and \texttt{gcenter} (graphical center) are provided, as shown in the following picture.
+
+\begin{quote}
+\geocoord{bjtnpn, collectors=1, emitters=2}
+\showanchors{bjtpnp, collectors=4, emitters=1, bjt pins width=0.6}{}(north/90/0.4, east/0/0.4, south/-90/0.4, west/180/0.4, center/120/0.3, vcenter/0/0.4, gcenter/-120/0.4, cbase/-60/0.6)
+\end{quote}
+
+A complete example of multiple terminal transistor application is the following PNP double current mirror circuit.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \ctikzset{transistors/arrow pos=end}
+ \draw (0,0) node[bjtpnp, xscale=-1](Q1){%
+ \scalebox{-1}[1]{Q1}};
+ \draw (Q1.B) node[bjtpnp, anchor=B, collectors=2]
+ (Q2){Q2} (Q1.B) node[circ]{};
+ \draw (Q1.E) node[circ]{} node[vcc]{} (Q2.E)
+ node[vcc]{} (Q1.E) -| (Q1.B);
+ \draw (Q1.C) to[R, l_=$R_0$, f=$I_0$] ++(0,-3.5)
+ node[ground](GND){};
+ \draw (Q2.C) -- ++(0,-0.5) coordinate(a);
+ \draw (Q2.C1) -- ++(1,0) coordinate(b) -- (b|-a);
+ \draw (a) ++(0,-0.1) node[flowarrow, rotate=-90,
+ anchor=west]{\rotatebox{90}{$I_0$}};
+ \draw (b|-a) ++(0,-0.1) node[flowarrow, rotate=-90,
+ anchor=west]{\rotatebox{90}{$I_0$}};
+ \path (b) ++(0.5,0); % bounding box adjust
+\end{circuitikz}
+\end{LTXexample}
+
+
Here is one composite example (please notice that the \texttt{xscale=-1} style would also reflect the label of the transistors, so here a new node is added and its text is used, instead of that of \texttt{pnp1}):
\begin{LTXexample}[varwidth=true]
@@ -2397,22 +2501,6 @@ Transistor paths have the possibility to use the poles syntax (see section~\ref{
The \texttt{name} property is available also for bipoles; this is useful mostly for triac, potentiometer and thyristor (see~\ref{sec:othertrip}).
-\subsubsection{Transistors customization}\label{sec:styling-transistors}
-
-The default position of the arrows in transistors is somewhat in the middle of the terminal; if you prefer you can move them to the end with the style key \texttt{transistors/arrow pos=end} (the default value is \texttt{legacy}).
-
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}
- \ctikzset{transistors/arrow pos=end}
- \draw (0,0) node[npn, ](npn){};
- \draw (2,0) node[pnp, ](npn){};
- \draw (0,-2) node[nmos, ](npn){};
- \draw (2,-2) node[pmos, ](npn){};
-\end{circuitikz}
-\end{LTXexample}
-
-You can change the scale of all the transistors by setting the key \texttt{transistors/scale} (default \texttt{1.0}).
-The size of the arrows (if any) is controlled by the same parameters as \texttt{currarrow} (see section~\ref{sec:currarrow-size}) and the dots on P-type transistors (if any) are the same as the nodes/poles (see section~\ref{sec:bipole-nodes}).
\subsection{Electronic Tubes}
@@ -2801,6 +2889,8 @@ You can change the aspect of a quadpole using the corresponding parameters \text
Transformers also inherits the \texttt{inductors/scale} (see~\ref{sec:tweak-l}) and similar parameters. It's your responsibility to set the aforementioned parameters if you change the scale or width of inductors.
+Transformers core line distance is specified by the parameter \texttt{quadpoles/transformer core/core width} (default \texttt{0.05}) and the thickness of the lines follows the choke one; in other words, you can set it changing \texttt{bipoles/cutechoke/cthick}.
+
Another very useful parameter is \texttt{quadpoles/*/inner} (default \texttt{0.4}) that determine which part of the component is the ``vertical'' one. So, setting that parameter to 1 will eliminate the horizontal part of the component (obviously, to maintain the general aspect ratio you need to change the width also):
@@ -2837,6 +2927,66 @@ This can be useful if you want to put seamlessly something in series with either
\end{LTXexample}
+\subsubsection{Styling transformer's coils independently}
+
+Since \texttt{0.9.6}, you can tweak the style of each of the coils of the transformers by
+changing the value of the two styles \texttt{transformer L1} and \texttt{transformer L2};
+the default for both are \texttt{\{\}}, that means inherit the inductors style in force.
+
+\begin{LTXexample}[pos=t, basicstyle=\small\ttfamily]
+\begin{circuitikz}[american]
+ \begin{scope}
+ \ctikzset{transformer L1/.style={inductors/coils=1, inductors/width=0.2}}
+ \draw (0,0) node[transformer core](T1){};
+ \end{scope}
+ \draw (3,0) node[transformer](T2){};
+ \ctikzset{cute inductors, quadpoles style=inline}
+ \ctikzset{transformer L1/.style={inductors/coils=2, inductors/width=0.2}}
+ \draw (6,0) node[transformer core](T3){};
+ \ctikzset{transformer L1/.style={american inductors, inductors/coils=1, inductors/width=0.2}}
+ \ctikzset{transformer L2/.style={inductors/coils=7, inductors/width=1.0}}
+ \draw (9,0) node[transformer ](T4){};
+ \foreach \t in {T1, T2, T3, T4} {
+ \foreach \l in {L1, L2} {
+ \foreach \a/\c in {a/blue, b/red}
+ \node [circle, fill=\c, inner sep=1pt] at (\t-\l.\a) {};
+ }
+ }
+\end{circuitikz}
+\end{LTXexample}
+
+\textbf{Caveat:} the size of the transformer is independent from the styles for \texttt{L1} and \texttt{L2}, so they follow whatever the parameters for the inductances were before applying them. In other words, the size of the transformer could result too small if you are not careful.
+
+\begin{LTXexample}[varwidth, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \ctikzset{transformer L1/.style={inductors/width=1.8, inductors/coils=13}}
+ % too small!
+ \draw (0,0) node[transformer core](T1){};
+ % adjust it
+ \ctikzset{quadpoles/transformer core/height=2.4}
+ \draw (2.5,0) node[transformer core](T1){};
+\end{circuitikz}
+\end{LTXexample}
+
+You can obviously define a style for a ``non-standard'' transformer. For example, you can have a current transformer\footnote{Suggested by Alex Pacini on \href{https://github.com/circuitikz/circuitikz/issues/297}{GitHub}} defined like this:
+
+\begin{LTXexample}[varwidth, basicstyle=\small\ttfamily]
+\begin{circuitikz}[
+ TA core/.style={transformer core,
+ % at tikz level, you have to use circuitikz/ explicitly
+ circuitikz/quadpoles style=inline,
+ circuitikz/transformer L1/.style={
+ american inductors, inductors/coils=1,
+ inductors/width=0.3},
+ } ]
+ \draw (0,0) node[TA core](T1){};
+ % changes are local
+ \draw (0,-3) node[transformer]{};
+\end{circuitikz}
+\end{LTXexample}
+
+Remember that the default \texttt{pgfkeys} directory is \texttt{/tikz} for nodes and for the options of the environment, so you \emph{have} to use the full path (with \texttt{circuitikz/}) there.
+
\subsection{Amplifiers}
\begin{groupdesc}
@@ -3373,8 +3523,8 @@ If otherwise \texttt{europeanports} option is active (or the style \texttt{[euro
There is no ``european'' version of these symbols.
\begin{groupdesc}
- \circuitdesc*{schmitt}{Non-Inverting \textsc{Schmitttrigger}}{}
- \circuitdesc*{invschmitt}{Inverting \textsc{Schmitttrigger}}{}
+ \circuitdesc*{schmitt}{Non-Inverting Schmitt trigger}{}
+ \circuitdesc*{invschmitt}{Inverting Schmitt trigger}{}
\end{groupdesc}
\subsubsection{Logic port customization}