summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/circuitikz
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-10-31 03:02:14 +0000
committerNorbert Preining <norbert@preining.info>2023-10-31 03:02:14 +0000
commit8e5b71c9e0334c62d993c6d03d9a5a98ca59518b (patch)
tree9677032880e3306dd8b3ad5a9418ae5440b683d2 /graphics/pgf/contrib/circuitikz
parent8647e4164dd0349eb19a3068ec19c135647e1b4c (diff)
CTAN sync 202310310302
Diffstat (limited to 'graphics/pgf/contrib/circuitikz')
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/changelog.tex32
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdfbin13459 -> 13461 bytes
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdfbin1695110 -> 1736212 bytes
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex233
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/circuitikz.sty4
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex5
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex420
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex11
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex4
9 files changed, 678 insertions, 31 deletions
diff --git a/graphics/pgf/contrib/circuitikz/doc/changelog.tex b/graphics/pgf/contrib/circuitikz/doc/changelog.tex
index a0c556df40..0586f67004 100644
--- a/graphics/pgf/contrib/circuitikz/doc/changelog.tex
+++ b/graphics/pgf/contrib/circuitikz/doc/changelog.tex
@@ -5,6 +5,34 @@ full list of changes.
\begin{itemize}
\item
+ Version 1.6.5 (2023-10-29)
+
+ This version features an important overhaul of the \texttt{muxdemux}
+ configurable component/shape, making it much more flexible and
+ powerful, by adding configurable labels and negation and clock symbols
+ to the pins. Also, a couple of minor fixes/workarounds.
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Added optional and configurable inner, outer and border labels to
+ the \texttt{muxdemux} shapes
+ \item
+ Added optional clock wedge and negation signs to the pins of
+ \texttt{muxdemux} shapes
+ \item
+ Added the possibility to add a background drawing to
+ \texttt{muxdemux} shapes
+ \item
+ Fixed a
+ \href{https://github.com/circuitikz/circuitikz/issues/748}{bug} with
+ \texttt{straightvoltages} and \texttt{open}
+ \item
+ Added an (ugly) workaround for a
+ \href{https://github.com/circuitikz/circuitikz/issues/747}{voltage
+ shift mismatch} for sources
+ \end{itemize}
+\item
Version 1.6.4 (2023-10-10)
A bit of enhancement and fixes for the European-style logic ports,
@@ -253,7 +281,7 @@ full list of changes.
B. Cameron, user \texttt{@cameroncb1} on GitHub)
\item
Added Shockley diode (suggested by
- {[}@dauph{]}(https://tex.stackexchange.com/questions/646039/creating-a-shockley-diode-in-circuitikz))
+ \href{https://tex.stackexchange.com/questions/646039/creating-a-shockley-diode-in-circuitikz}{@dauph})
\end{itemize}
\item
Version 1.5.2 (2022-05-08)
@@ -1431,7 +1459,7 @@ A detailed list of changes can be seen below.
\item
Fixed varcap symbol at small scalings
\item
- New packet-option "straightvoltages, to draw straight(no curved)
+ New packet-option ``straightvoltages, to draw straight(no curved)
voltage arrows
\item
New option ``invert'' to revert the node direction at paths
diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf
index e7bc7af850..42c752e23b 100644
--- a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf
+++ b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf
index 5eef804aa8..8583d870a7 100644
--- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf
+++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
index 1982bca452..32a8a8c532 100644
--- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
+++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
@@ -7281,11 +7281,133 @@ The code that implemented the printing of the numbers (which in \texttt{muxdemux
\foreach \myp in {1,...,\NB} \node[above, font=\tiny] at (\myn.bbpin \myp){\myp};
\foreach \myp in {1,...,\NT} \node[below, font=\tiny] at (\myn.btpin \myp){\myp};
}
+\end{circuitikz}
\end{lstlisting}
-\subsubsection{Adding wedge or circular inversion markers}\label{sec:wedge-inversion}
+\subsubsection{Adding labels to the pins}\label{sec:muxdemux-labels}
+
+In \texttt{muxdemux}es, there is no automatic labelling of pins with numbers as in chips; there is no simple standard enumeration possible. But since \texttt{v1.6.5} it is possible to associate a name to the pins that will be printed with the shape; that names are called \emph{pin labels}.
+Pin labels are counter-rotated by default if the shape is rotated, as in chip pin numbers~(see \ref{sec:chip-rotation}), but you can avoid it with the key \texttt{rotated numbers} (the default is \texttt{straight numbers}).
+Additionally, you can set also \emph{border labels} on the four borders (more or less, see later); that are normally not counter-rotated \emph{unless} the result would be upside-down (or if you use \texttt{straight numbers}, of course), and clock and negation symbols.
+
+All of these labels and symbols are added by specifying them in a \texttt{muxdemux label=\{\dots\}} clause. Notice that the key specified there are not checked for validity; if you misspell any of that, it will be simply ignored.
+
+\paragraph{Inner pin labels} will be printed in the inside of the shape, with the font specified in the \verb|\ctikzset| key \texttt{muxdemux/inner label font} (default is \verb|\tiny| in \LaTeX, other engine can have it different --- better set it in case of doubt) and with a padding setting with the keys \texttt{muxdemux/inner label xsep} and \texttt{muxdemux/inner label ysep} (respectively for horizontal and vertical shifts; default for both \texttt{2pt}). You can also use the key \texttt{muxdemux/inner label sep} to set both at the same time.
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}
+\tikzset{myICwl/.style={muxdemux,
+ muxdemux def={Lh=4, Rh=4, w=4,
+ NR=1, NL=2, NB=2, NT=2,},
+ muxdemux label={L1=left1, L2=left2,
+ R1=r1, B2=b2, T1=t1, T2=t2},
+ }
+}
+\draw (0, 0) node[myICwl]{chip} ++(3,0)
+ node[myICwl, rotate=-90]{chip};
+\draw (0, -3) node[myICwl]{chip} ++(3,0)
+ node[myICwl, rotate=-90,
+ rotated numbers]{chip};
+\end{circuitikz}
+\end{LTXexample}
+
+As you can see, the syntax is to add a \texttt{muxdemux label} to the specification; the labels are set using one of the letter \texttt{L}, \texttt{R}, \texttt{B}, and \texttt{T} for respectively left, right, bottom and top labels. You can define all the labels, none (which will give the default behavior of no-labels as it was before \texttt{v1.6.5}), or any number you wish.
+If you want some specific label rotated in a different way, you have to do it manually, as shown in the following example.
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}
+\tikzset{mux 4by2 wl/.style={muxdemux,
+ muxdemux def={Lh=6, NL=6, Rh=3, NB=2, w=3, NT=1},
+ draw only left pins={2-5},
+ muxdemux label={B1=$A_1$, B2=$A_0$, R1=OUT,
+ L2=$D_{00}$, L3=$D_{01}$, L4=$D_{10}$, L5=$D_{11}$,
+ T1=\rotatebox{90}{\texttt{Enable}}},
+ circuitikz/muxdemux/inner label ysep=4pt}}
+\node [mux 4by2 wl]{};
+\end{circuitikz}
+\end{LTXexample}
-Although you can add ``negation balls'' as seen for, for example, flip-flops (see section~\ref{sec:flip-flop-cust}), sometimes the European-style notation (also accepted by the IEEE standard) with the small wedge is preferred. The \texttt{wedgeinv} shape will nicely do. It'll scale with the \texttt{muxdemuxes} class, and the length and height can be changed with the keys \texttt{wedge inversion mark/width} (default \texttt{0.2}) and \texttt{height} (default \texttt{0.1}), with the same units that are used for the \texttt{external pins width} and similar keys.
+\paragraph{Outer pin labels} will be printed on the outside of the pin position --- in the case of left and right pins, either above (``up'', identified by \texttt{LU} and \texttt{RU} labels), or below (``down'', \texttt{LD} and \texttt{RD} labels); in the case of top and bottom pin, either at the left (\texttt{TL} and \texttt{BL}) or at the right (\texttt{TR} and \texttt{BR}). The font is specified in the key \texttt{muxdemux/outer label font} (default \verb|\tiny|) and the padding with the corresponding \texttt{muxdemux/outer label xsep} and \texttt{muxdemux/outer label ysep} (default for both \texttt{2pt}), or \texttt{muxdemux/outer label sep} to set both at the same time.
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}
+\ctikzset{muxdemux/outer label
+ font={\tiny\ttfamily\color{blue}}}
+\tikzset{myICwl/.style={muxdemux,
+ muxdemux def={Lh=4, Rh=4, w=4,
+ NR=1, NL=2, NB=2, NT=2,},
+ muxdemux label={L1=left1, L2=left2,
+ R1=r1, B2=b2, T1=t1, T2=t2,
+ LU1=lu1, LU2=lu2, LD1=ld1, LD2=ld2,
+ BR1=br1, BL1=bl1, BR2=br2, BL2=bl2,
+ RU1=ru1, RD1=rd1,TR2=tr2, TL2=tl2,
+ TR1=tr1, TL1=tl1},}
+}
+\draw (0, 0) node[myICwl]{chip} ++(3,0)
+ node[myICwl, rotate=-90]{chip};
+\draw (0, -3) node[myICwl]{chip} ++(3,0)
+ node[myICwl, rotate=-90,
+ rotated numbers]{chip};
+\end{circuitikz}
+\end{LTXexample}
+
+\paragraph{Border labels} are drawn \emph{before} the other labels along the external border (to be exact: in north, south, east, and west position) of the component.
+You set them with the key \texttt{N}, \texttt{S}, \texttt{W}, and \texttt{E} for the outer position, and \texttt{Ni}, \texttt{Si}, \texttt{Wi}, and \texttt{Ei} for the inner ones.
+The font is specified in the key \texttt{muxdemux/border label font} (default \verb|\tiny|) and the padding with the corresponding \texttt{muxdemux/border label xsep} and \texttt{muxdemux/border label ysep} (default for both \texttt{2pt}), or \texttt{muxdemux/border label sep} to set both at the same time.
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}
+\ctikzset{muxdemux/outer label
+ font={\tiny\ttfamily\color{blue}}}
+\tikzset{myICwl/.style={muxdemux,
+ muxdemux def={Lh=4, Rh=4, w=4,
+ NR=1, NL=2, NB=0, NT=0,},
+ muxdemux label={L1=inA, L2=inB,
+ R1=OUT, RU1=3, LU1=1, LU2=2,
+ N=mychip},}
+}
+\draw (0, 0) node[myICwl]{} ++(3,0)
+ node[myICwl, rotate=180]{};
+\draw (0, -3) node[myICwl,
+ muxdemux label={N=another}]{};
+\end{circuitikz}
+\end{LTXexample}
+
+As you can see, you can locally change any label in a specific instance.
+
+\paragraph{Clock and negation symbols} are not exactly labels, but they can be added with the same mechanism. There are four symbols available:
+\begin{description}
+ \item [clock wedge:] activated by the key \texttt{c} followed by the position (for example, \texttt{cL2} will set the clock wedge on the second left pin); its size can be changed with the key \texttt{muxdemux/clock wedge size} (default \texttt{0.2}, relative to \texttt{muxdemux/base len});
+ \item [not ball:] activated by the key \texttt{n} followed by the position (for example, \texttt{cR1} will set the negation circle on the first right pin); the type and shape of the ball will depend on the logic port negation in use (basically it will use a \texttt{circleinv} shape unless you are using european ports with the small \texttt{ocirc} negation symbol);
+ \item [wedge in:] a wedge negation \emph{entering} the component (with the point on the border), activated by the key \texttt{wi} followed by the position;
+ \item [wedge out:] a wedge negation \emph{exiting} the component (with the base on the border), activated by the key \texttt{wo} followed by the position.
+\end{description}
+The value of the key should be \texttt{0} or \texttt{1} for clocks and not circles; zero means ``do not draw'' and is used to override a previously specified element. In the case of wedge-style not, the \texttt{-1} value flips the side of the triangle (see the following example).
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz} \ctikzset{muxdemux/outer label
+ font={\tiny\ttfamily\color{blue}}}
+\ctikzset{logic ports=ieee, multipoles/external pins width=0.3}
+\tikzset{myICwl/.style={muxdemux,
+ muxdemux def={Lh=4, Rh=4, w=4, NR=2, NL=2, NB=1, NT=0,},
+ muxdemux label={L1=inA, L2=inB, R1=OUT, RU1=3, LU1=1, LU2=2,
+ N=example, nL1=1, woR1=1, woR2=-1, wiB1=1, cL2=1},}
+}
+\draw (0, 0) node[myICwl]{};
+\draw (0, -3) node[myICwl,
+ muxdemux label={N=another, LU1={1\strut},
+ RU1={3\strut}, cL2=0}](A){};
+\draw[red, <-] (A-nL1.-135) -- ++(-135:0.3);
+\end{circuitikz}
+\end{LTXexample}
+
+As you can see, the label position is not affected (with the exception of the clock wedge, that displaces the inner label), so you have to manually take care of not having overruns; you can change the \texttt{xsep} or \texttt{ysep} or, as shown in the example, modify the heigh and depth of the affected labels.
+
+You have also to take care of the effect shown for the flip-flops in section~\ref{sec:flip-flop-cust}, to avoid overrun the not circles when connecting wires. The ``not'' elements are named after the instance as \texttt{\textsl{<nodename>}-\textsl{<activating key>}} to give access to the border (show also in the example, although in bit of forced way\dots look at the red arrow).
+
+\subsubsection{Manually adding wedges or circular inversion markers}\label{sec:wedge-inversion}
+
+If the standard ``internal'' negation symbols are not sufficiently configurable for your application, you can add them manually.
+To add the wedge symbol, the \texttt{wedgeinv} shape will nicely do. It'll scale with the \texttt{muxdemuxes} class, and the length and height can be changed with the keys \texttt{wedge inversion mark/width} (default \texttt{0.2}) and \texttt{height} (default \texttt{0.1}), with the same units that are used for the \texttt{external pins width} and similar keys.
Similarly, there is also a \texttt{circleinv} shape, which is basically the same as the \texttt{notcirc} (see~\ref{sec:ieeestdports}) one, but that scales with the \texttt{muxdemuxes} class and that has the default anchor at its left, similarly to \texttt{wedgeinv}. This one will be filled if the class says so, contrary to the wedge-like shapes that are always open.
@@ -7310,6 +7432,52 @@ Similarly, there is also a \texttt{circleinv} shape, which is basically the same
\end{tikzpicture}
\end{LTXexample}
+\subsubsection{Adding a background drawing to the muxdemux}
+
+In a similar way to the oscilloscope waveform, you can add a drawing to the \texttt{muxdemux} component, provided you use basic-level \texttt{pgf} commands. You have to define a \texttt{.code} key named \texttt{bgpicture} in the \texttt{muxdemux def} definitions, as in the following example. The coordinate system is changed so that the horizontal axis of the shape is mapped between \SI{-1}{\cm} and \SI{+1}{\cm} and the origin at the center; the vertical extent will then depend on the form factor of the \texttt{muxdemux}: for example, the vertical coordinate of the top left border will be $\SI{1}{\cm}\cdot{\mathtt{Lh}/\mathtt{w}}$.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\scriptsize\ttfamily, keepspaces=true]
+\begin{circuitikz}
+\ctikzset{muxdemux/outer label font={\tiny\ttfamily\color{blue}}}
+\tikzset{myICwl/.style={muxdemux,
+ muxdemux def={Lh=4, Rh=4, w=3, NR=1, NL=2, NB=0, NT=0,
+ bgpicture/.code={%
+ \pgfsetcolor{gray!50}\pgfsetlinewidth{1mm}
+ \pgfpathmoveto{\pgfpoint{-1cm}{1cm*4/3}} \pgfpathlineto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfpoint{-1cm}{-1cm*4/3}}\pgfpathlineto{\pgfpointorigin}
+ \pgfpathmoveto{\pgfpoint{1cm}{0cm}} \pgfpathlineto{\pgfpointorigin}
+ \pgfpathcircle{\pgfpointorigin}{0.5cm}
+ \pgfusepath{draw}
+ },
+ },
+ muxdemux label={RU1=3, LU1=1, LU2=2, N=flux, Ni=converter},}
+}
+\draw (0, 0) node[myICwl]{}{};
+\end{circuitikz}
+\end{LTXexample}
+
+You can even embed images:
+
+\begin{LTXexample}[varwidth=true, basicstyle=\scriptsize\ttfamily]
+\begin{circuitikz}
+\ctikzset{muxdemux/outer label font={\tiny\ttfamily\color{blue}}}
+\tikzset{myICwl/.style={muxdemux,
+ muxdemux def={Lh=4, Rh=4, w=3, NR=1, NL=2, NB=0, NT=0,
+ bgpicture/.code={%
+ \pgfdeclareimage[width=1.5cm]{myimg}{example-image-a}
+ \pgftext{\pgfuseimage{myimg}}
+ },
+ },
+ muxdemux label={RU1=3, LU1=1, LU2=2, N=embedding, Ni=images},}
+}
+\draw (0, 0) node[myICwl]{}{};
+\end{circuitikz}
+\end{LTXexample}
+
+
+For more complex things, consider using a normal macro that draws on the background layer and that use the geographical coordinates of the node to locate it.
+
+
\subsubsection{Mux-Demux special usage}
You can use these shapes to draw a lot of symbols that are unavailable; using a bit of \LaTeX{} command trickery you can use them quite naturally too\dots. Examples with personalized amplifier shapes are listed in section~\ref{sec:muxdemux-amplis}.
@@ -7331,21 +7499,19 @@ As an additional example, this was used before the introduction of the \texttt{d
\end{circuitikz}
\end{LTXexample}
-Finally, you can play with them to create chips that have generic numbers of pins on the four sides, as in the following example (asked on \href{https://tex.stackexchange.com/q/596320/38080}{TeX.Stackexchange}):
+Finally, you can play with them to create chips that have generic numbers of pins on the four sides, as in the following example (asked on \href{https://tex.stackexchange.com/q/596320/38080}{TeX.Stackexchange}; notice however that this example has been made \emph{before} the option for labels existed; it could be quite streamlined now, as shown later):
-\begin{LTXexample}[varwidth=true]
-\begin{tikzpicture}[scale=0.8, transform shape]
+\begin{LTXexample}[varwidth=true, basicstyle=\scriptsize\ttfamily]
+\begin{tikzpicture}[scale=0.7, transform shape]
\tikzset{ic555/.style={muxdemux,
- muxdemux def={Lh=10, NL=5, Rh=10, NR=5,
- NB=2, w=6, NT=2, square pins=1},
+ muxdemux def={Lh=10, NL=5, Rh=10, NR=5, NB=2, w=6, NT=2,
+ square pins=1},
no input leads, external pins width=0.4,
circuitikz/muxdemuxes/fill=blue!10}
}
- \node [ic555, font=\small\ttfamily,align=center](A)
- at (0,0) {555\\Astable};
+ \node [ic555, font=\small\ttfamily,align=center](A) at (0,0) {555\\Astable};
% left pins
- \foreach \rawpin/\npin/\label in
- {2/7/Discharge, 4/2/Trigger, 5/6/Threshold} {
+ \foreach \rawpin/\npin/\label in {2/7/Discharge, 4/2/Trigger, 5/6/Threshold}{
\draw (A.lpin \rawpin) -- (A.blpin \rawpin)
node[midway, blue, font=\small, above]{\npin}
node[right, font=\small]{\label};
@@ -7360,12 +7526,32 @@ Finally, you can play with them to create chips that have generic numbers of pin
\draw (A.bpin \rawpin) -- (A.bbpin \rawpin)
node[midway, blue, font=\small, left]{\npin};
}
- % finally, left
+ % finally, right
\draw (A.rpin 3) -- (A.brpin 3)
node[midway, blue, font=\small, above]{3};
\end{tikzpicture}
\end{LTXexample}
+In a version of \Circuitikz{} better or equal to \texttt{v1.6.5}, you can do this:
+
+\begin{LTXexample}[varwidth=true, basicstyle=\scriptsize\ttfamily]
+\begin{tikzpicture}[scale=0.7, transform shape]
+\ctikzset{muxdemux/inner label font=\small}
+\ctikzset{muxdemux/outer label font={\small\color{blue}}}
+ \tikzset{ic555/.style={muxdemux,
+ muxdemux def={Lh=10, NL=5, Rh=10, NR=1, NB=2, w=6, NT=2},
+ muxdemux label={L2=Discharge, L4=Trigger, L5=Threshold,
+ T1=VCC, B2=GND,
+ LU2=7, LU4=2, LU5=6, TL1=8, TL2=4, RU1=3, BL1=5, BL2=1},
+ external pins width=0.4,
+ draw only left pins={2,4,5},
+ circuitikz/muxdemuxes/fill=blue!10}
+ }
+ \node [ic555, font=\small\ttfamily,align=center](A)
+ at (0,0) {555\\Astable};
+\end{tikzpicture}
+\end{LTXexample}
+
\subsection{Chips (integrated circuits)}\label{sec:chips}
@@ -7471,7 +7657,7 @@ with the \texttt{bpin \textit{n}} anchors for the suppressed pins.
\end{circuitikz}
\end{LTXexample}
-\subsubsection{Chips anchors}
+\subsubsection{Chip anchors}
Chips have anchors on pins and global anchors for the main shape.
The pin anchors to be used to connect wires to the chip are called \texttt{pin 1}, \texttt{pin 2} , \dots, with just one space between \texttt{pin} and the number.
@@ -7506,7 +7692,7 @@ Additionally, you have geometrical anchors on the chip ``box'', see the followin
\end{circuitikz}
\end{quote}
-\subsubsection{Chips rotation}
+\subsubsection{Chip rotation}\label{sec:chip-rotation}
You can rotate chips, and normally the pin numbers are kept straight (option \texttt{straight numbers}, which is the default), but you can rotate them if you like with \texttt{rotated numbers}.
Notice that the main label has to be (counter-) rotated manually in this case.
@@ -8478,6 +8664,25 @@ Negative values do work as expected:
\end{circuitikz}
\end{LTXexample}
+Unfortunately\footnote{see \href{https://github.com/circuitikz/circuitikz/issues/747}{this bug report}.} the amount of shift given by \texttt{voltage shift} is not always the same between sources and passive bipoles, especially if the sizes of the component is very different from the default. Although this qualifies as a bug, and should be fixed in a more comprehensive way, a workaround is available with the key \texttt{voltage shift sources adjust} (default: \texttt{\ctikzvalof{voltage shift sources adjust}}). A smaller value is better for smaller components, as you can see in the example below.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\newcommand{\example}[2][]{\draw[#1] (#2)
+ to [V_=$U$] ++(0, -1) (#2) ++(2,0)
+ to [R,v=$U_R$] ++(0,-1);
+ }
+\ctikzset{resistors/scale=0.55,inductors/scale=0.55,
+ capacitors/scale=0.6,sources/scale=.8}
+\begin{circuitikz}[circuitikz/voltage=straight,
+ voltage dir=EF]
+ \example{0,4}
+ \ctikzset{voltage shift=2}
+ \example[color=red]{0,2}
+ \ctikzset{voltage shift sources adjust=0.2}
+ \example[color=blue]{0,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 from the lines of the symbols, default \texttt{1.4}) for the latter.
\begin{LTXexample}[varwidth=true]
diff --git a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty
index 464ad23f13..5ca3373737 100644
--- a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty
+++ b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty
@@ -16,8 +16,8 @@
\providecommand\DeclareRelease[3]{}
\providecommand\DeclareCurrentRelease[2]{}
-\def\pgfcircversion{1.6.4}
-\def\pgfcircversiondate{2023/10/10}
+\def\pgfcircversion{1.6.5}
+\def\pgfcircversiondate{2023/10/29}
\DeclareRelease{0.4}{2012/12/20}{circuitikz-0.4-body.tex}
\DeclareRelease{v0.4}{2012/12/20}{circuitikz-0.4-body.tex}
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex
index 35038c59f0..094e0de4c0 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex
@@ -509,8 +509,9 @@
\long\def\pgf@circ@font@tenbm{\normal\bold}%
\long\def\pgf@circ@font@twelve{\tfa} %
\fi\fi\fi
-
-
+% noop
+\def\pgfcirc@nop#1{#1}% no operation, just strip {}
+%
%
% Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
%
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex
index f48aaac10e..dd4a94c716 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex
@@ -1144,7 +1144,7 @@
\ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
\ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
-%% muxdemuxes keys
+%% muxdemuxes internal keys
\ctikzset{multipoles/muxdemux/base len/.initial=0.4}
\ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
@@ -1158,6 +1158,41 @@
\ctikzset{multipoles/muxdemux/NB/.initial=3}
\ctikzset{multipoles/muxdemux/NT/.initial=0}
\ctikzset{multipoles/muxdemux/square pins/.initial=0}%
+\ctikzset{multipoles/muxdemux/bgpicture/.code={}}%
+
+% Thanks to @marmot
+% this should automatically create a key in this subfamily
+\pgfkeys{\circuitikzbasekey/multipoles/muxdemux/label/.is family,
+ \circuitikzbasekey/multipoles/muxdemux/label,
+ .unknown/.code = {
+ \pgfkeyssetvalue{\pgfkeyscurrentpath/\pgfkeyscurrentname}{#1}
+ }
+}
+\tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
+\tikzset{muxdemux label/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux/label}{#1}}
+% external (class-like) muxdemux settings for labels
+\ctikzset{muxdemux/inner label font/.initial=\pgf@circ@font@tiny}
+\ctikzset{muxdemux/outer label font/.initial=\pgf@circ@font@tiny}
+\ctikzset{muxdemux/border label font/.initial=\pgf@circ@font@tiny}
+\ctikzset{muxdemux/inner label xsep/.initial=2pt}
+\ctikzset{muxdemux/inner label ysep/.initial=2pt}
+\ctikzset{muxdemux/outer label xsep/.initial=2pt}
+\ctikzset{muxdemux/outer label ysep/.initial=2pt}
+\ctikzset{muxdemux/border label xsep/.initial=2pt}
+\ctikzset{muxdemux/border label ysep/.initial=2pt}
+\ctikzset{muxdemux/inner label sep/.code={%
+ \ctikzset{muxdemux/inner label xsep=#1}%
+ \ctikzset{muxdemux/inner label ysep=#1}%
+}}
+\ctikzset{muxdemux/outer label sep/.code={%
+ \ctikzset{muxdemux/outer label xsep=#1}%
+ \ctikzset{muxdemux/outer label ysep=#1}%
+}}
+\ctikzset{muxdemux/border label sep/.code={%
+ \ctikzset{muxdemux/border label xsep=#1}%
+ \ctikzset{muxdemux/border label ysep=#1}%
+}}
+\ctikzset{muxdemux/clock wedge size/.initial=0.2}
%>>>
%% Node shapes definitions for flip flops%<<<
@@ -1644,8 +1679,8 @@
%
% MUX-DEMUXES
%
-% Thanks to @marmot
-\tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
+% predefined muxdemux shapes (see manual)
+%
\tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
\tikzset{one bit adder/.style={muxdemux,
muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
@@ -1653,9 +1688,7 @@
\tikzset{ALU/.style={muxdemux,
muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
-
%generic mux-demux shape
-
% helper macros to set the anchors inside a loop (to expand the current count)
% left
\pgfutil@protected\def\pgf@circ@make@muxdemux@L@anchor#1%
@@ -1705,8 +1738,92 @@
\expandafter\gdef\csname pgf@anchor@muxdemux@btpin #1\endcsname
{\pgf@circ@muxdemux@T@anchor{#1}{0}}%
}
-
-
+%% put some label somewhere
+\def\pgf@circ@muxdemux@label@xy#1#2#3#4#5#6#7{%
+ % #1: which label: L,R,T,B or the outer ones with U/D/R/L
+ % #2: rotation
+ % #3: scale pad x
+ % #4: scale pad y
+ % #5: text position
+ % #6: operation on label text
+ % #7: type: inner, outer, border
+ % uses external variables \pgf@circ@count@a unless it's zero, in which case omit it
+ \ifnum\pgf@circ@count@a=0
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1}
+ \else
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
+ \fi
+ \pgfkeysifdefined{\@@thislabel}{%
+ \pgfscope
+ \pgftransformrotate{#2}
+ \pgfmathsetlength\pgf@circ@res@zero{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label xsep}}
+ \pgfmathsetlength\pgf@circ@res@other{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label ysep}}
+ %%% temp is added when we have wedges; it's a bit of a hack but it works if #3,#4 are -1,0,+1
+ \pgftransformxshift{(#3)*(\pgf@circ@res@zero+\pgf@circ@res@temp)}
+ \pgftransformyshift{(#4)*(\pgf@circ@res@other+\pgf@circ@res@temp)}
+ % Ok, now we have the point in the correct position, we add the label
+ \pgftext[#5]{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label font}%
+ \expandafter\csname#6\endcsname{\pgfkeysvalueof{\@@thislabel}}}
+ \endpgfscope
+ }{}
+}
+%% put a clock wedge here
+\def\pgf@circ@muxdemux@clockwedge#1#2{%
+ % #1: which label: cL,cR,cT,cB
+ % #2: rotation
+ % uses external variables \pgf@circ@count@a
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
+ \pgfkeysifdefined{\@@thislabel}{%
+ \edef\value{\pgfkeysvalueof{\@@thislabel}}
+ \ifnum\value=0
+ \pgf@circ@res@temp=0pt
+ \else\pgfscope
+ \pgftransformrotate{#2}
+ \pgfpathmoveto{\pgfpoint{+0pt}{-\clockwedge}}
+ \pgfpathlineto{\pgfpoint{\clockwedge}{+0pt}}
+ \pgfpathlineto{\pgfpoint{+0pt}{\clockwedge}}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgf@circ@res@temp=\clockwedge
+ \fi
+ }{}
+}
+%% put a negation here
+\def\pgf@circ@muxdemux@not@ball#1#2{%
+ % #1: which label: nL,nR,nT,nB
+ % #2: anchor
+ % uses external variables \pgf@circ@count@a
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
+ \pgfkeysifdefined{\@@thislabel}{%
+ \edef\value{\pgfkeysvalueof{\@@thislabel}}
+ \ifnum\value=0
+ \else
+ \pgfnode{\@@notcirc}{#2}{}{\thisshape-#1\the\pgf@circ@count@a}{\pgfusepath{stroke}}
+ \fi
+ }{}
+}
+%% put a negation wedge here
+\def\pgf@circ@muxdemux@not@wedge#1#2#3#4#5{%
+ % #1: which label: wi/wp with L,R,T,B
+ % #2: anchor
+ % #3: xscale
+ % #4: yscale
+ % #5: rotation
+ % uses external variables \pgf@circ@count@a
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
+ \pgfkeysifdefined{\@@thislabel}{%
+ \edef\value{\pgfkeysvalueof{\@@thislabel}}
+ \ifnum\value=0
+ \else\pgfscope
+ \pgftransformrotate{#5}
+ \pgftransformxscale{#3}
+ \pgftransformyscale{#4}
+ \pgftransformyscale{\value}% to flip
+ \pgfnode{wedgeinv}{#2}{}{\thisshape-#1\the\pgf@circ@count@a}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ }{}
+}
+%
\pgfdeclareshape{muxdemux}{
\savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
@@ -1849,6 +1966,18 @@
\pgf@circ@res@step = \pgf@x
\pgf@circ@res@temp = \pgf@y
%
+ % draw the (user-selectable) background
+ %
+ \pgfscope
+ \pgfmathsetmacro{\@@scalex}{\pgf@circ@res@right/1cm}
+ % It's better not to change the scale in an asymmetric way
+ % \pgfmathsetmacro{\@@scaley}{\pgf@circ@res@up/1cm}
+ \pgftransformxscale{\@@scalex}
+ \pgftransformyscale{\@@scalex}
+ \pgf@circ@setlinewidth{multipoles}{\pgfstartlinewidth}
+ \pgfkeys{\circuitikzbasekey/multipoles/muxdemux/bgpicture}
+ \endpgfscope
+ %
% external block
%
\pgfscope% (for the line width)
@@ -1866,7 +1995,7 @@
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
\fi
\pgfpathclose
- \pgf@circ@draworfill
+ \pgf@circ@draworfill
\endpgfscope
% now we have to draw the pins, if needed
\ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent
@@ -1995,6 +2124,281 @@
% end drawing pins; stroke them
\pgfusepath{stroke}
\endpgfscope\fi\fi
+ %%%% Labels. Added by Romano 14/10/2023.
+ % manage labels. This is independent from the drawing of pins; redo the loops. Surely
+ % there is a better way; but it's complex to factor out code. Let's go the KISS way.
+ \ifpgf@circuit@chip@straightnumbers
+ \pgfgettransformentries\a\b\temp\temp\temp\temp
+ \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
+ \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
+ \else
+ \pgfmathsetmacro{\rot}{0}
+ \pgfmathsetmacro{\quadrant}{0}
+ \fi
+ % clockwedge size
+ \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{muxdemux/clock wedge size}*\ctikzvalof{multipoles/muxdemux/base len}*\scaledRlen}
+ \edef\clockwedge{\the\pgf@circ@res@temp}
+ % select which negation ball to use
+ \ifpgf@circuit@ieeelogicport
+ \def\@@notcirc{circleinv}
+ \else
+ \ifpgf@circ@european@port@circle@ieee
+ \def\@@notcirc{circleinv}
+ \else
+ \def\@@notcirc{ocirc}
+ \fi
+ \fi
+ %% border labels
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@count@a=0
+ % go to north
+ \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
+ \pgfscope
+ \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
+ \ifnum\quadrant=2
+ \pgf@circ@muxdemux@label@xy{N}{180}{0}{-1}{top}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@muxdemux@label@xy{Ni}{180}{0}{1}{bottom}{pgfcirc@nop}{border}%
+ \else
+ \pgf@circ@muxdemux@label@xy{N}{0}{0}{1}{bottom}{pgfcirc@nop}{border}%
+ \pgf@circ@muxdemux@label@xy{Ni}{0}{0}{-1}{top}{pgfcirc@nop}{border}%
+ \fi
+ \endpgfscope
+ % go south!
+ \pgfscope
+ \pgftransformshift{\pgfpoint{0pt}{-\pgf@circ@res@up}}
+ \ifnum\quadrant=2
+ \pgf@circ@muxdemux@label@xy{S}{180}{0}{1}{bottom}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@muxdemux@label@xy{Si}{180}{0}{-1}{top}{pgfcirc@nop}{border}%
+ \else
+ \pgf@circ@muxdemux@label@xy{S}{0}{0}{-1}{top}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@muxdemux@label@xy{Si}{0}{0}{1}{bottom}{pgfcirc@nop}{border}%
+ \fi
+ \endpgfscope
+ % go west!
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
+ \ifnum\quadrant=3
+ \pgf@circ@muxdemux@label@xy{W}{-90}{0}{-1}{top}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@muxdemux@label@xy{Wi}{-90}{0}{1}{bottom}{pgfcirc@nop}{border}%
+ \else
+ \pgf@circ@muxdemux@label@xy{W}{90}{0}{1}{bottom}{pgfcirc@nop}{border}%
+ \pgf@circ@muxdemux@label@xy{Wi}{90}{0}{-1}{top}{pgfcirc@nop}{border}%
+ \fi
+ \endpgfscope
+ % go east!
+ \pgfscope
+ \pgftransformshift{\pgfpoint{-\pgf@circ@res@left}{0pt}}
+ \ifnum\quadrant=3
+ \pgf@circ@muxdemux@label@xy{E}{-90}{0}{1}{bottom}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@muxdemux@label@xy{Ei}{-90}{0}{-1}{top}{pgfcirc@nop}{border}%
+ \else
+ \pgf@circ@muxdemux@label@xy{E}{90}{0}{-1}{top}{pgfcirc@nop}{border}%
+ \pgf@circ@muxdemux@label@xy{Ei}{90}{0}{1}{bottom}{pgfcirc@nop}{border}%
+ \fi
+ \endpgfscope
+ % start exploring all the pins. We repeat the steps to position the coordinate on every pin.
+ % left pins
+ \ifnum\NL>0\relax
+ \pgf@circ@count@a=\NL\relax
+ \pgf@circ@count@b=\NL \divide\pgf@circ@count@b by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate
+ \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
+ \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
+ \ifdim\pgf@circ@res@down>0pt % check if we have an inset
+ % we have to check oddity
+ \ifodd\NL
+ \ifnum\NL=1
+ % only centerpin, step should not be used, but anyway...
+ \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
+ \else
+ \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
+ \fi
+ \else
+ \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
+ \fi
+ \else % no inset
+ \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
+ \fi
+ \pgfmathloop%
+ \ifnum\pgf@circ@count@a>0
+ \pgfscope
+ \ifdim\pgf@circ@res@down>0pt % check if we have an inset
+ \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
+ % for lower pins we have to shift them down
+ \ifodd\NL
+ % odd number of pins
+ \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
+ % centerpin!
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
+ \else
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a+1)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
+ \fi
+ \else
+ % even numer of pins: just go down
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
+ \fi
+ \else
+ % nothing need for #1<=NL/2
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \fi
+ \else
+ % no inset
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \fi
+ % put the not ball/wedges if needed
+ \pgf@circ@muxdemux@not@ball{nL}{east}
+ \pgf@circ@muxdemux@not@wedge{wiL}{east}{1}{1}{0}
+ \pgf@circ@muxdemux@not@wedge{woL}{west}{-1}{1}{0}
+ % \fi
+ \pgf@circ@muxdemux@clockwedge{cL}{0}
+ %% put the labels
+ \ifcase\quadrant % rotation 0; left label are at the left
+ \pgf@circ@muxdemux@label@xy{L}{0}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{LU}{0}{-1}{1}{bottom}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{LD}{0}{-1}{-1}{top}{llap}{outer}%
+ \or %rotation -90; left labels are at the top
+ \pgf@circ@muxdemux@label@xy{L}{90}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{LU}{90}{-1}{1}{bottom}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{LD}{90}{1}{1}{bottom}{rlap}{outer}%
+ \or %rotation 180; left labels are at the right
+ \pgf@circ@muxdemux@label@xy{L}{180}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{LU}{180}{1}{1}{bottom}{rlap}{outer}%
+ \pgf@circ@muxdemux@label@xy{LD}{180}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation +90; left labels are at the bottom
+ \pgf@circ@muxdemux@label@xy{L}{-90}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{LU}{-90}{-1}{-1}{top}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{LD}{-90}{1}{-1}{top}{rlap}{outer}%
+ \fi
+ \endpgfscope
+ \advance\pgf@circ@count@a by -1\relax%
+ \repeatpgfmathloop
+ \fi
+ %% right pins
+ \ifnum\NR>0\pgf@circ@count@a=\NR\relax
+ \pgfmathloop%
+ \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
+ \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
+ \ifnum\pgf@circ@count@a>0
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
+ % put the not ball/wedge if needed
+ \pgf@circ@muxdemux@not@ball{nR}{west}
+ \pgf@circ@muxdemux@not@wedge{wiR}{east}{-1}{1}{0}
+ \pgf@circ@muxdemux@not@wedge{woR}{west}{1}{1}{0}
+ % put the clock wedge if needed
+ \pgf@circ@muxdemux@clockwedge{cR}{180}
+ \ifcase\quadrant % rotation 0; right label are at the right
+ \pgf@circ@muxdemux@label@xy{R}{0}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{RU}{0}{1}{1}{bottom}{rlap}{outer}%
+ \pgf@circ@muxdemux@label@xy{RD}{0}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation -90; right labels are at the bottom
+ \pgf@circ@muxdemux@label@xy{R}{90}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{RU}{90}{-1}{-1}{top}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{RD}{90}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation 180; right labels are at the left
+ \pgf@circ@muxdemux@label@xy{R}{180}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{RU}{180}{-1}{1}{bottom}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{RD}{180}{-1}{-1}{top}{llap}{outer}%
+ \or %rotation +90; right labels are at the top
+ \pgf@circ@muxdemux@label@xy{R}{-90}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{RU}{-90}{-1}{1}{bottom}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{RD}{-90}{1}{1}{bottom}{rlap}{outer}%
+ \fi
+ \endpgfscope
+ \advance\pgf@circ@count@a by -1\relax%
+ \repeatpgfmathloop
+ \fi
+ %% bottom pins
+ \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
+ \pgfmathloop%
+ \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
+ \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
+ \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
+ \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step}
+ \ifnum\pgf@circ@count@a>0
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step}
+ {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
+ % put the not ball/wedge if needed
+ \pgf@circ@muxdemux@not@ball{nB}{north}
+ \pgf@circ@muxdemux@not@wedge{wiB}{east}{1}{1}{90}
+ \pgf@circ@muxdemux@not@wedge{woB}{west}{-1}{1}{90}
+ % put the clock wedge if needed
+ \pgf@circ@muxdemux@clockwedge{cB}{90}
+ \ifcase\quadrant % rotation 0; bottom label are at the bottom
+ \pgf@circ@muxdemux@label@xy{B}{0}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{BL}{0}{-1}{-1}{top}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{BR}{0}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation -90; bottom labels are at the left
+ \pgf@circ@muxdemux@label@xy{B}{90}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{BL}{90}{-1}{1}{bottom}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{BR}{90}{-1}{-1}{top}{llap}{outer}%
+ \or %rotation 180; bottom labels are at the top
+ \pgf@circ@muxdemux@label@xy{B}{180}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{BL}{180}{-1}{1}{bottom}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{BR}{180}{1}{1}{bottom}{rlap}{outer}%
+ \or %rotation +90; bottom labels are at the right
+ \pgf@circ@muxdemux@label@xy{B}{-90}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{BL}{-90}{1}{1}{bottom}{rlap}{outer}%
+ \pgf@circ@muxdemux@label@xy{BR}{-90}{1}{-1}{top}{rlap}{outer}%
+ \fi
+ \endpgfscope
+ \advance\pgf@circ@count@a by -1\relax%
+ \repeatpgfmathloop
+ \fi
+ %% top pins
+ \ifnum\NT>0\pgf@circ@count@a=\NT\relax
+ \pgfmathloop%
+ \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
+ \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
+ \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
+ \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step}
+ \ifnum\pgf@circ@count@a>0
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step}
+ {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
+ % put the not ball/wedge if needed
+ \pgf@circ@muxdemux@not@ball{nT}{south}
+ \pgf@circ@muxdemux@not@wedge{wiT}{east}{1}{-1}{-90}
+ \pgf@circ@muxdemux@not@wedge{woT}{west}{-1}{-1}{-90}
+ % put the clock wedge if needed
+ \pgf@circ@muxdemux@clockwedge{cT}{-90}
+ \ifcase\quadrant % rotation 0; top label are at the top
+ \pgf@circ@muxdemux@label@xy{T}{0}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{TL}{0}{-1}{1}{bottom}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{TR}{0}{1}{1}{bottom}{rlap}{outer}%
+ \or %rotation -90; top labels are at the right
+ \pgf@circ@muxdemux@label@xy{T}{90}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{TL}{90}{1}{1}{bottom}{rlap}{outer}%
+ \pgf@circ@muxdemux@label@xy{TR}{90}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation 180; top labels are at the bottom
+ \pgf@circ@muxdemux@label@xy{T}{180}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{TL}{180}{-1}{-1}{top}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{TR}{180}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation +90; top labels are at the left
+ \pgf@circ@muxdemux@label@xy{T}{-90}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf@circ@res@temp=0pt
+ \pgf@circ@muxdemux@label@xy{TL}{-90}{-1}{1}{bottom}{llap}{outer}%
+ \pgf@circ@muxdemux@label@xy{TR}{-90}{-1}{-1}{top}{llap}{outer}%
+ \fi
+ \endpgfscope
+ \advance\pgf@circ@count@a by -1\relax%
+ \repeatpgfmathloop
+ \fi
}
% let's start adding anchors
\pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex
index 819da5a110..6634531c2c 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircvoltage.tex
@@ -191,6 +191,13 @@
\def\pgf@circ@bipole@voltage@label@anchor{center}
\pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
\fi
+ % apply the same shift to open "straight" voltage as raised
+ \ifpgf@circuit@bipole@voltage@straight
+ \ifx\@@kind\@@open
+ \def\pgf@circ@bipole@voltage@label@anchor{center}
+ \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
+ \fi
+ \fi
}
% %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
%absolute move, minimum space is length of arrowhead
@@ -359,6 +366,8 @@
% %>>>
%% Output routine for voltage sources%<<<
+% (ugly) workaround for https://github.com/circuitikz/circuitikz/issues/747
+\ctikzset{voltage shift sources adjust/.initial=0.5} % coefficient added "by feel". Sorry.
\def\pgf@circ@drawvoltagegenerator{
% the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
% it's not perfect, but I can't find the way to do it correctly...
@@ -382,7 +391,7 @@
{
\edef\addvshift{0}
}
- \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
+ \pgfmathsetmacro{\bumpaplus}{\bumpa + \ctikzvalof{voltage shift sources adjust}*\shiftv}
}
\ifpgf@circuit@bipole@voltage@below
coordinate (pgfcirc@Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
diff --git a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex
index e76a91d957..8cc8b39131 100644
--- a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex
@@ -16,8 +16,8 @@
\startmodule[circuitikz]
\usemodule[tikz]
-\def\pgfcircversion{1.6.4}
-\def\pgfcircversiondate{2023/10/10}
+\def\pgfcircversion{1.6.5}
+\def\pgfcircversiondate{2023/10/29}
\writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}