From 3afcae17b4a1a6dffbaa749a6fd0b6406c4d34a9 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 13 Oct 2019 03:01:18 +0000 Subject: CTAN sync 201910130301 --- graphics/pgf/contrib/circuitikz/doc/changelog.tex | 32 ++ .../contrib/circuitikz/doc/circuitikz-context.pdf | Bin 15503 -> 15498 bytes .../contrib/circuitikz/doc/circuitikzmanual.pdf | Bin 750300 -> 773291 bytes .../contrib/circuitikz/doc/circuitikzmanual.tex | 385 ++++++++++++++------- 4 files changed, 297 insertions(+), 120 deletions(-) (limited to 'graphics/pgf/contrib/circuitikz/doc') diff --git a/graphics/pgf/contrib/circuitikz/doc/changelog.tex b/graphics/pgf/contrib/circuitikz/doc/changelog.tex index ab413a5a92..5d22e52f18 100644 --- a/graphics/pgf/contrib/circuitikz/doc/changelog.tex +++ b/graphics/pgf/contrib/circuitikz/doc/changelog.tex @@ -4,6 +4,38 @@ here. See \url{https://github.com/circuitikz/circuitikz/commits} for a full list of changes. \begin{itemize} +\item + Version 0.9.5 (2019-10-12) + + This release basically add features to better control labels, voltages + and similar text ``ornaments'' on bipoles, plus some other minor + things. + + On the bug fixes side, a big incompatibility with ConTeXt has been + fixed, thanks to help from \texttt{@TheTeXnician} and \texttt{@hmenke} + on \texttt{github.com}. + + \begin{itemize} + \tightlist + \item + Added a ``midtap'' anchor for coils and exposed the inner coils + shapes in the transformers + \item + Added a ``curved capacitor'' with polarity coherent with + ``ecapacitor'' + \item + Added the possibility to apply style and access the nodes of + bipole's text ornaments (labels, annotations, voltages, currents and + flows) + \item + Added the possibility to move the wiper in resistive potentiometers + \item + Added a command to load and set a style in one go + \item + Fixed internal font changing commands for compatibility with ConTeXt + \item + Fixed hardcoded black color in ``elko'' and ``elmech'' + \end{itemize} \item Version 0.9.4 (2019-08-30) diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf index 5c5c1080a1..a87cc0a40e 100644 Binary files a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf and b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf differ diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf index 710c67cb8a..c325cc1d07 100644 Binary files a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf and b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf differ diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex index 06a6f5ab5c..b9808d3ba7 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex @@ -1041,23 +1041,28 @@ For example, \emph{amplifiers} have the legacy class of \texttt{tripoles}, as we \subsubsection{Style files} -When using styles, it is possible to use \emph{style files} (see section~\ref{sec:writingstylefiles}), that then you can load with the command \verb|\ctikzloadstyle|. For example, in the distribution you have a number of style files: \texttt{legacy}, \texttt{romano}, \texttt{example}.When you load a style name \texttt{\emph{name}}, you will have available a style called \texttt{\emph{name} circuit style} that you can apply to your circuits. +When using styles, it is possible to use \emph{style files} (see section~\ref{sec:writingstylefiles}), that then you can load with the command \verb|\ctikzloadstyle|. For example, in the distribution you have a number of style files: \texttt{legacy}, \texttt{romano}, \texttt{example}. When you load a style name \texttt{\emph{name}}, you will have available a style called \texttt{\emph{name} circuit style} that you can apply to your circuits. The last style loaded is not enacted --- you have to explicitly do it if you want the style used by default, by putting for example in the preamble: -\begin{lstlisting} +\begin{lstlisting}[numbers=none] \ctikzloadstyle{romano} \tikzset{romano circuit style} \end{lstlisting} Please notice that the style is at \TikZ{} level, not \Circuitikz --- that let's you use it in the top option of the circuit, like: -\begin{lstlisting} +\begin{lstlisting}[numbers=none] \begin{circuitikz}[legacy circuit style, ..., ] ... \end{circuitikz} \end{lstlisting} +If you just want to use one style, you can load and activate it in one command with + +\begin{lstlisting}[numbers=none] + \ctikzsetstyle{romano} +\end{lstlisting} The \texttt{example} style file will simply make the amplifiers filled with light blue: @@ -1240,6 +1245,24 @@ Other miscellaneous resistor-like devices: \circuitdescbip*[thermistorntc]{thRn}{NTC thermistor}{thermistor ntc} \end{groupdesc} + +\subsubsection{Potentiometers: wiper position} + +Since version \texttt{0.9.5}, you can control the position of the wiper in potentiometers using the key \texttt{wiper pos}, which is a number in the range $[0,1]$. The default middle position is \texttt{wiper pos=0.5}. + + +\begin{LTXexample}[varwidth, basicstyle=\small\ttfamily] +\begin{circuitikz}[american] + \ctikzset{resistors/width=1.5, resistors/zigs=9} + \draw (0,0) to[pR, name=A] ++(0,-4); + \draw (1.5,0) to[pR, wiper pos=0.3, name=B] ++(0,-4); + \ctikzset{european resistors} + \draw (3,0) to[pR, wiper pos=0.8, name=C] ++(0,-4); + \foreach \i in {A, B, C} + \node[right] at (\i.wiper) {\i}; +\end{circuitikz} +\end{LTXexample} + \subsubsection{Generic sensors anchors}\label{sec:sensors-anchors} Generic sensors have an extra anchor named \texttt{label} to help position the type of dependence, if needed: @@ -1282,13 +1305,19 @@ For the american style resistors, you can change the number of ``zig-zags'' by s \begin{groupdesc} \circuitdescbip{capacitor}{Capacitor}{C} - \circuitdescbip[pcapacitor]{polar capacitor}{Polar capacitor}{pC} + \circuitdescbip[ccapacitor]{curved capacitor}{Curved (polarized) capacitor}{cC} \circuitdescbip*{ecapacitor}{Electrolytic capacitor}{eC,elko} \circuitdescbip[vcapacitor]{variable capacitor}{Variable capacitor}{vC} \circuitdescbip[capacitivesens]{capacitive sensor}{Capacitive sensor}{sC}(label/0/0.3) \circuitdescbip*{piezoelectric}{Piezoelectric Element}{PZ} \end{groupdesc} +There is also the (deprecated\footnote{Thanks to \href{https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong}{Anshul Singhv for noticing}.} --- its polarity is not coherent with the rest of the components) \texttt{polar capacitor}: + +\begin{groupdesc} + \circuitdescbip[pcapacitor]{polar capacitor}{Polar capacitor}{pC} +\end{groupdesc} + \subsubsection{Capacitive sensors anchors} For capacitive sensors, see section~\ref{sec:sensors-anchors}. @@ -1302,7 +1331,7 @@ You can change the scale of the capacitors by setting the key \texttt{capacitors If the \texttt{cuteinductors} option is active (default behaviour), or the style \texttt{[cute inductors]} is used, the inductors are displayed as follows: \begin{groupdesc} \ctikzset{inductor=cute} - \circuitdescbip[cuteinductor]{L}{Inductor}{cute inductor} + \circuitdescbip[cuteinductor]{L}{Inductor}{cute inductor}(midtap/90/0.1) \circuitdescbip[cutechoke]{cute choke}{Choke}{} \circuitdescbip[vcuteinductor]{vL}{Variable inductor}{variable cute inductor} \circuitdescbip[scuteinductor]{sL}{Inductive sensor}{cute inductive sensor}( label/0/0.3 ) @@ -1311,7 +1340,7 @@ If the \texttt{cuteinductors} option is active (default behaviour), or the style If the \texttt{americaninductors} option is active (or the style \texttt{[american inductors]} is used), the inductors are displayed as follows: \begin{groupdesc} \ctikzset{inductor=american} - \circuitdescbip[americaninductor]{L}{Inductor}{american inductor} + \circuitdescbip[americaninductor]{L}{Inductor}{american inductor}(midtap/90/0.3) \circuitdescbip[vamericaninductor]{vL}{Variable inductor}{variable american inductor} \circuitdescbip[samericaninductor]{sL}{Inductive sensor}{american inductive sensor}( label/0/0.3 ) \end{groupdesc} @@ -1319,15 +1348,12 @@ If the \texttt{americaninductors} option is active (or the style \texttt{[americ Finally, if the \texttt{europeaninductors} option is active (or the style \texttt{[european inductors]} is used), the inductors are displayed as follows: \begin{groupdesc} \ctikzset{inductor=european} - \circuitdescbip[fullgeneric]{L}{Inductor}{european inductor} + \circuitdescbip[fullgeneric]{L}{Inductor}{european inductor}(midtap/90/0.1) \circuitdescbip[tfullgeneric]{vL}{Variable inductor}{variable european inductor} \circuitdescbip[sfullgeneric]{sL}{Inductive sensor}{european inductive sensor}( label/0/0.3 ) \ctikzset{inductor=cute} % back to default \end{groupdesc} -\subsubsection{Inductive sensors anchors} - -For inductive sensors, see section~\ref{sec:sensors-anchors}. \subsubsection{Inductors customizations}\label{sec:tweak-l} @@ -1363,6 +1389,26 @@ Chokes (which comes only in the \texttt{cute} style) can have single and double \end{circuitikz} \end{LTXexample} +\subsubsection{Inductors anchors} + +For inductive sensors, see section~\ref{sec:sensors-anchors}. + +Inductors have an additional anchor, called \texttt{midtap}, that connects to the center of the coil ``wire''. Notice that this anchor could be on one side or the other of the component, depending on the number of loops of the element; if you need a fixed position, you can use the geographical anchors. + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz}[ + loops/.style={circuitikz/inductors/coils=#1}] +\ctikzset{cute inductors} +\draw (0,2) to[L, loops=5, name=A] ++(2,0) +to[L, loops=6, name=B] ++(2,0); +\ctikzset{american inductors} +\draw (0,0) to[L, loops=5, name=C] ++(2,0) +to[L, loops=6, name=D] ++(2,0); +\foreach \i in {A, B, C, D} + \node[circle, fill=red, inner sep=1pt] at (\i.midtap){}; +\end{circuitikz} +\end{LTXexample} + \subsection{Diodes and such} There are three basic styles for diodes: \texttt{empty} (fillable in color), \texttt{full} (completely filled with the draw color) and \texttt{stroke} (empty, but with a line across them). @@ -1901,7 +1947,6 @@ These are pseudo-arrows used in lot of places in the packages (for transistors, \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*{bnc}{BNC connector}{}(left/135/0.6, right/45/0.6, center/-90/0.6, hot/0/0.6, zero/-135/0.6) \end{groupdesc} \subsubsection{Arrows size}\label{sec:currarrow-size} @@ -2703,6 +2748,40 @@ A couple of examples follow: ;\end{circuitikz} \end{LTXexample} +Moreover, you can access the two internal coils (inductances); if your transformer node is called \texttt{T}, they are named \texttt{T-L1} and \texttt{T-L2}. Notice that the two inductors are rotated (by -90 degrees the first, +90 degrees the second) so you have to be careful with the anchors. Also, the \texttt{midtap} anchor of the inductors can be on the external or internal side depending on the numbers of coils. Finally, the anchors \texttt{L1.a} and \texttt{L1.b} are marking the start and end of the coils. + +\begin{quote} +\begin{circuitikz}[american inductors, + ] + \def\coordx(#1)[#2:#3]#4{node[circle, #4, draw, inner sep=1pt,pin={[#4, overlay, inner sep=0.5pt, font=\scriptsize, pin distance=#2cm, pin edge={#4, overlay,}]#3:#1}](){}} + \draw (-2,0) (0, 0) node[transformer](T){}; + \foreach \a/\d/\t in {L1.midtap/0.2/180, L1.south west/0.2/180, L1.south east/0.2/180, + L2.south/0.2/0, L2.south west/0.2/0, L2.south east/0.2/0} + \path (T-\a) \coordx(T-\a)[\d:\t]{red}; + \ctikzset{cute inductors} + \draw (4, 0) node[transformer](T){}; + \foreach \a/\d/\t in {L1.a/0.2/-120, L1.b/0.2/120, + L2.midtap/0.5/0, L2.south west/0.2/0, L2.south east/0.2/0} + \path (T-\a) \coordx(T-\a)[\d:\t]{blue}; + \node[font=\small\ttfamily,above] at (T.north) {inductors/coils=5}; + \draw (8, 0) node[transformer, circuitikz/inductors/coils=6](T){}; + \foreach \a/\d/\t in {L2.a/0.2/120, L2.b/0.2/-120, + L2.midtap/0.2/0, L2.south west/0.2/0, L2.south east/0.2/0} + \path (T-\a) \coordx(T-\a)[\d:\t]{red}; + \node[font=\small\ttfamily,above] at (T.north) {inductors/coils=6}; +\end{circuitikz} +\end{quote} + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz} +\draw (0,0) node[ground](GND){} to [sV] ++(0,2) -- ++(1,0) + node[transformer, circuitikz/inductors/coils=6, + anchor=A1](T){}; +\draw (T.A2) to[short, -*] (T.A2-|GND); +\draw (T-L2.midtap) to[short, *-o] (T.B1 |- T-L2.midtap); +\node [ocirc] at (T.B1){}; \node [ocirc] at (T.B2){}; +\end{circuitikz} +\end{LTXexample} \subsubsection{Double dipoles customization} Transformers are in the \texttt{inductors} class (also the gyrator\dots), so they scale with the key \texttt{inductors/scale}. @@ -3662,6 +3741,7 @@ A couple of examples are shown below. \end{LTXexample} + \section{Labels and similar annotations} \begin{LTXexample}[varwidth=true] @@ -4222,7 +4302,9 @@ This could be especially useful if you define a style, to use like this: \draw (0,-2) to[R,v_<=$V_S$] ++(2,0); \end{circuitikz} \end{LTXexample} -\subsubsection{Global properties of voltages and currents} + + +\subsection{Global properties of voltages and currents} \begin{LTXexample}[varwidth=true] \tikz \draw (0,0) to[R, v=1<\volt>] (2,0); \par @@ -4249,320 +4331,383 @@ However, you can override the properties \texttt{voltage/distance from node} (ho Note the \texttt{.initial}; you have to create such key the first time you use it. +\subsection{Changing the style of labels and text ornaments} -\subsection{Nodes (also called poles)}\label{sec:bipole-nodes} +Since version \texttt{0.9.5}, it is possible to change the style of bipole text ornaments (labels, annotations, voltages etc) by using the appropriate styles or keys. +The basic style applied to the text are defined in the \texttt{/tikz/circuitikz} key directory and applied to every node that contains the text; you can also change them locally by using the \texttt{tikz} direct keys in local scopes. -You can add nodes to the bipoles, positioned at the coordinates surrounding the component. The general style to use is \texttt{bipole nodes=\{start\}\{stop\}}, where \texttt{start} and \texttt{stop} are the nodes --- to be chosen between \texttt{none}, \texttt{circ}, \texttt{ocirc}, \texttt{squarepole}, \texttt{osquarepole}, \texttt{diamondpole}, \texttt{odiamondpole} and \texttt{rectfill}\footnote{You can use other shapes too, but at your own risk\dots Moreover, notice that \texttt{none} is not really a node, just a special word used to say ``do not put any node here''.} (see section~\ref{sec:terminals}). +For example, you can make all annotations small by using: +\begin{lstlisting}[numbers=none] +\ctikzset{bipole annotation style/.style={font=\small}} +\end{lstlisting} -\begin{LTXexample}[varwidth=true, - basicstyle=\small\ttfamily - ] -\begin{circuitikz} - \ctikzset{bipoles/length=.5cm, nodes width=0.1}%small components, big nodes - \foreach \a/\p [evaluate=\a as \b using (\a+180)] in - {-90/none, -60/circ, -30/ocirc, 0/diamondpole, 30/odiamondpole, 60/squarepole, 90/osquarepole} - \draw (0,0) to[R, bipole nodes={none}{\p}] ++(\a:1.5) node[font=\tiny, anchor=\b]{\p}; +And the change (override) the setting in one specific bipole using: + +\begin{lstlisting}[numbers=none] +...to[bipole annotation style={color=red}, R, a={Red note}]... +\end{lstlisting} + +where the annotation will be in normal font (it has been reset!) and red, or append to the style: + +\begin{lstlisting}[numbers=none] +...to[bipole annotation append style={color=red}, R, a={Red small note}]... +\end{lstlisting} + +\textbf{Caveat:} you have to put the style changing key at the start of the \texttt{to} arguments to have any effect\footnote{No, I do not know why. Hints and fixes are welcome.}. + +The available styles and commands are \texttt{bipole label style}, \texttt{bipole annotation style}, \texttt{bipole voltage style}, \texttt{bipole current style}, and \texttt{bipole flow style}. The following example shows a bit of everything. + + +\begin{LTXexample}[pos=t, basicstyle=\small\ttfamily ] +\begin{circuitikz}[american] + \ctikzset{bipole annotation style/.style={font=\tiny}} + \ctikzset{bipole current style/.style={font=\small\sffamily}} + \draw (0,0) to [bipole annotation append style={fill=yellow}, R=L1, a=A1] ++(3,0) + to [bipole label style={fill=cyan}, R, l2_=L2 and 2L, a^=A2] ++(3,0); + \draw (7,0) to [bipole voltage style={color=blue}, + bipole flow style={fill=green, outer sep=5pt}, + R=R1, v=V1, i=I1, f>^=F1] ++(3,0) + to [bipole current append style={color=red}, R, v<=V2, i^=I2, f>^=F2] ++(3,0); \end{circuitikz} \end{LTXexample} -These bipole nodes are added after the path is drawn, as every node in Ti\emph{k}Z --- this is the reason why they are always filled (with the main color the normal nodes, with white the open ones), in order to ``hide'' the wire below. You can override the fill color if you want; but notice that if you draw things in two different paths, you will have ``strange'' results; notice that in the second line of resistors the second wire is starting from the center of the white \texttt{ocirc} of the previous path. +\subsection{Labels in special components} -\begin{LTXexample}[varwidth=true, - pos=t, basicstyle=\small\ttfamily - ] +For some components label, current and voltage behave as one would expect: + +\begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, *-o] ++(2,0) to[R, -d] ++(2,0) - to[R, bipole nodes={diamondpole}{odiamondpole, fill=red}] ++(2,0); - \draw (0,-1) to[R, *-o] ++(2,0) ; - \draw (2,-1) to[R, -d] ++(2,0) to[R, bipole nodes={none}{squarepole}] ++(2,0); + \draw (0,0) to[I=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} -You can define shortcuts for the \texttt{bipole nodes} you use most; for example if you want a shortcut for a bipole with open square node in red in the right side you can: - -\begin{LTXexample}[varwidth=true, - basicstyle=\small\ttfamily - ] +\begin{LTXexample}[varwidth=true] \begin{circuitikz} - \ctikzset{-s/.style = {bipole nodes={none}{osquarepole, fill=red}}} - \draw (0,0) to[R, -s] ++(2,0); + \draw (0,0) to[I, i=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} -There are several predefined shorthand as the above; in the following pages you can see all of them. \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, o-o] (2,0); + \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[R, -o] (2,0); + \draw (0,0) to[sI=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, o-] (2,0); + \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 \texttt{[american currents]}. + \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, *-*] (2,0); +\begin{circuitikz}[american currents] + \draw (0,0) to[I=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, -*] (2,0); +\begin{circuitikz}[american currents] + \draw (0,0) to[I, i=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} + \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, *-] (2,0); +\begin{circuitikz}[american currents] + \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[R, d-d] (2,0); +\begin{circuitikz}[american currents] + \draw (0,0) to[sI=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, -d] (2,0); +\begin{circuitikz}[american currents] + \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[R, d-] (2,0); + \draw (0,0) to[V=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, o-*] (2,0); + \draw (0,0) to[V, v=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} + \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, *-o] (2,0); + \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[R, o-d] (2,0); + \draw (0,0) to[sV=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, d-o] (2,0); + \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 \texttt{[american voltages]}. + \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, *-d] (2,0); +\begin{circuitikz}[american voltages] + \draw (0,0) to[V=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, d-*] (2,0); +\begin{circuitikz}[american voltages] + \draw (0,0) to[V, v=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} -\subsection{Special components} +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltages] + \draw (0,0) to[cV=$k v_e$] (2,0); +\end{circuitikz} +\end{LTXexample} -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); +\begin{circuitikz}[american voltages] + \draw (0,0) to[sV=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[I, i=$a_1$] (2,0); +\begin{circuitikz}[american voltages] + \draw (0,0) to[csV=$k v_e$] (2,0); \end{circuitikz} \end{LTXexample} +\subsection{Integration with {\ttfamily siunitx}} + +If the option {\ttfamily siunitx} is active (and \emph{not} in \ConTeXt), then the following are equivalent: \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[cI=$k\cdot a_1$] (2,0); + \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[sI=$a_1$] (2,0); + \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[csI=$k\cdot a_1$] (2,0); + \draw (0,0) to[R, i=1<\milli\ampere>] (2,0); \end{circuitikz} \end{LTXexample} -The following results from using the option \texttt{americancurrent} or using the style \texttt{[american currents]}. - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[I=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, i=$\SI{1}{\milli\ampere}$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[I, i=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, v=1<\volt>] (2,0); \end{circuitikz} \end{LTXexample} - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[cI=$k\cdot a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, v=$\SI{1}{\volt}$] (2,0); \end{circuitikz} \end{LTXexample} +\subsection{Accessing labels text nodes} -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[sI=$a_1$] (2,0); +Since 0.9.5, you can access all the labels nodes\footnote{The access to \texttt{label}s and \texttt{annotation}s was present before, but not documented.} using special node names. So, if you use \texttt{name} to give a name to the bipole node, you can access also the following nodes: \texttt{namelabel} (notice: no space nor any other symbol between \texttt{name} and \texttt{label}!), \texttt{nameannotation}, \texttt{namevoltage}, \texttt{namecurrent} and \texttt{nameflow}. + +\begin{LTXexample}[varwidth=true, + pos=t, basicstyle=\small\ttfamily + ] +\newcommand{\marknode}[2][45]{% + \node[circle, draw, red, inner sep=1pt, + pin={[red, font=\tiny]#1:#2}] at (#2.center) {}; +} +\begin{circuitikz}[ american] + \draw (0,0) to [R=L1, a=A1, name=L1] ++(3,0) + to [R, l2_=L2 and 2L, a^=A2, name=L2] ++(3,0); + \marknode{L1} \marknode{L1label} \marknode[0]{L1annotation} + \marknode{L2} \marknode[0]{L2label} \marknode{L2annotation} + \draw[blue] (L2label.south west) rectangle (L2label.north east); + \draw (6.1,0) to [R=R1, v=V1, i=I1, f>^=F1, name=R1] ++(3,0) + to [R, v<=V2, i^=I2, f>^=F2, name=R2] ++(3,0); + \marknode[0]{R1voltage} \marknode[0]{R2voltage} \marknode[90]{R1current} + \marknode[90]{R2current} \marknode{R1flow} \marknode{R2flow} \end{circuitikz} \end{LTXexample} -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[csI=$k\cdot a_1$] (2,0); + +\section{Using bipoles in circuits} + +\subsection{Nodes (also called poles)}\label{sec:bipole-nodes} + +You can add nodes to the bipoles, positioned at the coordinates surrounding the component. The general style to use is \texttt{bipole nodes=\{start\}\{stop\}}, where \texttt{start} and \texttt{stop} are the nodes --- to be chosen between \texttt{none}, \texttt{circ}, \texttt{ocirc}, \texttt{squarepole}, \texttt{osquarepole}, \texttt{diamondpole}, \texttt{odiamondpole} and \texttt{rectfill}\footnote{You can use other shapes too, but at your own risk\dots Moreover, notice that \texttt{none} is not really a node, just a special word used to say ``do not put any node here''.} (see section~\ref{sec:terminals}). + + +\begin{LTXexample}[varwidth=true, + basicstyle=\small\ttfamily + ] +\begin{circuitikz} + \ctikzset{bipoles/length=.5cm, nodes width=0.1}%small components, big nodes + \foreach \a/\p [evaluate=\a as \b using (\a+180)] in + {-90/none, -60/circ, -30/ocirc, 0/diamondpole, 30/odiamondpole, 60/squarepole, 90/osquarepole} + \draw (0,0) to[R, bipole nodes={none}{\p}] ++(\a:1.5) node[font=\tiny, anchor=\b]{\p}; \end{circuitikz} \end{LTXexample} -The same holds for voltage sources: +These bipole nodes are added after the path is drawn, as every node in Ti\emph{k}Z --- this is the reason why they are always filled (with the main color the normal nodes, with white the open ones), in order to ``hide'' the wire below. You can override the fill color if you want; but notice that if you draw things in two different paths, you will have ``strange'' results; notice that in the second line of resistors the second wire is starting from the center of the white \texttt{ocirc} of the previous path. -\begin{LTXexample}[varwidth=true] +\begin{LTXexample}[varwidth=true, + pos=t, basicstyle=\small\ttfamily + ] \begin{circuitikz} - \draw (0,0) to[V=$a_1$] (2,0); + \draw (0,0) to[R, *-o] ++(2,0) to[R, -d] ++(2,0) + to[R, bipole nodes={diamondpole}{odiamondpole, fill=red}] ++(2,0); + \draw (0,-1) to[R, *-o] ++(2,0) ; + \draw (2,-1) to[R, -d] ++(2,0) to[R, bipole nodes={none}{squarepole}] ++(2,0); \end{circuitikz} \end{LTXexample} -\begin{LTXexample}[varwidth=true] +You can define shortcuts for the \texttt{bipole nodes} you use most; for example if you want a shortcut for a bipole with open square node in red in the right side you can: + +\begin{LTXexample}[varwidth=true, + basicstyle=\small\ttfamily + ] \begin{circuitikz} - \draw (0,0) to[V, v=$a_1$] (2,0); + \ctikzset{-s/.style = {bipole nodes={none}{osquarepole, fill=red}}} + \draw (0,0) to[R, -s] ++(2,0); \end{circuitikz} \end{LTXexample} +There are several predefined shorthand as the above; in the following pages you can see all of them. \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[cV=$k\cdot a_1$] (2,0); + \draw (0,0) to[R, o-o] (2,0); \end{circuitikz} \end{LTXexample} - \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[sV=$a_1$] (2,0); + \draw (0,0) to[R, -o] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[csV=$k\cdot a_1$] (2,0); + \draw (0,0) to[R, o-] (2,0); \end{circuitikz} \end{LTXexample} -The following results from using the option \texttt{americanvoltage} or the style \texttt{[american voltages]}. - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[V=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, *-*] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[V, v=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, -*] (2,0); \end{circuitikz} \end{LTXexample} - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[cV=$k v_e$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, *-] (2,0); \end{circuitikz} \end{LTXexample} - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[sV=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, d-d] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[csV=$k v_e$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, -d] (2,0); \end{circuitikz} \end{LTXexample} -\subsection{Integration with {\ttfamily siunitx}} - -If the option {\ttfamily siunitx} is active (and \emph{not} in \ConTeXt), then the following are equivalent: - \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, l=1<\kilo\ohm>] (2,0); + \draw (0,0) to[R, d-] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, l=$\SI{1}{\kilo\ohm}$] (2,0); + \draw (0,0) to[R, o-*] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, i=1<\milli\ampere>] (2,0); + \draw (0,0) to[R, *-o] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, i=$\SI{1}{\milli\ampere}$] (2,0); + \draw (0,0) to[R, o-d] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, v=1<\volt>] (2,0); + \draw (0,0) to[R, d-o] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, v=$\SI{1}{\volt}$] (2,0); + \draw (0,0) to[R, *-d] (2,0); \end{circuitikz} \end{LTXexample} - - +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, d-*] (2,0); +\end{circuitikz} +\end{LTXexample} \subsection{Mirroring and Inverting} Bipole paths can also mirrored and inverted (or reverted) to change the drawing direction. -- cgit v1.2.3