summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-01-14 03:00:53 +0000
committerNorbert Preining <norbert@preining.info>2024-01-14 03:00:53 +0000
commit897aab75a208680c8bb84f43e5da36abb2f47322 (patch)
tree4910bd73f457bb9036581bfd7692baf160b61490 /graphics
parent65fecaf48c4ed6505cb45447a2d7cf1b9d933e3a (diff)
CTAN sync 202401140300
Diffstat (limited to 'graphics')
-rw-r--r--graphics/pgf/contrib/tikzquads/README.md84
-rw-r--r--graphics/pgf/contrib/tikzquads/doc/tikzquads.pdfbin0 -> 500087 bytes
-rw-r--r--graphics/pgf/contrib/tikzquads/doc/tikzquads.tex1037
-rw-r--r--graphics/pgf/contrib/tikzquads/latex/tikzquads.sty2202
4 files changed, 3323 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/tikzquads/README.md b/graphics/pgf/contrib/tikzquads/README.md
new file mode 100644
index 0000000000..4ea07b35cb
--- /dev/null
+++ b/graphics/pgf/contrib/tikzquads/README.md
@@ -0,0 +1,84 @@
+tikzquads
+==========
+
+This package defines a few extra shapes (single / dual port boxes) designed to be used together with
+the CircuiTikZ package.
+
+
+For more details, see the (some) documentation,
+
+[tikzquads.pdf](http://mirrors.ctan.org/graphics/pgf/contrib/tikzdotncross/doc/tikzquads.pdf)
+
+--------------
+
+## Requirements
+* none besides a fairly recent LaTeX distribution as recent as 2022/06/01
+(with the new in kernel *\ProcessKeyOptions* and *\NewDocumentCommand*)
+
+and pgf/TikZ or CircuiTikZ
+
+## Installation
+The stable version is available at [CTAN](https://ctan.org/pkg/tikzquads).
+
+## Usage
+### Stable version
+Just place
+```latex
+ \usepackage{tikzquads}
+```
+
+in the preamble and compile away.
+
+
+Be aware that options might change between versions, so you have to check them manually.
+
+
+## More Information and documentation
+More Information can be found in the documentation; you can find a "bleeding edge" version
+at [the github page](http://github.com/alceu-frigeri/tikzquads)
+
+## Contacting Author
+
+For bug reports and enhancement suggestions, the preferred way is to use
+[the project's issue page](https://github.com/alceu-frigeri/tikzquads/issues).
+Please be ready to provide an example code showing the bug, if any.
+
+Please do not use the issue page for generic help on how to use the package.
+
+* git: https://github.com/alceu-frigeri/tikzquads
+
+-------------
+Copyright 2024-present by Alceu Frigeri
+
+ This work may be distributed and/or modified under the
+ conditions of
+
+ * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), version 1.3c (or later), and/or
+ * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html), version 3 (or later)
+
+This work has the LPPL maintenance status *maintained*.
+
+The Current Maintainer of this work is Alceu Frigeri
+
+-------------
+## This work consists of the files
+
+* tikzquads.sty
+ - The Package itself
+
+* README.md (this file)
+ - quick introduction
+
+* tikzquads.tex
+ - package documentation
+
+* tikzquads.pdf
+ - documentation in PDF format
+
+-------------
+
+## Changelog
+
+
+* Version 1.0
+ - Initial release by CTAN
diff --git a/graphics/pgf/contrib/tikzquads/doc/tikzquads.pdf b/graphics/pgf/contrib/tikzquads/doc/tikzquads.pdf
new file mode 100644
index 0000000000..4ea887cb74
--- /dev/null
+++ b/graphics/pgf/contrib/tikzquads/doc/tikzquads.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tikzquads/doc/tikzquads.tex b/graphics/pgf/contrib/tikzquads/doc/tikzquads.tex
new file mode 100644
index 0000000000..b6f6f1a30b
--- /dev/null
+++ b/graphics/pgf/contrib/tikzquads/doc/tikzquads.tex
@@ -0,0 +1,1037 @@
+% !TEX program = pdflatex
+% !TEX ext = --interaction=nonstopmode --enable-etex --enable-write18
+% !BIB program = none
+%%%==============================================================================
+%% Copyright 2024-present by Alceu Frigeri
+%%
+%% This work may be distributed and/or modified under the conditions of
+%%
+%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
+%% version 1.3c (or later), and/or
+%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
+%% version 3 (or later)
+%%
+%% This work has the LPPL maintenance status *maintained*.
+%%
+%% The Current Maintainer of this work is Alceu Frigeri
+%%
+%% This is version {1.0} {2024/01/13}
+%%
+%% The list of files that compose this work can be found in the README.md file at
+%% https://ctan.org/pkg/tikzdotncross
+%%
+%%%==============================================================================
+\documentclass[10pt]{article}
+\RequirePackage[verbose,a4paper,marginparwidth=27.5mm,top=2.5cm,bottom=1.5cm,hmargin={40mm,20mm},marginparsep=2.5mm,columnsep=10mm,asymmetric]{geometry}
+\usepackage{codedescribe}
+\RequirePackage[inline]{enumitem}
+\SetEnumitemKey{miditemsep}{parsep=0ex,itemsep=0.4ex}
+
+\usepackage[american,siunitx,cuteinductors,smartlabels,arrowmos,EFvoltages,betterproportions]{circuitikz}
+\usetikzlibrary{math}
+\usepackage{tikzdotncross}
+\usepackage{tikzquads}
+
+\RequirePackage{amsmath}
+\RequirePackage{amsthm, amssymb, amsfonts}
+%\RequirePackage{mathrsfs}
+%\RequirePackage{mathtools}
+%\RequirePackage{empheq}
+%\RequirePackage{cases}
+%\RequirePackage{extarrows}
+%\RequirePackage{mathfixs}
+
+\RequirePackage[hidelinks,hypertexnames=false]{hyperref}
+
+
+
+\NewDocumentCommand{\pinanchors}{mm}{ \path \foreach \n/\a/\d in {#2} { (#1.\n) \pincoord(\n,blue,\a,\d)}; }
+\NewDocumentCommand{\pingeoanchors}{m}{ \pinanchors{#1}{%
+ north/90/4, north east/55/4, east/0/4,%
+ south east/-55/4,%
+ south/-90/4, south west/-100/4, west/180/4, north west/100/4,%
+ center/-165/17}
+}
+
+
+\NewDocumentCommand{\pinquadanchors}{m}{%
+ \pinanchors{#1}{%
+ 1+/135/4, 1-/225/4, 2+/45/4, 2-/-45/4, inner 1+/-45/2, inner 1-/45/2, inner 2+/225/2, inner 2-/135/2
+ }
+}
+
+\NewDocumentCommand{\pinblackboxanchors}{m}{%
+ \pinanchors{#1}{%
+ 1+/135/4, 1-/225/4, inner 1+/-45/2, inner 1-/45/2
+ }
+}
+
+\NewDocumentCommand{\pinquadtextanchors}{m}{%
+ \pinanchors{#1}{%
+ bottom left/225/4, bottom center/-90/4, bottom right/-45/4,
+ inner bottom left/225/4, inner bottom center/90/2, inner bottom right/-45/4,
+ top left/135/4, top center/90/4, top right/45/4,
+ inner top left/135/4, inner top center/-90/2, inner top right/45/4
+ }
+}
+
+\begin{document}
+\tstitle{
+ author={Alceu Frigeri\footnote{\tsverb{https://github.com/alceu-frigeri/tikzquads}}},
+ date={\tsdate},
+ title={The tikzquads Package\break An Extension to CircuiTi\emph{k}Z\break Version \PkgInfo{tikzquads}{version}}
+ }
+
+
+\begin{typesetabstract}
+
+This package defines a few extra shapes (single / dual port boxes) designed to be used together with the \tsobj[pkg]{CircuiTikZ} package.
+\end{typesetabstract}
+
+\tableofcontents
+
+\section{Introduction}
+In standard text books, both for Circuits Theory and Electronics, quite frequently, in the process of modelling sub-circuits, one ends representing them either:
+\begin{itemize}
+ \item as a single port \emph{black box}, or
+ \item as a dual port \emph{black box}
+\end{itemize}
+
+This package defines a few, parameterized shapes for each case:
+\begin{itemize}
+ \item for single port \emph{black boxes}:
+ \begin{itemize}
+ \item Black Box
+ \item Thevenin
+ \item Norton
+ \end{itemize}
+ \item for dual port \emph{black boxes}:
+ \begin{itemize}
+ \item Quad
+ \item Quad Z
+ \item Quad Y
+ \item Quad G
+ \item Quad H
+ \end{itemize}
+Lastly, this package also defines a \emph{Pseudo-Graph load line} shape, for those moments where a true graph, \tsobj[pkg]{pgfplots}, isn't needed.
+\end{itemize}
+
+ \subsection{CircuiTi\emph{k}Z}
+ Unfortunately, some implementation details of these shapes don't follow the code structure adopted by \tsobj[pkg]{CircuiTikZ}, and some significant part of this package's code would have to be re-written if it were to be integrated directly in \tsobj[pkg]{CircuiTikZ}, and that's the main reason this is, for the time being, a separate package. After all, even though this doesn't follows \tsobj[pkg]{CircuiTikZ} code scheme, it does work nicely with it, as is.
+
+\section{Auxiliary Shapes and Basic Keys}
+Those shapes are not intended for end users.
+
+\subsection{Auxiliary shapes}\label{auxiliarynodes}
+A set of auxiliary shapes are defined, but not meant to be used otherwise, though their anchors might be relevant:
+
+\begin{center}
+\resizebox{0.8\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) node[QuadKeys,generic,H Res shape](N){};
+ \pingeoanchors{N}
+ \draw (4,0) node[QuadKeys,H Res shape](N){};
+ \pingeoanchors{N}
+ \draw (8,0) node[QuadKeys,generic,V Res shape](N){};
+ \pingeoanchors{N}
+ \draw (12,0) node[QuadKeys,V Res shape](N){};
+ \pingeoanchors{N}
+
+ \draw (0,-2) node[QuadKeys,round sources,IsourceDOWN shape](N){};
+ \pingeoanchors{N}
+ \draw (4,-2) node[QuadKeys,IsourceDOWN shape](N){};
+ \pingeoanchors{N}
+ \draw (8,-2) node[QuadKeys,round sources,IsourceUP shape](N){};
+ \pingeoanchors{N}
+ \draw (12,-2) node[QuadKeys,IsourceUP shape](N){};
+ \pingeoanchors{N}
+
+ \draw (0,-4) node[QuadKeys,round sources,Vsource shape](N){};
+ \pingeoanchors{N}
+ \draw (4,-4) node[QuadKeys,Vsource shape](N){};
+ \pingeoanchors{N}
+
+\end{tikzpicture}}
+\end{center}
+
+\begin{tsremark}
+The point being that, regardless of the sub-shape orientation, the intuitive geographical coordinates applies.
+\end{tsremark}
+
+
+
+\subsection{General Keys}\label{generalkeys}
+These are the keys to fine tuning a shape:
+\begin{describelist*}[30mm]{keys}
+ \describe {outer sep} {Text outer separation, initial value: 1.5pt}
+ \describe {inner sep} {Text inner separation, initial value: 1pt}
+ \describe {thickness} {Components thickness (relative to the drawing thickness), initial value: 2}
+ \describe {tip len} {tip len (current source). initial value: 4pt}
+ \describe {tip type} {possible values: \tsobj[keys]{triangle,bezier}. initial value: \tsobj[keys]{triangle}}
+ \describe {minussign len} {Minus sign len (voltage source). initial value: \tsobj{\pgf@circ@Rlen/14}}
+ \describe {plussign len} {Plus sign len (voltage source). initial value: \tsobj{1.1\pgf@circ@Rlen/14}}
+ \describe {source radius} {The base radius. initial value: \tsobj{0.3\pgf@circ@Rlen}}
+ \describe {round sources} {Sources will be round ones}
+ \describe {control sources} {Sources will be control/diamond ones}
+ \describe {generic, european} {Impedances will be generic rectangles}
+ \describe {zigzag, american} {Impedances will be draw as zigzags}
+\end{describelist*}
+
+
+% \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
+
+
+\section{Z, Y, G, H Quadripoles}\label{quadanchors}
+A set of configurable Quadripoles is defined, whereas quadripoles parameters (for instance $Z_{11}$, $Z_{12}$, $Z_{21}$ and $Z_{22}$) are \tsobj[marg]{key-value} parameters.
+\subsection{The Base Quadripole Shape}
+The base shape just draws a base box and sets some connection anchors: $1+$, $1-$, $inner\ 1+$, $inner\ 1-$, $2+$, $2-$, $inner\ 2+$ and $inner\ 2-$, besides the geographic ones:
+
+%,label bottom left={T1},label bottom center={T2},label bottom right={T3}
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.2+) ++(2,0) node[Quad,anchor=1+](Qb){text};
+ \pinquadanchors{Qb}
+ \end{tikzpicture}
+ }
+\end{center}
+
+And also a set of (meant for) \emph{text} anchors:
+
+\begin{center}
+ \resizebox{0.4\textwidth}{!}{
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+
+
+\subsubsection{Base Keys}\label{quadkeys}
+These applies to all Quad shapes:
+\begin{describelist*}[30mm]{keys}
+ \describe {base width} {The 'box' width}
+ \describe {half base width} {Ditto, half width. Initial value:\tsobj{2\pgf@circ@Rlen}.}
+ \describe {base height} {The distance between \tsobj[keys]{1+,1-}. The 'box' full height is equal to 2*(\tsobj[keys]{half base height} + \tsobj[keys]{height ext} + \tsobj[keys]{height ext+}).}
+ \describe {half base height} {Ditto, half height. Initial value:\tsobj{\pgf@circ@Rlen/7} }
+ \describe {height ext}{Initial value:\tsobj{2\pgf@circ@Rlen/7}}
+ \describe {height ext+}{Initial value:0}
+ \describe {inner ext} {distance between the 'box' and \tsobj{inner 1+/1-/2+/2-}. initial value: \tsobj{\pgf@circ@Rlen/7}}
+ \describe {outer ext} {distance between the 'box' and \tsobj{1+/1-/2+/2-}. initial value: \tsobj{5\pgf@circ@Rlen/14}}
+ \describe {inner marks} {If set, the inner anchors will be marked.}
+ \describe {outer marks} {If set, the outer anchors will be marked.}
+ \describe {invert} {The shape will be inverted, more or less like 'x scale=-1'.}
+ \describe {alt, opt} {Case a Voltage source is zero, a series impedance will be draw vertically.}
+ \describe {outer x fit to} {For any Quad, this is the same as \tsobj[key]{outer x fit to*}.}
+ \describe {outer x fit to*} {\tsobj[keys]{outer x fit*=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) \textbf{will fit} \tsobj[meta]{CoordA,CoordB}. This might result in a shape rotation.}
+ \describe {outer x fit to!} {\tsobj[keys]{outer x fit!=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that the distance between \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) will be the same as \tsobj[meta]{CoordA,CoordB}. This will never result in a shape rotation.}
+ \describe {inner x fit to} {For any Quad, this is the same as \tsobj[key]{inner x fit to*}.}
+ \describe {inner x fit to*} {\tsobj[keys]{inner x fit*=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) \textbf{will fit} \tsobj[meta]{CoordA,CoordB}. This might result in a shape rotation.}
+ \describe {inner x fit to!} {\tsobj[keys]{inner x fit!=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that the distance between \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) will be the same as \tsobj[meta]{CoordA,CoordB}. This will never result in a shape rotation.}
+ \describe {y fit to} {For any Quad, this is the same as \tsobj[key]{y fit to!}.}
+ \describe {y fit to*} {\tsobj[keys]{y fit*=}\tsargs[marg]{CoordA,CoordB}. The height will be set so that \tsobj[keys]{1+,1-} \textbf{will fit} \tsobj[keys]{CoordA,CoordB}. This might result in a shape rotation}
+ \describe {y fit to!} {\tsobj[keys]{y fit!=}\tsargs[marg]{CoordA,CoordB}. The height will be set so that the distance between \tsobj[meta]{1+,1-} will be equal to the distance between \tsobj[marg]{CoordA,CoordB}. This will never result in a shape rotation.}
+%
+% \describe {outer x fit to} {\tsobj[keys]{outer x fit=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) will fit \tsobj[meta]{CoordA,CoordB}}
+% \describe {outer x fit to*} {Same as \tsobj[key]{outer x fit to}, might result in a rotation.}
+% \describe {outer x fit to!} {Same as \tsobj[key]{outer x fit to}, but will never result in a rotation.}
+% \describe {inner x fit to} {\tsobj[keys]{inner x fit=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) will fit \tsobj[meta]{CoordA,CoordB}}
+% \describe {inner x fit to*} {Same as \tsobj[key]{inner x fit to}, might result in a rotation.}
+% \describe {inner x fit to!} {Same as \tsobj[key]{inner x fit to}, but will never result in a rotation.}
+% \describe {y fit to} {\tsobj[keys]{y fit=}\tsargs[marg]{CoordA,CoordB}. The distance between, lets say \tsobj[keys]{1+,1-} will be made equal to the distance between \tsobj[keys]{CoordA,CoordB}.}
+% \describe {y fit to*} {Same as \tsobj[key]{y fit to}, might result in a rotation.}
+% \describe {y fit to!} {Same as \tsobj[key]{y fit to}, but will never result in a rotation.}
+ \describe{label top left}{It will place a label at the top left anchor}
+ \describe{label top center}{It will place a label at the top center anchor}
+ \describe{label top right}{It will place a label at the top right anchor}
+ \describe{label inner top left}{It will place a label at the inner top left anchor}
+ \describe{label inner top center}{It will place a label at the inner top center anchor}
+ \describe{label inner top right}{It will place a label at the inner top right anchor}
+ \describe{label bottom left}{It will place a label at the bottom left anchor}
+ \describe{label bottom center}{It will place a label at the bottom center anchor}
+ \describe{label bottom right}{It will place a label at the bottom right anchor}
+ \describe{label inner bottom left}{It will place a label at the inner bottom left anchor}
+ \describe{label inner bottom center}{It will place a label at the inner bottom center anchor}
+ \describe{label inner bottom right}{It will place a label at the inner bottom right anchor}
+\end{describelist*}
+%\begin{tsremark}
+%For Quadripoles, \tsobj[keys]{outer x fit, inner x fit} might result in a shape rotation. \tsobj[keys]{y fit} never will result in a rotation.
+%\end{tsremark}
+%\begin{tsremark}
+%Those keys can be used with all the following components: \tsobj[meta]{Quad,Quad Z,Quad Y,Quad G,Quad H,ToQuad,ToQuad Z,ToQuad Y,ToQuad G,ToQuad H,Black Box,Thevenin,Norton,ToBlack Box,ToThevenin,ToNorton}.
+%\end{tsremark}
+
+
+A small example of the \emph{fit to} keys:
+\begin{codestore}[QuadKeysA]
+\begin{tikzpicture}
+\draw (0,0) \pincoord(A,blue,225) ++(4,0) \pincoord(B,blue,-45) ++(2,2) \pincoord(C) ;
+
+\draw (A) node[Quad,anchor=1+,outer x fit to={A}{B}](Qa){\footnotesize$Qa$};
+\draw (B) node[Quad,anchor=1+,outer x fit to={B}{C},I1=$I_a$,V2=$V_b$](Qb){\footnotesize$Qb$};
+
+\draw (Qb.2-) -- ++(2,0) \pincoord(D) ++(1,-2) \pincoord(E);
+
+\draw (D) node[Black Box,anchor=1+,y fit to={D}{E}](Ba){\footnotesize$Ba$};
+
+\draw (Qa.1-) ++(0,-1);
+\end{tikzpicture}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node},basicstyle={\scriptsize\ttfamily},numbers=left]{QuadKeysA}
+
+
+
+% show anchors of a node component:
+% optional: options of the circuitikz environment
+% mandatory node spec, node text
+% optional between (): anchor specification list
+\NewDocumentCommand{\showsubanchors}{O{} m m m d()}
+{
+ \begin{circuitikz}[#1]
+ \draw (0,0) node[#2](N){#3};
+ \IfValueT{#5}{%
+ \foreach \sn in {#4} {%
+ \foreach \n/\a/\d in {#5} {%
+ \path (N-\sn.\n) \showcoord(\n)<\a:\d>;
+ }
+ }
+ }
+ ;\par
+ \end{circuitikz}%
+}
+
+\subsection{Quad}
+\begin{codestore}[QuadDef]
+% Node use
+node[Quad]{}
+
+% To path use
+(A) to[ToQuad] (B)
+\end{codestore}
+
+\tscode*[emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton},basicstyle={\scriptsize\ttfamily},numbers=left,codeprefix={}]{QuadDef}
+
+This is just the base shape, to be used in cases whereas one just want to emphasises part of a circuit (using, for instance, the \tsobj[key]{inner x fit to} key, or just mark a two port black box.
+\begin{tsremark}
+There is also a \tsobj[key]{ToQuad} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
+\end{tsremark}
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.2+) ++(2,0) node[Quad,anchor=1+](Qb){text};
+ \pinquadanchors{Qb}
+
+ \draw (Qa.2-) ++(1,-1.5) node[Quad,anchor=north](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+\subsubsection{Quad Keys}
+\begin{describelist*}{keys}
+ \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
+ \describe{I1}{Initial value:\tsverb{$I_1$}}
+ \describe{I2}{Initial value:\tsverb{$I_2$}}
+ \describe{V1}{Initial value:\tsverb{$V_1$}}
+ \describe{V2}{Initial value:\tsverb{$V_2$}}
+\end{describelist*}
+
+
+\subsubsection{Examples of \emph{fit to} use}
+Squeezing a Quadripole between two parts of a circuit (nodes C and D):
+
+\begin{codestore}[QuadfitA]
+\begin{center}
+ \resizebox{0.5\textwidth}{!}{
+ \begin{tikzpicture}
+ \draw (0,0) \pincoord(ref) to[R=R1] ++(0,2) \pincoord(A) to[R=R2] ++(0,2) \pincoord(B)
+ -- ++(2,0) \pincoord(C,red,225) (C |- ref) \pincoord(C1,blue,135) -- (ref);
+ \draw (C) ++(7,0) \pincoord(D,red) -- ++(0.5,0) to[R=R3] ++(0,-3) -- ++(2,0) to[R=R4] ++(0,3) -- ++(0.5,0) \pincoord(E);
+ \draw (C) node[Quad,anchor=1+,y fit to={C}{C1},outer x fit to={C}{D}]{};
+ \end{tikzpicture}
+ }
+\end{center}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,Black,Box},basicstyle={\scriptsize\ttfamily},numbers=left]{QuadfitA}
+
+~
+
+Fitting some circuit inside the Quadripole (nodes C and E):
+\begin{codestore}[QuadfitB]
+\resizebox{0.4\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) \pincoord(ref) to[R=R1] ++(0,2) \pincoord(A) to[R=R2] ++(0,2) \pincoord(B)
+ -- ++(2,0) \pincoord(C,red) (C |- ref) \pincoord(C1) -- (ref);
+ \draw (C) ++(7,0) \pincoord(D) -- ++(0.5,0) to[R=R3] ++(0,-3) -- ++(2,0) to[R=R4] ++(0,3) -- ++(0.5,0) \pincoord(E,red);
+ \draw (C) node[Quad,anchor=inner 1+,y fit to={C}{C1},inner x fit to={C}{E}]{};
+\end{tikzpicture}}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,Black,Box},basicstyle={\scriptsize\ttfamily},numbers=left]{QuadfitB}
+
+
+
+\subsection{Quad Z}
+\begin{codestore}[QuadZDef]
+% Node use
+node[Quad Z]{}
+
+% To path use
+(A) to[ToQuad Z] (B)
+\end{codestore}
+
+\tscode*[emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton},basicstyle={\scriptsize\ttfamily},numbers=left,codeprefix={}]{QuadZDef}
+
+This shape, besides the base anchors (see \ref{quadanchors}) it has 4 internal nodes: \tsobj[key]{<node>-Z11,<node>-Z12,<node>-Z21,<node>-Z22} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
+\begin{tsremark}
+There is also a \tsobj[key]{ToQuad Z} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
+\end{tsremark}
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad Z](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.2+) ++(2,0) node[Quad Z,anchor=1+](Qb){text};
+ \pinquadanchors{Qb}
+ \end{tikzpicture}
+ }
+\end{center}
+\begin{center}%
+ \resizebox{0.4\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad Z,anchor=north](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+\subsubsection{Quad Z keys}
+\begin{describelist*}[30mm]{keys}
+ \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
+ \describe{I1}{Initial value:\tsverb{$I_1$}}
+ \describe{I2}{Initial value:\tsverb{$I_2$}}
+ \describe{V1}{Initial value:\tsverb{$V_1$}}
+ \describe{V2}{Initial value:\tsverb{$V_2$}}
+ \describe{Z11}{Initial value:\tsverb{$Z_{11}$}}
+ \describe{Z12}{Initial value:\tsverb{$Z_{12}$}}
+ \describe{Z21}{Initial value:\tsverb{$Z_{21}$}}
+ \describe{Z22}{Initial value:\tsverb{$Z_{22}$}}
+ \describe{Z11 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
+ \describe{Z12 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
+ \describe{Z21 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
+ \describe{Z22 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top right}}}
+\end{describelist*}
+\begin{tsremark}
+The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
+\end{tsremark}
+
+
+
+\subsection{Quad Y}
+\begin{codestore}[QuadYDef]
+% Node use
+node[Quad Y]{}
+
+% To path use
+(A) to[ToQuad Y] (B)
+\end{codestore}
+
+\tscode*[emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton},basicstyle={\scriptsize\ttfamily},numbers=left,codeprefix={}]{QuadYDef}
+This shape, besides the base anchors (see \ref{quadanchors}) it has 4 internal nodes: \tsobj[key]{<node>-Y11,<node>-Y12,<node>-Y21,<node>-Y22} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
+\begin{tsremark}
+There is also a \tsobj[key]{ToQuad Y} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
+\end{tsremark}
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad Y](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.2+) ++(2,0) node[Quad Y,anchor=1+](Qb){text};
+ \pinquadanchors{Qb}
+ \end{tikzpicture}
+ }
+\end{center}
+\begin{center}%
+ \resizebox{0.4\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad Y,anchor=north](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+\subsubsection{Quad Y keys}
+\begin{describelist*}[30mm]{keys}
+ \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
+ \describe{I1}{Initial value:\tsverb{$I_1$}}
+ \describe{I2}{Initial value:\tsverb{$I_2$}}
+ \describe{V1}{Initial value:\tsverb{$V_1$}}
+ \describe{V2}{Initial value:\tsverb{$V_2$}}
+ \describe{Y11}{Initial value:\tsverb{$Y_{11}$}}
+ \describe{Y12}{Initial value:\tsverb{$Y_{12}$}}
+ \describe{Y21}{Initial value:\tsverb{$Y_{21}$}}
+ \describe{Y22}{Initial value:\tsverb{$Y_{22}$}}
+ \describe{Y11 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
+ \describe{Y12 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
+ \describe{Y21 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
+ \describe{Y22 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
+\end{describelist*}
+\begin{tsremark}
+The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
+\end{tsremark}
+
+\subsection{Quad G}
+\begin{codestore}[QuadGDef]
+% Node use
+node[Quad G]{}
+
+% To path use
+(A) to[ToQuad G] (B)
+\end{codestore}
+
+\tscode*[emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton},basicstyle={\scriptsize\ttfamily},numbers=left,codeprefix={}]{QuadGDef}
+
+This shape, besides the base anchors (see \ref{quadanchors}) it has 4 internal nodes: \tsobj[key]{<node>-G11,<node>-G12,<node>-G21,<node>-G22} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
+\begin{tsremark}
+There is also a \tsobj[key]{ToQuad G} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
+\end{tsremark}
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad G](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.2+) ++(2,0) node[Quad G,anchor=1+](Qb){text};
+ \pinquadanchors{Qb}
+ \end{tikzpicture}
+ }
+\end{center}
+\begin{center}%
+ \resizebox{0.4\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad G,anchor=north](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+
+\subsubsection{Quad G keys}
+\begin{describelist*}[30mm]{keys}
+ \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
+ \describe{I1}{Initial value:\tsverb{$I_1$}}
+ \describe{I2}{Initial value:\tsverb{$I_2$}}
+ \describe{V1}{Initial value:\tsverb{$V_1$}}
+ \describe{V2}{Initial value:\tsverb{$V_2$}}
+ \describe{G11}{Initial value:\tsverb{$G_{11}$}}
+ \describe{G12}{Initial value:\tsverb{$G_{12}$}}
+ \describe{G21}{Initial value:\tsverb{$G_{21}$}}
+ \describe{G22}{Initial value:\tsverb{$G_{22}$}}
+ \describe{G11 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
+ \describe{G12 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
+ \describe{G21 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
+ \describe{G22 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top right}}}
+\end{describelist*}
+\begin{tsremark}
+The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
+\end{tsremark}
+
+\subsection{Quad H}
+\begin{codestore}[QuadHDef]
+% Node use
+node[Quad H]{}
+
+% To path use
+(A) to[ToQuad H] (B)
+\end{codestore}
+
+\tscode*[emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton},basicstyle={\scriptsize\ttfamily},numbers=left,codeprefix={}]{QuadHDef}
+
+This shape, besides the base anchors (see \ref{quadanchors}) it has 4 internal nodes: \tsobj[key]{<node>-H11,<node>-H12,<node>-H21,<node>-H22} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
+\begin{tsremark}
+There is also a \tsobj[key]{ToQuad H} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{outer x fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
+\end{tsremark}
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad H](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.2+) ++(2,0) node[Quad H,anchor=1+](Qb){text};
+ \pinquadanchors{Qb}
+ \end{tikzpicture}
+ }
+\end{center}
+\begin{center}%
+ \resizebox{0.4\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Quad H,anchor=north](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+
+
+\subsubsection{Quad H keys}
+\begin{describelist*}[30mm]{keys}
+ \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
+ \describe{I1}{Initial value:\tsverb{$I_1$}}
+ \describe{I2}{Initial value:\tsverb{$I_2$}}
+ \describe{V1}{Initial value:\tsverb{$V_1$}}
+ \describe{V2}{Initial value:\tsverb{$V_2$}}
+ \describe{H11}{Initial value:\tsverb{$H_{11}$}}
+ \describe{H12}{Initial value:\tsverb{$H_{12}$}}
+ \describe{H21}{Initial value:\tsverb{$H_{21}$}}
+ \describe{H22}{Initial value:\tsverb{$H_{22}$}}
+ \describe{H11 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
+ \describe{H12 label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
+ \describe{H21 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
+ \describe{H22 label pos}{changes the label position. Defaults to: \tsobj[verb]{{north west}{bottom right}}}
+\end{describelist*}
+
+\begin{tsremark}
+The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
+\end{tsremark}
+
+~
+
+\section{Thevenin, Norton single port boxes}
+
+
+\subsection{The Base Black Box Shape}\label{BBanchors}
+
+The base shape just draws a base box and sets some connection anchors: $1+$, $1-$, $inner\ 1+$, $inner\ 1-$, besides the geographic and text ones:
+
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Black Box](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.east) ++(2,0) node[Black Box,anchor=west](Qb){text};
+ \pinblackboxanchors{Qb}
+ \draw (Qb.east) ++(2,0) node[Black Box,anchor=west](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+
+~
+
+\subsubsection{Base Keys}\label{BBkeys}
+
+These applies to all \emph{Black Box} shapes:
+
+\begin{describelist*}[30mm]{keys}
+ \describe {base width} {The 'box' width}
+ \describe {half base width} {Ditto, half width. Initial value:\tsobj{2\pgf@circ@Rlen}.}
+ \describe {base height} {The distance between \tsobj[keys]{1+,1-}. The 'box' full height is equal to 2*(\tsobj[keys]{half base height} + \tsobj[keys]{height ext} + \tsobj[keys]{height ext+}).}
+ \describe {half base height} {Ditto, half height. Initial value:\tsobj{\pgf@circ@Rlen/7} }
+ \describe {height ext}{Initial value:\tsobj{2\pgf@circ@Rlen/7}}
+ \describe {height ext+}{Initial value:0}
+ \describe {inner ext} {distance between the 'box' and \tsobj{inner 1+/1-/2+/2-}. initial value: \tsobj{\pgf@circ@Rlen/7}}
+ \describe {outer ext} {distance between the 'box' and \tsobj{1+/1-/2+/2-}. initial value: \tsobj{5\pgf@circ@Rlen/14}}
+ \describe {inner marks} {If set, the inner anchors will be marked.}
+ \describe {outer marks} {If set, the outer anchors will be marked.}
+ \describe {invert} {The shape will be inverted, more or less like 'x scale=-1'.}
+ \describe {alt, opt} {Case a Voltage source is zero, a series impedance will be draw vertically.}
+ \describe {outer x fit to} {For any Black Box, this is the same as \tsobj[key]{outer x fit to!}.}
+ \describe {outer x fit to*} {\tsobj[keys]{outer x fit*=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) \textbf{will fit} \tsobj[meta]{CoordA,CoordB}. This might result in a shape rotation.}
+ \describe {outer x fit to!} {\tsobj[keys]{outer x fit!=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that the distance between \tsobj[meta]{1+,2+} (or \tsobj[meta]{1-,2-}, depending on the used anchor) will be the same as \tsobj[meta]{CoordA,CoordB}. This will never result in a shape rotation.}
+ \describe {inner x fit to} {For any Black Box, this is the same as \tsobj[key]{inner x fit to!}.}
+ \describe {inner x fit to*} {\tsobj[keys]{inner x fit*=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) \textbf{will fit} \tsobj[meta]{CoordA,CoordB}. This might result in a shape rotation.}
+ \describe {inner x fit to!} {\tsobj[keys]{inner x fit!=}\tsargs[marg]{CoordA,CoordB}. The width will be set so that the distance between \tsobj[meta]{inner 1+,inner 2+} (or \tsobj[meta]{inner 1-,inner 2-}, depending on the used anchor) will be the same as \tsobj[meta]{CoordA,CoordB}. This will never result in a shape rotation.}
+ \describe {y fit to} {For any Black Box, this is the same as \tsobj[key]{y fit to*}.}
+ \describe {y fit to*} {\tsobj[keys]{y fit*=}\tsargs[marg]{CoordA,CoordB}. The height will be set so that \tsobj[keys]{1+,1-} \textbf{will fit} \tsobj[keys]{CoordA,CoordB}. This might result in a shape rotation}
+ \describe {y fit to!} {\tsobj[keys]{y fit!=}\tsargs[marg]{CoordA,CoordB}. The height will be set so that the distance between \tsobj[meta]{1+,1-} will be equal to the distance between \tsobj[marg]{CoordA,CoordB}. This will never result in a shape rotation.}
+ \describe{label top left}{It will place a label at the top left anchor}
+ \describe{label top center}{It will place a label at the top center anchor}
+ \describe{label top right}{It will place a label at the top right anchor}
+ \describe{label inner top left}{It will place a label at the inner top left anchor}
+ \describe{label inner top center}{It will place a label at the inner top center anchor}
+ \describe{label inner top right}{It will place a label at the inner top right anchor}
+ \describe{label bottom left}{It will place a label at the bottom left anchor}
+ \describe{label bottom center}{It will place a label at the bottom center anchor}
+ \describe{label bottom right}{It will place a label at the bottom right anchor}
+ \describe{label inner bottom left}{It will place a label at the inner bottom left anchor}
+ \describe{label inner bottom center}{It will place a label at the inner bottom center anchor}
+ \describe{label inner bottom right}{It will place a label at the inner bottom right anchor}
+\end{describelist*}
+
+\subsection{Black Box}
+\begin{codestore}[BBDef]
+% Node use
+node[Black Box]{}
+
+% To path use
+(A) to[ToBlack Box] (B)
+\end{codestore}
+
+\tscode*[emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton},basicstyle={\scriptsize\ttfamily},numbers=left,codeprefix={}]{BBDef}
+This is just the base shape, to be used in cases whereas one just want to emphasises part of a circuit (using, for instance, the \tsobj[key]{inner x fit to} key, or just mark a single port black box.
+\begin{tsremark}
+There is also a \tsobj[key]{ToBlack Box} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{y fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
+\end{tsremark}
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Black Box](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.east) ++(2,0) node[Black Box,anchor=west](Qb){text};
+ \pinblackboxanchors{Qb}
+ \draw (Qb.east) ++(2,0) node[Black Box,anchor=west](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+~
+
+\subsubsection{Black Box keys}
+\begin{describelist*}[30mm]{keys}
+ \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
+ \describe{I1}{Initial value:\tsverb{$I_1$}}
+ \describe{V1}{Initial value:\tsverb{$V_1$}}
+\end{describelist*}
+
+\subsubsection{Examples of \emph{fit to} use}
+Squeezing a Black Box between two parts of a circuit (nodes C and D):
+
+\begin{codestore}[BBfitA]
+\resizebox{0.4\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) \pincoord(ref) to[R=R1] ++(0,2) \pincoord(A) to[R=R2] ++(0,2) \pincoord(B)
+ -- ++(2,0) \pincoord(C,red) (C |- ref) \pincoord(C1) -- (ref);
+ \draw (C) ++(7,0) \pincoord(D,red) -- ++(0.5,0) to[R=R3] ++(0,-3) -- ++(2,0) to[R=R4] ++(0,3) -- ++(0.5,0) \pincoord(E);
+ \draw (C) node[Black Box,anchor=1+,y fit to={C}{C1},outer x fit to={C}{D}]{};
+\end{tikzpicture}
+}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,Black,Box},basicstyle={\scriptsize\ttfamily},numbers=left]{BBfitA}
+
+~
+
+Fitting some circuit inside the Black Box (nodes C and E):
+\begin{codestore}[BBfitB]
+\resizebox{0.4\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) \pincoord(ref) to[R=R1] ++(0,2) \pincoord(A) to[R=R2] ++(0,2) \pincoord(B)
+ -- ++(2,0) \pincoord(C,red) (C |- ref) \pincoord(C1) -- (ref);
+ \draw (C) ++(7,0) \pincoord(D,red) -- ++(0.5,0) to[R=R3] ++(0,-3) -- ++(2,0) to[R=R4] ++(0,3) -- ++(0.5,0) \pincoord(E);
+ \draw (C) node[Black Box,anchor=inner 1+,y fit to={C}{C1},inner x fit to={C}{E}]{};
+\end{tikzpicture}
+}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,Black,Box},basicstyle={\scriptsize\ttfamily},numbers=left]{BBfitB}
+
+
+\subsection{Thevenin}
+\begin{codestore}[TheveninDef]
+% Node use
+node[Thevenin]{}
+
+% To path use
+(A) to[ToThevenin] (B)
+\end{codestore}
+
+\tscode*[emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton},basicstyle={\scriptsize\ttfamily},numbers=left,codeprefix={}]{TheveninDef}
+This is the classical Thevenin circuit. Besides the base anchors (see \ref{BBanchors}) it has 2 internal nodes: \tsobj[key]{<node>-Zth,<node>-Vth} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
+\begin{tsremark}
+There is also a \tsobj[key]{ToThevenin} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{y fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
+\end{tsremark}
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Thevenin](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.east) ++(2,0) node[Thevenin,anchor=west](Qb){text};
+ \pinblackboxanchors{Qb}
+ \draw (Qb.east) ++(2,0) node[Thevenin,anchor=west](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+
+
+\subsubsection{Thevenin keys}
+\begin{describelist*}[30mm]{keys}
+ \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
+ \describe{I1}{Initial value:\tsverb{$I_1$}}
+ \describe{V1}{Initial value:\tsverb{$V_1$}}
+ \describe{Zth}{Initial value:\tsverb{$Z_{th}$}}
+ \describe{Vth}{Initial value:\tsverb{$V_{th}$}}
+ \describe{Zth label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
+ \describe{Vth label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
+\end{describelist*}
+\begin{tsremark}
+The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
+\end{tsremark}
+
+\subsection{Norton}
+\begin{codestore}[NortonDef]
+% Node use
+node[Norton]{}
+
+% To path use
+(A) to[ToNorton] (B)
+\end{codestore}
+
+\tscode*[emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton},basicstyle={\scriptsize\ttfamily},numbers=left,codeprefix={}]{NortonDef}
+This is the classical Norton circuit. Besides the base anchors (see \ref{BBanchors}) it has 2 internal nodes: \tsobj[key]{<node>-Yn,<node>-In} and each of those sub-nodes has geographic anchors as defined at \ref{auxiliarynodes}.
+\begin{tsremark}
+There is also a \tsobj[key]{ToNorton} to be used in a \tsobj[key]{to[ ]} path, in which case the key \tsobj[key]{y fit to} style will be triggered with the starting and ending points of the \tsobj[key]{to[ ]} path.
+\end{tsremark}
+
+\begin{center}%
+ \resizebox{0.8\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[Norton](Qa){text};
+ \pingeoanchors{Qa}
+ \draw (Qa.east) ++(2,0) node[Norton,anchor=west](Qb){text};
+ \pinblackboxanchors{Qb}
+ \draw (Qb.east) ++(2,0) node[Norton,anchor=west](Qc){text};
+ \pinquadtextanchors{Qc}
+ \end{tikzpicture}
+ }
+\end{center}
+
+\subsubsection{Norton keys}
+\begin{describelist*}[30mm]{keys}
+ \describe {name} {\tsmeta{node-name}, when using a to[\,] path.}
+ \describe{I1}{Initial value:\tsverb{$I_1$}}
+ \describe{V1}{Initial value:\tsverb{$V_1$}}
+ \describe{Yn}{Initial value:\tsverb{$Y_{N}$}}
+ \describe{In}{Initial value:\tsverb{$I_{N}$}}
+ \describe{Yn label pos}{changes the label position. Defaults to: \tsobj[verb]{{south west}{top left}}}
+ \describe{In label pos}{changes the label position. Defaults to: \tsobj[verb]{{south east}{top left}}}
+\end{describelist*}
+\begin{tsremark}
+The label pos keys expects two anchor names (... label pos=\tsargs[marg]{anchor A,anchor B}). The first anchors refers the sub-shape node and the second anchor is the text one.
+\end{tsremark}
+
+
+\section{Pseudo-Graph Shape}
+\begin{codestore}[PGDef]
+% Node use
+node[PG load line]{}
+
+node[PG linear load line]
+\end{codestore}
+
+\tscode*[emph={draw,node},emph2={x,y,fit,to,outer,inner,node},emph3={Quad,ToQuad,Black,ToBlack,Box,Thevenin,ToThevenin,Norton,ToNorton,PG,load,line,linear},basicstyle={\scriptsize\ttfamily},numbers=left,codeprefix={}]{PGDef}
+
+Sometimes when representing a single port sub-circuit, one might use a X-Y graph, for which \tsobj[pkg]{gnuplot,pgfplots} are excellent choices, but a bit overkill if all you want is a crude representation of a linear load line.
+
+This shape is just that, a X-Y graph mockup, that nicely fits inside a black box, and nothing else.
+
+\begin{center}%
+% \resizebox{0.2\textwidth}{!}{%
+ \begin{tikzpicture}
+ \draw (0,0) node[PG linear load line,first quadrant](PGa){};
+ \pingeoanchors{PGa}
+ \draw (4,0) node[PG linear load line,second quadrant](PGa){};
+ \pingeoanchors{PGa}
+ \draw (8,0) node[PG linear load line,third quadrant](PGa){};
+ \pingeoanchors{PGa}
+ \draw (12,0) node[PG linear load line,fourth quadrant](PGa){};
+ \pingeoanchors{PGa}
+ \end{tikzpicture}
+% }
+\end{center}
+
+
+\subsection{Pseudo-Graph Keys}
+
+These are the keys to fine tuning a shape:
+\begin{describelist*}[30mm]{keys}
+ \describe {x axis} {X axis \emph{name}. Initial value: $V$}
+ \describe {x val} {X axis \emph{val} at the crossing point. Initial value: $V_{th}$}
+ \describe {y axis} {Y axis \emph{name}. Initial value: $I$}
+ \describe {y val} {Y axis \emph{val} at the crossing point. Initial value: $I_{N}$}
+ \describe {first quadrant} {First quadrant mock up. (which is also the default).}
+ \describe {second quadrant} {Second quadrant mock up.}
+ \describe {third quadrant} {Third quadrant mock up.}
+ \describe {fourth quadrant} {Fourth quadrant mock up.}
+ \describe {base width} {The \emph{graph} width}
+ \describe {half base width} {Ditto, half width. Initial value:\tsobj{0.5\pgf@circ@Rlen}.}
+ \describe {base height} {The \emph{graph} height}
+ \describe {half base height} {Ditto, half height. Initial value:\tsobj{0.5\pgf@circ@Rlen}.}
+\end{describelist*}
+\begin{tsremark}
+Besides these, one can also use the keys presented at \ref{generalkeys}.
+\end{tsremark}
+
+
+\section{Examples of use}
+
+First of, a simple case of combining a generic Quad with equations and a generic Black Box with a Pseudo-Graph:
+
+\begin{codestore}[DemoX]
+\resizebox{\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) \ncoord(ref) node[Quad,anchor=1+](Q1){}
+ (Q1.2+) -- ++(1,0) \ncoord(X) -- ++(1,0) node[Black Box,anchor=1+,V1=$V_a$,I1=$I_a$](B1){}
+ (Q1.2-) -- (B1.1-)
+ (B1.center) node[PG linear load line,x axis=$V_a$,y axis=$I_a$]{}
+ (Q1.center) node{$ \begin{matrix}
+ V_1 &=& 5j*V_2 + 2*I_2 \\
+ I_1 &=& 3*V_2 + 2j*I_2
+ \end{matrix} $%
+ } ;
+\end{tikzpicture}
+}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node,coord},emph2={x,y,axis,fit,to,outer,inner,round,control,sources,european,alt},emph3={Quad,Black,Box,PG,linear,load,line},basicstyle={\scriptsize\ttfamily},numbers=left]{DemoX}
+
+~
+
+All default Quadripoles and Thevenin/Norton.
+
+\begin{codestore}[DemoA]
+\resizebox{\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) \ncoord(ref) node[Quad Z,anchor=1+](Qz1){}
+ (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,anchor=1+](Qy1){}
+ (Qy1.2+) -- ++(1,0) node[Thevenin,anchor=1+](th1){}
+ (Qz1.1-) -- ++(0,-1.5) node[Quad H,anchor=1+](Qh1){}
+ (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,anchor=1+](Qg1){}
+ (Qg1.2+) -- ++(1,0) node[Norton,anchor=1+](nr1){}
+ (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
+ (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
+ ;
+ \draw (X) to[R=$Rx$] (X |- Qz1.2-)
+ (Y) to[R=$Ry$] (Y |- Qh1.2-)
+ ;
+\end{tikzpicture}
+}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node,coord},emph2={x,y,fit,to,outer,inner,round,control,sources,european,alt},emph3={Quad,Black,Box},basicstyle={\scriptsize\ttfamily},numbers=left]{DemoA}
+
+~
+
+
+The same demo but with all parameter $11$ and $22$ zeroed, and changing the ``control sources''
+
+\begin{codestore}[DemoB]
+\resizebox{\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) \ncoord(ref) node[Quad Z,anchor=1+,Z11=0,Z22=0,I1=$I_a$,V1=$V_a$,I2=$I_b$,V2=$V_b$](Qz1){}
+ (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,anchor=1+,Y11=0,Y22=0,I1=$I_d$,V1=$V_d$,I2=$I_c$,V2=$V_c$](Qy1){}
+ (Qy1.2+) -- ++(1,0) node[Thevenin,anchor=1+,Zth=0,I1=$I_h$,V1=$V_h$](th1){}
+ (Qz1.1-) -- ++(0,-1.5) node[Quad H,anchor=1+,H11=0,H22=0,I1=$I_e$,V1=$V_e$,I2=$I_e$,V2=$V_e$](Qh1){}
+ (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,anchor=1+,G11=0,G22=0,I1=$I_g$,V1=$V_g$,I2=$I_f$,V2=$V_f$](Qg1){}
+ (Qg1.2+) -- ++(1,0) node[Norton,anchor=1+,Yn=0,I1=$I_i$,V1=$V_i$](nr1){}
+ (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
+ (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
+ ;
+ \draw (X) to[R=$Rx$] (X |- Qz1.2-)
+ (Y) to[R=$Ry$] (Y |- Qh1.2-)
+ ;
+\end{tikzpicture}
+}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node,coord},emph2={x,y,fit,to,outer,inner,round,control,sources,european,alt},emph3={Quad,Black,Box},basicstyle={\scriptsize\ttfamily},numbers=left]{DemoB}
+~
+
+
+Now with the $12$ and $21$ parameters zeroed, normal form:
+
+\begin{codestore}[DemoC]
+\resizebox{\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) \ncoord(ref) node[Quad Z,anchor=1+,Z12=0,Z21=0,I1=$I_a$,V1=$V_a$,I2=$I_b$,V2=$V_b$](Qz1){}
+ (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,anchor=1+,Y12=0,Y21=0,I1=$I_d$,V1=$V_d$,I2=$I_c$,V2=$V_c$](Qy1){}
+ (Qy1.2+) -- ++(1,0) node[Thevenin,anchor=1+,Vth=0,I1=$I_h$,V1=$V_h$](th1){}
+ (Qz1.1-) -- ++(0,-1.5) node[Quad H,anchor=1+,H12=0,H21=0,I1=$I_e$,V1=$V_e$,I2=$I_e$,V2=$V_e$](Qh1){}
+ (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,anchor=1+,G12=0,G21=0,I1=$I_g$,V1=$V_g$,I2=$I_f$,V2=$V_f$](Qg1){}
+ (Qg1.2+) -- ++(1,0) node[Norton,anchor=1+,In=0,I1=$I_i$,V1=$V_i$](nr1){}
+ (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
+ (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
+ ;
+ \draw (X) to[R=$Rx$] (X |- Qz1.2-)
+ (Y) to[R=$Ry$] (Y |- Qh1.2-)
+ ;
+\end{tikzpicture}
+}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node,coord},emph2={x,y,fit,to,outer,inner,round,control,sources,european,alt},emph3={Quad,Black,Box},basicstyle={\scriptsize\ttfamily},numbers=left]{DemoC}
+
+~
+
+Same as last one, but with an alternate form:
+
+\begin{codestore}[DemoC]
+\resizebox{\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) \ncoord(ref) node[Quad Z,alt,anchor=1+,Z12=0,Z21=0,I1=$I_a$,V1=$V_a$,I2=$I_b$,V2=$V_b$](Qz1){}
+ (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,alt,anchor=1+,Y12=0,Y21=0,I1=$I_d$,V1=$V_d$,I2=$I_c$,V2=$V_c$](Qy1){}
+ (Qy1.2+) -- ++(1,0) node[Thevenin,alt,anchor=1+,Vth=0,I1=$I_h$,V1=$V_h$](th1){}
+ (Qz1.1-) -- ++(0,-1.5) node[Quad H,alt,anchor=1+,H12=0,H21=0,I1=$I_e$,V1=$V_e$,I2=$I_e$,V2=$V_e$](Qh1){}
+ (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,alt,anchor=1+,G12=0,G21=0,I1=$I_g$,V1=$V_g$,I2=$I_f$,V2=$V_f$](Qg1){}
+ (Qg1.2+) -- ++(1,0) node[Norton,alt,anchor=1+,In=0,I1=$I_i$,V1=$V_i$](nr1){}
+ (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
+ (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
+ ;
+ \draw (X) to[R=$Rx$] (X |- Qz1.2-)
+ (Y) to[R=$Ry$] (Y |- Qh1.2-)
+ ;
+\end{tikzpicture}
+}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node,coord},emph2={x,y,fit,to,outer,inner,round,control,sources,european,alt},emph3={Quad,Black,Box},basicstyle={\scriptsize\ttfamily},numbers=left]{DemoC}
+
+~
+
+
+Setting all parameters,some impedances as zig-zag, others as generic, per quadripole:
+
+
+
+\begin{codestore}[DemoD]
+\resizebox{\textwidth}{!}{
+\begin{tikzpicture}
+ \draw (0,0) \ncoord(ref) node[Quad Z,alt,round sources,european,anchor=1+,Z11=$Z_a$,Z22=$Z_b$,Z12=$Z_{re}$,Z21=$Z_{fe}$,I1=$I_a$,V1=$V_a$,I2=$I_b$,V2=$V_b$](Qz1){}
+ (Qz1.2+) -- ++(1.5,0) \ncoord(X) -- ++(1.5,0) node[Quad Y,alt,anchor=1+,Y11=$Y_a$,Y22=$Y_b$,Y12=$Y_{re}$,Y21=$Y_{fe}$,I1=$I_d$,V1=$V_d$,I2=$I_c$,V2=$V_c$](Qy1){}
+ (Qy1.2+) -- ++(1,0) node[Thevenin,alt,anchor=1+,Vth=$V_1$,Zth=$Z_a$,I1=$I_h$,V1=$V_h$](th1){}
+ (Qz1.1-) -- ++(0,-1.5) node[Quad H,european,alt,anchor=1+,H11=$H_a$,H22=$H_b$,H12=$H_{re}$,H21=$H_{fe}$,I1=$I_e$,V1=$V_e$,I2=$I_e$,V2=$V_e$](Qh1){}
+ (Qh1.2+) -- ++(1.5,0) \ncoord(Y) -- ++(1.5,0) node[Quad G,alt,anchor=1+,G11=$G_a$,G22=$G_b$,G12=$G_{re}$,G21=$G_{fe}$,I1=$I_g$,V1=$V_g$,I2=$I_f$,V2=$V_f$](Qg1){}
+ (Qg1.2+) -- ++(1,0) node[Norton,alt,control sources,european,anchor=1+,In=$I_b$,Yn=$Y_b$,I1=$I_i$,V1=$V_i$](nr1){}
+ (Qz1.2-) -- (Qy1.1-) (Qy1.2-) -- (th1.1-)
+ (Qh1.2-) -- (Qg1.1-) (Qg1.2-) -- (nr1.1-)
+ ;
+ \draw (X) to[R=$Rx$] (X |- Qz1.2-)
+ (Y) to[R=$Ry$] (Y |- Qh1.2-)
+ ;
+\end{tikzpicture}
+}
+\end{codestore}
+
+\tsdemo*[codeprefix={},resultprefix={},emph={draw,node,coord},emph2={x,y,fit,to,outer,inner,round,control,sources,european,alt},emph3={Quad,Black,Box},basicstyle={\scriptsize\ttfamily},numbers=left]{DemoD}
+
+
+
+\end{document}
diff --git a/graphics/pgf/contrib/tikzquads/latex/tikzquads.sty b/graphics/pgf/contrib/tikzquads/latex/tikzquads.sty
new file mode 100644
index 0000000000..31fc675742
--- /dev/null
+++ b/graphics/pgf/contrib/tikzquads/latex/tikzquads.sty
@@ -0,0 +1,2202 @@
+%%%==============================================================================
+%% Copyright 2024-present by Alceu Frigeri
+%%
+%% This work may be distributed and/or modified under the conditions of
+%%
+%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt),
+%% version 1.3c (or later), and/or
+%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html),
+%% version 3 (or later)
+%%
+%% This work has the LPPL maintenance status *maintained*.
+%%
+%% The Current Maintainer of this work is Alceu Frigeri
+%%
+%% This is version {1.0} {2024/01/13}
+%%
+%% The list of files that compose this work can be found in the README.md file at
+%% https://ctan.org/pkg/tikzquads
+%%
+%%%==============================================================================
+%% WARNING: These are personal packs/tests
+%% They might and probably will change at will as needed
+%%
+%%%==============================================================================
+\NeedsTeXFormat{LaTeX2e}[2022/06/01]
+
+
+\ProvidesExplPackage
+ {tikzquads}
+ {2024/01/13}
+ {1.0}
+ {CircuiTikZ Extension - Quadripoles and Dipoles}
+
+\ExplSyntaxOn
+%%%%%%%
+%%%
+%%% Just an attempt of having my packages info in a regular way
+%%% Idea being: { <pck-name> / pkg info } for each and all.
+%%%
+%%%%%%%
+\keys_define:nn { tikzquads / pkg info}
+ {
+ name .code:n = {tikzquads} ,
+ prefix .code:n = {tikzquads} ,
+ date .code:n = {2024/01/13},
+ version .code:n = {1.0} ,
+ description .code:n = {CircuiTikZ~ Extension~- Quadripoles~ and~ Dipoles}
+ }
+\cs_if_exist:NF \PkgInfo
+ {
+ \NewDocumentCommand \PkgInfo {mm} { \keys_set:nn {#1 / pkg info}{#2} }
+ \NewDocumentCommand \PkgDescription {m}
+ { \noindent Package~ \textbf{\PkgInfo{#1}{name}}~Version:~\PkgInfo{#1}{version}~ -~ \PkgInfo{#1}{date}\par \emph{\PkgInfo{#1}{description}}~\par }
+ }
+%%%%%%%
+%%% End of cut-n-paste
+%%%%%%%
+
+\RequirePackage{pgfkeysearch}
+
+\ExplSyntaxOff
+
+
+\makeatletter
+
+%%%
+%%% This only makes sense 'for this package'
+%%%
+\NewDocumentCommand{\SearchValueOf}{mmm}{%
+ \pgfkeysearchvalueof{\csuse{tikzquads@@#1Path}}{#2}{#3}
+ }
+
+%
+%%%%%%%%%%%%%%%
+%%%
+%%% In case \SearchValueOf 'fails' one could use this (no expl3 code)
+%%%
+%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@ValueOf}[2]{\pgfkeysvalueof{\csuse{tikzquads@@#1Path}/#2}}
+
+
+\newtoggle{tikzquads@@toggle@inverted}
+\newtoggle{tikzquads@@toggle@generic}
+\newtoggle{tikzquads@@toggle@alternate}
+\newtoggle{tikzquads@@toggle@innermarks}
+\newtoggle{tikzquads@@toggle@outermarks}
+\newtoggle{tikzquads@@toggle@beziertip}
+\newtoggle{tikzquads@@toggle@roundsources}
+%
+
+%
+%%%%%%%%%%%%%%%
+%%%
+%%% general/base "Keys" Path
+%%%
+%%%%%%%%%%%%%%%
+%
+\def\tikzquads@@KeysPath{/tikz/tikzquads}
+\pgfkeys{\tikzquads@@KeysPath/.is family}
+
+\pgfkeys{\tikzquads@@KeysPath,
+ .search also={/tikz},
+ tip len/.initial=4pt,
+ tip type/.is choice,
+ tip type/bezier/.code={\toggletrue{tikzquads@@toggle@beziertip}},
+ tip type/triangle/.code={\togglefalse{tikzquads@@toggle@beziertip}},
+ source radius/.initial=0.3\pgf@circ@Rlen,%
+ @round sources/.code={\toggletrue{tikzquads@@toggle@roundsources}},
+ round sources/.style={@round sources},
+ @control sources/.code={\togglefalse{tikzquads@@toggle@roundsources}},
+ control sources/.style={@control sources},
+ thickness/.initial=2,
+ @generic/.code={\toggletrue{tikzquads@@toggle@generic}},
+ generic/.style={@generic},
+ european/.style={@generic},
+ @zigzag/.code={\togglefalse{tikzquads@@toggle@generic}},
+ zigzag/.style={@zigzag},
+ american/.style={@zigzag},
+ name/.initial={}, % this will be, if defined, the node name used in a to[] path
+ minussign len/.initial=1.0\pgf@circ@Rlen/14,%
+ plussign len/.initial=1.1\pgf@circ@Rlen/14,%
+ outer sep/.initial=1.5pt, %% Text separation
+ inner sep/.initial=1pt, %% Text separation
+}
+
+%%%%%%%%%%%%%%%
+%%%
+%%% "PGKeys" Path (for PseudoGraph)
+%%%
+%%%%%%%%%%%%%%%
+
+\def\tikzquads@@PGKeysPath{\tikzquads@@KeysPath/PseudoGraph}
+\pgfkeys{\tikzquads@@PGKeysPath/.is family}
+\pgfkeys{/tikz/PGKeys/.style={\tikzquads@@PGKeysPath}}
+
+\pgfkeys{\tikzquads@@PGKeysPath,
+ .search also={\tikzquads@@KeysPath,/tikz},
+ x axis/.initial={\footnotesize$V$},
+ y axis/.initial={\footnotesize$I$},
+ x val/.initial={\footnotesize$V_{th}$},
+ y val/.initial={\footnotesize$I_{N}$},
+ @PGPoints/.code={%
+ \tikzmath{%
+ %real \x , \y;
+ \y{Xaxispos}=\y{innerbottom};
+ \x{Yaxispos}=\x{innerleft};
+ %
+ \x{coordA}=\x{left};
+ \y{coordA}=\y{Ctop};
+ %
+ \x{coordB}=\x{Cright};
+ \y{coordB}=\y{bottom};
+ %
+ \y{TXaxiscoord}=\y{bottom};
+ \x{TYaxiscoord}=\x{left};
+ %
+ \x{TXvalcoord}=\x{Cright}-0;
+ \y{TXvalcoord}=\y{bottom};
+ %
+ \x{TYvalcoord}=\x{left};
+ \y{TYvalcoord}=\y{Ctop}-0;
+ }
+ \gdef\tikzquads@@PG@XaxisTanchor{top left}
+ \gdef\tikzquads@@PG@XvalTanchor{top right}
+ %
+ \gdef\tikzquads@@PG@YaxisTanchor{bottom right}
+ \gdef\tikzquads@@PG@YvalTanchor{top right}
+ },
+ first quadrant/.style={%
+ @PGPoints/.code={%
+ \tikzmath{%
+ %real \x , \y;
+ \y{Xaxispos}=\y{innerbottom};
+ \x{Yaxispos}=\x{innerleft};
+ %
+ \x{coordA}=\x{left};
+ \y{coordA}=\y{Ctop};
+ %
+ \x{coordB}=\x{Cright};
+ \y{coordB}=\y{bottom};
+ %
+ \y{TXaxiscoord}=\y{bottom};
+ \x{TYaxiscoord}=\x{left};
+ %
+ \x{TXvalcoord}=\x{Cright}-0;
+ \y{TXvalcoord}=\y{bottom};
+ %
+ \x{TYvalcoord}=\x{left};
+ \y{TYvalcoord}=\y{Ctop}-0;
+ }
+ \gdef\tikzquads@@PG@XaxisTanchor{top left}
+ \gdef\tikzquads@@PG@XvalTanchor{top right}
+ %
+ \gdef\tikzquads@@PG@YaxisTanchor{bottom right}
+ \gdef\tikzquads@@PG@YvalTanchor{top right}
+ },
+ },
+ second quadrant/.style={%
+ @PGPoints/.code={%
+ \tikzmath{%
+ %real \x , \y;
+ \y{Xaxispos}=\y{innerbottom};
+ \x{Yaxispos}=\x{innerright};
+ %
+ \x{coordA}=\x{right};
+ \y{coordA}=\y{Ctop};
+ %
+ \x{coordB}=\x{Cleft};
+ \y{coordB}=\y{bottom};
+ %
+ \y{TXaxiscoord}=\y{bottom};
+ \x{TYaxiscoord}=\x{Cright};
+ %
+ \x{TXvalcoord}=\x{Cleft}+2pt;
+ \y{TXvalcoord}=\y{bottom};
+ %
+ \x{TYvalcoord}=\x{right};
+ \y{TYvalcoord}=\y{Ctop}-2pt;
+ }
+ \gdef\tikzquads@@PG@XaxisTanchor{top left}
+ \gdef\tikzquads@@PG@XvalTanchor{top left}
+ %
+ \gdef\tikzquads@@PG@YaxisTanchor{bottom right}
+ \gdef\tikzquads@@PG@YvalTanchor{top left}
+ },
+ },
+ third quadrant/.style={%
+ @PGPoints/.code={%
+ \tikzmath{%
+ %real \x , \y;
+ \y{Xaxispos}=\y{innertop};
+ \x{Yaxispos}=\x{innerright};
+ %
+ \x{coordA}=\x{Cleft};
+ \y{coordA}=\y{top};
+ %
+ \x{coordB}=\x{right};
+ \y{coordB}=\y{Cbottom};
+ %
+ \y{TXaxiscoord}=\y{Ctop};
+ \x{TYaxiscoord}=\x{Cright};
+ %
+ \x{TXvalcoord}=\x{Cleft}+2pt;
+ \y{TXvalcoord}=\y{top};
+ %
+ \x{TYvalcoord}=\x{right};
+ \y{TYvalcoord}=\y{Cbottom}+2pt;
+ }
+ \gdef\tikzquads@@PG@XaxisTanchor{top left}
+ \gdef\tikzquads@@PG@XvalTanchor{bottom left}
+ %
+ \gdef\tikzquads@@PG@YaxisTanchor{bottom right}
+ \gdef\tikzquads@@PG@YvalTanchor{bottom left}
+ },
+ },
+ fourth quadrant/.style={%
+ @PGPoints/.code={%
+ \tikzmath{%
+ %real \x , \y;
+ \y{Xaxispos}=\y{innertop};
+ \x{Yaxispos}=\x{innerleft};
+ %
+ \x{coordA}=\x{left};
+ \y{coordA}=\y{Cbottom};
+ %
+ \x{coordB}=\x{Cright};
+ \y{coordB}=\y{top};
+ %
+ \y{TXaxiscoord}=\y{Ctop};
+ \x{TYaxiscoord}=\x{left};
+ %
+ \x{TXvalcoord}=\x{Cright}-2pt;
+ \y{TXvalcoord}=\y{top};
+ %
+ \x{TYvalcoord}=\x{left};
+ \y{TYvalcoord}=\y{Cbottom}+2pt;
+ }
+ \gdef\tikzquads@@PG@XaxisTanchor{top left}
+ \gdef\tikzquads@@PG@XvalTanchor{bottom right}
+ %
+ \gdef\tikzquads@@PG@YaxisTanchor{bottom right}
+ \gdef\tikzquads@@PG@YvalTanchor{bottom right}
+ },
+ },
+ half base height/.initial=0.5\pgf@circ@Rlen,%
+ base height/.code={%
+ \tikzmath{real \X;
+ \X{tmp} = 0.5*abs(#1);
+ }
+ \pgfkeysalso{\tikzquads@@QuadKeysPath/half base height=\X{tmp}}
+ },
+ half base width/.initial=0.5\pgf@circ@Rlen,%
+ base width/.code={%
+ \tikzmath{real \X;
+ \X{tmp} = 0.5*abs(#1);
+ }
+ \pgfkeysalso{\tikzquads@@QuadKeysPath/half base width=\X{tmp}}
+ },
+}
+
+
+%%%%%%%%%%%%%%%
+%%%
+%%% "QUadKeys" Path (Quadripoles)
+%%%
+%%%%%%%%%%%%%%%
+
+\def\tikzquads@@QuadKeysPath{\tikzquads@@KeysPath/QuadKeys}
+\pgfkeys{\tikzquads@@QuadKeysPath/.is family}
+\pgfkeys{/tikz/QuadKeys/.style={\tikzquads@@QuadKeysPath}}
+
+\newcommand{\tikzquads@@QuadGetAnchor}[2]{\pgfkeys{\tikzquads@@QuadKeysPath,#1={#2}}}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% "R" Path (Rotation)
+%%%
+%%% re-mapping 'anchors names' in case of a 90 degree (clockwise) rotation
+%%% assuming the element should always be 90 degree rotated.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\def\tikzquads@@RPath{\tikzquads@@QuadKeysPath/Anchor +90 Rotation}
+\pgfkeys{\tikzquads@@RPath/.is family}
+\pgfkeys{\tikzquads@@RPath,
+ south/.code={\csdef{#1}{west}},
+ south east/.code={\csdef{#1}{south west}},
+ east/.code={\csdef{#1}{south}},
+ north east/.code={\csdef{#1}{south east}},
+ north/.code={\csdef{#1}{east}},
+ north west/.code={\csdef{#1}{north east}},
+ west/.code={\csdef{#1}{north}},
+ south west/.code={\csdef{#1}{north west}},
+}
+\newcommand{\tikzquads@@RotateAnchor}[2]{\pgfkeys{\tikzquads@@RPath,#1={#2}}}
+
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% "AutoR" Path (Rotation)
+%%%
+%%% re-mapping 'anchors names' in case of a 90 degree (clockwise) rotation
+%%% assuming the element should always be 90 degree rotated.
+%%%
+%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%
+%%%%%% re-mapping 'anchors names' in case of an auto 90 degree (clockwise) rotation
+%%%%%% assuming the rotation was conditional (and original anchors were thought in the original position.)
+%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%
+%%%\def\tikzquads@@AutoRPath{\tikzquads@@QuadKeysPath/Anchor Auto +90 Rotation}
+%%%\pgfkeys{\tikzquads@@AutoRPath/.is family}
+%%%\pgfkeys{\tikzquads@@AutoRPath,
+%%% east/.code={\csdef{#1}{south}},
+%%% west/.code={\csdef{#1}{north}},
+%%% south west/.code={\csdef{#1}{south west}},
+%%% south east/.code={\csdef{#1}{north east}},
+%%% south/.code={\csdef{#1}{west}},
+%%% north/.code={\csdef{#1}{east}},
+%%% north east/.code={\csdef{#1}{north east}},
+%%% north west/.code={\csdef{#1}{south west}},
+%%%}
+%%%\newcommand{\tikzquads@@AutoRotateAnchor}[2]{\pgfkeys{\tikzquads@@AutoRPath,#1={#2}}}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% re-mapping 'anchors names' in case of an 'auto' 90 degree (clockwise) rotation H Res -> V Res
+%%% assuming the rotation was conditional (and original anchors were thought in the original position.)
+%%%
+%%%%%%%%%%%%%%%%%%%
+\def\tikzquads@@AutoRPath{\tikzquads@@QuadKeysPath/Anchor Auto +90 Rotation}
+\pgfkeys{\tikzquads@@AutoRPath/.is family}
+\pgfkeys{\tikzquads@@AutoRPath,
+ east/.code={\csdef{#1}{east}},
+ west/.code={\csdef{#1}{west}},
+ south west/.code={\csdef{#1}{south east}},
+ south east/.code={\csdef{#1}{south west}},
+ south/.code={\csdef{#1}{south}},
+ north/.code={\csdef{#1}{north}},
+ north east/.code={\csdef{#1}{north west}},
+ north west/.code={\csdef{#1}{north east}},
+}
+\newcommand{\tikzquads@@AutoRotateAnchor}[2]{\pgfkeys{\tikzquads@@AutoRPath,#1={#2}}}
+
+
+%
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% re-mapping 'anchors names' in case of an 'invert' key
+%%%
+%%%%%%%%%%%%%%%%%%%
+\def\tikzquads@@TPath{\tikzquads@@QuadKeysPath/Translation}
+\pgfkeys{\tikzquads@@TPath/.is family}
+\pgfkeys{\tikzquads@@TPath,
+ setdefault/.style={#1/.code={\csdef{##1}{#1}}},
+ setdefault/.list={south west,south east,north west,north east,west,east,top left,top right,bottom left,bottom right,left,right},
+ set/.style 2 args={#1/.code={\csdef{##1}{#2}}},
+ .unknown/.code={\csdef{#1}{\pgfkeyscurrentname}},
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% pgf hackery, well, extention: allowing composit names
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfkeys{/pgf/text/.cd,
+ top left/.style={/pgf/text/.cd,top,left},
+ top right/.style={/pgf/text/.cd,top,right},
+ bottom left/.style={/pgf/text/.cd,bottom,left},
+ bottom right/.style={/pgf/text/.cd,bottom,right},
+}
+
+%
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% User Shapes as styles. Note that 'QuadKeys' assure that following keys are in the correct tree.
+%%%
+%%%%%%%%%%%%%%%%%%%
+
+\tikzset{BB/.style={BB shape,QuadKeys,@BB fit set,half base width=\pgf@circ@Rlen}}
+\tikzset{Black Box/.style={BB shape,QuadKeys,@BB fit set,half base width=\pgf@circ@Rlen}}
+\tikzset{Norton/.style={NortonBB shape,QuadKeys,@BB fit set,round sources,half base width=\pgf@circ@Rlen}}
+\tikzset{Thevenin/.style={TheveninBB shape,QuadKeys,@BB fit set,round sources,half base width=\pgf@circ@Rlen}}
+
+\tikzset{Quad compact/.style={Quad shape,QuadKeys,half base width=\pgf@circ@Rlen}}
+\tikzset{Quad/.style={Quad shape,QuadKeys}}
+\tikzset{Quad Z/.style={Quad Z shape,QuadKeys}}
+\tikzset{Quad Y/.style={Quad Y shape,QuadKeys}}
+\tikzset{Quad G/.style={Quad G shape,QuadKeys}}
+\tikzset{Quad H/.style={Quad H shape,QuadKeys}}
+
+\tikzset{PG load line/.style={PG linear load line shape,PGKeys}}
+\tikzset{PG linear load line/.style={PG linear load line shape,PGKeys}}
+
+%%
+%% These DO work, but be careful: the node gets a name only if <name> key is defined.
+%%
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% User shapes/keys which can be used in a to[]
+%%% These DO work, but be careful: the node gets a name only if <name> key is defined.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\tikzset{ToQuad/.style={to path={node[Quad,outer x fit to={\tikztostart}{\tikztotarget}](\tikzquads@@ValueOf{Keys}{name}){}},QuadKeys}}
+\tikzset{ToQuad Z/.style={to path={node[Quad Z,outer x fit to={\tikztostart}{\tikztotarget}](\tikzquads@@ValueOf{Keys}{name}){}},QuadKeys}}
+\tikzset{ToQuad Y/.style={to path={node[Quad Y,outer x fit to={\tikztostart}{\tikztotarget}](\tikzquads@@ValueOf{Keys}{name}){}},QuadKeys}}
+\tikzset{ToQuad G/.style={to path={node[Quad G,outer x fit to={\tikztostart}{\tikztotarget}](\tikzquads@@ValueOf{Keys}{name}){}},QuadKeys}}
+\tikzset{ToQuad H/.style={to path={node[Quad H,outer x fit to={\tikztostart}{\tikztotarget}](\tikzquads@@ValueOf{Keys}{name}){}},QuadKeys}}
+\tikzset{ToNorton/.style={to path={node[Norton,@BB fit set,y fit to={\tikztostart}{\tikztotarget}](\tikzquads@@ValueOf{Keys}{name}){}},QuadKeys}}
+\tikzset{ToThevenin/.style={to path={node[Thevenin,@BB fit set,y fit to={\tikztostart}{\tikztotarget}](\tikzquads@@ValueOf{Keys}{name}){}},QuadKeys}}
+\tikzset{ToBlack Box/.style={to path={node[Black Box,@BB fit set,y fit to={\tikztostart}{\tikztotarget}](\tikzquads@@ValueOf{Keys}{name}){}},QuadKeys}}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Main keys definition
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfkeys{\tikzquads@@QuadKeysPath,
+ %.unknown/.code={\let\searchname=\pgfkeyscurrentname%
+ % \pgfkeysalso{/tikz/\searchname=#1}},
+ .search also={\tikzquads@@KeysPath,/tikz},
+ none/.initial={}, %% this is a 'hack' for Thevenin/Norton ('control variable')
+ half base width/.initial=2\pgf@circ@Rlen,%
+ base width/.code={%
+ \tikzmath{real \X;
+ \X{tmp} = 0.5*abs(#1);
+ }
+ \pgfkeysalso{\tikzquads@@QuadKeysPath/half base width=\X{tmp}}
+ },
+ height ext/.initial=4\pgf@circ@Rlen/14,%
+ height ext+/.style={height ext={4\pgf@circ@Rlen/14 + #1}},%
+ height/.initial=\pgf@circ@Rlen,%
+ half base height/.initial=10\pgf@circ@Rlen/14,%
+ base height/.code={%
+ \tikzmath{real \X;
+ \X{tmp} = 0.5*abs(#1);
+ }
+ \pgfkeysalso{\tikzquads@@QuadKeysPath/half base height=\X{tmp}}
+ },
+ inner ext/.initial=2\pgf@circ@Rlen/14,%
+ outer ext/.initial=5\pgf@circ@Rlen/14,
+ Y11/.initial=$Y_{11}$, Y12/.initial=$Y_{12}$, Y21/.initial=$Y_{21}$, Y22/.initial=$Y_{22}$,
+ Z11/.initial=$Z_{11}$, Z12/.initial=$Z_{12}$, Z21/.initial=$Z_{21}$, Z22/.initial=$Z_{22}$,
+ H11/.initial=$H_{11}$, H12/.initial=$H_{12}$, H21/.initial=$H_{21}$, H22/.initial=$H_{22}$,
+ G11/.initial=$G_{11}$, G12/.initial=$G_{12}$, G21/.initial=$G_{21}$, G22/.initial=$G_{22}$,
+ I1/.initial=$I_1$, I2/.initial=$I_2$, V1/.initial=$V_1$, V2/.initial=$V_2$,
+ In/.initial=$I_N$, Yn/.initial=$Y_N$, Vth/.initial=$V_{th}$, Zth/.initial=$Z_{th}$,
+ label top left/.initial={},
+ label top center/.initial={},
+ label top right/.initial={},
+ label inner top left/.initial={},
+ label inner top center/.initial={},
+ label inner top right/.initial={},
+ label bottom left/.initial={},
+ label bottom center/.initial={},
+ label bottom right/.initial={},
+ label inner bottom left/.initial={},
+ label inner bottom center/.initial={},
+ label inner bottom right/.initial={},
+ @inner marks/.code={\toggletrue{tikzquads@@toggle@innermarks}},
+ inner marks/.style={@inner marks},
+ @outer marks/.code={\toggletrue{tikzquads@@toggle@outermarks}},
+ outer marks/.style={@outer marks},
+ @invert/.code={\toggletrue{tikzquads@@toggle@inverted}},
+ invert/.style={%
+ /tikz/xscale=-1,
+ @invert,
+ \tikzquads@@TPath,
+% set={south west}{south east},
+% set={south east}{south west},
+% set={north west}{north east},
+% set={north east}{north west},
+% set={west}{east},
+% set={east}{west},
+ set={bottom left}{bottom right},
+ set={bottom right}{bottom left},
+ set={top left}{top right},
+ set={top right}{top left},
+ set={left}{right},
+ set={right}{left},
+ \tikzquads@@QuadKeysPath,
+ },
+ compact/.style={half base width=\pgf@circ@Rlen},
+ @alternate/.code={\toggletrue{tikzquads@@toggle@alternate}},
+ alt/.style={@alternate},
+ opt/.style={@alternate},
+ inner x fit to/.style 2 args={inner x fit to*={#1}{#2}},
+ inner x fit to*/.code 2 args={%
+ \SearchValueOf{QuadKeys}{inner ext}{\@@innerext}
+ \tikzquads@@fitto{#1}{#2}{\@@innerext}{0}{\Xdiff}{\Xang}
+ \pgfkeysalso{/tikz/rotate=\Xang,\tikzquads@@QuadKeysPath/half base width=\Xdiff}
+ },
+ inner x fit to!/.code 2 args={%
+ \SearchValueOf{QuadKeys}{inner ext}{\@@innerext}
+ \tikzquads@@fitto{#1}{#2}{\@@innerext}{0}{\Xdiff}{\Xang}
+ \pgfkeysalso{\tikzquads@@QuadKeysPath/half base width=\Xdiff}
+ },
+ outer x fit to/.style 2 args={outer x fit to*={#1}{#2}},
+ outer x fit to*/.code 2 args={%
+ \SearchValueOf{QuadKeys}{outer ext}{\@@outerext}
+ \tikzquads@@fitto{#1}{#2}{-\@@outerext}{0}{\Xdiff}{\Xang}
+ \pgfkeysalso{/tikz/rotate=\Xang,\tikzquads@@QuadKeysPath/half base width=\Xdiff}
+ } ,
+ outer x fit to!/.code 2 args={%
+ \SearchValueOf{QuadKeys}{outer ext}{\@@outerext}
+ \tikzquads@@fitto{#1}{#2}{-\@@outerext}{0}{\Xdiff}{\Xang}
+ \pgfkeysalso{\tikzquads@@QuadKeysPath/half base width=\Xdiff}
+ } ,
+ y fit to/.style 2 args={y fit to!={#1}{#2}},
+ y fit to*/.code 2 args={%
+ \tikzquads@@fitto{#1}{#2}{0}{90}{\Ydiff}{\Yang}
+ \pgfkeysalso{/tikz/rotate=\Yang,\tikzquads@@QuadKeysPath/half base height=\Ydiff}
+ } ,
+ y fit to!/.code 2 args={%
+ \tikzquads@@fitto{#1}{#2}{0}{90}{\Ydiff}{\Yang}
+ \pgfkeysalso{\tikzquads@@QuadKeysPath/half base height=\Ydiff}
+ } ,
+ @BB fit set/.style={%
+ inner x fit to/.style 2 args={inner x fit to!={##1}{##2}},
+ outer x fit to/.style 2 args={outer x fit to!={##1}{##2}},
+ y fit to/.style 2 args={y fit to*={##1}{##2}},
+ }
+}
+
+\NewDocumentCommand{\tikzquads@@fitto}{mmmmmm}{
+ \tikzmath{coordinate \Ctmp; real \dx , \dy;% , \Rtmp ;
+ \Ctmp{from} = (#1);
+ \Ctmp{to} = (#2);
+ \dx{tmp} = (\Ctmpx{to} - \Ctmpx{from})/100;
+ \dy{tmp} = (\Ctmpy{to} - \Ctmpy{from})/100;
+ #5 = 50*sqrt((\dx{tmp})^2 + (\dy{tmp})^2) + #3;
+ #6 = atan2(\dy{tmp},\dx{tmp}) + #4;
+ }
+}
+
+\pgfkeys{\tikzquads@@QuadKeysPath,
+ setlabelscmd/.style={%
+ #1 N anchor/.style={},
+ #1 T anchor/.style={},
+ #1 label pos/.style 2 args={#1 N anchor/.style={\tikzquads@@TPath,##1=####1}, #1 T anchor/.style={\tikzquads@@TPath,##2=####1}, },
+ },
+ setlabelscmd/.list={Z11,Z12,Z21,Z22,Y11,Y12,Y21,Y22,G11,G12,G21,G22,H11,H12,H21,H22,In,Yn,Vth,Zth},
+ defaults/.style={
+ Z11 label pos={south west}{top left},
+ Z12 label pos={south east}{top left},
+ Z21 label pos={north west}{bottom right},
+ Z22 label pos={south east}{top right},
+%
+ Y11 label pos={south east}{top left},
+ Y12 label pos={south east}{top left},
+ Y21 label pos={north west}{bottom right},
+ Y22 label pos={north west}{bottom right},
+%
+ G11 label pos={south east}{top left},
+ G12 label pos={south east}{top left},
+ G21 label pos={north west}{bottom right},
+ G22 label pos={south east}{top right},
+%
+ H11 label pos={south west}{top left},
+ H12 label pos={south east}{top left},
+ H21 label pos={north west}{bottom right},
+ H22 label pos={north west}{bottom right},
+ %
+ Yn label pos={south east}{top left},
+ In label pos={south east}{top left},
+ %
+ Zth label pos={south west}{top left},
+ Vth label pos={south east}{top left},
+ %
+ },
+ defaults,
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Coordinates for a Quadripole
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@QuadPoints}{
+ \SearchValueOf{QuadKeys}{half base width}{\@@halfbasewidth}
+ \SearchValueOf{QuadKeys}{half base height}{\@@halfbaseheight}
+ \SearchValueOf{QuadKeys}{height ext}{\@@heightext}
+ \SearchValueOf{QuadKeys}{outer ext}{\@@outerext}
+ \SearchValueOf{QuadKeys}{inner ext}{\@@innerext}
+ \tikzmath{
+ real \x,\y;
+ \x{center}=0;
+ \y{center}=0;
+ \x{right}=0 + \@@halfbasewidth;
+ \y{top}=0 +( \@@halfbaseheight + \@@heightext);
+ %
+ \x{left}=0 - \@@halfbasewidth;
+ \y{bottom}=0 -( \@@halfbaseheight + \@@heightext);
+ %
+ \y{innerbottom}=0 - \@@halfbaseheight;
+ \y{innertop}=0 + \@@halfbaseheight;
+ %
+ \y{outerbottom}=\y{bottom} - 0.5*\@@outerext;
+ \y{outertop}=\y{top} + 0.5*\@@outerext;
+ %
+ \x{outerleft}=\x{left} - \@@outerext;
+ \x{innerleft}=\x{left} + \@@innerext;
+ %
+ \x{outerright}=\x{right} + \@@outerext;
+ \x{innerright}=\x{right} - \@@innerext;
+ %
+ \x{refC}=0 - 0.4*\@@halfbasewidth;
+ \x{refB}=(\x{innerleft}+\x{refC})/2; %center point for Res shape
+ \x{refA}=(2*\x{innerleft}+\x{refC})/3; %'center' point for Y.Res shape
+ %
+ \y{Tbottom}=\y{bottom} + 0.65ex;
+ %\y{Ttop}=-\y{Tbottom};
+ \x{Tinnerleft}=\x{innerleft} ;
+ \y{Tinnerbottom}=\y{innerbottom} + 0.95ex;
+ %\y{Tinnertop}=-\y{Tinnerbottom};
+ \x{Tinnerright}=\x{innerright};
+ \x{Tcenter}=0;
+ %
+ \y{Ttop}=\y{top} - 0.65ex;
+ \y{Tinnertop}=\y{innertop} - 0.95ex;
+ }
+}
+
+
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% if <key value>, #1, is zero, #2 is executed, otherwise #3.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@CondDraw}[3]{
+ \IfDecimal{\tikzquads@@ValueOf{QuadKeys}{#1}}{
+ \ifnumequal{0+\tikzquads@@ValueOf{QuadKeys}{#1}}{0}{%
+ #2
+ }{%
+ #3
+ }
+ }{#3}
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% if <key value>, #1, is zero, a in place line is drawn, otherwise shape #2 is draw.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@Zdraw}[5]{
+ \tikzquads@@CondDraw{#1}{%
+ \pgfnode{Shadow #2}{#3}{}{\tikz@fig@name-#1}{\pgfusepath{discard}}
+ \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#1}{#4}}
+ \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#1}{#5}}
+ \pgfusepath{stroke}
+ }{%
+ \pgfnode{#2}{#3}{}{\tikz@fig@name-#1}{\pgfusepath{stroke}}
+ }
+}
+
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Draws a Z side (impedance in series with a Voltage source
+%%%
+%%%%%%%%%%%%%%%%%%%
+
+\newtoggle{tikzquads@@toggle@auxA}
+\newtoggle{tikzquads@@toggle@auxB}
+%
+% #1->z11/z22 (res)
+% #2->z12/z21 (vsource)
+% #3 -> 'control source' I1/I2/V1/V2
+% #4->"-" minus signal !!! for B side
+%
+\newcommand{\tikzquads@@Zside}[4]{
+ \togglefalse{tikzquads@@toggle@auxA}
+ \IfDecimal{\tikzquads@@ValueOf{QuadKeys}{#1}}{
+ \ifnumequal{0+\tikzquads@@ValueOf{QuadKeys}{#1}}{0}{
+ \toggletrue{tikzquads@@toggle@auxA}}
+ }{}{
+ }
+ \togglefalse{tikzquads@@toggle@auxB}
+ \IfDecimal{\tikzquads@@ValueOf{QuadKeys}{#2}}{
+ \ifnumequal{0+\tikzquads@@ValueOf{QuadKeys}{#2}}{0}{
+ \toggletrue{tikzquads@@toggle@auxB}}
+ }{}{
+ }
+ \ifboolexpr{togl{tikzquads@@toggle@alternate} and ( togl{tikzquads@@toggle@auxA} or togl{tikzquads@@toggle@auxB})}{
+ \iftoggle{tikzquads@@toggle@auxA}{
+ {
+ \pgftransformshift{\pgfpoint{#4\x{refB}}{0}}
+ \tikzquads@@Zdraw{#2}{Vsource shape}{center}{north}{south}
+ }
+ {
+ \pgfpathmoveto{\pgfpoint{#4\x{innerleft}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpoint{#4\x{refB}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#2}{north}}
+ \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#2}{south}}
+ \pgfpathlineto{\pgfpoint{#4\x{refB}}{\y{innerbottom}}}
+ \pgfpathlineto{\pgfpoint{#4\x{innerleft}}{\y{innerbottom}}}
+ \pgfusepath{stroke}
+ }
+ }{
+ {
+ \pgftransformshift{\pgfpoint{#4\x{refB}}{0}}
+% \pgftransformrotate{90} %%% was #490
+% \tikzquads@@Zdraw{#1}{H Res shape}{center}{west}{east}
+ \tikzquads@@Zdraw{#1}{V Res shape}{center}{north}{south}
+ \pgfusepath{stroke}
+ }
+ {
+ \pgfpathmoveto{\pgfpoint{#4\x{innerleft}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpoint{#4\x{refB}}{\y{innertop}}}
+% \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#1}{east}}
+% \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#1}{west}}
+ \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#1}{north}}
+ \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#1}{south}}
+ \pgfpathlineto{\pgfpoint{#4\x{refB}}{\y{innerbottom}}}
+ \pgfpathlineto{\pgfpoint{#4\x{innerleft}}{\y{innerbottom}}}
+ \pgfusepath{stroke}
+ }
+ }
+ }{
+ {
+ \pgftransformshift{\pgfpoint{#4\x{refB}}{\y{innertop}}}
+ \tikzquads@@Zdraw{#1}{H Res shape}{center}{west}{east}
+ }
+ {
+ \pgftransformshift{\pgfpoint{#4\x{refC}}{0}}
+ \tikzquads@@Zdraw{#2}{Vsource shape}{center}{north}{south}
+ }
+ {
+ \pgfpathmoveto{\pgfpoint{#4\x{innerleft}}{\y{innertop}}}
+ \ifnumequal{#41}{-1}{%
+ \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#1}{east}}
+ \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#1}{west}}
+ }{%
+ \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#1}{west}}
+ \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#1}{east}}
+ }
+ \pgfpathlineto{\pgfpoint{#4\x{refC}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#2}{north}}
+ \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#2}{south}}
+ \pgfpathlineto{\pgfpoint{#4\x{refC}}{\y{innerbottom}}}
+ \pgfpathlineto{\pgfpoint{#4\x{innerleft}}{\y{innerbottom}}}
+ \pgfusepath{stroke}
+ }
+ }
+%
+ \tikzquads@@QuadGetAnchor{#2 N anchor}{tikzquads@@NanchorB}
+ \tikzquads@@QuadGetAnchor{#1 T anchor}{tikzquads@@TanchorA}
+ \tikzquads@@QuadGetAnchor{#2 T anchor}{tikzquads@@TanchorB}
+ \ifboolexpr{togl{tikzquads@@toggle@alternate} and togl{tikzquads@@toggle@auxB}}{%
+ \tikzquads@@QuadGetAnchor{#1 N anchor}{tikzquads@@NanchorAx}
+ \tikzquads@@AutoRotateAnchor{\tikzquads@@NanchorAx}{tikzquads@@NanchorA}
+ }{%
+ \tikzquads@@QuadGetAnchor{#1 N anchor}{tikzquads@@NanchorA}
+ }
+ {
+ \SearchValueOf{QuadKeys}{#1}{\@@valA}
+ \SearchValueOf{QuadKeys}{#2}{\@@valB}
+ \SearchValueOf{QuadKeys}{#3}{\@@valC}
+ \pgftransformresetnontranslations
+ \tikzquads@@CondDraw{#1}{}{\pgftext[\tikzquads@@TanchorA,at={\pgfpointanchor{\tikz@fig@name-#1}{\tikzquads@@NanchorA}}]{\@@valA}}
+ \tikzquads@@CondDraw{#2}{}{\pgftext[\tikzquads@@TanchorB,at={\pgfpointanchor{\tikz@fig@name-#2}{\tikzquads@@NanchorB}}]{\@@valB\@@valC}}
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% if <key value>, #1, is zero, nothing is drawn, otherwise shape #2 is draw.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@Ydraw}[3]{
+ \tikzquads@@CondDraw{#1}{%
+ \pgfnode{Shadow #2}{#3}{}{\tikz@fig@name-#1}{\pgfusepath{discard}}
+ }{%
+ \pgfnode{#2}{#3}{}{\tikz@fig@name-#1}{\pgfusepath{stroke}}
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Draws a Y side (impedance in paralel with a Currente source
+%%%
+%%%%%%%%%%%%%%%%%%%
+
+% #1 Isource UP/DWN
+% #2->y11/y22 (res)
+% #3->y12/y21 (isource)
+% #4 -> 'control source' I1/I2/V1/V2
+% #5->"-" minus signal !!! for B side
+%
+\newcommand{\tikzquads@@Yside}[5][IsourceDOWN shape]{
+ \togglefalse{tikzquads@@toggle@auxA}
+ \IfDecimal{\tikzquads@@ValueOf{QuadKeys}{#2}}{
+ \ifnumequal{0+\tikzquads@@ValueOf{QuadKeys}{#2}}{0}{
+ \toggletrue{tikzquads@@toggle@auxA}}
+ }{}{
+ }
+ \togglefalse{tikzquads@@toggle@auxB}
+ \IfDecimal{\tikzquads@@ValueOf{QuadKeys}{#3}}{
+ \ifnumequal{0+\tikzquads@@ValueOf{QuadKeys}{#3}}{0}{
+ \toggletrue{tikzquads@@toggle@auxB}}
+ }{}{
+ }
+ \ifboolexpr{togl{tikzquads@@toggle@alternate} and ( togl{tikzquads@@toggle@auxA} or togl{tikzquads@@toggle@auxB})}{
+ \tikzmath{
+ \x{20} = \x{refB};
+ \x{21} = \x{refB};
+ }
+ }{
+ \tikzmath{
+ \x{20} = \x{refA};
+ \x{21} = \x{refC};
+ }
+ }
+%
+ {
+ \pgftransformshift{\pgfpoint{#5\x{20}}{0}}
+% \pgftransformrotate{90} %%% was {#590}
+% \tikzquads@@Ydraw{#2}{H Res shape}{center}
+ \tikzquads@@Ydraw{#2}{V Res shape}{center}
+ }
+ \tikzquads@@CondDraw{#2}{}{
+ \pgfpathmoveto{\pgfpoint{#5\x{innerleft}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpoint{#5\x{20}}{\y{innertop}}}
+% \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#2}{east}}
+% \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#2}{west}}
+ \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#2}{north}}
+ \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#2}{south}}
+ \pgfpathlineto{\pgfpoint{#5\x{20}}{\y{innerbottom}}}
+ \pgfpathlineto{\pgfpoint{#5\x{innerleft}}{\y{innerbottom}}}
+ \pgfusepath{stroke}
+ }
+%
+ {
+ \pgftransformshift{\pgfpoint{#5\x{21}}{0}}
+ \tikzquads@@Ydraw{#3}{#1}{center}
+ }
+ \tikzquads@@CondDraw{#3}{}{
+ \pgfpathmoveto{\pgfpoint{#5\x{innerleft}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpoint{#5\x{refA}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpoint{#5\x{21}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpointanchor{\tikz@fig@name-#3}{north}}
+ \pgfpathmoveto{\pgfpointanchor{\tikz@fig@name-#3}{south}}
+ \pgfpathlineto{\pgfpoint{#5\x{21}}{\y{innerbottom}}}
+ \pgfpathlineto{\pgfpoint{#5\x{innerleft}}{\y{innerbottom}}}
+ \pgfusepath{stroke}
+ }
+ %\tikzquads@@QuadGetAnchor{#2 N anchor}{tikzquads@@NanchorAx}
+ \tikzquads@@QuadGetAnchor{#2 N anchor}{tikzquads@@NanchorA}
+ \tikzquads@@QuadGetAnchor{#3 N anchor}{tikzquads@@NanchorB}
+ \tikzquads@@QuadGetAnchor{#2 T anchor}{tikzquads@@TanchorA}
+ \tikzquads@@QuadGetAnchor{#3 T anchor}{tikzquads@@TanchorB}
+ %\tikzquads@@RotateAnchor{\tikzquads@@NanchorAx}{tikzquads@@NanchorA}
+ {
+ \SearchValueOf{QuadKeys}{#2}{\@@valA}
+ \SearchValueOf{QuadKeys}{#3}{\@@valB}
+ \SearchValueOf{QuadKeys}{#4}{\@@valC}
+ \pgftransformresetnontranslations
+ \tikzquads@@CondDraw{#2}{}{\pgftext[\tikzquads@@TanchorA,at={\pgfpointanchor{\tikz@fig@name-#2}{\tikzquads@@NanchorA}}]{\@@valA}}
+ \tikzquads@@CondDraw{#3}{}{\pgftext[\tikzquads@@TanchorB,at={\pgfpointanchor{\tikz@fig@name-#3}{\tikzquads@@NanchorB}}]{\@@valB\@@valC}}
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Coordinates for a Horizontal Resistor
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@HResPoints}{
+ \SearchValueOf{QuadKeys}{outer sep}{\@@outersep}
+ \tikzmath{
+ real \x,\y;
+ \x{center}=0;
+ \y{center}=0;
+ %
+ \x{left}=-\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen/2;
+ \x{right}=\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen/2;
+ %
+ \y{top}=+\ctikzvalof{bipoles/resistor/height}\pgf@circ@Rlen/2;
+ \y{bottom}=-\ctikzvalof{bipoles/resistor/height}\pgf@circ@Rlen/2;
+ %
+ \x{step}=\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen/12;
+ \y{step}=\ctikzvalof{bipoles/resistor/height}\pgf@circ@Rlen/2;
+ %
+ \x{Tcenter}=0;
+ \y{Tcenter}=0;
+ %
+ \y{Ttop}=+\ctikzvalof{bipoles/resistor/height}\pgf@circ@Rlen/2 +\@@outersep;
+ \y{Tbottom}=-\y{Ttop};
+ %
+ \x{Tright}=+\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen/2 +\@@outersep;
+ \x{Tleft}=-\x{Tright};
+ %
+ \y{Ctop}=\y{Ttop};
+ \y{Cbottom}=\y{Tbottom};
+ %
+ \x{Cleft}=\x{left};
+ \x{Cright}=\x{right};
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Coordinates for a Vertical Resistor
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@VResPoints}{
+ \SearchValueOf{QuadKeys}{outer sep}{\@@outersep}
+ \tikzmath{
+ real \x,\y;
+ \x{center}=0;
+ \y{center}=0;
+ %
+ \y{bottom}=-\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen/2;
+ \y{top}=\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen/2;
+ %
+ \x{right}=+\ctikzvalof{bipoles/resistor/height}\pgf@circ@Rlen/2;
+ \x{left}=-\ctikzvalof{bipoles/resistor/height}\pgf@circ@Rlen/2;
+%
+ \x{step}=\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen/12;
+ \y{step}=\ctikzvalof{bipoles/resistor/height}\pgf@circ@Rlen/2;
+ %
+ \x{Tcenter}=0;
+ \y{Tcenter}=0;
+ %
+ \y{Ttop}=+\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen/2 +\@@outersep;
+ \y{Tbottom}=-\y{Ttop};
+ %
+ \x{Tright}=+\ctikzvalof{bipoles/resistor/height}\pgf@circ@Rlen/2 +\@@outersep;
+ \x{Tleft}=-\x{Tright};
+ %
+ \y{Ctop}=\y{top};
+ \y{Cbottom}=\y{bottom};
+ %
+ \x{Cleft}=\x{Tleft};
+ \x{Cright}=\x{Tright};
+ }
+}
+
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Base Anchors for a Resistor like shape
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@ResBaseAnchors}[1]{
+ \anchor{center}{\centerpoint}
+ \savedanchor\centerpoint{%
+ #1
+ \pgfpoint{\x{center}}{\y{center}}
+ }
+ \anchor{text}{
+ #1
+ \pgfpoint{\x{Tcenter}}{\y{Ttop}}
+ }
+ \anchor{west}{\west}
+ \savedanchor{\west}{%
+ #1
+ \pgfpoint{\x{Cleft}}{\y{center}}
+ }
+ \anchor{east}{\east}
+ \savedanchor{\east}{%
+ #1
+ \pgfpoint{\x{Cright}}{\y{center}}
+ }
+ \anchor{north}{\north}
+ \savedanchor{\north}{%
+ #1
+ \pgfpoint{\x{center}}{\y{Ctop}}
+ }
+ \anchor{south}{\south}
+ \savedanchor{\south}{%
+ #1
+ \pgfpoint{\x{center}}{\y{Cbottom}}
+ }
+ \anchor{north west}{\northwest}%
+ \savedanchor{\northwest}{%
+ #1
+ \pgfpoint{\x{Tleft}}{\y{Ttop}}
+ }
+ \anchor{north east}{\northeast}%
+ \savedanchor{\northeast}{%
+ #1
+ \pgfpoint{\x{Tright}}{\y{Ttop}}
+ }
+ \anchor{south west}{\southwest}%
+ \savedanchor{\southwest}{%
+ #1
+ \pgfpoint{\x{Tleft}}{\y{Tbottom}}
+ }
+ \anchor{south east}{\southeast}%
+ \savedanchor{\southeast}{%
+ #1
+ \pgfpoint{\x{Tright}}{\y{Tbottom}}
+ }
+}
+
+\newcommand{\tikzquads@@DrawRes}[1]{
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Resistor shape. either zig-zag or generic/european
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{H Res shape}{
+ \tikzquads@@ResBaseAnchors{\tikzquads@@HResPoints}
+ \behindbackgroundpath{
+ \tikzquads@@HResPoints
+ \pgfsetxvec{\pgfpoint{\x{step}}{0}}
+ \pgfsetyvec{\pgfpoint{0}{\y{step}}}
+ \begin{pgfscope}
+ \SearchValueOf{QuadKeys}{thickness}{\@@tmpthickness}
+ \pgfsetlinewidth{\@@tmpthickness\pgflinewidth}
+ \pgfsetbeveljoin
+ \iftoggle{tikzquads@@toggle@generic}{
+ \pgfpathmoveto{\pgfpointxy{-6}{-1}}
+ \pgfpathlineto{\pgfpointxy{-6}{1}}
+ \pgfpathlineto{\pgfpointxy{6}{1}}
+ \pgfpathlineto{\pgfpointxy{6}{-1}}
+ \pgfpathlineto{\pgfpointxy{-6}{-1}}
+ }{
+ \pgfpathmoveto{\pgfpointxy{-6}{0}}
+ \pgfpathlineto{\pgfpointxy{-5}{1}}
+ \pgfpathlineto{\pgfpointxy{-3}{-1}}
+ \pgfpathlineto{\pgfpointxy{-1}{1}}
+ \pgfpathlineto{\pgfpointxy{1}{-1}}
+ \pgfpathlineto{\pgfpointxy{3}{1}}
+ \pgfpathlineto{\pgfpointxy{5}{-1}}
+ \pgfpathlineto{\pgfpointxy{6}{0}}
+ }
+ \pgfusepath{stroke}
+ \end{pgfscope}
+ }
+ \backgroundpath{}
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Shadow H Res shape => do nothing but defines anchors
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Shadow H Res shape}{
+ \inheritsavedanchors[from=H Res shape]
+ \foreach \anchor in {north,north west,north east,center,west,east,
+ ,south,south west,south east,text}{%
+ \inheritanchor[from=H Res shape]{\anchor}}
+ \backgroundpath{}
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Resistor shape. either zig-zag or generic/european
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{V Res shape}{
+ \tikzquads@@ResBaseAnchors{\tikzquads@@VResPoints}
+ \behindbackgroundpath{
+ \tikzquads@@HResPoints
+ \pgfsetxvec{\pgfpoint{\x{step}}{0}}
+ \pgfsetyvec{\pgfpoint{0}{\y{step}}}
+ \begin{pgfscope}
+ \SearchValueOf{QuadKeys}{thickness}{\@@tmpthickness}
+ \pgfsetlinewidth{\@@tmpthickness\pgflinewidth}
+ \pgfsetbeveljoin
+ \pgftransformrotate{90}
+ \iftoggle{tikzquads@@toggle@generic}{
+ \pgfpathmoveto{\pgfpointxy{-6}{-1}}
+ \pgfpathlineto{\pgfpointxy{-6}{1}}
+ \pgfpathlineto{\pgfpointxy{6}{1}}
+ \pgfpathlineto{\pgfpointxy{6}{-1}}
+ \pgfpathlineto{\pgfpointxy{-6}{-1}}
+ }{
+ \pgfpathmoveto{\pgfpointxy{-6}{0}}
+ \pgfpathlineto{\pgfpointxy{-5}{1}}
+ \pgfpathlineto{\pgfpointxy{-3}{-1}}
+ \pgfpathlineto{\pgfpointxy{-1}{1}}
+ \pgfpathlineto{\pgfpointxy{1}{-1}}
+ \pgfpathlineto{\pgfpointxy{3}{1}}
+ \pgfpathlineto{\pgfpointxy{5}{-1}}
+ \pgfpathlineto{\pgfpointxy{6}{0}}
+ }
+ \pgfusepath{stroke}
+ \end{pgfscope}
+ }
+ \backgroundpath{}
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Shadow V Res shape => do nothing but defines anchors
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Shadow V Res shape}{
+ \inheritsavedanchors[from=V Res shape]
+ \foreach \anchor in {north,north west,north east,center,west,east,
+ ,south,south west,south east,text}{%
+ \inheritanchor[from=V Res shape]{\anchor}}
+ \backgroundpath{}
+}
+
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% a simple arrow tip, can be a simple triangle or a bezier based one.
+%%% back of the tip at the 'starting point'
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@arrowtipat}[3]{
+ {
+ \pgftransformshift{\pgfpoint{#2}{#3}}
+ \pgftransformscale{\tikzquads@@ValueOf{Keys}{tip len}}
+ \pgftransformrotate{#1}
+ \iftoggle{tikzquads@@toggle@beziertip}{
+ %% bezier version
+ \pgfsetroundcap\pgfsetbeveljoin
+ \pgfpathmoveto{\pgfpoint{1}{0}}
+ \pgfpathcurveto{\pgfpoint{0.3}{0.125}}{\pgfpoint{0.3}{0.125}}{\pgfpoint{0}{0.4}}
+ \pgfpathcurveto{\pgfpoint{0.15}{0}}{\pgfpoint{0.15}{0}}{\pgfpoint{0}{-0.4}}
+ \pgfpathcurveto{\pgfpoint{0.3}{-0.125}}{\pgfpoint{0.3}{-0.125}}{\pgfpoint{1}{0}}
+ }{ %% simple triangle version
+ \pgfsetroundcap
+ \pgfpathmoveto{\pgfpoint{1}{0}}
+ \pgfpathlineto{\pgfpoint{0}{0.45}}
+ \pgfpathlineto{\pgfpoint{0}{-0.45}}
+ \pgfpathlineto{\pgfpoint{1}{0}}
+ }
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% a simple, centered at point of reference, 'plus' sign... it could be a \pgftext... but, that way it is more controlable.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@plussignat}[3][\tikzquads@@ValueOf{Keys}{plussign len}]{%
+ {
+ \pgftransformshift{\pgfpoint{#2}{#3}}
+ \pgftransformscale{#1}
+ \pgfpathmoveto{\pgfpoint{-1}{0}}
+ \pgfpathlineto{\pgfpoint{1}{0}}
+ \pgfpathmoveto{\pgfpoint{0}{-1}}
+ \pgfpathlineto{\pgfpoint{0}{1}}
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% a simple, centered at point of reference, 'minus' sign... it could be a \pgftext... but, that way it is more controlable.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@minussignat}[3][\tikzquads@@ValueOf{Keys}{minussign len}]{%
+ {
+ \pgftransformshift{\pgfpoint{#2}{#3}}
+ \pgftransformscale{#1}
+ \pgfpathmoveto{\pgfpoint{-1}{0}}
+ \pgfpathlineto{\pgfpoint{1}{0}}
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Coordinates for a (base) Source
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@SourcePoints}{
+ \SearchValueOf{QuadKeys}{source radius}{\@@sourceradius}
+ \SearchValueOf{QuadKeys}{outer sep}{\@@outersep}
+ \tikzmath{
+ real \x,\y;
+ \x{center}=0;
+ \y{center}=0;
+ \x{left}=-\@@sourceradius;
+ \x{right}=\@@sourceradius;
+ \y{top}=\@@sourceradius;
+ \y{bottom}=-\@@sourceradius;
+ %
+ \x{Tcenter}=0;
+ \y{Tcenter}=0;
+ \y{Tmiddletop}=+cos(45)*(\@@sourceradius+\@@outersep);
+ \y{Tmiddlebottom}=-\y{Tmiddletop};
+ %
+ \x{Tmiddleright}=+cos(45)*(\@@sourceradius+\@@outersep);
+ \x{Tmiddleleft}=-\x{Tmiddleright};
+ }
+}
+
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Base Anchors for a Source like shape
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@SourceBaseAnchors}[1]{
+ \savedanchor\centerpoint{
+ \pgfpoint{0}{0}
+ }
+ \anchor{center}{\centerpoint}
+ \anchor{text}{\text}%
+ \savedanchor{\text}{%
+ #1
+ \pgfpoint{\x{Tmiddleright}}{\y{Tmiddletop}}
+ }
+ \anchor{west}{\west}%
+ \savedanchor{\west}{%
+ #1
+ \pgfpoint{\x{left}}{\y{center}}
+ }
+ \anchor{east}{\east}%
+ \savedanchor{\east}{%
+ #1
+ \pgfpoint{\x{right}}{\y{center}}
+ }
+ \anchor{north}{\north}%
+ \savedanchor{\north}{%
+ #1
+ \pgfpoint{\x{center}}{\y{top}}
+ }
+ \anchor{south}{\south}%
+ \savedanchor{\south}{%
+ #1
+ \pgfpoint{\x{center}}{\y{bottom}}
+ }
+ \anchor{north west}{\northwest}%
+ \savedanchor{\northwest}{%
+ #1
+ \pgfpoint{\x{Tmiddleleft}}{\y{Tmiddletop}}
+ }
+ \anchor{north east}{\northeast}%
+ \savedanchor{\northeast}{%
+ #1
+ \pgfpoint{\x{Tmiddleright}}{\y{Tmiddletop}}
+ }
+ \anchor{south west}{\southwest}%
+ \savedanchor{\southwest}{%
+ #1
+ \pgfpoint{\x{Tmiddleleft}}{\y{Tmiddlebottom}}
+ }
+ \anchor{south east}{\southeast}%
+ \savedanchor{\southeast}{%
+ #1
+ \pgfpoint{\x{Tmiddleright}}{\y{Tmiddlebottom}}
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Base shape for a source like shape
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Base source shape}{
+ \tikzquads@@SourceBaseAnchors{\tikzquads@@SourcePoints}
+ \backgroundpath{}
+ }
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Voltage source shape. either round or diamond
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Vsource shape}{
+ \inheritsavedanchors[from=Base source shape]
+ \foreach \anchor in {north,north west,north east,center,west,east,
+ ,south,south west,south east,text}{%
+ \inheritanchor[from=Base source shape]{\anchor}}
+ \backgroundpath{
+ \SearchValueOf{QuadKeys}{thickness}{\@@tmpthickness}
+ \SearchValueOf{QuadKeys}{source radius}{\@@sourceradius}
+ \SearchValueOf{QuadKeys}{minussign len}{\@@minussignlen}
+ \SearchValueOf{QuadKeys}{plussign len}{\@@plussignlen}
+ \pgfsetroundcap
+ \begin{pgfscope}
+ \tikzquads@@SourcePoints
+ \pgfsetbeveljoin
+ \pgfsetlinewidth{\@@tmpthickness\pgflinewidth}
+ \iftoggle{tikzquads@@toggle@roundsources}{
+ \pgfpathcircle{\pgfpoint{0}{0}}{\@@sourceradius}
+ }{
+ \pgfpathmoveto{\pgfpoint{\x{center}}{\y{top}}}
+ \pgfpathlineto{\pgfpoint{\x{right}}{\y{center}}}
+ \pgfpathlineto{\pgfpoint{\x{center}}{\y{bottom}}}
+ \pgfpathlineto{\pgfpoint{\x{left}}{\y{center}}}
+ \pgfpathlineto{\pgfpoint{\x{center}}{\y{top}}}
+ }
+ \pgfusepath{stroke}
+ \end{pgfscope}
+ \tikzquads@@minussignat[\@@minussignlen]{0}{-0.4*\@@sourceradius}
+ \tikzquads@@plussignat[\@@plussignlen]{0}{0.4*\@@sourceradius}
+ \pgfusepath{stroke}
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Shadow Vsource shape => do nothing but defines anchors
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Shadow Vsource shape}{
+ \inheritsavedanchors[from=Base source shape]
+ \foreach \anchor in {north,north west,north east,center,west,east,
+ ,south,south west,south east,text}{%
+ \inheritanchor[from=Base source shape]{\anchor}}
+ \backgroundpath{}
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% currente source shape, arrow pointing down. either round or diamond
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{IsourceDOWN shape}{
+ \inheritsavedanchors[from=Base source shape]
+ \foreach \anchor in {north,north west,north east,center,west,east,
+ ,south,south west,south east,text}{%
+ \inheritanchor[from=Base source shape]{\anchor}}
+ \backgroundpath{
+ \SearchValueOf{QuadKeys}{thickness}{\@@tmpthickness}
+ \SearchValueOf{QuadKeys}{source radius}{\@@sourceradius}
+ \SearchValueOf{QuadKeys}{tip len}{\@@tiplen}
+ \begin{pgfscope}
+ \tikzquads@@SourcePoints
+ \pgfsetlinewidth{\@@tmpthickness\pgflinewidth}
+ \pgfsetroundcap
+ \iftoggle{tikzquads@@toggle@roundsources}{
+ \pgfpathcircle{\pgfpoint{0}{0}}{\@@sourceradius}
+ }{
+ \pgfpathmoveto{\pgfpoint{\x{center}}{\y{top}}}
+ \pgfpathlineto{\pgfpoint{\x{right}}{\y{center}}}
+ \pgfpathlineto{\pgfpoint{\x{center}}{\y{bottom}}}
+ \pgfpathlineto{\pgfpoint{\x{left}}{\y{center}}}
+ \pgfpathlineto{\pgfpoint{\x{center}}{\y{top}}}
+ }
+ \pgfpathmoveto{\pgfpoint{0}{0.7*\@@sourceradius}}
+ \pgfpathlineto{\pgfpoint{0}{-0.7*\@@sourceradius}}
+ %
+ \pgfusepath{stroke}
+ \tikzquads@@arrowtipat{-90}{0}{-0.7*\@@sourceradius+\@@tiplen}
+ \pgfusepath{stroke,fill}
+ \end{pgfscope}
+ }}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Shadow IsourceDOWN shape => do nothing but defines anchors
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Shadow IsourceDOWN shape}{
+ \inheritsavedanchors[from=Base source shape]
+ \foreach \anchor in {north,north west,north east,center,west,east,
+ ,south,south west,south east,text}{%
+ \inheritanchor[from=Base source shape]{\anchor}}
+ \backgroundpath{}
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% currente source shape, arrow pointing up. either round or diamond
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{IsourceUP shape}{
+ \inheritsavedanchors[from=Base source shape]
+ \foreach \anchor in {north,north west,north east,center,west,east,
+ ,south,south west,south east,text}{%
+ \inheritanchor[from=Base source shape]{\anchor}}
+ \backgroundpath{
+ \SearchValueOf{QuadKeys}{thickness}{\@@tmpthickness}
+ \SearchValueOf{QuadKeys}{source radius}{\@@sourceradius}
+ \SearchValueOf{QuadKeys}{tip len}{\@@tiplen}
+ \begin{pgfscope}
+ \tikzquads@@SourcePoints
+ \pgfsetlinewidth{\@@tmpthickness\pgflinewidth}
+ \pgfsetroundcap
+ \iftoggle{tikzquads@@toggle@roundsources}{
+ \pgfpathcircle{\pgfpoint{0}{0}}{\@@sourceradius}
+ }{
+ \pgfpathmoveto{\pgfpoint{\x{center}}{\y{top}}}
+ \pgfpathlineto{\pgfpoint{\x{right}}{\y{center}}}
+ \pgfpathlineto{\pgfpoint{\x{center}}{\y{bottom}}}
+ \pgfpathlineto{\pgfpoint{\x{left}}{\y{center}}}
+ \pgfpathlineto{\pgfpoint{\x{center}}{\y{top}}}
+ }
+ \pgfpathmoveto{\pgfpoint{0}{0.7*\@@sourceradius}}
+ \pgfpathlineto{\pgfpoint{0}{-0.7*\@@sourceradius}}
+ %
+ \pgfusepath{stroke}
+ \tikzquads@@arrowtipat{90}{0}{0.7*\@@sourceradius-\@@tiplen}
+ \pgfusepath{stroke,fill}
+ \end{pgfscope}
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Shadow IsourceUP shape => do nothing but defines anchors
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Shadow IsourceUP shape}{
+ \inheritsavedanchors[from=Base source shape]
+ \foreach \anchor in {north,north west,north east,center,west,east,
+ ,south,south west,south east,text}{%
+ \inheritanchor[from=Base source shape]{\anchor}}
+ \backgroundpath{}
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Base Anchors for a Quadripole like shape
+%%% (note that the second side anchors are missing,
+%%% since this will also be used as a base for the black box)
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@QuadBaseAnchors}[1]{
+ \savedanchor\centerpoint{
+ \pgfpoint{0}{0}
+ }
+ \anchor{center}{\centerpoint}
+ \anchor{text}{\text}%
+ \savedanchor{\text}{%
+ #1
+ \pgfpoint{\x{Tinnerleft}}{\y{Tbottom}}
+ }
+ \anchor{bottom left}{\bottomleft}
+ \savedanchor{\bottomleft}{%
+ #1
+ \pgfpoint{\x{Tinnerleft}}{\y{Tbottom}}
+ }
+ \anchor{bottom center}{\bottomcenter}
+ \savedanchor{\bottomcenter}{%
+ #1
+ \pgfpoint{0}{\y{Tbottom}}
+ }
+ \anchor{bottom right}{\bottomright}
+ \savedanchor{\bottomright}{%
+ #1
+ \pgfpoint{\x{Tinnerright}}{\y{Tbottom}}
+ }
+ \anchor{inner bottom left}{\innerbottomleft}
+ \savedanchor{\innerbottomleft}{%
+ #1
+ \pgfpoint{\x{Tinnerleft}}{\y{Tinnerbottom}}
+ }
+ \anchor{inner bottom center}{\innerbottomcenter}%
+ \savedanchor{\innerbottomcenter}{%
+ #1
+ \pgfpoint{0}{\y{Tinnerbottom}}
+ }
+ \anchor{inner bottom right}{\innerbottomright}%
+ \savedanchor{\innerbottomright}{%
+ #1
+ \pgfpoint{\x{Tinnerright}}{\y{Tinnerbottom}}
+ }
+ \anchor{top left}{\topleft}%
+ \savedanchor{\topleft}{%
+ #1
+ \pgfpoint{\x{Tinnerleft}}{-\y{Tbottom}}
+ }
+ \anchor{top center}{\topcenter}%
+ \savedanchor{\topcenter}{%
+ #1
+ \pgfpoint{0}{-\y{Tbottom}}
+ }
+ \anchor{top right}{\topright}%
+ \savedanchor{\topright}{%
+ #1
+ \pgfpoint{\x{Tinnerright}}{-\y{Tbottom}}
+ }
+ \anchor{inner top left}{\innertopleft}%
+ \savedanchor{\innertopleft}{%
+ #1
+ \pgfpoint{\x{Tinnerleft}}{-\y{Tinnerbottom}}
+ }
+ \anchor{inner top center}{\innertopcenter}%
+ \savedanchor{\innertopcenter}{%
+ #1
+ \pgfpoint{0}{-\y{Tinnerbottom}}
+ }
+ \anchor{inner top right}{\innertopright}%
+ \savedanchor{\innertopright}{%
+ #1
+ \pgfpoint{\x{Tinnerright}}{-\y{Tinnerbottom}}
+ }
+ \anchor{west}{\west}%
+ \savedanchor{\west}{%
+ #1
+ \pgfpoint{\x{outerleft}}{\y{center}}
+ }
+ \anchor{east}{\east}%
+ \savedanchor{\east}{%
+ #1
+ \pgfpoint{\x{outerright}}{\y{center}}
+ }
+ \anchor{north}{\north}%
+ \savedanchor{\north}{%
+ #1
+ \pgfpoint{\x{center}}{\y{outertop}}
+ }
+ \anchor{north west}{\northwest}%
+ \savedanchor{\northwest}{%
+ #1
+ \pgfpoint{\x{outerleft}}{\y{outertop}}
+ }
+ \anchor{north east}{\northeast}%
+ \savedanchor{\northeast}{%
+ #1
+ \pgfpoint{\x{outerright}}{\y{outertop}}
+ }
+ \anchor{south}{\south}%
+ \savedanchor{\south}{%
+ #1
+ \pgfpoint{\x{center}}{\y{outerbottom}}
+ }
+ \anchor{south west}{\southwest}%
+ \savedanchor{\southwest}{%
+ #1
+ \pgfpoint{\x{outerleft}}{\y{outerbottom}}
+ }
+ \anchor{south east}{\southeast}%
+ \savedanchor{\southeast}{%
+ #1
+ \pgfpoint{\x{outerright}}{\y{outerbottom}}
+ }
+ \anchor{1+}{\NodeA}
+ \savedanchor{\NodeA}{
+ #1
+ \pgfpoint{\x{outerleft}}{\y{innertop}}
+ }
+ \anchor{1-}{\NodeB}
+ \savedanchor{\NodeB}{
+ #1
+ \pgfpoint{\x{outerleft}}{\y{innerbottom}}
+ }
+ \anchor{inner 1+}{\NodeAi}
+ \savedanchor{\NodeAi}{
+ #1
+ \pgfpoint{\x{innerleft}}{\y{innertop}}
+ }
+ \anchor{inner 1-}{\NodeBi}
+ \savedanchor{\NodeBi}{
+ #1
+ \pgfpoint{\x{innerleft}}{\y{innerbottom}}
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% the Quadripole Base shape itself. Just a box with the external currents and voltages marked.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Quad shape}{
+%
+ \tikzquads@@QuadBaseAnchors{\tikzquads@@QuadPoints}
+%
+ \anchor{2+}{\NodeC}
+ \savedanchor{\NodeC}{
+ \tikzquads@@QuadPoints
+ \pgfpoint{\x{outerright}}{\y{innertop}}
+ }
+ \anchor{2-}{\NodeD}
+ \savedanchor{\NodeD}{
+ \tikzquads@@QuadPoints
+ \pgfpoint{\x{outerright}}{\y{innerbottom}}
+ }
+ \anchor{inner 2+}{\NodeCi}
+ \savedanchor{\NodeCi}{
+ \tikzquads@@QuadPoints
+ \pgfpoint{\x{innerright}}{\y{innertop}}
+ }
+ \anchor{inner 2-}{\NodeDi}
+ \savedanchor{\NodeDi}{
+ \tikzquads@@QuadPoints
+ \pgfpoint{\x{innerright}}{\y{innerbottom}}
+ }
+%
+ \behindbackgroundpath{% this is new
+ \tikzquads@@QuadPoints
+ \SearchValueOf{QuadKeys}{outer ext}{\@@outerext}
+ \SearchValueOf{QuadKeys}{minussign len}{\@@minussignlen}
+ \SearchValueOf{QuadKeys}{plussign len}{\@@plussignlen}
+%
+ \pgfpathmoveto{\pgfpoint{\x{left}}{\y{bottom}}}
+ \pgfpathlineto{\pgfpoint{\x{left}}{\y{top}}}
+ \pgfpathlineto{\pgfpoint{\x{right}}{\y{top}}}
+ \pgfpathlineto{\pgfpoint{\x{right}}{\y{bottom}}}
+ \pgfpathlineto{\pgfpoint{\x{left}}{\y{bottom}}}
+ \pgfpathmoveto{\pgfpoint{\x{outerleft}}{\y{innerbottom}}}
+ \pgfpathlineto{\pgfpoint{\x{innerleft}}{\y{innerbottom}}}
+ \pgfpathmoveto{\pgfpoint{-\x{outerleft}}{\y{innerbottom}}}
+ \pgfpathlineto{\pgfpoint{-\x{innerleft}}{\y{innerbottom}}}
+ \pgfpathmoveto{\pgfpoint{\x{outerleft}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpoint{\x{innerleft}}{\y{innertop}}}
+ \pgfpathmoveto{\pgfpoint{-\x{outerleft}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpoint{-\x{innerleft}}{\y{innertop}}}
+ \tikzquads@@plussignat[\@@plussignlen/2]{\x{outerleft}+\@@outerext/2}{\y{innertop}-\@@outerext/2}
+ \tikzquads@@minussignat[\@@minussignlen/2]{\x{outerleft}+\@@outerext/2}{\y{innerbottom}+\@@outerext/2}
+ \tikzquads@@plussignat[\@@plussignlen/2]{-\x{outerleft}-\@@outerext/2}{\y{innertop}-\@@outerext/2}
+ \tikzquads@@minussignat[\@@minussignlen/2]{-\x{outerleft}-\@@outerext/2}{\y{innerbottom}+\@@outerext/2}
+ \pgfusepath{draw}
+ \tikzquads@@arrowtipat{0}{\x{outerleft}+\@@outerext/2}{\y{innertop}}
+ \tikzquads@@arrowtipat{180}{-\x{outerleft}-\@@outerext/2}{\y{innertop}}
+ \pgfusepath{draw,fill}
+ %
+ \iftoggle{tikzquads@@toggle@innermarks}{
+ {
+ \pgftransformshift{\pgfpoint{-\x{innerleft}}{\y{innertop}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ {
+ \pgftransformshift{\pgfpoint{\x{innerleft}}{\y{innertop}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ {
+ \pgftransformshift{\pgfpoint{\x{innerleft}}{\y{innerbottom}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ {
+ \pgftransformshift{\pgfpoint{-\x{innerleft}}{\y{innerbottom}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ }{}
+ %
+ \iftoggle{tikzquads@@toggle@outermarks}{
+ {
+ \pgftransformshift{\pgfpoint{-\x{outerleft}}{\y{innertop}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ {
+ \pgftransformshift{\pgfpoint{\x{outerleft}}{\y{innertop}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ {
+ \pgftransformshift{\pgfpoint{\x{outerleft}}{\y{innerbottom}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ {
+ \pgftransformshift{\pgfpoint{-\x{outerleft}}{\y{innerbottom}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ }{}
+ %
+ {
+ \pgfsetdash{{0.8pt}{1pt}{0.2pt}{1pt}}{0pt}
+ \pgfsetlinewidth{0.5\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{-\x{refA}}{\y{innerbottom}}}
+ \pgfpathlineto{\pgfpoint{\x{refA}}{\y{innerbottom}}}
+ \pgfusepath{draw}
+ }
+ \SearchValueOf{QuadKeys}{I1}{\@@IA}
+ \SearchValueOf{QuadKeys}{I2}{\@@IB}
+ \SearchValueOf{QuadKeys}{V1}{\@@VA}
+ \SearchValueOf{QuadKeys}{V2}{\@@VB}
+ %
+ \iftoggle{tikzquads@@toggle@inverted}{
+ \pgftransformresetnontranslations
+ \pgftext[bottom,right,at={\pgfpoint{\x{left}-0.4ex}{\y{innertop}+0.8ex}}]{\@@IB}
+ \pgftext[bottom,left,at={\pgfpoint{\x{right}+0.4ex}{\y{innertop}+0.8ex}}]{\@@IA}
+ \pgftext[left,x=\x{right}+0.4ex]{\@@VA}
+ \pgftext[right,x=\x{left}-0.4ex]{\@@VB}
+ }{
+ %\pgftransformresetnontranslations %might be added, changes nothing if nothing scaled/rotated.
+ \pgftext[bottom,left,at={\pgfpoint{\x{right}+0.4ex}{\y{innertop}+0.8ex}}]{\@@IB}
+ \pgftext[bottom,right,at={\pgfpoint{\x{left}-0.4ex}{\y{innertop}+0.8ex}}]{\@@IA}
+ \pgftext[right,x=\x{left}-0.4ex]{\@@VA}
+ \pgftext[left,x=\x{right}+0.4ex]{\@@VB}
+ }
+ \SearchValueOf{QuadKeys}{label top left}{\@@Ltl}
+ \SearchValueOf{QuadKeys}{label top center}{\@@Ltc}
+ \SearchValueOf{QuadKeys}{label top right}{\@@Ltr}
+ \SearchValueOf{QuadKeys}{label inner top left}{\@@Litl}
+ \SearchValueOf{QuadKeys}{label inner top center}{\@@Litc}
+ \SearchValueOf{QuadKeys}{label inner top right}{\@@Litr}
+ %
+ \SearchValueOf{QuadKeys}{label bottom left}{\@@Lbl}
+ \SearchValueOf{QuadKeys}{label bottom center}{\@@Lbc}
+ \SearchValueOf{QuadKeys}{label bottom right}{\@@Lbr}
+ \SearchValueOf{QuadKeys}{label inner bottom left}{\@@Libl}
+ \SearchValueOf{QuadKeys}{label inner bottom center}{\@@Libc}
+ \SearchValueOf{QuadKeys}{label inner bottom right}{\@@Libr}
+ {
+ \iftoggle{tikzquads@@toggle@inverted}{ \pgftransformresetnontranslations }{}
+ \pgftext[top,left,at={\pgfpoint{\x{Tinnerleft}}{\y{Ttop}}}]{\@@Ltl}
+ \pgftext[top,center,at={\pgfpoint{\x{Tcenter}}{\y{Ttop}}}]{\@@Ltc}
+ \pgftext[top,right,at={\pgfpoint{\x{Tinnerright}}{\y{Ttop}}}]{\@@Ltr}
+ %
+ \pgftext[top,left,at={\pgfpoint{\x{Tinnerleft}}{\y{Tinnertop}}}]{\@@Litl}
+ \pgftext[top,center,at={\pgfpoint{\x{Tcenter}}{\y{Tinnertop}}}]{\@@Litc}
+ \pgftext[top,right,at={\pgfpoint{\x{Tinnerright}}{\y{Tinnertop}}}]{\@@Litr}
+ %
+ \pgftext[bottom,left,at={\pgfpoint{\x{Tinnerleft}}{\y{Tbottom}}}]{\@@Lbl}
+ \pgftext[bottom,center,at={\pgfpoint{\x{Tcenter}}{\y{Tbottom}}}]{\@@Lbc}
+ \pgftext[bottom,right,at={\pgfpoint{\x{Tinnerright}}{\y{Tbottom}}}]{\@@Lbr}
+ %
+ \pgftext[bottom,left,at={\pgfpoint{\x{Tinnerleft}}{\y{Tinnerbottom}}}]{\@@Libl}
+ \pgftext[bottom,center,at={\pgfpoint{\x{Tcenter}}{\y{Tinnerbottom}}}]{\@@Libc}
+ \pgftext[bottom,right,at={\pgfpoint{\x{Tinnerright}}{\y{Tinnerbottom}}}]{\@@Libr}
+ %
+ }
+ }
+ \backgroundpath{ \iftoggle{tikzquads@@toggle@inverted}{\pgftransformresetnontranslations}{} }
+}
+
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% the Z Quadripole shape itself.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Quad Z shape}{
+ \inheritsavedanchors[from=Quad shape]
+ \foreach \anchor in {north,center,west,east,south,north west,north east,south west, south east,
+ text,bottom left,bottom right,bottom center, inner bottom left, inner bottom right, inner bottom center,
+ top left,top right,top center, inner top left, inner top right, inner top center,
+ 1+,2+,1-,2-, inner 1+, inner 2+, inner 1-, inner 2-}{%
+ \inheritanchor[from=Quad shape]{\anchor}}
+ \inheritbehindbackgroundpath[from=Quad shape]
+ \backgroundpath{
+ \tikzquads@@QuadPoints
+ \tikzquads@@Zside{Z11}{Z12}{I2}{}
+ \tikzquads@@Zside{Z22}{Z21}{I1}{-}
+ \iftoggle{tikzquads@@toggle@inverted}{\pgftransformresetnontranslations}{}
+ }
+}
+
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% the Y Quadripole shape itself.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Quad Y shape}{
+ \inheritsavedanchors[from=Quad shape]
+ \foreach \anchor in {north,center,west,east,south,north west,north east,south west, south east,
+ text,bottom left,bottom right,bottom center, inner bottom left, inner bottom right, inner bottom center,
+ top left,top right,top center, inner top left, inner top right, inner top center,
+ 1+,2+,1-,2-, inner 1+, inner 2+, inner 1-, inner 2-}{%
+ \inheritanchor[from=Quad shape]{\anchor}}
+ \inheritbehindbackgroundpath[from=Quad shape]
+ \backgroundpath{
+ \tikzquads@@QuadPoints
+ \tikzquads@@Yside{Y11}{Y12}{V2}{}
+ \tikzquads@@Yside{Y22}{Y21}{V1}{-}
+ \iftoggle{tikzquads@@toggle@inverted}{\pgftransformresetnontranslations}{}
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% the H Quadripole shape itself.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Quad H shape}{
+ \inheritsavedanchors[from=Quad shape]
+ \foreach \anchor in {north,center,west,east,south,north west,north east,south west, south east,
+ text,bottom left,bottom right,bottom center, inner bottom left, inner bottom right, inner bottom center,
+ top left,top right,top center, inner top left, inner top right, inner top center,
+ 1+,2+,1-,2-, inner 1+, inner 2+, inner 1-, inner 2-}{%
+ \inheritanchor[from=Quad shape]{\anchor}}
+ \inheritbehindbackgroundpath[from=Quad shape]
+ \backgroundpath{
+ \tikzquads@@QuadPoints
+ \tikzquads@@Zside{H11}{H12}{V2}{}
+ \tikzquads@@Yside{H22}{H21}{I1}{-}
+ \iftoggle{tikzquads@@toggle@inverted}{\pgftransformresetnontranslations}{}
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% the G Quadripole shape itself.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Quad G shape}{
+ \inheritsavedanchors[from=Quad shape]
+ \foreach \anchor in {north,center,west,east,south,north west,north east,south west, south east,
+ text,bottom left,bottom right,bottom center, inner bottom left, inner bottom right, inner bottom center,
+ top left,top right,top center, inner top left, inner top right, inner top center,
+ 1+,2+,1-,2-, inner 1+, inner 2+, inner 1-, inner 2-}{%
+ \inheritanchor[from=Quad shape]{\anchor}}
+ \inheritbehindbackgroundpath[from=Quad shape]
+ \backgroundpath{
+ \tikzquads@@QuadPoints
+ \tikzquads@@Yside{G11}{G12}{I2}{}
+ \tikzquads@@Zside{G22}{G21}{V1}{-}
+ \iftoggle{tikzquads@@toggle@inverted}{\pgftransformresetnontranslations}{}
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% the BB (Black Box) is just a 'single sided' Quad
+%%%
+%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Coordinates for a Black Box
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@BBPoints}{
+ \SearchValueOf{QuadKeys}{outer ext}{\@@outerext}
+ \SearchValueOf{QuadKeys}{inner ext}{\@@innerext}
+ \SearchValueOf{QuadKeys}{half base height}{\@@halfbaseheight}
+ \SearchValueOf{QuadKeys}{half base width}{\@@halfbasewidth}
+ \SearchValueOf{QuadKeys}{height ext}{\@@heightext}
+ \tikzmath{
+ real \x,\y;
+ \x{center}=0;
+ \y{center}=0;
+ \x{right}=0 + \@@halfbasewidth;
+ \y{top}=0 +( \@@halfbaseheight + \@@heightext);
+ %
+ \x{left}=0 - \@@halfbasewidth;
+ \y{bottom}=0 -( \@@halfbaseheight + \@@heightext);
+ %
+ \y{innerbottom}=0 - \@@halfbaseheight;
+ \y{innertop}=0 + \@@halfbaseheight;
+ %
+ \y{outerbottom}=\y{bottom} - 0.5*\@@outerext;
+ \y{outertop}=\y{top} + 0.5*\@@outerext;
+ %
+ \x{outerleft}=\x{left} - \@@outerext;
+ \x{innerleft}=\x{left} + \@@innerext;
+ %
+ \x{outerright}=\x{right} + \@@outerext;
+ \x{innerright}=\x{right} - \@@innerext;
+ %
+ \x{refC}=0 + 0.3*\@@halfbasewidth;
+ \x{refB}=(\x{innerleft}+\x{refC})/2; %center point for Res shape
+ \x{refA}=(2*\x{innerleft}+\x{refC})/3; %'center' point for Y.Res shape
+ %
+ \y{Tbottom}=\y{bottom} + 0.65ex;
+ \x{Tinnerleft}=\x{innerleft} ;
+ \y{Tinnerbottom}=\y{innerbottom} + 0.95ex;
+ \x{Tinnerright}=\x{innerright};
+ \x{Tcenter}=0;
+ %
+ \y{Ttop}=\y{top} - 0.65ex;
+ \y{Tinnertop}=\y{innertop} - 0.95ex;
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% the base shape for a one port 'black box'. Just the box plus the external current/voltage marked
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{BB shape}{
+ \tikzquads@@QuadBaseAnchors{\tikzquads@@BBPoints}
+ \behindbackgroundpath{
+ \tikzquads@@BBPoints
+ \SearchValueOf{QuadKeys}{outer ext}{\@@outerext}
+ \SearchValueOf{QuadKeys}{plussign len}{\@@plussignlen}
+ \SearchValueOf{QuadKeys}{minussign len}{\@@minussignlen}
+ \pgfpathmoveto{\pgfpoint{\x{left}}{\y{bottom}}}
+ \pgfpathlineto{\pgfpoint{\x{left}}{\y{top}}}
+ \pgfpathlineto{\pgfpoint{\x{right}}{\y{top}}}
+ \pgfpathlineto{\pgfpoint{\x{right}}{\y{bottom}}}
+ \pgfpathlineto{\pgfpoint{\x{left}}{\y{bottom}}}
+ \pgfpathmoveto{\pgfpoint{\x{outerleft}}{\y{innerbottom}}}
+ \pgfpathlineto{\pgfpoint{\x{innerleft}}{\y{innerbottom}}}
+ \pgfpathmoveto{\pgfpoint{\x{outerleft}}{\y{innertop}}}
+ \pgfpathlineto{\pgfpoint{\x{innerleft}}{\y{innertop}}}
+ \tikzquads@@plussignat[\@@plussignlen/2]{\x{outerleft}+\@@outerext/2}{\y{innertop}-\@@outerext/2}
+ \tikzquads@@minussignat[\@@minussignlen/2]{\x{outerleft}+\@@outerext/2}{\y{innerbottom}+\@@outerext/2}
+ \pgfusepath{draw}
+ \tikzquads@@arrowtipat{180}{\x{outerleft}+\@@outerext/2}{\y{innertop}}
+ \pgfusepath{draw,fill}
+ %
+ \iftoggle{tikzquads@@toggle@innermarks}{
+ {
+ \pgftransformshift{\pgfpoint{\x{innerleft}}{\y{innertop}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ {
+ \pgftransformshift{\pgfpoint{\x{innerleft}}{\y{innerbottom}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ }{}
+ %
+ \iftoggle{tikzquads@@toggle@outermarks}{
+ {
+ \pgftransformshift{\pgfpoint{\x{outerleft}}{\y{innertop}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ {
+ \pgftransformshift{\pgfpoint{\x{outerleft}}{\y{innerbottom}}}
+ \pgfnode{circ}{center}{}{}{}
+ }
+ }{}
+ %
+ \SearchValueOf{QuadKeys}{I1}{\@@IA}
+ \SearchValueOf{QuadKeys}{V1}{\@@VA}
+ %
+ \iftoggle{tikzquads@@toggle@inverted}{
+ \pgftransformresetnontranslations
+ \pgftext[bottom,left,at={\pgfpoint{\x{right}+0.4ex}{\y{innertop}+0.8ex}}]{\@@IA}
+ \pgftext[left,x=\x{right}+0.4ex]{\@@VA}
+ }{
+ \pgftext[bottom,right,at={\pgfpoint{\x{left}-0.4ex}{\y{innertop}+0.8ex}}]{\@@IA}
+ \pgftext[right,x=\x{left}-0.4ex]{\@@VA}
+ }
+ \SearchValueOf{QuadKeys}{label top left}{\@@Ltl}
+ \SearchValueOf{QuadKeys}{label top center}{\@@Ltc}
+ \SearchValueOf{QuadKeys}{label top right}{\@@Ltr}
+ \SearchValueOf{QuadKeys}{label inner top left}{\@@Litl}
+ \SearchValueOf{QuadKeys}{label inner top center}{\@@Litc}
+ \SearchValueOf{QuadKeys}{label inner top right}{\@@Litr}
+ %
+ \SearchValueOf{QuadKeys}{label bottom left}{\@@Lbl}
+ \SearchValueOf{QuadKeys}{label bottom center}{\@@Lbc}
+ \SearchValueOf{QuadKeys}{label bottom right}{\@@Lbr}
+ \SearchValueOf{QuadKeys}{label inner bottom left}{\@@Libl}
+ \SearchValueOf{QuadKeys}{label inner bottom center}{\@@Libc}
+ \SearchValueOf{QuadKeys}{label inner bottom right}{\@@Libr}
+ {
+ \iftoggle{tikzquads@@toggle@inverted}{ \pgftransformresetnontranslations }{}
+ \pgftext[top,left,at={\pgfpoint{\x{Tinnerleft}}{\y{Ttop}}}]{\@@Ltl}
+ \pgftext[top,center,at={\pgfpoint{\x{Tcenter}}{\y{Ttop}}}]{\@@Ltc}
+ \pgftext[top,right,at={\pgfpoint{\x{Tinnerright}}{\y{Ttop}}}]{\@@Ltr}
+ %
+ \pgftext[top,left,at={\pgfpoint{\x{Tinnerleft}}{\y{Tinnertop}}}]{\@@Litl}
+ \pgftext[top,center,at={\pgfpoint{\x{Tcenter}}{\y{Tinnertop}}}]{\@@Litc}
+ \pgftext[top,right,at={\pgfpoint{\x{Tinnerright}}{\y{Tinnertop}}}]{\@@Litr}
+ %
+ \pgftext[bottom,left,at={\pgfpoint{\x{Tinnerleft}}{\y{Tbottom}}}]{\@@Lbl}
+ \pgftext[bottom,center,at={\pgfpoint{\x{Tcenter}}{\y{Tbottom}}}]{\@@Lbc}
+ \pgftext[bottom,right,at={\pgfpoint{\x{Tinnerright}}{\y{Tbottom}}}]{\@@Lbr}
+ %
+ \pgftext[bottom,left,at={\pgfpoint{\x{Tinnerleft}}{\y{Tinnerbottom}}}]{\@@Libl}
+ \pgftext[bottom,center,at={\pgfpoint{\x{Tcenter}}{\y{Tinnerbottom}}}]{\@@Libc}
+ \pgftext[bottom,right,at={\pgfpoint{\x{Tinnerright}}{\y{Tinnerbottom}}}]{\@@Libr}
+ %
+ }
+ \pgfusepath{draw}
+ }
+ \backgroundpath{}
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% A 'Thevenin' circuit inside a black box.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{TheveninBB shape}{
+ \inheritsavedanchors[from=BB shape]
+ \foreach \anchor in {north,center,west,east,south,north west,north east,south west, south east,
+ text,bottom left,bottom right,bottom center, inner bottom left, inner bottom right, inner bottom center,
+ top left,top right,top center, inner top left, inner top right, inner top center,
+ 1+,1-, inner 1+, inner 1-}{%
+ \inheritanchor[from=BB shape]{\anchor}}
+ \inheritbehindbackgroundpath[from=BB shape]
+ \backgroundpath{
+ \tikzquads@@BBPoints
+ \tikzquads@@Zside{Zth}{Vth}{none}{}
+ \iftoggle{tikzquads@@toggle@inverted}{\pgftransformresetnontranslations}{}
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% A 'Norton' circuit inside a black box.
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{NortonBB shape}{
+ \inheritsavedanchors[from=BB shape]
+ \foreach \anchor in {north,center,west,east,south,north west,north east,south west, south east,
+ text,bottom left,bottom right,bottom center, inner bottom left, inner bottom right, inner bottom center,
+ top left,top right,top center, inner top left, inner top right, inner top center,
+ 1+,1-, inner 1+, inner 1-}{%
+ \inheritanchor[from=BB shape]{\anchor}}
+ \inheritbehindbackgroundpath[from=BB shape]
+ \backgroundpath{
+ \tikzquads@@BBPoints
+ \tikzquads@@Yside[IsourceUP shape]{Yn}{In}{none}{}
+ \iftoggle{tikzquads@@toggle@inverted}{\pgftransformresetnontranslations}{}
+ }
+}
+
+
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% A Pseudo-Graph is just that, a crude representantion of a graph, out-of-scale.
+%%%
+%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Coordinates for a Pseudo-Graph shape
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@PGPoints}{
+ \SearchValueOf{PGKeys}{outer sep}{\@@outersep}
+ \SearchValueOf{PGKeys}{half base width}{\@@halfbasewidth}
+ \SearchValueOf{PGKeys}{half base height}{\@@halfbaseheight}
+ \tikzmath{
+ real \x,\y;
+ \x{center}=0;
+ \y{center}=0;
+ \x{right}=\@@halfbasewidth + \@@outersep;
+ \x{left}= 0-\x{right};
+ \y{top}=+( \@@halfbaseheight + \@@outersep);
+ \y{bottom}=0-\y{top};
+ %
+ \x{axisright}=\@@halfbasewidth;
+ \x{axisleft}=0-\x{right};
+ \y{axistop}=+\@@halfbaseheight;
+ \y{axisbottom}=0-\y{top};
+%
+ \y{Cbottom}=0.6*\y{axisbottom};
+ \y{Ctop}=0-\y{Cbottom};
+ %
+ \x{Cleft}=0.6*\x{axisleft};
+ \x{Cright}=-\x{Cleft};
+%
+ \y{innerbottom}=0.8*\y{axisbottom};
+ \y{innertop}=0-\y{innerbottom};
+ %
+ \x{innerleft}=0.8*\x{axisleft};
+ \x{innerright}=-\x{innerleft};
+ %
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Base Anchors for a PseudoGraph like shape
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newcommand{\tikzquads@@PGBaseAnchors}[1]{
+ \savedanchor\centerpoint{
+ \pgfpoint{0}{0}
+ }
+ \anchor{center}{\centerpoint}
+ \anchor{text}{\text}%
+ \savedanchor{\text}{%
+ #1
+ \pgfpoint{\x{center}}{\y{center}}
+ }
+ \anchor{west}{\west}%
+ \savedanchor{\west}{%
+ #1
+ \pgfpoint{\x{left}}{\y{center}}
+ }
+ \anchor{east}{\east}%
+ \savedanchor{\east}{%
+ #1
+ \pgfpoint{\x{right}}{\y{center}}
+ }
+ \anchor{north}{\north}%
+ \savedanchor{\north}{%
+ #1
+ \pgfpoint{\x{center}}{\y{top}}
+ }
+ \anchor{south}{\south}%
+ \savedanchor{\south}{%
+ #1
+ \pgfpoint{\x{center}}{\y{bottom}}
+ }
+ \anchor{north west}{\northwest}%
+ \savedanchor{\northwest}{%
+ #1
+ \pgfpoint{\x{left}}{\y{top}}
+ }
+ \anchor{north east}{\northeast}%
+ \savedanchor{\northeast}{%
+ #1
+ \pgfpoint{\x{right}}{\y{top}}
+ }
+ \anchor{south west}{\southwest}%
+ \savedanchor{\southwest}{%
+ #1
+ \pgfpoint{\x{left}}{\y{bottom}}
+ }
+ \anchor{south east}{\southeast}%
+ \savedanchor{\southeast}{%
+ #1
+ \pgfpoint{\x{right}}{\y{bottom}}
+ }
+}
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% Base shape for a source like shape
+%%%
+%%%%%%%%%%%%%%%%%%%
+\pgfdeclareshape{Base PG shape}{
+ \tikzquads@@PGBaseAnchors{\tikzquads@@PGPoints}
+ \backgroundpath{
+ }
+}
+
+
+%%%%%%%%%%%%%%%%%%%
+%%%
+%%% currente source shape, arrow pointing up. either round or diamond
+%%%
+%%%%%%%%%%%%%%%%%%%
+\newdimen\tikzquads@@pgflinewidth
+\pgfdeclareshape{PG linear load line shape}{
+ \inheritsavedanchors[from=Base PG shape]
+ \foreach \anchor in {north,north west,north east,center,west,east,
+ ,south,south west,south east,text}{%
+ \inheritanchor[from=Base PG shape]{\anchor}}
+ \backgroundpath{
+ \begin{pgfscope}
+ \tikzquads@@PGPoints
+ \tikzquads@@pgflinewidth=\pgflinewidth
+ \SearchValueOf{QuadKeys}{thickness}{\@@tmpthickness}
+ \pgfsetlinewidth{\@@tmpthickness\pgflinewidth}
+ \pgfsetroundcap
+ \pgfkeys{\tikzquads@@PGKeysPath/@PGPoints}
+ \pgfpathmoveto{\pgfpoint{\x{axisleft}}{\y{Xaxispos}}}
+ \pgfpathlineto{\pgfpoint{\x{axisright}}{\y{Xaxispos}}}
+ %
+ \pgfpathmoveto{\pgfpoint{\x{Yaxispos}}{\y{axisbottom}}}
+ \pgfpathlineto{\pgfpoint{\x{Yaxispos}}{\y{axistop}}}
+ \pgfusepath{stroke}
+ \tikzquads@@arrowtipat{0}{\x{axisright}}{\y{Xaxispos}}
+ \tikzquads@@arrowtipat{90}{\x{Yaxispos}}{\y{axistop}}
+ \pgfusepath{stroke,fill}
+ \pgfsetlinewidth{\tikzquads@@pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{\x{coordA}}{\y{coordA}}}
+ \pgfpathlineto{\pgfpoint{\x{coordB}}{\y{coordB}}}
+ \pgfusepath{stroke}
+ \SearchValueOf{PGKeys}{x axis}{\@@Xaxis}
+ \SearchValueOf{PGKeys}{x val}{\@@Xval}
+ \SearchValueOf{PGKeys}{y axis}{\@@Yaxis}
+ \SearchValueOf{PGKeys}{y val}{\@@Yval}
+ \pgftext[\tikzquads@@PG@XaxisTanchor,at=\pgfpoint{\x{axisright}}{\y{TXaxiscoord}}]{\@@Xaxis}
+ \pgftext[\tikzquads@@PG@XvalTanchor,at=\pgfpoint{\x{TXvalcoord}}{\y{TXvalcoord}}]{\@@Xval}
+ \pgftext[\tikzquads@@PG@YaxisTanchor,at=\pgfpoint{\x{TYaxiscoord}}{\y{axistop}}]{\@@Yaxis}
+ \pgftext[\tikzquads@@PG@YvalTanchor,at=\pgfpoint{\x{TYvalcoord}}{\y{TYvalcoord}}]{\@@Yval}
+ \end{pgfscope}
+ }
+}
+