From 3510255768e52c447c3d8235956be041a40456f3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 31 Oct 2021 21:07:56 +0000 Subject: circuitikz (31oct21) git-svn-id: svn://tug.org/texlive/trunk@60910 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/doc/latex/circuitikz/changelog.tex | 24 +++ .../doc/latex/circuitikz/circuitikzmanual.pdf | Bin 1441298 -> 1460564 bytes .../doc/latex/circuitikz/circuitikzmanual.tex | 184 ++++++++++++++++----- 3 files changed, 165 insertions(+), 43 deletions(-) (limited to 'Master/texmf-dist/doc/latex') diff --git a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex index 0ce9902781b..b715c12dc0f 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex @@ -4,6 +4,30 @@ here. See \url{https://github.com/circuitikz/circuitikz/commits} for a full list of changes. \begin{itemize} +\item + Version 1.4.4 (2021-10-31) + + Normal maintenance release; minor bugs fixed, a new component and a + new option. No Halloween component, sorry\ldots{} + + \begin{itemize} + \tightlist + \item + Added a laser diode component + (\href{https://github.com/circuitikz/circuitikz/issues/591}{contributed + by André Alves}) + \item + Add the \texttt{override\ source\ vif} option and better describe + source's voltage positioning in the manual + \item + fix \texttt{nobase} option with IGBT family (noticed by + \href{https://tex.stackexchange.com/q/619334/38080}{user hinata exc + on Stack Eschange}) + \item + fix a problem with + \href{https://github.com/circuitikz/circuitikz/issues/584}{legacy + open voltage label position} + \end{itemize} \item Version 1.4.3 (2021-09-06) diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf index 37b39c62f3d..57f2065ef9b 100644 Binary files a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf and b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf differ diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex index b29332aca21..79e63594759 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex @@ -1147,21 +1147,23 @@ Will create the final diagram: \section{The components: usage} -Components in \Circuitikz{} come in two forms: path-style, to be used in \texttt{to} path specifications, and node-style, which will be instantiated by a \texttt{node} specification. +Components in \Circuitikz{} come in two forms: path-style, to be used in a \texttt{to[\emph{component},...} path specifications, and node-style, which will be instantiated by a \texttt{node[\emph{component},...]} specification. + +All the shapes defined by Circui\TikZ{} are \texttt{pgf} nodes, so they are usable in both \texttt{pgf} and \TikZ. \subsection{Path-style components} The path-style components are used as shown below: \begin{lstlisting} \begin{circuitikz} - \draw (0,0) to[#1=#2, #options] (2,0); + \draw (0,0) to[#1=#2, options] (2,0); \end{circuitikz} \end{lstlisting} where \verb|#1| is the name of the component, \verb|#2| is an (optional) label, and \verb|options| are optional labels, annotations, style specifier that will be explained in the rest of the manual. Transistors and some other node-style components can also be placed using the syntax for bipoles. See section~\ref{sec:transasbip}. -Most path-style components can be used as a node-style components; to access them, you add a \texttt{shape} to the main name of component (for example, \texttt{diodeshape}). Such a ``node name'' is specified in the description of each component. +Most path-style components can be used as a node-style components; to access them, you add a \texttt{shape} to the main name of component (for example, \texttt{diodeshape}). Such a ``node-shape name'' is specified in the description of each component. \subsubsection{Anchors} @@ -1184,7 +1186,7 @@ Normally, path-style components do not need anchors, although they have them jus \path (R.\n) \showcoord(\n)<\a:\d>; \end{circuitikz} \end{center} -In the case of bipoles, also shortened geographical anchors exists. In the description, it will be shown when a bipole has additional anchors. To use the anchors, just give a name to the bipole element. +In the case of bipoles, also shortened geographical anchors exists. In the description, it will be shown when a bipole has additional anchors. To use the anchors, just give a name to the bipole element using the syntax \texttt{name=\emph{myname}}. \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -1333,7 +1335,7 @@ can be interpreted as the length of a resistor (including reasonable connections ;\end{circuitikz} \end{LTXexample} -The changes on \texttt{bipoles/length} should, however, be globally applied to every path, because they affect every element --- including the poles. So you can have artifacts like these: +The changes on \texttt{bipoles/length} should, however, be globally applied to every path, because they affect every element --- including the poles. So you can have artifacts like the one in the second line below: \begin{LTXexample}[varwidth=true] \begin{circuitikz}[ @@ -1399,6 +1401,8 @@ where you have all the needed information about the bipole, with also no-standar The \emph{Class} of the component (see section~\ref{sec:styling}) is printed at the end of the description. +Most path-style components can be used as a node-style components; to access them, normally you add a \texttt{shape} to the main name of component (for example, \texttt{diodeshape}). Sometimes though the ``node name'' is different, so it is specified in the description of each component. + \subsection{Node-style components} Node-style components (monopoles, multipoles) can be drawn at a specified point with this syntax, where \verb!#1! is the name of the component: \begin{lstlisting} @@ -1413,7 +1417,6 @@ Explanation of the parameters:\\ \texttt{\#3}: name of an anchor (optional)\\ \texttt{\#4}: text written to the text anchor of the component (optional)\\ -Most path-style components can be used as a node-style components; to access them, you add a \texttt{shape} to the main name of component (for example, \texttt{diodeshape}). Such a ``node name'' is specified in the description of each component. \begin{framed} \noindent \textbf{Notice:} Nodes must have curly brackets at the end, even when empty. An optional anchor (\texttt{\#3}) can be defined within round brackets to be addressed again later on. And please don't forget the semicolon to terminate the \texttt{\textbackslash draw} command. @@ -1457,7 +1460,7 @@ In other formats they are undefined; contributions to fill the gap are welcome. \subsubsection{Anchors} -Node components anchors are variable across the various kind of components, so they will described better after each category is presented in the manual. +Node components anchors vary a lot across the various kind of components, so they will described better after each category is presented in the manual. In general all components have geographic anchors (\texttt{north}, \texttt{north west}, \dots), but most of the other anchors are very component-specific. \subsubsection{Descriptions} @@ -1467,7 +1470,6 @@ The typical entry in the component list will be like this: \circuitdesc{npn}{\scshape npn}{}( B/180/0.2,C/0/0.2,E/0/0.2 ) \end{groupdesc} -All the shapes defined by Circui\TikZ. These are all \texttt{pgf} nodes, so they are usable in both \texttt{pgf} and \TikZ. If the component can be filled it will be specified in the description. In addition, as an example, the component shown will be filled with the option \texttt{fill=cyan!30!white}: \begin{groupdesc} @@ -1584,7 +1586,7 @@ so if will not be colored green!): \tmpcirc{scale=0.8, transform shape}{\ctikzset{resistors/scale=0.8, capacitors/scale=0.7, diodes/scale=0.6, transistors/scale=1.3,% amplifiers/fill=cyan, sources/fill=green, diodes/fill=red, resistors/fill=violet,}} -Please use this option with caution. Although two-color circuits can be nice, using more than that can become rapidly unbearable. +Please use this option with caution. Although two-colors circuits can be nice, using more than that can become rapidly unbearable. Old textbooks used the two-color style quite extensively, filling with a kind of light blue like \texttt{blue!30!white} ``closed'' components, but that was largely to hinder black-and-white photocopying\dots \subsubsection{Line thickness}\label{sec:styling-thickness} @@ -1968,7 +1970,9 @@ If you want that the arrows behave like the legacy symbols (which are shapes), \ \circuitdescbip*{memristor}{Memristor}{Mr} \end{groupdesc} -If \texttt{americanresistors} option is active (or the style \texttt{[american resistors]} is used; this is the default for the package), the resistors are displayed as follows: +Both \texttt{shortshape} and \texttt{openshape} are not really supposed to be used; they are dummy shapes used as placeholders for the path-drawing routines. + +If \texttt{americanresistors} option is active (or the style \texttt{[american resistors]} is used --- this is the default for the package), the resistors are displayed as follows: \begin{groupdesc} \ctikzset{resistor=american} \circuitdescbip[resistor]{R}{Resistor}{american resistor} @@ -2112,15 +2116,11 @@ ferroelectric capacitors that could be used to show the state of the hysteresis \end{tikzpicture} \end{LTXexample} -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} +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}; please do not use it. \subsubsection{Capacitive sensors anchors} -For capacitive sensors, see section~\ref{sec:sensors-anchors}. +For capacitive sensors, you have the same anchors than in the case of resistive sensors, see section~\ref{sec:sensors-anchors}. \subsubsection{Capacitors customizations}\label{sec:capacitors-styling} @@ -2226,7 +2226,7 @@ Moreover, you can change the number of ``coils'' drawn by setting the key \subsubsection{Inductors anchors} -For inductive sensors, see section~\ref{sec:sensors-anchors}. +For inductive sensors, you have the same anchors than in the case of resistive sensors, see section~\ref{sec:sensors-anchors}. \paragraph{Taps.} 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. @@ -2285,7 +2285,9 @@ The package options \texttt{fulldiode}, \texttt{strokediode}, and \texttt{emptyd \circuitdescbip*[emptyzzdiode]{empty ZZener diode}{Empty ZZener diode}{zzDo} \circuitdescbip*[emptytdiode]{empty tunnel diode}{Empty tunnel diode}{tDo} \circuitdescbip*[emptypdiode]{empty photodiode}{Empty photodiode}{pDo} - \circuitdescbip*[emptylediode]{empty led}{Empty led}{leDo} + \circuitdescbip*[emptylediode]{empty led}{Empty led}{leDo} + \circuitdescbip*[emptylaserdiode]{empty laser diode}{Empty laser diode\footnotemark}{lasD} + \footnotetext{Added by André Alves in \texttt{v1.4.4}} \circuitdescbip*[emptyvarcap]{empty varcap}{Empty varcap}{VCo} \circuitdescbip*[emptybidirectionaldiode]{empty bidirectionaldiode}{Empty bidirectionaldiode}{biDo} \circuitdescbip[fulldiode] {full diode}{Full diode}{D*} @@ -2295,6 +2297,7 @@ The package options \texttt{fulldiode}, \texttt{strokediode}, and \texttt{emptyd \circuitdescbip[fulltdiode]{full tunnel diode}{Full tunnel diode}{tD*} \circuitdescbip[fullpdiode]{full photodiode}{Full photodiode}{pD*} \circuitdescbip[fulllediode]{full led}{Full led}{leD*} + \circuitdescbip[fulllaserdiode]{full laser diode}{Full laser diode}{lasD*} \circuitdescbip[fullvarcap]{full varcap}{Full varcap}{VC*} \circuitdescbip[fullbidirectionaldiode]{full bidirectionaldiode}{Full bidirectionaldiode}{biD*} \end{groupdesc} @@ -2309,6 +2312,7 @@ These shapes have no exact node-style counterpart, because the stroke line is bu \circuitdescbip*[emptytdiode]{stroke tunnel diode}{Stroke tunnel diode}{tD-} \circuitdescbip*[emptypdiode]{stroke photodiode}{Stroke photodiode}{pD-} \circuitdescbip*[emptylediode]{stroke led}{Stroke led}{leD-} + \circuitdescbip*[emptylaserdiode]{stroke laser diode}{Stroke laser diode}{lasD-} \circuitdescbip*[emptyvarcap]{stroke varcap}{Stroke varcap}{VC-} \end{groupdesc} @@ -2802,7 +2806,7 @@ So the solution is often changing the structure to keep the meters in horizontal Since version 0.9.0 you have more options for the measuring instruments. You can use the generic \texttt{rmeterwa} (round meter with arrow), to which you can specify the internal symbol with the option \texttt{t=...} (and is fillable). \begin{LTXexample}[varwidth=true] - \begin{circuitikz}[american] +\begin{circuitikz}[american] \draw (0,0) -- ++(1,0) to[R] ++(2,0) to [rmeterwa, t=A, i=$i$] ++(0,-2) node[ground]{}; \draw (1,0) to[rmeterwa, t=V, v=$v$] ++(0,-2) @@ -2813,7 +2817,7 @@ Since version 0.9.0 you have more options for the measuring instruments. You can This kind of component will keep the symbol horizontal, whatever the orientation: \begin{LTXexample}[varwidth=true] - \begin{circuitikz}[american] +\begin{circuitikz}[american] \draw (0,0) -- ++(1,0) to[R] ++(2,0) to [rmeterwa, t=A, i=$i$] ++(2,0) -- ++(0,-1) node[ground]{}; @@ -2833,7 +2837,6 @@ The plain \texttt{rmeter} is the same, without the measuring arrow: \end{circuitikz} \end{LTXexample} - If you prefer it, you have the option to use square meters, in order to have more visual difference from generators: \begin{LTXexample}[varwidth=true] @@ -3015,7 +3018,7 @@ All circuit-drawing standards agree that to show a crossing without electric con \end{circuitikz} \end{LTXexample} -However, sometime it is advisable to mark the non-contact situation more explicitly. To this end, you can use a path-style component called \texttt{crossing}: +However, sometimes it is advisable to mark the non-contact situation more explicitly. To this end, you can use a path-style component called \texttt{crossing}: \begin{LTXexample}[varwidth=true] \begin{circuitikz}[] @@ -3141,6 +3144,7 @@ The BNC connector is defined so that you can easily connect it as input or outpu \begin{circuitikz} \draw (0,0) node[bnc](B1){$v_i$} to[R=\SI{50}{\ohm}] ++(3,0) + % you can also use \ctikzflipx{$v_o$} in LaTeX node[bnc, xscale=-1](B2){\scalebox{-1}[1]{$v_o$}}; \node [ground] at (B1.shield) {}; \node [eground] at (B2.shield){}; @@ -3251,7 +3255,7 @@ Those components have also \textbf{deprecated} anchors named \texttt{1, 2, 3, 4} \end{circuitikz} \end{LTXexample} -The Wilkinson divider has: +The Wilkinson divider has (notice that the node text is outside the bounding box, similarly to what happens for transistors!): \begin{LTXexample}[varwidth=true] \begin{circuitikz} \draw @@ -3614,7 +3618,7 @@ The mark will follow the \texttt{transistors} class thickness, but you can adjus \paragraph{IGBT outer base.} -Normally, in bipolar IGBTs the outer base is the same size (height) of the inner one, and of the same thickness (which will depend on the class thickness value). You can change this by setting (via \verb|\ctikzset`|) the keys \texttt{tripoles/igbt/outer base height} (default \texttt{0.4}, the same as \texttt{base height}), and \texttt{tripoles/igbt/outer base thickness} (default \texttt{1.0}), which will be relative to the class thickness. +Normally, in bipolar IGBTs the outer base is the same size (height) of the inner one, and of the same thickness (which will depend on the class thickness value). You can change this by setting (via \verb|\ctikzset|) the keys \texttt{tripoles/igbt/outer base height} (default \texttt{0.4}, the same as \texttt{base height}), and \texttt{tripoles/igbt/outer base thickness} (default \texttt{1.0}), which will be relative to the class thickness. \begin{LTXexample}[varwidth=true, pos=t] \begin{circuitikz} @@ -3682,6 +3686,9 @@ To draw the PMOS circle non-solid, use the option \texttt{emptycircle} or the co \circuitdesc{pmos, bulk}{pmos}{} \circuitdesc{nmosd, bulk}{nmos depletion}{}(bulk/45/0.3, nobulk/-30/.4) \circuitdesc{pmosd, bulk}{pmos depletion}{} + \circuitdesc{nigbt}{nigbt}{}(nobase/135/0.3, nobulk/-30/.4) + \circuitdesc{pigbt, nobase}{pigbt with no base terminal\footnotemark}{}(nobase/135/0.3, nobulk/-30/.4) + \footnotetext{Since \texttt{v1.4.4}, noticed by \href{https://tex.stackexchange.com/q/619334/38080}{user \texttt{hinata exc} on Stack Exchange}.} \end{groupdesc} \begin{LTXexample}[varwidth=true] @@ -4347,6 +4354,7 @@ The first port, to the left, is port \texttt{A}, having the anchors \texttt{A1} They also expose the \texttt{base} anchor, for labelling, and anchors for setting dots or signs to specify polarity. The set of anchors, to which the standard ``geographical'' \texttt{north}, \texttt{north east}, etc. is here: +\medskip \begin{quote} \begin{circuitikz}[cute inductors, ] @@ -4370,6 +4378,7 @@ The set of anchors, to which the standard ``geographical'' \texttt{north}, \text } \end{circuitikz} \end{quote} +\medskip Also, the standard ``geographical'' \texttt{north}, \texttt{north east}, etc. are defined. A couple of examples follow: @@ -4876,8 +4885,8 @@ These are all of the to-style type: \circuitdescbip[ncs]{normal closed switch}{Normally closed switch}{ncs} \circuitdescbip[pushbutton]{push button}{Normally open push button}{normally open push button, nopb}(tip/0/0.2) \circuitdescbip[ncpushbutton]{normally closed push button}{Normally closed push button}{ncpb}(tip/0/0.2) - \circuitdescbip[pushbuttonc]{normally open push button closed}{Normally open push button}{nopbc}(tip/0/0.2) - \circuitdescbip[ncpushbuttono]{normally closed push button open}{Normally closed push button}{ncpbo}(tip/0/0.2) + \circuitdescbip[pushbuttonc]{normally open push button closed}{Normally open push button (in closed position)}{nopbc}(tip/0/0.2) + \circuitdescbip[ncpushbuttono]{normally closed push button open}{Normally closed push button (in open position)}{ncpbo}(tip/0/0.2) \circuitdescbip[toggleswitch]{toggle switch}{Toggle switch}{} \circuitdescbip*{reed}{Reed switch}{} \end{groupdesc} @@ -5206,7 +5215,7 @@ There is no ``european'' version of the following symbols; for now they are use In addition to the legacy ports, since release 1.1.0, logic ports following the recommended geometry of distinctive-shape symbols in IEEE Std 91a-1991 Annex A (Recommended symbol proportions) are also available\footnote{Thanks to Jason for proposing it and digging out the info, see this \href{https://github.com/circuitikz/circuitikz/issues/383}{GitHub issue}.}. -These ports are completely independent from the legacy set (either \texttt{american} or \texttt{european}); they are not eanbled by default because the relative size of the ports is very different from the legacy ones, and that will disrupt every schematic (especially if drawn with absolute coordinate). If you want to use them as default, you can use the command \verb|\ctikzset{logic ports=ieee}| and by default the shapes \texttt{and port}, \texttt{or port} and so on will be the IEEE standard ones. +These ports are completely independent from the legacy set (either \texttt{american} or \texttt{european}); they are not enabled by default because the relative size of the ports is very different from the legacy ones, and that will disrupt every schematic (especially if drawn with absolute coordinate). If you want to use them as default, you can use the command \verb|\ctikzset{logic ports=ieee}| and by default the shapes \texttt{and port}, \texttt{or port} and so on will be the IEEE standard ones. The transmission gate (also known as ``bowtie'') components are not described in the IEEE standard, so they are simply inspired by the other IEEE ports --- this is why their name is prefixed by \texttt{ieee} and not by \texttt{ieeestd}. They are aliased to \texttt{tgate} and \texttt{double tgate} though, and it is recommended to use those names (maybe in the future there will be \texttt{american ports} and/or \texttt{european ports} versions available). @@ -5539,7 +5548,7 @@ The first one is to scale the port; if you set the port height so that it has th \end{circuitikz} \end{LTXexample} -But then the size of the port is quite ``unusual''. The solution is technical literature is to use what we can call a ``rack'' for the inputs; basically, only a certain number of pins are kept on the port, and the other are put on an extended input line. +But then the size of the port is quite ``unusual''. The solution in technical literature is to use what we can call a ``rack'' for the inputs; basically, only a certain number of pins are kept on the port, and the other are put on an extended input line. \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -5872,8 +5881,8 @@ As you can see, in a void flip flop no external pins are drawn: you have to defi To define a specific flip-flop, you have to set a series of keys under the \verb|\ctikzset| directory \texttt{multipoles/flipflop/}, corresponding to pins \texttt{1}\dots \texttt{6}, \texttt{u} for ``up'' and \texttt{d} for ``down'': \begin{itemize} \item a \emph{text} value \texttt{t0}, \texttt{t1}, \dots \texttt{t6}, and \texttt{tu} and \texttt{td} (the last ones for up and down) which will set a label on the pin; - \item a \emph{clock wedge} flag (\texttt{c0}, \dots \texttt{c6}, \texttt{cu}, \texttt{cd}), with value \texttt{0} or \texttt{1}, which will draw a triangle shape on the border of the correspondig pin; - \item a \emph{negation} flag (\texttt{n0}, \dots \texttt{n6}, \texttt{nu}, \texttt{nd}), with value \texttt{0} or \texttt{1}, which will put and \texttt{ocirc} shape on the outer border of the correspondig pin. + \item a \emph{clock wedge} flag (\texttt{c0}, \dots \texttt{c6}, \texttt{cu}, \texttt{cd}), with value \texttt{0} or \texttt{1}, which will draw a triangle shape on the border of the corresponding pin; + \item a \emph{negation} flag (\texttt{n0}, \dots \texttt{n6}, \texttt{nu}, \texttt{nd}), with value \texttt{0} or \texttt{1}, which will put and \texttt{ocirc} shape on the outer border of the corresponding pin. \end{itemize} To set all this keys, an auxiliary style \texttt{flipflop def} is defined, so that you can do the following thing: @@ -6573,15 +6582,17 @@ A couple of examples are shown below. \section{Labels, voltages and currents} +You can add ``decorations'' to the path-style components; there are basically five types of them: labels, annotations, voltages, currents, and flows. Let's see an example of all of them\dots + \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, l=$R_1$] (2,0); + \draw (0,0) to[R, l=$R_1$, f=$i_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R=$R_1$] (2,0); + \draw (0,0) to[R=$R_1$, a=\SI{1}{\kohm}] (2,0); \end{circuitikz} \end{LTXexample} @@ -6611,11 +6622,12 @@ A couple of examples are shown below. \end{LTXexample} -Long names/styles for the bipoles can be used: +Long names/styles for the bipoles can be used, of course, and there is a special syntax (that works only in simple cases --- use it with caution!) if you load the package with the `siunitx` options: + \begin{LTXexample}[varwidth=true] \begin{circuitikz}\draw - (0,0) to[resistor=1<\kilo\ohm>] (2,0) -;\end{circuitikz} + (0,0) to[resistor=1<\kilo\ohm>] (2,0); +\end{circuitikz} \end{LTXexample} \subsection{Labels and Annotations} @@ -6637,7 +6649,7 @@ When drawing a component left-to-right, the label \texttt{l} is by default above \end{circuitikz} \end{LTXexample} -For passive components, you can use \texttt{type=text} as a shortcut for \texttt{type, l=text}: +For passive components, you can use \texttt{\emph{component type}=text} as a shortcut for \texttt{\emph{component type}, l=text}: \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -6919,6 +6931,92 @@ Note the \texttt{.initial}; you have to create such key the first time you use i One common request is to change the style of the arrows (both head and line) of these elements. Voltages, currents and flows are part of the same path of the component, so this is not possible in simple way; you have to drawn your own with \TikZ{} commands using the facilities explained in section~\ref{sec:vif-anchors}. +\subsubsection{Special treatment for generators}\label{sec:source-vif} + +The ``active'' elements (sources and batteries, mainly) are treated differently from passive elements, in the sense that the default current and voltage direction and position could be different\footnote{This, in hindsight, has been a bad feature --- and I'm partly responsible for it. But removing it would create \emph{too small} variations in circuits, easily to go unnoticed, so it stays: nobody wants \emph{wrong} circuits just by recompiling.} following the chosen global voltage direction strategy (see section~\ref{curr-and-volt}). If they change or not depend on both the element and the chosen \texttt{voltage dir} option. + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{tikzpicture}[] + \draw (0,0) to[sV, v=$V_s$] ++(2,0) + to[battery, v=$V_B$] ++(2,0) + to[R, v=$V_R$] ++(2,0); +\end{tikzpicture} +\end{LTXexample} + +The consistency between symbols drawings and the default voltage and current directions are designed to work well \emph{when this default is enabled}. If you want, though, you can override this behavior by ``switching off'' the source status of the component by setting the property \texttt{bipole/is voltage} to \texttt{false}: + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{tikzpicture}[] + \draw (0,0) to[sV, bipole/is voltage=false, + v=$V_s$] ++(2,0) + to[battery, bipole/is voltage=false, + v=$V_B$] ++(2,0) + to[R, v=$V_R$] ++(2,0); +\end{tikzpicture} +\end{LTXexample} + +When you do this, \textbf{be careful} that (as you can see) the direction of the plain \texttt{v=...} option will change (please notice that this does not mean that it is incorrect, given that the voltage and current direction are arbitrary; in the case above, if the battery is a \SI{3}{V} one, $V_B=\SI{-3}{V}$ with the \texttt{RPvoltages} conventions). + +Also, notice that there is an ordering problem in the \texttt{to[...]} options: you have to switch the \texttt{is voltage} property off \textbf{before} setting the voltage, otherwise you will have a mix of the source-type and passive positioning: + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{tikzpicture}[] + % correct way + \draw (0,0) to[sV, bipole/is voltage=false, v=$V_s$] ++(2,0) + % wrong way, setting voltage before changing type + to[sV=$V_B$ , bipole/is voltage=false, ] ++(2,0); +\end{tikzpicture} +\end{LTXexample} + +In the first \texttt{to[]} command, the voltage is set before changing the type (assigning a value to the name of the element is understood as a \texttt{v=...} command for voltage sources). + +A similar switch is present for current generators, called \texttt{bipoles/.is current}, acting in a very similar way. + +If you would prefer to switch to the \texttt{is voltage=false, is current=false} behavior by default, you can (since \texttt{v1.4.4}\footnote{Suggested by user \href{https://github.com/circuitikz/circuitikz/issues/590}{\texttt{@judober} on GitHub}.}) by setting the option \texttt{bipole/override source vif} to \texttt{true}. This is \emph{highly} experimental, so use with care. + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{tikzpicture}[] + \draw (0,0) to [battery=vb] ++(2,0) + to[sV=sV] ++(2,0) to[R, v=vR] ++(2,0); + \ctikzset{bipole/override source vif=true} + \draw (0,-2) to [battery=vb] ++(2,0) + to[sV=sV] ++(2,0) to[R, v=vR] ++(2,0); +\end{tikzpicture} +\end{LTXexample} + +Notice that the option \texttt{override source vif} is ``stronger'' than the normal \texttt{is voltage}; so to locally re-set the behavior for just one source, you need to disable that \emph{before} using a voltage designator. + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{tikzpicture}[american] + % dangerous option ahead: USE WITH CARE + \ctikzset{bipole/override source vif=true} + % ugly output, you should really use V>=va + \draw (0,6) to [V=va] ++(2,0); + % not working! + \draw (0,4) to [V=va, bipole/override source vif=false] ++(2,0); + % ok, this one is working --- you need both settings! + \draw (0,2) to [V, + bipole/override source vif=false, + bipole/is voltage=true, + v=va] ++(2,0); +\end{tikzpicture} +\end{LTXexample} + +Clearly, if you find yourself using the last component often, it is better to define a style, which will save you a lot of typing and help readability: + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\tikzset{myV/.style={V, bipole/override source vif=false, + bipole/is voltage=true, v={#1}}}% +\begin{tikzpicture}[american] + % dangerous option ahead: USE WITH CARE + \ctikzset{bipole/override source vif=true} + \draw (0,0) to [V>=va] ++(2,0); + \draw (0,-2) to[myV=vb] ++(2,0); +\end{tikzpicture} +\end{LTXexample} + +On the other way around, you could use styles to set \texttt{is voltage=false} only on the components you use and without using the global switch --- which is the recommended way of doing it. + \subsection{Currents}\label{sec:currents} Inline (along the wire) currents are selected with \verb|i_>|, \verb|i^<|, \verb|i>_|, \verb|i>^|, and various combination; the default position and direction is obtained with the simple key \verb|i=...|. @@ -6983,7 +7081,7 @@ Also notice that the direction of the path is important: \end{circuitikz} \end{LTXexample} -Default directions can change if the component is active or passive,\footnote{This, in hindsight, has been a bad feature --- and I'm partly responsible for it. But removing it would create \emph{too small} variations in circuits, so it stays.} following the chosen global voltage direction strategy (see section~\ref{curr-and-volt}). +Default directions can change if the component is active or passive,\footnote{This is better explained in section~\ref{sec:source-vif}} following the chosen global voltage direction strategy (see section~\ref{curr-and-volt}). \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -7145,7 +7243,7 @@ Moreover, for historical reasons, voltage generators have differently looking ar \end{circuitikz} \end{LTXexample} -You can change this last thing by forcing ``off'' the status of ``voltage generator'' of the component; but now the normal (passive) rule will apply, so, again, be careful. +You can change this last thing by forcing ``off'' the status of ``voltage generator'' of the component; but now the normal (passive) rule will apply, so, again, be careful and read section~\ref{sec:source-vif}. \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -7210,12 +7308,12 @@ Again, voltage generators are treated differently: \end{circuitikz} \end{LTXexample} -And you can override that with \texttt{bipole/is voltage} keeping into account that the default direction will be the one of passive components: +And you can override that with \texttt{bipole/is voltage} keeping into account that the default direction will be the one of passive components (see~\ref{sec:source-vif}): \begin{LTXexample}[varwidth=true] \begin{circuitikz}[straight voltages] - \draw (0,0) to[V=10V, bipole/is voltage=false, - i_=$i_1$] (3,0); + \draw (0,0) to[V, bipole/is voltage=false, + v=10V, i_=$i_1$] (3,0); \end{circuitikz} \end{LTXexample} @@ -7346,7 +7444,7 @@ You can fine-tune the position of the \texttt{+} and \texttt{-} symbols and the Notes that \texttt{american voltage} also affects batteries. \begin{LTXexample}[varwidth=true] - \begin{circuitikz}[voltage shift=0.5] +\begin{circuitikz}[voltage shift=0.5] \draw (0,0) to[battery,l_=1V, v=$u_1$, i=$i_1$] (2,0); \end{circuitikz} \end{LTXexample} @@ -7537,7 +7635,7 @@ Or, for example, to have a different voltage style; normally you would define a \end{circuitikz} \end{LTXexample} -Since \texttt{v1.4.1} you can also keep the voltage, current and flow labels and suppress the output of the symbols (arrows or plus/minus depending on the style) with the keys \texttt{no v symbols}, \texttt{no i symbols}, \texttt{no f symbols} (there are also the corresponding \texttt{v symbols}, \texttt{i symbols} and \texttt{f symbols} in case you want to switch the behavior off/on globally). This for example simplify an often requested feature, like having all the current in one color and the voltages in another one, which is not possible natively because the arrows are part of the same path One possible implementation is the following one: +Since \texttt{v1.4.1} you can also keep the voltage, current and flow labels and suppress the output of the symbols (arrows or plus/minus depending on the style) with the keys \texttt{no v symbols}, \texttt{no i symbols}, \texttt{no f symbols} (there are also the corresponding \texttt{v symbols}, \texttt{i symbols} and \texttt{f symbols} in case you want to switch the behavior off/on globally). This for example simplify an often requested feature, like having all the current in one color and the voltages in another one, which is not possible natively because the arrows are part of the same path. One possible implementation of that is the following one: \begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] \newcommand{\iarronly}[1]{% name -- cgit v1.2.3