diff options
Diffstat (limited to 'graphics/pgf/contrib/circuitikz/tex')
6 files changed, 397 insertions, 124 deletions
diff --git a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty index 69ce1bbddd..4f5ce00a0f 100644 --- a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty +++ b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty @@ -16,8 +16,8 @@ \providecommand\DeclareRelease[3]{} \providecommand\DeclareCurrentRelease[2]{} -\def\pgfcircversion{1.6.8} -\def\pgfcircversiondate{2024/05/05} +\def\pgfcircversion{1.7.0} +\def\pgfcircversiondate{2024/08/03} \DeclareRelease{0.4}{2012/12/20}{circuitikz-0.4-body.tex} \DeclareRelease{v0.4}{2012/12/20}{circuitikz-0.4-body.tex} diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex index 943745bf7a..cca735bf1e 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex @@ -266,6 +266,58 @@ % %>>> +%% check loaded TikZ/pgf version %<<<` +% +% parse the release date, thanks to Skillmon +% https://github.com/pgf-tikz/pgf/issues/1348#issuecomment-2231681032 +% date can be yyyy-mm-dd or (older TikZ) yyyy/mm/dd +\begingroup + \pgfutil@protected\def\parsedate#1% + {% + \afterassignment\parsedate@month + \pgf@circ@count@a=#1\relax + } + \pgfutil@protected\def\parsedate@month#1% + {% + \afterassignment\parsedate@day + \pgf@circ@count@b=% + } + \pgfutil@protected\def\parsedate@day#1% + {% + \afterassignment\parsedate@cleanup + \pgf@circ@count@c=% + } + \def\parsedate@cleanup#1\relax{}% + \parsedate{\pgfrevisiondate}% + \xdef\ctikz@@pgfyear{\the\pgf@circ@count@a}% + \xdef\ctikz@@pgfmonth{\the\pgf@circ@count@b}% + \xdef\ctikz@@pgfday{\the\pgf@circ@count@c}% +\endgroup +% The following code thanks to Skillmon: +% https://tex.stackexchange.com/a/722570/38080 +% modified by romano to check the date +\def\ctikz@@ifpgfafter@auxi#1#2% + {% + \ifnum#1 + \ctikz@@ifpgfafter@auxii{#2}% + \fi + } +\def\ctikz@@ifpgfafter@auxii#1\fi#2\ctikz@@ifpgfafter#3{\fi#1} +\def\ctikz@@ifpgfafter#1-#2-#3#% + {% + \ctikz@@ifpgfafter@auxi{\ctikz@@pgfyear>#1}\pgfutil@firstoftwo + \ctikz@@ifpgfafter@auxi{\ctikz@@pgfyear<#1}\pgfutil@secondoftwo + \ctikz@@ifpgfafter@auxi{\ctikz@@pgfmonth>#2}\pgfutil@firstoftwo + \ctikz@@ifpgfafter@auxi{\ctikz@@pgfmonth<#2}\pgfutil@secondoftwo + \ctikz@@ifpgfafter@auxi{\ctikz@@pgfday<#3}\pgfutil@secondoftwo + \pgfutil@gobble\ctikz@@ifpgfafter\pgfutil@firstoftwo + } +% +% usage \ctikz@@ifpgfafter 2023-01-16{true}{false} +% ^^^ no spaces here, braces needed. +% +%>>> + %% arrow tips macros and utilities %<<<1 % the default arrow is latexslim, which has been ported over old arrows library (deprecated) @@ -298,9 +350,70 @@ \pgfpathclose \pgfusepathqfill } - \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim} - +%% Jack Tap, see +%% https://github.com/circuitikz/circuitikz/issues/806 +\pgfdeclarearrow{name=Jack Tap, + parameters = {% + \the\pgfarrowlength,% + \the\pgfarrowwidth,% + \ifpgfarrowswap s\fi% + \ifpgfarrowopen o\fi% + \ifpgfarrowroundjoin j\fi + \ifpgfarrowroundcap c\fi% + }, + setup code = { + \pgfarrowssettipend{.5\pgfarrowlength} + \pgfarrowssetlineend{-.6\pgfarrowlength} + \pgfarrowssetvisualbackend{-.6\pgfarrowlength} + \pgfarrowssetbackend{-.6\pgfarrowlength} + % hull + \pgfarrowshullpoint{.5\pgfarrowlength}{0pt} + \pgfarrowshullpoint{0pt}{\pgfarrowwidth} + \pgfarrowshullpoint{-.6\pgfarrowlength}{0pt} + % Saves: Only the length: + \pgfarrowssavethe\pgfarrowlength + \pgfarrowssavethe\pgfarrowwidth + }, + drawing code = { + \pgfsetdash{}{+0pt} + \pgfarrowlinewidth=\pgflinewidth + \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi + \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi + \pgfpathmoveto{\pgfqpoint{-.6\pgfarrowlength}{0pt}} + \pgfpathlineto{\pgfqpoint{-.5\pgfarrowlength}{0pt}} + \pgfpathlineto{\pgfqpoint{0pt}{\pgfarrowwidth}} + \pgfpathlineto{\pgfqpoint{.5\pgfarrowlength}{0pt}} + \ifpgfarrowopen + \pgfusepathqstroke + \else + \pgfpathclose + \ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi + \fi + }, + defaults = {length = 0.3cm, width=0.15cm, open}, + % cache=false, % breaks everything +} +% the new "fill without arg" will be in TikZ 3.1.11. Apply it here if we have an +% older version +\ctikz@@ifpgfafter 2023-01-16{\relax}{% + % thanks @muzimuzhi https://github.com/pgf-tikz/pgf/issues/1348#issuecomment-2229075269 + % undo the fill/.value required key + \expandafter\let\csname pgfk@/pgf/arrow keys/fill/.@def\endcsname\@undefined + \pgfkeys{/pgf/arrow keys/fill/.code={% + \def\pgf@temp{#1}% + \ifx\pgf@temp\pgf@nonetext% + \pgfarrowsaddtooptions{\pgfarrowopentrue}% + \else\ifx\pgf@temp\pgfkeysnovalue@text% + \pgfarrowsaddtooptions{\pgfarrowopenfalse}% + \else + \pgfarrowsaddtooptions{\pgfarrowopenfalse\def\pgf@arrows@fill@color{#1}}% + \fi\fi + }}% +} +\tikzset{v/.tip={Jack Tap[swap]}, ^/.tip={Jack Tap}, + vf/.tip={Jack Tap[swap,fill]}, ^f/.tip={Jack Tap[fill]}} +% % select the arrows using available defaults. \def\pgfcirc@arrow@default{default} % choose the arrows to use. Use #2 and #3 if the key is equal to "default" @@ -466,7 +579,30 @@ \fi \fi } - +% similar o the above, use the fill parameter to set fill or draw +% for a subset of the shape +\def\pgf@circ@subset@fill@or@draw#1{% + % You *must* be sure that this is called inside a \pgfscope! + \edef\@@none{none}\edef\@@default{default} + \edef\@@tmp{\ctikzvalof{#1/fill}} + \ifx\@@tmp\@@none + \pgfusepath{draw} + \else + \ifx\@@tmp\@@default\else + \pgfsetfillcolor{\@@tmp} + \fi + \pgfusepath{draw, fill} + \fi +} +% ...and for the thickness +\def\pgf@circ@subset@thickness#1{% + % You *must* be sure that this is called inside a \pgfscope! + \edef\@@default{default} + \edef\@@tmp{\ctikzvalof{#1/thickness}} + \ifx\@@tmp\@@default\else + \pgfsetlinewidth{\@@tmp\pgflinewidth}% + \fi +} % set the text color (via \color) if the color is not default or none % needed in some strange case (like bodydiode' dots) \def\pgf@circ@maybe@color#1{% @@ -557,6 +693,7 @@ % #7 - macros drawing the bipole % \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{ + % \typeout{Declaring bipole:\space #4,} \pgfdeclareshape{#4shape}{ \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}} \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} @@ -602,97 +739,33 @@ \pgf@y=.5\pgf@y } \anchor{center}{\pgfpointorigin} - \anchor{n}{ - \northeast - \pgf@x=0cm - } - \anchor{north east}{ - \northeast - } - \anchor{north west}{ - \northeast - \pgf@x=-\pgf@x - } - \anchor{ne}{ - \northeast - } - \anchor{nw}{ - \northeast - \pgf@x=-\pgf@x - } - \anchor{e}{ - \northeast - \pgf@y=0cm - } - \anchor{s}{ - \southwest - \pgf@x=0cm - } - \anchor{south east}{ - \southwest - \pgf@x=-\pgf@x - } - \anchor{south west}{ - \southwest - } - \anchor{se}{ - \southwest - \pgf@x=-\pgf@x - } - \anchor{sw}{ - \southwest - } - \anchor{w}{ - \southwest - \pgf@y=0cm - } - \anchor{north}{ - \northeast - \pgf@x=0cm - } - \anchor{east}{ - \northeast - \pgf@y=0cm - } - \anchor{south}{ - \southwest - \pgf@x=0cm - } - \anchor{west}{ - \southwest - \pgf@y=0cm - } - \anchor{right}{ - \northeast - \pgf@y=0cm - } - \anchor{above}{ - \northeast - \pgf@x=0cm - } - \anchor{left}{ - \southwest - \pgf@y=0cm - } - \anchor{below}{ - \southwest - \pgf@x=0cm - } - \anchor{a}{ - \northeast - \pgf@y=0cm - } - \anchor{b}{ - \southwest - \pgf@y=0cm - } + \anchor{n}{\northeast\pgf@x=0cm } + \anchor{north east}{\northeast} + \anchor{north west}{\northeast\pgf@x=-\pgf@x} + \anchor{ne}{\northeast} + \anchor{nw}{\northeast\pgf@x=-\pgf@x} + \anchor{e}{\northeast\pgf@y=0cm } + \anchor{s}{\southwest\pgf@x=0cm } + \anchor{south east}{\southwest\pgf@x=-\pgf@x} + \anchor{south west}{\southwest} + \anchor{se}{\southwest\pgf@x=-\pgf@x} + \anchor{sw}{\southwest} + \anchor{w}{\southwest\pgf@y=0cm } + \anchor{north}{\northeast\pgf@x=0cm } + \anchor{east}{\northeast\pgf@y=0cm } + \anchor{south}{\southwest\pgf@x=0cm } + \anchor{west}{\southwest\pgf@y=0cm } + \anchor{right}{\northeast\pgf@y=0cm } + \anchor{above}{\northeast\pgf@x=0cm } + \anchor{left}{\southwest\pgf@y=0cm } + \anchor{below}{\southwest\pgf@x=0cm } + \anchor{a}{\northeast\pgf@y=0cm } + \anchor{b}{\southwest\pgf@y=0cm } \savedanchor{\textanchor}{% \pgf@y=\ht\pgfnodeparttextbox \pgf@x=-.5\wd\pgfnodeparttextbox } - \anchor{text}{ - \textanchor - } + \anchor{text}{ \textanchor } \anchorborder{% \ifpgf@circuit@bipole@inverted \pgf@circ@res@left=-\pgf@x @@ -711,7 +784,6 @@ #2% \pgf@circ@draw@component{ \pgf@circ@setcolor - \northeast \pgf@circ@res@up = \pgf@y \pgf@circ@res@zero = 0cm diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex index 4978311dca..b30e741458 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex @@ -632,13 +632,21 @@ \pgfusepath{draw} \endpgfscope }% - %% Zig-zag resistors +% see https://github.com/circuitikz/circuitikz/discussions/814 +\ctikzset{resistors/zigzag stub/.initial=0} +\ctikzset{resistors/zigzag hook/.code={}} \def\pgf@circ@zigzag#1{% + \pgf@circ@res@temp=\ctikzvalof{resistors/zigzag stub}\pgf@circ@res@step + \advance \pgf@circ@res@step by -2\pgf@circ@res@temp \divide \pgf@circ@res@step by \numexpr4*\zigs\relax \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \ifdim\pgf@circ@res@temp>0pt + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp -\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \fi \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@temp \pgf@circ@count@a=\zigs\relax % first half zig \advance\pgf@circ@res@other by \pgf@circ@res@step @@ -655,11 +663,14 @@ \advance\pgf@circ@res@other by 2\pgf@circ@res@step \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}} \advance\pgf@circ@res@other by \pgf@circ@res@step - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \ifdim\pgf@circ@res@temp>0pt + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other+\pgf@circ@res@temp+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \fi \pgfsetbeveljoin + \pgfkeys{/tikz/circuitikz/resistors/zigzag hook} \pgfusepath{draw} } - %% Resistor \pgfcircdeclarebipolescaled{resistors} { @@ -672,7 +683,7 @@ { \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen} \pgf@circ@zigzag{1} } @@ -692,7 +703,7 @@ { \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen} \pgf@circ@zigzag{.5} \pgfscope @@ -731,7 +742,7 @@ { \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen} \pgf@circ@zigzag{1} \pgfscope @@ -761,7 +772,7 @@ {% \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen} \pgf@circ@zigzag{.5} \pgfscope @@ -810,7 +821,7 @@ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right/\@@intscale+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}} \pgftransformationadjustments - \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/ldresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth} + \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/ldresistor/width}*\scaledRlen} \pgf@circ@zigzag{\@@hscale} }% @@ -3696,9 +3707,9 @@ \pgf@circuit@fulldiodefalse \ctikzset{diode/.is choice} -\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default -\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue } -\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue} +\ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default +\ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue\pgf@circuit@strokediodefalse} +\ctikzset{diode/stroke/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodetrue} \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}} \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}} @@ -6031,6 +6042,13 @@ \ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5} \ctikzset{bipoles/iloop/width/.initial=.40} \ctikzset{bipoles/iloop/height/.initial=.60} +% currtap see https://github.com/circuitikz/circuitikz/issues/807 +\ctikzset{bipoles/currtap/height/.initial=0.4} +\ctikzset{bipoles/currtap/dot size/.initial=0.5} +\ctikzset{bipoles/currtap/fill/.initial=default} +\ctikzset{bipoles/currtap/dash/.initial=none} +\ctikzset{bipoles/currtap/color/.initial=default} +\ctikzset{bipoles/currtap/thickness/.initial=default} \ctikzset{bipoles/oscope/height/.initial=.60} \ctikzset{bipoles/oscope/width/.initial=.60} @@ -6607,6 +6625,28 @@ \pgfusepath{draw} \endpgfscope } +%% currtap +\pgfcircdeclarebipolescaled{instruments} +{ + \savedmacro{\@@dotsize}{\def\@@dotsize{\ctikzvalof{bipoles/currtap/dot size}}} + \anchor{tap}{\northeast\pgf@x=0pt\pgf@y=\@@dotsize\pgf@y\pgf@y=-\pgf@y} +} +{\ctikzvalof{bipoles/currtap/height}} +{currtap} +{\ctikzvalof{bipoles/currtap/height}} +{\ctikzvalof{bipoles/currtap/height}} +{ + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@left}{0pt}} + \pgfpatharc{180}{0}{0.95\pgf@circ@res@right} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgf@circ@subset@color@dash{bipoles/currtap} + \pgf@circ@subset@thickness{bipoles/currtap} + \pgfusepath{draw} + \pgfpathcircle{\pgfpoint{0pt}{0pt}}{\@@dotsize*\pgf@circ@res@up} + \pgf@circ@subset@fill@or@draw{bipoles/currtap} +} % %>>> % Path definitions for Instruments%<<< @@ -6619,8 +6659,8 @@ \pgfcirc@activate@bipole@simple{l}{rmeterwa} \pgfcirc@activate@bipole@simple{l}{smeter} \pgfcirc@activate@bipole@simple{l}{iloop} -% \pgfcirc@activate@bipole@simple{l}{iloop2} that was wrong \pgfcirc@activate@bipole{l}{ilooptwo}{iloop2}{iloop2} +\pgfcirc@activate@bipole@simple{l}{currtap} \pgfcirc@activate@bipole@simple{l}{qvprobe} \pgfcirc@activate@bipole@simple{l}{qiprobe} \pgfcirc@activate@bipole@simple{l}{qpprobe} @@ -6774,16 +6814,22 @@ % spring into the damper \pgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgfscope + \pgftransformationadjustments \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{.95\pgf@circ@res@left}{\pgf@circ@res@zero}} \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}} + \pgfsetbuttcap + \pgfsetbeveljoin \pgfusepath{stroke} \endpgfscope + \endpgfscope % damper box \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} @@ -6977,7 +7023,7 @@ \ctikzset{bipoles/tlmic/width/.initial=.5}% it MUST be mic width *5/8 \ctikzset{bipoles/mic/bar thickness/.initial=1} -% arresters, fuses, lamps, etc +% arresters, fuses, relais, lamps, etc \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30} \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80} @@ -6994,6 +7040,7 @@ \ctikzset{bipoles/afuse/height/.initial=.20} \ctikzset{bipoles/afuse/width/.initial=.50} \ctikzset{bipoles/lamp/height/.initial=.60} +\ctikzset{bipoles/lamp/width/.initial=.60} \ctikzset{bipoles/wfuse/height/.initial=.20} \ctikzset{bipoles/wfuse/width/.initial=.50} \ctikzset{bipoles/wfuse/shape/.initial=ocirc} @@ -7001,9 +7048,22 @@ \ctikzset{bipoles/wfuse/dots/.is choice} \ctikzset{bipoles/wfuse/dots/.is if=pgf@circ@wfuse@dots} % -\ctikzset{bipoles/lamp/width/.initial=.60} +\ctikzset{bipoles/relais/height/.initial=.8} +\ctikzset{bipoles/relais/width/.initial=.3} +% \ctikzset{bipoles/bulb/height/.initial=.8} \ctikzset{bipoles/bulb/width/.initial=.8} +% suggested by @bogger33, see https://github.com/circuitikz/circuitikz/issues/793 +\ctikzset{bipoles/neonlampcc/height/.initial=.60} +\ctikzset{bipoles/neonlampac/height/.initial=.60} +\pgf@circ@declare@family@arrows{sparkgap} +\newif\ifpgf@sparkgap@dot +\newif\ifpgf@sparkgap@circle +\ctikzset{sparkgap/circle/.is if=pgf@sparkgap@circle} +\ctikzset{sparkgap/dot/.is if=pgf@sparkgap@dot} +\ctikzset{sparkgap/gap/.initial=.05} +\ctikzset{bipoles/sparkgap/height/.initial=.60} +% \ctikzset{bipoles/squid/height/.initial=.60} \ctikzset{bipoles/squid/width/.initial=.60} \ctikzset{bipoles/barrier/height/.initial=.60} @@ -7157,18 +7217,18 @@ {\ctikzvalof{bipoles/thermocouple/height}} {\ctikzvalof{bipoles/thermocouple/width}} { + \pgfsetrectcap \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} - \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} \pgfusepath{draw} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfsetroundcap + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}} + \pgfusepath{draw} } %% fuse \pgfcircdeclarebipolescaled{misc} @@ -7233,6 +7293,25 @@ \pgfnode{\cshape}{center}{}{\thisshape-right}{\pgfusepath{draw}} \fi } + +%% Relais +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/relais/height}} +{relais} +{\ctikzvalof{bipoles/relais/height}} +{\ctikzvalof{bipoles/relais/width}} +{ + \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgf@circ@draworfill + \pgfscope + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope +} + %% SQUID added by Cor Molenaar 5 March 2010 \pgfcircdeclarebipolescaled{misc} {} @@ -7340,11 +7419,116 @@ \pgfsetbeveljoin \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfusepath{draw} -}% %>>> +}% +% neon lamps, suggested by @bogger33 https://github.com/circuitikz/circuitikz/issues/793 +% implemented by Romano +% double-cathode (capacitor) style +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/neonlampcc/height}} +{neonlampcc} +{\ctikzvalof{bipoles/neonlampcc/height}} +{\ctikzvalof{bipoles/neonlampcc/height}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + %% leads in + \pgfsetlinewidth{\pgfstartlinewidth} + \def\@@w{0.2}\def\@@h{0.6} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@right}{0pt}} + %% "capacitor style" symbol + \pgfusepath{draw} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\@@w\pgf@circ@res@right}{\@@h\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@right}{\@@h\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@up}} + \pgfusepath{draw} + %% dot + \pgftransformshift{\pgfpoint{\@@w\pgf@circ@res@left-3*\ctikzvalof{nodes width}\pgf@circ@Rlen} + {\@@h\pgf@circ@res@down + 2*\ctikzvalof{nodes width}\pgf@circ@Rlen}} + \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}} +} +% anode-cathode style +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/neonlampac/height}} +{neonlampac} +{\ctikzvalof{bipoles/neonlampac/height}} +{\ctikzvalof{bipoles/neonlampac/height}} +{ + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} + \pgf@circ@draworfill + %% leads in + \pgfsetlinewidth{\pgfstartlinewidth} + \def\@@w{0.5}\def\@@h{0.5} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + %% one terminal is a straight plate + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@up}} + \pgfusepath{draw} + %% the other is an "ocirc" shape + \pgftransformshift{\pgfpoint{\@@w\pgf@circ@res@right}{0pt}} + \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw,fill}} + %% dot + \pgftransformshift{\pgfpoint{-\@@w\pgf@circ@res@right}{\@@h\pgf@circ@res@down}} + \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}} +} +% spark gap, suggested by @bogger33 https://github.com/circuitikz/circuitikz/issues/800 +\pgfcircdeclarebipolescaled{misc} +{ + \savedmacro{\changeh}{\edef\changeh{\ifpgf@sparkgap@circle 1 \else 0.5 \fi}} + \pgfcirc@border@extend@updown{\changeh}{\changeh} +} +{\ctikzvalof{bipoles/sparkgap/height}} +{sparkgap} +{\ctikzvalof{bipoles/sparkgap/height}} +{\ctikzvalof{bipoles/sparkgap/height}}{ + % circle (if requested) + \pgfscope + \ifpgf@sparkgap@circle + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@up} + \pgf@circ@draworfill + \fi + \endpgfscope + % arrows + \pgfscope + \pgfcirc@set@arrows{sparkgap}{}{Triangle[scale=2]} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{sparkgap/gap}\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{sparkgap/gap}\pgf@circ@res@left}{0pt}} + \pgfusepath{draw} + \endpgfscope{} + % dot (if requested) + \ifpgf@sparkgap@dot + \pgftransformshift{\pgfpoint + {\ctikzvalof{sparkgap/gap}\pgf@circ@res@left-1*\ctikzvalof{nodes width}\pgf@circ@Rlen} + {-4*\ctikzvalof{nodes width}\pgf@circ@Rlen}} + \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}} + \fi +} + +%>>> %% Path definitions for Miscellaneous%<<< \pgfcirc@activate@bipole@simple{l}{lamp} +\pgfcirc@activate@bipole@simple{l}{neonlampcc} +\pgfcirc@activate@bipole@simple{l}{neonlampac} +\pgfcirc@activate@bipole@simple{l}{sparkgap} \pgfcirc@activate@bipole@simple{l}{bulb} \pgfcirc@activate@bipole@simple{l}{squid} \pgfcirc@activate@bipole@simple{l}{barrier} @@ -7355,6 +7539,7 @@ \pgfcirc@style@to@style{asymmetric fuse}{afuse} \pgfcirc@activate@bipole@simple{l}{wfuse} \pgfcirc@activate@bipole{l}{wfuse}{wfuse}{wiggly fuse} +\pgfcirc@activate@bipole@simple{l}{relais} \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi} \pgfcirc@activate@bipole{l}{europeangfsurgearrester}{european gas filled surge arrester}{european gas filled surge arrester} \pgfcirc@activate@bipole{l}{americangfsurgearrester}{american gas filled surge arrester}{american gas filled surge arrester} diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex index e3665b8862..cb95f54ef3 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex @@ -231,13 +231,15 @@ \compattikzset{#2/.style={\comnpatname #1, #3={##1}}}% } % create a bipole -\def\pgfcirc@activate@bipole#1#2#3#4{% path name, base node name, style name +\def\pgfcirc@activate@bipole#1#2#3#4{% type of label, path name, base node name, style name + % \typeout{Activate bipole:\space #4,} \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}% \pgfcirc@path@to@style{#1}{#2}{#4}{}% no options here, let's see } \def\pgfcirc@activate@bipole@simple#1#2{\pgfcirc@activate@bipole{#1}{#2}{#2}{#2}} % create a bipole with options -\def\pgfcirc@activate@bipole@opt#1#2#3#4#5{% path name, base node name, style name +\def\pgfcirc@activate@bipole@opt#1#2#3#4#5{% type of label, path name, base node name, style name, options + % \typeout{Activate bipole:\space #4,} \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}% \pgfcirc@path@to@style{#1}{#2}{#4}{#5}% no options here, let's see } diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex index 7457dabb46..d8d089dd92 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex @@ -4025,6 +4025,8 @@ \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}} \pgftransformscale{\@@BDscale} \ifpgf@circuit@fulldiode + % I'm not sure why this is needed, but... + \pgf@circ@maybe@color{transistor bodydiode/color} \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} \else \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}} @@ -8613,6 +8615,11 @@ \pgf@y=\pgf@circ@res@up\advance\pgf@y by -\pgf@circ@res@right \fi } + \savedmacro{\tubes@filament@angle}{\edef\tubes@filament@angle{\ctikzvalof{tubes/filament angle}}} + \savedmacro{\tubes@filament@distance}{\edef\tubes@filament@distance{\ctikzvalof{tubes/filament distance}}} + \savedmacro{\tubes@tube@radius}{\edef\tubes@tube@radius{\ctikzvalof{tubes/tube radius}}} + \savedmacro{\tubes@cathode@width}{\edef\tubes@cathode@width{\ctikzvalof{tubes/cathode width}}} + \savedmacro{\tubes@cathode@distance}{\edef\tubes@cathode@distance{\ctikzvalof{tubes/cathode distance}}} \anchor{tube ne}{\tubene} \anchor{tubesq ne}{\tubesquarene} % tube shape anchors: geo @@ -8647,30 +8654,37 @@ \anchor{cathode}{% \northwest \pgf@y=-\pgf@y - \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + \pgf@x=\tubes@cathode@width\pgf@x } \anchor{cathode 1}{% \northwest \pgf@y=-\pgf@y - \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x + \pgf@x=\tubes@cathode@width\pgf@x } \anchor{cathode 2}{% \northwest \pgf@y=-\pgf@y - \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x + \pgf@x=-\tubes@cathode@width\pgf@x } \anchor{filament 1}{% \northwest - \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgfmathparse{(\tubes@tube@radius*sin(\tubes@filament@angle)} \pgf@x=\pgfmathresult\pgf@x \pgf@y=-\pgf@y } \anchor{filament 2}{% \northwest - \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})} + \pgfmathparse{(\tubes@tube@radius*sin(\tubes@filament@angle)} \pgf@x=-\pgfmathresult\pgf@x \pgf@y=-\pgf@y } + \anchor{filament center}{% + \northwest + \pgf@ya=0.5\pgf@y + \pgf@ya=-\tubes@cathode@distance\pgf@y + \advance\pgf@ya by -\tubes@filament@distance\pgf@y + \pgf@x=0pt\pgf@y=\pgf@ya + } % Extra anchors #2% diff --git a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex index a738c664ea..f85b8ab58b 100644 --- a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex +++ b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex @@ -16,8 +16,8 @@ \startmodule[circuitikz] \usemodule[tikz] -\def\pgfcircversion{1.6.8} -\def\pgfcircversiondate{2024/05/05} +\def\pgfcircversion{1.7.0} +\def\pgfcircversiondate{2024/08/03} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} |