texlive[55771] Master/texmf-dist: circuitikz (7jul20)
commits+karl at tug.org
commits+karl at tug.org
Tue Jul 7 23:11:46 CEST 2020
Revision: 55771
http://tug.org/svn/texlive?view=revision&revision=55771
Author: karl
Date: 2020-07-07 23:11:46 +0200 (Tue, 07 Jul 2020)
Log Message:
-----------
circuitikz (7jul20)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf
trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md
trunk/Master/texmf-dist/doc/generic/circuitikz/README.md
trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex
trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf
trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex
trunk/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty
trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty
Modified: trunk/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md 2020-07-07 21:11:46 UTC (rev 55771)
@@ -1,6 +1,21 @@
<!--- CircuiTikz - Changelog --->
The major changes among the different circuitikz versions are listed here. See <https://github.com/circuitikz/circuitikz/commits> for a full list of changes.
+* Version 1.2.1 (2020-07-06)
+
+ Several changes, both internal and user-visible. These are quite risky, although they *should* be backeard-compatible.
+
+ From the user point of view:
+ - there is now a new style of voltages ("raised American")
+ - a powerful mechanism for customize voltages, current and flows has been added.
+
+ The internal changes are basically the re-implementation of the macros that draw the path elements (`to[...]`), which have been completely rewritten. Please be sure to read the possible incompatibilities in the manual (section 1.9).
+
+ - Added access to voltages, currents and flows anchors
+ - Added "raised american" voltage style
+ - Rewrite of the path generation macros
+ - Several small bugs fixed (no one ever used some "f^>" options...)
+
* Version 1.2.0 (2020-06-21)
In this release, the big change is the rewriting of the voltages output routine. Now all voltage options (american, european, and straight) take into account the shape (square border) of the component. The adjusting parameters are now (at least for passive elements) acting in similar way for all the options, too.
Modified: trunk/Master/texmf-dist/doc/generic/circuitikz/README.md
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex 2020-07-07 21:11:46 UTC (rev 55771)
@@ -5,6 +5,40 @@
\begin{itemize}
\item
+ Version 1.2.1 (2020-07-06)
+
+ Several changes, both internal and user-visible. These are quite
+ risky, although they \emph{should} be backeard-compatible.
+
+ From the user point of view:
+
+ \begin{itemize}
+ \tightlist
+ \item
+ there is now a new style of voltages (``raised American'')
+ \item
+ a powerful mechanism for customize voltages, current and flows has
+ been added.
+ \end{itemize}
+
+ The internal changes are basically the re-implementation of the macros
+ that draw the path elements (\texttt{to{[}...{]}}), which have been
+ completely rewritten. Please be sure to read the possible
+ incompatibilities in the manual (section 1.9).
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Added access to voltages, currents and flows anchors
+ \item
+ Added ``raised american'' voltage style
+ \item
+ Rewrite of the path generation macros
+ \item
+ Several small bugs fixed (no one ever used some
+ ``f\^{}\textgreater{}'' options\ldots{})
+ \end{itemize}
+\item
Version 1.2.0 (2020-06-21)
In this release, the big change is the rewriting of the voltages
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex 2020-07-07 21:11:46 UTC (rev 55771)
@@ -141,23 +141,23 @@
\draw (C.pin 20) -- ++(0,-8) node[ground](GND){};
\draw (C.pin 7) to[D, fill=blue] ++(0,-1) -- ++(0.5,0) to[R] ++(2,0)
coordinate(a1) to[short, -*]
- node[above left, blue]{Massimo A. Redaelli}
- node[below left,]{\email{m.redaelli at gmail.com}}
+ node[above left, blue, pos=1]{Massimo A. Redaelli}
+ node[below left, pos=1]{\email{m.redaelli at gmail.com}}
(a1-|GND);
\draw (C.pin 5) to[D, fill=red] ++(0,-3)-- ++(0.5,0) to[R] ++(2,0)
coordinate(a2) to[short, -*]
- node[above left, blue]{Stefan Lindner}
- node[below left,]{\email{stefan.lindner at fau.de}}
+ node[above left, blue, pos=1]{Stefan Lindner}
+ node[below left, pos=1]{\email{stefan.lindner at fau.de}}
(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 Erhardt}
- node[below left,]{\email{stefan.erhardt at fau.de}}
+ node[above left, blue, pos=1]{Stefan Erhardt}
+ node[below left, pos=1]{\email{stefan.erhardt at fau.de}}
(a3-|GND);
\draw (C.pin 1) to[D, fill=yellow] ++(0,-7)-- ++(0.5,0) to[R] ++(2,0)
coordinate(a4) to[short, -*]
- node[above left, blue]{Romano Giannetti}
- node[below left,]{\email{romano.giannetti at gmail.com}}
+ node[above left, blue, pos=1]{Romano Giannetti}
+ node[below left, pos=1]{\email{romano.giannetti at gmail.com}}
(a4-|GND);
\end{circuitikz}
\par\bigskip\vfill}
@@ -273,7 +273,7 @@
\end{circuitikz}
\end{LTXexample}
-They \texttt{use fpu reciprocal} key seems to have no side effects, but given that it is patching an internal interface of \TikZ{} it can break any time, so it is advisable to use it only if and when needed.
+The \texttt{use fpu reciprocal} key seems to have no side effects, but given that it is patching an internal interface of \TikZ{} it can break any time, so it is advisable to use it only if and when needed.
\subsection{Incompabilities between version}
@@ -280,6 +280,14 @@
Here, we will provide a list of incompabilitys between different version of circuitikz. We will try to hold this list short, but sometimes it is easier to break with old syntax than including a lot of switches and compatibility layers.
You can check the used version at your local installation using the macro \verb!\pgfcircversion{}!.
\begin{itemize}
+ \item After v1.2.1: \textbf{Important:} the routine that implement the \texttt{to[...]} component positioning has been rewritten. That should enhance the line joins in path, and it's safer, but it can potentially change behavior.
+
+ One of the changes is that the previous routine did the wrong thing if you used \texttt{(node) to[...]} (you should use an anchor or a coordinate, not a node there --- like \texttt{(node.anchor) to[...]}).
+
+ The other one was that in the structure \texttt{... to[...] node[pos=\emph{something}] (coord)} the value of \texttt{pos} was completely wrong (even if you don't use \texttt{pos} explicitly, remeber it's \texttt{pos=0.5} by default).
+
+ Additionally, the old code disrupted the \TikZ{} path-fill mechanism, so that you could get away with using the \texttt{fill} option on paths and having just the components to be filled, not the path. That was incorrect, although sometime it was handy.
+
\item After v1.2.0: voltage arrows, symbols and label positions are calculated with a rewritten routine. There should be little change, \emph{unless} you touched internal values\dots
\item After v1.1.3: during the 1.1.0 --- 1.1.2 version, the inverted Schmitt buffer in IEEE style ports was called \texttt{inv schmitt} (with an additional space). The correct name is \texttt{invschmitt port} (the same as the legacy american port).
\item After v1.1.2: the position of \texttt{american} voltages for the \texttt{open} bipoles (you can revert to old behavior, see section~\ref{sec:sub-voltage-position}).
@@ -315,7 +323,12 @@
\subsection{Package options}
\label{sec:package-options}
-\noindent Circuit people are very opinionated about their symbols. In order to meet the individual gusto you can set a bunch of package options. The standard options are what the authors like, for example you get this:
+Circuit people are very opinionated about their symbols. In order to meet the individual gusto you can set a bunch of package options.
+
+There are arguably way too much options in \Circuitikz, as you can see in the following list. Since version \texttt{1.0}, it is recommended to just use the basic ones --- voltage directions (you \textbf{should} specify one of them), \texttt{siunitx}, the global style (\texttt{american} or \texttt{european}) and use styles (see~\ref{sec:styling}) for the remaining options.
+
+The standard options are what the authors like, for example you get this:
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
\draw (0,0) to[R=2<\ohm>, i=?, v=84<\volt>] (2,0) --
@@ -5347,9 +5360,9 @@
\subsection{Labels and Annotations}
\label{sec:labels-and-annotations}
-Since Version 0.7, beside the original label (l) option, there is a new option to place a second label, called annotation (a) at each bipole. Up to now this is a beta-test and there can be problems. For example, up to now this option is not compatible with the concurrent use of voltage labels.
+Since Version 0.7, beside the original label (\texttt{l}) option, there is a new option to place a second label, called annotation (\texttt{a}) at each bipole.
-The position of (a) and (l) labels can be adjusted with \_ and \^, respectively.
+The position of annotations and labels can be adjusted with \verb|_| and \verb|^|.
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
@@ -5364,7 +5377,7 @@
\end{LTXexample}
\textbf{Caveat:} notice that the way in which \texttt{circuitikz} processes the options, there will be problems if the label (or annotation, voltage, or current) contains one of the characters $=$ (equal) or $,$ (comma), giving unexpected errors and wrong output.
-These two characters must be protected to the option parser using an \verb|\mbox| command, or redefining the characters with a \TeX\ \verb|\def|:
+These two characters must be protected from the option parser using an \verb|\mbox| command, or redefining the characters with a \TeX\ \verb|\def|:
\begin{LTXexample}[varwidth=true]
\def\eq{=}
@@ -5513,11 +5526,56 @@
This manual has been typeset with the option \texttt{\chosenvoltoption}.
+\subsubsection{Common properties of voltages and currents}
+\label{sec:common-vif-pos}
+
+Currents, voltages and flows (see later) are positioned along, or across, the part of the wires that connect the inner component to the rest of the circuit. So, changing the length of the connection (the coordinates that embrace the \texttt{to[...]} command) will change the position of the components.
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}
+ \draw (-1,1) to[R, v=$v$, i=$i$, f>^=$f$] (1,1);
+ \draw (-2,0) to[R, v=$v$, i=$i$, f>^=$f$] (2,0);
+\end{circuitikz}
+\end{LTXexample}
+
+However, you can override the properties \texttt{voltage/distance from node} (default \texttt{0.5}: how distant from the initial and final points of the path the arrow starts and ends or the plus and minus symbols are drawn) and \texttt{voltage/bump b} (how high the bump of the arrow is --- how curved it is, default \texttt{1.5}), and also \texttt{voltage/european label distance} (how distant from the normal position the voltage label will be, default \texttt{1.4}) on a per-component basis, in order to fine-tune the voltages:
+
+\begin{LTXexample}[varwidth=true]
+\tikz \draw (0,0) to[R, v=1<\volt>] (2,0); \par
+\ctikzset{voltage/distance from node=.1}
+\ctikzset{voltage/bump b=2.5}
+\tikz \draw (0,0) to[R, v=1<\volt>] (2,0);
+\end{LTXexample}
+
+The same concept as \texttt{distance from node} applies to the key \texttt{current/distance} for the position of the current's arrow:
+
+\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}
+
+You can change globally these parameters by defining a component-specific key; you have to use the internal name of the component (in the component list, is the \texttt{nodename} without the terminal ``\texttt{shape}'' part):
+
+\begin{LTXexample}[varwidth=true]
+\tikz \draw (0,0) to[R, v=1<\volt>] (1.5,0)
+ to[C, v=2<\volt>] (3,0); \par
+\ctikzset{bipoles/capacitor/voltage/distance from node/.initial=.7}
+\tikz \draw (0,0) to[R, v=1<\volt>] (1.5,0)
+ to[C, v=2<\volt>] (3,0); \par
+\end{LTXexample}
+
+Note the \texttt{.initial}; you have to create such key the first time you use it. These kind of adjustments are not guaranteed to work in future upgrades, though; if you have to create a key you are somehow touching the internal structure of the package; it's much safer to create a style.
+
+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}.
+
\subsection{Currents}\label{sec:currents}
-Inline (along the wire) currents are selected with \verb|i_>|, \verb|i^<|, \verb|i>_|, \verb|i>^|, and various simplification; the default position and direction is obtained with the key \verb|i=...|.
+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=...|.
+Basically, \verb|^| and \verb|_| control if the label is above or below the line (above and below \textbf{do} depend on the direction of the component path), and \verb|<| and \verb|>| the direction of the arrow; swapping them (from for example from \verb|i^>| to \verb|i>^|) will switch the side of the component where the symbol is drawn. See the following examples:
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
\draw (0,0) to[R, i^>=$i_1$] (2,0);
@@ -5566,45 +5624,30 @@
\end{circuitikz}
\end{LTXexample}
-Also:
+Also notice that the direction of the path is important:
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
+ \draw (2,1) to[R, i<=$i_1$] (0,1);
\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}
+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}).
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
- \draw (0,0) to[R, i^=$i_1$] (2,0);
+ \draw (0,0) to[V=10V, 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}
+\begin{circuitikz}[voltage dir=EF]
\draw (0,0) to[V=10V, i_=$i_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}
- \draw (0,0) to[V<=10V, i_=$i_1$] (2,0);
-\end{circuitikz}
-\end{LTXexample}
-
-\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[american]
\draw (0,0) to[V=10V, i_=$i_1$] (2,0);
\end{circuitikz}
@@ -5616,22 +5659,27 @@
\end{circuitikz}
\end{LTXexample}
+Current generators with the direct label (the one obtained by, for example, \texttt{I = something}) will treat it as a current:
+
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american]
- \draw (0,0) to[dcisource=1A, i_=$i_1$] (2,0);
+\begin{circuitikz}
+ \draw (0,0) to[I=$a_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
+If you use the option \texttt{americancurrent} or using the style \texttt{[american currents]}
+you can changhe the style of current generators.
+
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american]
- \draw (0,0) to[dcisource=1A,invert, i_=$i_1$] (2,0);
+\begin{circuitikz}[american currents]
+ \draw (0,0) to[I=$a_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
+
\subsection{Flows}\label{flows}
-As an alternative for the current arrows, you can also use the following flows. They can also be used to indicate thermal or power flows. The syntax is pretty the same as for currents.
-\textit{This is a new beta feature since version 0.8.3; therefore, please provide bug reports or hints to optimize this feature regarding placement and appearance! This means that the appearance may change in the future!}
+As an alternative for the current arrows, you can also use the following ``flows''. They can also be used to indicate thermal or power flows. The syntax is pretty the same as for currents.
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
@@ -5676,10 +5724,14 @@
\end{LTXexample}
\subsection{Voltages}
-See introduction note at Currents and Voltages (chapter \ref{curr-and-volt}, page \pageref{curr-and-volt}) for the direction of the voltage and currents.
+See the introduction at Currents and Voltages (section~\ref{curr-and-volt}, page \pageref{curr-and-volt}) for the default direction of the voltage and currents.
-\subsubsection{European style} The default, with arrows. Use option \texttt{europeanvoltage} or style \verb![european voltages]!, or setting (even locally) \texttt{voltage=european}.
+Voltages come in four different styles: European (with curved or straight arrows) and American (with signs that can stay near the wire or raised at the label level).
+Direction and position of the symbols are controlled in the same way as for the currents (see section~\ref{sec:currents}) with the \verb|_^<>| symbols.
+
+\subsubsection{European style} The default, with curved arrows. Use option \texttt{europeanvoltage} or style \verb![european voltages]!, or setting (even locally) \texttt{voltage=european}.
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[european voltages]
\draw (0,0) to[R, v^>=$v_1$] (2,0);
@@ -5704,51 +5756,73 @@
\end{circuitikz}
\end{LTXexample}
+The default direction for active elements can change, depending on the global \texttt{voltage dir} setting, so be careful.
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
- \draw (0,0) to[V=10V, i_=$i_1$] (2,0);
+ \draw (0,0) to[I=1A, v_=$u_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
- \draw (0,0) to[V<=10V, i_=$i_1$] (2,0);
+ \draw (0,0) to[I<=1A, v_=$u_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
- \draw (0,0) to[I=1A, v_=$u_1$] (2,0);
+ \draw (0,0) to[I=$~$,l=1A, v_=$u_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
- \draw (0,0) to[I<=1A, v_=$u_1$] (2,0);
+ \draw (0,0) to[I,l=1A, v_=$u_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
+Moreover, for historical reasons, voltage generators have differently looking arrows (they are straight even in curved European style).
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
- \draw (0,0) to[I=$~$,l=1A, v_=$u_1$] (2,0);
+ \draw (0,0) to[battery,l_=1V, v=$u_1$, i=$i_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
- \draw (0,0) to[I,l=1A, v_=$u_1$] (2,0);
+ \draw (0,0) to[V=10V, i_=$i_1$] (2,0);
\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.
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
- \draw (0,0) to[battery,l_=1V, v=$u_1$, i=$i_1$] (2,0);
+ \draw (0,0) to[battery, bipole/is voltage=false,
+ v>=$u_1$,] (2,0);
\end{circuitikz}
\end{LTXexample}
-\subsubsection{Straight European style} Using straight arrows. Use option \texttt{straightvoltages} or style \verb![straight voltages]!, or setting (even locally) \texttt{voltage=straight}. Notice that this is an only lightly tested option, so use with care.
+As for the currents, the direct label of voltage sources is passed as a voltage:
\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}
+ \draw (0,0) to[cV=$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}[american voltages]
+ \draw (0,0) to[V=$a_1$] (2,0);
+\end{circuitikz}
+\end{LTXexample}
+
+\subsubsection{Straight European style} Using straight arrows. Use option \texttt{straightvoltages} or style \verb![straight voltages]!, or setting (even locally) \texttt{voltage=straight}.
+
+\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[straight voltages]
\draw (0,0) to[R, v^>=$v_1$] (2,0);
\end{circuitikz}
@@ -5772,72 +5846,95 @@
\end{circuitikz}
\end{LTXexample}
+Again, voltage generators are treated differently:
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[straight voltages]
- \draw (0,0) to[V=10V, i_=$i_1$] (2,0);
+ \draw (0,0) to[V=10V, i_=$i_1$] (3,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[straight voltages]
- \draw (0,0) to[V<=10V, i_=$i_1$] (2,0);
+ \draw (0,0) to[I, v=10V, i_=$i_1$] (3,0);
\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:
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[straight voltages]
- \draw (0,0) to[I=1A, v_=$u_1$] (2,0);
+ \draw (0,0) to[V=10V, bipole/is voltage=false,
+ i_=$i_1$] (3,0);
\end{circuitikz}
\end{LTXexample}
+\subsubsection{American style}
+Use option \texttt{americanvoltage} or set \verb![american voltages]! or use the option \texttt{voltage=american}.
+
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[straight voltages]
- \draw (0,0) to[I<=1A, v_=$u_1$] (2,0);
+\begin{circuitikz}[american voltages]
+ \draw (0,0) to[R, v^>=$v_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[straight voltages]
- \draw (0,0) to[I=$~$,l=1A, v_=$u_1$] (2,0);
+\begin{circuitikz}[american voltages]
+ \draw (0,0) to[R, v^<=$v_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[straight voltages]
- \draw (0,0) to[I,l=1A, v_=$u_1$] (2,0);
+\begin{circuitikz}[american voltages]
+ \draw (0,0) to[R, v_>=$v_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[straight voltages]
- \draw (0,0) to[battery,l_=1V, v=$u_1$, i=$i_1$] (2,0);
+\begin{circuitikz}[american voltages]
+ \draw (0,0) to[R, v_<=$v_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}[american]
+ \draw (0,0) to[I=1A, v_=$u_1$] (2,0);
+\end{circuitikz}
+\end{LTXexample}
-\subsubsection{American style}
-Use option \texttt{americanvoltage} or set \verb![american voltages]! or use the option \texttt{voltage=american}.
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}[american]
+ \draw (0,0) to[I<=1A, v_=$i_1$] (2,0);
+\end{circuitikz}
+\end{LTXexample}
+
+\subsubsection{Raised American style}
+
+Since version \texttt{1.2.1}, ``raised'' American voltages are available; to use them, set the style \verb![raised voltages]! or use the option \texttt{voltage=raised}.
+This is a version of the American-style voltage where the signs are raised to the level of the label.
+The label is centered between the two signs, and the position of the signs is calculated supposing that the label itself will be pretty simple; if you have very big labels you will need to adjust the position with \texttt{voltage shift} and/or the \texttt{voltage/distance from node} properties (see section~\ref{sec:common-vif-pos}).
+
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american voltages]
+\begin{circuitikz}[raised voltages]
\draw (0,0) to[R, v^>=$v_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american voltages]
+\begin{circuitikz}[raised voltages]
\draw (0,0) to[R, v^<=$v_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american voltages]
+\begin{circuitikz}[raised voltages]
\draw (0,0) to[R, v_>=$v_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american voltages]
+\begin{circuitikz}[raised voltages]
\draw (0,0) to[R, v_<=$v_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
@@ -5844,18 +5941,21 @@
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[american]
+ \ctikzset{voltage=raised}
\draw (0,0) to[I=1A, v_=$u_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american]
+\begin{circuitikz}[raised voltages]
\draw (0,0) to[I<=1A, v_=$i_1$] (2,0);
\end{circuitikz}
\end{LTXexample}
-\subsubsection{Voltage position}\label{sec:sub-voltage-position} It is possible to move away the arrows and the plus or minus signs with the key \texttt{voltages shift} (default value is \texttt{0}, which gives the standard position):
+\subsubsection{Voltage position}\label{sec:sub-voltage-position}
+It is possible to move the arrows and the plus or minus signs away form the component with the key \texttt{voltages shift} (default value is \texttt{0}, which gives the standard position):
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[]
\draw (0,0) to[R, v=$v_1$, i=$i_1$] (2,0);
@@ -5862,7 +5962,7 @@
\draw (0,-1) to[R, v=$v_1$, i=$i_1$,
voltage shift=0.5] (2,-1);
\draw (0,-2) to[R, v=$v_1$, i=$i_1$,
- voltage shift=1.0, ] (2,-2);
+ voltage shift=1.0] (2,-2);
\end{circuitikz}
\end{LTXexample}
@@ -5872,12 +5972,24 @@
\end{circuitikz}
\end{LTXexample}
+Negative values do work as expected:
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}[raised voltages]
+ \draw (0,1.5) to[R, v^=$v_1$, i=$i_1$] ++(2,0);
+ \draw (0,0) to[R, v^=$v_1$, i=$i_1$,
+ voltage shift=-1.0] ++(2,0);
+\end{circuitikz}
+\end{LTXexample}
+
You can fine-tune the position of the \texttt{+} and \texttt{-} symbols and the label in independent way using \texttt{voltage/shift} (default \texttt{0.0} for the former and \texttt{voltage/american label distance} (the distance of the label form the lines of the symbols, default \texttt{1.4}) for the latter.
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}[american voltages]
- \ctikzset{voltage/american label distance=0.2, voltage/shift=2}
- \draw (0,0) to[R, v=$v_1$, i=$i_1$] (2,0);
+ \draw (0,1) to[R, v=$v_1$, i=$i_1$] ++(2,0);
+ % normally 1.4, make it tighter
+ \ctikzset{voltage/american label distance=0.5}
+ \draw (0,0) to[R, v=$v_1$, i=$i_1$] ++(2,0);
\end{circuitikz}
\end{LTXexample}
@@ -5949,33 +6061,7 @@
\end{LTXexample}
-\subsection{Global properties of voltages and currents}
-\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) to[C, i=$\imath$] (2,0); \par
-\ctikzset{current/distance = .2}
-\tikz \draw (0,0) to[C, i=$\imath$] (2,0);
-\end{LTXexample}
-
-However, you can override the properties \texttt{voltage/distance from node} (how distant from the initial and final points of the path the arrow starts and ends, default \texttt{0.5}) and \texttt{voltage/bump b} (how high the bump of the arrow is --- how curved it is, default \texttt{1.5}), and also \texttt{voltage/european label distance} (how distant from the ``bump'' the voltage label will be, default \texttt{1.4}) on a per-component basis, in order to fine-tune the voltages:
-
-
-\begin{LTXexample}[varwidth=true]
-\tikz \draw (0,0) to[R, v=1<\volt>] (1.5,0)
- to[C, v=2<\volt>] (3,0); \par
-\ctikzset{bipoles/capacitor/voltage/distance from node/.initial=.7}
-\tikz \draw (0,0) to[R, v=1<\volt>] (1.5,0)
- to[C, v=2<\volt>] (3,0); \par
-\end{LTXexample}
-
-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}
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.
@@ -5987,7 +6073,7 @@
\ctikzset{bipole annotation style/.style={font=\small}}
\end{lstlisting}
-And the change (override) the setting in one specific bipole using:
+And/or change (override) the setting in one specific bipole using:
\begin{lstlisting}[numbers=none]
...to[bipole annotation style={color=red}, R, a={Red note}]...
@@ -6017,144 +6103,234 @@
\end{circuitikz}
\end{LTXexample}
-\subsection{Labels in special components}
+\subsection{Accessing labels text nodes}
-For some components label, current and voltage behave as one would expect:
+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}. Notice that the node names are available only if the bipole has an anchor or an annotation, of course.
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}
- \draw (0,0) to[I=$a_1$] (2,0);
+\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}
- \draw (0,0) to[I, i=$a_1$] (2,0);
-\end{circuitikz}
-\end{LTXexample}
+\subsection{Advanced voltages, currents and flows}\label{sec:vif-anchors}
+Since version \texttt{1.2.1}, it is possible to access the anchors of the ``ornaments'' --- voltage, current and flows, together with some additional information that makes it possible to personalize them.
+Normally, voltages and flow and currents are drawn into the path of the bipoles, so that it is not possible, for example, to change the line type or color of the arrows, or the type of arrows\footnote{in regular voltages, the arrows are not real \TikZ{} arrows, but the auxiliary arrow shapes of \Circuitikz{}}. Access to the anchors allows to do all this things, and more.
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}
- \draw (0,0) to[cI=$k\cdot a_1$] (2,0);
+For example, you can do something like this:
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[]
+ \draw (0,1) to[R, v=$v$] ++(3,0);
+ \draw (0,0) to[R, v, name=R, voltage/bump b=3] ++(3,0);
+ \draw [thin, red, -{Stealth[width=8pt]}, ]
+ (R-Vfrom) .. controls (R-Vcont1) and (R-Vcont2).. (R-Vto)
+ node [black, pos=0.5, fill=white]{v};
\end{circuitikz}
\end{LTXexample}
+Or, for example, to have a different voltage style; normally you would define a macro:
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}
- \draw (0,0) to[sI=$a_1$] (2,0);
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[voltage shift=0.5]
+ \def\eurVPM#1#2{% node, label
+ \draw [thin, -{Stealth[width=8pt]}, shorten >=5pt,
+ shorten <=5pt] (#1-Vfrom) node[font=\tiny]{$-$}
+ .. controls (#1-Vcont1) and (#1-Vcont2)..
+ (#1-Vto) node[font=\tiny]{$+$}
+ node[pos=0.5,anchor=\ctikzgetanchor{#1}{Vlab}]{#2};}
+ \draw (0,0) to[R=R1, name=R1, v, i=$i$] ++(3,0)
+ to[R, l_=R2, v^, name=R2] ++(0,-3);
+ \eurVPM{R1}{$v_1$} \eurVPM{R2}{$v_2$}
\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}
+\subsubsection{Activating the anchors}
-The following results from using the option \texttt{americancurrent} or using the style \texttt{[american currents]}.
+You will have access to the anchors for voltages, currents and flows when, in the bipole, you have both a \texttt{v}, \texttt{i}, \texttt{f} specification (one or more of them) \textbf{and} a \texttt{name} key, to give the bipole a name. Otherwise, the anchors and the associated functions are not defined.
+To suppress the normal output of the \texttt{v}, \texttt{i}, \texttt{f} keys, you can use such keys without any argument, like in the previous example; notice that the \verb|_| and \verb|^| modifiers work as expected.
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american currents]
- \draw (0,0) to[I=$a_1$] (2,0);
-\end{circuitikz}
-\end{LTXexample}
+The following line of resistors has been drawn with the following commands; it is used to show the name of the available anchors.
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american currents]
- \draw (0,0) to[I, i=$a_1$] (2,0);
+\begin{lstlisting}
+ \draw (0,0) to[R=R1, v=$v$, name=R1] ++(4,0)
+ to[R, l_=R2, i=$i$, name=R2] ++(4,0)
+ to[R=R3, f=$f$, name=R3] ++(4,0);
+\end{lstlisting}
+
+\begin{circuitikz}[]
+ \draw (0,0) to[R=R1, v=$v$, name=R1] ++(4,0) to[R, l_=R2, i=$i$, name=R2] ++(4,0) to[R=R3, f=$f$, name=R3] ++(4,0);
+ \path
+ (R1-Vto) \showcoord(R1-Vto)<-135:0.2>
+ (R1-Vfrom) \showcoord(R1-Vfrom)<-45:0.2>
+ (R1-Vcont1) \showcoord(R1-Vcont1)<-45:0.2>
+ (R1-Vcont2) \showcoord(R1-Vcont2)<-135:0.2>
+ (R1-Vlab) \showcoord(R1-Vlab)<-90:0.5>
+ (R2-Ito) \showcoord(R2-Ito)<45:0.3>
+ (R2-Ifrom) \showcoord(R2-Ifrom)<135:0.3>
+ (R2-Ipos) \showcoord(R2-Ipos)<-90:0.3>
+ (R3-Fto) \showcoord(R3-Fto)<45:0.3>
+ (R3-Ffrom) \showcoord(R3-Ffrom)<135:0.3>
+ (R3-Fpos) \showcoord(R3-Fpos)<-90:0.4>
+ ;
\end{circuitikz}
-\end{LTXexample}
+The meaning of the anchors is the following:
+\begin{itemize}
+\item
+ \texttt{Vfrom} and \texttt{Vto} are the main points where the voltage information is given: start and end point of the arrow, or position of the $+$ or $-$ sign. This is the same for the \texttt{Ffrom} or \texttt{Fto} anchors for flows; for inline currents, the corresponding \texttt{Ifrom} and \texttt{Ito} mark the wire segment where the arrowhead is positioned (at the specified \texttt{current/distance} fraction. The direction of the arrow is available using the auxiliary macro \verb|\ctikzgetdirection| (see below).
+\item
+ \texttt{Vcont1} and \texttt{Vcont2} are the control points for the curved arrow (see the examples above); in the case of straight arrows or american-style voltages, they are set at the midpoint between \texttt{Vfrom} and \texttt{Vto}.
+\item
+ \texttt{Vlab} is where the text label for the voltage is normally positioned. The anchor used for such label is available using the auxiliary macro \verb|\ctikzgetanchor| (see below)
+\item
+ \texttt{Ipos} and \texttt{Fpos} are the position for the arrowhead or the small flow arrow (which is a \texttt{currarrow} or \texttt{flowarrow} node normally) is positioned, respectively. The label is then added to the correct side of it using the anchor available via \verb|\ctikzgetanchor|.\footnote{In this case, the exact position of the label is not available if you do not position the element, for this there is no \texttt{Flab} or \texttt{Ilab} coordinate; you have to use the \texttt{Fpos} and \texttt{Ipos} coordinate with the corresponding \texttt{Ilab} and \texttt{Flab} anchors.}
+\end{itemize}
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american currents]
- \draw (0,0) to[cI=$k\cdot a_1$] (2,0);
-\end{circuitikz}
-\end{LTXexample}
+Changing the options of the elements, will change the anchors acoordingly:
+\begin{lstlisting}
+ \ctikzset{current/distance=0.2}
+ \draw (0,0) to[R=R1, v>=$v$, name=R1] ++(4,0)
+ to[R, l_=R2, i<_=$i$, name=R2] ++(4,0)
+ to[R, l_=R3, f<_=$f$, name=R3] ++(4,0);
+\end{lstlisting}
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american currents]
- \draw (0,0) to[sI=$a_1$] (2,0);
+\begin{circuitikz}[]
+ \ctikzset{current/distance=0.2}
+ \draw (0,0) to[R=R1, v>=$v$, name=R1] ++(4,0) to[R, l_=R2, i<_=$i$, name=R2] ++(4,0) to[R, l_=R3, f<_=$f$, name=R3] ++(4,0);
+ \path
+ (R1-Vto) \showcoord(R1-Vto)<-45:0.2>
+ (R1-Vfrom) \showcoord(R1-Vfrom)<-135:0.2>
+ (R1-Vcont1) \showcoord(R1-Vcont1)<-135:0.2>
+ (R1-Vcont2) \showcoord(R1-Vcont2)<-45:0.2>
+ (R1-Vlab) \showcoord(R1-Vlab)<-90:0.5>
+ (R2-Ito) \showcoord(R2-Ito)<135:0.3>
+ (R2-Ifrom) \showcoord(R2-Ifrom)<45:0.3>
+ (R2-Ipos) \showcoord(R2-Ipos)<90:0.3>
+ (R3-Fto) \showcoord(R3-Fto)<90:0.4>
+ (R3-Ffrom) \showcoord(R3-Ffrom)<80:0.4>
+ (R3-Fpos) \showcoord(R3-Fpos)<-90:0.4>
+ ;
\end{circuitikz}
-\end{LTXexample}
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american currents]
- \draw (0,0) to[csI=$k\cdot a_1$] (2,0);
-\end{circuitikz}
-\end{LTXexample}
+Obviously, the anchors follow the voltage style you choose:
-The same holds for voltage sources:
+\begin{lstlisting}
+ \draw (0,0) to[R=R1, v=$v$, name=R1, voltage=straight] ++(4,0)
+ to[R=R2, v=$v$, name=R2, voltage=american] ++(4,0)
+ to[R=R3, v=$v$, name=R3, voltage=raised] ++(4,0);
+\end{lstlisting}
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}
- \draw (0,0) to[V=$a_1$] (2,0);
+\begin{circuitikz}[]
+ \ctikzset{current/distance=0.2}
+ \draw (0,0) to[R=R1, v=$v$, name=R1, voltage=straight] ++(4,0)
+ to[R=R2, v=$v$, name=R2, voltage=american] ++(4,0)
+ to[R=R3, v=$v$, name=R3, voltage=raised] ++(4,0);
+ \foreach \i in {1, 2, 3} {
+ \path
+ (R\i-Vto) \showcoord(R\i-Vto)<-90:0.4>
+ (R\i-Vfrom) \showcoord(R\i-Vfrom)<-90:0.4>
+ (R\i-Vcont1) \showcoord(R\i-Vcont1)<135:0.6>
+ (R\i-Vcont2) \showcoord(R\i-Vcont2)<45:0.6>
+ (R\i-Vlab) \showcoord(R\i-Vlab)<-90:0.6>
+ ;
+ }
\end{circuitikz}
-\end{LTXexample}
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}
- \draw (0,0) to[V, v=$a_1$] (2,0);
-\end{circuitikz}
-\end{LTXexample}
+Notice the postion of the control points, as well as the fact that the anchor available with \verb|\ctikzgetanchor| is applied to \texttt{Vfrom} and \texttt{Vto} symbols, too.
+Finally, as ever, generators are treated differently, but you have all your anchors too.
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}
- \draw (0,0) to[cV=$k\cdot a_1$] (2,0);
-\end{circuitikz}
-\end{LTXexample}
+\begin{lstlisting}
+ \ctikzset{american}
+ \draw (0,0) to[V=$v$, name=G1, voltage=european] ++(4,0)
+ to[V=$v$, v=$v$, name=G2, voltage=american] ++(4,0)
+ to[battery2, v=$v$, name=G3, voltage=raised] ++(4,0);
+\end{lstlisting}
-
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}
- \draw (0,0) to[sV=$a_1$] (2,0);
+\begin{circuitikz}[]
+ \ctikzset{american}
+ \draw (0,0) to[V=$v$, name=G1, voltage=european] ++(4,0)
+ to[V=$v$, v=$v$, name=G2, voltage=american] ++(4,0)
+ to[battery2, v=$v$, name=G3, voltage=raised] ++(4,0);
+ \foreach \i in {1, 2, 3} {
+ \path
+ (G\i-Vto) \showcoord(G\i-Vto)<-60:0.1>
+ (G\i-Vfrom) \showcoord(G\i-Vfrom)<-120:0.1>
+ (G\i-Vlab) \showcoord(G\i-Vlab)<90:0.3>
+ ;
+ }
\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}
+\subsubsection{Auxiliary information}
-The following results from using the option \texttt{americanvoltage} or the style \texttt{[american voltages]}.
+When the anchors are activated, there are additional macros that you can use:
+\begin{itemize}
+ \item \texttt{\textbackslash ctikzgetanchor\{\emph{<name>}\}\{\emph{<anchor>}\}}: \emph{name} is the name of the bipole, and \emph{anchor} can be \texttt{Vlab}, \texttt{Fpos} or \texttt{Ipos}. This macro expands to the normal anchor position (something like \texttt{north}, \texttt{south west}). Notice that if you have not activated the corresponding anchor, the content of this macro is not specified. It could be equivalent to \verb|\relax| (basically, empty) or contains the anchor of a bipole with the same name from another drawing --- it's a global macro like the coordinates.
+ \item \texttt{\textbackslash ctikzgetdirection\{\emph{<name>}\}}: a number which is the direction of the \emph{name}d bipole.
+\end{itemize}
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american voltages]
- \draw (0,0) to[V=$a_1$] (2,0);
-\end{circuitikz}
-\end{LTXexample}
+For example, you could like the voltage label oriented with the bipole:
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american voltages]
- \draw (0,0) to[V, v=$a_1$] (2,0);
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[]
+ \def\myvv#1#2{%
+ \draw [thin, blue, ->,]
+ (#1-Vfrom) .. controls (#1-Vcont1) and (#1-Vcont2).. (#1-Vto)
+ node [pos=0.5, below,
+ rotate=\ctikzgetdirection{#1}] at (#1-Vlab) {#2}; }
+ \draw (0,0) to[R, v, name=A] ++(3,0);
+ \draw (0,0) to[R, v, name=B] ++(3,3);
+ \myvv{A}{$v_A$}\myvv{B}{$v_B$}
\end{circuitikz}
\end{LTXexample}
+Or you could use the anchor to substitute the flow with a fancy one and still position automatically the label; suppose you have the following definition in your preamble (see \TikZ{} manual, ``Path decorations''):
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american voltages]
- \draw (0,0) to[cV=$k v_e$] (2,0);
-\end{circuitikz}
-\end{LTXexample}
+\begin{lstlisting}
+% requires \usetikzlibrary{decorations, decorations.pathmorphing}
+\tikzset{%
+lray/.style={decorate, decoration={
+ snake, amplitude=2pt,pre length=1pt,post length=2pt, segment length=5pt,},
+ -Triangle,
+}}
+\end{lstlisting}
+\tikzset{%
+lray/.style={decorate, decoration={
+ snake, amplitude=2pt,pre length=1pt,post length=2pt, segment length=5pt, },
+ -Triangle,
+}}
+You can then define a kind of ``power flow'' style:
-\begin{LTXexample}[varwidth=true]
-\begin{circuitikz}[american voltages]
- \draw (0,0) to[sV=$a_1$] (2,0);
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[]
+ \newcommand\myff[3][blue]{% [opt: color] node label
+ \draw [lray, #1, ] (#2-Ffrom) -- (#2-Fto)
+ node [anchor=\ctikzgetanchor{#2}{Flab}, inner sep=4pt]
+ at (#2-Fpos) {#3};}
+ \draw (0,1) to[R, f, name=A] ++(3,0);
+ \draw (0,0) to[R, f_<, name=B] ++(3,0);
+ \myff{A}{$P_A$}\myff[red]{B}{$P_B$}
\end{circuitikz}
\end{LTXexample}
-\begin{LTXexample}[varwidth=true]
-\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:
@@ -6195,31 +6371,7 @@
\end{circuitikz}
\end{LTXexample}
-\subsection{Accessing labels text nodes}
-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}
-
-
\section{Using bipoles in circuits}
\subsection{Nodes (also called poles)}\label{sec:bipole-nodes}
@@ -6354,7 +6506,7 @@
\end{circuitikz}
\end{LTXexample}
-\subsubsection{Transparent poles}
+\subsubsection{Transparent poles}\label{sec:transparent-poles}
``Open-poles'' terminals (\texttt{ocirc}, \texttt{odiamondpole}, and \texttt{osquarepole}) are normally filled with the background color at full opacity. This is because, for simplicity of operation, the nodes are placed \emph{after} the wires are drawn and have to ``white-out'' the underlying lines.
@@ -6363,14 +6515,16 @@
\begin{LTXexample}[pos=t, basicstyle=\small\ttfamily]
\begin{circuitikz}[scale=3, transform shape]
\fill[cyan] (0,0) rectangle (4.1,-0.6);
- \tikzset{halfwhite/.style={fill opacity=0.5, fill=white, open poles opacity=0.5}}
+ \tikzset{open poles opacity=0.5}
% automatic positioning when opacity is not 1.0 creates artifacts
- \draw[halfwhite] (0,0) to[generic, -o] ++(2,0) --++(0,-0.5);
+ % note that opacity must go on the draw command for path-style components
+ \draw[fill opacity=0.5] (0,0) to[generic, fill=white, -o] ++(2,0) --++(0,-0.5);
% you have to use manual positioning
- \draw[halfwhite] (2.2,0) -- ++(0.5,0) node[ocirc, anchor=180]{};
- \draw[halfwhite] (3,0) node[ocirc](B){} (B.0) --++(0.5,0) (B.-90) --++(0,-0.5);
+ \draw (2.2,0) -- ++(0.5,0) node[ocirc, anchor=180, fill opacity=0.5]{};
+ \draw (3,0) node[ocirc, fill opacity=0.5](B){} (B.0) --++(0.5,0) (B.-90) --++(0,-0.5);
% maybe really useful only for terminals going out of the circuit...
- \draw (3.6,0) -- ++(0.2,0) node[ocirc, halfwhite, anchor=180]{};
+ % notice that in node commands you can specify the opacity directly
+ \draw (3.6,0) -- ++(0.2,0) node[ocirc, fill=white, fill opacity=0.5, anchor=180]{};
\end{circuitikz}
\end{LTXexample}
@@ -6457,9 +6611,17 @@
\end{tikzpicture}
\end{LTXexample}
-
\section{Colors}
+Color support in \Circuitikz{} is quite limited. You will have no problem if:
+\begin{enumerate}
+ \item You stick to use styles (see~\ref{sec:styling-fillcolor}) for filling your components, or using a direct \texttt{fill=...} option directly;
+ \item when coloring whole circuits, use the option \texttt{color=...} in your global picture options or in the \verb|\draw| command (not just the color name as a shorthand);
+ \item forget about transparency.
+\end{enumerate}
+
+Nevertheless, if you really need to do strange things with colors you can read on; you can do almost everything but there are several glitches to take into account.
+
\subsection{Shape colors}
The color of the components is stored 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]!.
@@ -6583,20 +6745,23 @@
;\end{circuitikz}
\end{LTXexample}
-Notice also that the connection point are always filled, although the color \emph{tries} to follow the color of the filling of the component:
+Notice also that the connection point are always filled, although the color \emph{tries} to follow the color of the filling of the component (but look at section~\ref{sec:transparent-poles}). Moreover, if you want to pass fill transparency down to path-style components, you \emph{have} to put it into the options of the \verb|\draw| command.
\begin{LTXexample}[varwidth=true, pos=t]
\begin{circuitikz}
\fill[cyan] (0,3.0) rectangle (7,7);
- \draw [fill=yellow, ] (4,4) to [D,o-o] ++(0,2) to[D*, fill=yellow] ++(2,0)
- to[D*] ++(0,-2) to[D, fill=red, o-o] ++(-2,0);
+ \draw [fill opacity=0.5] (1,6.5) to[generic, fill=white,o-o] ++(2,0);
+ \draw (1,5.5) to[short, fill=red, o-o] ++(1,0) to[short, -o] ++(1,0);
+ \draw[fill=yellow] (1,5) to[short, o-o] ++(1,0) to[short, -o] ++(1,0);
+ \draw (1,4.5) to[short, o-o] ++(1,0) to[short, -o] ++(1,0);
\draw (1,4) node[ocirc]{} -- ++(1,0) node[ocirc]{};
- \draw (1,4.5) to[short, o-o] ++(1,0) to[short, -o] ++(1,0);
- \draw[fill=yellow] (1,5) to[short, o-o] ++(1,0) to[short, -o] ++(1,0);
- \draw (1,5.5) to[short, fill=red, o-o] ++(1,0) to[short, -o] ++(1,0);
+ \draw [thick, color=green!50!black] (4,4) to [D,o-o,fill=yellow] ++(0,2) to[D*, fill=yellow]
+ ++(2,0) to[D*,fill=yellow] ++(0,-2) to[D, fill=red, o-o] ++(-2,0);
\end{circuitikz}
\end{LTXexample}
+As you can see, the ``black'' components (as \texttt{D*}) follow the color of the line, not the fill.
+
\section{FAQ}
\noindent Q: When using \verb!\tikzexternalize! I get the following error:
@@ -7197,3 +7362,4 @@
\printindex
\end{document}
+% vim: set fdm=marker fmr=%<<<,%>>>:
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty
===================================================================
--- trunk/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty 2020-07-07 21:11:46 UTC (rev 55771)
@@ -17,7 +17,7 @@
\RequirePackage{showexpl}
\RequirePackage{ragged2e}
% for some example we need them...
-\usetikzlibrary{calc,fit}
+\usetikzlibrary{calc,fit, decorations, decorations.pathmorphing}
\RequirePackage{upgreek}
%
% The following trick is used to silence showexpl a bit, so that the
@@ -135,6 +135,11 @@
[blue, inner sep=0.5pt, font=\small,
pin distance=#3\pgf at circ@Rlen, pin edge={blue, }%
]#2:#1}](#1){}}
+ \def\showcoordwc[#1](#2)<#3:#4>{%
+ node[circle, #1, draw, inner sep=1pt,pin={%
+ [#1, inner sep=0.5pt, font=\small,
+ pin distance=#4\pgf at circ@Rlen, pin edge={#1, }%
+ ]#3:#2}](#2){}}
\makeatother
% show anchors of a node component:
% optional: options of the circuitikz environment
Modified: trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex 2020-07-07 21:11:46 UTC (rev 55771)
@@ -10,8 +10,8 @@
%
% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
-\def\pgfcircversion{1.2.0}
-\def\pgfcircversiondate{2020/06/21}
+\def\pgfcircversion{1.2.1}
+\def\pgfcircversiondate{2020/07/06}
\writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
\usemodule[tikz]
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex 2020-07-07 21:11:46 UTC (rev 55771)
@@ -9,9 +9,10 @@
% 2. under the GNU Public License.
%
% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
-
%
-%% Key managements
+% This file has folding marks for vim (See last line).
+%
+%% Key managements%<<<1
\long\def\pgf at circ@comment#1{}
@@ -24,15 +25,17 @@
\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
+\pgfkeys{\circuitikzbasekey/.search also={/tikz}}
+%%>>>
+
+%% Temporary Counters and dimensions%<<<1
%% Temporary Counters
-
\newcount\pgf at circ@count at a
\newcount\pgf at circ@count at b
\newcount\pgf at circ@count at c
%%%%%%%%%%%%
%% Dimensions
-
-% coordinates
+% coordinate
\newdimen\pgf at circ@res at up
\newdimen\pgf at circ@res at down
\newdimen\pgf at circ@res at zero
@@ -41,10 +44,19 @@
\newdimen\pgf at circ@res at other
\newdimen\pgf at circ@res at step
\newdimen\pgf at circ@res at temp
+% Base len for all circuitikz
+\newdimen\pgf at circ@Rlen
+% scaled length for internal use in scalable shapes
+\newdimen\pgf at circ@scaled at Rlen
+\ctikzset{bipoles/length/.code={\pgf at circ@Rlen = #1\pgf at circ@scaled at Rlen=\pgf at circ@Rlen}}
+\pgf at circ@Rlen = 1.4cm
+% by default scale is 1.0
+\pgf at circ@scaled at Rlen=\pgf at circ@Rlen
% inital thickness
\newdimen \pgfstartlinewidth
+%%>>>
-% arrow tips, ported over old arrows library (deprecated)
+% arrow tips, ported over old arrows library (deprecated)%<<<1
% see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
% this was the original definition of latex' tips, renamed to avoid clashes
%
@@ -76,7 +88,10 @@
}
\pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
+%%>>>
+%% Macros to do things depending on the class%<<<1
+
\def\pgf at circ@setifdefinedfill#1#2{%
% if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
% set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
@@ -150,8 +165,9 @@
}
% use \pgf at circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
\ctikzset{none/thickness/.initial=1.0} % do not touch
+%%>>>
-%% font changes compatible with plain/LaTeX/ConTeXt
+%% font changes compatible with plain/LaTeX/ConTeXt%<<<1
%% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
\ifpgfutil at format@is at latex
@@ -203,8 +219,10 @@
{{}}% #1 is \relax, so consider empty
{\expandafter{#1}}% otherwise, leave the key after one more expansion
}%
-%
-% text position (added with ieeestd logic ports. Maybe to be extended to other components,
+%>>>
+
+% text position in some component.%<<<1
+% (added with ieeestd logic ports. Maybe to be extended to other components,
% like amplifiers)
%
\newif\ifpgf at circ@center at text\pgf at circ@center at texttrue
@@ -215,8 +233,9 @@
\ctikzset{component text/center/.code={\pgf at circ@center at texttrue}}%
\ctikzset{component text/left/.code={\pgf at circ@center at textfalse}}%
\ctikzset{left text distance/.initial=0.3em}%
+%>>>
-% voltage options
+% voltage direction options%<<<1
\newif\ifpgf at circ@siunitx
\newif\ifpgf at circuit@compat
@@ -229,54 +248,109 @@
\ctikzset{voltage dir/noold/.code={\pgf at circ@oldvoltagedirectionfalse\pgf at circ@fixbatteriesfalse}}
\ctikzset{voltage dir/RP/.code={\pgf at circ@oldvoltagedirectiontrue\pgf at circ@fixbatteriestrue}}
\ctikzset{voltage dir/EF/.code={\pgf at circ@oldvoltagedirectionfalse\pgf at circ@fixbatteriestrue}}
-\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}
+\tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}%
+%>>>
-% Option ">" for twoports
-\newif\ifpgf at circuit@inputarrow
-\ctikzset{>/.add code={}{\pgf at circuit@inputarrowtrue}}
-\ctikzset{inputarrow/.is choice}
-\ctikzset{inputarrow/true/.code={\pgf at circuit@inputarrowtrue}}
-\ctikzset{inputarrow/false/.code={\pgf at circuit@inputarrowfalse}}
+% bipole definitions for path component and text decorations%%<<<1
+%
+% Option "t=*" for nodes
+\pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
+%
+\ctikzset{bipole/.is family}
+\ctikzset{bipole/kind/.initial=}
+\ctikzset{bipole/name/.initial=}
+\newif\ifpgf at circuit@bipole at isvoltage
+\ctikzset{bipole/is voltage/.is if=pgf at circuit@bipole at isvoltage}
+\newif\ifpgf at circuit@bipole at voltageoutsideofsymbol
+\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf at circuit@bipole at voltageoutsideofsymbol}
+\newif\ifpgf at circuit@bipole at strokedsymbol
+\ctikzset{bipole/is strokedsymbol/.is if=pgf at circuit@bipole at strokedsymbol}
+\newif\ifpgf at circuit@bipole at iscurrent
+\ctikzset{bipole/is current/.is if=pgf at circuit@bipole at iscurrent}
-% Option "boxed" for nodes and twoports
-\newif\ifpgf at circuit@boxed
-\pgfkeys{/tikz/boxed/.add code={}{\pgf at circuit@boxedtrue}}
-\ctikzset{boxed/.add code={}{\pgf at circuit@boxedtrue}}
-\pgfkeys{/tikz/box/.add code={}{\pgf at circuit@boxedtrue}}
-\ctikzset{box/.add code={}{\pgf at circuit@boxedtrue}}
+\ctikzset{bipole/voltage/.is family}
+\newif\ifpgf at circuit@bipole at voltage@backward
+\ctikzset{bipole/voltage/direction/.is choice}
+\ctikzset{bipole/voltage/direction/forward/.code={\pgf at circuit@bipole at voltage@backwardfalse}}
+\ctikzset{bipole/voltage/direction/backward/.code={\pgf at circuit@bipole at voltage@backwardtrue}}
+\newif\ifpgf at circuit@bipole at voltage@below
+\ctikzset{bipole/voltage/position/.is choice}
+\ctikzset{bipole/voltage/position/above/.code={\pgf at circuit@bipole at voltage@belowfalse}}
+\ctikzset{bipole/voltage/position/below/.code={\pgf at circuit@bipole at voltage@belowtrue}}
-% Option "dashed" for nodes and twoports
-\newif\ifpgf at circuit@dashed
-\pgfkeys{/tikz/dashed/.add code={}{\pgf at circuit@dashedtrue}}
-\ctikzset{dashed/.add code={}{\pgf at circuit@dashedtrue}}
+\ctikzset{bipole/voltage/label/unit/.initial=}
+\ctikzset{bipole/voltage/label/name/.initial=}
-% Option "t=*" for nodes
-\pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
+\ctikzset{bipole/current/.is family}
+\newif\ifpgf at circuit@bipole at current@backward
+\ctikzset{bipole/current/direction/.is choice}
+\ctikzset{bipole/current/direction/forward/.code={\pgf at circuit@bipole at current@backwardfalse}}
+\ctikzset{bipole/current/direction/backward/.code={\pgf at circuit@bipole at current@backwardtrue}}
+\newif\ifpgf at circuit@bipole at current@before
+\ctikzset{bipole/current/x position/.is choice}
+\ctikzset{bipole/current/x position/after/.code={\pgf at circuit@bipole at current@beforefalse}}
+\ctikzset{bipole/current/x position/before/.code={\pgf at circuit@bipole at current@beforetrue}}
+\newif\ifpgf at circuit@bipole at current@below
+\ctikzset{bipole/current/y position/.is choice}
+\ctikzset{bipole/current/y position/above/.code={\pgf at circuit@bipole at current@belowfalse}}
+\ctikzset{bipole/current/y position/below/.code={\pgf at circuit@bipole at current@belowtrue}}
+\ctikzset{bipole/current/label/unit/.initial=}
+\ctikzset{bipole/current/label/name/.initial=}
-\ctikzset{current arrow scale/.initial=16}
+\ctikzset{bipole/flow/.is family}
+\newif\ifpgf at circuit@bipole at flow@backward
+\ctikzset{bipole/flow/direction/.is choice}
+\ctikzset{bipole/flow/direction/forward/.code={\pgf at circuit@bipole at flow@backwardfalse}}
+\ctikzset{bipole/flow/direction/backward/.code={\pgf at circuit@bipole at flow@backwardtrue}}
+\newif\ifpgf at circuit@bipole at flow@before
+\ctikzset{bipole/flow/x position/.is choice}
+\ctikzset{bipole/flow/x position/after/.code={\pgf at circuit@bipole at flow@beforefalse}}
+\ctikzset{bipole/flow/x position/before/.code={\pgf at circuit@bipole at flow@beforetrue}}
+\newif\ifpgf at circuit@bipole at flow@below
+\ctikzset{bipole/flow/y position/.is choice}
+\ctikzset{bipole/flow/y position/above/.code={\pgf at circuit@bipole at flow@belowfalse}}
+\ctikzset{bipole/flow/y position/below/.code={\pgf at circuit@bipole at flow@belowtrue}}
+\ctikzset{bipole/flow/label/unit/.initial=}
+\ctikzset{bipole/flow/label/name/.initial=}
+\ctikzset{flow/distance/.initial = .5}
+\ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
-\ctikzset{bipoles/.is family}
+\ctikzset{bipole/label/.is family}
+\ctikzset{bipole/label/position/.initial=90}
+\ctikzset{bipole/label/unit/.initial=}
+\ctikzset{bipole/label/name/.initial=}
+\ctikzset{bipole/annotation/.is family}
+\ctikzset{bipole/annotation/position/.initial=-90}
+\ctikzset{bipole/annotation/unit/.initial=}
+\ctikzset{bipole/annotation/name/.initial=}
+
+\newif\ifpgf at circ@siunitx
+\newif\ifpgf at circ@siunitx at res
+
+\ctikzset{label/align/.is choice}
+\ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
+\ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
+\ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
+%%>>>
+
+% traditional styles %<<<1
+%
+\ctikzset{thickness/.initial=2}
+\ctikzset{color/.initial=black}
+\pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
\ctikzset{bipoles/border margin/.initial=1.1}
\ctikzset{bipoles/thickness/.initial=2}
\ctikzset{tripoles/thickness/.initial=2}
\ctikzset{quadpoles/thickness/.initial=2}
\ctikzset{nodes width/.initial=.04}
+%%>>>
-% Base len for all circuitikz
-\newdimen\pgf at circ@Rlen
-% scaled length for internal use in scalable shapes
-\newdimen\pgf at circ@scaled at Rlen
-\ctikzset{bipoles/length/.code={\pgf at circ@Rlen = #1\pgf at circ@scaled at Rlen=\pgf at circ@Rlen}}
-\pgf at circ@Rlen = 1.4cm
-% by default scale is 1.0
-\pgf at circ@scaled at Rlen=\pgf at circ@Rlen
+% Styles definitions and macros%<<<1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% main style definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
% load a style file: search ctikzstyle-NAME.tex in path
\def\ctikzloadstyle#1{%
\pgfutil at InputIfFileExists{ctikzstyle-#1}{}{%
@@ -395,8 +469,15 @@
\ctikzset{displays/scale/.initial=1.0}
\ctikzset{displays/fill/.initial=none}
\ctikzset{displays/thickness/.initial=none}
+%
+% general styles
+%
+\tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
+\tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
+\tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
+%%>>>
-% grounds and power supplies
+% grounds and power supplies%<<<1
\ctikzset{monopoles/.is family}
\ctikzset{monopoles/ground/width/.initial=.25}
@@ -423,24 +504,28 @@
\ctikzset{monopoles/bareantenna/width/.initial=.25}
\ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
\ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
-\ctikzset{monopoles/waves/width/.initial=0.5}
+\ctikzset{monopoles/waves/width/.initial=0.5}%
+%>>>
-% microstrips
+% microstrips %<<<1
\ctikzset{bipoles/mstline/height/.initial=0.3}
\ctikzset{bipoles/mstline/width/.initial=1.2}
\pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
\ctikzset{monopoles/msport/width/.initial=.5}
\ctikzset{monopoles/msrstub/height/.initial=1.0}
-\ctikzset{monopoles/msrstub/width/.initial=0.6}
+\ctikzset{monopoles/msrstub/width/.initial=0.6}%
+%>>>
-% microphone and loudspeaker
+% microphone and loudspeaker%<<<1
\ctikzset{bipoles/loudspeaker/height/.initial=.8}
\ctikzset{bipoles/loudspeaker/depth/.initial=.3}
\ctikzset{bipoles/loudspeaker/width/.initial=.8}
\ctikzset{bipoles/mic/height/.initial=1.2}
\ctikzset{bipoles/mic/depth/.initial=.1}
-\ctikzset{bipoles/mic/width/.initial=.8}
+\ctikzset{bipoles/mic/width/.initial=.8}%
+%>>>
+% resistors%<<<1
% Zig Zag resistors
\ctikzset{resistors/zigs/.initial=3}
\ctikzset{resistors/width/.code={%
@@ -501,8 +586,19 @@
\ctikzset{bipoles/tgeneric/height/.initial=.70}
\ctikzset{bipoles/tgeneric/width/.initial=.80}
\ctikzset{bipoles/ageneric/width/.initial=.80}
+\ctikzset{bipoles/memristor/height/.initial=.30}
+\ctikzset{bipoles/memristor/wave height/.initial=.5}
+\ctikzset{bipoles/memristor/width/.initial=.80}
-%% Capacitors
+\newif\ifpgf at circuit@europeanresistor
+\ctikzset{resistor/.is choice}
+\ctikzset{resistor/american/.code = \pgf at circuit@europeanresistorfalse }
+\ctikzset{resistor/european/.code = \pgf at circuit@europeanresistortrue }
+\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
+\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}
+%%>>>
+
+%% Capacitors%<<<1
\ctikzset{bipoles/capacitor/height/.initial=.6}
\ctikzset{bipoles/capacitor/width/.initial=.2}
\ctikzset{bipoles/ecapacitor/height/.initial=.5}
@@ -519,9 +615,10 @@
\ctikzset{bipoles/vcapacitor/width/.initial=.5}
\ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4}
\ctikzset{bipoles/piezoelectric/height/.initial=.7}
-\ctikzset{bipoles/piezoelectric/width/.initial=.5}
+\ctikzset{bipoles/piezoelectric/width/.initial=.5}%
+%>>>
-% Inductors
+% Inductors%<<<1
\ctikzset{inductors/coils/.code={%
\ctikzset{bipoles/cuteinductor/coils=#1}%
\ctikzset{bipoles/cutechoke/coils=#1}%
@@ -578,9 +675,21 @@
\ctikzset{bipoles/tfullgeneric/width/.initial=.80}
\ctikzset{bipoles/fullgeneric/height/.initial=.30}
\ctikzset{bipoles/fullgeneric/width/.initial=.80}
+\ctikzset{inductor/.is choice}
+\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
+\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
+\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
-% Sources
+\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
+\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
+\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
+\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
+\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
+%%>>>
+
+% Sources%<<<1
+
\ctikzset{bipoles/esource/height/.initial=.60}
\ctikzset{bipoles/esource/width/.initial=.60}
\ctikzset{bipoles/pvsource/height/.initial=.60}
@@ -632,7 +741,12 @@
\ctikzset{bipoles/battery1/width/.initial=.3}
\ctikzset{bipoles/battery2/height/.initial=.6}
\ctikzset{bipoles/battery2/width/.initial=.3}
+% noise sources
+\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
+%%>>>
+
+% "oo" style transformers and power grid diagrams%<<<1
% % % ootransformer
\ctikzset{bipoles/oosourcetrans/height/.initial=.6}
\ctikzset{bipoles/oosourcetrans/width/.initial=.6}
@@ -671,9 +785,10 @@
\pgfkeys{tikz/tert/.is choice}
\pgfkeys{tikz/tert/delta/.add code={}{\pgf at circ@tert at deltatrue}}
\pgfkeys{tikz/tert/wye/.add code={}{\pgf at circ@tert at wyetrue}}
-\pgfkeys{tikz/tert/zig/.add code={}{\pgf at circ@tert at zigtrue}}
+\pgfkeys{tikz/tert/zig/.add code={}{\pgf at circ@tert at zigtrue}}%
+%>>>
-% diodes
+% diodes%<<<1
\ctikzset{bipoles/diode/height/.initial=.50}
\ctikzset{bipoles/diode/width/.initial=.40}
@@ -683,9 +798,53 @@
\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
\ctikzset{bipoles/varcap/height/.initial=.50}
\ctikzset{bipoles/varcap/width/.initial=.45}
+\ctikzset{tripoles/thyristor/height/.initial=1.10}
+\ctikzset{tripoles/thyristor/height 2/.initial=.5}
+\ctikzset{tripoles/thyristor/width/.initial=1.0}
+\ctikzset{tripoles/thyristor/diode height/.initial=.5}
+\ctikzset{tripoles/thyristor/diode width left/.initial=.4}
+\ctikzset{tripoles/thyristor/diode width right/.initial=.3}
-% switches
+\ctikzset{tripoles/triac/height/.initial=1.1}
+\ctikzset{tripoles/triac/width/.initial=1}
+\ctikzset{tripoles/triac/diode width left/.initial=.3}
+\ctikzset{tripoles/triac/diode width right/.initial=.3}
+%
+% Flipping arrows in LED and photodiodes
+%
+\newif\ifpgf at led@fliparrows
+\newif\ifpgf at pd@fliparrows
+\pgf at led@fliparrowsfalse
+\pgf at pd@fliparrowsfalse
+%
+% by default the arrows start (LED) and go (PD) to the anode.
+%
+\ctikzset{led arrows from anode/.code=\pgf at led@fliparrowsfalse}
+\ctikzset{pd arrows to anode/.code=\pgf at pd@fliparrowsfalse}
+%
+% but they can start form the cathode (LED) or go to it (PD)
+%
+\ctikzset{led arrows from cathode/.code=\pgf at led@fliparrowstrue}
+\ctikzset{pd arrows to cathode/.code=\pgf at pd@fliparrowstrue}
+\newif\ifpgf at circuit@strokediode
+\newif\ifpgf at circuit@fulldiode
+\pgf at circuit@strokediodefalse
+\pgf at circuit@fulldiodefalse
+
+\ctikzset{diode/.is choice}
+\ctikzset{diode/empty/.code = \pgf at circuit@fulldiodefalse\pgf at circuit@strokediodefalse}%default
+\ctikzset{diode/full/.code = \pgf at circuit@fulldiodetrue }
+\ctikzset{diode/stroke/.code = \pgf at circuit@strokediodetrue}
+
+\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
+\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
+\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
+
+%%>>>
+
+% switches%<<<1
+
\ctikzset{bipoles/spst/height/.initial=.35}
\ctikzset{bipoles/spst/width/.initial=.35}
\ctikzset{bipoles/spst/depth/.initial=.2}
@@ -695,13 +854,31 @@
\ctikzset{bipoles/ncs/height/.initial=.35}
\ctikzset{bipoles/ncs/width/.initial=.35}
\ctikzset{bipoles/ncs/depth/.initial=.2}
+\ctikzset{bipoles/pushbutton/height/.initial=.5}
+\ctikzset{bipoles/pushbutton/height 2/.initial=.2}
+\ctikzset{bipoles/pushbutton/width/.initial=.50}
%%% reed switch
\ctikzset{bipoles/reed/height/.initial=.4}
\ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
\ctikzset{bipoles/reed/depth/.initial=.4}
+%% Cute switches
+\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
+\ctikzset{bipoles/cuteswitch/height/.initial=.6}
+\ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
+\ctikzset{bipoles/cuteswitch/width/.initial=.50}
+\ctikzset{bipoles/cuteswitch/thickness/.initial=1}
-% misc
+\ctikzset{tripoles/spdt/width/.initial=.85}
+\ctikzset{tripoles/spdt/height/.initial=.45}
+\ctikzset{tripoles/spdt/margin/.initial=.45}
+\ctikzset{tripoles/toggleswitch/height/.initial=.8}
+\ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
+\ctikzset{tripoles/toggleswitch/width/.initial=.80}
+%%>>>
+
+% arresters, fuses, lamps, etc%<<<1
+
\ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
\ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
\ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
@@ -715,9 +892,31 @@
\ctikzset{bipoles/fuse/width/.initial=.50}
\ctikzset{bipoles/afuse/height/.initial=.20}
\ctikzset{bipoles/afuse/width/.initial=.50}
-\ctikzset{bipoles/memristor/height/.initial=.30}
-\ctikzset{bipoles/memristor/wave height/.initial=.5}
-\ctikzset{bipoles/memristor/width/.initial=.80}
+\ctikzset{bipoles/lamp/height/.initial=.60}
+\ctikzset{bipoles/lamp/width/.initial=.60}
+\ctikzset{bipoles/bulb/height/.initial=.8}
+\ctikzset{bipoles/bulb/width/.initial=.8}
+\ctikzset{bipoles/tline/height/.initial=.3}
+\ctikzset{bipoles/tline/width/.initial=.8}
+\ctikzset{bipoles/squid/height/.initial=.60}
+\ctikzset{bipoles/squid/width/.initial=.60}
+\ctikzset{bipoles/barrier/height/.initial=.60}
+\ctikzset{bipoles/barrier/width/.initial=.60}
+\ctikzset{bipoles/openbarrier/gap/.initial=0.5}
+\ctikzset{bipoles/thermocouple/height/.initial=.250}
+\ctikzset{bipoles/thermocouple/height 2/.initial=.60}
+\ctikzset{bipoles/thermocouple/width/.initial=.140}
+\newif\ifpgf at circuit@europeangfsurgearrester
+\ctikzset{gas filled surge arrester choice/.is choice}
+\ctikzset{gas filled surge arrester choice/european/.code= {\pgf at circuit@europeangfsurgearrestertrue}}
+\ctikzset{gas filled surge arrester choice/american/.code= {\pgf at circuit@europeangfsurgearresterfalse}}
+
+\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
+\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
+%%>>>
+
+% wires (open, shorts, ...)%<<<1
+
\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
\ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
@@ -728,7 +927,11 @@
\ctikzset{bipoles/multiwire/height/.initial=0.4}
\ctikzset{bipoles/multiwire/width/.initial=0.2}
\ctikzset{bipoles/multiwire/spacing/.initial=0.05}
+% crossing wires
+\ctikzset{bipoles/crossing/size/.initial=.2}
+%%>>>
+% Instruments %<<<1
\ctikzset{bipoles/ammeter/height/.initial=.60}
\ctikzset{bipoles/ammeter/width/.initial=.60}
\ctikzset{bipoles/ohmmeter/height/.initial=.60}
@@ -759,31 +962,10 @@
\ctikzset{straight instruments/.add code={}{\pgf at circuit@straightinstrumentstrue}}
\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf at circuit@straightinstrumentsfalse}}
\ctikzset{rotated instruments/.add code={}{\pgf at circuit@straightinstrumentsfalse}}
+%%>>>
+% blocks (twoports and so)%<<<1
-\ctikzset{bipoles/buffer/height/.initial=1}
-\ctikzset{bipoles/buffer/width/.initial=1}
-\ctikzset{bipoles/not port/width/.initial=1}
-\ctikzset{bipoles/not port/height/.initial=.8}
-\ctikzset{bipoles/not port/circle width/.initial=.15}
-\ctikzset{bipoles/lamp/height/.initial=.60}
-\ctikzset{bipoles/lamp/width/.initial=.60}
-\ctikzset{bipoles/bulb/height/.initial=.8}
-\ctikzset{bipoles/bulb/width/.initial=.8}
-\ctikzset{bipoles/tline/height/.initial=.3}
-\ctikzset{bipoles/tline/width/.initial=.8}
-\ctikzset{bipoles/squid/height/.initial=.60}
-\ctikzset{bipoles/squid/width/.initial=.60}
-\ctikzset{bipoles/barrier/height/.initial=.60}
-\ctikzset{bipoles/barrier/width/.initial=.60}
-\ctikzset{bipoles/openbarrier/gap/.initial=0.5}
-\ctikzset{bipoles/thermocouple/height/.initial=.250}
-\ctikzset{bipoles/thermocouple/height 2/.initial=.60}
-\ctikzset{bipoles/thermocouple/width/.initial=.140}
-\ctikzset{bipoles/pushbutton/height/.initial=.5}
-\ctikzset{bipoles/pushbutton/height 2/.initial=.2}
-\ctikzset{bipoles/pushbutton/width/.initial=.50}
-
\ctikzset{bipoles/twoport/width/.initial=.7}
\ctikzset{bipoles/twoport/height/.initial=.7}
\ctikzset{bipoles/twoport/text/.initial=}
@@ -805,11 +987,16 @@
\ctikzset{bipoles/phaseshifter/width/.initial=.7}
\ctikzset{bipoles/vphaseshifter/width/.initial=.7}
\ctikzset{bipoles/detector/width/.initial=.7}
+\ctikzset{tripoles/mixer/width/.initial=0.7}
+\ctikzset{tripoles/adder/width/.initial=0.7}
+\ctikzset{tripoles/circulator/width/.initial=.7}
+\ctikzset{tripoles/oscillator/width/.initial=.7}
-% crossing wires
-\ctikzset{bipoles/crossing/size/.initial=.2}
+\ctikzset{tripoles/wilkinson/height/.initial=1.3}
+\ctikzset{tripoles/wilkinson/width/.initial=1.3}
+%%>>>
-% Transistors starts here
+% Transistors %<<<1
\newif\ifpgf at circuit@trans at depletiontype
\pgf at circuit@trans at depletiontypefalse
@@ -1203,10 +1390,44 @@
\ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
%% transistors stop here
+%%>>>
-%% Logic ports
+% Electronic tubes: diodetube, triode, tetrode and pentode%<<<1
+\ctikzset{tubes/width/.initial=1} % relative width
+\ctikzset{tubes/height/.initial=1.4} % relative height
+\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
+\ctikzset{tubes/anode distance/.initial=0.40} % distance from center
+\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
+\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
+\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
+\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
+\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
+\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
+\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
+\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
+\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
+\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
+\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
+
+\newif\ifpgf at circuit@tubes at filament\pgf at circuit@tubes at filamentfalse
+\pgfkeys{/tikz/filament/.add code={}{\pgf at circuit@tubes at filamenttrue}}
+\ctikzset{tubes/filament/.add code={}{\pgf at circuit@tubes at filamenttrue}}
+\newif\ifpgf at circuit@tubes at nocathode\pgf at circuit@tubes at nocathodefalse
+\pgfkeys{/tikz/nocathode/.add code={}{\pgf at circuit@tubes at nocathodetrue}}
+\ctikzset{tubes/nocathode/.add code={}{\pgf at circuit@tubes at nocathodetrue}}
+\newif\ifpgf at circuit@tubes at fullcathode\pgf at circuit@tubes at fullcathodefalse
+\pgfkeys{/tikz/fullcathode/.add code={}{\pgf at circuit@tubes at fullcathodetrue}}
+\ctikzset{tubes/fullcathode/.add code={}{\pgf at circuit@tubes at fullcathodetrue}}%
+%>>>
+
+%% Logic ports%<<<1
%% beware that the third option is in IEEE ports in pgfcircmultipoles.tex
+% switches for logic gates
+%
+\pgfkeys{/tikz/number inputs/.initial=0}
+\pgfkeys{/tikz/number inputs/.default=0}
+
\newif\ifpgf at circuit@europeanlogicport
\ctikzset{logic ports/.is choice}
\ctikzset{logic ports/european/.code= {\pgf at circuit@europeanlogicporttrue
@@ -1296,6 +1517,12 @@
\tikzset{all leads/.code={\pgfcirc at draw@output at leadstrue\pgfcirc at draw@input at leadstrue}}
\tikzset{no leads/.code={\pgfcirc at draw@output at leadsfalse\pgfcirc at draw@input at leadsfalse}}
+% old, legacy keys that should be killed over
+\ctikzset{bipoles/buffer/height/.initial=1}
+\ctikzset{bipoles/buffer/width/.initial=1}
+\ctikzset{bipoles/not port/width/.initial=1}
+\ctikzset{bipoles/not port/height/.initial=.8}
+\ctikzset{bipoles/not port/circle width/.initial=.15}
\ctikzset{tripoles/american and port/width/.initial=1.1}
\ctikzset{tripoles/american and port/height/.initial=.8}
@@ -1429,11 +1656,10 @@
\ctikzset{tripoles/american xnor port/bbb/.initial=.4}
\ctikzset{tripoles/american xnor port/ccc/.initial=.5}
\ctikzset{tripoles/american xnor port/ddd/.initial=.0}
-% switches for logic gates
-%
-\pgfkeys{/tikz/number inputs/.initial=0}
-\pgfkeys{/tikz/number inputs/.default=0}
+%%>>>
+% flip flops and muxdemxes%<<<1
+
%% flip-flop specific keys (most others are the same as chips)
\ctikzset{multipoles/flipflop/font/.initial=\pgf at circ@font at small}
@@ -1455,7 +1681,10 @@
\ctikzset{multipoles/muxdemux/NR/.initial=1}
\ctikzset{multipoles/muxdemux/NB/.initial=3}
\ctikzset{multipoles/muxdemux/NT/.initial=0}
-\ctikzset{multipoles/muxdemux/square pins/.initial=0}
+\ctikzset{multipoles/muxdemux/square pins/.initial=0}%
+%>>>
+
+% Amplifiers%<<<1
%
% switches for op amps
% changing input polarity
@@ -1576,43 +1805,10 @@
\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
\def\pgf at circ@ampli at plus{\ctikzvalof{amplifiers/plus}}
\def\pgf at circ@ampli at minus{\ctikzvalof{amplifiers/minus}}
+%%>>>
-\ctikzset{tripoles/thyristor/height/.initial=1.10}
-\ctikzset{tripoles/thyristor/height 2/.initial=.5}
-\ctikzset{tripoles/thyristor/width/.initial=1.0}
-\ctikzset{tripoles/thyristor/diode height/.initial=.5}
-\ctikzset{tripoles/thyristor/diode width left/.initial=.4}
-\ctikzset{tripoles/thyristor/diode width right/.initial=.3}
+% Transformers%<<<1
-\ctikzset{tripoles/triac/height/.initial=1.1}
-\ctikzset{tripoles/triac/width/.initial=1}
-\ctikzset{tripoles/triac/diode width left/.initial=.3}
-\ctikzset{tripoles/triac/diode width right/.initial=.3}
-
-%% Cute switches
-\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
-\ctikzset{bipoles/cuteswitch/height/.initial=.6}
-\ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
-\ctikzset{bipoles/cuteswitch/width/.initial=.50}
-\ctikzset{bipoles/cuteswitch/thickness/.initial=1}
-
-\ctikzset{tripoles/spdt/width/.initial=.85}
-\ctikzset{tripoles/spdt/height/.initial=.45}
-\ctikzset{tripoles/spdt/margin/.initial=.45}
-
-\ctikzset{tripoles/toggleswitch/height/.initial=.8}
-\ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
-\ctikzset{tripoles/toggleswitch/width/.initial=.80}
-
-\ctikzset{tripoles/mixer/width/.initial=0.7}
-\ctikzset{tripoles/adder/width/.initial=0.7}
-\ctikzset{tripoles/circulator/width/.initial=.7}
-\ctikzset{tripoles/oscillator/width/.initial=.7}
-
-
-\ctikzset{tripoles/wilkinson/height/.initial=1.3}
-\ctikzset{tripoles/wilkinson/width/.initial=1.3}
-
\ctikzset{quadpoles/transformer/inner/.initial=0.4}
\ctikzset{quadpoles/transformer/width/.initial=1.5}
\ctikzset{quadpoles/transformer/width1/.initial=.4}
@@ -1654,9 +1850,105 @@
\ctikzset{quadpoles/gyrator/width=0.6}%
}%
}
+%%>>>
+% seven segment displays by RGtti%<<<1
+
+\newif\ifpgf at circ@sevenseg at dot
+\newif\ifpgf at circ@sevenseg at box
+\def\pgf at circ@sevenseg at dotstate{empty}
+\ctikzset{seven seg/.is family}
+\ctikzset{seven seg/dot/.is choice}
+% none means no dot, not space for it. Empty means no dot, but space
+\ctikzset{seven seg/dot/none/.code={\pgf at circ@sevenseg at dotfalse}}
+\ctikzset{seven seg/dot/empty/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{empty}}}
+\ctikzset{seven seg/dot/off/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{off}}}
+\ctikzset{seven seg/dot/on/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{on}}}
%
-% multipoles
+\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf at circ@Rlen
+\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
+\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
+\ctikzset{seven seg/box sep/.initial=1pt}% external box gap
+\ctikzset{seven seg/color on/.initial=red}% color for segment "on"
+\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
+\ctikzset{seven seg/box/.is choice}
+\ctikzset{seven seg/box/off/.code={\pgf at circ@sevenseg at boxfalse}}
+\ctikzset{seven seg/box/on/.code={\pgf at circ@sevenseg at boxtrue}}
+
+\ctikzset{seven seg/bits/.initial=0000000}
+
+\ctikzset{seven seg/value/.code={%
+ \edef\@@tmp{#1}%
+ \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
+ \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
+ \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
+ \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
+ \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
+ \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
+ \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
+ \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
+ \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
+ \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
+ \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
+}}
+
+\tikzset{%
+ seven segment val/.style args={#1dot#2box#3}{%
+ shape=bare7seg,
+ /tikz/circuitikz/seven seg/value=#1,
+ /tikz/circuitikz/seven seg/dot=#2,
+ /tikz/circuitikz/seven seg/box=#3,
+ },
+ seven segment bits/.style args={#1dot#2box#3}{%
+ shape=bare7seg,
+ /tikz/circuitikz/seven seg/bits=#1,
+ /tikz/circuitikz/seven seg/dot=#2,
+ /tikz/circuitikz/seven seg/box=#3,
+ },
+}
+%%>>>
+
+% Options for twoports and blocks%<<<1
+
+% Option ">" for twoports
+\newif\ifpgf at circuit@inputarrow
+\ctikzset{>/.add code={}{\pgf at circuit@inputarrowtrue}}
+\ctikzset{inputarrow/.is choice}
+\ctikzset{inputarrow/true/.code={\pgf at circuit@inputarrowtrue}}
+\ctikzset{inputarrow/false/.code={\pgf at circuit@inputarrowfalse}}
+
+% Option "boxed" for nodes and twoports
+\newif\ifpgf at circuit@boxed
+\pgfkeys{/tikz/boxed/.add code={}{\pgf at circuit@boxedtrue}}
+\ctikzset{boxed/.add code={}{\pgf at circuit@boxedtrue}}
+\pgfkeys{/tikz/box/.add code={}{\pgf at circuit@boxedtrue}}
+\ctikzset{box/.add code={}{\pgf at circuit@boxedtrue}}
+
+% Option "dashed" for nodes and twoports
+\newif\ifpgf at circuit@dashed
+\pgfkeys{/tikz/dashed/.add code={}{\pgf at circuit@dashedtrue}}
+\ctikzset{dashed/.add code={}{\pgf at circuit@dashedtrue}}%
+%>>>
+
+% Chips and Rotary switches (multipoles) %<<<1
%
\ctikzset{multipoles/thickness/.initial=2}
\ctikzset{multipoles/font/.initial=\pgf at circ@font at tiny}
@@ -1738,8 +2030,9 @@
rotary switch ->/.default={5 in 60 wiper 20},
rotary switch <->/.default={5 in 60 wiper 20},
}
+%%>>>
-% %Mechanical section
+% %Mechanical section%<<<1
\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
\ctikzset{bipoles/spring/height/.initial=.5}
@@ -1753,142 +2046,56 @@
\ctikzset{bipoles/damper/height/.initial=.35}
\ctikzset{bipoles/damper/length/.initial=.3}
\ctikzset{bipoles/damper/width/.initial=.4}
+%%>>>
+% powerelectronic blocks%<<<1
+\ctikzset{bipoles/sacdc/width/.initial=.7}
+\ctikzset{bipoles/sdcac/width/.initial=.7}
+\ctikzset{bipoles/tacdc/width/.initial=.7}
+\ctikzset{bipoles/tdcac/width/.initial=.7}
+\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
+%>>>
-\ctikzset{bipole/.is family}
-\ctikzset{bipole/kind/.initial=}
-\ctikzset{bipole/name/.initial=}
-\newif\ifpgf at circuit@bipole at isvoltage
-\ctikzset{bipole/is voltage/.is if=pgf at circuit@bipole at isvoltage}
-\newif\ifpgf at circuit@bipole at voltageoutsideofsymbol
-\ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf at circuit@bipole at voltageoutsideofsymbol}
-\newif\ifpgf at circuit@bipole at strokedsymbol
-\ctikzset{bipole/is strokedsymbol/.is if=pgf at circuit@bipole at strokedsymbol}
-\newif\ifpgf at circuit@bipole at iscurrent
-\ctikzset{bipole/is current/.is if=pgf at circuit@bipole at iscurrent}
-
-\ctikzset{bipole/voltage/.is family}
-\newif\ifpgf at circuit@bipole at voltage@backward
-\ctikzset{bipole/voltage/direction/.is choice}
-\ctikzset{bipole/voltage/direction/forward/.code={\pgf at circuit@bipole at voltage@backwardfalse}}
-\ctikzset{bipole/voltage/direction/backward/.code={\pgf at circuit@bipole at voltage@backwardtrue}}
-\newif\ifpgf at circuit@bipole at voltage@below
-\ctikzset{bipole/voltage/position/.is choice}
-\ctikzset{bipole/voltage/position/above/.code={\pgf at circuit@bipole at voltage@belowfalse}}
-\ctikzset{bipole/voltage/position/below/.code={\pgf at circuit@bipole at voltage@belowtrue}}
-
-\ctikzset{bipole/voltage/label/unit/.initial=}
-\ctikzset{bipole/voltage/label/name/.initial=}
-
-\ctikzset{bipole/current/.is family}
-\newif\ifpgf at circuit@bipole at current@backward
-\ctikzset{bipole/current/direction/.is choice}
-\ctikzset{bipole/current/direction/forward/.code={\pgf at circuit@bipole at current@backwardfalse}}
-\ctikzset{bipole/current/direction/backward/.code={\pgf at circuit@bipole at current@backwardtrue}}
-\newif\ifpgf at circuit@bipole at current@before
-\ctikzset{bipole/current/x position/.is choice}
-\ctikzset{bipole/current/x position/after/.code={\pgf at circuit@bipole at current@beforefalse}}
-\ctikzset{bipole/current/x position/before/.code={\pgf at circuit@bipole at current@beforetrue}}
-\newif\ifpgf at circuit@bipole at current@below
-\ctikzset{bipole/current/y position/.is choice}
-\ctikzset{bipole/current/y position/above/.code={\pgf at circuit@bipole at current@belowfalse}}
-\ctikzset{bipole/current/y position/below/.code={\pgf at circuit@bipole at current@belowtrue}}
-\ctikzset{bipole/current/label/unit/.initial=}
-\ctikzset{bipole/current/label/name/.initial=}
-
-\ctikzset{bipole/flow/.is family}
-\newif\ifpgf at circuit@bipole at flow@backward
-\ctikzset{bipole/flow/direction/.is choice}
-\ctikzset{bipole/flow/direction/forward/.code={\pgf at circuit@bipole at flow@backwardfalse}}
-\ctikzset{bipole/flow/direction/backward/.code={\pgf at circuit@bipole at flow@backwardtrue}}
-\newif\ifpgf at circuit@bipole at flow@before
-\ctikzset{bipole/flow/x position/.is choice}
-\ctikzset{bipole/flow/x position/after/.code={\pgf at circuit@bipole at flow@beforefalse}}
-\ctikzset{bipole/flow/x position/before/.code={\pgf at circuit@bipole at flow@beforetrue}}
-\newif\ifpgf at circuit@bipole at flow@below
-\ctikzset{bipole/flow/y position/.is choice}
-\ctikzset{bipole/flow/y position/above/.code={\pgf at circuit@bipole at flow@belowfalse}}
-\ctikzset{bipole/flow/y position/below/.code={\pgf at circuit@bipole at flow@belowtrue}}
-\ctikzset{bipole/flow/label/unit/.initial=}
-\ctikzset{bipole/flow/label/name/.initial=}
-\ctikzset{flow/distance/.initial = .5}
-\ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
-
-\ctikzset{bipole/label/.is family}
-\ctikzset{bipole/label/position/.initial=90}
-\ctikzset{bipole/label/unit/.initial=}
-\ctikzset{bipole/label/name/.initial=}
-\ctikzset{bipole/annotation/.is family}
-\ctikzset{bipole/annotation/position/.initial=-90}
-\ctikzset{bipole/annotation/unit/.initial=}
-\ctikzset{bipole/annotation/name/.initial=}
-
-\newif\ifpgf at circuit@europeanresistor
-\ctikzset{resistor/.is choice}
-\ctikzset{resistor/american/.code = \pgf at circuit@europeanresistorfalse }
-\ctikzset{resistor/european/.code = \pgf at circuit@europeanresistortrue }
-
-\ctikzset{inductor/.is choice}
-\ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
-\ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
-\ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
-
+% voltage and current options%<<<1
%
-% Flipping arrows in LED and photodiodes
-%
-\newif\ifpgf at led@fliparrows
-\newif\ifpgf at pd@fliparrows
-\pgf at led@fliparrowsfalse
-\pgf at pd@fliparrowsfalse
-%
-% by default the arrows start (LED) and go (PD) to the anode.
-%
-\ctikzset{led arrows from anode/.code=\pgf at led@fliparrowsfalse}
-\ctikzset{pd arrows to anode/.code=\pgf at pd@fliparrowsfalse}
-%
-% but they can start form the cathode (LED) or go to it (PD)
-%
-\ctikzset{led arrows from cathode/.code=\pgf at led@fliparrowstrue}
-\ctikzset{pd arrows to cathode/.code=\pgf at pd@fliparrowstrue}
+\ctikzset{current arrow scale/.initial=16}
+\ctikzset{current/distance/.initial = .5}
-\newif\ifpgf at circuit@strokediode
-\newif\ifpgf at circuit@fulldiode
-\pgf at circuit@strokediodefalse
-\pgf at circuit@fulldiodefalse
-
-\ctikzset{diode/.is choice}
-\ctikzset{diode/empty/.code = \pgf at circuit@fulldiodefalse\pgf at circuit@strokediodefalse}%default
-\ctikzset{diode/full/.code = \pgf at circuit@fulldiodetrue }
-\ctikzset{diode/stroke/.code = \pgf at circuit@strokediodetrue}
-
-\tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
-\tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
-\tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
-
-\ctikzset{thickness/.initial=2}
-\ctikzset{color/.initial=black}
-\pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
-
-\newif\ifpgf at circ@siunitx
-\newif\ifpgf at circ@siunitx at res
-
-%
-% voltage and current options
-%
-
\newif\ifpgf at circuit@europeancurrent
\newif\ifpgf at circuit@europeanvoltage
\newif\ifpgf at circuit@bipole at voltage@straight
+\newif\ifpgf at circuit@bipole at voltage@raised
\ctikzset{voltage/.is choice}
%
% straight is expected to be a subset of european, so disable it in american style
%
-\ctikzset{voltage/american/.code = {\pgf at circuit@europeanvoltagefalse\pgf at circuit@bipole at voltage@straightfalse}}
-\ctikzset{voltage/european/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straightfalse}}
-\ctikzset{voltage/straight/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straighttrue}}
-\ctikzset{voltage/curved/.code = {\pgf at circuit@europeanvoltagetrue\pgf at circuit@bipole at voltage@straightfalse}}
-
+\ctikzset{voltage/american/.code = {%
+ \pgf at circuit@europeanvoltagefalse
+ \pgf at circuit@bipole at voltage@straightfalse
+ \pgf at circuit@bipole at voltage@raisedfalse
+}}
+\ctikzset{voltage/raised/.code = {%
+ \pgf at circuit@europeanvoltagefalse
+ \pgf at circuit@bipole at voltage@straightfalse
+ \pgf at circuit@bipole at voltage@raisedtrue
+}}
+\ctikzset{voltage/european/.code = {%
+ \pgf at circuit@europeanvoltagetrue
+ \pgf at circuit@bipole at voltage@straightfalse
+ \pgf at circuit@bipole at voltage@raisedfalse
+}}
+\ctikzset{voltage/straight/.code = {%
+ \pgf at circuit@europeanvoltagetrue
+ \pgf at circuit@bipole at voltage@straighttrue
+ \pgf at circuit@bipole at voltage@raisedfalse
+}}
+\ctikzset{voltage/curved/.code = {%
+ \pgf at circuit@europeanvoltagetrue
+ \pgf at circuit@bipole at voltage@straightfalse
+ \pgf at circuit@bipole at voltage@raisedfalse
+}}
+% are these used?
\ctikzset{current/.is choice}
\ctikzset{current/american/.code = \pgf at circuit@europeancurrentfalse}
\ctikzset{current/european/.code = \pgf at circuit@europeancurrenttrue}
@@ -1903,9 +2110,17 @@
% above. I hope it is ok --- would be a mess otherwise
%
\ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
-\ctikzset{voltage shift/.style={voltage/shift=#1}}
+\ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
\tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
-
+%
+% keys for exporting voltage, current, flow anchors
+%
+\newif\ifpgfcirc at has@v\pgfcirc at has@vfalse
+\newif\ifpgfcirc at has@f\pgfcirc at has@ffalse
+\newif\ifpgfcirc at has@i\pgfcirc at has@ifalse
+\def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname}
+\def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname}
+%
% shaping the +/- sign, see pgfcircvoltage.tex
\ctikzset{voltage/american font/.initial={}}
\ctikzset{voltage/american plus/.initial={$+$}}
@@ -1938,13 +2153,29 @@
\ctikzset{voltage/european label distance/.initial=1.4}
\ctikzset{voltage/straight label distance/.initial=1.4}
\ctikzset{voltage/american label distance/.initial=1.4}
+% american open voltage adjusting
%
+\newif\ifpgf at adjust@open at voltage\pgf at adjust@open at voltagetrue
+\ctikzset{american open voltage/.is choice}
+\ctikzset{american open voltage/center/.code={\pgf at adjust@open at voltagetrue}}
+\ctikzset{american open voltage/legacy/.code={\pgf at adjust@open at voltagefalse}}
+%
+% voltage and current styles
+%
+\tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
+\tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
+\tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
+\tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
+\tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
+\tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}}
+%%>>>
+
+% special cases for voltage positions%<<<1
% the KIND is the node name without SHAPE
% See the definition above for meaning
% if bipoles/KIND/voltage/straight label distance is not defined, it uses the height
% if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance)
%
-% special cases for voltage positions
\ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4}
\ctikzset{bipoles/generic/voltage/bump b/.initial=2}
%
@@ -1992,169 +2223,7 @@
\ctikzset{bipoles/battery/voltage/bump a/.initial=1.4}
\ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2}
\ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2}
-%
-% american open voltage adjusting
-%
-\newif\ifpgf at adjust@open at voltage\pgf at adjust@open at voltagetrue
-\ctikzset{american open voltage/.is choice}
-\ctikzset{american open voltage/center/.code={\pgf at adjust@open at voltagetrue}}
-\ctikzset{american open voltage/legacy/.code={\pgf at adjust@open at voltagefalse}}
-%
-% currents
-%
-\ctikzset{current/distance/.initial = .5}
+%%>>>
-%
-% voltage and current styles
-%
-
-\tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
-\tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
-\tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
-\tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
-\tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
-\tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
-\tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}
-
-\newif\ifpgf at circuit@europeangfsurgearrester
-\ctikzset{gas filled surge arrester choice/.is choice}
-\ctikzset{gas filled surge arrester choice/european/.code= {\pgf at circuit@europeangfsurgearrestertrue}}
-\ctikzset{gas filled surge arrester choice/american/.code= {\pgf at circuit@europeangfsurgearresterfalse}}
-
-\tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
-\tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
-\tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
-\tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
-\tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
-\tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
-\tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
-
-%
-% general styles
-%
-
-\tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
-\tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
-\tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
-
-
-% noise sources
-\ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
-
-\ctikzset{label/align/.is choice}
-\ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
-\ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
-\ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
-
-% seven segment displays by RGtti
-
-\newif\ifpgf at circ@sevenseg at dot
-\newif\ifpgf at circ@sevenseg at box
-\def\pgf at circ@sevenseg at dotstate{empty}
-\ctikzset{seven seg/.is family}
-\ctikzset{seven seg/dot/.is choice}
-% none means no dot, not space for it. Empty means no dot, but space
-\ctikzset{seven seg/dot/none/.code={\pgf at circ@sevenseg at dotfalse}}
-\ctikzset{seven seg/dot/empty/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{empty}}}
-\ctikzset{seven seg/dot/off/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{off}}}
-\ctikzset{seven seg/dot/on/.code={\pgf at circ@sevenseg at dottrue\def\pgf at circ@sevenseg at dotstate{on}}}
-%
-\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf at circ@Rlen
-\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
-\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
-\ctikzset{seven seg/box sep/.initial=1pt}% external box gap
-\ctikzset{seven seg/color on/.initial=red}% color for segment "on"
-\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
-\ctikzset{seven seg/box/.is choice}
-\ctikzset{seven seg/box/off/.code={\pgf at circ@sevenseg at boxfalse}}
-\ctikzset{seven seg/box/on/.code={\pgf at circ@sevenseg at boxtrue}}
-
-\ctikzset{seven seg/bits/.initial=0000000}
-
-\ctikzset{seven seg/value/.code={%
- \edef\@@tmp{#1}%
- \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
- \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
- \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
- \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
- \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
- \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
- \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
- \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
- \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
- \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
- \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
- \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
- \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
- \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
- \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
- \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
- \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
- \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
- \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
- \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
- \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
- \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
- \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
- \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
- \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
- \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
- \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
- \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
- \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
-}}
-
-\tikzset{%
- seven segment val/.style args={#1dot#2box#3}{%
- shape=bare7seg,
- /tikz/circuitikz/seven seg/value=#1,
- /tikz/circuitikz/seven seg/dot=#2,
- /tikz/circuitikz/seven seg/box=#3,
- },
- seven segment bits/.style args={#1dot#2box#3}{%
- shape=bare7seg,
- /tikz/circuitikz/seven seg/bits=#1,
- /tikz/circuitikz/seven seg/dot=#2,
- /tikz/circuitikz/seven seg/box=#3,
- },
-}
-
-
-%%%%%%%%%% new
-\pgfkeys{\circuitikzbasekey/.search also={/tikz}}
-
-% Electronic tubes: diodetube, triode, tetrode and pentode
-\ctikzset{tubes/width/.initial=1} % relative width
-\ctikzset{tubes/height/.initial=1.4} % relative height
-\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
-\ctikzset{tubes/anode distance/.initial=0.40} % distance from center
-\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
-\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
-\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
-\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
-\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
-\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
-\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
-\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
-\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
-\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
-\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
-
-\newif\ifpgf at circuit@tubes at filament\pgf at circuit@tubes at filamentfalse
-\pgfkeys{/tikz/filament/.add code={}{\pgf at circuit@tubes at filamenttrue}}
-\ctikzset{tubes/filament/.add code={}{\pgf at circuit@tubes at filamenttrue}}
-\newif\ifpgf at circuit@tubes at nocathode\pgf at circuit@tubes at nocathodefalse
-\pgfkeys{/tikz/nocathode/.add code={}{\pgf at circuit@tubes at nocathodetrue}}
-\ctikzset{tubes/nocathode/.add code={}{\pgf at circuit@tubes at nocathodetrue}}
-\newif\ifpgf at circuit@tubes at fullcathode\pgf at circuit@tubes at fullcathodefalse
-\pgfkeys{/tikz/fullcathode/.add code={}{\pgf at circuit@tubes at fullcathodetrue}}
-\ctikzset{tubes/fullcathode/.add code={}{\pgf at circuit@tubes at fullcathodetrue}}
-
-% powerelectronic blocks
-\ctikzset{bipoles/sacdc/width/.initial=.7}
-\ctikzset{bipoles/sdcac/width/.initial=.7}
-\ctikzset{bipoles/tacdc/width/.initial=.7}
-\ctikzset{bipoles/tdcac/width/.initial=.7}
-\ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
-
\endinput
+% vim: set fdm=marker fmr=%<<<,%>>>:
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirccurrent.tex 2020-07-07 21:11:46 UTC (rev 55771)
@@ -88,6 +88,7 @@
}
\ctikzset{i/.code = {
+ \pgfcirc at has@itrue
\pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
\circuitikzbasekey/bipole/current/x position = after,
\circuitikzbasekey/bipole/current/y position = above }
@@ -131,8 +132,8 @@
%% Output routine
\def\pgf at circ@drawcurrent{
\pgfextra{
- \edef\pgf at circ@ffffff{\pgf at circ@direction}
- \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@ffffff\pgf at nil}
+ \edef\pgf at circ@rounded at dir{\pgf at circ@direction}
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@rounded at dir\pgf at nil}
\ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
\ifpgf at circuit@bipole at current@below
@@ -178,36 +179,50 @@
\ifpgf at circuit@bipole at current@below
\def\pgf at circ@dir{north}\else\def\pgf at circ@dir{south}
\fi
- \fi
+ \fi
+ % export anchor position (if not needed, is always the same macro)
+ \expandafter\xdef\csname pgfcirc@\pgfcirc at a@prefix-Ilab-anchor\endcsname{\pgf at circ@dir}
- \ifpgf at circuit@bipole at current@below
- \def\pgf at circ@bipole at current@label at where{-90}
- \else
- \def\pgf at circ@bipole at current@label at where{+90}
- \fi
+ \ifpgf at circuit@bipole at current@below
+ \def\pgf at circ@bipole at current@label at where{-90}
+ \else
+ \def\pgf at circ@bipole at current@label at where{+90}
+ \fi
}
+ %
\pgfextra{\def\pgf at temp{short}\edef\pgf at circ@temp{\ctikzvalof{bipole/kind}}}
\ifx\pgf at circ@temp\pgf at temp%draw current at a short at middle of the line
- (\tikztostart)--(\tikztotarget)
+ coordinate (\pgfcirc at a@prefix-Ifrom) at (\tikztostart)
+ coordinate (\pgfcirc at a@prefix-Ito) at (\tikztotarget)
\else% normal bipole or source
\ifpgf at circuit@bipole at current@before
- (\tikztostart)--(anchorstartnode)
+ coordinate (\pgfcirc at a@prefix-Ifrom) at (\tikztostart)
+ coordinate (\pgfcirc at a@prefix-Ito) at (anchorstartnode)
\else
- (anchorendnode)--(\tikztotarget)
+ coordinate (\pgfcirc at a@prefix-Ifrom) at (anchorendnode)
+ coordinate (\pgfcirc at a@prefix-Ito) at (\tikztotarget)
\fi
\fi
\ifpgf at circuit@bipole at current@backward
\pgfextra{
- \pgfmathsubtract{\pgf at circ@ffffff}{180}
- \edef\pgf at circ@ffffff{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
+ \pgfmathsubtract{\pgf at circ@rounded at dir}{180}
+ \edef\pgf at circ@rounded at dir{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
}
\fi
- coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf at circ@ffffff,
- anchor=center](Iarrow)
- (Iarrow.\pgf at circ@bipole at current@label at where)
+ coordinate (\pgfcirc at a@prefix-Ipos) at ($(\pgfcirc at a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc at a@prefix-Ito)$)
+ % if the current label is not empty (in which case we have already all the anchors)
+ \pgf at circ@ifkeyempty{bipole/current/label/name}\else
+ % put the arrow node
+ node[currarrow, rotate=\pgf at circ@rounded at dir, anchor=center](Iarrow) at (\pgfcirc at a@prefix-Ipos) {}
+ % put the label
node[anchor=\pgf at circ@dir, \circuitikzbasekey/bipole current style]
- (\ctikzvalof{bipole/name}current){\pgf at circ@finallabels{current/label}}
+ (\ctikzvalof{bipole/name}current)
+ at (Iarrow.\pgf at circ@bipole at current@label at where){\pgf at circ@finallabels{current/label}}
+ \fi % end ifempty
+ \ifpgf at circuit@bipole at current@backward
+ \pgfcirc at swap@coordinates{\pgfcirc at a@prefix-Ifrom}{\pgfcirc at a@prefix-Ito}
+ \fi
}
\endinput
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircflow.tex 2020-07-07 21:11:46 UTC (rev 55771)
@@ -13,6 +13,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% flow handling
+
%% styles
\ctikzset{bipole flow style/.style={}}
\tikzset{bipole flow style/.code={
@@ -27,7 +28,7 @@
f = #1,
\circuitikzbasekey/bipole/flow/direction = forward,
\circuitikzbasekey/bipole/flow/x position = after,
- \circuitikzbasekey/bipole/curflowrent/y position = above
+ \circuitikzbasekey/bipole/flow/y position = above
}
}
@@ -93,6 +94,7 @@
\ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } }
\ctikzset{f/.code = {
+ \pgfcirc at has@ftrue
\pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
\circuitikzbasekey/bipole/flow/x position = after,
\circuitikzbasekey/bipole/flow/y position = above }
@@ -113,10 +115,11 @@
}
%% Output routine
+
\def\pgf at circ@drawflow{
\pgfextra{
- \edef\pgf at circ@ffffff{\pgf at circ@direction}
- \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@ffffff\pgf at nil}
+ \edef\pgf at circ@rounded at dir{\pgf at circ@direction}
+ \def\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@rounded at dir\pgf at nil}
\ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
\ifpgf at circuit@bipole at flow@below
@@ -169,38 +172,62 @@
\else
\def\pgf at circ@bipole at flow@label at where{+90}
\fi
+ % export anchor position (if not needed, is always the same macro)
+ \expandafter\xdef\csname pgfcirc@\pgfcirc at a@prefix-Flab-anchor\endcsname{\pgf at circ@dir}
}
\pgfextra{\def\pgf at temp{short}\edef\pgf at circ@temp{\ctikzvalof{bipole/kind}}}
- \ifx\pgf at circ@temp\pgf at temp%draw flow at a short at middle of the line
- (\tikztostart)--(\tikztotarget)
+ \ifx\pgf at circ@temp\pgf at temp%draw current at a short at middle of the line
+ coordinate (pgfcirc at Ffrom@flat) at (\tikztostart)
+ coordinate (pgfcirc at Fto@flat) at (\tikztotarget)
\else% normal bipole or source
\ifpgf at circuit@bipole at flow@before
- (\tikztostart)--(anchorstartnode)
+ coordinate (pgfcirc at Ffrom@flat) at (\tikztostart)
+ coordinate (pgfcirc at Fto@flat) at (anchorstartnode)
\else
- (anchorendnode)--(\tikztotarget)
+ coordinate (pgfcirc at Ffrom@flat) at (anchorendnode)
+ coordinate (pgfcirc at Fto@flat) at (\tikztotarget)
\fi
\fi
\pgfextra{
+ \newdimen{\absfshift}
+ \def\flow at offset{\ctikzvalof{flow/offset}\pgf at circ@Rlen}
+ \absfshift=\flow at offset
\ifpgf at circuit@bipole at flow@backward
- \ifpgf at circuit@bipole at flow@below
- \def\flow at offset{\ctikzvalof{flow/offset}\pgf at circ@Rlen}
- \else
- \def\flow at offset{-\ctikzvalof{flow/offset}\pgf at circ@Rlen}
- \fi
- \pgfmathsubtract{\pgf at circ@ffffff}{180}
- \edef\pgf at circ@ffffff{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
- \else
- \ifpgf at circuit@bipole at flow@below
- \def\flow at offset{-\ctikzvalof{flow/offset}\pgf at circ@Rlen}
- \else
- \def\flow at offset{\ctikzvalof{flow/offset}\pgf at circ@Rlen}
- \fi
+ \pgfmathsubtract{\pgf at circ@rounded at dir}{180}
+ \edef\pgf at circ@rounded at dir{\expandafter\pgf at circ@stripdecimals\pgfmathresult\pgf at nil}
\fi
}
- coordinate[flowarrow,pos=\ctikzvalof{flow/distance},rotate=\pgf at circ@ffffff,yshift=\flow at offset, anchor=center](Farrowpos)
- (Farrowpos.\pgf at circ@bipole at flow@label at where) node[anchor=\pgf at circ@dir, \circuitikzbasekey/bipole flow style]
- (\ctikzvalof{bipole/name}flow){\pgf at circ@finallabels{flow/label}}
+ \ifpgf at circuit@bipole at flow@below
+ coordinate (pgfcirc at Ffrom@up) at ($(pgfcirc at Ffrom@flat) ! \absfshift !-90: (pgfcirc at Fto@flat)$)
+ coordinate (pgfcirc at Fto@up) at ($(pgfcirc at Fto@flat) ! \absfshift !90: (pgfcirc at Ffrom@flat)$)
+ \else
+ coordinate (pgfcirc at Ffrom@up) at ($(pgfcirc at Ffrom@flat) ! \absfshift !90: (pgfcirc at Fto@flat)$)
+ coordinate (pgfcirc at Fto@up) at ($(pgfcirc at Fto@flat) ! \absfshift !-90: (pgfcirc at Ffrom@flat)$)
+ \fi
+ coordinate (\pgfcirc at a@prefix-Fpos) at ($(pgfcirc at Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc at Fto@up)$)
+ \pgfextra{
+ \absfshift=0.25\pgf at circ@Rlen% This is half size of the "flowarrow" shape!
+ }
+ coordinate (\pgfcirc at a@prefix-Ffrom) at ($(\pgfcirc at a@prefix-Fpos)!\absfshift!(pgfcirc at Ffrom@up)$)
+ coordinate (\pgfcirc at a@prefix-Fto) at ($(\pgfcirc at a@prefix-Fpos)!\absfshift!(pgfcirc at Fto@up) $)
+ %
+ % coordinate (\pgfcirc at a@prefix-Fpos) at
+ % ([yshift=\flow at offset]$(\pgfcirc at a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc at a@prefix-Fto)$)
+ % if the flow label is not empty (in which case we have already all the anchors)
+ \pgf at circ@ifkeyempty{bipole/flow/label/name}\else
+ % the flow arrow is really a node "flowarrow", not a real arrow
+ node[flowarrow, rotate=\pgf at circ@rounded at dir, anchor=center](Farrowpos) at (\pgfcirc at a@prefix-Fpos) {}
+
+ node[anchor=\pgf at circ@dir, \circuitikzbasekey/bipole flow style]
+ (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf at circ@bipole at flow@label at where) {\pgf at circ@finallabels{flow/label}}
+ \fi
+
+ % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above
+ \ifpgf at circuit@bipole at flow@backward
+ \pgfcirc at swap@coordinates{\pgfcirc at a@prefix-Ffrom}{\pgfcirc at a@prefix-Fto}
+ \fi
+
}
\endinput
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex 2020-07-07 21:11:46 UTC (rev 55771)
@@ -13,6 +13,13 @@
\def\pgf at circ@direction{0.0}
+% swap two coordinates
+\def\pgfcirc at swap@coordinates#1#2{%
+ coordinate (tmp) at (#1)
+ coordinate (#1) at (#2)
+ coordinate (#2) at (tmp)
+}
+
% Names
\ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
\ctikzset{n/.code = {
@@ -52,22 +59,6 @@
}
}
-%% Helper function for path-function to ensure using anchors between nodes
-\def\set at explicit@center at anchor#1{
- \pgfutil at ifundefined{pgf at sh@ns@#1}
- {
- %This coordinate is no node(but a relative position or a coordinate), no further handling needed
- }{
- \pgfutil at in@.{#1}
- \ifpgfutil at in@
- % Anchor is used, do nothing!
- \else%
- \let\tikz at moveto@waiting=\relax
- \pgfpathmoveto{\tikz at last@position}%force movement, because tikz at moveto@waiting
- \edef#1{#1.center}%ensure using center anchor
- \fi
-}
-}
%% Generic bipole path
\def\pgf at circ@bipole at path#1#2{
@@ -111,9 +102,6 @@
% #4: this will be filled by the argument of the to-path
%
\pgfextra{
- \set at explicit@center at anchor{\tikztostart}
- \set at explicit@center at anchor{\tikztotarget}
- \pgfsyssoftpath at getcurrentpath{\myp at th}%% save current path to extend after calculation of correct start/end coordinates
\ctikzset{bipole/kind = #3}
\edef\pgf at temp{\ctikzvalof{bipole/name}}
\def\pgf at circ@temp{}
@@ -120,71 +108,73 @@
\ifx\pgf at temp\pgf at circ@temp % if it has not a name
\pgfmathrandominteger{\pgf at circ@rand}{1000}{9999}
\ctikzset{bipole/name = #3\pgf at circ@rand} % create it (re-usage should not create problem, but...)
+ \edef\pgfcirc at a@prefix{pgfcirc}% do not pollute the namespace for nothing
+ \else
+ \edef\pgfcirc at a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors
\fi
}
-
- (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relative start/end or constructions like ((node1)-|(node2))
- (\tikztotarget) coordinate (\ctikzvalof{bipole/name}end)
+ % save start and stop values
+ % notice that we DO NOT MOVE the path position at all!
+ coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart)
+ coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget)
\pgfextra{
+ % find the direction (angle) of the path
\pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
- {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
- % DO NOT ROUND HERE! pgfcirclabel.tex will do that when needed
- % \pgfmathround{\pgfmathresult}
- \edef\pgf at circ@direction{\pgfmathresult}%Calculate direction(angle) of path
- % \typeout{DIRECTION:\pgf at circ@direction}
- \pgfsyssoftpath at setcurrentpath{\myp at th}
+ {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
+ \edef\pgf at circ@direction{\pgfmathresult}
+ \expandafter\xdef\csname pgfcirc@\pgfcirc at a@prefix-direction\endcsname{\pgf at circ@direction}
}
- \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#3}}
- \ifx\pgf at temp\pgf at circ@temp % if it is an open
+ % position the component in the middle of the path. We DO NOT MOVE the current position!
+ node[#3#1, rotate=\pgf at circ@direction, yscale=\ctikzvalof{mirror value},
+ xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name})
+ at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2}
+ % set start and end labels
+ \ifpgf at circuit@bipole at inverted
+ \ifcsname pgf at anchor@#3#1 at pathstart\endcsname%if special path-anchors are defined, use them!
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
\else
- --($(\ctikzvalof{bipole/name}start) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?)
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.right)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left)
\fi
- ($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node
- node[#3#1, rotate=\pgf at circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}]
- (\ctikzvalof{bipole/name}) {#2}
- \ifpgf at circuit@bipole at inverted
- \ifcsname pgf at anchor@#3#1 at pathstart\endcsname%if special path-anchors are defined, use them!
- coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
- coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
- \else
- coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.right)
- coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left)
- \fi
- \else
- \ifcsname pgf at anchor@#3#1 at pathstart\endcsname%if special path-anchors are defined, use them!
- coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
- coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
- \else
- coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.left)
- coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right)
- \fi
- \fi
- \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#3}}
- \ifx\pgf at temp\pgf at circ@temp % if it is an open
\else
- (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode)
- (anchorendnode) -- (\ctikzvalof{bipole/name}end.center)
- \fi
-
- \drawpoles
- \pgf at circ@ifkeyempty{bipole/label/name}\else\pgf at circ@drawlabels{label}\fi
- \pgf at circ@ifkeyempty{bipole/annotation/name}\else\pgf at circ@drawlabels{annotation}\fi
- \pgf at circ@ifkeyempty{bipole/voltage/label/name}\else\pgf at circ@drawvoltage\fi
- \pgf at circ@ifkeyempty{bipole/current/label/name}\else\pgf at circ@drawcurrent\fi
- \pgf at circ@ifkeyempty{bipole/flow/label/name}\else\pgf at circ@drawflow\fi
- \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#3}}
- \ifx\pgf at temp\pgf at circ@temp % if it is an open
- (\ctikzvalof{bipole/name}end)%Move to end of path
+ \ifcsname pgf at anchor@#3#1 at pathstart\endcsname%if special path-anchors are defined, use them!
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
\else
- ($(\ctikzvalof{bipole/name}end) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}start)$) -- (\ctikzvalof{bipole/name}end)%ugly workaround to get correct linejoins(node breaks path?)
- %tikztostart and tikztotarget could not be used, because it would break if target coordinate is something like (node1-|node2)
-
+ coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.left)
+ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right)
\fi
- % reset
- \pgfextra{
- \pgfcircresetpath
- }
- \tikztonodes%draw pending nodes an path
+ \fi
+ % draw the leads unless it's an open circuit
+ % stop at the component
+ \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#3}}
+ \ifx\pgf at temp\pgf at circ@temp % if it is an open do nothing
+ \else
+ % it is important to start the path with -- to have correct line joins!
+ -- (\tikztostart) -- (anchorstartnode)
+ \fi
+ % Add all the "ornaments": labels, annotations, voltages, currents and flows
+ \drawpoles
+ \pgf at circ@ifkeyempty{bipole/label/name}\else\pgf at circ@drawlabels{label}\fi
+ \pgf at circ@ifkeyempty{bipole/annotation/name}\else\pgf at circ@drawlabels{annotation}\fi
+ \ifpgfcirc at has@v\pgf at circ@drawvoltage\fi
+ % \pgf at circ@ifkeyempty{bipole/current/label/name}\else\pgf at circ@drawcurrent\fi
+ \ifpgfcirc at has@i\pgf at circ@drawcurrent\fi
+ % \pgf at circ@ifkeyempty{bipole/flow/label/name}\else\pgf at circ@drawflow\fi
+ \ifpgfcirc at has@f\pgf at circ@drawflow\fi
+ % finish the path from the component to the final target
+ % you never know --- re-set \pgf at temp to detect open
+ \pgfextra{\def\pgf at temp{open}\def\pgf at circ@temp{#3}}
+ \ifx\pgf at temp\pgf at circ@temp % if it is an open do nothing
+ (\tikztotarget)
+ \else
+ (anchorendnode) -- (\tikztotarget)
+ \fi
+ % reset internal circuit keys
+ \pgfextra{\pgfcircresetpath}
+ %draw pending nodes an path
+ \tikztonodes
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex 2020-07-07 21:11:46 UTC (rev 55771)
@@ -58,6 +58,7 @@
% Default position varies whether the component is a voltage source
% or not
\ctikzset{v/.code = {
+ \pgfcirc at has@vtrue
\ifpgf at circuit@bipole at isvoltage
\pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
\circuitikzbasekey/bipole/voltage/direction=forward}
@@ -174,6 +175,10 @@
\def\pgf at circ@bipole at voltage@label at anchor{center}
\fi
\fi
+ \ifpgf at circuit@bipole at voltage@raised
+ \def\pgf at circ@bipole at voltage@label at anchor{center}
+ \pgfmathsetlength{\absvshift}{\absvshift+height{"Q"}} % with the current font.
+ \fi
}
% %\pgf at circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
%absolute move, minimum space is length of arrowhead
@@ -193,28 +198,33 @@
coordinate (pgfcirc at bottom) at (\ctikzvalof{bipole/name}.-90)
coordinate (pgfcirc at Vto1) at ($(pgfcirc at mid)+(pgfcirc at bottom)-(pgfcirc at Vfrom@flat)$)
coordinate (pgfcirc at Vfrom1) at ($(pgfcirc at mid)+(pgfcirc at bottom)-(pgfcirc at Vto@flat)$)
- coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto1) ! \absvshift!90 : (pgfcirc at Vfrom1)$)
- coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom1) ! \absvshift!-90 : (pgfcirc at Vto1)$)
- coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vto)!0.5!(pgfcirc at Vfrom) $)
- coordinate (pgfcirc at Vdir) at (pgfcirc at Vto)
+ coordinate (\pgfcirc at a@prefix-Vto) at ($(pgfcirc at Vto1) ! \absvshift!90 : (pgfcirc at Vfrom1)$)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($(pgfcirc at Vfrom1) ! \absvshift!-90 : (pgfcirc at Vto1)$)
+ coordinate (\pgfcirc at a@prefix-Vlab) at ($(\pgfcirc at a@prefix-Vto)!0.5!(\pgfcirc at a@prefix-Vfrom) $)
+ coordinate (pgfcirc at Vdir) at (\pgfcirc at a@prefix-Vto)
\else
- coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!90 : (anchorendnode)$)
- coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
+ coordinate (\pgfcirc at a@prefix-Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!90 : (anchorendnode)$)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
coordinate (pgfcirc at Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
coordinate (pgfcirc at Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
- coordinate (pgfcirc at Vcont1) at ($(pgfcirc at Vcont1t) ! -\absvshift!90 : (pgfcirc at Vcont2t)$)
- coordinate (pgfcirc at Vcont2) at ($(pgfcirc at Vcont2t) ! -\absvshift!-90 : (pgfcirc at Vcont1t)$)
- coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vcont2)!0.5!(pgfcirc at Vcont1)$)
- coordinate (pgfcirc at Vdir) at (pgfcirc at Vcont2)
+ coordinate (\pgfcirc at a@prefix-Vcont1) at ($(pgfcirc at Vcont1t) ! -\absvshift!90 : (pgfcirc at Vcont2t)$)
+ coordinate (\pgfcirc at a@prefix-Vcont2) at ($(pgfcirc at Vcont2t) ! -\absvshift!-90 : (pgfcirc at Vcont1t)$)
+ coordinate (\pgfcirc at a@prefix-Vlab) at ($(\pgfcirc at a@prefix-Vcont2)!0.5!(\pgfcirc at a@prefix-Vcont1)$)
+ coordinate (pgfcirc at Vdir) at (\pgfcirc at a@prefix-Vcont2)
\fi
- \else % we are here in case of american here
+ \else
% we are in case of american here
- coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!90 : (anchorendnode)$)
- coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
+ coordinate (\pgfcirc at a@prefix-Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!90 : (anchorendnode)$)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
coordinate (pgfcirc at bottom) at (\ctikzvalof{bipole/name}.-90)
coordinate (pgfcirc at Vdir0) at ($(pgfcirc at mid)+(pgfcirc at bottom)-(pgfcirc at Vfrom@flat)$)
- coordinate (pgfcirc at Vlab) at ($(pgfcirc at bottom) ! \absvshift!-90 : (pgfcirc at Vdir0)$)
- coordinate (pgfcirc at Vdir) at ($(pgfcirc at mid)+(pgfcirc at Vlab)-(pgfcirc at Vfrom@flat)$)
+ coordinate (\pgfcirc at a@prefix-Vlab) at ($(pgfcirc at bottom) ! \absvshift!-90 : (pgfcirc at Vdir0)$)
+ coordinate (pgfcirc at Vdir) at ($(pgfcirc at mid)+(\pgfcirc at a@prefix-Vlab)-(pgfcirc at Vfrom@flat)$)
+ \ifpgf at circuit@bipole at voltage@raised
+ % move the from and to up to the level of Vlab
+ coordinate (\pgfcirc at a@prefix-Vto) at ($(\pgfcirc at a@prefix-Vlab)+(pgfcirc at Vto@flat)-(pgfcirc at mid)$)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($(\pgfcirc at a@prefix-Vlab)+(pgfcirc at Vfrom@flat)-(pgfcirc at mid)$)
+ \fi
\fi
\else
\ifpgf at circuit@europeanvoltage
@@ -224,102 +234,113 @@
coordinate (pgfcirc at Vto1) at ($(pgfcirc at mid)+(pgfcirc at top)-(pgfcirc at Vfrom@flat)$)
coordinate (pgfcirc at Vfrom1) at ($(pgfcirc at mid)+(pgfcirc at top)-(pgfcirc at Vto@flat)$)
% add the extra distance
- coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto1) ! \absvshift!-90 : (pgfcirc at Vfrom1)$)
- coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom1) ! \absvshift!90 : (pgfcirc at Vto1)$)
- coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vto)!0.5!(pgfcirc at Vfrom) $)
+ coordinate (\pgfcirc at a@prefix-Vto) at ($(pgfcirc at Vto1) ! \absvshift!-90 : (pgfcirc at Vfrom1)$)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($(pgfcirc at Vfrom1) ! \absvshift!90 : (pgfcirc at Vto1)$)
+ coordinate (\pgfcirc at a@prefix-Vlab) at ($(\pgfcirc at a@prefix-Vto)!0.5!(\pgfcirc at a@prefix-Vfrom) $)
% direction line to shift the label later
- coordinate (pgfcirc at Vdir) at (pgfcirc at Vto)
+ coordinate (pgfcirc at Vdir) at (\pgfcirc at a@prefix-Vto)
\else
% european voltages here
- coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! -\absvshift!90 : (anchorendnode)$)
- coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$)
+ coordinate (\pgfcirc at a@prefix-Vto) at ($(pgfcirc at Vto@flat) ! -\absvshift!90 : (anchorendnode)$)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($(pgfcirc at Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$)
% identify the two control points for the "arc" of the voltage
coordinate (pgfcirc at Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
coordinate (pgfcirc at Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
% and shift them a bit
- coordinate (pgfcirc at Vcont1) at ($(pgfcirc at Vcont1t) ! \absvshift!90 : (pgfcirc at Vcont2t)$)
- coordinate (pgfcirc at Vcont2) at ($(pgfcirc at Vcont2t) ! \absvshift!-90 : (pgfcirc at Vcont1t)$)
- coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vcont2)!0.5!(pgfcirc at Vcont1)$)
+ coordinate (\pgfcirc at a@prefix-Vcont1) at ($(pgfcirc at Vcont1t) ! \absvshift!90 : (pgfcirc at Vcont2t)$)
+ coordinate (\pgfcirc at a@prefix-Vcont2) at ($(pgfcirc at Vcont2t) ! \absvshift!-90 : (pgfcirc at Vcont1t)$)
+ coordinate (\pgfcirc at a@prefix-Vlab) at ($(\pgfcirc at a@prefix-Vcont2)!0.5!(\pgfcirc at a@prefix-Vcont1)$)
% direction line to shift the label later
- coordinate (pgfcirc at Vdir) at (pgfcirc at Vcont2)
+ coordinate (pgfcirc at Vdir) at (\pgfcirc at a@prefix-Vcont2)
\fi
\else
% we are in case of american here
- coordinate (pgfcirc at Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!-90 : (anchorendnode)$)
- coordinate (pgfcirc at Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!90 : (anchorstartnode)$)
+ coordinate (\pgfcirc at a@prefix-Vto) at ($(pgfcirc at Vto@flat) ! \absvshift!-90 : (anchorendnode)$)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($(pgfcirc at Vfrom@flat) ! \absvshift!90 : (anchorstartnode)$)
coordinate (pgfcirc at top) at (\ctikzvalof{bipole/name}.90)
% move parallel to the component line
coordinate (pgfcirc at Vdir0) at ($(pgfcirc at mid)+(pgfcirc at top)-(pgfcirc at Vfrom@flat)$)
% and add the extra distance
- coordinate (pgfcirc at Vlab) at ($(pgfcirc at top) ! \absvshift!90 : (pgfcirc at Vdir0)$)
- coordinate (pgfcirc at Vdir) at ($(pgfcirc at mid)+(pgfcirc at Vlab)-(pgfcirc at Vfrom@flat)$)
+ coordinate (\pgfcirc at a@prefix-Vlab) at ($(pgfcirc at top) ! \absvshift!90 : (pgfcirc at Vdir0)$)
+ coordinate (pgfcirc at Vdir) at ($(pgfcirc at mid)+(\pgfcirc at a@prefix-Vlab)-(pgfcirc at Vfrom@flat)$)
+ \ifpgf at circuit@bipole at voltage@raised
+ % move the from and to up to the level of Vlab
+ coordinate (\pgfcirc at a@prefix-Vto) at ($(\pgfcirc at a@prefix-Vlab)+(pgfcirc at Vto@flat)-(pgfcirc at mid)$)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($(\pgfcirc at a@prefix-Vlab)+(pgfcirc at Vfrom@flat)-(pgfcirc at mid)$)
+ \fi
\fi
\fi
\ifx\@@kind\@@open
- coordinate (pgfcirc at Vto) at (pgfcirc at Vto@flat)
- coordinate (pgfcirc at Vfrom) at (pgfcirc at Vfrom@flat)
+ coordinate (\pgfcirc at a@prefix-Vto) at (pgfcirc at Vto@flat)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at (pgfcirc at Vfrom@flat)
\fi
\ifpgf at circ@debugv
node [ocirc, fill=red] at (anchorstartnode) {}
node [ocirc, fill=blue] at (anchorendnode) {}
- node [ocirc, fill=green] at (pgfcirc at Vto) {}
- node [ocirc, fill=yellow] at (pgfcirc at Vfrom) {}
+ node [ocirc, fill=green] at (\pgfcirc at a@prefix-Vto) {}
+ node [ocirc, fill=yellow] at (\pgfcirc at a@prefix-Vfrom) {}
node [odiamondpole, fill=green!50!black] at (pgfcirc at Vto@flat) {}
node [odiamondpole, fill=orange] at (pgfcirc at Vfrom@flat) {}
\ifpgf at circuit@europeanvoltage
\ifpgf at circuit@bipole at voltage@straight
\else
- node [osquarepole, fill=red] at (pgfcirc at Vcont1) {}
- node [osquarepole, fill=blue] at (pgfcirc at Vcont2) {}
+ node [osquarepole, fill=red] at (\pgfcirc at a@prefix-Vcont1) {}
+ node [osquarepole, fill=blue] at (\pgfcirc at a@prefix-Vcont2) {}
\fi
\fi
\fi
+ %
+ % Now we draw the voltage things (only if not empty --- in which case we have been
+ % called just to set the anchors)
+ %
+ \pgf at circ@ifkeyempty{bipole/voltage/label/name}\else
\ifpgf at circuit@europeanvoltage
\ifpgf at circuit@bipole at voltage@straight
\ifpgf at circuit@bipole at voltage@backward
- (pgfcirc at Vto) --(pgfcirc at Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
+ (\pgfcirc at a@prefix-Vto) --(\pgfcirc at a@prefix-Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
\else
- (pgfcirc at Vfrom) --(pgfcirc at Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
+ (\pgfcirc at a@prefix-Vfrom) --(\pgfcirc at a@prefix-Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
\fi
\else
\ifpgf at circuit@bipole at voltage@backward
- (pgfcirc at Vto) .. controls (pgfcirc at Vcont2) and (pgfcirc at Vcont1) ..
+ (\pgfcirc at a@prefix-Vto) .. controls (\pgfcirc at a@prefix-Vcont2) and (\pgfcirc at a@prefix-Vcont1) ..
node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
- (pgfcirc at Vfrom)
+ (\pgfcirc at a@prefix-Vfrom)
\else
- (pgfcirc at Vfrom) .. controls (pgfcirc at Vcont1) and (pgfcirc at Vcont2) ..
+ (\pgfcirc at a@prefix-Vfrom) .. controls (\pgfcirc at a@prefix-Vcont1) and (\pgfcirc at a@prefix-Vcont2) ..
node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
- (pgfcirc at Vto)
+ (\pgfcirc at a@prefix-Vto)
\fi
\fi
\else % american
\ifpgf at circuit@bipole at voltage@backward
\ifpgf at circ@oldvoltagedirection
- (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ (\pgfcirc at a@prefix-Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
- (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ (\pgfcirc at a@prefix-Vto) node[inner sep=0, node font=\pgf at circ@avfont,
anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
\else
- (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ (\pgfcirc at a@prefix-Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
- (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ (\pgfcirc at a@prefix-Vto) node[inner sep=0, node font=\pgf at circ@avfont,
anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
\fi
\else
\ifpgf at circ@oldvoltagedirection
- (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ (\pgfcirc at a@prefix-Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
- (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ (\pgfcirc at a@prefix-Vto) node[inner sep=0, node font=\pgf at circ@avfont,
anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
\else
- (pgfcirc at Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
+ (\pgfcirc at a@prefix-Vfrom) node[inner sep=0, node font=\pgf at circ@avfont,
anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avplus}
- (pgfcirc at Vto) node[inner sep=0, node font=\pgf at circ@avfont,
+ (\pgfcirc at a@prefix-Vto) node[inner sep=0, node font=\pgf at circ@avfont,
anchor=\pgf at circ@bipole at voltage@label at anchor]{\pgf at circ@avminus}
\fi
\fi
\fi
+ \fi % Closing the ...ifempty
}
%% Output routine for voltage sources
@@ -351,21 +372,22 @@
\ifpgf at circuit@bipole at voltage@below
coordinate (pgfcirc at Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
coordinate (pgfcirc at Vto0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
- coordinate (pgfcirc at Vfrom) at ($ (pgfcirc at Vfrom0) ! \addvshift! -90: (pgfcirc at Vto0) $)
- coordinate (pgfcirc at Vto) at ($ (pgfcirc at Vto0) ! \addvshift! 90: (pgfcirc at Vfrom0) $)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($ (pgfcirc at Vfrom0) ! \addvshift! -90: (pgfcirc at Vto0) $)
+ coordinate (\pgfcirc at a@prefix-Vto) at ($ (pgfcirc at Vto0) ! \addvshift! 90: (pgfcirc at Vfrom0) $)
\else
coordinate (pgfcirc at Vfrom0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
coordinate (pgfcirc at Vto0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
- coordinate (pgfcirc at Vfrom) at ($ (pgfcirc at Vfrom0) ! \addvshift! 90: (pgfcirc at Vto0) $)
- coordinate (pgfcirc at Vto) at ($ (pgfcirc at Vto0) ! \addvshift! -90: (pgfcirc at Vfrom0) $)
+ coordinate (\pgfcirc at a@prefix-Vfrom) at ($ (pgfcirc at Vfrom0) ! \addvshift! 90: (pgfcirc at Vto0) $)
+ coordinate (\pgfcirc at a@prefix-Vto) at ($ (pgfcirc at Vto0) ! \addvshift! -90: (pgfcirc at Vfrom0) $)
\fi
- coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vto)!0.5!(pgfcirc at Vfrom) $)
- coordinate (pgfcirc at Vdir) at (pgfcirc at Vto)
+ coordinate (\pgfcirc at a@prefix-Vlab) at ($(\pgfcirc at a@prefix-Vto)!0.5!(\pgfcirc at a@prefix-Vfrom) $)
+ coordinate (pgfcirc at Vdir) at (\pgfcirc at a@prefix-Vto)
+ \pgf at circ@ifkeyempty{bipole/voltage/label/name}\else
\ifpgf at circuit@europeanvoltage
\ifpgf at circuit@bipole at voltage@backward
- (pgfcirc at Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc at Vfrom)
+ (\pgfcirc at a@prefix-Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc at a@prefix-Vfrom)
\else
- (pgfcirc at Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc at Vto)
+ (\pgfcirc at a@prefix-Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc at a@prefix-Vto)
\fi
\else% american voltage
\ifpgf at circuit@bipole at voltageoutsideofsymbol
@@ -373,23 +395,24 @@
\ifpgf at circ@fixbatteries
\ifpgf at circuit@bipole at voltage@backward
- (pgfcirc at Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
- (pgfcirc at Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
+ (\pgfcirc at a@prefix-Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
+ (\pgfcirc at a@prefix-Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
\else
- (pgfcirc at Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
- (pgfcirc at Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
+ (\pgfcirc at a@prefix-Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
+ (\pgfcirc at a@prefix-Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
\fi
\else
\ifpgf at circuit@bipole at voltage@backward
- (pgfcirc at Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
- (pgfcirc at Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
+ (\pgfcirc at a@prefix-Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
+ (\pgfcirc at a@prefix-Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
\else
- (pgfcirc at Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
- (pgfcirc at Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
+ (\pgfcirc at a@prefix-Vfrom) node[node font=\pgf at circ@avfont] {\pgf at circ@avplus}
+ (\pgfcirc at a@prefix-Vto) node[node font=\pgf at circ@avfont] {\pgf at circ@avminus}
\fi
\fi
\fi
\fi
+ \fi % closes ...ifempty
}
%% Output routine
@@ -397,8 +420,21 @@
%%
%% locally used dimensions
\newdimen{\pgfcirc at labelshift}
+\newif\ifpgfcirc at v@curved % helper if --- true only if voltages are curved
\def\pgf at circ@drawvoltage{% node name
- \pgfextra{ %WARNING: indentation is probably wrong
+ \pgfextra{%
+ % set the helper if...curved
+ \ifpgf at circuit@europeanvoltage
+ \ifpgf at circuit@bipole at voltage@straight
+ \pgfcirc at v@curvedfalse
+ \else
+ \pgfcirc at v@curvedtrue
+ \fi
+ \else
+ \pgfcirc at v@curvedfalse
+ \fi
+ % \typeout{V routine called with prefix: \pgfcirc at a@prefix}
+ % Label anchors WARNING: indentation is probably wrong
\edef\pgfcircmathresult{\expandafter\pgf at circ@stripdecimals\pgf at circ@direction\pgf at nil}
\ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
\ifpgf at circuit@bipole at voltage@below
@@ -457,13 +493,15 @@
\fi
\fi\fi
+ % export anchor position (if not needed, is always the same macro)
+ \expandafter\xdef\csname pgfcirc@\pgfcirc at a@prefix-Vlab-anchor\endcsname{\pgf at circ@bipole at voltage@label at anchor}
% this must be set *before* changing for mirroring and inverting; in that case
% the xscale/yscale parameters take it into account
- \ifpgf at circuit@bipole at voltage@below
- \def\pgf at circ@bipole at voltage@label at where{-90}
- \else
- \def\pgf at circ@bipole at voltage@label at where{90}
- \fi
+ \ifpgf at circuit@bipole at voltage@below
+ \def\pgf at circ@bipole at voltage@label at where{-90}
+ \else
+ \def\pgf at circ@bipole at voltage@label at where{90}
+ \fi
% magic to counteract the scale and yscale effects (there should be a better way...)
\ifnum \ctikzvalof{mirror value}=-1
@@ -507,7 +545,12 @@
% check for american
\edef\pgf at temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}
\pgfkeysifdefined{\pgf at temp}{%
- \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}%
+ \ifpgf at circuit@bipole at voltage@raised
+ % do not apply the shift if we are using raised american style
+ \edef\labeldist{1.4}% default value
+ \else
+ \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}%
+ \fi
% \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist}
}{\edef\labeldist{\ctikzvalof{voltage/american label distance}}}
\ifpgf at circ@debugv\edef\whichtypeshift{AME}\fi
@@ -534,6 +577,9 @@
\ifpgf at circuit@bipole at isvoltage
\pgf at circ@drawvoltagegenerator
+ % add fake cont1 and cont2 anchors for export
+ coordinate (\pgfcirc at a@prefix-Vcont1) at ($(\pgfcirc at a@prefix-Vfrom) !0.5! (\pgfcirc at a@prefix-Vto)$)
+ coordinate (\pgfcirc at a@prefix-Vcont2) at ($(\pgfcirc at a@prefix-Vfrom) !0.5! (\pgfcirc at a@prefix-Vto)$)
\else
\pgf at circ@drawvoltagegeneric
\fi
@@ -544,7 +590,7 @@
% \pgf at circ@debugvtrue}
% move a bit if requested
- coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vlab) ! \pgfcirc at labelshift ! \pgf at circ@bipole at voltage@label at where :(pgfcirc at Vdir)$)
+ coordinate (\pgfcirc at a@prefix-Vlab) at ($(\pgfcirc at a@prefix-Vlab) ! \pgfcirc at labelshift ! \pgf at circ@bipole at voltage@label at where :(pgfcirc at Vdir)$)
% check for the case of american AND open
\ifpgf at circuit@europeanvoltage
@@ -551,19 +597,33 @@
\else
\ifx\@@kind\@@open
% override pgfcirc at Vlab
- coordinate (pgfcirc at Vlab) at ($(pgfcirc at Vfrom@flat)!0.5!(pgfcirc at Vto@flat)$)\fi
+ coordinate (\pgfcirc at a@prefix-Vlab) at ($(pgfcirc at Vfrom@flat)!0.5!(pgfcirc at Vto@flat)$)\fi
\fi
\ifpgf at circ@debugv
- node [odiamondpole, color=blue] at (pgfcirc at Vlab) {}
+ node [odiamondpole, color=blue] at (\pgfcirc at a@prefix-Vlab) {}
node [odiamondpole, color=red] at (pgfcirc at Vdir) {}
node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc at Vdir)
{\whichtypeshift:\the\pgfcirc at labelshift\\ DIR:\pgf at circ@bipole at voltage@label at where}
\fi
- node [anchor=\pgf at circ@bipole at voltage@label at anchor, inner sep=2pt,
- \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
- at (pgfcirc at Vlab) {\pgf at circ@finallabels{voltage/label}}
+ % put the node only if it's not empty
+ \pgf at circ@ifkeyempty{bipole/voltage/label/name}\else
+ node [anchor=\pgf at circ@bipole at voltage@label at anchor, inner sep=2pt,
+ \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
+ at (\pgfcirc at a@prefix-Vlab) {\pgf at circ@finallabels{voltage/label}}
+ \fi
+ \ifpgfcirc at v@curved\else
+ % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom
+ coordinate (\pgfcirc at a@prefix-Vcont1) at ($(\pgfcirc at a@prefix-Vfrom) !0.5! (\pgfcirc at a@prefix-Vto)$)
+ coordinate (\pgfcirc at a@prefix-Vcont2) at ($(\pgfcirc at a@prefix-Vfrom) !0.5! (\pgfcirc at a@prefix-Vto)$)
+ \fi
+ % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...)
+ \ifpgf at circuit@bipole at voltage@backward
+ \pgfcirc at swap@coordinates{\pgfcirc at a@prefix-Vfrom}{\pgfcirc at a@prefix-Vto}
+ \pgfcirc at swap@coordinates{\pgfcirc at a@prefix-Vcont1}{\pgfcirc at a@prefix-Vcont2}
+ \fi
+
}%end drawvoltages
\endinput
Modified: trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty 2020-07-07 00:26:05 UTC (rev 55770)
+++ trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty 2020-07-07 21:11:46 UTC (rev 55771)
@@ -12,8 +12,8 @@
\NeedsTeXFormat{LaTeX2e}
-\def\pgfcircversion{1.2.0}
-\def\pgfcircversiondate{2020/06/21}
+\def\pgfcircversion{1.2.1}
+\def\pgfcircversiondate{2020/07/06}
\ProvidesPackage{circuitikz}%
[\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion]
More information about the tex-live-commits
mailing list.