diff options
Diffstat (limited to 'graphics')
16 files changed, 593 insertions, 186 deletions
diff --git a/graphics/pgf/contrib/circuitikz/README.md b/graphics/pgf/contrib/circuitikz/README.md index 574ed24859..9ba8dacdcd 100644 --- a/graphics/pgf/contrib/circuitikz/README.md +++ b/graphics/pgf/contrib/circuitikz/README.md @@ -45,9 +45,9 @@ If you want to use older versions of `circuitikz` in LaTeX, just append the vers ```latex \usepackage{circuitikz-0.8.3} ``` -The available versions are 0.8.3, 0.7, 0.6 and 0.4. +The available versions are specified in the manual. -In ConTeXt, only the 0.8.3 version is available for the time being; you can use it with +In ConTeXt, you can use older version with ```latex \usemodule[circuitikz-0.8.3] ``` @@ -58,6 +58,12 @@ Be aware that options can (and do) change between versions, so you have to check More Information can be found in the manual and (maybe) at the wiki of the project located at https://github.com/circuitikz/circuitikz/wiki. ## Contact the authors + +For bug reports and enhacement suggestions, the preferred way is to use the issue page on the project https://github.com/circuitikz/circuitikz/issues . Please be ready to provide an example code showing the bug, if any. + +Please do not use the issue page for generic help on how to use the package. The manual has a (growing) set of examples; +also the questions tagged `circuitikz` on https://tex.stackexchange.com/ are often answered promptly. + * git: https://github.com/circuitikz/circuitikz * Massimo Redaelli (m.redaelli@gmail.com) * Stefan Lindner (stefan.lindner@fau.de) diff --git a/graphics/pgf/contrib/circuitikz/doc/changelog.tex b/graphics/pgf/contrib/circuitikz/doc/changelog.tex index ab413a5a92..5d22e52f18 100644 --- a/graphics/pgf/contrib/circuitikz/doc/changelog.tex +++ b/graphics/pgf/contrib/circuitikz/doc/changelog.tex @@ -5,6 +5,38 @@ full list of changes. \begin{itemize} \item + Version 0.9.5 (2019-10-12) + + This release basically add features to better control labels, voltages + and similar text ``ornaments'' on bipoles, plus some other minor + things. + + On the bug fixes side, a big incompatibility with ConTeXt has been + fixed, thanks to help from \texttt{@TheTeXnician} and \texttt{@hmenke} + on \texttt{github.com}. + + \begin{itemize} + \tightlist + \item + Added a ``midtap'' anchor for coils and exposed the inner coils + shapes in the transformers + \item + Added a ``curved capacitor'' with polarity coherent with + ``ecapacitor'' + \item + Added the possibility to apply style and access the nodes of + bipole's text ornaments (labels, annotations, voltages, currents and + flows) + \item + Added the possibility to move the wiper in resistive potentiometers + \item + Added a command to load and set a style in one go + \item + Fixed internal font changing commands for compatibility with ConTeXt + \item + Fixed hardcoded black color in ``elko'' and ``elmech'' + \end{itemize} +\item Version 0.9.4 (2019-08-30) This release introduces two changes: a big one, which is the styling diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf Binary files differindex 5c5c1080a1..a87cc0a40e 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf Binary files differindex 710c67cb8a..c325cc1d07 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex index 06a6f5ab5c..b9808d3ba7 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex @@ -1041,23 +1041,28 @@ For example, \emph{amplifiers} have the legacy class of \texttt{tripoles}, as we \subsubsection{Style files} -When using styles, it is possible to use \emph{style files} (see section~\ref{sec:writingstylefiles}), that then you can load with the command \verb|\ctikzloadstyle|. For example, in the distribution you have a number of style files: \texttt{legacy}, \texttt{romano}, \texttt{example}.When you load a style name \texttt{\emph{name}}, you will have available a style called \texttt{\emph{name} circuit style} that you can apply to your circuits. +When using styles, it is possible to use \emph{style files} (see section~\ref{sec:writingstylefiles}), that then you can load with the command \verb|\ctikzloadstyle|. For example, in the distribution you have a number of style files: \texttt{legacy}, \texttt{romano}, \texttt{example}. When you load a style name \texttt{\emph{name}}, you will have available a style called \texttt{\emph{name} circuit style} that you can apply to your circuits. The last style loaded is not enacted --- you have to explicitly do it if you want the style used by default, by putting for example in the preamble: -\begin{lstlisting} +\begin{lstlisting}[numbers=none] \ctikzloadstyle{romano} \tikzset{romano circuit style} \end{lstlisting} Please notice that the style is at \TikZ{} level, not \Circuitikz --- that let's you use it in the top option of the circuit, like: -\begin{lstlisting} +\begin{lstlisting}[numbers=none] \begin{circuitikz}[legacy circuit style, ..., ] ... \end{circuitikz} \end{lstlisting} +If you just want to use one style, you can load and activate it in one command with + +\begin{lstlisting}[numbers=none] + \ctikzsetstyle{romano} +\end{lstlisting} The \texttt{example} style file will simply make the amplifiers filled with light blue: @@ -1240,6 +1245,24 @@ Other miscellaneous resistor-like devices: \circuitdescbip*[thermistorntc]{thRn}{NTC thermistor}{thermistor ntc} \end{groupdesc} + +\subsubsection{Potentiometers: wiper position} + +Since version \texttt{0.9.5}, you can control the position of the wiper in potentiometers using the key \texttt{wiper pos}, which is a number in the range $[0,1]$. The default middle position is \texttt{wiper pos=0.5}. + + +\begin{LTXexample}[varwidth, basicstyle=\small\ttfamily] +\begin{circuitikz}[american] + \ctikzset{resistors/width=1.5, resistors/zigs=9} + \draw (0,0) to[pR, name=A] ++(0,-4); + \draw (1.5,0) to[pR, wiper pos=0.3, name=B] ++(0,-4); + \ctikzset{european resistors} + \draw (3,0) to[pR, wiper pos=0.8, name=C] ++(0,-4); + \foreach \i in {A, B, C} + \node[right] at (\i.wiper) {\i}; +\end{circuitikz} +\end{LTXexample} + \subsubsection{Generic sensors anchors}\label{sec:sensors-anchors} Generic sensors have an extra anchor named \texttt{label} to help position the type of dependence, if needed: @@ -1282,13 +1305,19 @@ For the american style resistors, you can change the number of ``zig-zags'' by s \begin{groupdesc} \circuitdescbip{capacitor}{Capacitor}{C} - \circuitdescbip[pcapacitor]{polar capacitor}{Polar capacitor}{pC} + \circuitdescbip[ccapacitor]{curved capacitor}{Curved (polarized) capacitor}{cC} \circuitdescbip*{ecapacitor}{Electrolytic capacitor}{eC,elko} \circuitdescbip[vcapacitor]{variable capacitor}{Variable capacitor}{vC} \circuitdescbip[capacitivesens]{capacitive sensor}{Capacitive sensor}{sC}(label/0/0.3) \circuitdescbip*{piezoelectric}{Piezoelectric Element}{PZ} \end{groupdesc} +There is also the (deprecated\footnote{Thanks to \href{https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong}{Anshul Singhv for noticing}.} --- its polarity is not coherent with the rest of the components) \texttt{polar capacitor}: + +\begin{groupdesc} + \circuitdescbip[pcapacitor]{polar capacitor}{Polar capacitor}{pC} +\end{groupdesc} + \subsubsection{Capacitive sensors anchors} For capacitive sensors, see section~\ref{sec:sensors-anchors}. @@ -1302,7 +1331,7 @@ You can change the scale of the capacitors by setting the key \texttt{capacitors If the \texttt{cuteinductors} option is active (default behaviour), or the style \texttt{[cute inductors]} is used, the inductors are displayed as follows: \begin{groupdesc} \ctikzset{inductor=cute} - \circuitdescbip[cuteinductor]{L}{Inductor}{cute inductor} + \circuitdescbip[cuteinductor]{L}{Inductor}{cute inductor}(midtap/90/0.1) \circuitdescbip[cutechoke]{cute choke}{Choke}{} \circuitdescbip[vcuteinductor]{vL}{Variable inductor}{variable cute inductor} \circuitdescbip[scuteinductor]{sL}{Inductive sensor}{cute inductive sensor}( label/0/0.3 ) @@ -1311,7 +1340,7 @@ If the \texttt{cuteinductors} option is active (default behaviour), or the style If the \texttt{americaninductors} option is active (or the style \texttt{[american inductors]} is used), the inductors are displayed as follows: \begin{groupdesc} \ctikzset{inductor=american} - \circuitdescbip[americaninductor]{L}{Inductor}{american inductor} + \circuitdescbip[americaninductor]{L}{Inductor}{american inductor}(midtap/90/0.3) \circuitdescbip[vamericaninductor]{vL}{Variable inductor}{variable american inductor} \circuitdescbip[samericaninductor]{sL}{Inductive sensor}{american inductive sensor}( label/0/0.3 ) \end{groupdesc} @@ -1319,15 +1348,12 @@ If the \texttt{americaninductors} option is active (or the style \texttt{[americ Finally, if the \texttt{europeaninductors} option is active (or the style \texttt{[european inductors]} is used), the inductors are displayed as follows: \begin{groupdesc} \ctikzset{inductor=european} - \circuitdescbip[fullgeneric]{L}{Inductor}{european inductor} + \circuitdescbip[fullgeneric]{L}{Inductor}{european inductor}(midtap/90/0.1) \circuitdescbip[tfullgeneric]{vL}{Variable inductor}{variable european inductor} \circuitdescbip[sfullgeneric]{sL}{Inductive sensor}{european inductive sensor}( label/0/0.3 ) \ctikzset{inductor=cute} % back to default \end{groupdesc} -\subsubsection{Inductive sensors anchors} - -For inductive sensors, see section~\ref{sec:sensors-anchors}. \subsubsection{Inductors customizations}\label{sec:tweak-l} @@ -1363,6 +1389,26 @@ Chokes (which comes only in the \texttt{cute} style) can have single and double \end{circuitikz} \end{LTXexample} +\subsubsection{Inductors anchors} + +For inductive sensors, see section~\ref{sec:sensors-anchors}. + +Inductors have an additional anchor, called \texttt{midtap}, that connects to the center of the coil ``wire''. Notice that this anchor could be on one side or the other of the component, depending on the number of loops of the element; if you need a fixed position, you can use the geographical anchors. + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz}[ + loops/.style={circuitikz/inductors/coils=#1}] +\ctikzset{cute inductors} +\draw (0,2) to[L, loops=5, name=A] ++(2,0) +to[L, loops=6, name=B] ++(2,0); +\ctikzset{american inductors} +\draw (0,0) to[L, loops=5, name=C] ++(2,0) +to[L, loops=6, name=D] ++(2,0); +\foreach \i in {A, B, C, D} + \node[circle, fill=red, inner sep=1pt] at (\i.midtap){}; +\end{circuitikz} +\end{LTXexample} + \subsection{Diodes and such} There are three basic styles for diodes: \texttt{empty} (fillable in color), \texttt{full} (completely filled with the draw color) and \texttt{stroke} (empty, but with a line across them). @@ -1901,7 +1947,6 @@ These are pseudo-arrows used in lot of places in the packages (for transistors, \begin{groupdesc} \circuitdesc{currarrow}{Arrows (current and voltage)}{}(center/0/0.2) \circuitdesc{inputarrow}{Arrow to draw at its tip, useful for block diagrams.}{}(center/0/0.2) - \circuitdesc*{bnc}{BNC connector}{}(left/135/0.6, right/45/0.6, center/-90/0.6, hot/0/0.6, zero/-135/0.6) \end{groupdesc} \subsubsection{Arrows size}\label{sec:currarrow-size} @@ -2703,6 +2748,40 @@ A couple of examples follow: ;\end{circuitikz} \end{LTXexample} +Moreover, you can access the two internal coils (inductances); if your transformer node is called \texttt{T}, they are named \texttt{T-L1} and \texttt{T-L2}. Notice that the two inductors are rotated (by -90 degrees the first, +90 degrees the second) so you have to be careful with the anchors. Also, the \texttt{midtap} anchor of the inductors can be on the external or internal side depending on the numbers of coils. Finally, the anchors \texttt{L1.a} and \texttt{L1.b} are marking the start and end of the coils. + +\begin{quote} +\begin{circuitikz}[american inductors, + ] + \def\coordx(#1)[#2:#3]#4{node[circle, #4, draw, inner sep=1pt,pin={[#4, overlay, inner sep=0.5pt, font=\scriptsize, pin distance=#2cm, pin edge={#4, overlay,}]#3:#1}](){}} + \draw (-2,0) (0, 0) node[transformer](T){}; + \foreach \a/\d/\t in {L1.midtap/0.2/180, L1.south west/0.2/180, L1.south east/0.2/180, + L2.south/0.2/0, L2.south west/0.2/0, L2.south east/0.2/0} + \path (T-\a) \coordx(T-\a)[\d:\t]{red}; + \ctikzset{cute inductors} + \draw (4, 0) node[transformer](T){}; + \foreach \a/\d/\t in {L1.a/0.2/-120, L1.b/0.2/120, + L2.midtap/0.5/0, L2.south west/0.2/0, L2.south east/0.2/0} + \path (T-\a) \coordx(T-\a)[\d:\t]{blue}; + \node[font=\small\ttfamily,above] at (T.north) {inductors/coils=5}; + \draw (8, 0) node[transformer, circuitikz/inductors/coils=6](T){}; + \foreach \a/\d/\t in {L2.a/0.2/120, L2.b/0.2/-120, + L2.midtap/0.2/0, L2.south west/0.2/0, L2.south east/0.2/0} + \path (T-\a) \coordx(T-\a)[\d:\t]{red}; + \node[font=\small\ttfamily,above] at (T.north) {inductors/coils=6}; +\end{circuitikz} +\end{quote} + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz} +\draw (0,0) node[ground](GND){} to [sV] ++(0,2) -- ++(1,0) + node[transformer, circuitikz/inductors/coils=6, + anchor=A1](T){}; +\draw (T.A2) to[short, -*] (T.A2-|GND); +\draw (T-L2.midtap) to[short, *-o] (T.B1 |- T-L2.midtap); +\node [ocirc] at (T.B1){}; \node [ocirc] at (T.B2){}; +\end{circuitikz} +\end{LTXexample} \subsubsection{Double dipoles customization} Transformers are in the \texttt{inductors} class (also the gyrator\dots), so they scale with the key \texttt{inductors/scale}. @@ -3662,6 +3741,7 @@ A couple of examples are shown below. \end{LTXexample} + \section{Labels and similar annotations} \begin{LTXexample}[varwidth=true] @@ -4222,7 +4302,9 @@ This could be especially useful if you define a style, to use like this: \draw (0,-2) to[R,v_<=$V_S$] ++(2,0); \end{circuitikz} \end{LTXexample} -\subsubsection{Global properties of voltages and currents} + + +\subsection{Global properties of voltages and currents} \begin{LTXexample}[varwidth=true] \tikz \draw (0,0) to[R, v=1<\volt>] (2,0); \par @@ -4249,320 +4331,383 @@ However, you can override the properties \texttt{voltage/distance from node} (ho Note the \texttt{.initial}; you have to create such key the first time you use it. +\subsection{Changing the style of labels and text ornaments} -\subsection{Nodes (also called poles)}\label{sec:bipole-nodes} +Since version \texttt{0.9.5}, it is possible to change the style of bipole text ornaments (labels, annotations, voltages etc) by using the appropriate styles or keys. +The basic style applied to the text are defined in the \texttt{/tikz/circuitikz} key directory and applied to every node that contains the text; you can also change them locally by using the \texttt{tikz} direct keys in local scopes. -You can add nodes to the bipoles, positioned at the coordinates surrounding the component. The general style to use is \texttt{bipole nodes=\{start\}\{stop\}}, where \texttt{start} and \texttt{stop} are the nodes --- to be chosen between \texttt{none}, \texttt{circ}, \texttt{ocirc}, \texttt{squarepole}, \texttt{osquarepole}, \texttt{diamondpole}, \texttt{odiamondpole} and \texttt{rectfill}\footnote{You can use other shapes too, but at your own risk\dots Moreover, notice that \texttt{none} is not really a node, just a special word used to say ``do not put any node here''.} (see section~\ref{sec:terminals}). +For example, you can make all annotations small by using: +\begin{lstlisting}[numbers=none] +\ctikzset{bipole annotation style/.style={font=\small}} +\end{lstlisting} -\begin{LTXexample}[varwidth=true, - basicstyle=\small\ttfamily - ] -\begin{circuitikz} - \ctikzset{bipoles/length=.5cm, nodes width=0.1}%small components, big nodes - \foreach \a/\p [evaluate=\a as \b using (\a+180)] in - {-90/none, -60/circ, -30/ocirc, 0/diamondpole, 30/odiamondpole, 60/squarepole, 90/osquarepole} - \draw (0,0) to[R, bipole nodes={none}{\p}] ++(\a:1.5) node[font=\tiny, anchor=\b]{\p}; +And the change (override) the setting in one specific bipole using: + +\begin{lstlisting}[numbers=none] +...to[bipole annotation style={color=red}, R, a={Red note}]... +\end{lstlisting} + +where the annotation will be in normal font (it has been reset!) and red, or append to the style: + +\begin{lstlisting}[numbers=none] +...to[bipole annotation append style={color=red}, R, a={Red small note}]... +\end{lstlisting} + +\textbf{Caveat:} you have to put the style changing key at the start of the \texttt{to} arguments to have any effect\footnote{No, I do not know why. Hints and fixes are welcome.}. + +The available styles and commands are \texttt{bipole label style}, \texttt{bipole annotation style}, \texttt{bipole voltage style}, \texttt{bipole current style}, and \texttt{bipole flow style}. The following example shows a bit of everything. + + +\begin{LTXexample}[pos=t, basicstyle=\small\ttfamily ] +\begin{circuitikz}[american] + \ctikzset{bipole annotation style/.style={font=\tiny}} + \ctikzset{bipole current style/.style={font=\small\sffamily}} + \draw (0,0) to [bipole annotation append style={fill=yellow}, R=L1, a=A1] ++(3,0) + to [bipole label style={fill=cyan}, R, l2_=L2 and 2L, a^=A2] ++(3,0); + \draw (7,0) to [bipole voltage style={color=blue}, + bipole flow style={fill=green, outer sep=5pt}, + R=R1, v=V1, i=I1, f>^=F1] ++(3,0) + to [bipole current append style={color=red}, R, v<=V2, i^=I2, f>^=F2] ++(3,0); \end{circuitikz} \end{LTXexample} -These bipole nodes are added after the path is drawn, as every node in Ti\emph{k}Z --- this is the reason why they are always filled (with the main color the normal nodes, with white the open ones), in order to ``hide'' the wire below. You can override the fill color if you want; but notice that if you draw things in two different paths, you will have ``strange'' results; notice that in the second line of resistors the second wire is starting from the center of the white \texttt{ocirc} of the previous path. +\subsection{Labels in special components} -\begin{LTXexample}[varwidth=true, - pos=t, basicstyle=\small\ttfamily - ] +For some components label, current and voltage behave as one would expect: + +\begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, *-o] ++(2,0) to[R, -d] ++(2,0) - to[R, bipole nodes={diamondpole}{odiamondpole, fill=red}] ++(2,0); - \draw (0,-1) to[R, *-o] ++(2,0) ; - \draw (2,-1) to[R, -d] ++(2,0) to[R, bipole nodes={none}{squarepole}] ++(2,0); + \draw (0,0) to[I=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} -You can define shortcuts for the \texttt{bipole nodes} you use most; for example if you want a shortcut for a bipole with open square node in red in the right side you can: - -\begin{LTXexample}[varwidth=true, - basicstyle=\small\ttfamily - ] +\begin{LTXexample}[varwidth=true] \begin{circuitikz} - \ctikzset{-s/.style = {bipole nodes={none}{osquarepole, fill=red}}} - \draw (0,0) to[R, -s] ++(2,0); + \draw (0,0) to[I, i=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} -There are several predefined shorthand as the above; in the following pages you can see all of them. \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, o-o] (2,0); + \draw (0,0) to[cI=$k\cdot a_1$] (2,0); \end{circuitikz} \end{LTXexample} + \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, -o] (2,0); + \draw (0,0) to[sI=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, o-] (2,0); + \draw (0,0) to[csI=$k\cdot a_1$] (2,0); \end{circuitikz} \end{LTXexample} +The following results from using the option \texttt{americancurrent} or using the style \texttt{[american currents]}. + \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, *-*] (2,0); +\begin{circuitikz}[american currents] + \draw (0,0) to[I=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, -*] (2,0); +\begin{circuitikz}[american currents] + \draw (0,0) to[I, i=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} + \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, *-] (2,0); +\begin{circuitikz}[american currents] + \draw (0,0) to[cI=$k\cdot a_1$] (2,0); \end{circuitikz} \end{LTXexample} + \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, d-d] (2,0); +\begin{circuitikz}[american currents] + \draw (0,0) to[sI=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, -d] (2,0); +\begin{circuitikz}[american currents] + \draw (0,0) to[csI=$k\cdot a_1$] (2,0); \end{circuitikz} \end{LTXexample} +The same holds for voltage sources: + \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, d-] (2,0); + \draw (0,0) to[V=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, o-*] (2,0); + \draw (0,0) to[V, v=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} + \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, *-o] (2,0); + \draw (0,0) to[cV=$k\cdot a_1$] (2,0); \end{circuitikz} \end{LTXexample} + \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, o-d] (2,0); + \draw (0,0) to[sV=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, d-o] (2,0); + \draw (0,0) to[csV=$k\cdot a_1$] (2,0); \end{circuitikz} \end{LTXexample} +The following results from using the option \texttt{americanvoltage} or the style \texttt{[american voltages]}. + \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, *-d] (2,0); +\begin{circuitikz}[american voltages] + \draw (0,0) to[V=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[R, d-*] (2,0); +\begin{circuitikz}[american voltages] + \draw (0,0) to[V, v=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} -\subsection{Special components} +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[american voltages] + \draw (0,0) to[cV=$k v_e$] (2,0); +\end{circuitikz} +\end{LTXexample} -For some components label, current and voltage behave as one would expect: \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[I=$a_1$] (2,0); +\begin{circuitikz}[american voltages] + \draw (0,0) to[sV=$a_1$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz} - \draw (0,0) to[I, i=$a_1$] (2,0); +\begin{circuitikz}[american voltages] + \draw (0,0) to[csV=$k v_e$] (2,0); \end{circuitikz} \end{LTXexample} +\subsection{Integration with {\ttfamily siunitx}} + +If the option {\ttfamily siunitx} is active (and \emph{not} in \ConTeXt), then the following are equivalent: \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[cI=$k\cdot a_1$] (2,0); + \draw (0,0) to[R, l=1<\kilo\ohm>] (2,0); \end{circuitikz} \end{LTXexample} - \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[sI=$a_1$] (2,0); + \draw (0,0) to[R, l=$\SI{1}{\kilo\ohm}$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[csI=$k\cdot a_1$] (2,0); + \draw (0,0) to[R, i=1<\milli\ampere>] (2,0); \end{circuitikz} \end{LTXexample} -The following results from using the option \texttt{americancurrent} or using the style \texttt{[american currents]}. - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[I=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, i=$\SI{1}{\milli\ampere}$] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[I, i=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, v=1<\volt>] (2,0); \end{circuitikz} \end{LTXexample} - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[cI=$k\cdot a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, v=$\SI{1}{\volt}$] (2,0); \end{circuitikz} \end{LTXexample} +\subsection{Accessing labels text nodes} -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[sI=$a_1$] (2,0); +Since 0.9.5, you can access all the labels nodes\footnote{The access to \texttt{label}s and \texttt{annotation}s was present before, but not documented.} using special node names. So, if you use \texttt{name} to give a name to the bipole node, you can access also the following nodes: \texttt{namelabel} (notice: no space nor any other symbol between \texttt{name} and \texttt{label}!), \texttt{nameannotation}, \texttt{namevoltage}, \texttt{namecurrent} and \texttt{nameflow}. + +\begin{LTXexample}[varwidth=true, + pos=t, basicstyle=\small\ttfamily + ] +\newcommand{\marknode}[2][45]{% + \node[circle, draw, red, inner sep=1pt, + pin={[red, font=\tiny]#1:#2}] at (#2.center) {}; +} +\begin{circuitikz}[ american] + \draw (0,0) to [R=L1, a=A1, name=L1] ++(3,0) + to [R, l2_=L2 and 2L, a^=A2, name=L2] ++(3,0); + \marknode{L1} \marknode{L1label} \marknode[0]{L1annotation} + \marknode{L2} \marknode[0]{L2label} \marknode{L2annotation} + \draw[blue] (L2label.south west) rectangle (L2label.north east); + \draw (6.1,0) to [R=R1, v=V1, i=I1, f>^=F1, name=R1] ++(3,0) + to [R, v<=V2, i^=I2, f>^=F2, name=R2] ++(3,0); + \marknode[0]{R1voltage} \marknode[0]{R2voltage} \marknode[90]{R1current} + \marknode[90]{R2current} \marknode{R1flow} \marknode{R2flow} \end{circuitikz} \end{LTXexample} -\begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american currents] - \draw (0,0) to[csI=$k\cdot a_1$] (2,0); + +\section{Using bipoles in circuits} + +\subsection{Nodes (also called poles)}\label{sec:bipole-nodes} + +You can add nodes to the bipoles, positioned at the coordinates surrounding the component. The general style to use is \texttt{bipole nodes=\{start\}\{stop\}}, where \texttt{start} and \texttt{stop} are the nodes --- to be chosen between \texttt{none}, \texttt{circ}, \texttt{ocirc}, \texttt{squarepole}, \texttt{osquarepole}, \texttt{diamondpole}, \texttt{odiamondpole} and \texttt{rectfill}\footnote{You can use other shapes too, but at your own risk\dots Moreover, notice that \texttt{none} is not really a node, just a special word used to say ``do not put any node here''.} (see section~\ref{sec:terminals}). + + +\begin{LTXexample}[varwidth=true, + basicstyle=\small\ttfamily + ] +\begin{circuitikz} + \ctikzset{bipoles/length=.5cm, nodes width=0.1}%small components, big nodes + \foreach \a/\p [evaluate=\a as \b using (\a+180)] in + {-90/none, -60/circ, -30/ocirc, 0/diamondpole, 30/odiamondpole, 60/squarepole, 90/osquarepole} + \draw (0,0) to[R, bipole nodes={none}{\p}] ++(\a:1.5) node[font=\tiny, anchor=\b]{\p}; \end{circuitikz} \end{LTXexample} -The same holds for voltage sources: +These bipole nodes are added after the path is drawn, as every node in Ti\emph{k}Z --- this is the reason why they are always filled (with the main color the normal nodes, with white the open ones), in order to ``hide'' the wire below. You can override the fill color if you want; but notice that if you draw things in two different paths, you will have ``strange'' results; notice that in the second line of resistors the second wire is starting from the center of the white \texttt{ocirc} of the previous path. -\begin{LTXexample}[varwidth=true] +\begin{LTXexample}[varwidth=true, + pos=t, basicstyle=\small\ttfamily + ] \begin{circuitikz} - \draw (0,0) to[V=$a_1$] (2,0); + \draw (0,0) to[R, *-o] ++(2,0) to[R, -d] ++(2,0) + to[R, bipole nodes={diamondpole}{odiamondpole, fill=red}] ++(2,0); + \draw (0,-1) to[R, *-o] ++(2,0) ; + \draw (2,-1) to[R, -d] ++(2,0) to[R, bipole nodes={none}{squarepole}] ++(2,0); \end{circuitikz} \end{LTXexample} -\begin{LTXexample}[varwidth=true] +You can define shortcuts for the \texttt{bipole nodes} you use most; for example if you want a shortcut for a bipole with open square node in red in the right side you can: + +\begin{LTXexample}[varwidth=true, + basicstyle=\small\ttfamily + ] \begin{circuitikz} - \draw (0,0) to[V, v=$a_1$] (2,0); + \ctikzset{-s/.style = {bipole nodes={none}{osquarepole, fill=red}}} + \draw (0,0) to[R, -s] ++(2,0); \end{circuitikz} \end{LTXexample} +There are several predefined shorthand as the above; in the following pages you can see all of them. \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[cV=$k\cdot a_1$] (2,0); + \draw (0,0) to[R, o-o] (2,0); \end{circuitikz} \end{LTXexample} - \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[sV=$a_1$] (2,0); + \draw (0,0) to[R, -o] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[csV=$k\cdot a_1$] (2,0); + \draw (0,0) to[R, o-] (2,0); \end{circuitikz} \end{LTXexample} -The following results from using the option \texttt{americanvoltage} or the style \texttt{[american voltages]}. - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[V=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, *-*] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[V, v=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, -*] (2,0); \end{circuitikz} \end{LTXexample} - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[cV=$k v_e$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, *-] (2,0); \end{circuitikz} \end{LTXexample} - \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[sV=$a_1$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, d-d] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] -\begin{circuitikz}[american voltages] - \draw (0,0) to[csV=$k v_e$] (2,0); +\begin{circuitikz} + \draw (0,0) to[R, -d] (2,0); \end{circuitikz} \end{LTXexample} -\subsection{Integration with {\ttfamily siunitx}} - -If the option {\ttfamily siunitx} is active (and \emph{not} in \ConTeXt), then the following are equivalent: - \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, l=1<\kilo\ohm>] (2,0); + \draw (0,0) to[R, d-] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, l=$\SI{1}{\kilo\ohm}$] (2,0); + \draw (0,0) to[R, o-*] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, i=1<\milli\ampere>] (2,0); + \draw (0,0) to[R, *-o] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, i=$\SI{1}{\milli\ampere}$] (2,0); + \draw (0,0) to[R, o-d] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, v=1<\volt>] (2,0); + \draw (0,0) to[R, d-o] (2,0); \end{circuitikz} \end{LTXexample} \begin{LTXexample}[varwidth=true] \begin{circuitikz} - \draw (0,0) to[R, v=$\SI{1}{\volt}$] (2,0); + \draw (0,0) to[R, *-d] (2,0); \end{circuitikz} \end{LTXexample} - - +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R, d-*] (2,0); +\end{circuitikz} +\end{LTXexample} \subsection{Mirroring and Inverting} Bipole paths can also mirrored and inverted (or reverted) to change the drawing direction. diff --git a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty index ea827867ef..12893f68b8 100644 --- a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty +++ b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty @@ -9,8 +9,8 @@ \NeedsTeXFormat{LaTeX2e} -\def\pgfcircversion{0.9.4} -\def\pgfcircversiondate{2019/08/30} +\def\pgfcircversion{0.9.5} +\def\pgfcircversiondate{2019/10/12} \ProvidesPackage{circuitikz}% [\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex index 200230b50a..28e41a24d0 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex @@ -138,6 +138,36 @@ % use \pgf@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 +%% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605 + +\ifpgfutil@format@is@latex + \long\def\pgf@circ@font@tiny{\tiny} + \long\def\pgf@circ@font@small{\small} + \long\def\pgf@circ@font@bold{\textbf} + \long\def\pgf@circ@font@boldmath{\boldmath} + \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath} + \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath} + \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont} +\else\ifpgfutil@format@is@plain + \long\def\pgf@circ@font@tiny{\fiverm} + \long\def\pgf@circ@font@small{\sevenrm} + \long\def\pgf@circ@font@bold#1{{\bf#1}} + \long\def\pgf@circ@font@boldmath{\bf} % to be tested + \long\def\pgf@circ@font@sixbm{\sevenrm\bf} % + \long\def\pgf@circ@font@tenbm{\tenrm\bf} % + \long\def\pgf@circ@font@twelve{\twelverm} % +\else\ifpgfutil@format@is@context + \long\def\pgf@circ@font@tiny{\tfxx} + \long\def\pgf@circ@font@small{\tfx} + \long\def\pgf@circ@font@bold{\bold} + \long\def\pgf@circ@font@boldmath{\bold} % to be tested + \long\def\pgf@circ@font@sixbm{\tfx\bold} % + \long\def\pgf@circ@font@tenbm{\normal\bold}% + \long\def\pgf@circ@font@twelve{\tfa} % +\fi\fi\fi + + % voltage options \newif\ifpgf@circ@siunitx @@ -210,6 +240,12 @@ \fi } +% load and enact a style +\def\ctikzsetstyle#1{% + \ctikzloadstyle{#1}% + \tikzset{#1 circuit style}% +} + % global style parameters \ctikzset{default/scale/.initial=1.0} % do not touch \ctikzset{default/fill/.initial=none} % do not touch @@ -371,12 +407,17 @@ \ctikzset{bipoles/ageneric/width=#1}% \ctikzset{bipoles/tgeneric/width=#1}% }} +\ctikzset{wiper pos/.code={% + \ctikzset{bipoles/potentiometer/wiper pos=#1}% + \ctikzset{bipoles/generic potentiometer/wiper pos=#1}% +}} % zigzag resistor \ctikzset{bipoles/resistor/height/.initial=.3} \ctikzset{bipoles/resistor/width/.initial=.8} \ctikzset{bipoles/potentiometer/height/.initial=.8} \ctikzset{bipoles/potentiometer/height 2/.initial=.3} \ctikzset{bipoles/potentiometer/width/.initial=.8} +\ctikzset{bipoles/potentiometer/wiper pos/.initial=.5} \ctikzset{bipoles/vresistor/height/.initial=.6} \ctikzset{bipoles/vresistor/width/.initial=.8} \ctikzset{bipoles/resistivesens/height/.initial=.6} @@ -404,6 +445,7 @@ \ctikzset{bipoles/generic potentiometer/height/.initial=.80} \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30} \ctikzset{bipoles/generic potentiometer/width/.initial=.80} +\ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5} \ctikzset{bipoles/ageneric/height/.initial=.30} \ctikzset{bipoles/tgeneric/height/.initial=.70} \ctikzset{bipoles/tgeneric/width/.initial=.80} @@ -414,10 +456,14 @@ \ctikzset{bipoles/capacitor/width/.initial=.2} \ctikzset{bipoles/ecapacitor/height/.initial=.5} \ctikzset{bipoles/ecapacitor/width/.initial=.2} -\ctikzset{bipoles/ecapacitor/font/.initial= \fontsize{6}{0}\selectfont\boldmath} +\ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm} +%%% pcapacitor is deprecated \ctikzset{bipoles/pcapacitor/height/.initial=.6} \ctikzset{bipoles/pcapacitor/width/.initial=.2} \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1} +\ctikzset{bipoles/ccapacitor/height/.initial=.6} +\ctikzset{bipoles/ccapacitor/width/.initial=.12} +\ctikzset{bipoles/ccapacitor/bend width/.initial=1.1} \ctikzset{bipoles/vcapacitor/height/.initial=.6} \ctikzset{bipoles/vcapacitor/width/.initial=.5} \ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4} @@ -1192,7 +1238,7 @@ \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position -\ctikzset{tripoles/op amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath} % Absolute font size needed! +\ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! % Fully differential operational amplifier \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width @@ -1201,15 +1247,15 @@ \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position -\ctikzset{tripoles/fd op amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath} % Absolute font size needed! +\ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! \ctikzset{tripoles/en amp/width/.initial=1.7} \ctikzset{tripoles/en amp/port width/.initial=.7} \ctikzset{tripoles/en amp/height/.initial=1.6} \ctikzset{tripoles/en amp/input height/.initial=.3} \ctikzset{tripoles/en amp/up pos/.initial=.45} -\ctikzset{tripoles/en amp/font/.initial= \fontsize{10}{12}\selectfont} % Absolute font size needed! -\ctikzset{tripoles/en amp/font2/.initial= \fontsize{12}{14}\selectfont} % Absolute font size needed! +\ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! +\ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed! \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}} \tikzset{ en amp text/.code = {% @@ -1227,7 +1273,7 @@ \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position -\ctikzset{tripoles/gm amp/font/.initial= \fontsize{10}{12}\selectfont\boldmath} % Absolute font size needed! +\ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! % Instrumentation amplifier \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width @@ -1237,7 +1283,7 @@ \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position -\ctikzset{tripoles/inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath} % Absolute font size needed! +\ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! % Instrumentation amplifier with differential output \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width @@ -1248,7 +1294,7 @@ \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position -\ctikzset{tripoles/fd inst amp/font/.initial= \fontsize{10}{0}\selectfont\boldmath} % Absolute font size needed! +\ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! % Instrumentation amplifier with gain resistor terminals \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width @@ -1259,7 +1305,7 @@ \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation -\ctikzset{tripoles/inst amp ra/font/.initial= \fontsize{10}{0}\selectfont\boldmath} % Absolute font size needed! +\ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed! % Plain amplifier \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width @@ -1350,7 +1396,7 @@ % multipoles % \ctikzset{multipoles/thickness/.initial=2} -\ctikzset{multipoles/font/.initial=\tiny} +\ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny} % DIP (dual in line package) chips \ctikzset{multipoles/dipchip/width/.initial=1.2} \ctikzset{multipoles/dipchip/num pins/.initial=8} diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex index 0048efb892..2eaa1cf8e5 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex @@ -386,7 +386,7 @@ \pgfusepath{draw} \pgfsetlinewidth{\pgfstartlinewidth} - \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$} \pgfsetarrowsend{latexslim} \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} @@ -416,7 +416,7 @@ \pgfusepath{draw} \pgfsetlinewidth{\pgfstartlinewidth} - \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$} + \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$} \pgfsetarrowsend{latexslim} \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}} @@ -427,11 +427,17 @@ } %% Generic tunable -\pgfcircdeclarebipolescaled{resistors}{ - \anchor{wiper}{ - \northeast - \pgfpoint{0pt}{\pgf@y} - } +\pgfcircdeclarebipolescaled{resistors} +{ + \savedanchor{\wiper}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@ya + \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa} + } + \anchor{wiper}{\wiper} + \anchor{W}{\wiper} } {\ctikzvalof{bipoles/generic potentiometer/height 2}} {genericpotentiometer} @@ -450,8 +456,9 @@ \pgfscope %\pgfsetlinewidth{\pgfstartlinewidth} \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfextractx{\pgf@circ@res@other}{\wiper} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} \pgfusepath{draw} \endpgfscope } @@ -526,12 +533,20 @@ %% Potentiometer \pgfcircdeclarebipolescaled{resistors} { - \anchor{wiper}{\northeast\pgfpoint{0pt}{\pgf@y}} - \anchor{W}{\northeast\pgfpoint{0pt}{\pgf@y}} + \savedanchor{\wiper}{ + \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen + \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@ya + \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen + \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa} + } + \anchor{wiper}{\wiper} + \anchor{W}{\wiper} \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}} } {\ctikzvalof{bipoles/potentiometer/height 2}} -{potentiometer}{\ctikzvalof{bipoles/potentiometer/height}} +{potentiometer} +{\ctikzvalof{bipoles/potentiometer/height}} {\ctikzvalof{bipoles/potentiometer/width}} { \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} @@ -542,8 +557,9 @@ \pgfscope %\pgfsetlinewidth{\pgfstartlinewidth} \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} + \pgfextractx{\pgf@circ@res@other}{\wiper} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} \pgfusepath{draw} \endpgfscope } @@ -619,7 +635,7 @@ \endpgfscope } -%% Polar Capacitor +%% Polar Capacitor (DEPRECATED) \pgfcircdeclarebipolescaled{capacitors} {} {\ctikzvalof{bipoles/pcapacitor/height}} @@ -640,9 +656,38 @@ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfusepath{draw} +} + + +%% Curved capacitor +% see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong +% for a rationale +% +\pgfcircdeclarebipolescaled{capacitors} +{} +{\ctikzvalof{bipoles/ccapacitor/height}} +{ccapacitor} +{\ctikzvalof{bipoles/ccapacitor/height}} +{\ctikzvalof{bipoles/ccapacitor/width}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+ \ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgftransformrotate{-90} + \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}} + \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}} + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} } + + + %% Electrolytic Capacitor \pgfcircdeclarebipolescaled{capacitors} {} @@ -666,9 +711,9 @@ \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfsetfillcolor{black} + \pgfsetfillcolor{\ctikzvalof{color}} \pgfusepath{draw,fill} - \pgfsetfillcolor{black} + \pgfsetfillcolor{\ctikzvalof{color}} % % plus pole annotation \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}] {\ctikzvalof{bipoles/ecapacitor/font} $+$} @@ -746,7 +791,18 @@ %% cute inductor \pgfcircdeclarebipolescaled{inductors} -{} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} {\ctikzvalof{bipoles/cuteinductor/lower coil height}} {cuteinductor} {\ctikzvalof{bipoles/cuteinductor/height}} @@ -778,6 +834,16 @@ \pgfcircdeclarebipolescaled{inductors} {% anchor for labelling the type of dependency \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} } {\ctikzvalof{bipoles/cuteinductor/lower coil height}} {scuteinductor} @@ -814,7 +880,18 @@ %% cute choke \pgfcircdeclarebipolescaled{inductors} -{} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} {\ctikzvalof{bipoles/cutechoke/lower coil height}} {cutechoke} {\ctikzvalof{bipoles/cutechoke/height}} @@ -858,7 +935,18 @@ %% variable cute inductor \pgfcircdeclarebipolescaled{inductors} -{} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?% + \ctikzvalof{bipoles/cuteinductor/height} :% even + -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} {\ctikzvalof{bipoles/vcuteinductor/lower coil height}} {vcuteinductor} {\ctikzvalof{bipoles/vcuteinductor/height}} @@ -895,7 +983,18 @@ %% american inductor \pgfcircdeclarebipolescaled{inductors} -{} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?% + 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even + 0) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} {\ctikzvalof{bipoles/americaninductor/height 2}} {americaninductor} {\ctikzvalof{bipoles/americaninductor/height}} @@ -924,6 +1023,16 @@ \pgfcircdeclarebipolescaled{inductors} {% anchor for labelling the type of dependency \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}% + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?% + 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even + 0) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} } {\ctikzvalof{bipoles/americaninductor/height 2}} {samericaninductor} @@ -956,7 +1065,18 @@ %% variable american inductor \pgfcircdeclarebipolescaled{inductors} -{} +{ + \savedanchor{\midtap}{% + \pgf@x=0pt\relax + \pgfmathsetlength{\pgf@y}{% + (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?% + 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even + 0) %odd + *\pgf@circ@scaled@Rlen/2 + } + } + \anchor{midtap}{\midtap} +} {\ctikzvalof{bipoles/vamericaninductor/height 2}} {vamericaninductor} {\ctikzvalof{bipoles/vamericaninductor/height}} @@ -989,7 +1109,9 @@ %% Generic bipole, filled - used as inductor by some \pgfcircdeclarebipolescaled{inductors} -{} +{ + \anchor{midtap}{\northeast\pgf@x=0pt\relax} +} {\ctikzvalof{bipoles/fullgeneric/height}} {fullgeneric} {\ctikzvalof{bipoles/fullgeneric/height}} @@ -1005,6 +1127,7 @@ \pgfcircdeclarebipolescaled{inductors} {% anchor for labelling the type of dependency \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}% + \anchor{midtap}{\northeast\pgf@x=0pt\relax} } {\ctikzvalof{bipoles/fullgeneric/height}} {sfullgeneric} @@ -1025,7 +1148,9 @@ %% Generic full tunable \pgfcircdeclarebipolescaled{inductors} -{} +{ + \anchor{midtap}{\northeast\pgf@x=0pt\relax} +} {\ctikzvalof{bipoles/tfullgeneric/height}} {tfullgeneric} {\ctikzvalof{bipoles/tfullgeneric/height}} @@ -2815,7 +2940,7 @@ {\ctikzvalof{bipoles/ammeter/width}} { \drawmeteringcircle - \pgfnode{circle}{center}{\textbf{A}}{}{} + \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{} } %OHMMETER \pgfcircdeclarebipolescaled{instruments} @@ -2837,7 +2962,7 @@ {\ctikzvalof{bipoles/voltmeter/width}} { \drawmeteringcircle - \pgfnode{circle}{center}{\textbf{V}}{}{} + \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{} } @@ -3276,7 +3401,7 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfusepath{draw} - \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\tiny\textsf{U}}} + \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}} } %%%%%%%%%%%%%% diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex index 88cd79aa5b..cc2bf8de14 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirccurrent.tex @@ -10,6 +10,15 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Current handling +%% styles +\ctikzset{bipole current style/.style={}} +\tikzset{bipole current style/.code={ + \ctikzset{bipole current style/.style={#1}} +}} +\tikzset{bipole current append style/.code={ + \ctikzset{bipole current style/.append style={#1}} +}} + %% Options \ctikzset{i^>/.style = { i = #1, @@ -192,7 +201,9 @@ } \fi coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf@circ@ffffff](Iarrow) - (Iarrow.\pgf@circ@bipole@current@label@where) node[anchor=\pgf@circ@dir]{\pgf@circ@finallabels{current/label}} + (Iarrow.\pgf@circ@bipole@current@label@where) + node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style] + (\ctikzvalof{bipole/name}current){\pgf@circ@finallabels{current/label}} } \endinput diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex index 7995725d6d..6af0af0ee0 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircflow.tex @@ -10,6 +10,15 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% flow handling +%% styles +\ctikzset{bipole flow style/.style={}} +\tikzset{bipole flow style/.code={ + \ctikzset{bipole flow style/.style={#1}} +}} +\tikzset{bipole flow append style/.code={ + \ctikzset{bipole flow style/.append style={#1}} +}} + %% Options \ctikzset{f^>/.style = { f = #1, @@ -187,7 +196,8 @@ \fi } coordinate[flowarrow,pos=\ctikzvalof{flow/distance},rotate=\pgf@circ@ffffff,yshift=\flow@offset](Farrowpos) - (Farrowpos.\pgf@circ@bipole@flow@label@where) node[anchor=\pgf@circ@dir]{ \pgf@circ@finallabels{flow/label}} + (Farrowpos.\pgf@circ@bipole@flow@label@where) node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style] + (\ctikzvalof{bipole/name}flow){\pgf@circ@finallabels{flow/label}} } \endinput diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex index 0d14585846..51ecc8574b 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirclabel.tex @@ -10,6 +10,23 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Bipole label positioning +%% bipole labels and annotation extra style + +\ctikzset{bipole label style/.style={}} +\tikzset{bipole label style/.code={ + \ctikzset{bipole label style/.style={#1}} +}} +\tikzset{bipole label append style/.code={ + \ctikzset{bipole label style/.append style={#1}} +}} +\ctikzset{bipole annotation style/.style={}} +\tikzset{bipole annotation style/.code={ + \ctikzset{bipole annotation style/.style={#1}} +}} +\tikzset{bipole annotation append style/.code={ + \ctikzset{bipole annotation style/.append style={#1}} +}} + %% Options \ctikzset{label/.style = { l=#1 } } \ctikzset{l/.code = { @@ -188,7 +205,8 @@ } % reset cm is not working correctly here (labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(labelcoor) - node[anchor=mid, rotate=\pgfcirclabrot](\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}} + node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style] + (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}} } \def\pgf@circ@drawreglabels#1{ @@ -257,7 +275,7 @@ \fi \fi\fi (labelcoor) node[anchor=\pgf@circ@labanctext, - inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, + inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style, ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}% } } diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex index 0c9bfc1209..07a4a050d4 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex @@ -200,7 +200,9 @@ \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}} \def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}} \def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}} +%% polar capacitor is deprectaed, use curved capacitor instead \def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}} +\def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}} \def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}} \def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}} \def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}} @@ -379,7 +381,9 @@ \compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}} \compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} \compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}} +% polar capacitor is deprecated, use curved capacitor instead \compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}} +\compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}} \compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}} \compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}} \compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} @@ -664,7 +668,9 @@ \compattikzset{pR/.style= {\comnpatname potentiometer = #1}} \compattikzset{C/.style = {\comnpatname capacitor = #1}} \compattikzset{eC/.style = {\comnpatname ecapacitor = #1}} +%% pC is deprecated, use cC instead \compattikzset{pC/.style = {\comnpatname polar capacitor = #1}} +\compattikzset{cC/.style = {\comnpatname curved capacitor = #1}} \compattikzset{vC/.style = {\comnpatname variable capacitor = #1}} \compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}} \compattikzset{L/.style = {\comnpatname inductor = #1}} diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex index 1ab0f935b6..facb041eff 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircquadpoles.tex @@ -15,6 +15,8 @@ { \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}} \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + % shapename + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} \anchor{center}{ \northwest \pgf@x=0pt @@ -195,13 +197,13 @@ \edef\pgf@circ@temp{\ctikzvalof{inductor}}% \def\pgf@temp{european}% \ifx\pgf@temp\pgf@circ@temp% - \pgfnode{fullgenericshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} \else% \def\pgf@temp{cute} \ifx\pgf@temp\pgf@circ@temp% - \pgfnode{cuteinductorshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} \else% - \pgfnode{americaninductorshape}{center}{}{pgf@inductor1}{\pgfusepath{stroke}} + \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}} \fi% \fi% @@ -223,13 +225,13 @@ \edef\pgf@circ@temp{\ctikzvalof{inductor}}% \def\pgf@temp{european}% \ifx\pgf@temp\pgf@circ@temp% - \pgfnode{fullgenericshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} \else% \def\pgf@temp{cute} \ifx\pgf@temp\pgf@circ@temp% - \pgfnode{cuteinductorshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} \else% - \pgfnode{americaninductorshape}{center}{}{pgf@inductor2}{\pgfusepath{stroke}} + \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}} \fi% \fi% @@ -237,17 +239,17 @@ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpointanchor{pgf@inductor1}{b}} + \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}} - \pgfpathmoveto{\pgfpointanchor{pgf@inductor1}{a}} + \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}} \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpointanchor{pgf@inductor2}{a}} + \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}} - \pgfpathmoveto{\pgfpointanchor{pgf@inductor2}{b}} + \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}} \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex index 6c8df35607..73f1485b2b 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex @@ -4066,7 +4066,7 @@ \pgfseteorule \pgfusepath{clip} \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}} - \pgfsetfillcolor{black} + \pgfsetfillcolor{\ctikzvalof{color}} \pgfusepath{fill, draw} \endpgfscope \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step} diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex index 158ee2dd79..bad64d1bd8 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex @@ -10,6 +10,14 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Voltage management +%% styles +\ctikzset{bipole voltage style/.style={}} +\tikzset{bipole voltage style/.code={ + \ctikzset{bipole voltage style/.style={#1}} +}} +\tikzset{bipole voltage append style/.code={ + \ctikzset{bipole voltage style/.append style={#1}} +}} \ctikzset{v^>/.style = { v = #1, @@ -94,8 +102,6 @@ \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}} % % plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex) -% notice that the double braces are needed to be able -% to use \boldmath in the font (although it is semi-deprecated...) % \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}} \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}} @@ -457,8 +463,9 @@ \ifpgf@circuit@bipole@voltage@straight coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $) - node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] - at (Vlab) { \pgf@circ@finallabels{voltage/label} } + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt, + \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage) + at (Vlab) {\pgf@circ@finallabels{voltage/label}} \else \ifpgf@circuit@europeanvoltage coordinate (Vlab) at ($(pgfcirc@Vcont1)!0.5!(pgfcirc@Vcont2)$) @@ -470,7 +477,9 @@ coordinate (Vlab) at ($(Vlab) ! \alshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vto)$) \fi \fi - node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] at (Vlab) { \pgf@circ@finallabels{voltage/label} } + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt, + \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage) + at (Vlab) {\pgf@circ@finallabels{voltage/label}} \fi }%end drawvoltages \endinput diff --git a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex index a5117dfe78..c1b973efb2 100644 --- a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex +++ b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex @@ -1,5 +1,5 @@ -\def\pgfcircversion{0.9.4} -\def\pgfcircversiondate{2019/08/30} +\def\pgfcircversion{0.9.5} +\def\pgfcircversiondate{2019/10/12} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} \usemodule[tikz] @@ -17,9 +17,6 @@ \catcode`\|=12 \catcode`\!=12 -\let\tiny=\tfxx -\let\small=\tfx - \input pgfcirc.defines.tex \input pgfcircutils.tex |