From 080ac5381f901946a1b4558ef16853881a4dbcb9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 2 May 2021 20:41:58 +0000 Subject: circuitikz (2may21) git-svn-id: svn://tug.org/texlive/trunk@59054 c570f23f-e606-0410-a88d-b1316a301751 --- .../third/circuitikz/circuitikz-context.pdf | Bin 17743 -> 17727 bytes .../texmf-dist/doc/generic/circuitikz/CHANGELOG.md | 28 +- .../texmf-dist/doc/latex/circuitikz/changelog.tex | 59 ++- .../doc/latex/circuitikz/circuitikzmanual.pdf | Bin 1217358 -> 1381312 bytes .../doc/latex/circuitikz/circuitikzmanual.tex | 326 +++++++++++- .../tex/context/third/circuitikz/t-circuitikz.tex | 4 +- .../tex/generic/circuitikz/ctikzstyle-legacy.tex | 1 + .../tex/generic/circuitikz/ctikzstyle-romano.tex | 2 + .../tex/generic/circuitikz/pgfcircbipoles.tex | 577 ++++++++++++++------- .../tex/generic/circuitikz/pgfcircmultipoles.tex | 10 +- .../tex/generic/circuitikz/pgfcircquadpoles.tex | 80 +++ .../tex/generic/circuitikz/pgfcirctripoles.tex | 294 ++++++----- .../tex/generic/circuitikz/pgfcircutils.tex | 31 ++ .../texmf-dist/tex/latex/circuitikz/circuitikz.sty | 4 +- 14 files changed, 1077 insertions(+), 339 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf b/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf index 3a44fac2104..2cafb29806e 100644 Binary files a/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf and b/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf differ diff --git a/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md b/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md index 6520036c80b..a7401f0f365 100644 --- a/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md +++ b/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md @@ -1,19 +1,35 @@ The major changes among the different CircuiTikZ versions are listed here. See for a full list of changes. +* Version 1.3.5 (2021-05-02) + + Power electronics devices are the main characters in this release: PUT, GTOs, a new style for thyristors, and a photovoltaic module. + Additionally, an **experimental** support for subcircuits has been added; + it could change in the future. + Fixed a nasty bug in rotary switches "in" anchor positioning in some cases. + + - Added support for creating and using sub-circuits + - Added UJT transistors and GTO devices ([suggested by JetherReis](https://github.com/circuitikz/circuitikz/issues/522)) + - Added (as an option) a different, more compact style for thyristor-type devices. + - Added a photovoltaic module ([suggested by André Alves](https://github.com/circuitikz/circuitikz/issues/524)) + - Added a DC/DC converter block for symmetry ([suggested by Pratched](https://github.com/circuitikz/circuitikz/issues/529)) + - Added the possibility to change the waveforms shown in the oscilloscope ([suggested by Mario Tafur](https://tex.stackexchange.com/q/595062/38080)) + - In the manual, separate the component usage chapter from the big component list + - Fix wrong rotary switch "in" anchors for switches with more than 180 degrees coverage ([see bug](https://github.com/circuitikz/circuitikz/issues/532)) + * Version 1.3.4 (2021-04-20) - New things, like configurable modifier thickness, ferroelectric devices, and several transistor tweaks. Importantly, a bug that hindered compatibility with the internal Ti*k*Z `circuits` library (introduced in 1.3.3) has been fixed. + New things, like configurable modifier thickness, ferroelectric devices, and several transistor tweaks. + Importantly, a bug that hindered compatibility with the internal Ti*k*Z `circuits` library (introduced in 1.3.3) has been fixed. - Added separate configuration for the line thickness of resistors, capacitors, and inductors modifiers - - Added ferroelectric capacitors and ferroelectric gate MOS/FETs (suggested by Mayeul Cantan, https://github.com/circuitikz/circuitikz/issues/515) + - Added ferroelectric capacitors and ferroelectric gate MOS/FETs ([suggested by Mayeul Cantan](https://github.com/circuitikz/circuitikz/issues/515)) - Added an option to fill the gate gap in MOSes, FETs and IGBTs with a color - Added a "centergap" anchor for transistors - Added the option "nogate" to the `hemt` symbol - Fixed a bug in thermistors not respecting their class line thickness - - Fixes in the manual (copy and paste of snippets without numbers, correct old usage of `siunitx`, factor out repetitions in the preamble; thanks to Ulrike Fischer: - https://tex.stackexchange.com/a/57160/38080) - - Fixed a bug introduced in 1.3.3 that would reduce compatibility with the `circuits` internal library; reported by JetherReis (https://github.com/circuitikz/circuitikz/issues/519) + - Fixes in the manual (copy and paste of snippets without numbers, correct old usage of `siunitx`, factor out repetitions in the preamble; [thanks to Ulrike Fischer](https://tex.stackexchange.com/a/57160/38080). + - Fixed a bug introduced in 1.3.3 that would reduce compatibility with the `circuits` internal library; [reported by JetherReis]( https://github.com/circuitikz/circuitikz/issues/519)) * Version 1.3.3 (2021-04-04) @@ -36,7 +52,7 @@ The major changes among the different CircuiTikZ versions are listed here. See < - Added the simplified (2-waves) highpass and lowpass blocks - Added graphene FETs (suggested by Cees Keyer) - Added left/right anchors to transistors - - Fixed a bug in flip-flops (https://tex.stackexchange.com/q/587213/38080) + - Fixed a [bug in flip-flops](https://tex.stackexchange.com/q/587213/38080) * Version 1.3.1 (2021-02-20) diff --git a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex index 2cdfeeb95ff..cf46a5674fc 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex @@ -4,6 +4,48 @@ here. See \url{https://github.com/circuitikz/circuitikz/commits} for a full list of changes. \begin{itemize} +\item + Version 1.3.5 (2021-05-02) + + Power electronics devices are the main characters in this release: + PUT, GTOs, a new style for thyristors, and a photovoltaic module. + Additionally, an \textbf{experimental} support for subcircuits has + been added; it could change in the future. Fixed a nasty bug in rotary + switches ``in'' anchor positioning in some cases. + + \begin{itemize} + \tightlist + \item + Added support for creating and using sub-circuits + \item + Added UJT transistors and GTO devices + (\href{https://github.com/circuitikz/circuitikz/issues/522}{suggested + by JetherReis}) + \item + Added (as an option) a different, more compact style for + thyristor-type devices. + \item + Added a photovoltaic module + (\href{https://github.com/circuitikz/circuitikz/issues/524}{suggested + by André Alves}) + \item + Added a DC/DC converter block for symmetry + (\href{https://github.com/circuitikz/circuitikz/issues/529}{suggested + by Pratched}) + \item + Added the possibility to change the waveforms shown in the + oscilloscope + (\href{https://tex.stackexchange.com/q/595062/38080}{suggested by + Mario Tafur}) + \item + In the manual, separate the component usage chapter from the big + component list + \item + Fix wrong rotary switch ``in'' anchors for switches with more than + 180 degrees coverage + (\href{https://github.com/circuitikz/circuitikz/issues/532}{see + bug}) + \end{itemize} \item Version 1.3.4 (2021-04-20) @@ -19,8 +61,8 @@ full list of changes. capacitors, and inductors modifiers \item Added ferroelectric capacitors and ferroelectric gate MOS/FETs - (suggested by Mayeul Cantan, - https://github.com/circuitikz/circuitikz/issues/515) + (\href{https://github.com/circuitikz/circuitikz/issues/515}{suggested + by Mayeul Cantan}) \item Added an option to fill the gate gap in MOSes, FETs and IGBTs with a color @@ -33,12 +75,13 @@ full list of changes. \item Fixes in the manual (copy and paste of snippets without numbers, correct old usage of \texttt{siunitx}, factor out repetitions in the - preamble; thanks to Ulrike Fischer: - https://tex.stackexchange.com/a/57160/38080) + preamble; \href{https://tex.stackexchange.com/a/57160/38080}{thanks + to Ulrike Fischer}. \item Fixed a bug introduced in 1.3.3 that would reduce compatibility with - the \texttt{circuits} internal library; reported by JetherReis - (https://github.com/circuitikz/circuitikz/issues/519) + the \texttt{circuits} internal library; + \href{https://github.com/circuitikz/circuitikz/issues/519}{reported + by JetherReis}) \end{itemize} \item Version 1.3.3 (2021-04-04) @@ -77,8 +120,8 @@ full list of changes. \item Added left/right anchors to transistors \item - Fixed a bug in flip-flops - (https://tex.stackexchange.com/q/587213/38080) + Fixed a \href{https://tex.stackexchange.com/q/587213/38080}{bug in + flip-flops} \end{itemize} \item Version 1.3.1 (2021-02-20) diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf index 03f147a8136..9769fbe4590 100644 Binary files a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf and b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf differ diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex index c4e65e34c46..0d71c951568 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex @@ -953,7 +953,7 @@ Will create the final diagram: \endgroup -\section{The components} +\section{The components: usage} Components in \Circuitikz{} come in two forms: path-style, to be used in \texttt{to} path specifications, and node-style, which will be instantiated by a \texttt{node} specification. @@ -1396,7 +1396,7 @@ Old textbooks used the two-color style quite extensively, filling with a kind of You can change the line thickness for any class of component in an independent way. The default standard thickness of components is defined on a loose ``legacy'' category (like \texttt{bipoles}, \texttt{tripoles} and so on, see section~\ref{sec:legacy-thickness}); to override that you set the key \texttt{\emph{class}/thickness} to any number. The default is \texttt{none}, which means that the old way of selecting thickness is used. -For example, \emph{amplifiers} have the legacy class of \texttt{tripoles}, as well as transistors and tubes.By default they are drawn with thickness 2 (relative to the base linewidth). To change them to be thicker, you can for example add to the previous style +For example, \emph{amplifiers} have the legacy class of \texttt{tripoles}, as well as transistors and tubes. By default they are drawn with thickness 2 (relative to the base linewidth). To change them to be thicker, you can for example add to the previous style \begin{lstlisting} \ctikzset{amplifier/thickness=4} @@ -1467,13 +1467,182 @@ This kind of style will \emph{add} to the existing style. If you want to have a \begin{lstlisting}[frame=single, framesep=10pt] \ctikzloadstyle{legacy}% start from a know state \tikzset{romano circuit style/.style={% -legacy circuit style, % load the legacy style -\circuitikzbasekey/.cd,% -% Resistors -resistors/scale=0.8, + legacy circuit style, % load the legacy style + \circuitikzbasekey/.cd,% + % Resistors + resistors/scale=0.8, [...] + }} \end{lstlisting} +If you want to add a setting to your style file that has been recently added to the package (for example, the thyristor compact shapes added in \texttt{1.3.5}), but you want that your style file is still compatible with older versions of \Circuitikz, you can use the \texttt{.try} statement: + +\begin{lstlisting}[frame=single, framesep=10pt] + % Diodes + diodes/scale=0.6, + diodes/thickness=1.0, + thyristor style/.try=compact, +\end{lstlisting} + +\subsection{Subcircuits} + +Starting from version \texttt{1.3.5}, there is an \textbf{experimental}\footnote{That means that in future releases the interface can change; use it at your risk and if you need it to continue working as-is, please use the \href{https://circuitikz.github.io/circuitikz/}{GitHub project page} and download and save the \texttt{circuitikzgit.sty} file for future-proof use!} support for generating sub-circuits, or circuits blocks. The creation and use of subcircuits is somewhat limited, to keep them simple and easy to define and maintain. + + +A subcircuit is basically a path (and just one path!) of generic \TikZ{} instructions, with a series of accessible coordinates that behave more or less like anchors in the ``real'' shapes. The basic limitation is that a subcircuit can be moved, replicated and placed around but it can't be easily personalized. Even if scaling and rotation is in principle possible, it is not easily done. Nevertheless, they can be quite useful to build complex components and reusable blocks. + +\subsubsection{Subcircuit definition} + +To define a block you use the \verb|\ctikzsubcircuitdef| macro; this macro has 3 arguments: +\begin{itemize} + \item the first argument is the name of the subcircuit, and it must form a valid TeX command name when prepended with a backslash: so just letters (no spaces, nor numbers, nor symbols like underscores etc.); + \item the second one is a comma-separated list of anchors names; here you can use whatever you can use for naming a coordinate or a node (so it's much more relaxed that the first one); + \item finally, the commands that will draw the circuit. You must suppose you are in a \verb|\draw| command, with the start coordinate already set-up. You can (and should) use \verb|#1| as the name of the current node, and you \emph{must} define the coordinates of all the anchors listed before as \texttt{coordinate(\#-\emph{anchorname})}. You should \textbf{not} finish the path here and use \textbf{only relative coordinates or named ones} . +\end{itemize} + +Let's see that with an example: + +\ctikzsubcircuitdef{optovishay}{in 1, out 1, in 2, out 2, center}{% + % reference anchor is -center + coordinate(#1-center) + (#1-center) +(-1.2,-1) rectangle +(1.2,1) + (#1-center) ++(-1.2,0.8) coordinate (#1-in 1) + (#1-center) ++(-1.2,-0.8) coordinate (#1-in 2) + (#1-center) ++(1.2,0.8) coordinate (#1-out 1) + (#1-center) ++(1.2,-0.8) coordinate (#1-out 2) + (#1-center) ++(0,1) coordinate (#1-up) + (#1-in 1) -- ++(0.5,0) coordinate(#1-tmp) + to[leD*, diodes/scale=0.6, led arrows from cathode] + (#1-tmp|- #1-in 2) -- (#1-in 2) + (#1-out 1) -- ++(-0.5,0) coordinate(#1-tmp) + to[pD*, diodes/scale=0.4, mirror] ++(0,-0.5) + edge[densely dashed] ++(0,-0.533) ++(0,-0.566) + to[pD*, diodes/scale=0.4,mirror] (#1-tmp|- #1-out 2) -- (#1-out 2) + % leave the position of the path at the center + (#1-center) +} +\begin{lstlisting} +\ctikzsubcircuitdef{optovishay}{in 1, out 1, in 2, out 2, center}{% + % reference anchor is -center + coordinate(#1-center) + (#1-center) +(-1.2,-1) rectangle +(1.2,1) + (#1-center) ++(-1.2,0.8) coordinate (#1-in 1) + (#1-center) ++(-1.2,-0.8) coordinate (#1-in 2) + (#1-center) ++(1.2,0.8) coordinate (#1-out 1) + (#1-center) ++(1.2,-0.8) coordinate (#1-out 2) + (#1-center) ++(0,1) coordinate (#1-up) + (#1-in 1) -- ++(0.5,0) coordinate(#1-tmp) + to[leD*, diodes/scale=0.6, led arrows from cathode] + (#1-tmp|- #1-in 2) -- (#1-in 2) + (#1-out 1) -- ++(-0.5,0) coordinate(#1-tmp) + to[pD*, diodes/scale=0.4, mirror] ++(0,-0.5) + edge[densely dashed] ++(0,-0.533) ++(0,-0.566) + to[pD*, diodes/scale=0.4,mirror] (#1-tmp|- #1-out 2) -- (#1-out 2) + % leave the position of the path at the center + (#1-center) +} +\end{lstlisting} + +Our element is a symbol for an optocoupler; in this case is the symbol used for once cell of the double \href{https://www.vishay.com/docs/84639/vo1263aa.pdf}{Vishay vo1263 device}. + +The name of the subcircuit is \texttt{optovishay} --- notice we can use only letters here, upper or lowercase, and nothing more. +Then we have a series of anchor names; here we can use letters, numbers, spaces and some symbol --- but avoid the dot (\texttt{.}) and the hyphen (\texttt{-}). +Additionally, the anchor named \texttt{subckt@reference} is reserved and shouldn't be used. +If you use spaces, be on the safe side and \emph{never} use two or more consecutive spaces. + +After that, you have to draw your subcircuit as if you where into a \verb|\draw| command, starting from a generic point. +In this case, we decide to draw the circuit around this generic point so that it will result to be the center of the block; so as a first thing, we ``mark'' the position of the center anchor, with \texttt{coordinate(\#1-center)}. +The \texttt{\#1} will be substituted with the specific name of the subcircuit's instance later --- so if you then call one instance of the optocoupler \texttt{opto1}, that coordinate will be called \texttt{opto1-center}. + +We continue by defining all our anchors (there is no need to do that at the start, but it's handy because then you can use them). +You \textbf{must} define all the anchors! + +\textbf{Important}: all the coordinates used must be either relative, or named in the form \texttt{\#1-something}; absolute coordinate will not work when instantiating the block. +The block is thought to be used inside a path specification, so the idea is not to end the path --- that means that changing line styles or colors is at best difficult. +You can still use \texttt{edge}s, though (see~\ref{faqs:dashed}). + +After that, we draw our circuit; in this case a LED and a couple of smaller photodiodes will do. +We also define a coordinate \texttt{-up} (you can define more coordinates, in addition to the anchors, or name elements with \texttt{name=\#1-\emph{something}} for later access) for adding text. + +\subsubsection{Using the subcircuit} + +To use the subcircuit, an additional step is needed. Somewhere you have to \emph{activate} it. This is needed to calculate the relative positions of anchors using the current set of style parameters. The normal place is to activate it just before usage; to do that you use the command \verb|\ctikzsubcircuitactivate| with the name of the subcircuit. That will define a new command, \texttt{\textbackslash\emph{nameofthesubcircuit}} that you can use then in your paths. + +So to check your subcircuit while defining it you can use this simple snippet: +\begin{LTXexample}[varwidth=true] +\ctikzsubcircuitactivate{optovishay} +\begin{tikzpicture} + \draw (0,0) \optovishay{one}{}; + \node [above] at (one-up) {O1}; + \draw[color=blue] (one-out 1) -- ++(1,0) + \optovishay{two}{in 1}; + \node [above] at (two-up) {O2}; +\end{tikzpicture} +\end{LTXexample} + +\paragraph{Scaling, flipping and rotating subcircuits} + +To scale and rotate a subcircuit you have to include it into a \texttt{scope} with the appropriate \texttt{scale} and rotation commands. Notice that, as in general in \Circuitikz, global scales that affect rotation works only if \texttt{transform shape} is issued (see~\ref{sec:bugs}); nesting \texttt{transform shape} normally works, but it has been really lightly tested. + +\begin{LTXexample}[varwidth=true] +\ctikzsubcircuitactivate{optovishay} +\begin{tikzpicture}[scale=0.8, transform shape] + \draw (0,0) \optovishay{three}{}; + \draw (three-out 1) -- ++(0.5,0) coordinate(here); + \begin{scope}[xscale=-1,rotate=-45,transform shape] + \draw (here) \optovishay{four}{out 1}; + \end{scope} + \draw[blue] (three-out 2) -| (four-out 2); +\end{tikzpicture} +\end{LTXexample} + +\subsubsection{Parameters in subcircuits} + +There are no additional parameters definable for subcircuit shapes; this is a bit of a pity, because sometime they could be useful, especially for labels of objects. +Given the need to use \texttt{transform shape} to translate and rotate them, though, it is better not to add invariant-direction things (like text) into the subcircuit, unless you are sure you will just translate them. +One possibility is to use additional macros and anchors for positioning, like in the following example. + +Suppose you have defined + +\begin{lstlisting} + \ctikzsubcircuitdef{divider}{in, out}{% + coordinate (#1-in) to[R, l=~, name=#1-rh, -*] ++(2,0) + coordinate(#1-tmp) to[R, l=~, name=#1-rl] ++(0,-2) + node[tlground]{} (#1-tmp) --++(0.5,0) coordinate(#1-out) + } +\end{lstlisting} + +\ctikzsubcircuitdef{divider}{in, out}{% + coordinate (#1-in) to[R, l=~, name=#1-rh, -*] ++(2,0) + coordinate(#1-tmp) to[R, l=~, name=#1-rl] ++(0,-2) + node[tlground]{} (#1-tmp) --++(0.5,0) coordinate(#1-out) +} + +then you can additionally define: + +\begin{lstlisting} + \newcommand{\mydiv}[4]{ + \divider{#1}{#2} (#1-rh.n) node[above]{#3} + (#1-rl.n) node[right]{#4} (#1-out) + } +\end{lstlisting} + +\newcommand{\mydiv}[4]{ + \divider{#1}{#2} (#1-rh.n) node[above]{#3} + (#1-rl.n) node[right]{#4} (#1-out) +} + +And finally do: +\begin{LTXexample}[varwidth=true] +\ctikzsubcircuitactivate{divider} +\begin{tikzpicture} + \draw (0,0) \mydiv{a}{in}{$R_1$}{$R_2$}; + \draw (a-out) -- \mydiv{b}{in}{$R_3$}{$R_4$}; +\end{tikzpicture} +\end{LTXexample} + + +\section{The components: list} \subsection{Grounds and supply voltages} @@ -1903,20 +2072,52 @@ These shapes have no exact node-style counterpart, because the stroke line is bu \circuitdescbip*[emptyvarcap]{stroke varcap}{Stroke varcap}{VC-} \end{groupdesc} -\subsubsection{Tripole-like diodes}\label{sec:othertrip} The following tripoles are entered with the usual command, of the form \texttt{to[Tr, \dots]}. +\subsubsection{Tripole-like diodes}\label{sec:othertrip} The following tripoles are entered with the usual command, of the form \texttt{to[Tr, \dots]}. In the following list you can see the traditional, or \texttt{legacy}, shape of the Thyristors-type devices. \begin{groupdesc} + \ctikzset{thyristor style=legacy} + \circuitdescbip[fulldiode] {full diode}{Full diode}{D*} + \circuitdescbip*[emptydiode] {stroke diode}{Stroke diode}{D-} \circuitdescbip*[emptytriac]{triac}{Standard triac (shape depends on package option)}{Tr}( G/0/0.3, anode/-90/0.2, cathode/-90/0.2) \circuitdescbip*[emptytriac]{empty triac}{Empty triac}{Tro}( gate/0/0.3 ) \circuitdescbip[fulltriac]{full triac}{Full triac}{Tr*} - \circuitdescbip*[emptythyristor]{thyristor}{Standard thyristor (shape depends on package option)}{Ty}( G/0/0.3, anode/-90/0.2, cathode/-90/0.2) + \circuitdescbip*[emptythyristor]{thyristor}{Standard thyristor (shape depends on package option)}{Ty}( G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) \circuitdescbip*[emptythyristor]{empty thyristor}{Empty thyristor}{Tyo} \circuitdescbip[fullthyristor]{full thyristor}{Full thyristor}{Ty*} \circuitdescbip*[emptythyristor]{stroke thyristor}{Stroke thyristor}{Ty-} + \circuitdescbip*[emptyput]{put}{Standard Programmable Unipolar Transistor\footnotemark (shape depends on package option)}{PUT}( G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) + \footnotetext{This components, and the GTO family, has been suggested by \href{https://github.com/circuitikz/circuitikz/issues/522}{GitHub user JetherReis}.} + \circuitdescbip*[emptyput]{empty put}{Empty PUT}{PUTo} + \circuitdescbip[fullput]{full put}{Full PUT}{PUT*} + \circuitdescbip*[emptyput]{stroke put}{Stroke PUT}{PUT-} + \circuitdescbip*[emptygto]{gto}{Standard GTO (shape depends on package option)}{GTO}( G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) + \circuitdescbip*[emptygto]{empty gto}{Empty GTO}{GTOo} + \circuitdescbip[fullgto]{full gto}{Full GTO}{GTO*} + \circuitdescbip*[emptygto]{stroke gto}{Stroke GTO}{GTO-} + \circuitdescbip*[emptygtobar]{gtobar}{Standard GTO with bar-type gate (shape depends on package option)}{GTOb}( G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) + \circuitdescbip*[emptygtobar]{empty gtobar}{Empty GTO, bar-type}{GTObo} + \circuitdescbip[fullgtobar]{full gtobar}{Full GTO, bar-type}{GTOb*} + \circuitdescbip*[emptygtobar]{stroke gtobar}{Stroke GTO, bar type}{GTOb-} + \circuitdescbip*[emptyagtobar]{agtobar}{Standard GTO with bar-type gate on anode (shape depends on package option)}{aGTOb}( G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) + \circuitdescbip*[emptyagtobar]{empty agtobar}{Empty GTO, bar-type on anode}{aGTObo} + \circuitdescbip[fullagtobar]{full agtobar}{Full GTO, bar-type on anode}{aGTOb*} + \circuitdescbip*[emptyagtobar]{stroke agtobar}{Stroke GTO, bar-type on anode}{aGTOb-} \end{groupdesc} -\subsubsection{Triacs anchors} +For basically stylistical reasons, there is a different, more compact, shape available for them, activated with the key \texttt{thyristor style=compact} (the default is \texttt{legacy}). All the devices above are present, we will show here just the automatic version for shortness. + +\begin{groupdesc} + \ctikzset{thyristor style=compact} + \circuitdescbip*[emptytriac]{triac}{Standard triac (shape depends on package option)}{Tr}(G/0/0.3, anode/-90/0.2, cathode/-90/0.2) + \circuitdescbip*[emptythyristor]{thyristor}{Standard thyristor (shape depends on package option)}{Ty}(G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) + \circuitdescbip*[emptyput]{put}{Standard Programmable Unipolar Transistor (shape depends on package option)}{PUT}( G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) + \circuitdescbip*[emptygto]{gto}{Standard gto (shape depends on package option)}{GTO}(G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) + \circuitdescbip*[emptygtobar]{gtobar}{Standard GTO with a bar symbol on the gate (shape depends on package option)}{GTOb}( G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) + \circuitdescbip*[emptyagtobar]{agtobar}{Standard GTO with bar-type gate on anode (shape depends on package option)}{aGTOb}( G/0/0.3, gate/45/0.3, anode/-90/0.2, cathode/-90/0.2) +\end{groupdesc} + +\subsubsection{Thyristors anchors and customization} When inserting a thrystor, a triac or a potentiometer, one needs to refer to the third node-gate (\texttt{gate} or \texttt{G}) for the former two; wiper (\texttt{wiper} or \texttt{W}) for the latter one. This is done by giving a name to the bipole: \label{bipole-naming} @@ -1928,6 +2129,20 @@ When inserting a thrystor, a triac or a potentiometer, one needs to refer to the ;\end{circuitikz} \end{LTXexample} +As commented above, you can change the shape of these devices (globally or locally) setting the key \texttt{thyristor style=compact} (the default is \texttt{legacy}). Additionally, normally the plain \texttt{GTO} symbols come without the arrows, but you can add them using a syntax similar to the one explained in section~\ref{sec:tunablearrows} using the arrow group \texttt{gto gate}. + +\begin{LTXexample}[varwidth=true] + \begin{circuitikz}[] + \ctikzset{thyristor style=compact} + \draw (0,0) to[GTO=$G_1$] ++(0,-3); + \ctikzset{gto gate end arrow=latexslim} + \draw (2,0) to[GTO*=$G_2$, mirror] ++(0,-3); + \draw (4,0) to[GTOb-=$G_2$, mirror] ++(0,-3); + \end{circuitikz} +\end{LTXexample} + +Notice that you can set both \texttt{gto gate end arrow} and \texttt{gto gate start arrow} --- choosing just one of the two you can decide the ``rotation'' direction of the symbol. There is little space though, so don't overdo it. + \subsubsection{Diode customizations}\label{sec:tweak-d} You can change the scale of the diodes by setting the key \texttt{diodes/scale} to something different from the default \texttt{1.0}. In Romano's opinion, diodes are somewhat big with the default style of the package, so a setting like \verb|\ctikzset{diode/scale=0.6}| is recommended. @@ -2086,6 +2301,8 @@ Notice that if you choose the dashed style, the noise sources are fillable: \circuitdescbip*{vsourcetri}{Triangle voltage source}{tV} \circuitdescbip*{esource}{Empty voltage source}{} \circuitdescbip*{pvsource}{Photovoltaic-voltage source}{} + \circuitdescbip*{pvmodule}{Photovoltaic module source\footnotemark}{} + \footnotetext{Added by André Alves in \texttt{v1.3.5}} \circuitdescbip*[oosource]{ioosource}{Double Zero style current source}{} \circuitdescbip*[oosource]{voosource}{Double Zero style voltage source}{} \circuitdescbip*[oosourcetrans]{oosourcetrans}{transformer source}{} @@ -2168,6 +2385,45 @@ You can do the same with the \texttt{american controlled voltage sources}, subst You can change the scale of all the instruments (including the current loops) by setting the key \texttt{instruments/scale} to something different from the default \texttt{1.0}. +\paragraph{Oscilloscope waveform.} You can change the waveform shown in the oscilloscope ``screen''\footnote{Suggested by \href{https://tex.stackexchange.com/q/595062/38080}{Mario Tafur on TeX.SX}}. To change it, you just set the key \texttt{bipoles/oscope/waveform} to one of the available shape. You have available the shapes in the following list (the default is \texttt{ramps}): + +\begin{LTXexample}[pos=t, basicstyle=\small\ttfamily] +\begin{circuitikz} + \foreach [count=\i] \wvf in {ramps, sin, square, triangle, lissajous, zero, none} { + \ctikzset{bipoles/oscope/waveform=\wvf} + \draw ({2*\i},1.4) node[oscopeshape](O){} + ({2*\i},0.65) node[anchor=base]{\texttt{\wvf}}; + } + \ctikzset{bipoles/oscope/width=1.0} + \foreach [count=\i] \wvf in {ramps, sin, square, triangle, lissajous, zero, none} { + \ctikzset{bipoles/oscope/waveform=\wvf} + \draw ({2*\i},0) node[oscopeshape]{}; + } +\end{circuitikz} +\end{LTXexample} + +If you want more or different shapes, you can define your owns, but you have to use low-level \texttt{pgf} commands (see part IX, ``The Basic Layer'', in the PGF/\TikZ{} manual). The code is executed into a \verb|\pgfscope| \dots \verb|\endpgfscope| environment, and it must use the path built with a \verb|\pgfusepath|. The coordinates have been scaled so that the external box of the scope is a rectangle between \texttt{(-1cm, -1cm)} and \texttt{(1cm, 1cm)}; the oscilloscope grid is fixed and painted between \texttt{(-0.75cm, -0.5cm)} and \texttt{(0,75cm, 0.5cm)}. If you stretch the scope with the \texttt{\dots width} or \texttt{\dots height} keys, the drawing will be stretched too. + +\begin{LTXexample}[varwidth=t, basicstyle=\small\ttfamily] + \ctikzset{% + bipoles/oscope/waveform/mywave/.code={% + \pgfsetcolor{red} + \pgfpathmoveto{\pgfpoint{-.75cm}{-.5cm}} + \pgfpathlineto{\pgfpoint{.75cm}{.5cm}} + \pgfusepath{draw} + \pgfsetcolor{green} + \pgfpathmoveto{\pgfpoint{-.75cm}{.5cm}} + \pgfpathlineto{\pgfpoint{.75cm}{-.5cm}} + \pgfusepath{draw} + }} + \begin{circuitikz} + \ctikzset{bipoles/oscope/waveform=mywave} + \draw (0,0) node[oscopeshape]{}; + \end{circuitikz} +\end{LTXexample} + + + \subsubsection{Rotation-invariant elements} The \texttt{oscope} element will not rotate the ``graph'' shown with the component: @@ -2619,11 +2875,12 @@ It also has a \texttt{zero} anchor if you need to rotate it about its real cente \circuitdescbip*{phaseshifter}{phase shifter}{} \circuitdescbip*{vphaseshifter}{var.\ phase shifter}{} \circuitdescbip*{detector}{detector}{} - \circuitdescbip*{sacdc}{sacdc}{} - \circuitdescbip*{sdcac}{sdcac}{} - \circuitdescbip*{tacdc}{tacdc}{} - \circuitdescbip*{tdcac}{tdcac\footnotemark}{}(left/170/0.5, right/5/0.5, center/-90/0.3, ac1/45/0.1, ac2/-5/.3, ac3/-45/.1, dc1/135/.3, dc2/185/.3) - \footnotetext{the 4 converter blocks added by \texttt{olfline}} + \circuitdescbip*{sdcdc}{single wire DC/DC converter}{} + \circuitdescbip*{sacdc}{single phase AC/DC converter}{} + \circuitdescbip*{sdcac}{single phase DC/AC converter}{} + \circuitdescbip*{tacdc}{three phases AC/DC converter}{} + \circuitdescbip*{tdcac}{three phases AC/DC converter}{}(left/170/0.5, right/5/0.5, center/-90/0.3, ac1/45/0.1, ac2/-5/.3, ac3/-45/.1, dc1/135/.3, dc2/185/.3) + \footnotetext{the converter blocks added by \texttt{olfline}} \end{groupdesc} \begin{groupdesc} @@ -2868,13 +3125,23 @@ Basically they are the same as the normal \texttt{npn} and \texttt{pnp}, and the \circuitdesc{pigfetd}{pigfetd}{} \end{groupdesc} -\textsc{njfet} and \textsc{pjfet} have been incorporated based on code provided by Danilo Piazzalunga: +\textsc{JFET} are also available\footnote{based on code provided by Danilo Piazzalunga}, both n-type and p-type. + \begin{groupdesc} - \circuitdesc{njfet}{njfet}{Q} - \circuitdesc{pjfet}{pjfet}{} + \circuitdesc{njfet}{n-type JFET}{Q}(G/-135/0.2,D/0/0.2,S/0/0.2) + \circuitdesc{pjfet}{p-type JFET}{}(G/-135/0.2,D/0/0.2,S/0/0.2) \end{groupdesc} -\textsc{isfet} +\textsc{UJT} transistors\footnote{sugged by \href{https://github.com/circuitikz/circuitikz/issues/522}{user JetherReis on GitHub}.} have a different anchor names although \textbf{most} of the others, like \texttt{D} and \texttt{G}, work also (the exception is \texttt{E} and \texttt{emitter}!). Notice that if used with \texttt{nobase}, the anchor \texttt{E} follows the wire, while \texttt{G} is fixed (as is \texttt{kink}). + +\begin{groupdesc} + \circuitdesc{nujt}{n-type UJT}{Q}(G/-135/0.2,B1/0/0.2,B2/0/0.2 , kink/90/0.4, E/135/0.2) + \circuitdesc{pujt}{p-type UJT}{Q}(G/-135/0.2,B1/0/0.2,B2/0/0.2 , kink/90/0.4, E/135/0.2) + \circuitdesc{nujt, nobase}{n-type UJT with nobase option}{Q}(G/-135/0.2,B1/0/0.2,B2/0/0.2 , kink/90/0.4, E/135/0.2) +\end{groupdesc} + +\textsc{isfet}: + \begin{groupdesc} \circuitdesc{isfet}{isfet}{Q} \end{groupdesc} @@ -3044,6 +3311,26 @@ Normally, in bipolar IGBTs the outer base is the same size (height) of the inner \end{circuitikz} \end{LTXexample} +\paragraph{UJT transistors.}\label{sec:ujt} They look better if you use \texttt{transistors/arrow pos=end}, especially if you use them with \texttt{tr circle}. If you use the key \texttt{nobase} with UJTs, the horizontal part of the controlling terminal is not drawn; notice that this \emph{will} move the \texttt{E} or \texttt{emitter} anchor, but not the generic ones like \texttt{G}. + +\begin{LTXexample}[varwidth=true, basicstyle=\footnotesize\ttfamily] +\begin{circuitikz}[scale=0.8] + \draw (0,5) node[nujt]{} ++(2,0) node[pujt]{} + ++(2,0) node[nujt, tr circle]{} ++(2,0) + node[pujt, tr circle]{}; + \ctikzset{transistors/arrow pos=end} + \draw (0,2.5) node[nujt](A){} ++(2,0) node[pujt]{} + ++(2,0) node[nujt, tr circle]{} ++(2,0) + node[pujt, tr circle](C){}; + \draw (0,0) node[nujt, nobase](B){} ++(2,0) + node[pujt, nobase]{} ++(2,0) + node[nujt, tr circle, nobase]{} ++(2,0) + node[pujt, tr circle, nobase](D){}; + % "E" anchor follows the nobase option: + \draw[red] (A.E) |- (B.E) (C.E) |- (D.E); +\end{circuitikz} +\end{LTXexample} + \paragraph{Base/Gate terminal.} The Base/Gate connection of all transistors can be disabled by the options \textit{nogate} or \textit{nobase}, respectively. The Base/Gate anchors are floating, but there is an additional anchor \texttt{nogate}/\texttt{nobase} , which can be used to point to the unconnected base: \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -3371,6 +3658,9 @@ Finally, double-gated components (MOSes, FETs, IGBTs) have an extra anchor \text \end{circuitikz} \end{LTXexample} +For UJT transistors anchors, see section~\ref{sec:ujt}. + + \subsubsection{Transistor paths}\label{sec:transasbip} For syntactical convenience standard transistors (not multi-terminal ones) can be placed using the normal path notation used for bipoles. The transitor type can be specified by simply adding a ``T'' (for transistor) in front of the node name of the transistor. It will be placed with the base/gate orthogonal to the direction of the path: diff --git a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex index 82fde840f3c..a84fd4d95df 100644 --- a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex +++ b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex @@ -10,8 +10,8 @@ % % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. -\def\pgfcircversion{1.3.4} -\def\pgfcircversiondate{2021/04/20} +\def\pgfcircversion{1.3.5} +\def\pgfcircversiondate{2021/05/02} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} \usemodule[tikz] diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex index b35cb69166e..c4ce332209a 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-legacy.tex @@ -27,6 +27,7 @@ inductors/thickness=none, diodes/scale=1.0, diodes/fill=none, diodes/thickness=none, +thyristor style/.try=legacy, % % Batteries batteries/scale=1.0, diff --git a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex index 15e3e1e9cf1..6227a23d32b 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/ctikzstyle-romano.tex @@ -22,6 +22,7 @@ inductors/thickness=1.0, % Diodes diodes/scale=0.6, diodes/thickness=1.0, +thyristor style/.try=compact, % % Batteries batteries/scale=1.0, @@ -53,6 +54,7 @@ amplifiers/scale=1.0, amplifiers/thickness=3.0, % % Logic ports +logic ports/.try=ieee, logic ports/scale=1.0, logic ports/thickness=2.0, logic ports origin=center, diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index 445a14d639d..b29aea51355 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -22,6 +22,7 @@ \pgf@circ@declare@family@arrows{tunable} \pgf@circ@declare@family@arrows{wiper} \pgf@circ@declare@family@arrows{switch} +\pgf@circ@declare@family@arrows{gto gate} %>>> @@ -1595,6 +1596,8 @@ \ctikzset{bipoles/esource/width/.initial=.60} \ctikzset{bipoles/pvsource/height/.initial=.60} \ctikzset{bipoles/pvsource/width/.initial=.60} +\ctikzset{bipoles/pvmodule/height/.initial=.60} +\ctikzset{bipoles/pvmodule/width/.initial=1.20} \ctikzset{bipoles/isource/height/.initial=.60} \ctikzset{bipoles/isource/width/.initial=.60} \ctikzset{bipoles/oosource/height/.initial=.60} @@ -1916,7 +1919,6 @@ \endpgfscope } - %% PV Source \pgfcircdeclarebipolescaled{sources} {} @@ -1958,6 +1960,35 @@ } +%% PV Module - contributed by Andre Alves +\pgfcircdeclarebipolescaled{sources} +{} +{\ctikzvalof{bipoles/pvmodule/height}} +{pvmodule} +{\ctikzvalof{bipoles/pvmodule/height}} +{\ctikzvalof{bipoles/pvmodule/width}} +{ + + % Draw rectangle + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathclose + \pgf@circ@draworfill + + % Draw triangle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0}} + \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@right}{\pgf@circ@res@down}} + \pgf@circ@draworfill + + \pgfusepath{draw} +} + %% Empty Source \pgfcircdeclarebipolescaled{sources} {} @@ -2867,6 +2898,10 @@ \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} +\pgfcirc@activate@bipole@simple@opt{v}{pvmodule}{% + \circuitikzbasekey/bipole/is voltage=true, + \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} + \pgfcirc@activate@bipole@simple@opt{v}{dcvsource}{% \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true} @@ -2987,17 +3022,55 @@ \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3} \ctikzset{bipoles/varcap/height/.initial=.50} \ctikzset{bipoles/varcap/width/.initial=.45} + \ctikzset{tripoles/thyristor/height/.initial=1.10} \ctikzset{tripoles/thyristor/height 2/.initial=.5} \ctikzset{tripoles/thyristor/width/.initial=1.0} \ctikzset{tripoles/thyristor/diode height/.initial=.5} \ctikzset{tripoles/thyristor/diode width left/.initial=.4} \ctikzset{tripoles/thyristor/diode width right/.initial=.3} +\ctikzset{tripoles/thyristor/gate height/.initial=0.0} % legacy 0 +\ctikzset{tripoles/thyristor/gate kink/.initial=1.0} % legacy 1.0 +\ctikzset{tripoles/thyristor/gto space up/.initial=0.5} % legacy 0.5 +\ctikzset{tripoles/thyristor/gto space down/.initial=0.0} % legacy 0.0 +\ctikzset{tripoles/thyristor/gto bar width/.initial=0.2} % legacy 0.2 \ctikzset{tripoles/triac/height/.initial=1.1} \ctikzset{tripoles/triac/width/.initial=1} \ctikzset{tripoles/triac/diode width left/.initial=.3} \ctikzset{tripoles/triac/diode width right/.initial=.3} +\ctikzset{tripoles/triac/gate kink/.initial=1} + +\ctikzset{thyristor style/.is choice} +\ctikzset{thyristor style/legacy/.code={% + \ctikzset{tripoles/thyristor/height=1.1}% + \ctikzset{tripoles/thyristor/height 2=.5}% + \ctikzset{tripoles/thyristor/width=1.0}% + \ctikzset{tripoles/thyristor/diode height=.5}% + \ctikzset{tripoles/thyristor/diode width left=.4}% + \ctikzset{tripoles/thyristor/diode width right=.3}% + \ctikzset{tripoles/thyristor/gate height=0.0}% + \ctikzset{tripoles/thyristor/gate kink=1.0}% + \ctikzset{tripoles/thyristor/gto space up=0.5}% + \ctikzset{tripoles/thyristor/gto space down=0.0}% + \ctikzset{tripoles/thyristor/gto bar width=0.2}% + \ctikzset{tripoles/triac/gate kink=1}% +}} +\ctikzset{thyristor style/compact/.code={% + \ctikzset{tripoles/thyristor/height=0.8}% legacy 1.1 + \ctikzset{tripoles/thyristor/height 2=.5}% + \ctikzset{tripoles/thyristor/width=1.0}% + \ctikzset{tripoles/thyristor/diode height=.5}% + \ctikzset{tripoles/thyristor/diode width left=.4}% + \ctikzset{tripoles/thyristor/diode width right=.4}%legacy 0.3 + \ctikzset{tripoles/thyristor/gate height=0.5}% legacy 0 + \ctikzset{tripoles/thyristor/gate kink=0.7}% legacy 1.0 + \ctikzset{tripoles/thyristor/gto space up=0.25}% legacy 0.5 + \ctikzset{tripoles/thyristor/gto space down=0.25}% legacy 0.0 + \ctikzset{tripoles/thyristor/gto bar width=0.2}% + \ctikzset{tripoles/triac/gate kink=.7}% +}} + % % Flipping arrows in LED and photodiodes % @@ -3563,211 +3636,278 @@ \pgfusepath{draw} } -%% Black thyristor -\pgfcircdeclarebipolescaled{diodes} -{ - \anchor{gate}{\northeast} - \anchor{anode}{\southwest\pgf@y=0cm} - \anchor{G}{\northeast} - \anchor{cathode}{\northeast\pgf@y=0cm } -} -{\ctikzvalof{tripoles/thyristor/height 2}} -{fullthyristor} -{\ctikzvalof{tripoles/thyristor/height}} -{\ctikzvalof{tripoles/thyristor/width}} -{ - - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} +%%% Thyristors in general - \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right - \pgfscope - \pgftransformxshift{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfusepath{draw,fill} - - \pgfsetlinewidth{\pgfstartlinewidth} +\def\pgfcircdeclarethyristor#1#2#3#4{%name, fill (0-> black; 1-empty), gate position (1: catode, -1: anode), extra code + \pgfcircdeclarebipolescaled{diodes} + { + \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/thyristor/gate kink}}} + \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x} + \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{cathode}{\northeast\pgf@y=0cm } + } + {\ctikzvalof{tripoles/thyristor/height 2}} + {#1} + {\ctikzvalof{tripoles/thyristor/height}} + {\ctikzvalof{tripoles/thyristor/width}} + { + \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope + \pgfscope + % draw the thick parts here (shifted horizontally) + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + % draw the basic triangle + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathclose + \ifnum#2=0\relax + \pgfusepath{draw,fill} + \else + \pgf@circ@draworfill + \fi + % draw the vertical bar + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + \pgfusepath{draw} + \endpgfscope - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} + % back to normal linewidth + % stroke if needed + \ifpgf@circuit@bipole@strokedsymbol + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi - \pgfusepath{draw} + % draw the gate thing; + #4 - \pgfsetlinewidth{\pgfstartlinewidth} + % draw the leads in/out + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfusepath{draw} + } +} +\def\pgfcirc@thyristor@simplegate{% + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@step} + {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\pgf@circ@res@up} + } \pgfusepath{draw} - } +%% Black thyristor +\pgfcircdeclarethyristor{fullthyristor}{0}{1}{\pgfcirc@thyristor@simplegate} %% Empty thyristor - -\pgfcircdeclarebipolescaled{diodes} -{ - \anchor{gate}{\northeast} - \anchor{anode}{\southwest\pgf@y=0cm} - \anchor{G}{\northeast} - \anchor{cathode}{\northeast\pgf@y=0cm } -} -{\ctikzvalof{tripoles/thyristor/height 2}} -{emptythyristor} -{\ctikzvalof{tripoles/thyristor/height}} -{\ctikzvalof{tripoles/thyristor/width}} -{ - - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - - \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right - +\pgfcircdeclarethyristor{emptythyristor}{1}{1}{\pgfcirc@thyristor@simplegate} +%% black and empty GTO (standard: double line symbol, no arrow) + +\def\pgfcirc@doublegate@gto@add{ + % connection to gate terminal + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up - + \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\pgf@circ@res@up} + } + \pgfusepath{draw} \pgfscope - \pgftransformxshift{\pgf@circ@res@other} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - - \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfpathclose - \pgf@circ@draworfill - \pgfscope - % to allow filling, we need to draw explicitily the stroke here. - \pgfsetlinewidth{\pgfstartlinewidth} - \ifpgf@circuit@bipole@strokedsymbol - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0pt}{0pt}} - \pgfusepath{draw} - \fi - \endpgfscope - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfusepath{draw} - \endpgfscope - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}} - + \pgfcirc@set@arrows{gto gate}{}{} + % \pgfsetarrowsstart{latexslim} + % first (lower) gto line: from body to gate + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@step} + {(\ctikzvalof{tripoles/thyristor/gate height}-\ctikzvalof{tripoles/thyristor/gto space down}) + *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up - + \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } \pgfusepath{draw} - - \pgfsetlinewidth{\pgfstartlinewidth} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - + % second (higher) gto line: from gate to body + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up + + \ctikzvalof{tripoles/thyristor/gto space up}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\pgf@circ@res@step} + {(\ctikzvalof{tripoles/thyristor/gate height}+\ctikzvalof{tripoles/thyristor/gto space up}) + *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } \pgfusepath{draw} + \endpgfscope } +\pgfcircdeclarethyristor{fullgto}{0}{1}{\pgfcirc@doublegate@gto@add} +\pgfcircdeclarethyristor{emptygto}{1}{1}{\pgfcirc@doublegate@gto@add} -%% Empty triac -\pgfcircdeclarebipolescaled{diodes} -{ - \anchor{gate}{\northeast} - \anchor{anode}{\southwest\pgf@y=0cm} - \anchor{G}{\northeast} - \anchor{cathode}{\northeast\pgf@y=0cm } +\def\pgfcirc@bargate@gto@add{% + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@step} + {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right} + {\pgf@circ@res@up} + } + % draw bar line. + \pgfpathmoveto{\pgfpoint + {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right} + {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right} + {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up} + } + \pgfusepath{draw} } -{\ctikzvalof{tripoles/triac/height}} -{emptytriac} -{\ctikzvalof{tripoles/triac/height}} -{\ctikzvalof{tripoles/triac/width}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} +\pgfcircdeclarethyristor{fullgtobar}{0}{1}{\pgfcirc@bargate@gto@add} +\pgfcircdeclarethyristor{emptygtobar}{1}{1}{\pgfcirc@bargate@gto@add} - \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right +%% Thyristors with anode-connected gate - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} +\def\pgfcirc@thyristor@anodegate{% + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@other} + {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left} + {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left} + {\pgf@circ@res@up} + } + \pgfusepath{draw} +} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} +%% Black PUT +\pgfcircdeclarethyristor{fullput}{0}{-1}{\pgfcirc@thyristor@anodegate} +%% Empty PUT +\pgfcircdeclarethyristor{emptyput}{1}{-1}{\pgfcirc@thyristor@anodegate} +%% black and empty GTO (standard: double line symbol, no arrow) - \pgf@circ@draworfill +\def\pgfcirc@anodebargate@gto@add{% + \pgfpathmoveto{\pgfpoint + {\pgf@circ@res@other} + {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left} + {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left} + {\pgf@circ@res@up} + } + % draw bar line. + \pgfpathmoveto{\pgfpoint + {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left} + {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up} + } + \pgfpathlineto{\pgfpoint + {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left} + {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up} + } + \pgfusepath{draw} +} - \pgfsetlinewidth{\pgfstartlinewidth} +\pgfcircdeclarethyristor{fullagtobar}{0}{-1}{\pgfcirc@anodebargate@gto@add} +\pgfcircdeclarethyristor{emptyagtobar}{1}{-1}{\pgfcirc@anodebargate@gto@add} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) +% Triacs - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} +\def\pgfcircdeclaretriac#1#2{%name, fill (0-> black; 1-empty) + \pgfcircdeclarebipolescaled{diodes} + { + \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/triac/gate kink}}} + \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x} + \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x} + \anchor{anode}{\southwest\pgf@y=0cm} + \anchor{cathode}{\northeast\pgf@y=0cm } + } + {\ctikzvalof{tripoles/triac/height}} + {#1} + {\ctikzvalof{tripoles/triac/height}} + {\ctikzvalof{tripoles/triac/width}} + { + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left + \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right - \pgfusepath{draw} -} + % diodes forms + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} -%% Full triac -\pgfcircdeclarebipolescaled{diodes} -{ - \anchor{gate}{\northeast} - \anchor{anode}{\southwest\pgf@y=0cm} - \anchor{G}{\northeast} - \anchor{cathode}{\northeast\pgf@y=0cm } -} -{\ctikzvalof{tripoles/triac/height}} -{fulltriac} -{\ctikzvalof{tripoles/triac/height}} -{\ctikzvalof{tripoles/triac/width}} -{ - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left - \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right + \ifnum#2=0\relax + \pgfusepath{draw,fill} + \else + \pgf@circ@draworfill + \fi - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + \pgfsetlinewidth{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} + % draw gate + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right} + {-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) - \pgfusepath{draw,fill} + % draw leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2) - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2) + \pgfusepath{draw} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}} + } +} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}} +\pgfcircdeclaretriac{fulltriac}{0} +\pgfcircdeclaretriac{emptytriac}{1} - \pgfusepath{draw} -}% %>>> +% end of shape definitions for diodes%>>> %% Paths definitions for Diodes%<<< @@ -3792,6 +3932,14 @@ \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2} \pgfcirc@activate@bipole{l}{#1thyristor}{#1thyristor}{#1 thyristor} \pgfcirc@style@to@style{#1 thyristor}{Ty#2} + \pgfcirc@activate@bipole{l}{#1put}{#1put}{#1 put} + \pgfcirc@style@to@style{#1 put}{PUT#2} + \pgfcirc@activate@bipole{l}{#1gto}{#1gto}{#1 gto} + \pgfcirc@style@to@style{#1 gto}{GTO#2} + \pgfcirc@activate@bipole{l}{#1gtobar}{#1gtobar}{#1 gtobar} + \pgfcirc@style@to@style{#1 gtobar}{GTOb#2} + \pgfcirc@activate@bipole{l}{#1agtobar}{#1agtobar}{#1 agtobar} + \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2} \pgfcirc@activate@bipole{l}{#1triac}{#1triac}{#1 triac} \pgfcirc@style@to@style{#1 triac}{Tr#2} } @@ -3818,6 +3966,14 @@ \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2} \pgfcirc@node@to@style{l}{emptythyristor}{#1 thyristor}{\circuitikzbasekey/bipole/is strokedsymbol=true} \pgfcirc@style@to@style{#1 thyristor}{Ty#2} + \pgfcirc@node@to@style{l}{emptyput}{#1 put}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 put}{PUT#2} + \pgfcirc@node@to@style{l}{emptygto}{#1 gto}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 gto}{GTO#2} + \pgfcirc@node@to@style{l}{emptygtobar}{#1 gtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 gtobar}{GTOb#2} + \pgfcirc@node@to@style{l}{emptyagtobar}{#1 agtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true} + \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2} \pgfcirc@node@to@style{l}{emptytriac}{#1 triac}{\circuitikzbasekey/bipole/is strokedsymbol=true} \pgfcirc@style@to@style{#1 triac}{Tr#2} } @@ -3844,6 +4000,14 @@ \pgfcirc@style@to@style{bidirectionaldiode}{biD} \pgfcirc@style@to@style{\pgfcircdiodestylemacro thyristor}{thyristor} \pgfcirc@style@to@style{thyristor}{Ty} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro put}{put} +\pgfcirc@style@to@style{put}{PUT} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro gto}{gto} +\pgfcirc@style@to@style{gto}{GTO} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro gtobar}{gtobar} +\pgfcirc@style@to@style{gtobar}{GTOb} +\pgfcirc@style@to@style{\pgfcircdiodestylemacro agtobar}{agtobar} +\pgfcirc@style@to@style{agtobar}{aGTOb} \pgfcirc@style@to@style{\pgfcircdiodestylemacro triac}{triac} \pgfcirc@style@to@style{triac}{Tr} % %>>> @@ -4657,6 +4821,62 @@ } % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176 +% +% oscilloscope waveforms + +\ctikzset{% + bipoles/oscope/waveform/sin/.code={% + \pgfpathmoveto{\pgfpoint{-0.6cm}{0cm}} + \pgfpathsine{\pgfpoint{0.3cm}{0.4cm}} + \pgfpathcosine{\pgfpoint{0.3cm}{-0.4cm}} + \pgfpathsine{\pgfpoint{0.3cm}{-0.4cm}} + \pgfpathcosine{\pgfpoint{0.3cm}{0.4cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/ramps/.code={% + \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{-0.05cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{-0.05cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.65cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0.65cm}{-0.25cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/square/.code={% + \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{-0.6cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.6cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0.75cm}{0.25cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/triangle/.code={% + \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}} + \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{-0.3cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.3cm}{0.25cm}} + \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}} + \pgfpathlineto{\pgfpoint{0.75cm}{0cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/zero/.code={ + \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}} + \pgfpathlineto{\pgfpoint{0.75cm}{0cm}} + \pgfusepath{draw} + },% + bipoles/oscope/waveform/lissajous/.code={% + \pgfpathellipse{\pgfpoint{0cm}{0cm}} + {\pgfpoint{0.5cm}{0.35cm}}{\pgfpoint{-0.3cm}{0.2cm}} + \pgfusepath{draw} + }, + bipoles/oscope/waveform/none/.code={},% +} +% default waveform (backward compatible) +\ctikzset{bipoles/oscope/waveform/.initial=ramps} + \pgfcircdeclarebipolescaled{instruments} { \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x} @@ -4682,8 +4902,6 @@ \pgfscope \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}} \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} - % this would create a round (analog?) scope... - % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}} \pgf@circ@draworfill \endpgfscope % get the rotation @@ -4700,23 +4918,24 @@ \pgfscope \pgfsetlinewidth{0.5\pgfstartlinewidth} \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} - \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]% + % the "almost one" make the grid complete most of the time --- beware of antialiasing + \pgfpathgrid[stepx=0.995\pgf@circ@res@step, stepy=0.995\pgf@circ@res@step]% {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}} {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}} \pgfsetstrokeopacity{0.5} \pgfusepath{draw} \endpgfscope - % function displayed, thanks to - \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} - \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}} - \pgfusepath{draw} + % function displayed + \pgfscope + \pgfmathsetmacro{\@@scalex}{\pgf@circ@res@right/1cm} + \pgfmathsetmacro{\@@scaley}{\pgf@circ@res@up/1cm} + \pgftransformxscale{\@@scalex} + \pgftransformyscale{\@@scaley} + \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} + \pgfkeys{\circuitikzbasekey/bipoles/oscope/waveform/\ctikzvalof{bipoles/oscope/waveform}} + \endpgfscope \endpgfscope } - % generic round meter with always horizontal text, no arrow \pgfcircdeclarebipolescaled{instruments} {} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex index 6acaa06aa99..23e0d40b7fb 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex @@ -687,11 +687,15 @@ \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))} \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)} } + % + % Notice that the "in" anchors must mimic "ext center", otherwise they are + % wrong for angles > 90 degrees! + % % center anchors - \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius} + \anchor{cin}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width} % horizontal angles - \anchor{in}{ \northwest \pgf@y=0pt} - \anchor{ain}{ \northwest \pgf@y=0pt} + \anchor{in}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius} + \anchor{ain}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius} \anchor{center}{ \central \pgf@y=0pt } \anchor{east}{ \northeast \pgf@y=0pt } diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex index 7b267095403..1b2e77e613a 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex @@ -470,6 +470,7 @@ % powerelectronic blocks \ctikzset{bipoles/sacdc/width/.initial=.7} \ctikzset{bipoles/sdcac/width/.initial=.7} +\ctikzset{bipoles/sdcdc/width/.initial=.7} \ctikzset{bipoles/tacdc/width/.initial=.7} \ctikzset{bipoles/tdcac/width/.initial=.7} \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole? @@ -1950,6 +1951,84 @@ } +%% dc/dc converter +\pgfcircdeclarebipolescaled{blocks} +{ + \anchor{dc1}{ + \northeast + \pgf@y=.4\pgf@y + \pgf@x=-\pgf@x + } + \anchor{dc2}{ + \northeast + \pgf@y=-.4\pgf@y + \pgf@x=-\pgf@x + } +} +{\ctikzvalof{bipoles/sdcdc/width}} +{sdcdc} +{\ctikzvalof{bipoles/sdcdc/width}} +{\ctikzvalof{bipoles/sdcdc/width}} +{ + \pgf@circ@res@step = \ctikzvalof{bipoles/sdcdc/width}\pgf@circ@scaled@Rlen + \divide \pgf@circ@res@step by 2 + + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \pgf@circ@res@other = \pgf@circ@res@left + \advance\pgf@circ@res@other by \pgf@circ@res@step + + \ifpgf@circuit@dashed + \pgfsetdash{{0.1cm}{0.1cm}}{0cm} + \fi + + % draw outer box + \pgf@circ@twoportbox + + \ifpgf@circuit@inputarrow + { + \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth + \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}} + } + \fi + + % rotate inner symbol + \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil} + \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135 + \pgftransformrotate{270} + \fi\fi + \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible + \pgftransformrotate{180} + \fi\fi + \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315 + \pgftransformrotate{90} + \fi\fi + + % draw inner symbol + \pgfsetdash{}{0pt} % always draw solid line for inner symbol + \pgfsetarrows{-} %never draw arrows + \pgfsetlinewidth{\pgfstartlinewidth} + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \pgfusepath{draw} + + % draw equal sign + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}} + \pgfusepath{draw} + + % draw equal sign + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}} + \pgfusepath{draw} + \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}} + \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}} + \pgfusepath{draw} +} + %% single phase dc/ac converter \pgfcircdeclarebipolescaled{blocks} @@ -2270,6 +2349,7 @@ \pgfcirc@activate@bipole@simple{l}{detector} \pgfcirc@activate@bipole@simple{l}{sacdc} \pgfcirc@activate@bipole@simple{l}{sdcac} +\pgfcirc@activate@bipole@simple{l}{sdcdc} \pgfcirc@activate@bipole@simple{l}{tacdc} \pgfcirc@activate@bipole@simple{l}{tdcac} % %>>> diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex index e013c51c3b3..cccb975f22b 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex @@ -3231,7 +3231,9 @@ \ctikzset{tripoles/njfet/gate height 2/.initial=.35} \ctikzset{tripoles/njfet/gate width/.initial=.5} \ctikzset{tripoles/njfet/base width/.initial=.5} -\ctikzset{tripoles/njfet/conn height/.initial=.35} +\ctikzset{tripoles/njfet/conn height/.initial=.35}% at the exterior +\ctikzset{tripoles/njfet/union height/.initial=.35}% at the gate +\ctikzset{tripoles/njfet/conn kink/.initial=1}% 1=no kink \ctikzset{tripoles/njfet/height/.initial=1.1} \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3} \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3} @@ -3244,12 +3246,42 @@ \ctikzset{tripoles/pjfet/gate width/.initial=.5} \ctikzset{tripoles/pjfet/base width/.initial=.5} \ctikzset{tripoles/pjfet/conn height/.initial=.35} +\ctikzset{tripoles/pjfet/union height/.initial=.35}% at the gate +\ctikzset{tripoles/pjfet/conn kink/.initial=1}% 1=no kink \ctikzset{tripoles/pjfet/height/.initial=1.1} \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3} \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3} \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6} \ctikzset{tripoles/pjfet/curr direction/.initial=-1} +\ctikzset{tripoles/nujt/width/.initial=.7} +\ctikzset{tripoles/nujt/gate height/.initial=.5} +\ctikzset{tripoles/nujt/gate height 2/.initial=.35} +\ctikzset{tripoles/nujt/gate width/.initial=.5} +\ctikzset{tripoles/nujt/base width/.initial=.5} +\ctikzset{tripoles/nujt/conn height/.initial=.35} +\ctikzset{tripoles/nujt/union height/.initial=0}% at the gate +\ctikzset{tripoles/nujt/conn kink/.initial=.82}% to match the circle position +\ctikzset{tripoles/nujt/height/.initial=1.1} +\ctikzset{tripoles/nujt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/nujt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/nujt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/nujt/curr direction/.initial=1} + +\ctikzset{tripoles/pujt/width/.initial=.7} +\ctikzset{tripoles/pujt/gate height/.initial=.5} +\ctikzset{tripoles/pujt/gate height 2/.initial=.35} +\ctikzset{tripoles/pujt/gate width/.initial=.5} +\ctikzset{tripoles/pujt/base width/.initial=.5} +\ctikzset{tripoles/pujt/conn height/.initial=.35} +\ctikzset{tripoles/pujt/union height/.initial=0}% at the gate +\ctikzset{tripoles/pujt/conn kink/.initial=.82}% to match the circle position +\ctikzset{tripoles/pujt/height/.initial=1.1} +\ctikzset{tripoles/pujt/bodydiode scale/.initial=.3} +\ctikzset{tripoles/pujt/bodydiode distance/.initial=.3} +\ctikzset{tripoles/pujt/bodydiode conn/.initial=.6} +\ctikzset{tripoles/pujt/curr direction/.initial=-1} + \ctikzset{tripoles/isfet/width/.initial=1} \ctikzset{tripoles/isfet/gate height/.initial=.35} \ctikzset{tripoles/isfet/base height/.initial=.5} @@ -5417,139 +5449,159 @@ \fi } -\pgfcircdeclaretransistor{njfet}{ - \anchor{inner up}{ - \northeast - \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y - } - \anchor{inner down}{ - \northeast - \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y - } - }{% - % add the circle if requested (before everything else, so we can fill it) - \pgfcirc@transistorcircle - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}} +%%% uni-junction transistors: jfets, ujts - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfusepath{draw} +\long\def\pgfcircdeclarejunctiontransistor#1#2#3{% name, extra anchors, extra draw + \pgfcircdeclaretransistor{#1}{ + \anchor{inner up}{ + \northeast + \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y + } + \anchor{inner down}{ + \northeast + \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y + } + \anchor{kink}{ + \northeast + \pgf@ya=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y + \left + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya + \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x + } + % extra anchors (or override) + #2 + }{% + % add the circle if requested (before everything else, so we can fill it) + \pgfcirc@transistorcircle - \pgfscope - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}} + % get direction + \edef\@@dir{\ctikzvalof{tripoles/#1/curr direction}} + + % draw drain/source connections: up + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}} - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}} + + % down + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} + {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} \pgfusepath{draw} - \endpgfscope - % arrow - \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgfresetnontranslationattimefalse - \ifpgf@circuit@trans@arrowatend - \edef\@@anchor{tip}\edef\@@pos{1.0} - \else - \edef\@@anchor{center}\edef\@@pos{0.6} - \fi - \pgftransformlineattime{\@@pos}{% - \pgfpoint{\pgf@circ@res@left}% - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% - }{% - \pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}% - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}% - } - \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} - \endpgfscope + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}} + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgfusepath{draw} + \endpgfscope - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} - {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}} - \pgfusepath{draw} -} + % arrow + \pgfscope + \pgfslopedattimetrue + \pgfallowupsidedownattimetrue + \pgfresetnontranslationattimefalse + \ifpgf@circuit@trans@arrowatend + \ifnum\@@dir>0 + \edef\@@anchor{tip}\edef\@@pos{1.0} + \else + \edef\@@anchor{btip}\edef\@@pos{1.0} + \fi + \else + \ifnum\@@dir>0 + \edef\@@anchor{center}\edef\@@pos{0.6} + \else + \edef\@@anchor{center}\edef\@@pos{0.4} + \fi + \fi + % find x1, x2 and y for the base arrow + \ifnum\@@dir>0 + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left + \pgf@circ@res@other=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left + \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@down + \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down + \else + \pgf@circ@res@step=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left + \pgf@circ@res@other=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left + \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up + \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@up + \fi + % + % gate line (called emitter in UJT) + % + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + % + % horizontal gate line + % + \ifpgf@circuit@bpt@drawgate + \ifnum\@@dir>0 + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}} + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}} + \fi + \fi + \pgfusepath{draw} + % + % gate arrows (called emitter in UJT) + % + \pgftransformlineattime{\@@pos}{% + \pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp} + }{% + \pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero} + } + \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} + % + % gate line (called emitter in UJT) + % + \endpgfscope -\pgfcircdeclaretransistor{pjfet}{ - \anchor{inner up}{ - \northeast - \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y - } - \anchor{inner down}{ - \northeast - \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y - } - }{% - % add the circle if requested (before everything else, so we can fill it) - \pgfcirc@transistorcircle - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} + % extra drawings + #3 + } +} - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}} - \pgfusepath{draw} +% NJFET and PJFET - \pgfscope - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}} - \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} - \pgfusepath{draw} - \endpgfscope +\pgfcircdeclarejunctiontransistor{njfet}{}{} +\pgfcircdeclarejunctiontransistor{pjfet}{}{} - \pgfscope - \pgfslopedattimetrue - \pgfallowupsidedownattimetrue - \pgfresetnontranslationattimefalse - \ifpgf@circuit@trans@arrowatend - \edef\@@anchor{btip}\edef\@@pos{1.0} - \else - \edef\@@anchor{center}\edef\@@pos{0.4} +\def\@ujtanchoroverride#1{ + \savedanchor{\ujtrealemitter}{ + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen + \pgf@y=.5\pgf@y %north anchor height + % kink AND conn height, they're the same + \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y + \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y + % horizontal + \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen % left + \ifpgf@circuit@bpt@drawgate\else + \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x \fi - \pgftransformlineattime{\@@pos}{% - \pgfpoint% - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}% - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% - }{% - \pgfpoint{\pgf@circ@res@left}% - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}% - } - \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}} - \endpgfscope - - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth} - {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}} - \pgfusepath{draw} + } + \anchor{E}{\ujtrealemitter} + \anchor{emitter}{\ujtrealemitter} + \anchor{B2}{\northeast\pgf@y=-\pgf@y} + \anchor{B1}{\northeast} } + +\pgfcircdeclarejunctiontransistor{nujt}{\@ujtanchoroverride{nujt}}{} +\pgfcircdeclarejunctiontransistor{pujt}{\@ujtanchoroverride{pujt}}{} + + \pgfdeclaretransistorwrapperaddbulk{isfet}{ }{% % add the circle if requested (before everything else, so we can fill it) diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex index 9400b0c7011..ac87e083040 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex @@ -89,4 +89,35 @@ }}}% } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% subcircuits (experimental) +%% +%% introduced by Romano Giannetti around April 2021 +%% +%% +\newbox\ctikz@scratchbox +\long\def\ctikzsubcircuitdef#1#2#3{% + \expandafter\gdef\csname #1@Anchor\endcsname{} + \expandafter\gdef\csname #1@setanchors\endcsname{ + \setbox\ctikz@scratchbox=\hbox{% + \begin{circuitikz} + \draw (0,0) \csname#1\endcsname{T-#1}{}; + \foreach [count=\i] \anchor in {#2} + % reference anchor is -center + \draw (0,{2-\i/2}) let \p1 = ($(T-#1-subckt@reference)-(T-#1-\anchor)$) in + node[right]{\anchor: \x1,\y1 \expandafter\xdef\csname #1@Anchor\anchor\endcsname{++(\x1,\y1)}}; + \end{circuitikz} + } + } + \expandafter\gdef\csname#1\endcsname##1##2{\csname#1aux\endcsname{##1}{\csname #1@Anchor##2\endcsname}} + \expandafter\gdef\csname#1aux\endcsname##1##2{% + % move to the anchor + ##2 + % reference anchor should be -reference + coordinate (##1-subckt@reference) + #3 + } +} +\long\def\ctikzsubcircuitactivate#1{\csname #1@setanchors\endcsname} + \endinput diff --git a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty index 95631c84b4d..bcf532bfe6f 100644 --- a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty +++ b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty @@ -12,8 +12,8 @@ \NeedsTeXFormat{LaTeX2e} -\def\pgfcircversion{1.3.4} -\def\pgfcircversiondate{2021/04/20} +\def\pgfcircversion{1.3.5} +\def\pgfcircversiondate{2021/05/02} \ProvidesPackage{circuitikz}% [\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] -- cgit v1.2.3