texlive[68706] Master/texmf-dist: circuitikz (30oct23)
commits+karl at tug.org
commits+karl at tug.org
Mon Oct 30 20:35:37 CET 2023
Revision: 68706
https://tug.org/svn/texlive?view=revision&revision=68706
Author: karl
Date: 2023-10-30 20:35:37 +0100 (Mon, 30 Oct 2023)
Log Message:
-----------
circuitikz (30oct23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf
trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md
trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex
trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf
trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex
trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex
trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty
Modified: trunk/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md 2023-10-30 19:35:21 UTC (rev 68705)
+++ trunk/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md 2023-10-30 19:35:37 UTC (rev 68706)
@@ -1,6 +1,17 @@
<!--- CircuiTikz - Changelog --->
The major changes among the different CircuiTikZ versions are listed here. See <https://github.com/circuitikz/circuitikz/commits> for a full list of changes.
+* Version 1.6.5 (2023-10-29)
+
+ This version features an important overhaul of the `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.
+
+ - Added optional and configurable inner, outer and border labels to the `muxdemux` shapes
+ - Added optional clock wedge and negation signs to the pins of `muxdemux` shapes
+ - Added the possibility to add a background drawing to `muxdemux` shapes
+ - Fixed a [bug](https://github.com/circuitikz/circuitikz/issues/748) with `straightvoltages` and `open`
+ - Added an (ugly) workaround for a [voltage shift mismatch](https://github.com/circuitikz/circuitikz/issues/747) for sources
+
* Version 1.6.4 (2023-10-10)
A bit of enhancement and fixes for the European-style logic ports, more switches (and a bit more configurabilityi for them), more option for some sources.
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex 2023-10-30 19:35:21 UTC (rev 68705)
+++ trunk/Master/texmf-dist/doc/latex/circuitikz/changelog.tex 2023-10-30 19:35:37 UTC (rev 68706)
@@ -5,6 +5,34 @@
\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 @@
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 @@
\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
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex 2023-10-30 19:35:21 UTC (rev 68705)
+++ trunk/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex 2023-10-30 19:35:37 UTC (rev 68706)
@@ -7281,12 +7281,134 @@
\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}
-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.
+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}
+
+\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.
\begin{LTXexample}[varwidth=true]
@@ -7310,6 +7432,52 @@
\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 @@
\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,13 +7526,33 @@
\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}
\texttt{CircuiTikZ} supports two types of variable-pin chips: DIP (Dual-in-Line Package) and QFP (Quad-Flat Package).
@@ -7471,7 +7657,7 @@
\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 @@
\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 @@
\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]
Modified: trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex 2023-10-30 19:35:21 UTC (rev 68705)
+++ trunk/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex 2023-10-30 19:35:37 UTC (rev 68706)
@@ -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}
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex 2023-10-30 19:35:21 UTC (rev 68705)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex 2023-10-30 19:35:37 UTC (rev 68706)
@@ -509,9 +509,10 @@
\long\def\pgf at circ@font at tenbm{\normal\bold}%
\long\def\pgf at circ@font at twelve{\tfa} %
\fi\fi\fi
-
-
+% noop
+\def\pgfcirc at nop#1{#1}% no operation, just strip {}
%
+%
% Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
%
% this is needed to avoid problems with \ConTeXt
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex 2023-10-30 19:35:21 UTC (rev 68705)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex 2023-10-30 19:35:37 UTC (rev 68706)
@@ -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 at circ@font at tiny}
+\ctikzset{muxdemux/outer label font/.initial=\pgf at circ@font at tiny}
+\ctikzset{muxdemux/border label font/.initial=\pgf at circ@font at 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 at protected\def\pgf at circ@make at muxdemux@L at anchor#1%
@@ -1705,8 +1738,92 @@
\expandafter\gdef\csname pgf at anchor@muxdemux at btpin #1\endcsname
{\pgf at circ@muxdemux at T@anchor{#1}{0}}%
}
-
-
+%% put some label somewhere
+\def\pgf at circ@muxdemux at 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 at circ@count at a unless it's zero, in which case omit it
+ \ifnum\pgf at circ@count at a=0
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1}
+ \else
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf at circ@count at a}
+ \fi
+ \pgfkeysifdefined{\@@thislabel}{%
+ \pgfscope
+ \pgftransformrotate{#2}
+ \pgfmathsetlength\pgf at circ@res at zero{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label xsep}}
+ \pgfmathsetlength\pgf at circ@res at 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 at circ@res at zero+\pgf at circ@res at temp)}
+ \pgftransformyshift{(#4)*(\pgf at circ@res at other+\pgf at circ@res at 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 at circ@muxdemux at clockwedge#1#2{%
+ % #1: which label: cL,cR,cT,cB
+ % #2: rotation
+ % uses external variables \pgf at circ@count at a
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf at circ@count at a}
+ \pgfkeysifdefined{\@@thislabel}{%
+ \edef\value{\pgfkeysvalueof{\@@thislabel}}
+ \ifnum\value=0
+ \pgf at circ@res at temp=0pt
+ \else\pgfscope
+ \pgftransformrotate{#2}
+ \pgfpathmoveto{\pgfpoint{+0pt}{-\clockwedge}}
+ \pgfpathlineto{\pgfpoint{\clockwedge}{+0pt}}
+ \pgfpathlineto{\pgfpoint{+0pt}{\clockwedge}}
+ \pgfusepath{draw}
+ \endpgfscope
+ \pgf at circ@res at temp=\clockwedge
+ \fi
+ }{}
+}
+%% put a negation here
+\def\pgf at circ@muxdemux at not@ball#1#2{%
+ % #1: which label: nL,nR,nT,nB
+ % #2: anchor
+ % uses external variables \pgf at circ@count at a
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf at circ@count at a}
+ \pgfkeysifdefined{\@@thislabel}{%
+ \edef\value{\pgfkeysvalueof{\@@thislabel}}
+ \ifnum\value=0
+ \else
+ \pgfnode{\@@notcirc}{#2}{}{\thisshape-#1\the\pgf at circ@count at a}{\pgfusepath{stroke}}
+ \fi
+ }{}
+}
+%% put a negation wedge here
+\def\pgf at circ@muxdemux at 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 at circ@count at a
+ \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf at circ@count at 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 at circ@count at a}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ }{}
+}
+%
\pgfdeclareshape{muxdemux}{
\savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf at x}{\ctikzvalof{\ctikzclass/scale}\pgf at circ@Rlen}}
@@ -1849,6 +1966,18 @@
\pgf at circ@res at step = \pgf at x
\pgf at circ@res at temp = \pgf at y
%
+ % draw the (user-selectable) background
+ %
+ \pgfscope
+ \pgfmathsetmacro{\@@scalex}{\pgf at circ@res at right/1cm}
+ % It's better not to change the scale in an asymmetric way
+ % \pgfmathsetmacro{\@@scaley}{\pgf at circ@res at up/1cm}
+ \pgftransformxscale{\@@scalex}
+ \pgftransformyscale{\@@scalex}
+ \pgf at circ@setlinewidth{multipoles}{\pgfstartlinewidth}
+ \pgfkeys{\circuitikzbasekey/multipoles/muxdemux/bgpicture}
+ \endpgfscope
+ %
% external block
%
\pgfscope% (for the line width)
@@ -1866,7 +1995,7 @@
\pgfpathlineto{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at temp}}
\fi
\pgfpathclose
- \pgf at circ@draworfill
+ \pgf at circ@draworfill
\endpgfscope
% now we have to draw the pins, if needed
\ifdim\extshift>0pt\ifpgfcirc at draw@input at 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 at circuit@chip at 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 at circ@res at temp}{\ctikzvalof{muxdemux/clock wedge size}*\ctikzvalof{multipoles/muxdemux/base len}*\scaledRlen}
+ \edef\clockwedge{\the\pgf at circ@res at temp}
+ % select which negation ball to use
+ \ifpgf at circuit@ieeelogicport
+ \def\@@notcirc{circleinv}
+ \else
+ \ifpgf at circ@european at port@circle at ieee
+ \def\@@notcirc{circleinv}
+ \else
+ \def\@@notcirc{ocirc}
+ \fi
+ \fi
+ %% border labels
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@count at a=0
+ % go to north
+ \topleft\pgf at circ@res at left=\pgf at x \pgf at circ@res at up=\pgf at y
+ \pgfscope
+ \pgftransformshift{\pgfpoint{0pt}{\pgf at circ@res at up}}
+ \ifnum\quadrant=2
+ \pgf at circ@muxdemux at label@xy{N}{180}{0}{-1}{top}{pgfcirc at nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@muxdemux at label@xy{Ni}{180}{0}{1}{bottom}{pgfcirc at nop}{border}%
+ \else
+ \pgf at circ@muxdemux at label@xy{N}{0}{0}{1}{bottom}{pgfcirc at nop}{border}%
+ \pgf at circ@muxdemux at label@xy{Ni}{0}{0}{-1}{top}{pgfcirc at nop}{border}%
+ \fi
+ \endpgfscope
+ % go south!
+ \pgfscope
+ \pgftransformshift{\pgfpoint{0pt}{-\pgf at circ@res at up}}
+ \ifnum\quadrant=2
+ \pgf at circ@muxdemux at label@xy{S}{180}{0}{1}{bottom}{pgfcirc at nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@muxdemux at label@xy{Si}{180}{0}{-1}{top}{pgfcirc at nop}{border}%
+ \else
+ \pgf at circ@muxdemux at label@xy{S}{0}{0}{-1}{top}{pgfcirc at nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@muxdemux at label@xy{Si}{0}{0}{1}{bottom}{pgfcirc at nop}{border}%
+ \fi
+ \endpgfscope
+ % go west!
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{0pt}}
+ \ifnum\quadrant=3
+ \pgf at circ@muxdemux at label@xy{W}{-90}{0}{-1}{top}{pgfcirc at nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@muxdemux at label@xy{Wi}{-90}{0}{1}{bottom}{pgfcirc at nop}{border}%
+ \else
+ \pgf at circ@muxdemux at label@xy{W}{90}{0}{1}{bottom}{pgfcirc at nop}{border}%
+ \pgf at circ@muxdemux at label@xy{Wi}{90}{0}{-1}{top}{pgfcirc at nop}{border}%
+ \fi
+ \endpgfscope
+ % go east!
+ \pgfscope
+ \pgftransformshift{\pgfpoint{-\pgf at circ@res at left}{0pt}}
+ \ifnum\quadrant=3
+ \pgf at circ@muxdemux at label@xy{E}{-90}{0}{1}{bottom}{pgfcirc at nop}{border}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@muxdemux at label@xy{Ei}{-90}{0}{-1}{top}{pgfcirc at nop}{border}%
+ \else
+ \pgf at circ@muxdemux at label@xy{E}{90}{0}{-1}{top}{pgfcirc at nop}{border}%
+ \pgf at circ@muxdemux at label@xy{Ei}{90}{0}{1}{bottom}{pgfcirc at 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 at circ@count at a=\NL\relax
+ \pgf at circ@count at b=\NL \divide\pgf at circ@count at b by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate
+ \topleft\pgf at circ@res at left=\pgf at x \pgf at circ@res at up=\pgf at y
+ \insetnortheast\pgf at circ@res at right=\pgf at x \pgf at circ@res at down=\pgf at y
+ \ifdim\pgf at circ@res at 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 at circ@res at step}{2*(\pgf at circ@res at up-\pgf at circ@res at down)/(\NL)}
+ \else
+ \pgfmathsetlength{\pgf at circ@res at step}{2*(\pgf at circ@res at up-\pgf at circ@res at down)/(\NL-1)}
+ \fi
+ \else
+ \pgfmathsetlength{\pgf at circ@res at step}{2*(\pgf at circ@res at up-\pgf at circ@res at down)/\NL}
+ \fi
+ \else % no inset
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at up/\NL}
+ \fi
+ \pgfmathloop%
+ \ifnum\pgf at circ@count at a>0
+ \pgfscope
+ \ifdim\pgf at circ@res at down>0pt % check if we have an inset
+ \ifnum\pgf at circ@count at a>\pgf at circ@count at b\relax
+ % for lower pins we have to shift them down
+ \ifodd\NL
+ % odd number of pins
+ \ifnum\pgf at circ@count at a=\numexpr\the\pgf at circ@count at b+1\relax
+ % centerpin!
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{0pt}}
+ \else
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a+1)*\pgf at circ@res at step-2*\pgf at circ@res at down}}
+ \fi
+ \else
+ % even numer of pins: just go down
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step-2*\pgf at circ@res at down}}
+ \fi
+ \else
+ % nothing need for #1<=NL/2
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \fi
+ \else
+ % no inset
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step}}
+ \fi
+ % put the not ball/wedges if needed
+ \pgf at circ@muxdemux at not@ball{nL}{east}
+ \pgf at circ@muxdemux at not@wedge{wiL}{east}{1}{1}{0}
+ \pgf at circ@muxdemux at not@wedge{woL}{west}{-1}{1}{0}
+ % \fi
+ \pgf at circ@muxdemux at clockwedge{cL}{0}
+ %% put the labels
+ \ifcase\quadrant % rotation 0; left label are at the left
+ \pgf at circ@muxdemux at label@xy{L}{0}{1}{0}{left}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{LU}{0}{-1}{1}{bottom}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{LD}{0}{-1}{-1}{top}{llap}{outer}%
+ \or %rotation -90; left labels are at the top
+ \pgf at circ@muxdemux at label@xy{L}{90}{0}{-1}{top}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{LU}{90}{-1}{1}{bottom}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{LD}{90}{1}{1}{bottom}{rlap}{outer}%
+ \or %rotation 180; left labels are at the right
+ \pgf at circ@muxdemux at label@xy{L}{180}{-1}{0}{right}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{LU}{180}{1}{1}{bottom}{rlap}{outer}%
+ \pgf at circ@muxdemux at label@xy{LD}{180}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation +90; left labels are at the bottom
+ \pgf at circ@muxdemux at label@xy{L}{-90}{0}{1}{bottom}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{LU}{-90}{-1}{-1}{top}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{LD}{-90}{1}{-1}{top}{rlap}{outer}%
+ \fi
+ \endpgfscope
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop
+ \fi
+ %% right pins
+ \ifnum\NR>0\pgf at circ@count at a=\NR\relax
+ \pgfmathloop%
+ \topright\pgf at circ@res at right=\pgf at x \pgf at circ@res at up=\pgf at y
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at up/\NR}
+ \ifnum\pgf at circ@count at a>0
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at right}{\pgf at circ@res at up+(0.5-\pgf at circ@count at a)*\pgf at circ@res at step}}
+ % put the not ball/wedge if needed
+ \pgf at circ@muxdemux at not@ball{nR}{west}
+ \pgf at circ@muxdemux at not@wedge{wiR}{east}{-1}{1}{0}
+ \pgf at circ@muxdemux at not@wedge{woR}{west}{1}{1}{0}
+ % put the clock wedge if needed
+ \pgf at circ@muxdemux at clockwedge{cR}{180}
+ \ifcase\quadrant % rotation 0; right label are at the right
+ \pgf at circ@muxdemux at label@xy{R}{0}{-1}{0}{right}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{RU}{0}{1}{1}{bottom}{rlap}{outer}%
+ \pgf at circ@muxdemux at label@xy{RD}{0}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation -90; right labels are at the bottom
+ \pgf at circ@muxdemux at label@xy{R}{90}{0}{1}{bottom}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{RU}{90}{-1}{-1}{top}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{RD}{90}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation 180; right labels are at the left
+ \pgf at circ@muxdemux at label@xy{R}{180}{1}{0}{left}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{RU}{180}{-1}{1}{bottom}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{RD}{180}{-1}{-1}{top}{llap}{outer}%
+ \or %rotation +90; right labels are at the top
+ \pgf at circ@muxdemux at label@xy{R}{-90}{0}{-1}{top}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{RU}{-90}{-1}{1}{bottom}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{RD}{-90}{1}{1}{bottom}{rlap}{outer}%
+ \fi
+ \endpgfscope
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop
+ \fi
+ %% bottom pins
+ \ifnum\NB>0\pgf at circ@count at a=\NB\relax %%%
+ \pgfmathloop%
+ \topleft\pgf at circ@res at left=\pgf at x \pgf at circ@res at up=\pgf at y
+ \topright\pgf at circ@res at right=\pgf at x \pgf at circ@res at down=\pgf at y
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at right/\NB}
+ \pgfmathsetlength{\pgf at circ@res at other}{(\pgf at circ@res at down-\pgf at circ@res at up)/(\pgf at circ@res at right-\pgf at circ@res at left)*\pgf at circ@res at step}
+ \ifnum\pgf at circ@count at a>0
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left+(\pgf at circ@count at a-0.5)*\pgf at circ@res at step}
+ {-\pgf at circ@res at down+(\NB-\pgf at circ@count at a+0.5)*\pgf at circ@res at other}}
+ % put the not ball/wedge if needed
+ \pgf at circ@muxdemux at not@ball{nB}{north}
+ \pgf at circ@muxdemux at not@wedge{wiB}{east}{1}{1}{90}
+ \pgf at circ@muxdemux at not@wedge{woB}{west}{-1}{1}{90}
+ % put the clock wedge if needed
+ \pgf at circ@muxdemux at clockwedge{cB}{90}
+ \ifcase\quadrant % rotation 0; bottom label are at the bottom
+ \pgf at circ@muxdemux at label@xy{B}{0}{0}{1}{bottom}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{BL}{0}{-1}{-1}{top}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{BR}{0}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation -90; bottom labels are at the left
+ \pgf at circ@muxdemux at label@xy{B}{90}{1}{0}{left}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{BL}{90}{-1}{1}{bottom}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{BR}{90}{-1}{-1}{top}{llap}{outer}%
+ \or %rotation 180; bottom labels are at the top
+ \pgf at circ@muxdemux at label@xy{B}{180}{0}{-1}{top}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{BL}{180}{-1}{1}{bottom}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{BR}{180}{1}{1}{bottom}{rlap}{outer}%
+ \or %rotation +90; bottom labels are at the right
+ \pgf at circ@muxdemux at label@xy{B}{-90}{-1}{0}{right}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{BL}{-90}{1}{1}{bottom}{rlap}{outer}%
+ \pgf at circ@muxdemux at label@xy{BR}{-90}{1}{-1}{top}{rlap}{outer}%
+ \fi
+ \endpgfscope
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop
+ \fi
+ %% top pins
+ \ifnum\NT>0\pgf at circ@count at a=\NT\relax
+ \pgfmathloop%
+ \topleft\pgf at circ@res at left=\pgf at x \pgf at circ@res at up=\pgf at y
+ \topright\pgf at circ@res at right=\pgf at x \pgf at circ@res at down=\pgf at y
+ \pgfmathsetlength{\pgf at circ@res at step}{2*\pgf at circ@res at right/\NT}
+ \pgfmathsetlength{\pgf at circ@res at other}{(\pgf at circ@res at down-\pgf at circ@res at up)/(\pgf at circ@res at right-\pgf at circ@res at left)*\pgf at circ@res at step}
+ \ifnum\pgf at circ@count at a>0
+ \pgfscope
+ \pgftransformshift{\pgfpoint{\pgf at circ@res at left+(\pgf at circ@count at a-0.5)*\pgf at circ@res at step}
+ {\pgf at circ@res at down-(\NT-\pgf at circ@count at a+0.5)*\pgf at circ@res at other}}
+ % put the not ball/wedge if needed
+ \pgf at circ@muxdemux at not@ball{nT}{south}
+ \pgf at circ@muxdemux at not@wedge{wiT}{east}{1}{-1}{-90}
+ \pgf at circ@muxdemux at not@wedge{woT}{west}{-1}{-1}{-90}
+ % put the clock wedge if needed
+ \pgf at circ@muxdemux at clockwedge{cT}{-90}
+ \ifcase\quadrant % rotation 0; top label are at the top
+ \pgf at circ@muxdemux at label@xy{T}{0}{0}{-1}{top}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{TL}{0}{-1}{1}{bottom}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{TR}{0}{1}{1}{bottom}{rlap}{outer}%
+ \or %rotation -90; top labels are at the right
+ \pgf at circ@muxdemux at label@xy{T}{90}{-1}{0}{right}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{TL}{90}{1}{1}{bottom}{rlap}{outer}%
+ \pgf at circ@muxdemux at label@xy{TR}{90}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation 180; top labels are at the bottom
+ \pgf at circ@muxdemux at label@xy{T}{180}{0}{1}{bottom}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{TL}{180}{-1}{-1}{top}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{TR}{180}{1}{-1}{top}{rlap}{outer}%
+ \or %rotation +90; top labels are at the left
+ \pgf at circ@muxdemux at label@xy{T}{-90}{1}{0}{left}{pgfcirc at nop}{inner}% type, rot, pad x, pad y, text pos, op, type
+ \pgf at circ@res at temp=0pt
+ \pgf at circ@muxdemux at label@xy{TL}{-90}{-1}{1}{bottom}{llap}{outer}%
+ \pgf at circ@muxdemux at label@xy{TR}{-90}{-1}{-1}{top}{llap}{outer}%
+ \fi
+ \endpgfscope
+ \advance\pgf at circ@count at a by -1\relax%
+ \repeatpgfmathloop
+ \fi
}
% let's start adding anchors
\pgfutil at g@addto at macro\pgf at sh@s at muxdemux{%
Modified: trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex 2023-10-30 19:35:21 UTC (rev 68705)
+++ trunk/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex 2023-10-30 19:35:37 UTC (rev 68706)
@@ -191,6 +191,13 @@
\def\pgf at circ@bipole at voltage@label at 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 at circuit@bipole at voltage@straight
+ \ifx\@@kind\@@open
+ \def\pgf at circ@bipole at voltage@label at anchor{center}
+ \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
+ \fi
+ \fi
}
% %\pgf at circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
%absolute move, minimum space is length of arrowhead
@@ -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 at 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 at circuit@bipole at voltage@below
coordinate (pgfcirc at Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
Modified: trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty 2023-10-30 19:35:21 UTC (rev 68705)
+++ trunk/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty 2023-10-30 19:35:37 UTC (rev 68706)
@@ -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}
More information about the tex-live-commits
mailing list.