diff options
Diffstat (limited to 'graphics/pgf/contrib/circuitikz')
-rw-r--r-- | graphics/pgf/contrib/circuitikz/doc/changelog.tex | 30 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf | bin | 15492 -> 17620 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex | 3 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf | bin | 815539 -> 845023 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex | 261 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/circuitikz.sty | 4 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-legacy.tex | 5 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/ctikzstyle-romano.tex | 8 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex | 55 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex | 428 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex | 25 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex | 564 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex | 25 | ||||
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex | 4 |
14 files changed, 1342 insertions, 70 deletions
diff --git a/graphics/pgf/contrib/circuitikz/doc/changelog.tex b/graphics/pgf/contrib/circuitikz/doc/changelog.tex index 463e72e5c6..a64775720a 100644 --- a/graphics/pgf/contrib/circuitikz/doc/changelog.tex +++ b/graphics/pgf/contrib/circuitikz/doc/changelog.tex @@ -5,6 +5,34 @@ full list of changes. \begin{itemize} \item + Version 1.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. + + \begin{itemize} + \tightlist + \item + Added a flip-flop library + \item + Added a single-input generic amplifier with the same dimension as + ``plain amp'' + \item + Added border anchors to amplifiers + \item + Added the possibility (expert only!) to add transparency to poles + (after a suggestion from user @matthuszagh on GitHub) + \item + Make plus and minus symbol on amplifiers configurable + \item + Adjusted the position of text in triangular amplifiers + \item + Fixed ``plain amp'' not respecting ``noinv input up'' + \item + Fixed minor incompatibility with ConTeXt and Plain TeX + \end{itemize} +\item Version 0.9.7 (2019-12-01) The important thing in this release is the new position of @@ -25,7 +53,7 @@ full list of changes. The highlights of this release are the new multiple terminals BJTs and several stylistic addition and fixes; if you like to pixel-peep, you - will like the fixed transistors arrows. Additionally, the transforms + will like the fixed transistors arrows. Additionally, the transformers are much more configurable now, the ``pmos'' and ``nmos'' elements have grown an optional bulk connection, and you can use the ``flow'' arrows outside of a path. diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf Binary files differindex 4149774548..34f8ec98c0 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex index aa752551d4..4b6ee8db0d 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.tex @@ -15,7 +15,8 @@ A simple example to test the installation. to [generic, i=$i_1$, v=$v_1$] (4,-.5) -- (4,-1.5) (0,2) -- (0,-1.5) to[V, v_=4\volt] (2,-1.5) to [R, l=1\kilo\ohm] (4,-1.5) - (5,2) node[dipchip, anchor=pin 1]{}; + (5,2) node[dipchip, anchor=pin 1]{} + (5,-2) node[flipflop JK, anchor=pin 1]{}; \stopcircuitikz diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf Binary files differindex 4de70f73d5..1d2dc85a79 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex index e34526c6f8..af05238cc1 100644 --- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex +++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex @@ -209,6 +209,8 @@ instead of \texttt{circuitikz}. This is also advantageous for ``future resilienc So, if loaded with said option, one must write \verb!(0,0) to[*R] (2,0)! and, for transistors on a path, \verb!(0,0) to[*Tnmos] (2,0)!, and so on (but \verb!(0,0) node[nmos] {}!). See example at page~\pageref{ex:compatibility}. +Another thing to take into account is that any \TikZ{} figure (and \Circuitikz{} ones qualify) \textbf{will} have problems if you use the \texttt{babel} package with a language that changes active characters (most of them). The solution is normally to add the line \verb|\usetikzlibrary{babel}| in your preamble, after loading \TikZ{} or \Circuitikz. This will normally solve the problem; some language also requires using \verb|\deactivatequoting| or the option \texttt{shorthands=off} for \texttt{babel}. Please check the documentation of \TikZ{} or this question \href{https://tex.stackexchange.com/questions/166772/problem-with-babel-and-tikz-using-draw}{on \TeX{} stackexchange site}. + \subsection{Known bugs and limitation}\label{sec:bugs} \Circuitikz{} will \textbf{not work} correctly with global (in the main \texttt{circuitikz} environment, or in \texttt{scope} environments) \emph{negative} scale parameters (\texttt{scale}, \texttt{xscale} or \texttt{yscale}), unless \texttt{transform shape} is also used, and even in this cases the behavior is not guaranteed. @@ -227,7 +229,7 @@ You can check the used version at your local installation using the macro \verb! \item After v0.9.4: added the concept of styling of circuits. It should be backward compatible, but it's a big change, so be ready to use the \texttt{0.9.3} snapshot (see below for details). \item After v0.9.0: the parameters \texttt{tripoles/american or port/aaa}, \texttt{...bbb}, \texttt{...ccc} and \texttt{...ddd} are no longer used and are silently ignored; the same stands for \texttt{nor}, \texttt{xor}, and \texttt{xnor} ports. \item After v0.9.0: voltage and current directions/sign (plus and minus signs in case of \texttt{american voltages} and arrows in case of \texttt{european voltages} have been rationalized with a couple of new options (see details in section~\ref{curr-and-volt}. The default case is still the same as v0.8.3. - \item Since v0.8.2: voltage and current label directions(v<= / i<=) do NOT change the orientation of the drawn source shape anymore. Use the "invert" option to rotate the shape of the source. Furthermore, from this version on, the current label(i=) at current sources can be used independent of the regular label(l=). + \item Since v0.8.2: voltage and current label directions (\texttt{v<=} / \texttt{i<=}) do NOT change the orientation of the drawn source shape anymore. Use the \texttt{invert} option to rotate the shape of the source. Furthermore, from this version on, the current label (\texttt{i=}) at current sources can be used independent of the regular label (\texttt{l=}). \item Since v0.7?: The label behaviour at mirrored bipoles has changes, this fixes the voltage drawing, but perhaps you have to adjust your label positions. \item Since v0.5.1: The parts pfet, pigfete, pigfetebulk and pigfetd are now mirrored by default. Please adjust your yscale-option to correct this. \item Since v0.5: New voltage counting direction, here exists an option to use the old behaviour @@ -297,8 +299,8 @@ Feel free to load the package with your own cultural options: \item \texttt{europeanresistors}: uses rectangular empty shape for resistors, as per european standards; \item \texttt{americanresistors}: uses zig-zag shape for resistors, as per american standards; \item \texttt{europeaninductors}: uses rectangular filled shape for inductors, as per european standards; - \item \texttt{americaninductors}: uses "4-bumps" shape for inductors, as per american standards; - \item \texttt{cuteinductors}: uses my personal favorite, "pig-tailed" shape for inductors; + \item \texttt{americaninductors}: uses ``4-bumps'' shape for inductors, as per american standards; + \item \texttt{cuteinductors}: uses my personal favorite, ``pig-tailed'' shape for inductors; \item \texttt{americanports}: uses triangular logic ports, as per american standards; \item \texttt{europeanports}: uses rectangular logic ports, as per european standards; \item \texttt{americangfsurgearrester}: uses round gas filled surge arresters, as per american standards; @@ -897,10 +899,11 @@ Mirroring and flipping of node components is obtained by using the \TikZ\ keys \ \end{circuitikz} \end{LTXexample} -To simplify this task, \Circuitikz{} has three helper macros --- \verb|\ctikzflipx{}|, \verb|\ctikzflipy{}|, +To simplify this task, \Circuitikz{} when used in \LaTeX{} has three helper macros --- \verb|\ctikzflipx{}|, \verb|\ctikzflipy{}|, and \verb|\ctikzflipxy{}|, that can be used to ``un-rotate'' the text of nodes drawn with, respectively, \texttt{xscale=-1}, \texttt{yscale=-1}, and \texttt{scale=-1} (which is equivalent to \texttt{xscale=-1, yscale=-1}). +In other formats they are undefined; contributions to fill the gap are welcome. \begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] \begin{circuitikz}[scale=0.7, transform shape] @@ -2254,7 +2257,7 @@ Basically they are the same as the normal \texttt{npn} and \texttt{pnp}, and the \circuitdesc{hemt}{hemt}{} \end{groupdesc} -\textsc{nfet}s and \textsc{pfet}s have been incorporated based on code provided by Clemens Helfmeier and Theodor Borsche. Use the package options \texttt{fetsolderdot}/\texttt{nofetsolderdot} to enable/disable solderdot at some fet-transistors. Additionally, the solderdot option can be enabled/disabled for single transistors with the option "solderdot" and "nosolderdot", respectm ively. +\textsc{nfet}s and \textsc{pfet}s have been incorporated based on code provided by Clemens Helfmeier and Theodor Borsche. Use the package options \texttt{fetsolderdot}/\texttt{nofetsolderdot} to enable/disable solderdot at some fet-transistors. Additionally, the solderdot option can be enabled/disabled for single transistors with the option \texttt{solderdot} and \texttt{nosolderdot}, respectively. \begin{groupdesc} \circuitdesc{nfet}{nfet}{Q} @@ -2362,7 +2365,7 @@ You can use the \texttt{body ...} anchors to add more or different things to the \end{circuitikz} \end{LTXexample} -\paragraph{Base/Gate terminal.} The Base/Gate connection of all transistors can be disabled by the options \textit{nogate} or \textit{nobase}, respectively. The Base/Gate anchors are floating, but there is an additional anchor "nogate"/"nobase", which can be used to point to the unconnected base: +\paragraph{Base/Gate terminal.} The Base/Gate connection of all transistors can be disabled by the options \textit{nogate} or \textit{nobase}, respectively. The Base/Gate anchors are floating, but there is an additional anchor \texttt{nogate}/\texttt{nobase} , which can be used to point to the unconnected base: \begin{LTXexample}[varwidth=true] \begin{circuitikz} \draw (2,0) node[npn,nobase](npn){}; @@ -3080,8 +3083,9 @@ Remember that the default \texttt{pgfkeys} directory is \texttt{/tikz} for nodes \circuitdesc*{inst amp}{plain instrumentation amplifier}{}( up/90/0.2, down/-90/0.2, refv up/45/0.2, refv down/-45/0.2 ) \circuitdesc*{fd inst amp}{Fully differential instrumentation amplifier}{} \circuitdesc*{inst amp ra}{instrumentation amplifier with amplification resistance terminals}{}( ra+/180/0.1, ra-/180/0.1 ) - \circuitdesc*{plain amp}{Plain amplifier}{}(+/180/0.2, -/180/0.2, out/0/0.2, up/90/0.2) - \circuitdesc*{buffer}{Buffer}{}(in/180/0.2, out/0/0.2) + \circuitdesc*{plain amp}{Plain amplifier, unmarked, two inputs}{}(in up/180/0.1, in down/180/0.1, up/90/0.2, out/0/0.2, bin up/145/0.2, bin down/-145/0.2, bout/45/0.3) + \circuitdesc*{plain mono amp}{Plain amplifier, one input}{}(in/180/0.2, out/0/0.2, up/90/0.2, center/-30/0.6, bin/145/0.1, bout/45/0.3) + \circuitdesc*{buffer}{Buffer}{}(in/180/0.2, out/0/0.2, center/-30/0.6, bin/145/0.1, bout/45/0.3) \end{groupdesc} \subsubsection{Amplifiers anchors} @@ -3124,7 +3128,7 @@ The fully differential op amp defines two outputs: ;\end{circuitikz} \end{LTXexample} -The instrumentation amplifier inst amp defines also references (normally you use the "down", unless you are flipping the component): +The instrumentation amplifier inst amp defines also references (normally you use the \texttt{down}, unless you are flipping the component): \begin{LTXexample}[varwidth=true] \begin{circuitikz} \draw (0,0) node[inst amp] (opamp) {} @@ -3168,6 +3172,21 @@ The instrumentation amplifier with resistance terminals (\texttt{inst amp ra}) d ;\end{circuitikz} \end{LTXexample} +Amplifiers have also ``border'' anchors (just add \texttt{b}, without space, to the anchor, like \texttt{b+} or \texttt{bin up} and so on). These can be useful to add ``internal components'' or to modify the component. Also the \texttt{leftedge} anchors (on the border midway between input) is available. + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz}[] + \draw (0,2.2) node[op amp](OA){IA1}; + \node[oosourceshape, rotate=90, scale=0.5] + at (OA.leftedge) {}; + \draw (0,0) node[plain amp](A){$A$}; + \draw [color=red] (A.bin up) -- ++(0.2,0) + coordinate (tmp) + to[R, resistors/scale=0.5] + (tmp|-A.bin down) -- (A.bin down); +\end{circuitikz} +\end{LTXexample} + \subsubsection{Amplifiers customization} You can scale the amplifiers using the key \texttt{amplifiers/scale} and setting it to something different from \texttt{1.0}. The font used for symbols will not scale, so it's your responsibility to change it if the need arises. @@ -3192,6 +3211,43 @@ 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}. + +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} + \tikzset{amp symbol font={% + \color{blue}\fontsize{12}{12}\selectfont\boldmath}} +\end{lstlisting} +to have plus and minus symbols that are bigger and blue. + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz}[] + % change in this circuit only + \tikzset{amp symbol font={\color{blue}\small\boldmath}} + % local change + \draw (0,2.2) node[op amp, amp plus=$\oplus$]{}; + \draw (0,0) node[op amp]{}; + % from now on... + \ctikzset{amplifiers/plus={$\oplus$}} + \ctikzset{amplifiers/minus={$\ominus$}} + \draw (0,-2.2) node[fd op amp]{}; +\end{circuitikz} +\end{LTXexample} + +If you want different symbols for input and output you can use a null symbol and put them manually using the border anchors. + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz}[] + \ctikzset{amplifiers/plus={}} + \ctikzset{amplifiers/minus={}} + \draw (0,0) node[fd op amp](A){}; + \node [font=\small\bfseries, right] at(A.bin up) {1}; + \node [font=\small\bfseries, right] at(A.bin down) {2}; + \node [font=\small\bfseries, below] at(A.bout up) {3}; + \node [font=\small\bfseries, above] at(A.bout down) {4}; +\end{circuitikz} +\end{LTXexample} + \paragraph{European-style amplifier customization} Thanks to the suggestions from David Rouvel (\email{david.rouvel@iphc.cnrs.fr}) there are several possible customization for the European-style amplifiers. @@ -3749,7 +3805,170 @@ In the case of \textsc{not}, there are only \texttt{in} and \texttt{out} (althou ;\end{circuitikz} \end{LTXexample} +\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. + +The default flip flop is empty: it is just a rectangular box like a blank \texttt{dipchip} with 6 pins. +\begin{groupdesc} + \circuitdesc*{flipflop}{Blank (void) flip flop}{FF}( + pin 1/180/0.2, pin 2/180/0.2, pin 3/180/0.2, + bpin 1/120/0.3, bpin 6/60/0.3, up/90/0.2, down/-90/0.2, bup/30/0.2, bdown/-30/0.2, + pin 6/0/0.2, pin 5/0/0.2, pin 4/0/0.2) +\end{groupdesc} + +As you can see, in a void flip flop no external pins are drawn: you have to define the meaning of each of them to see them. +To define a specific flip-flop, you have to set a series of keys under the \verb|\ctikzset| directory \texttt{multipoles/flipflop/}, corresponding to pins \texttt{1}\dots \texttt{6}, \texttt{u} for ``up'' and \texttt{d} for ``down'': +\begin{itemize} + \item a \emph{text} value \texttt{t0}, \texttt{t1}, \dots \texttt{t6}, and \texttt{tu} and \texttt{td} (the last ones for up and down) which will set a label on the pin; + \item a \emph{clock wedge} flag (\texttt{c0}, \dots \texttt{c6}, \texttt{cu}, \texttt{cd}), with value \texttt{0} or \texttt{1}, which will draw a triangle shape on the border of the correspondig pin; + \item a \emph{negation} flag (\texttt{n0}, \dots \texttt{n6}, \texttt{nu}, \texttt{nd}), with value \texttt{0} or \texttt{1}, which will put and \texttt{ocirc} shape on the outer border of the correspondig pin. +\end{itemize} + +To set all this keys, an auxiliary style \texttt{flipflop def} is defined, so that you can do the following thing: + +\begingroup +\tikzset{flipflop AB/.style={flipflop, + flipflop def={t1=A, t3=B, t6=Q, t4={\ctikztextnot{Q}}, + td=rst, nd=1, c2=1, n2=1, t2={\texttt{CLK}}}, +}} + +\begin{lstlisting} +\tikzset{flipflop AB/.style={flipflop, + flipflop def={t1=A, t3=B, t6=Q, t4={\ctikztextnot{Q}}, + td=rst, nd=1, c2=1, n2=1, t2={\texttt{CLK}}}, +}} +\end{lstlisting} + +to obtain: + +\begin{groupdesc} + \circuitdesc*{flipflop AB}{Example custom flip flop}{}( + pin 1/180/0.2, pin 2/180/0.2, pin 3/180/0.2, + bpin 1/120/0.3, bpin 6/60/0.3, down/-90/0.2, bdown/-30/0.2, + pin 6/0/0.2) +\end{groupdesc} +\endgroup + +\verb|\ctikztextnot{}| is a small utility macro to set a overbar to a text, like \ctikztextnot{RST} (created by \verb|\ctikztextnot{RST}|). + + +By default, the following flip-flops are defined: +\begin{groupdesc} + \circuitdesc*{latch}{D-type latch}{} + \circuitdesc*{flipflop SR}{flip-flop SR}{} + \circuitdesc*{flipflop D}{Edge-triggered synchronous flip-flop D}{} + \circuitdesc*{flipflop T}{Edge-triggered synchronous flip-flop T}{} + \circuitdesc*{flipflop JK}{Edge-triggered synchronous flip-flop JK}{} +\end{groupdesc} + +If you prefer that the negated output is labelled \texttt{Q} and a dot indicating negation is shown, you can add the \texttt{dot on notQ} key: + +\begin{groupdesc} + \circuitdesc*{flipflop JK, dot on notQ}{synchronous flip-flop JK with asynchronous set and reset}{} +\end{groupdesc} + +You can also add ``vertical'' asynchronous set and reset (active low) adding the style \texttt{add async SR} to all of them: + +\begin{groupdesc} + \circuitdesc*{flipflop JK, add async SR}{synchronous flip-flop JK with asynchronous set and reset}{} +\end{groupdesc} + +\subsubsection{Custom flip-flops} + +If you like different pin distributions, you can easily define different flip-flops to your taste. For example, somebody likes the clock pin on the bottom pin: + +\begingroup +\tikzset{flipflop myJK/.style={flipflop, + flipflop def={t1=J, t2=K, t6=Q, t4={\ctikztextnot{Q}}, c3=1}} +} + +\begin{lstlisting} +\tikzset{flipflop myJK/.style={flipflop, + flipflop def={t1=J, t2=K, t6=Q, t4={\ctikztextnot{Q}}, c3=1}} +} +\end{lstlisting} + +\begin{groupdesc} + \circuitdesc*{flipflop myJK}{Example custom flip flop}{} +\end{groupdesc} +\endgroup + +The standard definition of the default flip-flops are the following (you can find them in the file \texttt{pgfcircmultipoles.tex}): + +\begin{lstlisting}[basicstyle=\small\ttfamily] +\tikzset{ + % async + latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}}, + flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}}, + % sync + flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}}, + flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}}, + flipflop JK/.style={flipflop, + flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}}, + % additional features + add async SR/.style={flipflop def={% + tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}}, + dot on notQ/.style={flipflop def={t4={Q}, n4=1}}, +} +\end{lstlisting} + + +\subsubsection{Flip-flops anchors} + +Flip-flops have all the standard geometrical anchors, although it should be noticed that the external pin are \emph{outside} them. The pins are accessed by the number \texttt{1} to \texttt{6} for the lateral ones (like in DIP chips), and with the \texttt{up} and \texttt{down} anchors for the top and bottom one. All the pins have the ``border'' variant (add a \texttt{b} in front of them, no spaces). + +\begin{quote} + \geocoord{flipflop JK}\qquad + \showanchors{flipflop JK, add async SR, external pins width=0.5}{}(% + pin 1/180/0.5, pin 2/180/0.5, pin 3/180/0.5, + up/90/0.2, down/-90/0.2, + pin 6/0/0.5, pin 5/0/0.5, pin 4/0/0.5, + bpin 1/120/0.3, bpin 2/135/0.3, bpin 3/-120/0.2, + bup/30/0.3, bdown/-30/0.3, + bpin 6/60/0.3, bpin 5/30/0.3, bpin 4/-30/0.4) +\end{quote} + +If you have negated pins, you can access the \texttt{ocirc} shapes with the name as \texttt{\textsl{<nodename>}-N\textsl{<pin number>}}, and all the respective anchors (for example --- \verb|myFFnode-N4.west|). + +\subsubsection{Flip-flops customization} + + +Flip-flop's size is controlled by the class parameters (like \texttt{flipflops/scale}) and the specific \verb|\ctikzset| keys \texttt{multipoles/flipflop/width} and \texttt{multipoles/flipflop/pin spacing}. Class parameters are also used for line thickness and fill color. The default values are matched with the logic ports ones. + +The fonts used for the pins \texttt{1}\dots \texttt{6} is set by the key \texttt{multipoles/flipflop/font} (by default \verb|\small| in \LaTeX{} and the equivalent in other formats) and the font used for pins \texttt{u} and \texttt{d} is \texttt{multipoles/flipflop/fontud} (\verb|\tiny| by default). +You can change it globally or specifically for each flip flop. + +As in chips, you can change the length of the external pin with the key \texttt{external pins width}; you can for example have a pinless flip-flop like this: + +\begin{groupdesc} + \circuitdesc*{flipflop JK, add async SR, external pins width=0}{synchronous flip-flop JK}{} +\end{groupdesc} + +Notice however that negated pins when the pins width is zero has to be handled with care. As explained in the poles sections, the \texttt{ocirc} shape is drawn at the end of the shape to cancel out the wires below; so if you use a pinless flipflop when you do the connection you should take care of connecting the symbol correctly. To this end, the shapes of the negation circles are made available as \texttt{\textsl{<nodename>}-N\textsl{<pin number>}}, as you can see in the next (contrived) example. + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz}[scale=3, transform shape] + \clip (0.2,0.5) rectangle (1.2,-1.3); + \node [flipflop JK, + flipflop def={n5=1,n4=1,t5={/c},c5=1}, + external pins width=0, + ](A){}; + \draw (A-N5.east) -- ++(1,0); % correct + \draw (A.pin 4) -- ++(1,0); % wrong +\end{circuitikz} +\end{LTXexample} + +Normally the symbols on the flip-flop are un-rotated when you rotate the symbol, but as in case of chips, you can avoid it. +\begin{LTXexample}[pos=t] +\begin{tikzpicture} + \draw (0,0) node[flipflop JK, add async SR]{}; + \draw (3,0) node[flipflop JK, add async SR, rotate=90]{}; + \draw (7,0) node[flipflop JK, add async SR, rotate=90, rotated numbers]{}; +\end{tikzpicture} +\end{LTXexample} \subsection{Chips (integrated circuits)} @@ -4940,6 +5159,30 @@ There are several predefined shorthand as the above; in the following pages you \draw (0,0) to[R, d-*] (2,0); \end{circuitikz} \end{LTXexample} + +\subsubsection{Transparent poles} + +``Open-poles'' terminals (\texttt{ocirc}, \texttt{odiamondpole}, and \texttt{osquarepole}) are normally filled with the background color at full opacity. This is because, for simplicity of operation, the nodes are placed \emph{after} the wires are drawn and have to ``white-out'' the underlying lines. + +Anyway, \emph{if you know what you are doing}, you can change it with the key \texttt{poles/open fill opacity} (with \verb|\ctikzset|) or the style \texttt{open poles opacity}. Notice that you will have artifacts if you don't use the border anchors of the poles to connect wires, and you need to do that by hand. + +\begin{LTXexample}[pos=t, basicstyle=\small\ttfamily] +\begin{circuitikz}[scale=3, transform shape] + \fill[cyan] (0,0) rectangle (4.1,-0.6); + \tikzset{halfwhite/.style={fill opacity=0.5, fill=white, open poles opacity=0.5}} + % automatic positioning when opacity is not 1.0 creates artifacts + \draw[halfwhite] (0,0) to[generic, -o] ++(2,0) --++(0,-0.5); + % you have to use manual positioning + \draw[halfwhite] (2.2,0) -- ++(0.5,0) node[ocirc, anchor=180]{}; + \draw[halfwhite] (3,0) node[ocirc](B){} (B.0) --++(0.5,0) (B.-90) --++(0,-0.5); + % maybe really useful only for terminals going out of the circuit... + \draw (3.6,0) -- ++(0.2,0) node[ocirc, halfwhite, anchor=180]{}; +\end{circuitikz} +\end{LTXexample} + +You also have the similar keys for the ``full'' poles (albeit they are probably not useful at all). + + \subsection{Mirroring and Inverting} Bipole paths can also mirrored and inverted (or reverted) to change the drawing direction. diff --git a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty index 1d2cc1e3b9..d7595ab87b 100644 --- a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty +++ b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty @@ -9,8 +9,8 @@ \NeedsTeXFormat{LaTeX2e} -\def\pgfcircversion{0.9.7} -\def\pgfcircversiondate{2019/12/01} +\def\pgfcircversion{1.0.0-pre1} +\def\pgfcircversiondate{2019/12/22} \ProvidesPackage{circuitikz}% [\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] diff --git a/graphics/pgf/contrib/circuitikz/tex/ctikzstyle-legacy.tex b/graphics/pgf/contrib/circuitikz/tex/ctikzstyle-legacy.tex index 2e33283dc4..e8be0a1081 100644 --- a/graphics/pgf/contrib/circuitikz/tex/ctikzstyle-legacy.tex +++ b/graphics/pgf/contrib/circuitikz/tex/ctikzstyle-legacy.tex @@ -111,6 +111,11 @@ logic ports/fill=none, logic ports/thickness=none, logic ports origin=legacy, % it can be "center" (better) % +% flip-flops +flipflops/scale=1.0 +flipflops/fill=none +flipflops/thickness=none +% % Integrated circuits chips/scale=1.0, chips/fill=none, diff --git a/graphics/pgf/contrib/circuitikz/tex/ctikzstyle-romano.tex b/graphics/pgf/contrib/circuitikz/tex/ctikzstyle-romano.tex index fabba4abf2..9fb6b0fe0f 100644 --- a/graphics/pgf/contrib/circuitikz/tex/ctikzstyle-romano.tex +++ b/graphics/pgf/contrib/circuitikz/tex/ctikzstyle-romano.tex @@ -2,6 +2,10 @@ % Do not use LaTeX commands if you want it to be compatible with ConTeXt % Do not add spurious spaces \tikzset{romano circuit style/.style={% +% generic tikz-level settings +american,% +cute inductors,% +%circutikz-level settings \circuitikzbasekey/.cd,% % Resistors resistors/scale=0.8, @@ -53,6 +57,10 @@ logic ports/scale=1.0, logic ports/thickness=2.0, logic ports origin=center, % it can be "center" (better) % +% flip-flops +flipflops/scale=1.0 +flipflops/thickness=2.0 +% % Switches bipoles/cuteswitch/thickness=0.5, % diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex index b7df7e324e..b433361e29 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex @@ -168,6 +168,29 @@ \fi\fi\fi +% +% Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080 +% +% this is needed to avoid problems with \ConTeXt +\ifcsname normalunexpanded\endcsname + \let\pgfcircutil@unexpanded\normalunexpanded +\else + \let\pgfcircutil@unexpanded\unexpanded +\fi +% minimally expand a pgfkey to check if it's {}/undefined or filled. +\def\unexpandedvalueof#1{% + \pgfcircutil@unexpanded\expandafter\expandafter + \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}} +\def\pgf@circ@valueof@chk#1{% + \ifx\relax#1% + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi + {{}}% #1 is \relax, so consider empty + {\expandafter{#1}}% otherwise, leave the key after one more expansion +}% + % voltage options \newif\ifpgf@circ@siunitx @@ -337,6 +360,10 @@ \ctikzset{logic ports/fill/.initial=none} \ctikzset{logic ports/thickness/.initial=none} +\ctikzset{flipflops/scale/.initial=1.0} +\ctikzset{flipflops/fill/.initial=none} +\ctikzset{flipflops/thickness/.initial=none} + \ctikzset{chips/scale/.initial=1.0} \ctikzset{chips/fill/.initial=none} \ctikzset{chips/thickness/.initial=none} @@ -1254,6 +1281,13 @@ % \pgfkeys{/tikz/number inputs/.initial=0} \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} % % switches for op amps % changing input polarity @@ -1354,6 +1388,27 @@ \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position +% changing fonts and symbols of amplifiers +\ctikzset{amplifiers/symbol font/.code={% + \ctikzset{tripoles/inst amp ra/font=#1}% + \ctikzset{tripoles/fd inst amp/font=#1}% + \ctikzset{tripoles/inst amp/font=#1}% + \ctikzset{tripoles/gm amp/font=#1}% + \ctikzset{tripoles/en amp/font=#1}% + \ctikzset{tripoles/fd op amp/font=#1}% + \ctikzset{tripoles/op amp/font=#1}% +}} +\ctikzset{amplifiers/plus/.initial={$+$}} +\ctikzset{amplifiers/minus/.initial={$-$}} +\tikzset{amp symbol font/.code={% + \ctikzset{amplifiers/symbol font={#1}}% + } +} +\tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}} +\tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}} +\def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}} +\def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}} + \ctikzset{tripoles/thyristor/height/.initial=1.10} \ctikzset{tripoles/thyristor/height 2/.initial=.5} \ctikzset{tripoles/thyristor/width/.initial=1.0} diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex index ab2b0d4e77..db7becaa74 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex @@ -855,3 +855,431 @@ \pgfusepath{draw,fill} \fi } + + +%%%%%% +%%%%%% Flip-flops +%%%%%% + +% Flip flops are a specialized kind of dipchip. +% they have a class by themselves + +%% flip flop definitions --- by default empty +%% pin texts +\ctikzset{multipoles/flipflop/t1/.initial={}} +\ctikzset{multipoles/flipflop/t2/.initial={}} +\ctikzset{multipoles/flipflop/t3/.initial={}} +\ctikzset{multipoles/flipflop/t4/.initial={}} +\ctikzset{multipoles/flipflop/t5/.initial={}} +\ctikzset{multipoles/flipflop/t6/.initial={}} +\ctikzset{multipoles/flipflop/tu/.initial={}} +\ctikzset{multipoles/flipflop/td/.initial={}} +% pin clock wedge flags +\ctikzset{multipoles/flipflop/c1/.initial={0}} +\ctikzset{multipoles/flipflop/c2/.initial={0}} +\ctikzset{multipoles/flipflop/c3/.initial={0}} +\ctikzset{multipoles/flipflop/c4/.initial={0}} +\ctikzset{multipoles/flipflop/c5/.initial={0}} +\ctikzset{multipoles/flipflop/c6/.initial={0}} +\ctikzset{multipoles/flipflop/cu/.initial={0}} +\ctikzset{multipoles/flipflop/cd/.initial={0}} +% pin negation circle flags +\ctikzset{multipoles/flipflop/n1/.initial={0}} +\ctikzset{multipoles/flipflop/n2/.initial={0}} +\ctikzset{multipoles/flipflop/n3/.initial={0}} +\ctikzset{multipoles/flipflop/n4/.initial={0}} +\ctikzset{multipoles/flipflop/n5/.initial={0}} +\ctikzset{multipoles/flipflop/n6/.initial={0}} +\ctikzset{multipoles/flipflop/nu/.initial={0}} +\ctikzset{multipoles/flipflop/nd/.initial={0}} + + +% Thanks to @marmot +\tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}} + +% default set of flip flops +\tikzset{ + % async + latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}}, + flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}}, + % sync + flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}}, + flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}}, + flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}}, + % additional features + add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}}, + dot on notQ/.style={flipflop def={t4={Q}, n4=1}}, +} + +% +% commodity macro to draw the clock wedges. They leave the size of the +% wedge in \pgf@circ@res@temp so that a possible label can be displaced. +% +\def\pgf@circ@do@wedge@left{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}} + \pgfusepath{stroke} + \pgf@circ@res@temp=\wedge + \fi +} +\def\pgf@circ@do@wedge@right{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}} + \pgfusepath{stroke} + \pgf@circ@res@temp=-\wedge + \fi +} +\def\pgf@circ@do@wedge@up{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/cu}>0 + \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}} + \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}} + \pgfusepath{stroke} + \pgf@circ@res@temp=-\wedge + \fi +} +\def\pgf@circ@do@wedge@down{ + \pgf@circ@res@temp=0pt\relax + \ifnum\ctikzvalof{multipoles/flipflop/cd}>0 + \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}} + \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}} + \pgfusepath{stroke} + \pgf@circ@res@temp=\wedge + \fi +} +% generic flip-flop shape +\pgfdeclareshape{flipflop}{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}} + \savedmacro\numpins{\def\numpins{6}} + \savedanchor\centerpoint{% + \pgf@x=-.5\wd\pgfnodeparttextbox% + \pgf@y=-.5\ht\pgfnodeparttextbox% + \advance\pgf@y by+.5\dp\pgfnodeparttextbox% + }% + \savedanchor\origin{\pgfpoint{0pt}{0pt}} + \anchor{center}{\origin} + \anchor{text}{\centerpoint}% to adjust text + \saveddimen\height{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{((\numpins) + *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}% + }% + \saveddimen{\chipspacing}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}} + \saveddimen{\width}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}} + \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}}} + % standard anchors + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgfmathsetlength\pgf@y{0.5*((\numpins) + *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}% + \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}} + } + \anchor{dot}{\northwest + \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing} + \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing} + } + \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 } + % upper and lower pin + \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift } + \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift} + \anchor{bup}{\northwest\pgf@x=0pt } + \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y} + % start drawing + \backgroundpath{% + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgf@circ@scaled@Rlen=\scaledRlen + \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen + \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen + \pgfsetcolor{\ctikzvalof{color}} + \pgfscope% (for the line width) + \pgf@circ@setlinewidth{multipoles}{\pgflinewidth} + \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}% + \pgf@circ@draworfill + \pgfusepath{stroke}% + \endpgfscope + % Adding the pin number + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080 + \ifpgf@circuit@chip@straightnumbers + \pgfgettransformentries\a\b\temp\temp\temp\temp + \pgfmathsetmacro{\rot}{-atan2(\b,\a)} + \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)} + \else + \pgfmathsetmacro{\rot}{0} + \pgfmathsetmacro{\quadrant}{0} + \fi + \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax} + % text + \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space + \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}% + \pgf@circ@strut\space} + % \typeout{TEXT\space\mytext} + \pgfmathloop% + \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step} + \pgf@circ@res@temp=0pt\relax + \ifnum\pgf@circ@count@a>0 + \ifcase\quadrant % rotation 0 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + % \typeout{TEXT Left Q1\space\mytext} + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation -90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or %rotation 180 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + \pgftext[right, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[left, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \or % rotation +90 + % left + \pgf@circ@count@c=\pgf@circ@count@a + \pgf@circ@do@wedge@left + \pgftext[bottom, + at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + % right + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \pgf@circ@do@wedge@right + \pgftext[top, + at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}, + rotate=\rot]{\mytext} + \fi + \advance\pgf@circ@count@a-1\relax% + \repeatpgfmathloop + % Now the up and down text + % up + \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space} + \pgf@circ@do@wedge@up + \ifcase\quadrant % rotation 0 + \pgftext[top, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation -90 + \pgftext[right, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or %rotation 180 + \pgftext[bottom, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation +90 + \pgftext[left, + at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \fi + % down + \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space} + \pgf@circ@do@wedge@down + \ifcase\quadrant % rotation 0 + \pgftext[bottom, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation -90 + \pgftext[left, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or %rotation 180 + \pgftext[top, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \or % rotation +90 + \pgftext[right, + at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp}, + rotate=\rot]{\mytext} + \fi + % external pins + \ifdim\pgf@circ@res@other>0pt + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % left side pins + \pgf@circ@count@c=\pgf@circ@count@a + %% we draw the pin only if it's defined either a text, a clock wedge or a not pin + %% Or'ing tests in core TeX is tough + \edef\@@or{0} + % Just expand the key the minimum needed + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfusepath{stroke} + \fi + % right side pins + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \edef\@@or{0} + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + % \typeout{TEST\space\@@tmp\space\@@x} + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfusepath{stroke} + \fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + % up side + \edef\@@or{0} + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + % \typeout{TEST\space\@@tmp\space\@@x} + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}} + \pgfusepath{stroke} + \fi + % down side + \edef\@@or{0} + \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x} + \ifx\@@tmp\@@x\else\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} + \ifnum\@@tmp>0\edef\@@or{1}\fi + % \typeout{TEST\space\@@tmp\space\@@x} + \ifnum\@@or>0 + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}} + \pgfusepath{stroke} + \fi + \endpgfscope + \fi % external pin width >0 + % + % draw "inverting" circles on outputs, they must be last + % + \pgfscope + \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} + \pgf@circ@count@a=\numpins\relax + \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % left side pins + \pgf@circ@count@c=\pgf@circ@count@a + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfnode{ocirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} + \endpgfscope\fi + % right side pins + \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} + \pgfnode{ocirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} + \endpgfscope\fi + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop + % up side + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfnode{ocirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}} + \endpgfscope\fi + % down side + \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}} + \ifnum\@@tmp>0\pgfscope + \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfnode{ocirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}} + \endpgfscope\fi + \endpgfscope + }% + % \pgf@sh@s@<name of the shape here> contains all the code for the shape + % and is executed just before a node is drawn. + \pgfutil@g@addto@macro\pgf@sh@s@flipflop{% + % Start with the maximum pin number and go backwards. + \pgf@circ@count@a=\numpins\relax + \pgfmathloop% + \ifnum\pgf@circ@count@a>0 + % we will create two anchors per pin: the "normal one" like `pin 1` for the + % electrical contact, and the "border one" like `bpin 1` for labels. + % they will coincide if `external pins width` is set to 0. + \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}% + } + \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{% + \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}% + } + \advance\pgf@circ@count@a by -1\relax% + \repeatpgfmathloop% + }% + } + diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex index 724f5ee350..3ccf5abfcb 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircshapes.tex @@ -30,6 +30,17 @@ \pgfpointorigin } } +% +% Provision for changing opacity. Only expert use, see the manual. +% +\ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it +\tikzset{open poles opacity/.code={% + \ctikzset{poles/open fill opacity=#1}% +}} +\ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it +\tikzset{full poles opacity/.code={% + \ctikzset{poles/full fill opacity=#1}% +}} %% Full terminal @@ -65,14 +76,14 @@ \pgfscope \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen} \pgfsetcolor{\ctikzvalof{color}} - \pgfsetfillopacity{1.0} + \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0 \pgfusepath{draw,fill} \endpgfscope } } -%% Empty terminal +%% Empty round terminal \pgfdeclareshape{ocirc}{ \anchor{center}{ @@ -117,7 +128,7 @@ \else \pgfsetfillcolor{\tikz@fillcolor} \fi - \pgfsetfillopacity{1.0} + \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0 \pgfusepath{draw,fill} \endpgfscope @@ -171,7 +182,7 @@ {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} \pgfsetcolor{\ctikzvalof{color}} - \pgfsetfillopacity{1.0} + \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0 \pgfusepath{draw,fill} \endpgfscope } @@ -234,7 +245,7 @@ \else \pgfsetfillcolor{\tikz@fillcolor} \fi - \pgfsetfillopacity{1.0} + \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0 \pgfusepath{draw,fill} \endpgfscope } @@ -278,7 +289,7 @@ {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}} {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}} \pgfsetcolor{\ctikzvalof{color}} - \pgfsetfillopacity{1.0} + \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0 \pgfusepath{draw,fill} \endpgfscope } @@ -331,7 +342,7 @@ \else \pgfsetfillcolor{\tikz@fillcolor} \fi - \pgfsetfillopacity{1.0} + \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0 \pgfusepath{draw,fill} \endpgfscope } diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex index 90beddf153..a7a6616cf5 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex @@ -2902,6 +2902,12 @@ \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } \anchor{south}{ \northwest \pgf@y=-\pgf@y @@ -2912,12 +2918,11 @@ \pgf@x=0pt } \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x \pgf@y=0pt } - \anchor{leftedge} - {\left - \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x - } \savedanchor\inOneFixed{% \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen @@ -2985,12 +2990,46 @@ \pgf@x=-\pgf@x } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors \anchor{south west}{ \northwest \pgf@y=-\pgf@y } \anchor{north east}{ \northwest \pgf@x=-\pgf@x } \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -3024,7 +3063,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} % Positive input terminal \pgfpathmoveto{\pgfpoint @@ -3033,7 +3072,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} % Output terminal \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} @@ -3056,6 +3095,12 @@ \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x } + \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt + } \anchor{south}{ \northwest \pgf@y=-\pgf@y @@ -3065,14 +3110,6 @@ \northwest \pgf@x=0pt } - \savedanchor\left{% - \pgf@y=0pt - } - \anchor{leftedge} - { - \left - \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x - } \savedanchor\inOneFixed{% \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen @@ -3125,6 +3162,40 @@ \left \pgf@x=-\pgf@x } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors \anchor{south west}{ \northwest \pgf@y=-\pgf@y } \anchor{north east}{ \northwest \pgf@x=-\pgf@x } \anchor{north west}{ \northwest } @@ -3156,7 +3227,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} \pgfpathmoveto{\pgfpoint {\pgf@circ@res@left} @@ -3164,7 +3235,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}} @@ -3207,6 +3278,9 @@ \northwest\pgf@x=0pt\relax } \savedanchor\left{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x \pgf@y=0pt } \savedanchor\inOneFixed{% @@ -3283,6 +3357,70 @@ \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{bout +}{ + \outline + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + } + \anchor{bout -}{ + \outline + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + \pgf@y=-\pgf@y + } + \anchor{bout up}{ + \northwest + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + } + \anchor{bout down}{ + \northwest + \pgf@xa=\pgf@x\pgf@ya=\pgf@y + \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}} + {\pgfpoint{\pgf@xa}{0pt}} + {\pgfpoint{0pt}{\pgf@ya}} + \pgf@y=-\pgf@y + } + % end border anchors \anchor{west}{ \left } @@ -3298,6 +3436,7 @@ \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x } \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y } + \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -3350,7 +3489,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} % Positive input terminal \pgfpathmoveto{\pgfpoint @@ -3359,13 +3498,13 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} % Negative output terminal label - \pgftext[right, bottom, x=3pt, y=1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup$-$\else$+$\fi} + \pgftext[right, bottom, x=3pt, y=1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} % Positive output terminal label - \pgftext[right, top, x=3pt, y=-1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup$+$\else$-$\fi} + \pgftext[right, top, x=3pt, y=-1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} \pgfsetrectcap \pgfusepath{draw} @@ -3524,6 +3663,57 @@ \outportfixed \pgf@y=-\pgf@y } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@x=-\pgf@x \pgf@y=0pt + } + \anchor{bout +}{ + \outport + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + \anchor{bout -}{ + \outport + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + \anchor{bout up}{ + \outportfixed + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + \anchor{bout down}{ + \outportfixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya + } + % end border anchors % \anchor{west}{ \left @@ -3580,7 +3770,7 @@ {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}} % - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} % input terminal down \pgfpathmoveto{\pgfpoint @@ -3590,7 +3780,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} % output leads down and up \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} @@ -3692,6 +3882,40 @@ \pgf@y=0pt \pgf@x=-\pgf@x } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors \anchor{west}{ \left } @@ -3704,10 +3928,7 @@ \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\northwest - \pgf@x=\ctikzvalof{tripoles/op amp/port width}\pgf@x - \pgfpoint{-.5\wd\pgfnodeparttextbox+.25\pgf@x}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - + \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -3743,7 +3964,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} \pgfpathmoveto{\pgfpoint @@ -3752,7 +3973,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} % @@ -3883,6 +4104,40 @@ \pgf@y=0pt \pgf@x=-\pgf@x } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors \anchor{west}{ \left } @@ -3940,7 +4195,7 @@ {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}} % - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} % Positive input terminal \pgfpathmoveto{\pgfpoint @@ -3950,7 +4205,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} % Output terminal \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} @@ -4028,17 +4283,16 @@ % you can change that with the `ra pos` key (use 0.5 for one-R). \savedanchor\raOneFixed{% \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} - \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen - \pgf@y=.5\pgf@y - \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y - \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen - \pgf@x=.5\pgf@x + \pgf@y=\pgf@circ@scaled@Rlen + \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x } \anchor{ra up}{ - \inOneFixed + \raOneFixed } \anchor{ra down}{ - \inOneFixed + \raOneFixed \pgf@y=-\pgf@y } \savedanchor\raOne{% @@ -4111,6 +4365,58 @@ \pgf@y=0pt \pgf@x=-\pgf@x } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ + \inOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra up}{ + \raOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra down}{ + \raOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra-}{ + \raOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bra+}{ + \raOne + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors \anchor{west}{ \left } @@ -4185,7 +4491,7 @@ {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}} % - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$+$\else$-$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi} % Positive input terminal \pgfpathmoveto{\pgfpoint @@ -4195,7 +4501,7 @@ \pgfpathlineto{\pgfpoint {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left} {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}} - \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup$-$\else$+$\fi} + \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi} % Output terminal \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} @@ -4240,8 +4546,18 @@ \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{bin}{ + \northwest + \pgf@y=0pt + \pgf@x=0.7\pgf@x + } + \anchor{bout}{ + \northwest + \pgf@y=0pt + \pgf@x=-0.7\pgf@x + } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -4307,6 +4623,15 @@ \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen \pgf@x=.5\pgf@x + \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi + } + \savedanchor\inOneFixed{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x } \anchor{-}{ \inOne @@ -4316,12 +4641,46 @@ \pgf@y=-\pgf@y } \anchor{in up}{ - \inOne + \inOneFixed } \anchor{in down}{ + \inOneFixed + \pgf@y=-\pgf@y + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin up}{ + \inOneFixed + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bin down}{ + \inOneFixed + \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b-}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{b+}{ \inOne \pgf@y=-\pgf@y + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors \savedanchor\up{% \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen @@ -4351,7 +4710,7 @@ \pgf@x=-\pgf@x } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -4397,6 +4756,125 @@ } } +% plain amplifier, no symbols, one input +\pgfdeclareshape{plain mono amp} +{ + \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}} + \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + } + \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x } + \anchor{west}{ \northwest \pgf@y=0pt } + \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y } + \anchor{north}{ \northwest \pgf@x=0pt } + \anchor{south west}{ \northwest \pgf@y=-\pgf@y } + \anchor{north east}{ \northwest \pgf@x=-\pgf@x } + \anchor{north west}{ \northwest } + \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } + \savedanchor\left{% + \pgf@y=0pt + } + \savedanchor\inOne{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@y=0pt\relax + } + \anchor{in}{ + \inOne + } + % support for border anchors + \savedanchor\leftedge{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x + \pgf@y=0pt + } + \anchor{leftedge}{\leftedge} + \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x } + \anchor{bin}{ + \inOne + \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya + } + \anchor{bout}{ + \leftedge + \pgf@y=0pt + \pgf@x=-\pgf@x + } + % end border anchors + \savedanchor\up{% + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y + \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen + \pgf@x=.5\pgf@x + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + \pgfpointlineattime{ + \ctikzvalof{tripoles/plain amp/up pos}}{ + \pgfpoint{ + \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {\pgf@circ@res@up}} + {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + } + \anchor{up}{ + \up + } + \anchor{down}{ + \up + \pgf@y=-\pgf@y + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + + \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + + \backgroundpath{ + \pgfsetcolor{\ctikzvalof{color}} + + \northwest + \pgf@circ@res@up = \pgf@y + \pgf@circ@res@down = -\pgf@y + \pgf@circ@res@right = -\pgf@x + \pgf@circ@res@left = \pgf@x + + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + \pgf@circ@res@step=\pgf@circ@res@right + \advance\pgf@circ@res@step by -\pgf@circ@res@left + \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgf@circ@draworfill + \endpgfscope + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@left} + {0pt}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left} + {0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}} + + \pgfusepath{draw} + } +} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% electromechanical device (motor/generator) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex index a287f7a733..5748009f13 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex @@ -57,11 +57,26 @@ \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1} -%%%%%%% -%% flipping text +%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% useful commands + +\ifpgfutil@format@is@latex + %% flipping text + \def\ctikzflipx#1{\scalebox{-1}[1]{#1}} + \def\ctikzflipy#1{\scalebox{1}[-1]{#1}} + \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}} + % text mode overbar + % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080 + \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$} +\else\ifpgfutil@format@is@plain + % text mode overbar + % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080 + \def\ctikztextnot#1{$\overline{\hbox{#1}}$} +\else\ifpgfutil@format@is@context + % text mode overbar + % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080 + \def\ctikztextnot#1{$\overline{\hbox{#1}}$} +\fi\fi\fi -\def\ctikzflipx#1{\scalebox{-1}[1]{#1}} -\def\ctikzflipy#1{\scalebox{1}[-1]{#1}} -\def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}} \endinput diff --git a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex index 37da619865..28f2535204 100644 --- a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex +++ b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex @@ -1,5 +1,5 @@ -\def\pgfcircversion{0.9.7} -\def\pgfcircversiondate{2019/12/01} +\def\pgfcircversion{1.0.0-pre1} +\def\pgfcircversiondate{2019/12/22} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} \usemodule[tikz] |