diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-08 22:59:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-08 22:59:29 +0000 |
commit | 147bfcd0c0aafd20e8893a1be104f51602906d5e (patch) | |
tree | 5f2fa1794dd7413d2770769d9c4072909bf93f5d /Master/texmf-dist/tex/generic | |
parent | ca4dab97ce02af391dc3582183a1c50d5709535f (diff) |
circuitikz (8mar17)
git-svn-id: svn://tug.org/texlive/trunk@43430 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
6 files changed, 313 insertions, 98 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex index 4c962cdc74c..828a7af89ee 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex @@ -186,6 +186,8 @@ \ctikzset{bipoles/battery/width/.initial=.3} \ctikzset{bipoles/battery1/height/.initial=.6} \ctikzset{bipoles/battery1/width/.initial=.3} +\ctikzset{bipoles/battery2/height/.initial=.6} +\ctikzset{bipoles/battery2/width/.initial=.3} \ctikzset{bipoles/diode/height/.initial=.50} \ctikzset{bipoles/diode/width/.initial=.40} \ctikzset{bipoles/varcap/height/.initial=.50} @@ -222,8 +224,14 @@ \ctikzset{bipoles/tfullgeneric/width/.initial=.80} \ctikzset{bipoles/fullgeneric/height/.initial=.30} \ctikzset{bipoles/fullgeneric/width/.initial=.80} -\ctikzset{bipoles/open/height/.initial=.25} -\ctikzset{bipoles/open/width/.initial=.8} +\ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages +\ctikzset{bipoles/open/voltage/straight label distance/.initial=0} +\ctikzset{bipoles/open/voltage/distance from node/.initial=.2} +\ctikzset{bipoles/short/height/.initial=0} %dummy height for voltage positioning +\ctikzset{bipoles/short/width/.initial=0} %dummy width for voltage positioning +%\ctikzset{bipoles/short/voltage/straight label distance/.initial=.2} +%\ctikzset{bipoles/short/voltage/distance from node/.initial=.5} \ctikzset{bipoles/ammeter/height/.initial=.60} \ctikzset{bipoles/ammeter/width/.initial=.60} \ctikzset{bipoles/ohmmeter/height/.initial=.60} @@ -791,11 +799,13 @@ \ctikzset{bipole/nodes/left/empty/.code={\ctikzsetvalof{bipole/nodes/left}{empty}}} \ctikzset{bipole/nodes/left/full/.code={\ctikzsetvalof{bipole/nodes/left}{full}}} \ctikzset{bipole/nodes/left/diamond/.code={\ctikzsetvalof{bipole/nodes/left}{diamond}}} +\ctikzset{bipole/nodes/left/rectjoinfill/.code={\ctikzsetvalof{bipole/nodes/left}{rectjoinfill}}} \ctikzset{bipole/nodes/right/.is choice} \ctikzset{bipole/nodes/right/none/.code={\ctikzsetvalof{bipole/nodes/right}{none}}} \ctikzset{bipole/nodes/right/empty/.code={\ctikzsetvalof{bipole/nodes/right}{empty}}} \ctikzset{bipole/nodes/right/full/.code={\ctikzsetvalof{bipole/nodes/right}{full}}} \ctikzset{bipole/nodes/right/diamond/.code={\ctikzsetvalof{bipole/nodes/right}{diamond}}} +\ctikzset{bipole/nodes/right/rectjoinfill/.code={\ctikzsetvalof{bipole/nodes/right}{rectjoinfill}}} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index a66e907e656..28470321cd8 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -329,7 +329,7 @@ } -%% Battery 1 +%% Battery 1 % poles with equl thickness \pgfcircdeclarebipole{}{\ctikzvalof{bipoles/battery1/height}}{battery1}{\ctikzvalof{bipoles/battery1/height}}{\ctikzvalof{bipoles/battery1/width}}{ \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} @@ -344,15 +344,29 @@ \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} - + \pgfusepath{draw} +} +%% Battery 2 % negative pole thicker +\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/battery2/height}}{battery2}{\ctikzvalof{bipoles/battery2/height}}{\ctikzvalof{bipoles/battery2/width}}{ + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}} + \pgfusepath{draw} + \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} + \pgfsetlinewidth{3\pgflinewidth} + \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}} \pgfusepath{draw} } - %% cute inductor \pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cuteinductor/lower coil height}}{cuteinductor}{\ctikzvalof{bipoles/cuteinductor/height}}{\ctikzvalof{bipoles/cuteinductor/width}}{ @@ -422,10 +436,10 @@ \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}} + { \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } \pgfsetbuttcap \pgfsetbeveljoin \pgfusepath{stroke} @@ -443,10 +457,10 @@ \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@Rlen \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases + \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}} + { \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} - \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other} + } \pgfsetbuttcap \pgfsetbeveljoin \pgfusepath{stroke} @@ -875,8 +889,16 @@ \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}} \pgfusepath{draw} \pgfscope - \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} - \pgfnode{currarrow}{center}{}{}{\pgfusepath{draw}} + \ifpgf@circ@oldvoltagedirection + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \else + \ifpgf@circuit@bipole@current@backward + \pgftransformshift{\pgfpoint{-.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \pgftransformrotate{180} + \else + \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}} + \fi\fi + \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}} \endpgfscope } @@ -1719,6 +1741,16 @@ \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=diamond}} \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=diamond}} +\ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}} +\ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=full}} +\ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=empty}} +\ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamond}} +\ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} +\ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}} + \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}} @@ -1727,29 +1759,41 @@ \def\drawpoles{ \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{diamond} } \ifx\pgf@temp\pgf@circ@temp - { (\tikztostart) node[diamondpole] {} } + (\tikztostart) node[diamondpole] {} \else - \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{empty} } + \pgfextra{ \def\pgf@temp{empty} } \ifx\pgf@temp\pgf@circ@temp - { (\tikztostart) node[ocirc] {} } + (\tikztostart) node[ocirc] {} \else - \pgfextra{ \def\pgf@temp{full} } - \ifx\pgf@temp\pgf@circ@temp - { (\tikztostart) node[circ] {} } + \pgfextra{ \def\pgf@temp{full} } + \ifx\pgf@temp\pgf@circ@temp + (\tikztostart) node[circ] {} + \else + \pgfextra{ \def\pgf@temp{rectjoinfill} } + \ifx\pgf@temp\pgf@circ@temp + (\tikztostart) node[rectjoinfill] {} + \else + \fi \fi \fi \fi \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} \def\pgf@temp{diamond} } \ifx\pgf@temp\pgf@circ@temp - { (\tikztotarget) node[diamondpole] {} } + (\tikztotarget) node[diamondpole] {} \else - \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} \def\pgf@temp{empty} } + \pgfextra{ \def\pgf@temp{empty} } \ifx\pgf@temp\pgf@circ@temp - { (\tikztotarget) node[ocirc] {} } + (\tikztotarget) node[ocirc] {} \else - \pgfextra{ \def\pgf@temp{full} } - \ifx\pgf@temp\pgf@circ@temp - { (\tikztotarget) node[circ] {} } + \pgfextra{ \def\pgf@temp{full} } + \ifx\pgf@temp\pgf@circ@temp + (\tikztotarget) node[circ] {} + \else + \pgfextra{ \def\pgf@temp{rectjoinfill} } + \ifx\pgf@temp\pgf@circ@temp + (\tikztotarget) node[rectjoinfill] {} + \else + \fi \fi \fi \fi @@ -1757,23 +1801,6 @@ - - - - - - - - - - - - - - - - - %% Lamp \pgfcircdeclarebipole{}{\ctikzvalof{bipoles/lamp/height}}{lamp}{\ctikzvalof{bipoles/lamp/height}}{\ctikzvalof{bipoles/lamp/width}}{ diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex index 38dee46769c..2af7aaa9e78 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex @@ -47,29 +47,33 @@ %% Generic bipole path \def\pgf@circ@bipole@path#1#2{ - \pgfextra{ + +\pgfextra{ \ctikzset{bipole/kind = #1} - \edef\pgf@temp{\pgfkeysvalueof{/tikz/circuitikz/bipole/name}} + \edef\pgf@temp{\ctikzvalof{bipole/name}} \def\pgf@circ@temp{} \ifx\pgf@temp\pgf@circ@temp % if it has not a name \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999} \ctikzset{bipole/name = #2\pgf@circ@rand} % create it \fi - - \def\pgf@temp{open} - \def\pgf@circ@temp{#1} + \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates } - (\tikztostart) coordinate (\ctikzvalof{bipole/name}start) + (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relativ start/end or constructions like ((node1)-|(node2)) (\tikztotarget) coordinate (\ctikzvalof{bipole/name}end) \pgfextra{ \pgf@circ@slope{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}} {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}} - \edef\pgf@circ@direction{\pgfmathresult} + \edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path + \pgfsyssoftpath@setcurrentpath{\myp@th} } - - ($(\tikztostart) ! .5 ! (\tikztotarget)$) + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open + \else + --($(\ctikzvalof{bipole/name}start) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?) + \fi + ($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node node[#1shape, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name}) {} \ifpgf@circuit@bipole@inverted @@ -89,33 +93,40 @@ coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right) \fi \fi + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} \ifx\pgf@temp\pgf@circ@temp % if it is an open \else \ifpgf@circuit@bipole@strokedsymbol%draw line thrue symbol(e.g. diodes) \ifcsname pgf@anchor@#1shape@strokepathstart\endcsname%if special path-anchors are defined, use them! - (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.strokepathstart) + (\ctikzvalof{bipole/name}start.center) -- (\ctikzvalof{bipole/name}.strokepathstart) (\ctikzvalof{bipole/name}.strokepathend) -- (\ctikzvalof{bipole/name}end.center) \else - (\ctikzvalof{bipole/name}start.center)--(\ctikzvalof{bipole/name}end.center) + (\ctikzvalof{bipole/name}start.center) -- (\ctikzvalof{bipole/name}end.center) \fi \else - (\ctikzvalof{bipole/name}start.center) --(anchorstartnode) + (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode) (anchorendnode) -- (\ctikzvalof{bipole/name}end.center) - \fi \fi - + \drawpoles \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi - \drawpoles \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi + \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} + \ifx\pgf@temp\pgf@circ@temp % if it is an open + (\ctikzvalof{bipole/name}end)%Move to end of path + \else + ($(\ctikzvalof{bipole/name}end) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}start)$) -- (\ctikzvalof{bipole/name}end)%ugly workaround to get correct linejoins(node breaks path?) + %tikztostart and tikztotarget could not be used, because it would break if target coordinate is something like (node1-|node2) + + \fi % reset \pgfextra{ \pgfcircresetpath } - (\tikztotarget) \tikztonodes % e si continua + \tikztonodes%draw pending nodes an path } @@ -133,7 +144,8 @@ \def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}} \def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}} \def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}} -\def\pgf@circ@battery1@path#1{\pgf@circ@bipole@path{battery1}{#1}} +\def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}} +\def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}} \def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} \def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}} \def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}} @@ -285,7 +297,8 @@ \compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}} \compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}} \compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} -\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery1@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} +\compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}} \compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}} \compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}} \compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}} @@ -662,4 +675,4 @@ \pgf@circ@definetranspath{pigbt} \pgf@circ@definetranspath{nigbt} \pgf@circ@definetranspath{Lpigbt} -\pgf@circ@definetranspath{Lnigbt}
\ No newline at end of file +\pgf@circ@definetranspath{Lnigbt} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex index 3f5091a6ea2..07a8ce6be06 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex @@ -115,12 +115,40 @@ } } +%% Fill for correct rectangular joins + +\pgfdeclareshape{rectjoinfill}{ + \anchor{center}{ + \pgfpointorigin + } + \anchorborder{ + \pgf@circ@res@left=\pgf@x + \pgf@circ@res@up=\pgf@y + } + \behindforegroundpath{ + \pgfscope + \pgfpathrectanglecorners + {\pgfpoint{0}{.5\pgflinewidth}} + {\pgfpoint{0}{-.5\pgflinewidth}} + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}} + \pgfusepath{draw,fill} + \endpgfscope + } +} + + %% Current arrow \pgfdeclareshape{currarrow}{ \anchor{center}{ \pgfpointorigin } + \anchor{tip}{ + \pgfpointorigin + \pgf@circ@res@step = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \divide \pgf@circ@res@step by 16 + \pgf@x =\pgf@circ@res@step + } \behindforegroundpath{ \pgfscope diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex index 255aa335f0e..b98af8b9123 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex @@ -738,13 +738,14 @@ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathclose \pgfusepath{draw} \pgfpathellipse {\pgfpoint{\pgf@circ@res@step-.5\pgf@circ@res@other}{0pt}} {\pgfpoint{.5\pgf@circ@res@other}{0pt}} {\pgfpoint{0pt}{.5\pgf@circ@res@other}} - \pgfusepath{draw} + \pgfsetfillcolor{white} + \pgfusepath{draw,fill} \endpgfscope \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} @@ -769,7 +770,111 @@ } } - +\pgfdeclareshape{schmitt} + { + \anchor{center}{\pgfpointorigin} + \savedanchor\northwest{% + \pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/height}\pgf@y + \pgf@y=.5\pgf@y + \pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length} + \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/width}\pgf@x + \pgf@x=.5\pgf@x + } + \savedanchor\left{% + \pgf@y=0pt + } + \anchor{in}{ + \northwest + \pgf@y=0pt + } + \anchor{out}{ + \northwest + \pgf@y=0pt + \pgf@x=-\pgf@x + } + \anchor{center}{ + \pgfpointorigin + } + \anchor{east}{ + \left + \pgf@x=-.8\pgf@x + } + \anchor{west}{ + \left + } + \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 + } + \backgroundpath{ + \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/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 + + \pgf@circ@res@other = \pgfkeysvalueof{/tikz/circuitikz/bipoles/not port/circle width}\pgf@circ@res@right + + \pgfscope + \pgfsetlinewidth{2\pgflinewidth} + \pgftransformxshift{.7\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=.7\pgf@circ@res@step + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} + \pgfpathclose + \pgfusepath{draw} + \endpgfscope + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}} + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + %draw inner shape + + \pgfsetlinewidth{2\pgflinewidth} + + \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}} + \pgfusepath{draw} + + } + } @@ -3235,22 +3340,29 @@ \pgfpointorigin } \anchor{anode}{ - \northwest - \pgf@circ@res@step= \pgf@y - \pgfpointorigin - \pgfpathmoveto{ \pgfpointpolar{-90}{\pgf@circ@res@step}} + \northwest + \pgf@x=0pt + \pgf@y=-\pgf@y } \anchor{cathode1}{ \northwest - \pgf@circ@res@step= \pgf@y - \pgfpointorigin - \pgfpathmoveto{ \pgfpointpolar{105}{\pgf@circ@res@step}} + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(105)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(105)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture } \anchor{cathode2}{ \northwest - \pgf@circ@res@step= \pgf@y - \pgfpointorigin - \pgfpathmoveto{ \pgfpointpolar{75}{\pgf@circ@res@step}} + \pgf@circ@res@step=\pgf@y + \pgfmathparse{cos(75)} + \pgf@x=\pgfmathresult\pgf@circ@res@step + \pgfmathparse{sin(75)} + \pgf@y=\pgfmathresult\pgf@circ@res@step + %\pgfpointorigin + %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture } \anchor{text}{ \pgfpointorigin diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex index 5a944419fd8..a9322362709 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircvoltage.tex @@ -90,16 +90,26 @@ \def\pgf@circ@drawvoltagegeneric{ \pgfextra{ + + + \edef\pgf@temp{/tikz/circuitikz/bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance} + \pgfkeysifdefined{\pgf@temp} + { \edef\partwidth{\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/voltage/straight label distance}} + \def\tmpdistfromline{\partwidth\pgf@circ@Rlen}} + { + \edef\partwidth{0.5*\ctikzvalof{bipoles/\pgfkeysvalueof{/tikz/circuitikz/bipole/kind}/height}} + \def\tmpdistfromline{(\partwidth\pgf@circ@Rlen+0.2\pgf@circ@Rlen)} + } \ifnum \ctikzvalof{mirror value}=-1 \ifpgf@circuit@bipole@inverted \ifpgf@circuit@bipole@voltage@straight - \def\distfromline{\eudist} + \def\distfromline{\tmpdistfromline} \else \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} \fi \else \ifpgf@circuit@bipole@voltage@straight - \def\distfromline{-\eudist} + \def\distfromline{-\tmpdistfromline} \else \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} \fi @@ -107,13 +117,13 @@ \else \ifpgf@circuit@bipole@inverted \ifpgf@circuit@bipole@voltage@straight - \def\distfromline{-\eudist} + \def\distfromline{-\tmpdistfromline} \else \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} \fi \else \ifpgf@circuit@bipole@voltage@straight - \def\distfromline{\eudist} + \def\distfromline{\tmpdistfromline} \else \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@Rlen} \fi @@ -136,11 +146,17 @@ { \edef\bumpb{\ctikzvalof{voltage/bump b}} } } + % %\pgfkeysvalueof{/tikz/circuitikz/bipoles/length}/16 is equal to the length of the currarrow + coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}/16 ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorstartnode)$) - coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \distacefromnode ! (anchorstartnode)$) + coordinate (pgfcirc@Vfrom) at ($(pgfcirc@midtmp) ! -\distfromline ! \pgf@circ@voltage@angle:(anchorstartnode)$) - coordinate (pgfcirc@mid) at ($(\tikztotarget) ! \distacefromnode ! (anchorendnode)$) - coordinate (pgfcirc@Vto) at ($(pgfcirc@mid) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$) + coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}/16 ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead + coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distacefromnode ! (anchorendnode)$) + + coordinate (pgfcirc@Vto) at ($(pgfcirc@midtmp) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$) + \ifpgf@circuit@bipole@voltage@below coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$) @@ -153,9 +169,9 @@ \ifpgf@circuit@europeanvoltage \ifpgf@circuit@bipole@voltage@straight \ifpgf@circuit@bipole@voltage@backward - (pgfcirc@Vto) --(pgfcirc@Vfrom) node[currarrow, sloped, allow upside down, pos=1] {} + (pgfcirc@Vto) --(pgfcirc@Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} \else - (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1] {} + (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {} \fi \else @@ -194,18 +210,18 @@ \def\pgf@circ@drawvoltagegenerator{ \ifpgf@circuit@bipole@voltage@below - coordinate (pgfcirc@Vcont1) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-120)$) - coordinate (pgfcirc@Vcont2) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-60)$) + coordinate (pgfcirc@Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-120)$) + coordinate (pgfcirc@Vto) at ($(\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.-60)$) \else - coordinate (pgfcirc@Vcont1) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.120)$) - coordinate (pgfcirc@Vcont2) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.60)$) + coordinate (pgfcirc@Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.120)$) + coordinate (pgfcirc@Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \ctikzvalof{voltage/bump a} ! (\ctikzvalof{bipole/name}.60)$) \fi \ifpgf@circuit@europeanvoltage \ifpgf@circuit@bipole@voltage@backward - (pgfcirc@Vcont2) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vcont1) + (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vfrom) \else - (pgfcirc@Vcont1) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vcont2) + (pgfcirc@Vfrom) -- node[currarrow, sloped, allow upside down, pos=1] {} (pgfcirc@Vto) \fi \else % american voltage @@ -213,9 +229,9 @@ \ifpgf@circuit@bipole@voltageoutsideofsymbol % if it is a battery, must put + and - \ifpgf@circuit@bipole@voltage@backward - (pgfcirc@Vcont1) node {$-$} (pgfcirc@Vcont2) node {$+$} + (pgfcirc@Vfrom) node {$-$} (pgfcirc@Vto) node {$+$} \else - (pgfcirc@Vcont1) node {$+$} (pgfcirc@Vcont2) node {$-$} + (pgfcirc@Vfrom) node {$+$} (pgfcirc@Vto) node {$-$} \fi \fi @@ -321,14 +337,23 @@ \pgf@circ@drawvoltagegeneric \fi - - - (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where) + % (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where) %Zeile sinnlos!? + \ifpgf@circuit@bipole@voltage@straight + coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $) + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] + at (Vlab) { \pgf@circ@finallabels{voltage/label} } + \else coordinate (Vlab) at ($(\ctikzvalof{bipole/name}.center) ! - \ifpgf@circuit@europeanvoltage\eudist\else\ctikzvalof{voltage/american label distance}\fi ! + \ifpgf@circuit@europeanvoltage + \eudist + \else + \ctikzvalof{voltage/american label distance} + \fi ! (\ctikzvalof{bipole/name}.\pgf@circ@bipole@voltage@label@where)$) - node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=0] - at (Vlab) { \pgf@circ@finallabels{voltage/label} } -} + node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt] + at (Vlab) { \pgf@circ@finallabels{voltage/label} } + + \fi + }%end drawvoltages \endinput |