diff options
author | Karl Berry <karl@freefriends.org> | 2020-02-24 14:23:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-02-24 14:23:07 +0000 |
commit | 6f61bcc81c9a4f6081084ac212a497e35cd50692 (patch) | |
tree | e5cb6dc44cb2bfa39dc5602837225906e29a1f5e /Master/texmf-dist/tex/generic/circuitikz | |
parent | ef9ef1814cdd4608fd5602d2f3b9095fd2ff7e95 (diff) |
circuitikz (23feb20)
git-svn-id: svn://tug.org/texlive/trunk@53883 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz')
4 files changed, 137 insertions, 34 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex index f550af644bd..ae0f8ee6426 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex @@ -726,6 +726,7 @@ \ctikzset{bipoles/squid/width/.initial=.60} \ctikzset{bipoles/barrier/height/.initial=.60} \ctikzset{bipoles/barrier/width/.initial=.60} +\ctikzset{bipoles/openbarrier/gap/.initial=0.5} \ctikzset{bipoles/thermocouple/height/.initial=.250} \ctikzset{bipoles/thermocouple/height 2/.initial=.60} \ctikzset{bipoles/thermocouple/width/.initial=.140} @@ -1728,6 +1729,24 @@ \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}} \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}} +% +% Flipping arrows in LED and photodiodes +% +\newif\ifpgf@led@fliparrows +\newif\ifpgf@pd@fliparrows +\pgf@led@fliparrowsfalse +\pgf@pd@fliparrowsfalse +% +% by default the arrows start (LED) and go (PD) to the anode. +% +\ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse} +\ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse} +% +% but they can start form the cathode (LED) or go to it (PD) +% +\ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue} +\ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue} + \newif\ifpgf@circuit@strokediode \newif\ifpgf@circuit@fulldiode \pgf@circuit@strokediodefalse diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index cd4b14fcabb..a315f97806d 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -278,6 +278,27 @@ \pgf@circ@draworfill } +% +% generic crossed, suggested by Radványi Patrik Tamás <patrikradvanyi@gmail.com> +% inherit "generic" properties +% +\pgfcircdeclarebipolescaled{resistors} +{} +{\ctikzvalof{bipoles/generic/height}} +{xgeneric} +{\ctikzvalof{bipoles/generic/height}} +{\ctikzvalof{bipoles/generic/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 + % cross it + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfusepath{draw} +} %% Generic empty tunable \pgfcircdeclarebipolescaled{resistors} {} @@ -2128,6 +2149,50 @@ \endpgfscope } +% +% draw LED arrows +% +\def\pgf@circ@draw@ledarrows{% + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsend{latexslim} + \ifpgf@led@fliparrows + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}} + \pgfusepath{draw} + \else + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \fi +} +% +% ---and photodiode arrows +% +\def\pgf@circ@draw@pdarrows{% + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfsetarrowsstart{latexslim} + \ifpgf@pd@fliparrows + \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}} + \pgfusepath{draw} + \else + \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} + \pgfusepath{draw} + \fi +} %% Black light emitting diode \pgfcircdeclarebipolescaled{diodes} {} @@ -2150,15 +2215,7 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} - \pgfusepath{draw} - + \pgf@circ@draw@ledarrows } %% Black photodiode @@ -2183,14 +2240,7 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsstart{latexslim} - \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} - \pgfusepath{draw} + \pgf@circ@draw@pdarrows } %% Black varcap @@ -2355,14 +2405,7 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} - \pgfusepath{draw} + \pgf@circ@draw@ledarrows } %% Empty photodiode @@ -2382,14 +2425,7 @@ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} - \pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsstart{latexslim} - \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}} - \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}} - \pgfusepath{draw} + \pgf@circ@draw@pdarrows } %% Empty varcap @@ -5059,6 +5095,34 @@ \pgfusepath{draw} } +% +% open version of the barrier symbol +% suggested by Radványi Patrik Tamás <patrikradvanyi@gmail.com> +% +\pgfcircdeclarebipolescaled{misc} +{} +{\ctikzvalof{bipoles/barrier/height}} +{openbarrier} +{\ctikzvalof{bipoles/barrier/height}} +{\ctikzvalof{bipoles/barrier/width}} +{ + % this is set with normal wire linewidth + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + + % do the cross part + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}} + \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}} + + \pgfusepath{draw} +} %% Lamp \pgfcircdeclarebipolescaled{misc} {} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex index 337443da279..858e388363f 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex @@ -92,8 +92,10 @@ \pgfextra{ \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}} {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}} - \pgfmathround{\pgfmathresult} + % DO NOT ROUND HERE! pgfcirclabel.tex will do that when needed + % \pgfmathround{\pgfmathresult} \edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path + % \typeout{DIRECTION:\pgf@circ@direction} \pgfsyssoftpath@setcurrentpath{\myp@th} } \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}} @@ -311,6 +313,7 @@ \def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}} \def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}} \def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}} +\def\pgf@circ@xgeneric@path#1{\pgf@circ@bipole@path{xgeneric}{#1}} \def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}} \def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}} \def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}} @@ -329,6 +332,7 @@ \def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}} \def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}} \def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}} +\def\pgf@circ@openbarrier@path#1{\pgf@circ@bipole@path{openbarrier}{#1}} \def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}} \def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}} \def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}} @@ -441,6 +445,7 @@ \compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}} +\compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@xgeneric@path, l=#1}} \compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}} \compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}} \compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}} @@ -453,6 +458,7 @@ \compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}} \compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}} +\compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@openbarrier@path}} \compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}} \compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}} \compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex index 81192ba913e..2860ef9a32d 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex @@ -65,5 +65,19 @@ \def\ctikztextnot#1{$\overline{\hbox{#1}}$} \fi\fi\fi +%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% switch to use fpu in reciprocal scale transformations +%% +%% this code has been contributed by Schrödinger's cat +%% https://tex.stackexchange.com/a/529159/38080 +%% +\tikzset{use fpu reciprocal/.code={% +\def\pgfmathreciprocal@##1{% + \begingroup + \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}% + \pgfmathparse{1/##1}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}}}% \endinput |