diff options
author | Karl Berry <karl@freefriends.org> | 2019-12-22 21:55:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-12-22 21:55:04 +0000 |
commit | 43e0008a52cd84bc0f2940deec3a5c87f982c014 (patch) | |
tree | ef911ff0e7fd75e17b82db67f9d2b927120f852c /Master/texmf-dist/tex/generic | |
parent | 3b3666879f7acdee9e0bc770836aa3524429e165 (diff) |
circuitikz (22dec19)
git-svn-id: svn://tug.org/texlive/trunk@53208 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
7 files changed, 1055 insertions, 55 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex index 2e33283dc4b..e8be0a10810 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/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/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex index fabba4abf29..9fb6b0fe0f8 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/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/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex index b7df7e324e1..b433361e29d 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/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/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex index ab2b0d4e77a..db7becaa748 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/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/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex index 724f5ee3500..3ccf5abfcbd 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/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/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex index 90beddf1533..a7a6616cf5f 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/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/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex index a287f7a7336..5748009f135 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/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 |