From 3cbe503dbda14b8212adf6cad6bfb8fd7882f427 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 23 Jan 2020 21:55:34 +0000 Subject: circuitikz (23jan20) git-svn-id: svn://tug.org/texlive/trunk@53515 c570f23f-e606-0410-a88d-b1316a301751 --- .../third/circuitikz/circuitikz-context.pdf | Bin 17620 -> 17619 bytes .../texmf-dist/doc/generic/circuitikz/CHANGELOG.md | 10 + .../texmf-dist/doc/latex/circuitikz/changelog.tex | 21 + .../doc/latex/circuitikz/circuitikzmanual.pdf | Bin 845023 -> 877095 bytes .../doc/latex/circuitikz/circuitikzmanual.tex | 297 ++++++++++++- .../doc/latex/circuitikz/ctikzmanutils.sty | 7 +- .../tex/context/third/circuitikz/t-circuitikz.tex | 4 +- .../tex/generic/circuitikz/ctikzstyle-legacy.tex | 1 + .../tex/generic/circuitikz/ctikzstyle-romano.tex | 3 +- .../tex/generic/circuitikz/pgfcirc.defines.tex | 45 ++ .../tex/generic/circuitikz/pgfcircbipoles.tex | 63 ++- .../tex/generic/circuitikz/pgfcirclabel.tex | 8 +- .../tex/generic/circuitikz/pgfcircmultipoles.tex | 489 ++++++++++++++++++++- .../tex/generic/circuitikz/pgfcircpath.tex | 8 +- .../tex/generic/circuitikz/pgfcirctripoles.tex | 307 ++++++++----- .../texmf-dist/tex/latex/circuitikz/circuitikz.sty | 4 +- 16 files changed, 1131 insertions(+), 136 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf b/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf index 34f8ec98c01..1861747f2bf 100644 Binary files a/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf and b/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf differ diff --git a/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md b/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md index 5fb324319d4..b913ffc33a4 100644 --- a/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md +++ b/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md @@ -1,6 +1,16 @@ The major changes among the different circuitikz versions are listed here. See for a full list of changes. +* Version 1.0.0-pre2 (2020-01-23) + + **Really** last additions toward the 1.0.0 version. The most important change is the addition of multiplexer and de-multiplexers; also added the multi-wires (bus) markers. + + - Added mux-demux shapes + - Added the possibility to suppress the input leads in logic gates + - Added multiple wires markers + - Added a style to switch off the automatic rotation of instruments + - Changed the shape of the or-type american logic ports (reversible with a flag) + * Version 1.0.0-pre1 (2019-12-22) Last additions before the long promised 1.0! In this pre-release we feature a flip-flop library, a revamped configurability of amplifiers (and a new amplifier as a bonus) and some bug fix around the clock. diff --git a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex index a64775720a1..9a745ee128c 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex @@ -4,6 +4,27 @@ here. See \url{https://github.com/circuitikz/circuitikz/commits} for a full list of changes. \begin{itemize} +\item + Version 1.0.0-pre2 (2020-01-23) + + \textbf{Really} last additions toward the 1.0.0 version. The most + important change is the addition of multiplexer and de-multiplexers; + also added the multi-wires (bus) markers. + + \begin{itemize} + \tightlist + \item + Added mux-demux shapes + \item + Added the possibility to suppress the input leads in logic gates + \item + Added multiple wires markers + \item + Added a style to switch off the automatic rotation of instruments + \item + Changed the shape of the or-type american logic ports (reversible + with a flag) + \end{itemize} \item Version 1.0.0-pre1 (2019-12-22) diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf index 1d2dc85a794..c0fc6167d88 100644 Binary files a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf and b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf differ diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex index af05238cc1c..b0a108d60c1 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex @@ -1704,6 +1704,26 @@ The \texttt{oscope} element will not rotate the ``graph'' shown with the compone The \texttt{rmeter}, \texttt{rmaterwa}, and \texttt{smeter} have the same behavior. +However, if you prefer that the \texttt{oscope}, \texttt{rmeter}, \texttt{smeter} and \texttt{rmeterwa} instruments rotate the text or the diagram, +you can use the key or style \texttt{rotated instruments} (the default style is \texttt{straight instruments}). + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] + \begin{circuitikz}[scale=0.8, transform shape] + \ctikzset{rotated instruments} % new default + \draw (0,0) to[oscope] ++(0:3); + \draw (0,0) to[oscope] ++(60:3); + \draw (0,0) to[rmeter, t=A] ++(120:3); + % local override + \draw (0,0) to[rmeterwa, t=A, straight instruments] ++(180:3); + \ctikzset{straight instruments} % back to default + \draw (0,0) to[rmeterwa, t=A] ++(240:3); + % local override + \draw (0,0) to[smeter, t=A, rotated instruments] ++(300:3); +\end{circuitikz} +\end{LTXexample} + + + \subsubsection{Instruments as node elements} The node-style usage of the \texttt{oscope} is also interesting, using the additional \texttt{in 1} and \texttt{in 2} anchors; notice that in this case you can use the text content of the node to put labels above it. @@ -1915,6 +1935,24 @@ You can use microphones and loudspeakers with \texttt{waves} (see section~\ref{s You can change the scale of all the miscellaneous elements by setting the key \texttt{misc/scale} to something different from the default \texttt{1.0}. +\subsection{Multiple wires (buses)} + +This are simple drawings to indicate multiple wires. +\begin{groupdesc} +\circuitdescbip{multiwire}{Single line multiple wires}{multiwire} +\circuitdescbip{bmultiwire}{Double line multiple wires}{bmultiwire} +\end{groupdesc} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[multiwire=4] ++(1,0); + \draw (0,-2) to[bmultiwire=6] ++(1,0); +\end{circuitikz} +\end{LTXexample} + + + + \subsection{Crossings} Path style: @@ -3211,7 +3249,7 @@ All these amplifier have the possibility to flip input and output (if needed) po When you use the \texttt{noinv input/output ...} keys the anchors (\texttt{+}, \texttt{-}, \texttt{out +}, \texttt{out -}) will change with the effective position of the terminals. You have also the anchors \texttt{in up}, \texttt{in down}, \texttt{out up}, \texttt{out down} that will not change with the positive or negative sign. -You can change the symbols ``$+$'' or ``$-$'' appearing in the amplifiers if you want, both globally and on component-by-component basis. The plus and minus symbols can be changed with \verb|\ctikzset| of the keys \texttt{amplifiers/plus} and +\texttt{amplifiers/minus} (which defaults to the math mode plus or minus cited before), or using the styles \texttt{amp plus} and \texttt{amp minus}. +You can change the symbols ``$+$'' or ``$-$'' appearing in the amplifiers if you want, both globally and on component-by-component basis. The plus and minus symbols can be changed with \verb|\ctikzset| of the keys \texttt{amplifiers/plus} and \texttt{amplifiers/minus} (which defaults to the math mode plus or minus cited before), or using the styles \texttt{amp plus} and \texttt{amp minus}. The font used is set in several keys, but you can change it globally with \verb|\tikzset{amp symbol font}|, which has a default of 10-point (in \LaTeX, and the corresponding one in \ConTeXt). You can change it for example with \begin{lstlisting} @@ -3346,6 +3384,23 @@ But notice that the ``A'' is also flipped by the \texttt{xscale} parameter. So t \end{LTXexample} +\subsubsection{Designing your own amplifier} + +If you need a different kind of amplifier, you can use the \texttt{muxdemux} +(see section~\ref{sec:muxdemuxes}) shape for defining one that suits your needs (you need version \texttt{1.0.0} for this to work). + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\tikzset{tdax/.style={muxdemux, + muxdemux def={NL=2, Lh=3, NR=1, Rh=0, + NB=4, NT=5}, font=\scriptsize\ttfamily}} +\begin{circuitikz} + \draw (0,0) node[tdax](A){TDA1}; + \draw (2.5,0) node[tdax, + muxdemux def={Rh=0.5}]{TDA2}; +\end{circuitikz} +\end{LTXexample} + + \subsection{Switches and buttons} Switches and button come in to-style (the simple ones and the pushbuttons), and as nodes. @@ -3667,9 +3722,35 @@ There is no ``european'' version of these symbols. \subsubsection{Logic port customization} +Since version \texttt{1.0.0}, the default shape of the family of american ``or'' ports has changed to a more ``pointy'' one, for better distinguish them from the ``and''-type ports. You can still going back to the previous aspect with the key \texttt{american or shape} that can be set to \texttt{pointy} or \texttt{roundy}. The \texttt{legacy} style will enact the old, roundy style also. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[ + american] + % legacy shapes + \ctikzset{american or shape=roundy} + \ctikzset{logic ports/fill=yellow} + \node [or port](O1) at (0,0) {}; + \node [nor port](O2) at (0,-1.5) {}; + \node [xor port](O3) at (0,-3) {}; + \node [xnor port](O4) at (0,-4.5) {}; + \begin{scope}[xshift=3cm] + % new shapes + \ctikzset{american or shape=pointy} + \node [or port](O1) at (0,0) {}; + \node [nor port](O2) at (0,-1.5) {}; + \node [xor port](O3) at (0,-3) {}; + \node [xnor port](O4) at (0,-4.5) {}; + \end{scope} +\end{circuitikz} +\end{LTXexample} + + Logic port class is called \texttt{logic ports}, so you can scale them all with \texttt{logic ports/scale} (default \texttt{1.0}). -As for most components, you can change the width and height of the ports; the thickness is given by the parameter \texttt{tripoles/thickness} (default 2): +As for most components, you can change the width and height of the ports; the thickness is given by the parameter \texttt{tripoles/thickness} (default 2). + +It is possible to change height and width of the logic ports using the parameters \texttt{tripoles/american \emph{type} port/} plus \texttt{width} or \texttt{height}: \begin{LTXexample}[varwidth=true] \tikz \draw (0,0) node[nand port] {}; \par @@ -3679,6 +3760,7 @@ As for most components, you can change the width and height of the ports; the th \tikz \draw (0,0) node[nand port] {}; \end{LTXexample} + This is especially useful if you have ports with more than two inputs, which are instantiated with the parameter \texttt{number inputs} : @@ -3697,6 +3779,35 @@ with the parameter \texttt{number inputs} : \end{circuitikz} \end{LTXexample} +You can suppress the drawing of the logic ports input leads by using the boolean key \texttt{logic ports draw input leads} (default \texttt{true}) or, locally, with the style \texttt{no inputs leads} (that can be reverted with \texttt{input leads}), like in the following example. The anchors do not change and you have to take responsibility do do the connection to the ``border''-anchors. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \node [or port](O1) at (0,2) {}; + \node [or port, no input leads](O1) at (2,2) {}; + \ctikzset{logic ports draw input leads=false} + \node [and port](O1) at (0,0) {}; + \node [nand port, input leads](O1) at (2,0) {}; +\end{circuitikz} +\end{LTXexample} + +This is useful if you need to draw a generic port, like the one following here: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \ctikzset{tripoles/american nand port/height=1.6} + \draw (0,0) + node[american nand port, + circuitikz/tripoles/american nand port/height=1.1, + number inputs=5, no input leads, + ] (B) {Pn}; + \draw (B.in 1) -- (B.bin 1) (B.in 5) -- (B.bin 5); + \node[rotate=90] at (B.in 3) {\dots}; +\end{circuitikz} +\end{LTXexample} + +The flag works also for the european-style ports, and it suppress only the input leads because the negated ports in european style are ill-specified if you do not draw the output leads (and moreover, it seems really less useful). + You can tweak the appearance of american ``or'' family (\texttt{or}, \texttt{nor}, \texttt{xor} and \texttt{xnor}) ports, too, with the parameters \texttt{inner} (how much the base circle go ``into'' the shape, default 0.3) and \texttt{angle} (the angle at which the base starts, default 70). \begin{LTXexample}[varwidth=true] @@ -3807,7 +3918,7 @@ In the case of \textsc{not}, there are only \texttt{in} and \texttt{out} (althou \subsection{Flip-flops}\label{sec:flipflops} -Flip-flops are an hybrid between the logic ports and the chips. They have a class by themselves (\texttt{flipflops}) but the default parameters are set at the same values as the logic gates one. +Flip-flops (available since version \texttt{1.0.0}) are an hybrid between the logic ports and the chips. They have a class by themselves (\texttt{flipflops}) but the default parameters are set at the same values as the logic gates one. The default flip flop is empty: it is just a rectangular box like a blank \texttt{dipchip} with 6 pins. \begin{groupdesc} @@ -3894,7 +4005,7 @@ If you like different pin distributions, you can easily define different flip-fl \end{groupdesc} \endgroup -The standard definition of the default flip-flops are the following (you can find them in the file \texttt{pgfcircmultipoles.tex}): +The standard definition of the default flip-flops are the following (in the file \texttt{pgfcircmultipoles.tex}): \begin{lstlisting}[basicstyle=\small\ttfamily] \tikzset{ @@ -3970,6 +4081,184 @@ Normally the symbols on the flip-flop are un-rotated when you rotate the symbol, \end{tikzpicture} \end{LTXexample} +\subsection{Multiplexer and de-multiplexer}\label{sec:muxdemuxes} + +The shape used for muxes and de-muxes is probably the most configurable shape of the package; it has been added by Romano in \texttt{v1.0.0}. The basic shape is a multiplexer with 8 input pin, one output pin, and three control pins ($2^3\to1$ multiplexer). The pins are not named as input or output pins (see below for a full description for anchors) for reasons that will be clear later. + +\begin{groupdesc} + \circuitdesc*[0.7]{muxdemux}{mux-demux}{MD1}(lpin 1/180/0.2, lpin 2/180/0.2, bpin 1/-90/0.2, blpin 1/0/0.2, blpin 2/0/0.2, bbpin 1/90/0.2, rpin 1/0/0.1, brpin 1/-110/0.1) +\end{groupdesc} + +You can define a custom shape for the \texttt{muxdemux}es using an interface similar to the one used in flip-flops; for example: + +\begin{lstlisting} +\tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}} +\end{lstlisting} + +will generate the following shape (the definition above is already defined in the package): + +\begin{groupdesc} + \circuitdesc*[0.7]{demux}{Demultiplexer $1\to2^3$ with \texttt{Lh=4, Rh=8, NL=1, NB=3, NR=8} }{MD2} +\end{groupdesc} + +The shape can be also defined with an inset. For example it can be used like this to define a 1-bit adder (also already available): + +\begin{lstlisting} +\tikzset{one bit adder/.style={muxdemux, + muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5, + inset w=0.5, inset Lh=2, inset Rh=1.5}}} +\end{lstlisting} +\begin{groupdesc} + \circuitdesc*{one bit adder}{One-bit adder}{\Large$\oplus$} +\end{groupdesc} + +Or a Arithmetic Logic Unit (again, already defined by default): + +\begin{lstlisting} +\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}}} +\end{lstlisting} +\begin{groupdesc} + \circuitdesc*{ALU}{ALU}{\rotatebox{90}{\small\ttfamily ALU}} +\end{groupdesc} + +\subsubsection{Mux-Demux: design your own shape} + +\begin{minipage}{0.45\linewidth} +\RaggedRight +In designing the shape there are several parameters to be taken into account. In the diagram on the right they are shown in a (hopefully) practical way. The parameter can be set in a node or in a style using the \texttt{muxdemux def} key as shown above, or set with \verb|\ctikzset| as \texttt{multipoles/muxdemux/Lh} keys and so on. +\end{minipage}% +\begin{minipage}{0.5\linewidth} +\centering +\begin{circuitikz}[quote/.style={thin, blue, <->}, refline/.style={red, dashed}] + \def\myquotev#1#2#3#4{% + \draw [refline] (A.#1) -- ++(#2,0) coordinate(tmp) --++(#3,0); + \draw [quote] (tmp|-A.center) -- (tmp |- A.#1) + node [midway, below=4pt, sloped, fill=white]{\texttt{#4}}; + } + \def\myquoteh#1#2#3#4#5{% + \draw [refline] (A.#1) -- ++(0,#2) coordinate(tmp) --++(0,#3); + \draw [quote] (tmp) -- (tmp -| A.#5) + node [right, fill=white]{\texttt{#4}}; + } + \begin{scope} + \clip (-4,-0.5) rectangle (2,3); + \node [muxdemux, muxdemux def={NL=6, NR=3, NT=3, + inset w=1.0, inset Lh=3.0, inset Rh=2.0}, no input leads](A) at(0,0) {}; + \draw [refline] (-4,0) -- (2,0); + \draw [refline] (0,-1) -- (0,3); + \end{scope} + \myquotev{top left}{-2.8}{-.2}{Lh} + \myquotev{inset top left}{-2.0}{-.2}{inset Lh} + \myquotev{inset top right}{-1.4}{-.2}{inset Rh} + \myquotev{top right}{.5}{.2}{Rh} + \myquoteh{top left}{.3}{.2}{w}{center} + \myquoteh{inset top left}{-1.5}{-.2}{inset w}{inset top right} +\end{circuitikz} +\end{minipage} + +\bigskip + +The default values are $\texttt{Lh}=8$, $\texttt{Rh}=6$, $\texttt{w}=3$ and no inset: $\texttt{inset Lh}=\texttt{inset Rh}=\texttt{inset w}=0$. In addition, you can set the following parameters: +\begin{description} + \item [NL, NR, NB, NT]: number of pins relatively on the left, right, bottom and top side (default \texttt{8}, \texttt{1}, \texttt{3}, \texttt{0}). When an inset is active (in other words, when $\texttt{Lh}>0$) the pins are positioned on the top and bottom part, not in the inset; the exception is when the number of left pins is odd, in which case you have one pin set on the center of the inset. + If you do not want a pin in one side, use \texttt{0} as number of pins. + \item [square pins]: set to \texttt{0} (default) if you want the square pins to stick out following the slope of the bottom or top side, \texttt{1} if you want them to stick out in a square way (see the example above for the ALU). +\end{description} +All the distances are multiple of \texttt{multipoles/muxdemux/base len} (default \texttt{0.4}, to be set with \verb|\ctikzset|), which is relative to the basic length. That value has been chosen so that, if you have a numbers of pins which is equal to the effective distance where they are spread (which is \texttt{Lh} without inset, $\texttt{Lh}- (\texttt{inset Lh})$ with an inset), then the distance is the same as the default pin distance in chips, as shown in the next circuit. In the same drawing you can see the effect of \texttt{square pins} parameters (without it, the rightmost bottom lead of the \texttt{mux 4by2} shape will not connect with the below one). + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz} + \tikzset{mux 4by2/.style={muxdemux, + muxdemux def={Lh=4, NL=4, Rh=3, + NB=2, w=2, square pins=1}}} + \node [dipchip, num pins=8](A) at (0,0) {IC1}; + \node [one bit adder, scale=-1, anchor=lpin 2] + at (A.pin 1){}; + \node [mux 4by2, anchor=lpin 1](B) + at (A.pin 8){MUX}; + \node [qfpchip, num pins=8, anchor=pin 8] at + (B.bpin 1) {IC2}; +\end{circuitikz} +\end{LTXexample} + +\subsubsection{Mux-Demux customization} + +Mux-demuxes have the normal parameters of their class (\texttt{muxdemuxes}): you can scale them with the \verb|\ctikzset| key \texttt{muxdemuxes/scale}, control the border thickness with \texttt{muxdemuxes/thickness} and the default fill color with \texttt{muxdemuxes/fill} --- they are set, by default, at the same values than \texttt{logic ports}. + +External pins' length is controlled by the key \texttt{multipoles/external pins width} (default \texttt{0.2}) or by the style \texttt{external pins width}. The parameter +\texttt{multipoles/external pins thickness} is also respected. +like in chips. In addition, like in logic ports, you can suppress the +drawing of the leads by using the boolean key +\texttt{logic ports draw input leads} (default \texttt{true}) or, locally, +with the style \texttt{no inputs leads} (that can be reverted with +\texttt{input leads}). + +The main difference between setting \texttt{external pins width} to \texttt{0} or using \texttt{no inputs lead} is that in the first case the normal pin anchors and the border anchors will coincide, and in the second case they will not move and stay where they should have been if the leads were drawn. + +\subsubsection{Mux-Demux anchors} + +Mux-demuxes have a plethora of anchors. As in the case of chips, the geographic anchors mark the rectangle occupied by the component, without taking into account the pin leads. + +\begin{quote} + \scalebox{0.7}{% + \geocoord[baseline=(N.center)]{muxdemux} + \showanchors[baseline=(N.center)]{muxdemux}{X}(top left/180/0.3, top/90/0.3, top right/0/0.3, + bottom left/180/0.3, bottom/-90/0.3, bottom right/0/0.3, left/180/0.3, right/0/0.3, + center/45/0.2, center up/0/0.4, center down/0/0.4) + \showanchors[baseline=(N.center)]{muxdemux, muxdemux def={NL=6, NR=3, NT=3, inset w=1.0, + inset Lh=3.0, inset Rh=2.0}, no input leads}{}(inset top left/180/0.3, inset top/90/0.5, + inset top right/0/0.3, inset bottom left/180/0.3, inset bottom/-90/0.5, + inset bottom right/-20/0.3, inset left/180/0.3, inset right/-20/0.2, inset center/135/0.2, + narrow center/20/0.2, center up/45/0.4, center down/-45/0.4) +} +\end{quote} + +The pins anchors are named \texttt{lpin}, \texttt{rpin}, \texttt{bpin} and \texttt{tpin} for the left, right, bottom and top pin respectively, and points to the ``external'' pin. The border pins are named the same, with a \texttt{b} added in front: \texttt{blpin}, \texttt{brpin}, \texttt{bbpin} and \texttt{btpin}. +The following graph will show the numbering and position of the pin anchors. + +\begin{quote} +\begin{circuitikz} + \node [muxdemux, muxdemux def={NL=4, NR=3, NT=3, NB=3, w=2, inset w=0.5, + Lh=4, inset Lh=2.0, inset Rh=1.0, square pins=1}](C) at (0,0) {X}; + \node [muxdemux, muxdemux def={NL=7, NR=8, NT=4, inset w=1.0, + inset Lh=4.0, inset Rh=0.0}](D) at (4,0) {X}; + \foreach \myn/\NL/\NR/\NB/\NT in {C/4/3/3/3,D/7/8/3/4} { + \foreach \myp in {1,...,\NL} \node[right, font=\tiny] at (\myn.blpin \myp){\myp}; + \foreach \myp in {1,...,\NR} \node[left, font=\tiny] at(\myn.brpin \myp) {\myp}; + \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}; + } + \path (C.lpin 1) \showcoord(lpin 1)<180:0.3>; + \path (D.blpin 1) \showcoord(blpin 1)<135:0.3>; + \path (C.tpin 1) \showcoord(tpin 1)<180:0.3>; + \path (D.btpin 1) \showcoord(btpin 1)<45:0.3>; + \path (C.rpin 1) \showcoord(rpin 1)<0:0.3>; + \path (D.brpin 1) \showcoord(brpin 1)<45:0.3>; + \path (C.bpin 2) \showcoord(bpin 2)<-90:0.3>; + \path (C.bbpin 2) \showcoord(bbpin 2)<-60:0.3>; + \path (D.bbpin 2) \showcoord(bbpin 2)<-45:0.3>; +\end{circuitikz} +\end{quote} + + +The code that implemented the printing of the numbers (which in \texttt{muxdemux}es, differently from chips, are never printed automatically) in the last graph is the following one. + +\begin{lstlisting}[basicstyle=\small\ttfamily] +\begin{circuitikz} +\node [muxdemux, muxdemux def={NL=4, NR=3, NT=3, NB=3, w=2, inset w=0.5, + Lh=4, inset Lh=2.0, inset Rh=1.0, square pins=1}](C) at (0,0) {X}; +\node [muxdemux, muxdemux def={NL=7, NR=8, NT=4, inset w=1.0, + inset Lh=4.0, inset Rh=0.0}](D) at (4,0) {X}; +\foreach \myn/\NL/\NR/\NB/\NT in {C/4/3/3/3,D/7/8/3/4} { + \foreach \myp in {1,...,\NL} \node[right, font=\tiny] at (\myn.blpin \myp){\myp}; + \foreach \myp in {1,...,\NR} \node[left, font=\tiny] at(\myn.brpin \myp) {\myp}; + \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{lstlisting} + \subsection{Chips (integrated circuits)} \texttt{CircuiTikZ} supports two types of variable-pin chips: DIP (Dual-in-Line Package) and QFP (Quad-Flat Package). diff --git a/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty b/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty index 5e11576ca24..ae4035128c1 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty +++ b/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty @@ -3,6 +3,7 @@ \RequirePackage{ifthen} \RequirePackage{xparse} \RequirePackage{showexpl} +\RequirePackage{ragged2e} % % The following trick is used to silence showexpl a bit, so that the % logs are readable... @@ -61,7 +62,7 @@ \end{circuitikz}% }{\sloppy% {#4, type: node\IfBooleanT{#1}{, fillable}% - } (\texttt{node[#3]\IfValueT{#7}{(N)}\{#5\}}). \index{#3}% + } (\texttt{node[\detokenize{#3}]\IfValueT{#7}{(N)}\{\detokenize{#5}\}}). \index{#3}% \checkclass{N}% }% } @@ -131,14 +132,14 @@ } -\def\geolrcoord#1{\showanchors{#1}{text}(north/90/0.4, north east/45/0.4, east/0/0.4, +\newcommand{\geolrcoord}[2][]{\showanchors[#1]{#2}{text}(north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, left/160/0.4, right/30/0.4, center/-120/0.3 ) } -\def\geocoord#1{\showanchors{#1}{text}(north/90/0.4, north east/45/0.4, east/0/0.4, +\newcommand{\geocoord}[2][]{\showanchors[#1]{#2}{text}(north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, center/-120/0.3 diff --git a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex index 28f25352046..d2a510866d1 100644 --- a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex +++ b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex @@ -1,5 +1,5 @@ -\def\pgfcircversion{1.0.0-pre1} -\def\pgfcircversiondate{2019/12/22} +\def\pgfcircversion{1.0.0-pre2} +\def\pgfcircversiondate{2020/01/23} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} \usemodule[tikz] diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex index e8be0a10810..5708adc84aa 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex @@ -110,6 +110,7 @@ logic ports/scale=1.0, logic ports/fill=none, logic ports/thickness=none, logic ports origin=legacy, % it can be "center" (better) +american or shape=roundy,% could be pointy % % flip-flops flipflops/scale=1.0 diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex index 9fb6b0fe0f8..4505e31056f 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex @@ -55,7 +55,8 @@ amplifiers/thickness=3.0, % Logic ports logic ports/scale=1.0, logic ports/thickness=2.0, -logic ports origin=center, % it can be "center" (better) +logic ports origin=center, +american or shape=pointy, % % flip-flops flipflops/scale=1.0 diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex index b433361e29d..e8c27efbeed 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex @@ -364,6 +364,10 @@ \ctikzset{flipflops/fill/.initial=none} \ctikzset{flipflops/thickness/.initial=none} +\ctikzset{muxdemuxes/scale/.initial=1.0} +\ctikzset{muxdemuxes/fill/.initial=none} +\ctikzset{muxdemuxes/thickness/.initial=none} + \ctikzset{chips/scale/.initial=1.0} \ctikzset{chips/fill/.initial=none} \ctikzset{chips/thickness/.initial=none} @@ -658,6 +662,11 @@ \ctikzset{bipoles/short/width/.initial=0} %dummy width for voltage positioning %\ctikzset{bipoles/short/voltage/straight label distance/.initial=.2} %\ctikzset{bipoles/short/voltage/distance from node/.initial=.5} +% multiwire +\ctikzset{bipoles/multiwire/height/.initial=0.4} +\ctikzset{bipoles/multiwire/width/.initial=0.2} +\ctikzset{bipoles/multiwire/spacing/.initial=0.05} + \ctikzset{bipoles/ammeter/height/.initial=.60} \ctikzset{bipoles/ammeter/width/.initial=.60} \ctikzset{bipoles/ohmmeter/height/.initial=.60} @@ -673,6 +682,15 @@ \ctikzset{bipoles/iloop/height/.initial=.60} \ctikzset{bipoles/oscope/height/.initial=.60} \ctikzset{bipoles/oscope/width/.initial=.60} + +% option to not rotate the new (Romano's) instruments +\newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue +\pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}} +\pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} +\ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}} + + \ctikzset{bipoles/buffer/height/.initial=1} \ctikzset{bipoles/buffer/width/.initial=1} \ctikzset{bipoles/not port/width/.initial=1} @@ -1144,6 +1162,17 @@ }% } +\newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse +\ctikzset{american or shape/.is choice} +\ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}} +\ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}} + +\newif\ifpgfcirc@draw@leads\pgfcirc@draw@leadstrue +\ctikzset{logic ports draw input leads/.is choice} +\ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@leadstrue}} +\ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@leadsfalse}} +\tikzset{input leads/.code={\pgfcirc@draw@leadstrue}} +\tikzset{no input leads/.code={\pgfcirc@draw@leadsfalse}} \ctikzset{tripoles/american and port/width/.initial=1.1} \ctikzset{tripoles/american and port/height/.initial=.8} @@ -1283,11 +1312,27 @@ \pgfkeys{/tikz/number inputs/.default=0} %% flip-flop specific keys (most others are the same as chips) + \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small} \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny} \ctikzset{multipoles/flipflop/width/.initial=1.2} \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6} \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2} + +%% muxdemuxes keys + +\ctikzset{multipoles/muxdemux/base len/.initial=0.4} +\ctikzset{multipoles/muxdemux/Lh/.initial=8.0} +\ctikzset{multipoles/muxdemux/Rh/.initial=6.0} +\ctikzset{multipoles/muxdemux/w/.initial=3.0} +\ctikzset{multipoles/muxdemux/inset w/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0} +\ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0} +\ctikzset{multipoles/muxdemux/NL/.initial=8} +\ctikzset{multipoles/muxdemux/NR/.initial=1} +\ctikzset{multipoles/muxdemux/NB/.initial=3} +\ctikzset{multipoles/muxdemux/NT/.initial=0} +\ctikzset{multipoles/muxdemux/square pins/.initial=0} % % switches for op amps % changing input polarity diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index 2eaa1cf8e52..5e4cf0e1749 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -231,6 +231,37 @@ {\ctikzvalof{bipoles/open/width}} { } +% multiwire(s) +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/multiwire/height}} +{multiwire} +{\ctikzvalof{bipoles/multiwire/height}} +{\ctikzvalof{bipoles/multiwire/width}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} + +\pgfcircdeclarebipole +{} +{\ctikzvalof{bipoles/multiwire/height}} +{bmultiwire} +{\ctikzvalof{bipoles/multiwire/height}} +{\ctikzvalof{bipoles/multiwire/width}} +{ + \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} +} %% Generic bipole - used as resistor by some (bleah) \pgfcircdeclarebipolescaled{resistors} {} @@ -2997,8 +3028,12 @@ \pgf@circ@draworfill \endpgfscope % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi % and unrotate the scope \pgfscope \pgftransformrotate{\rot} @@ -3037,8 +3072,12 @@ \pgf@circ@draworfill % draw the text label % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi % and unrotate the scope \pgfscope \pgfsetcolor{\ctikzvalof{color}} @@ -3061,8 +3100,12 @@ \pgf@circ@draworfill % draw the text label % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi % and unrotate the scope \pgfscope \pgftransformrotate{\rot} @@ -3118,8 +3161,12 @@ \pgf@circ@draworfill \endpgfscope % get the rotation - \pgfgettransformentries\a\b\temp\temp\temp\temp - \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \ifpgf@circuit@straightinstruments + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \else + \edef\rot{0} + \fi % and unrotate the scope \pgfscope \pgftransformrotate{\rot} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex index 51ecc8574b8..0542e905efe 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex @@ -182,7 +182,9 @@ % the coeffcient is adjusted so that the distance is more or less % the same for rotated labels and straight ones (although it will % depend on the font, so it's not exact). - \pgfgettransformentries{\tmp}{\tmp}{\tmp}{\myscale}{\tmp}{\tmp} + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale} \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale} \ifnum \ctikzvalof{bipole/#1/position}>0 %we need some more space for placement below, due to mid-anchor @@ -216,7 +218,9 @@ \pgfextra{ % scale ex-distance to make it independent on scale % thanks @marmot see https://tex.stackexchange.com/a/476018/38080 - \pgfgettransformentries{\tmp}{\tmp}{\tmp}{\myscale}{\tmp}{\tmp} + \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% + \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed + % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale} \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale} \pgfmathadd{\pgf@circ@labanc}{90} \pgfmathround{\pgfmathresult} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex index db7becaa748..6c175c4b732 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex @@ -1281,5 +1281,492 @@ \advance\pgf@circ@count@a by -1\relax% \repeatpgfmathloop% }% - } +} + +% +% MUX-DEMUXES +% +% Thanks to @marmot +\tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}} +\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, + inset w=0.5, inset Lh=2, inset Rh=1.5}}} +\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 +\pgfdeclareshape{muxdemux}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + % pins on the four sides + % \savedmacro\NL{% + % \pgf@circ@count@a=\ctikzvalof{multipoles/muxdemux/NL}% + % \def\NL{\the\pgf@circ@count@a} + % } + \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}} + \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}} + \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}} + \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}} + \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}} + % topleft and topright sizes + \savedanchor{\topleft}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2} + } + \savedanchor{\topright}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2} + } + \savedanchor{\insetnortheast}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}* + (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2} + } + \saveddimen{\insethright}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}} + \saveddimen{\extshift}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}} + \savedanchor{\northwest}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2} + \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2} + } + \anchor{nw}{\northwest} + \anchor{ne}{\northwest\pgf@x=-\pgf@x} + \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y} + \anchor{sw}{\northwest\pgf@y=-\pgf@y} + \anchor{north west}{\northwest} + \anchor{north east}{\northwest\pgf@x=-\pgf@x} + \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y} + \anchor{south west}{\northwest\pgf@y=-\pgf@y} + \anchor{n}{\northwest\pgf@x=0pt } + \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{w}{\northwest\pgf@y=0pt } + \anchor{north}{\northwest\pgf@x=0pt } + \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt } + \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + \anchor{west}{\northwest\pgf@y=0pt } + \anchor{center}{\pgfpointorigin} + \anchor{top right}{\topright} + \anchor{bottom right}{\topright\pgf@y=-\pgf@y} + \anchor{right}{\topright\pgf@y=0pt\relax} + \anchor{top left}{\topleft} + \anchor{bottom left}{\topleft\pgf@y=-\pgf@y} + \anchor{left}{\topleft\pgf@y=0pt\relax} + \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 \pgf@x=0pt\relax} + \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax} + \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya} + \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y} + \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax} + \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya} + \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya} + \anchor{inset left}{\topleft\pgf@y=0pt\relax} + \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright + \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x + \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}} + \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright + \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x + \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}} + \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast + \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax} + \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright + \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax} + \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 + \pgf@yb = \insethright \advance\pgf@y by \pgf@yb + \divide\pgf@y by 2 \pgf@x=0pt\relax} + \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya + \divide\pgf@y by 2 + \pgf@yb = \insethright \advance\pgf@y by \pgf@yb + \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax} + \anchor{text}{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}* + \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2} + \advance\pgf@x by -.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \backgroundpath{% + \topleft + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@left = \pgf@x + \topright + \pgf@circ@res@other = \pgf@y + \pgf@circ@res@right = \pgf@x + \insetnortheast + \pgf@circ@res@step = \pgf@x + \pgf@circ@res@temp = \pgf@y + % + % external block + % + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + % inset, starting down + \ifdim\pgf@circ@res@temp>0pt % inset + % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}} + \fi + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + % now we have to draw the pins, if needed + \ifdim\extshift>0pt\ifpgfcirc@draw@leads\pgfscope % let's avoid too much indent + % Ok, we have to draw the leads (a.k.a. pins) + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + % We mimic the anchors here --- probably there is a better way + % left pins + \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop + \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 + %%%%% + \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 + % \typeout{DEBUGTEST1\space #1\space entering\space \NL} + \ifodd\NL + % odd number of pins + \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax + % centerpin! + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \ifnum\squarepins>0 + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}} + \else + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}} + \fi + \else + \pgfpathmoveto{\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}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\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 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\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 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + \else + % no inset + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \fi + %%%%% + \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 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}} + \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 + \pgfpathmoveto{\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}} + \ifnum\squarepins>0 + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}} + \else + \pgfpathlineto{\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-\extshift}} + \fi + \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 + \pgfpathmoveto{\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}} + \ifnum\squarepins>0 + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step} + {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}} + \else + \pgfpathlineto{\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+\extshift}} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop\fi% + % end drawing pins; stroke them + \pgfusepath{stroke} + \endpgfscope\fi\fi + } + % let's start adding anchors + \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{% + % left side anchors + \pgf@circ@count@a=\NL\relax + % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL} + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL} + % we will create two anchors per pin: the "normal one" like `lpin 1` for the + % external leads, and the "border one" like `blpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@lpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@blpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % right anchors + \pgf@circ@count@a=\NR\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `rpin 1` for the + % external leads, and the "border one" like `brpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@rpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@brpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % bottom anchors + \pgf@circ@count@a=\NB\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `bpin 1` for the + % external leads, and the "border one" like `bbpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@bbpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + % top anchors + \pgf@circ@count@a=\NT\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `tpin 1` for the + % external leads, and the "border one" like `btpin 1` for internal ones. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@muxdemux@tpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@muxdemux@btpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% +} + +%% left anchors for muxdemux +\def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topleft + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \insetnortheast + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \ifnum#1>\NL + \PackageError{circuitikz}{% + You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NL\space left pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \pgf@circ@count@a=\NL \divide\pgf@circ@count@a by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate + % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL} + \ifnum\NL>1 + \ifdim\pgf@yb>0pt % check if we have an inset + % we have to check oddity + \ifodd\NL + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)} + \else + \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL} + \fi + \else % no inset + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL} + \fi + \ifdim\pgf@yb>0pt % check if we have an inset + \ifnum#1>\pgf@circ@count@a\relax + % for lower pins we have to shift them down + % \typeout{DEBUGTEST1\space #1\space entering\space \NL} + \ifodd\NL + % odd number of pins + \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax + % centerpin! + \ifnum#2=0\relax + \pgfpoint{\pgf@xb}{0pt} + \else + \ifnum\squarepins>0 + \pgfpoint{\pgf@xa-#2*\extshift}{0pt} + \else + \pgfpoint{\pgf@xb-#2*\extshift}{0pt} + \fi + \fi + \else + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb} + \fi + \else + % even numer of pins: just go down + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb} + \fi + \else + % nothing need for #1<=NL/2 + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step} + \fi + \else + % no inset + \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step} + \fi + \else + \pgfpoint{\pgf@xa-#2*\extshift}{0pt} + \fi +} + +% right anchors +\def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topright + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \ifnum#1>\NR + \PackageError{circuitikz}{% + You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NR\space right pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \ifnum\NR>1 + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR} + \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step} + \else + \pgfpoint{\pgf@xa+#2*\extshift}{0pt} + \fi +} + +% bottom anchors +\def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topleft + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \topright + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \ifnum#1>\NB + \PackageError{circuitikz}{% + You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NB\space bottom pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \ifnum\NB>0 + % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB} + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step} + \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step} + \ifnum#2=0\relax + \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other} + \else + \ifnum\squarepins>0\relax + \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift} + \else + \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift} + \fi + \fi + \else + % should not happen, give the same as pin 1 anyway + \ifnum#2=0\relax + \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2} + \else + \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift} + \fi + \fi +} + +% top anchors +\def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin + \topleft + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \topright + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \ifnum#1>\NT + \PackageError{circuitikz}{% + You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak + which has been defined with \NT\space top pins% + }{Please check the manual about mux/demux shapes; if you press return I'll try to continue} + \fi + \ifnum\NT>0 + \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT} + \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step} + \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step} + \ifnum#2=0\relax + \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other} + \else + \ifnum\squarepins>0 + \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift} + \else + \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift} + \fi + \fi + \else + % should not happen, give the same as pin 1 anyway + \ifnum#2=0\relax + \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2} + \else + \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift} + \fi + \fi +} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex index 0e579c18623..eb319b1ad8b 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex @@ -796,7 +796,13 @@ \compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}} \def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}} \compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}} - +% multiwire(s) +\def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}} +\compattikzset{bmultiwire/.style = {\circuitikzbasekey, +/tikz/to path=\pgf@circ@bmultiwire@path, l=#1}} +\def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}} +\compattikzset{multiwire/.style = {\circuitikzbasekey, +/tikz/to path=\pgf@circ@multiwire@path, l=#1}} % Transistor like bipoles diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex index a7a6616cf5f..4e8a010fb9d 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex @@ -415,7 +415,7 @@ \anchor{bout}{\right\pgf@y=0pt} - \anchor{left}{\left}% edges of component mius leads + \anchor{left}{\left}% edges of component minus leads \anchor{right}{\right} \anchor{north east}{\northeast}% see \Compass macro @@ -446,22 +446,25 @@ \pgfextracty{\pgf@circ@res@temp}{\step}% \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax \pgf@circ@res@count = \inputs\relax - \loop\ifnum\pgf@circ@res@count>0 - \advance\pgf@circ@res@temp by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left} - {\pgf@circ@res@temp}} - \advance\pgf@circ@res@count by -1 + \ifpgfcirc@draw@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 \repeat - + \fi + % output lead \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}} - \pgfusepath{draw} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left @@ -476,21 +479,23 @@ \pgfextracty{\pgf@circ@res@temp}{\step}% \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax \pgf@circ@res@count = \inputs\relax - \loop\ifnum\pgf@circ@res@count>0 - \advance\pgf@circ@res@temp by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left} - {\pgf@circ@res@temp}} - \advance\pgf@circ@res@count by -1 - \repeat + \ifpgfcirc@draw@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 + \repeat + \fi \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}} \pgfusepath{draw} - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right @@ -520,14 +525,17 @@ \pgfextracty{\pgf@circ@res@temp}{\step}% \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax \pgf@circ@res@count = \inputs\relax - \loop\ifnum\pgf@circ@res@count>0 - \advance\pgf@circ@res@temp by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% - \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% - \advance\pgf@circ@res@count by -1 - \repeat + \ifpgfcirc@draw@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} @@ -542,12 +550,23 @@ \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax \advance\pgf@circ@res@other by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry - \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% - \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% - \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% - \pgfpathclose + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi + % not dot \pgfpathellipse {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} {\pgfpoint{.5\pgf@circ@res@step}{0pt}} @@ -567,14 +586,17 @@ \pgfextracty{\pgf@circ@res@temp}{\step}% \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax \pgf@circ@res@count = \inputs\relax - \loop\ifnum\pgf@circ@res@count>0 - \advance\pgf@circ@res@temp by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% - \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% - \advance\pgf@circ@res@count by -1 - \repeat + \ifpgfcirc@draw@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} @@ -586,11 +608,21 @@ \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}% - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry - \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% - \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% - \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% - \pgfpathclose + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi \pgf@circ@draworfill } @@ -611,15 +643,18 @@ \pgfextracty{\pgf@circ@res@temp}{\step}% \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax \pgf@circ@res@count = \inputs\relax - \loop\ifnum\pgf@circ@res@count>0 - \advance\pgf@circ@res@temp by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% - \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% - \advance\pgf@circ@res@other by -\pgf@circ@math@distance - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% - \advance\pgf@circ@res@count by -1 - \repeat + \ifpgfcirc@draw@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} @@ -631,11 +666,21 @@ \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}% - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry - \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% - \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% - \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% - \pgfpathclose + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi \pgf@circ@draworfill \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}% @@ -662,15 +707,18 @@ \pgfextracty{\pgf@circ@res@temp}{\step}% \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax \pgf@circ@res@count = \inputs\relax - \loop\ifnum\pgf@circ@res@count>0 - \advance\pgf@circ@res@temp by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% - \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% - \advance\pgf@circ@res@other by -\pgf@circ@math@distance - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% - \advance\pgf@circ@res@count by -1 - \repeat + \ifpgfcirc@draw@leads + %input leads + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}% + \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \advance\pgf@circ@res@other by -\pgf@circ@math@distance + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}% + \advance\pgf@circ@res@count by -1 + \repeat + \fi \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} @@ -685,11 +733,21 @@ \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax \advance\pgf@circ@res@other by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry - \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% - \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% - \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% - \pgfpathclose + % main shape + \ifpgfcirc@roundy@or@shapes + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry + \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}% + \pgfpathclose + \else + \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}% + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}% + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}} + \pgfpathclose + \fi \pgfpathellipse {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}} @@ -813,8 +871,11 @@ \pgf@circ@draworfill \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \ifpgfcirc@draw@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} @@ -921,8 +982,11 @@ \pgf@circ@draworfill \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \ifpgfcirc@draw@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} @@ -949,6 +1013,11 @@ \northwest \pgf@y=0pt } + \anchor{bin}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } \anchor{bin 1}{ \northwest \pgf@y=0pt @@ -1031,8 +1100,11 @@ \pgf@circ@draworfill \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \ifpgfcirc@draw@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} @@ -1072,6 +1144,11 @@ \northwest \pgf@y=0pt } + \anchor{bin}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } \anchor{bin 1}{ \northwest \pgf@y=0pt @@ -1148,8 +1225,11 @@ \pgf@circ@draworfill \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \ifpgfcirc@draw@leads + %input leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + \fi \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}} @@ -1272,39 +1352,42 @@ {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}} \pgf@circ@draworfill \endpgfscope - \ifnum#3=1\relax - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% - \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% - \else - \pgfextracty{\pgf@circ@res@temp}{\step}% - \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax - %\pgf@circ@res@count = #3\relax% redundant - \loop\ifnum\pgf@circ@res@count>0 - \advance\pgf@circ@res@temp by -\pgf@circ@res@step - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left} - {\pgf@circ@res@temp}} - \advance\pgf@circ@res@count by -1 + \ifpgfcirc@draw@leads + %input leads + \ifnum#3=1\relax + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}% + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}% + \else + \pgfextracty{\pgf@circ@res@temp}{\step}% + \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax + %\pgf@circ@res@count = #3\relax% redundant + \loop\ifnum\pgf@circ@res@count>0 + \advance\pgf@circ@res@temp by -\pgf@circ@res@step + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}% + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left} + {\pgf@circ@res@temp}} + \advance\pgf@circ@res@count by -1 \repeat \fi - % - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{% - \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} - % - \edef\pgf@temp{not} - \edef\pgf@circ@temp{#4} - \ifx\pgf@temp\pgf@circ@temp % is a not - \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% - {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} - \fi - % - \pgfusepath{draw} - % - \pgfpathmoveto{\pgfpointorigin} - \pgftext{#2} + \fi + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{% + \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} + % + \edef\pgf@temp{not} + \edef\pgf@circ@temp{#4} + \ifx\pgf@temp\pgf@circ@temp % is a not + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% + {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} + \fi + % + \pgfusepath{draw} + % + \pgfpathmoveto{\pgfpointorigin} + \pgftext{#2} } } } diff --git a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty index d7595ab87b0..40f37add536 100644 --- a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty +++ b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty @@ -9,8 +9,8 @@ \NeedsTeXFormat{LaTeX2e} -\def\pgfcircversion{1.0.0-pre1} -\def\pgfcircversiondate{2019/12/22} +\def\pgfcircversion{1.0.0-pre2} +\def\pgfcircversiondate{2020/01/23} \ProvidesPackage{circuitikz}% [\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] -- cgit v1.2.3