summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-04-20 03:03:09 +0000
committerNorbert Preining <norbert@preining.info>2020-04-20 03:03:09 +0000
commit2a6dafa8ee740f345650d6a697665bf85a57cc77 (patch)
tree41026274cc0ff06c74d65d2fa12b025a3d3d5764 /graphics
parent0e85a1501dd8b23f1debab0ed20d89b11146ad34 (diff)
CTAN sync 202004200303
Diffstat (limited to 'graphics')
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/changelog.tex27
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdfbin17748 -> 17748 bytes
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdfbin910006 -> 956337 bytes
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex420
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/circuitikz.sty4
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex37
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex36
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex914
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex2
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex168
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex4
-rw-r--r--graphics/pgf/contrib/tikz-planets/README.md5
-rw-r--r--graphics/pgf/contrib/tikz-planets/planets-doc.pdfbin54223 -> 167190 bytes
-rw-r--r--graphics/pgf/contrib/tikz-planets/planets-doc.tex161
-rw-r--r--graphics/pgf/contrib/tikz-planets/planets.sty328
15 files changed, 1938 insertions, 168 deletions
diff --git a/graphics/pgf/contrib/circuitikz/doc/changelog.tex b/graphics/pgf/contrib/circuitikz/doc/changelog.tex
index c1dac70eb8..7d50e0e01b 100644
--- a/graphics/pgf/contrib/circuitikz/doc/changelog.tex
+++ b/graphics/pgf/contrib/circuitikz/doc/changelog.tex
@@ -5,6 +5,33 @@ full list of changes.
\begin{itemize}
\item
+ Version 1.1.0 (2020-04-19)
+
+ Version bumped to 1.1 because the new logic ports are quite a big
+ addition: now there is a new style for logic ports, conforming to IEEE
+ recommendations.
+
+ Several minor additions all over the map too.
+
+ \begin{itemize}
+ \tightlist
+ \item
+ added IEEE standard logic ports suggested by user Jason-s on GitHub
+ \item
+ added configurability to european logic port ``not'' output symbol,
+ suggested by j-hap on GitHub
+ \item
+ added \texttt{inerter} component by user Tadashi on GitHub
+ \item
+ added variable outer base height for IGBT, suggested by user RA-EE
+ on GitHub
+ \item
+ added configurable ``+'' and ``-'' signs on american-style voltage
+ generators
+ \item
+ text on amplifiers can be positioned to the left or centered
+ \end{itemize}
+\item
Version 1.0.2 (2020-03-22)
\begin{itemize}
diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf
index 683b25c31d..4e25d9425f 100644
--- a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf
+++ b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf
index 28e478825c..ae19c3cdc5 100644
--- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf
+++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
index dbd67b0d3c..f5fd98ad7a 100644
--- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
+++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
@@ -1749,6 +1749,29 @@ The size of the broken part of the DC current source is configurable by changing
You can change the scale of the batteries by setting the key \texttt{batteries/scale}, for the controlled (dependent) sources with \texttt{csources/scale}, and for all the other independent sources and generators with \texttt{sources/scale}, to something different from the default \texttt{1.0}.
+The symbols drawn into the \texttt{american voltage source}\footnote{Since version \texttt{1.1.0}, thanks to the suggestions and discussion
+\href{https://tex.stackexchange.com/questions/538723/circuitikz-what-should-i-do-to-put-the-and-on-the-appropriate-places-like-t}{in this TeX.SX question}.} can be changed by using the \verb|\ctikzset| keys \texttt{bipoles/vsourceam/inner plus} and \texttt{bipoles/vsourceam/inner minus} (by default they are \verb|$+$| and \verb|$-$| respectively, in the current font), and move them nearer of farther away by twiddling \texttt{bipoles/vsourceam/margin} (default \texttt{0.7}, less means nearer).
+
+Moreover, you can move the two symbols nearer of farther away by twiddling \texttt{bipoles/vsourceam/margin} (default \texttt{0.7}, less means nearer).
+
+You can do the same with the \texttt{american controlled voltage sources}, substituting \texttt{cvsourceam} to \texttt{vsourceam} (notice the initial ``\texttt{c}'').
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[american]
+ \ctikzset{bipoles/vsourceam/inner plus={\tiny $+$}}
+ \ctikzset{bipoles/vsourceam/inner minus={\tiny $-$}}
+ \draw (0,0) to[V, l_=$V$] ++(0,3)
+ to[R=\SI{5}{\ohm}] ++(3,0)
+ to[V, invert,
+ bipoles/vsourceam/inner plus={\color{red}\tiny $\oplus$},
+ bipoles/vsourceam/inner minus={\color{blue}\tiny $\ominus$},
+ bipoles/vsourceam/margin=0.5]
+ ++(0,-3) to[short, -*] (0,0) node[ground]{};
+\end{circuitikz}
+\end{LTXexample}
+
+
+
\subsection{Instruments}
\begin{groupdesc}
\circuitdescbip*{ammeter}{Ammeter}{}
@@ -1954,6 +1977,7 @@ Or, if you want a more physical structure for the measurement setup:
\subsection{Mechanical Analogy}
\begin{groupdesc}
\circuitdescbip*{damper}{Mechanical Damping}{}
+ \circuitdescbip*{inerter}{Mechanical Inerter}{}
\circuitdescbip{spring}{Mechanical Stiffness}{}
\circuitdescbip*{viscoe}{Mechanical viscoelastic element\footnotemark}{}(left/135/0.2, right/45/0.2, center/-90/0.3)
\footnotetext{Suggested by @Alex in \url{https://tex.stackexchange.com/q/484268/38080}}
@@ -2506,6 +2530,29 @@ You can change the size of the Schottky ``hook'' changing the parameter \texttt{
\end{circuitikz}
\end{LTXexample}
+\paragraph{IGBT outer base}
+
+Normally, in bipolar IGBTs the outer base is the same size (height) of the inner one, and of the same thickness (which will depend on the class thickness value). You can change this by setting (via \verb|\ctikzset`|) the keys \texttt{tripoles/igbt/outer base height} (default \texttt{0.4}, the same as \texttt{base height}), and \texttt{tripoles/igbt/outer base thickness} (default \texttt{1.0}), which will be relative to the class thickness.
+
+\begin{LTXexample}[varwidth=true, pos=t, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,0)
+ -- ++(1,0) node[nigbt, anchor=B](B){} (B.nobase)
+ -- ++(1,0) node[pigbt, anchor=B](B){} (B.nobase)
+ -- ++(1,0) node[Lnigbt, anchor=B](B){} (B.nobase)
+ -- ++(1,0) node[Lpigbt, anchor=B](B){} (B.nobase)
+ ;
+ \ctikzset{tripoles/igbt/outer base height=0.3}
+ \ctikzset{tripoles/igbt/outer base thickness=1.5}
+ \draw (6,0)
+ -- ++(1,0) node[nigbt, anchor=B](B){} (B.nobase)
+ -- ++(1,0) node[pigbt, anchor=B](B){} (B.nobase)
+ -- ++(1,0) node[Lnigbt, anchor=B](B){} (B.nobase)
+ -- ++(1,0) node[Lpigbt, anchor=B](B){} (B.nobase)
+ ;
+\end{circuitikz}
+\end{LTXexample}
+
\paragraph{Base/Gate terminal.} The Base/Gate connection of all transistors can be disabled by the options \textit{nogate} or \textit{nobase}, respectively. The Base/Gate anchors are floating, but there is an additional anchor \texttt{nogate}/\texttt{nobase} , which can be used to point to the unconnected base:
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
@@ -3224,7 +3271,7 @@ Remember that the default \texttt{pgfkeys} directory is \texttt{/tikz} for nodes
\circuitdesc*{inst amp}{plain instrumentation amplifier}{}( up/90/0.2, down/-90/0.2, refv up/45/0.2, refv down/-45/0.2 )
\circuitdesc*{fd inst amp}{Fully differential instrumentation amplifier}{}
\circuitdesc*{inst amp ra}{instrumentation amplifier with amplification resistance terminals}{}( ra+/180/0.1, ra-/180/0.1 )
- \circuitdesc*{plain amp}{Plain amplifier, unmarked, two inputs}{}(in up/180/0.1, in down/180/0.1, up/90/0.2, out/0/0.2, bin up/145/0.2, bin down/-145/0.2, bout/45/0.3)
+ \circuitdesc*{plain amp}{Plain amplifier, unmarked, two inputs}{A$_1$}(in up/180/0.1, in down/180/0.1, up/90/0.2, out/-90/0.2, bin up/145/0.2, bin down/-145/0.2, bout/90/0.3)
\circuitdesc*{plain mono amp}{Plain amplifier, one input}{}(in/180/0.2, out/0/0.2, up/90/0.2, center/-30/0.6, bin/145/0.1, bout/45/0.3)
\circuitdesc*{buffer}{Buffer}{}(in/180/0.2, out/0/0.2, center/-30/0.6, bin/145/0.1, bout/45/0.3)
\end{groupdesc}
@@ -3389,6 +3436,23 @@ If you want different symbols for input and output you can use a null symbol and
\end{circuitikz}
\end{LTXexample}
+The amplifier label (given as the text of the node) is normally more or less centered in the shape (in the case of the triangular shape, it is shifted a bit to the left to \emph{seem} visually centered); since version \texttt{1.1.0} you can move it at the left side plus a fixed offset setting the key \texttt{component text} or the style with the same name to \texttt{left}; by default the key is \texttt{center}.
+You can change the offset with the key \texttt{left text distance} (default \texttt{0.3em}; you must use a length here).
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[]
+ \draw (0,2.5) node[plain amp]{\texttt{741}};
+ \draw (3,2.5)
+ node[plain amp, component text=left]
+ {\texttt{741}};
+ \ctikzset{component text=left}
+ \draw (0,0) node[op amp]{\texttt{741}};
+ \ctikzset{left text distance=0.6em}
+ \draw (3,0) node[op amp]{\texttt{741}};
+\end{circuitikz}
+\end{LTXexample}
+
+These keys are also used for the positioning of the labels in the label positioning of IEEE logic gates (see~\ref{sec:ieeestdports}).
\paragraph{European-style amplifier customization}
Thanks to the suggestions from David Rouvel (\email{david.rouvel@iphc.cnrs.fr}) there are several possible customization for the European-style amplifiers.
@@ -3797,6 +3861,37 @@ Logic gates, with two or more input, are supported. Albeit in principle these co
\circuitdesc*{american buffer port}{American \textsc{buffer} port}{}
\circuitdesc*{american not port}{American \textsc{not} port}{}
\end{groupdesc}
+
+There is no ``european'' version of the following symbols (but you can probably use the \texttt{schmitt symbol} of the IEEE standard ports.
+
+\begin{groupdesc}
+ \circuitdesc*{schmitt}{Non-Inverting Schmitt trigger}{}
+ \circuitdesc*{invschmitt}{Inverting Schmitt trigger}{}
+\end{groupdesc}
+
+\subsubsection{IEEE logic gates}\label{sec:ieeestdports}
+
+In addition to the legacy ports, since release 1.1.0, logic ports following the recommended geometry of distinctive-shape symbols in IEEE Std 91a-1991 Annex A (Recommended symbol proportions) are also available\footnote{Thanks to Jason for proposing it and digging out the info, see this \href{https://github.com/circuitikz/circuitikz/issues/383}{GitHub issue}.}.
+
+These ports are completely independent from the legacy set (either \texttt{american} or \texttt{european}); they are not eanbled by default because the relative size of the ports is very different from the legacy ones, and that will disrupt every schematic (especially if drawn with absolute coordinate). If you want to use them as default, you can use the command \verb|\ctikzset{logic ports=ieee}| and by default the shapes \texttt{and port}, \texttt{or port} and so on will be the IEEE standard ones.
+
+\begin{groupdesc}
+ \circuitdesc*{ieeestd and port}{IEEE standard ``and'' port}{}(in 1/180/0.2, in 2/180/0.2, out/0/0.2, bout/45/0.2)
+ \circuitdesc*{ieeestd nand port}{IEEE standard ``nand'' port}{}(in 1/180/0.2, out/0/0.2, bout/45/0.2)
+ \circuitdesc*{ieeestd or port}{IEEE standard ``or'' port}{}(in 1/180/0.2, bin 2/-155/0.2, out/0/0.2, bout/45/0.2)
+ \circuitdesc*{ieeestd nor port}{IEEE standard ``nor'' port}{}(left/180/0.2, center/-45/0.4, up/30/0.2,
+ down/-30/0.2)[not/45/0.3]
+ \circuitdesc*{ieeestd xor port}{IEEE standard ``xor'' port xor}{}(left/180/0.2, bin 1/145/0.3, ibin 1/45/0.3, right/45/0.2)
+ \circuitdesc*{ieeestd xnor port}{IEEE standard ``xnor'' port}{}(body left/70/0.4, body right/-70/0.3,
+ out/0/0.2, bout/45/0.2)
+ \circuitdesc*{ieeestd buffer port}{IEEE standard buffer port}{}(in 1/180/0.2, bin 1/-155/0.2, up/30/0.2, down/-30/0.2)
+ \circuitdesc*{ieeestd not port}{IEEE standard ``not'' port}{}(in/180/0.2, bin/-155/0.2, out/0/0.2, bout/45/0.2)
+ \circuitdesc*{ieeestd schmitt port}{Schmitt port matched to IEEE standard ports}{}(in/180/0.2, out/0/0.2, bout/45/0.2)
+ \circuitdesc*{ieeestd inv schmitt port}{Inverting Schmitt port matched to IEEE standard ports}{}
+ \circuitdesc*{notcirc}{Inverting dot for IEEE ports}{}(west/180/0.1, east/0/0.1)
+ \circuitdesc*{schmitt symbol}{Schmitt symbol to add to input pins if needed}{}(north west/145/0.1, south east/-45/0.1)
+\end{groupdesc}
+
\subsubsection{European Logic gates}
\begin{groupdesc}
\circuitdesc*{european and port}{European \textsc{and} port}{}( in 1/180/0.2, in 2/180/0.2, out/0/0.2 )
@@ -3813,18 +3908,12 @@ Logic gates, with two or more input, are supported. Albeit in principle these co
If (default behaviour) \texttt{americanports} option is active (or the style \texttt{[american ports]} is used), the shorthands \texttt{and port}, \texttt{or port}, \texttt{not port}, \texttt{nand port}, \texttt{not port}, \texttt{xor port}, and \texttt{xnor port} are equivalent to the american version of the respective logic port.
If otherwise \texttt{europeanports} option is active (or the style \texttt{[european ports]} is used), the shorthands \texttt{and port}, \texttt{or port}, \texttt{not port}, \texttt{nand port}, \texttt{not port}, \texttt{xor port}, and \texttt{xnor port} are equivalent to the european version of the respective logic port.
-\end{framed}
-
-\subsubsection{Special components}
-There is no ``european'' version of these symbols.
+Finally, for version \texttt{1.1.0} and up, you can use the style \texttt{ieee ports} to set the shorthands to the set of \texttt{ieeestd} ports. (There is no global option for this).
+\end{framed}
-\begin{groupdesc}
- \circuitdesc*{schmitt}{Non-Inverting Schmitt trigger}{}
- \circuitdesc*{invschmitt}{Inverting Schmitt trigger}{}
-\end{groupdesc}
-\subsubsection{Logic port customization}
+\subsubsection{American port usage}
Since version \texttt{1.0.0}, the default shape of the family of american ``or'' ports has changed to a more ``pointy'' one, for better distinguish them from the ``and''-type ports. You can still going back to the previous aspect with the key \texttt{american or shape} that can be set to \texttt{pointy} or \texttt{roundy}. The \texttt{legacy} style will enact the old, roundy style also.
@@ -3849,6 +3938,7 @@ Since version \texttt{1.0.0}, the default shape of the family of american ``or''
\end{circuitikz}
\end{LTXexample}
+\paragraph{American logic port customization}
Logic port class is called \texttt{logic ports}, so you can scale them all with \texttt{logic ports/scale} (default \texttt{1.0}).
@@ -3921,7 +4011,7 @@ You can tweak the appearance of american ``or'' family (\texttt{or}, \texttt{nor
\tikz \draw (0,0) node[xnor port] {};
\end{LTXexample}
-\subsubsection{Logic port anchors}
+\paragraph{American logic port anchors}
These are the anchors for logic ports:
@@ -3939,7 +4029,7 @@ These are the anchors for logic ports:
south/-90, south east/45, east/45, north east/45}
\path (A.\a) \coorda(\a)<\d>;
-\draw (9,0) node[european and port, ](A){} ;
+\draw (9,0) node[nand port, ](A){} ;
\foreach \a/\d in {left/45, right/45, center/-90}
\path (A.\a) \coorda(\a)<\d>;
\end{circuitikz}
@@ -3960,7 +4050,7 @@ You have also ``border pin anchors'':
\foreach \a/\d in {bin 1/-135, bin 2/-135, bin 3/-135, bout/-45}
\path (A.\a) \coorda(\a)<\d>;
-\draw (9,0) node[european and port, ](A){} ;
+\draw (9,0) node[nand port, ](A){} ;
\foreach \a/\d in {bin 1/-135, bin 2/-135, bout/-45}
\path (A.\a) \coorda(\a)<\d>;
\end{circuitikz}
@@ -4020,6 +4110,308 @@ In the case of \textsc{not}, there are only \texttt{in} and \texttt{out} (althou
;\end{circuitikz}
\end{LTXexample}
+
+
+
+\subsubsection{IEEE logic gates usage.}
+
+\begingroup % for IEEE ports
+The rest of this section will assume you have issued the command \verb|\ctikzset{logic ports=ieee}|, so that the short form of the names is used.
+\ctikzset{logic ports=ieee}
+
+IEEE standard logic gates have a basic difference with the legacy ones: the proportions of their shapes does not change when you change the size, so you can't have a ``tall'' port or a ``squatty'' ones. The two-inputs gates, by default, have their default size designed so that they match the chips component (see~\ref{sec:chips}).
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,0) node[dipchip](C){IC} (C.pin 8)
+ node[or port, anchor=in 1,
+ color=red](A){IC2A};
+\end{circuitikz}
+\end{LTXexample}
+
+If you need, say, a 4-inputs port, the port will look like this:
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,0) node[dipchip](C){IC} (C.pin 8)
+ node[or port, anchor=in 1, number inputs=4,
+ color=red](A){IC2A};
+\end{circuitikz}
+\end{LTXexample}
+
+\dots and in this case it is clear that it does not match. With standard ports, there are two possibilities.
+The first one is to scale the port; if you set the port height so that it has the same size (see ``IEEE logic gates customization'' below for details) as the number of ports, they will match again.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,0) node[dipchip](C){IC} (C.pin 8)
+ node[or port, anchor=in 1,
+ number inputs=4,
+ circuitikz/ieeestd ports/height=4,
+ color=red](A){IC2A};
+\end{circuitikz}
+\end{LTXexample}
+
+But then the size of the port is quite ``unusual''. The solution is technical literature is to use what we can call a ``rack'' for the inputs; basically, only a certain number of pins are kept on the port, and the other are put on an extended input line.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,0) node[dipchip](C){IC} (C.pin 8)
+ node[or port, anchor=in 1,
+ number inputs=4,
+ inner inputs=2,
+ color=red](A){IC2A};
+\end{circuitikz}
+\end{LTXexample}
+
+When using the \texttt{inner inputs} key, keep in mind the rule of thumbs:
+\begin{itemize}
+ \item the distance between the pins is matched with the chip ones when the \texttt{inner inputs} match the \texttt{/ieeestd ports/height} key;
+ \item when the number of pins in the rack is odd, the result is often quite ugly, so try to avoid it.
+\end{itemize}
+For example, look at the following example; given that we are asking an odd number of pins on the rack, some of the inputs are drawn on the port's border, resulting in a less-than-ideal diagram.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,0) node[dipchip](C){IC} (C.pin 8)
+ node[or port, anchor=in 1,
+ number inputs=5,
+ inner inputs=2,
+ color=red](A){IC2A};
+\end{circuitikz}
+\end{LTXexample}
+
+In this case, if you don't like the solution, the better approach is to let the gate grow a bit.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,0) node[dipchip](C){IC} (C.pin 8)
+ node[or port, anchor=in 1,
+ number inputs=5,
+ inner inputs=3,
+ circuitikz/ieeestd ports/height=3,
+ color=red](A){IC2A};
+\end{circuitikz}
+\end{LTXexample}
+
+The good thing about the rack mechanism is that you can have quite big ports without problems.
+
+\begin{LTXexample}[varwidth=true, pos=t, basicstyle=\small\ttfamily]
+\begin{circuitikz}[scale=0.75, transform shape]
+ \draw node[nor port, number inputs=32, inner inputs=2,
+ rotate=90](A){\rotatebox{-90}{IC1A}};
+\end{circuitikz}
+\end{LTXexample}
+
+You can use the additional elements (the \texttt{notcirc} and the \texttt{schmitt symbol} to obtain circuits like the following ones (well, a bit of a mix of conventions, but...):
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,0) node[and port](A){A} (A.out)
+ node[buffer port, anchor=in,
+ component text=left](B){B} (B.bin)
+ node[schmitt symbol, above left]{}
+ (A.bin 1) node[schmitt symbol, right]{};
+ \node [notcirc, left] at (A.bin 1) {};
+ \node [notcirc, above](C) at (B.up) {};
+ \draw (C.north) |- ++(-1,1) (B.down) --++(0,-1);
+\end{circuitikz}
+\end{LTXexample}
+
+Notice the key \texttt{component text=left} that moves the label near to the left border of the component. There is also a \verb|\ctikzset{component text=left}| if you prefer to have it as a default for all the IEEE ports.\footnote{There is a plan to extend this to other components, too.}
+
+
+\paragraph{Stacking and aligning IEEE standard gates.} The standard gates are designed so that they stacks up nicely when positioned using the external leads as anchors. Notice that the ports \textbf{do} have different sizes, but the leads lengths are designed to counter the differences.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw
+ (0,0) node[and port, anchor=in 1]{A1}
+ (0,-1.2) node[nand port, anchor=in 1]{A2}
+ (0,-2.4) node[or port, anchor=in 1]{A3}
+ (0,-3.6) node[xnor port, anchor=in 1]{A4};
+ \draw
+ (3,0) node[and port, anchor=in 1](A1){A1}
+ (3,-1.2) node[nand port, anchor=in 1]{A2}
+ (3,-2.4) node[or port, anchor=in 1]{A3}
+ (3,-3.6) node[xnor port, anchor=in 1](A4){A4};
+ \draw[red, dashed]([yshift=0.8cm]A1.body left)
+ -- ([yshift=-0.8cm]A4.body left);
+\end{circuitikz}
+\end{LTXexample}
+
+The length of the external leads can be changed by the user, but notice that if you use a too small value you can jeopardize that property.
+
+The single input ports (\texttt{not port}, \texttt{buffer port} and their Schmitt equivalent) are smaller that the six standard ports, so they are not kept aligned by default; the just have the same distance at the input side. For the not ports, the \texttt{left} position of the text results often in a better look (the centered text in the triangle seems to be much more at the right).
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \ctikzset{component text=left}
+ \draw (0,0) node[nand port, anchor=in 1]{A1}
+ (0,-1.8) node[buffer port, anchor=in 1]{A2}
+ (0,-3.2) node[not port, anchor=in 1]{A3};
+ \draw (3,0) node[nand port, anchor=in 1](A1){A1}
+ (3,-1.8) node[buffer port, anchor=in 1]{A2}
+ (3,-3.2) node[not port, anchor=in 1](A3){A3};
+ \draw[red, dashed]([yshift=0.8cm]A1.body left)
+ -- ([yshift=-0.8cm]A3.body left);
+\end{circuitikz}
+\end{LTXexample}
+
+\paragraph{IEEE standard ports customization}
+
+There are several parameters that can be used to customize the IEEE standard ports, although less than the ones in the legacy american ones --- the basic shape is set to follow the IEEE recommendation. The basic parameters are shown in the following table, and they can be set via \verb|\ctikzset{ieeestd ports/...}|
+
+\begin{tabular}{@{}>{\ttfamily}l >{\ttfamily} l >{\RaggedRight}p{0.6\textwidth}@{}}
+ \toprule
+ \multicolumn{1}{l}{\textbf{key}} &
+ \multicolumn{1}{l}{\textbf{default}} &
+ \multicolumn{1}{l}{\textbf{description}} \\
+ \midrule
+ baselen & 0.4 & the basic length for every dimension, as a fraction of the (scaled) resistor length \\
+ height & 2 & the height of the port, in term of \texttt{baselen}. Pin distance is given by this parameter divided by the inner pins.\\
+ pin length & 0.7 & length of the external pin leads that are drawn with the port. This length is always calculated starting from the inner body of the shape.\\
+ not radius & 0.154 & radius of the ``not circle'' added to the negated-output ports. The default value is the IEEE recommended one. \\
+ xor bar distance & 0.192 & distance of the detached input shape in \texttt{xor} and \texttt{xnor} ports. The default value is the IEEE recommended one. \\
+ xor leads in & 1 & If set to \texttt{0}, there will be no leads drawn between the detached input line and the body in the \texttt{xor} and \texttt{xnor} ports. IEEE recommends \texttt{1} here. \\
+ schmitt symbol size & 0.3 & Size of the small Schmitt symbol to use near input leads. \\
+ \bottomrule
+\end{tabular}
+
+For example, using a \texttt{not radius} of \texttt{0.1} will give a ``not ball'' of the same size of a connecting pole, as it is in the legacy ports.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,2) node[xnor port](P){}
+ (P.out) to[short, -o] ++(1,0);
+ \ctikzset{ieeestd ports/.cd, not radius=0.1,
+ xor bar distance=0.3, xor leads in=0}
+ \draw (0,0) node[xnor port](P){}
+ (P.out) to[short, -o] ++(1,0);
+\end{circuitikz}
+\end{LTXexample}
+
+In addition to the specific parameters, you can also apply to these ports the boolean style \texttt{no input leads} as in legacy ones (this simply \emph{does not draw} the input leads, but the anchors stays where they should):
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+\draw (0,0) node[nand port,
+ number inputs=5, no input leads,](B){Pn};
+\draw (B.in 1) -- (B.bin 1) (B.in 5) -- (B.bin 5);
+\node[rotate=90] at (B.in 3) {\dots};
+\end{circuitikz}
+\end{LTXexample}
+
+Changing the leads length must be done with a bit of care, because if the length is shorter than the port left or right extrusions strange things can happen (yes, a 4-inputs xnor gates is not so well defined\dots but it's a nice example to show):
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \ctikzset{ieeestd ports/pin length=0.2}
+ \draw (0,0) node[xnor port,
+ number inputs=4, inner inputs=2](B){};
+\end{circuitikz}
+\end{LTXexample}
+
+\paragraph{IEEE standard ports anchors} Geographical anchors define the rectangular space that the port is using, included the leads if presents.
+
+\geocoord{ieeestd and port}
+\geocoord{ieeestd xnor port, number inputs=6, inner inputs=2,
+ circuitikz/ieeestd ports/height=1}
+
+Most of the anchors can be seen in the following diagram:
+
+\begin{circuitikz}[]
+ \draw (0,0) node[ieeestd and port, number inputs=4](A){};
+ \draw (5.8,0) node[ieeestd xnor port, number inputs=2,
+ circuitikz/ieeestd ports/.cd, baselen=0.6, pin length=1, xor bar distance=0.4](B){};
+ \draw (11,0) node[ieeestd or port, number inputs=6, inner inputs=2](C){};
+ %
+ \foreach \i in {1,2,3,4} {
+ \path (A.in \i) \showcoord(in \i)<180:0.3>;
+ \path (A.bin \i) \showcoordb(bin \i)<45:0.3>;
+ }
+ \path (A.out) \showcoord(out)<0:0.2>;
+ \path (A.bout) \showcoordb(bout)<-45:0.2>;
+ \path (A.left) \showcoord(left)<-45:0.4>;
+ \path (A.right) \showcoord(right)<45:0.4>;
+
+ \path (B.ibin 1) \showcoordb(ibin 1)<90:0.4>;
+ \path (B.ibin 2) \showcoordb(ibin 2)<-90:0.4>;
+ \path (B.bin 1) \showcoordb(bin 1)<-145:0.2>;
+ \path (B.out) \showcoord(out)<0:0.2>;
+ \path (B.bout) \showcoordb(bout)<-45:0.2>;
+ \path (B.left) \showcoord(left)<-145:0.4>;
+ \path (B.body left) \showcoord(body left)<145:0.6>;
+ \path (B.right) \showcoord(right)<45:0.4>;
+ \path (B.body right) \showcoord(body right)<90:0.5>;
+
+ \path (C.up) \showcoordb(up)<90:0.2>;
+ \path (C.down) \showcoordb(down)<-90:0.2>;
+ \foreach \i in {1,...,6} {
+ \path (C.in \i) \showcoord(in \i)<180:0.2>;
+ }
+\end{circuitikz}
+
+The inputs anchor are \texttt{in \emph{number}} (on the tip of the lead) and \texttt{bin \emph{number}} (\textbf{b}order \textbf{in}puts) on the component's border (useful if you draw the ports with \texttt{no inut leads}. Additionally, you have \texttt{ibin \emph{number}} (\textbf{i}nner \textbf{b}order \textbf{in}puts) for the \emph{x}-type ports. The anchor named \texttt{left} is where a central border input would be.
+
+In one-input ports (\texttt{not port}, the buffer, and Schmitt-type ports) you can use plain \texttt{in} or \texttt{in 1} indifferently.
+
+On the output, \texttt{out} is on the tip of the lead, and \texttt{bout} on the rightmost border (so, if there is a negation circle, it is on it); \texttt{right} is the same as \texttt{bout}.
+
+The main body of the port is marked with \texttt{body left} and \texttt{body right} anchors (as seen in the middle port in the diagram above); you have also an \texttt{up} and \texttt{down} anchors centered on the body (you can use them as enable signals or similar things).
+
+Finally, the internal \texttt{notcirc} node used for the output negation is accessible with the name \texttt{\emph{nodename}-not}, where \emph{nodename} is the name given to the logic port node.
+
+\endgroup % for IEEE ports ctikzset
+%%
+
+\subsubsection{European logic port usage}
+
+European logic port are the same class as american and IEEE-style ones, and they obey the same class modifier. Moreover, you can use the \texttt{no inputs pin} as in the other logic ports to suppress input pins.
+
+\paragraph{European logic port customization} Normally the European-style logic port with inverted output are marked with a small triangle; if you want you can change it with the key \texttt{tripoles/european not symbol}; its default is \texttt{triangle} but you can set it to \texttt{circle} like in the following example. As you can see, the circle size is the same as the circuit poles; if you prefer the size used in the IEEE standard ports, you can use set it to \texttt{ieee circle}.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[european]
+ \draw (0,3) node[nand port](A){}
+ (A.out) to[short, *-o] ++(0.5,0);
+ \ctikzset{tripoles/european not symbol=circle}
+ \draw (0,1.5) node[nand port](A){}
+ (A.out) to[short, *-o] ++(0.5,0);
+ \ctikzset{tripoles/european not symbol=ieee circle}
+ \draw (0,0) node[european nand port](A){}
+ (A.out) to[short, *-o] ++(0.5,0);
+\end{circuitikz}
+\end{LTXexample}
+
+\paragraph{European logic port anchors} The anchors are basically the same as in the american-style ports.
+
+\bigskip
+\begin{circuitikz} [american]
+\def\coorda(#1)<#2>{node[circle, red, draw, inner sep=1pt,pin={[red, overlay, inner sep=0.5pt, font=\small, pin distance=0.1cm, pin edge={red, overlay,}]#2:#1}](#1){}}
+
+\draw (0, 0) node[european and port, ](A){} ;
+ \foreach \a/\d in {left/45, right/45, center/-90}
+ \path (A.\a) \coorda(\a)<\d>;
+
+\draw (3,0) node[european and port, ](A){} ;
+ \foreach \a/\d in {bin 1/-135, bin 2/-135, bout/-45}
+ \path (A.\a) \coorda(\a)<\d>;
+
+\draw (6,0) node[european nand port, ](A){} ;
+ \foreach \a/\d in {bin 1/-135, bin 2/-135, bout/-45}
+ \path (A.\a) \coorda(\a)<\d>;
+
+\ctikzset{tripoles/european not symbol=circle}
+
+\draw (9,0) node[european nand port, ](A){} ;
+ \foreach \a/\d in {bin 1/-135, bin 2/-135, bout/-45}
+ \path (A.\a) \coorda(\a)<\d>;
+
+\end{circuitikz}
+\bigskip
+
+
\subsection{Flip-flops}\label{sec:flipflops}
Flip-flops (available since version \texttt{1.0.0}) are an hybrid between the logic ports and the chips. They have a class by themselves (\texttt{flipflops}) but the default parameters are set at the same values as the logic gates one.
@@ -4380,7 +4772,7 @@ You can use these shapes to draw a lot of symbols that are unavailable; using a
\end{circuitikz}
\end{LTXexample}
-\subsection{Chips (integrated circuits)}
+\subsection{Chips (integrated circuits)}\label{sec:chips}
\texttt{CircuiTikZ} supports two types of variable-pin chips: DIP (Dual-in-Line Package) and QFP (Quad-Flat Package).
\begin{groupdesc}
diff --git a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty
index 74d8e070ba..3c41450fb2 100644
--- a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty
+++ b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty
@@ -12,8 +12,8 @@
\NeedsTeXFormat{LaTeX2e}
-\def\pgfcircversion{1.0.2}
-\def\pgfcircversiondate{2020/03/22}
+\def\pgfcircversion{1.1.0}
+\def\pgfcircversiondate{2020/04/19}
\ProvidesPackage{circuitikz}%
[\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion]
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex
index ad86e49627..49f7306219 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex
@@ -203,6 +203,18 @@
{{}}% #1 is \relax, so consider empty
{\expandafter{#1}}% otherwise, leave the key after one more expansion
}%
+%
+% text position (added with ieeestd logic ports. Maybe to be extended to other components,
+% like amplifiers)
+%
+\newif\ifpgf@circ@center@text\pgf@circ@center@texttrue
+\tikzset{component text/.is choice}%
+\tikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
+\tikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
+\ctikzset{component text/.is choice}%
+\ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
+\ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
+\ctikzset{left text distance/.initial=0.3em}%
% voltage options
@@ -1022,6 +1034,8 @@
\ctikzset{tripoles/pigbt/gate height/.initial=.45}
\ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
\ctikzset{tripoles/pigbt/base height/.initial=.4}
+\ctikzset{tripoles/pigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
\ctikzset{tripoles/pigbt/conn height/.initial=0}
\ctikzset{tripoles/pigbt/height/.initial=1.1}
\ctikzset{tripoles/pigbt/gate width/.initial=.62}
@@ -1035,6 +1049,8 @@
\ctikzset{tripoles/nigbt/gate height/.initial=.45}
\ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
\ctikzset{tripoles/nigbt/base height/.initial=.4}
+\ctikzset{tripoles/nigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
\ctikzset{tripoles/nigbt/conn height/.initial=0}
\ctikzset{tripoles/nigbt/height/.initial=1.1}
\ctikzset{tripoles/nigbt/gate width/.initial=.62}
@@ -1048,6 +1064,8 @@
\ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
\ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
\ctikzset{tripoles/Lpigbt/base height/.initial=.4}
+\ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
\ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
\ctikzset{tripoles/Lpigbt/height/.initial=1.1}
\ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
@@ -1061,6 +1079,8 @@
\ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
\ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
\ctikzset{tripoles/Lnigbt/base height/.initial=.4}
+\ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
+\ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
\ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
\ctikzset{tripoles/Lnigbt/height/.initial=1.1}
\ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
@@ -1070,6 +1090,21 @@
\ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
\ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
+\ctikzset{tripoles/igbt/outer base height/.code={
+ \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
+ \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
+ \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
+}}
+\ctikzset{tripoles/igbt/outer base thickness/.code={
+ \ctikzset{tripoles/nigbt/outer base thickness=#1}
+ \ctikzset{tripoles/pigbt/outer base thickness=#1}
+ \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
+ \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
+}}
+
\ctikzset{tripoles/njfet/width/.initial=.7}
\ctikzset{tripoles/njfet/gate height/.initial=.5}
\ctikzset{tripoles/njfet/gate height 2/.initial=.35}
@@ -1651,6 +1686,8 @@
\ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
\ctikzset{bipoles/spring/height/.initial=.5}
\ctikzset{bipoles/spring/width/.initial=.5}
+\ctikzset{bipoles/inerter/height/.initial=.7}
+\ctikzset{bipoles/inerter/width/.initial=.175}
\ctikzset{bipoles/mass/height/.initial=.55}
\ctikzset{bipoles/mass/box height/.initial=.4}
\ctikzset{bipoles/mass/width/.initial=.5}
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex
index a315f97806..dd62d7e9d8 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircbipoles.tex
@@ -1360,6 +1360,9 @@
\pgfusepath{draw}
}
+%% To change the internal symbols of the voltage source american style
+\ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
+\ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
%% Independent voltage source - American style
\pgfcircdeclarebipolescaled{sources}
{}
@@ -1374,11 +1377,11 @@
\pgf@circ@draworfill
\pgfsetcolor{\ctikzvalof{color}}
\ifpgf@circ@oldvoltagedirection
- \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$}
- \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$}
+ \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
+ \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
\else
- \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$-$}
- \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$+$}
+ \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
+ \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
\fi
}
@@ -1684,6 +1687,9 @@
\pgfusepath{draw}
}
+%% To change the internal symbols of the controlled voltage source american style
+\ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
+\ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}}
%% Controlled voltage source - American
\pgfcircdeclarebipolescaled{csources}
{}
@@ -1702,11 +1708,11 @@
\pgfsetcolor{\ctikzvalof{color}}
\ifpgf@circ@oldvoltagedirection
- \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$}
- \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$}
+ \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
+ \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
\else
- \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$-$}
- \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$+$}
+ \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
+ \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
\fi
}
@@ -4749,6 +4755,20 @@
\pgfusepath{stroke}
}
+%% mechanical capacitance - inerter
+\pgfcircdeclarebipolescaled{mechanicals}
+{}
+{\ctikzvalof{bipoles/inerter/height}}
+{inerter}
+{\ctikzvalof{bipoles/inerter/height}}
+{\ctikzvalof{bipoles/inerter/width}}
+{
+ \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
+ \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
+ \pgf@circ@draworfill
+}
+
+
%% mechanical inductance - mass
\pgfcircdeclarebipolescaled{mechanicals}
{}
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex
index 4c8d6d4e49..1c836583af 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex
@@ -1772,3 +1772,917 @@
\fi
\fi
}
+
+%% IEEE standard logic ports module
+%%
+%% Original multi-input code from John Kormylo at tex.stackexchange.com
+%% Help by TheTeXnician <38565529+TheTeXnician@users.noreply.github.com>
+%% Suggested idea and example code by Jason Sachs <jmsachs@gmail.com>
+%% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
+%% Most of the code, all errors and bugs by Romano Giannetti <romano.giannetti@gmail.com>
+%% Everything is in the same place here --- more or less; first step to move towards
+%% a module interface for circutikz
+%%
+
+% base parameters for ieeestd ports.
+
+\ctikzset{ieeestd ports/.is family}
+% baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so.
+% the value of 0.4 is the standard pin distance for a port with height=num pins
+% and matches the chip distance
+\ctikzset{ieeestd ports/baselen/.initial=0.4}
+% these are in term of baselen; width depends on height (fixed proportions)
+\ctikzset{ieeestd ports/height/.initial=2}
+\ctikzset{ieeestd ports/pin length/.initial=0.7}
+% the standard "not" circle should be 1/6.5 of height (diameter);
+% so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
+\ctikzset{ieeestd ports/not radius/.initial=0.154}
+\ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
+% the suggested xnor distance is is 1.24, so 1.25/3.25/2
+% xor/xnor leads go full in in IEEE; let this be optional
+\ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
+\ctikzset{ieeestd ports/xor leads in/.initial=1}%
+%
+% base size of a small external schmitt symbol
+%
+\ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
+%
+% input management
+% we are using the same /tikz/number inputs than the legacy ports
+%
+\tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
+%
+% integrate with the other logic ports
+%
+\ctikzset{logic ports/ieee/.code= {\pgf@circuit@europeanlogicportfalse
+ \tikzset{and port/.style={shape=ieeestd and port}}%
+ \tikzset{or port/.style={shape=ieeestd or port}}%
+ \tikzset{xor port/.style={shape=ieeestd xor port}}%
+ \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
+ \tikzset{not port/.style={shape=ieeestd not port}}%
+ \tikzset{nand port/.style={shape=ieeestd nand port}}%
+ \tikzset{nor port/.style={shape=ieeestd nor port}}%
+ \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
+ \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
+ \tikzset{inv schmitt port/.style={shape=ieeestd schmitt port}}%
+}}
+\tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
+%
+% the base angle for the or port. See the drawings. This will not change with height
+%
+\pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)}
+% \typeout{ANGLE-IS\space\pgf@circ@orangle}
+\def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter
+{%
+ \ifnum#1>\inputs
+ \PackageError{circuitikz}{%
+ You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
+ which has been defined with \inputs\space pins%
+ }{Please check the manual about logic ports; if you press return I'll try to continue}
+ \fi
+ \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
+ \pgfextractx{\pgf@circ@res@left}{\bodyleft}
+ \pgf@circ@res@step=\pind
+ \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax
+ \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen
+}%
+
+% #1 = \pgfmathcounter #2=type
+% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
+\def\pgf@circ@ieeeport@baseinput#1#2%
+{%
+ \ifnum#1>\inputs
+ \PackageError{circuitikz}{%
+ You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
+ which has been defined with \inputs\space pins%
+ }{Please check the manual about logic ports; if you press return I'll try to continue}
+ \fi
+ % Find the vertical position (this is the same for any port)
+ \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
+ \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
+ % rack (extended) pins; they are the same for all the ports
+ % call K = (inputs-inner)/2, rounded up; pins on the rack are:
+ % above: 1..K (included)
+ % below: inputs-K..inputs
+ % Find the pins on the rack; they are 1...
+ \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
+ \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
+ % border anchors for rack should be ok
+ \pgfextractx{\pgf@circ@res@left}{\topleft}
+ \pgfextractx{\pgf@circ@res@right}{\bodyleft}
+ \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
+ % we have finished if we are in the rack
+ \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
+ % we are on the inner ports; we have to do the hard work here
+ % and and nand
+ \ifnum #2=1
+ \relax % It's an and/nand, all border ports are on the rack line
+ \fi
+ % or and nor
+ \ifnum #2=2
+ \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
+ \fi
+ % xor and xnor
+ \ifnum #2=3\relax
+ \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
+ \fi
+ \fi\fi
+}%
+% inner base ports for xor types port
+% #1 = \pgfmathcounter #2=type
+% type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
+\def\pgf@circ@ieeeport@innerbaseinput#1%
+{%
+ \ifnum#1>\inputs
+ \PackageError{circuitikz}{%
+ You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
+ which has been defined with \inputs\space pins%
+ }{Please check the manual about logic ports; if you press return I'll try to continue}
+ \fi
+ % Find the vertical position (this is the same for any port)
+ \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
+ \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
+ % rack (extended) pins; they are the same for all the ports
+ % call K = (inputs-inner)/2, rounded up; pins on the rack are:
+ % above: 1..K (included)
+ % below: inputs-K..inputs
+ % Find the pins on the rack; they are 1...
+ \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
+ \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
+ % border anchors for rack should be ok
+ \pgfextractx{\pgf@circ@res@left}{\topleft}
+ \pgfextractx{\pgf@circ@res@right}{\bodyleft}
+ \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
+ % we have finished if we are in the rack
+ \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
+ % we are on the inner ports; we have to do the hard work here
+ \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
+ \fi\fi
+}%
+
+%%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp
+\def\pgf@circ@ieeestd@baselen{%
+ \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen}
+}
+\def\pgf@circ@ieeestd@stdH{%
+ \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
+ \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen}
+}
+\def\pgf@circ@ieeestd@pinlen{%
+ \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
+ \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen}
+}
+\def\pgf@circ@ieeestd@xorbar{%
+ \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
+ \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen}
+}
+%% Not circle
+\def\pgf@circ@notradius{
+ \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE
+ \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp}
+ % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp}
+}
+%% Find (in ...@other) the height of the rack
+\def\pgf@circ@findrackH{%
+ \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
+ \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
+ \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
+ \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
+ \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
+ \pgf@circ@ieeestd@stdH
+ \multiply\pgf@circ@res@temp by 2\relax% full height
+ \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing
+ \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port
+ % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other}
+}
+%%
+\def\pgf@circ@find@ieeeport@up{% leave it in up
+ % Normal port limits
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp}
+ % rack top size
+ \pgf@circ@findrackH
+ \ifdim\pgf@circ@res@other > \pgf@circ@res@up
+ \pgf@circ@res@up=\pgf@circ@res@other
+ \else
+ \fi
+}
+\def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type
+ % Normal port limits
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5}
+ \pgf@circ@res@right=\pgf@circ@res@left % save the border value
+ \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value
+ \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp
+ % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
+ % this is the normal left border
+ % For the or or xor port, the limit can be the pointy thing (in case the
+ % pinlen is zero or too small)
+ % add to the body margin the or/nor peak:
+ \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
+ \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))}
+ \advance\pgf@circ@res@right by \pgf@circ@res@other
+ % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
+ \fi
+ % add to the body margin the xor/xnor distance
+ \ifnum #1 = 3\relax% "xor" or "xnor" gates.
+ \pgf@circ@ieeestd@xorbar
+ \advance\pgf@circ@res@right by \pgf@circ@res@temp
+ % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
+ \fi
+ % and if this exceeds the normal margin, this is it
+ % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
+ \ifdim \pgf@circ@res@right > \pgf@circ@res@left
+ \pgf@circ@res@left=\pgf@circ@res@right
+ \fi
+ % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
+ \pgf@circ@res@left=-\pgf@circ@res@left
+}
+\def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated
+ % Normal port limits
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5}
+ \pgf@circ@notradius
+ \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
+ \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
+ \ifdim\pgf@circ@res@other > \pgf@circ@res@right
+ \pgf@circ@res@right=\pgf@circ@res@other
+ \fi
+}
+\def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated
+ % Normal port limits
+ \pgf@circ@ieeestd@stdH
+ % notice 0.8660254 is cos(30)
+ \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp}
+ \pgf@circ@notradius
+ \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
+ \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
+ \ifdim\pgf@circ@res@other > \pgf@circ@res@right
+ \pgf@circ@res@right=\pgf@circ@res@other
+ \fi
+}
+
+
+%%% ieeestd multi-input ports
+%%% #1: name
+%%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
+%%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
+%%% #4: drawing for the port
+\long\def\pgfcircdeclareieeeport#1#2#3#4{%
+ \pgfdeclareshape{ieeestd #1 port}%
+ {%
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
+ \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
+ \saveddimen{\baselen}{%
+ \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
+ }
+ \saveddimen{\stdH}{% This is HALF the height of the inner port
+ \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
+ }
+ \saveddimen{\notdiameter}{
+ \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
+ }
+ \saveddimen{\pind}{% pin distance;
+ \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
+ \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
+ \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
+ \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
+ \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
+ \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height
+ \divide\pgf@x by \pgf@circ@count@b
+ }
+ \saveddimen{\pinlen}{%
+ \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
+ }
+ \saveddimen{\xorbar}{%
+ \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp
+ }
+ % anchors for the body (no pins included here)
+ \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5}
+ \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
+ }
+ \savedanchor{\topleft}{%
+ \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar
+ \pgf@circ@ieeestd@stdH
+ \pgf@circ@res@other=0pt\relax
+ \ifnum #2 = 2\relax% "or" or "nor" gates.
+ \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))}
+ \fi
+ \ifnum #2 = 3\relax% "xor" or "xnor" gates.
+ \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))
+ +\pgf@circ@res@right}
+ \fi
+ \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other}
+ \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
+ }
+ \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5}
+ \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
+ }
+ \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
+ \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
+ \pgf@circ@ieeestd@stdH
+ % #3 is =1 if the port is a negated output one
+ \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other}
+ \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
+ }
+ % geographical anchors --- must be rectangulars!
+ \savedanchor{\northwest}{%
+ \pgf@circ@find@ieeeport@up
+ \pgf@circ@find@ieeeport@left{#2}
+ % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up}
+ \pgf@x=\pgf@circ@res@left
+ \pgf@y=\pgf@circ@res@up
+ }
+ \savedanchor{\southwest}{%
+ \pgf@circ@find@ieeeport@up
+ \pgf@circ@find@ieeeport@left{#2}
+ \pgf@x=\pgf@circ@res@left
+ \pgf@y=-\pgf@circ@res@up
+ }
+ \savedanchor{\southeast}{%
+ \pgf@circ@find@ieeeport@up
+ \pgf@circ@find@ieeeport@right{#3}
+ \pgf@x=\pgf@circ@res@right
+ \pgf@y=-\pgf@circ@res@up
+ }
+ \savedanchor{\northeast}{%
+ \pgf@circ@find@ieeeport@up
+ \pgf@circ@find@ieeeport@right{#3}
+ \pgf@x=\pgf@circ@res@right
+ \pgf@y=\pgf@circ@res@up
+ }
+ \savedmacro\inputs{% get number of inputs
+ \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
+ \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default
+ \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
+ % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
+ \def\inputs{\the\pgf@circ@count@a}%
+ }%
+ \savedmacro\inners{% get number of "inner" inputs (for racks)
+ \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
+ \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax
+ \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
+ \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
+ \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi
+ % \typeout{INNER is \the\pgf@circ@count@b}%
+ % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
+ \def\inners{\the\pgf@circ@count@b}%
+ }%
+ \anchor{center}{\pgfpointorigin}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
+ \else
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border
+ \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
+ \fi
+ }
+ % create input anchors
+ \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{%
+ \pgfmathloop%
+ \ifnum\pgfmathcounter>\pgf@circ@count@a%
+ \else%
+ %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
+ \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{%
+ \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above
+ }%
+ \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{%
+ \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above
+ }%
+ \ifnum #2 = 3\relax % xor/xnor inner border pins
+ \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{%
+ \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above
+ }%
+ \fi
+ %}{}%
+ \repeatpgfmathloop%
+ }
+ % output anchor
+ \anchor{out}{%
+ \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
+ \advance\pgf@circ@res@other by\pinlen
+ \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
+ \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
+ \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
+ \fi
+ \pgf@x=\pgf@circ@res@other\pgf@y=0pt
+ }
+ \anchor{bout}{\bottomright\pgf@y=0pt}
+
+ \anchor{body right}{\bodyright\pgf@y=0pt}
+ \anchor{right}{\bottomright\pgf@y=0pt}
+ \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
+ \anchor{left}{% central edge of the component
+ \bodyleft\pgf@y=0pt
+ \ifnum #2=3\relax
+ \advance\pgf@x by -\xorbar
+ \fi
+ }
+ \anchor{up}{%
+ \bodyleft
+ \ifnum #2 > 1 % pointy shapes
+ \pgf@circ@ieeestd@stdH
+ % horizontal coordinate where the right semicircle starts
+ \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
+ % vertical drop of the circle at the above coordinate
+ \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
+ \advance \pgf@y by -\pgf@circ@res@step
+ \fi
+ \pgf@x=0pt
+ }
+ \anchor{down}{%
+ \bodyleft
+ \ifnum #2 > 1 % pointy shapes
+ \pgf@circ@ieeestd@stdH
+ % horizontal coordinate where the right semicircle starts
+ \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
+ % vertical drop of the circle at the above coordinate
+ \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
+ \advance \pgf@y by -\pgf@circ@res@step
+ \fi
+ \pgf@y=-\pgf@y\pgf@x=0pt
+ }
+
+ % geographical anchors
+ \anchor{nw}{\northwest}
+ \anchor{ne}{\northeast}
+ \anchor{se}{\southeast}
+ \anchor{sw}{\southwest}
+ \anchor{north west}{\northwest}
+ \anchor{north east}{\northeast}
+ \anchor{south east}{\southeast}
+ \anchor{south west}{\southwest}
+ % over 0,0 even if asymmetric
+ % will break if the geocoords are not rectangular
+ \anchor{n}{\northwest\pgf@x=0pt\relax}
+ \anchor{e}{\northeast\pgf@y=0pt\relax}
+ \anchor{s}{\southwest\pgf@x=0pt\relax}
+ \anchor{w}{\northwest\pgf@y=0pt\relax}
+ \anchor{north}{\northwest\pgf@x=0pt\relax}
+ \anchor{east}{\northeast\pgf@y=0pt\relax}
+ \anchor{south}{\southwest\pgf@x=0pt\relax}
+ \anchor{west}{\northwest\pgf@y=0pt\relax}
+
+ \backgroundpath{
+ \pgfscope
+ \pgfsetcolor{\ctikzvalof{color}}
+ #4
+ \endpgfscope
+ % output lead:
+ \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
+ \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
+ \advance\pgf@circ@res@other by \pinlen\relax
+ \ifdim \pgf@circ@res@other > \pgf@circ@res@right
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
+ \pgfusepath{draw}
+ \fi
+ \ifnum #3=1\relax\pgfscope
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
+ \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ }
+ }
+}
+
+%%% #1 direct name #2 negated name #3 type #4 drawing (without output)
+\long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
+ \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
+ \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
+}
+%
+% ieeestd "and" and "nand"
+%
+\pgfcircdeclareieeeportpair{and}{nand}{1}{%
+ \pgf@circ@count@a = \inputs\relax
+ \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
+ \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
+ \pgfextractx{\pgf@circ@res@left}{\bodyleft}
+ \pgfextracty{\pgf@circ@res@down}{\bodyleft}
+ \ifpgfcirc@draw@leads
+ %input leads --- all the same for AND ports
+ \loop\ifnum\pgf@circ@count@a>0
+ \advance\pgf@circ@res@temp by -\pind
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
+ \advance\pgf@circ@count@a by -1
+ \repeat
+ \fi
+ \pgfusepath{draw}
+ %% Body. let's start from the top left
+ \pgfscope
+ \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
+ \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
+ \pgfpatharc{90}{-90}{\stdH}
+ \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
+ \pgfpathclose
+ \pgf@circ@draworfill
+ % rack now; skip if not needed.
+ % \typeout{WHAT\space \inputs\space \inners}
+ \ifnum\inputs>\inners
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
+ \pgfusepath{draw}
+ \fi
+ \endpgfscope
+}
+%
+% or/nor and xor/xnor are practically the same. Let factor out everything
+% the argument #1 is put just before the drawing of the inner pins
+% the argument #2 is put after the drawing of the body
+%
+\long\def\pgf@circ@ieeeport@orxor#1#2{%
+ \pgf@circ@count@a = \inputs\relax
+ \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
+ \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
+ \pgfextractx{\pgf@circ@res@left}{\bodyleft}
+ \pgfextracty{\pgf@circ@res@down}{\bodyleft}
+ % rack (extended) pins; they are the same for all the ports
+ % call K = (inputs-inner)/2, rounded up; pins on the rack are:
+ % above: 1..K (included)
+ % below: inputs-K..inputs
+ % Find the pins on the rack; they are 1...
+ \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
+ \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1
+ \ifpgfcirc@draw@leads
+ %input leads --- for or ports
+ \loop\ifnum\pgf@circ@count@a>0
+ \pgfextractx{\pgf@circ@res@right}{\topleft}
+ \advance\pgf@circ@res@temp by -\pind
+ % this is the height; let's find the "right" position
+ \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c
+ % inner pins
+ % \typeout{INNER\space\pgf@circ@count@a}
+ \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))}
+ % hook for xor/xnor
+ #1
+ \fi\fi
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}%
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
+ \pgfusepath{draw}
+ \advance\pgf@circ@count@a by -1
+ \repeat
+ \fi
+ %% Body. let's start from the top left
+ \pgfscope
+ \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
+ % it should start here, but with this trick the close comes out better.
+ % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
+ \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
+ \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} %
+ \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
+ \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}}
+ \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
+ %% this should be 2 and 2; but the round part is not a perfect circle that way
+ %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
+ \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
+ \pgfpathclose
+ \pgf@circ@draworfill
+ % hook for xor/xnor
+ #2
+ % rack now; skip if not needed.
+ % \typeout{WHAT\space \inputs\space \inners}
+ \ifnum\inputs>\inners
+ \pgfextractx{\pgf@circ@res@left}{\topleft}
+ \pgfextracty{\pgf@circ@res@down}{\topleft}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
+ \pgfusepath{draw}
+ \fi
+ \endpgfscope
+}
+%
+% ieeestd "or" and "nor"
+%
+\pgfcircdeclareieeeportpair{or}{nor}{2}{%
+ \pgf@circ@ieeeport@orxor{}{}
+}
+\pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
+ \pgf@circ@ieeeport@orxor{
+ \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
+ \ifnum\@@tmp=0\relax
+ % move pin start to the left to leave the xor gap free (not standard)
+ \advance\pgf@circ@res@right by -\xorbar
+ \fi
+ }{%
+ % add the xor/xnor bar
+ \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
+ % see the comment on the main body about the 2.2
+ \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
+ \pgfusepath{draw}
+ }
+}
+%
+% Buffer and inverters
+%
+% #1: name
+% #2: polarity
+% #3: content
+\long\def\pgfcircdeclareieeebufferport#1#2#3{%
+ \pgfdeclareshape{ieeestd #1 port}%
+ {%
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
+ \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
+ \saveddimen{\baselen}{%
+ \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
+ }
+ \saveddimen{\stdH}{% This is HALF the height of the inner port
+ \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
+ }
+ \saveddimen{\notdiameter}{
+ \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
+ }
+ \saveddimen{\pinlen}{%
+ \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
+ }
+ % anchors for the body (no pins included here)
+ % Notice that 0.8660254 is cos(30)
+ \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
+ \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
+ }
+ \savedanchor{\topleft}{%
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
+ \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
+ }
+ \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp}
+ \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
+ }
+ \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
+ \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
+ \pgf@circ@ieeestd@stdH
+ % #2 is =1 if the port is a negated output one
+ \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other}
+ \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
+ }
+ % geographical anchors --- must be rectangulars!
+ \savedanchor{\northwest}{%
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
+ \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
+ }
+ \savedanchor{\southwest}{%
+ \pgf@circ@ieeestd@stdH
+ \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
+ \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
+ }
+ \savedanchor{\southeast}{%
+ \pgf@circ@ieeestd@stdH
+ \pgf@circ@res@up=\pgf@circ@res@temp
+ \pgf@circ@find@ieeeport@not@right{#2}
+ \pgf@x=\pgf@circ@res@right
+ \pgf@y=-\pgf@circ@res@up
+ }
+ \savedanchor{\northeast}{%
+ \pgf@circ@ieeestd@stdH
+ \pgf@circ@res@up=\pgf@circ@res@temp
+ \pgf@circ@find@ieeeport@not@right{#2}
+ \pgf@x=\pgf@circ@res@right
+ \pgf@y=\pgf@circ@res@up
+ }
+ \anchor{center}{\pgfpointorigin}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
+ \else
+ \pgf@circ@ieeestd@stdH
+ \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
+ \fi
+ }
+ % input anchors
+ \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
+ \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
+ \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
+ \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
+ % output anchors
+ \anchor{out}{%
+ \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
+ \advance\pgf@circ@res@other by\pinlen
+ \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
+ \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
+ \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
+ \fi
+ \pgf@x=\pgf@circ@res@other\pgf@y=0pt
+ }
+ \anchor{bout}{\bottomright\pgf@y=0pt}
+
+ \anchor{body right}{\bodyright\pgf@y=0pt}
+ \anchor{right}{\bottomright\pgf@y=0pt}
+ \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
+ \anchor{left}{% central edge of the component
+ \pgf@circ@ieeestd@xorbar% save \xorbar in temp
+ \bodyleft\pgf@y=0pt\advance\pgf@x by -\pgf@circ@res@temp
+ }
+ \anchor{up}{%
+ \bodyleft
+ \pgf@y=+0.5\pgf@y\pgf@x=0pt
+ }
+ \anchor{down}{%
+ \bodyleft
+ \pgf@y=-0.5\pgf@y\pgf@x=0pt
+ }
+
+ % geographical anchors
+ \anchor{nw}{\northwest}
+ \anchor{ne}{\northeast}
+ \anchor{se}{\southeast}
+ \anchor{sw}{\southwest}
+ \anchor{north west}{\northwest}
+ \anchor{north east}{\northeast}
+ \anchor{south east}{\southeast}
+ \anchor{south west}{\southwest}
+ % over 0,0 even if asymmetric
+ % will break if the geocoords are not rectangular
+ \anchor{n}{\northwest\pgf@x=0pt\relax}
+ \anchor{e}{\northeast\pgf@y=0pt\relax}
+ \anchor{s}{\southwest\pgf@x=0pt\relax}
+ \anchor{w}{\northwest\pgf@y=0pt\relax}
+ \anchor{north}{\northwest\pgf@x=0pt\relax}
+ \anchor{east}{\northeast\pgf@y=0pt\relax}
+ \anchor{south}{\southwest\pgf@x=0pt\relax}
+ \anchor{west}{\northwest\pgf@y=0pt\relax}
+
+ \backgroundpath{
+ \pgfscope
+ \pgfsetcolor{\ctikzvalof{color}}
+ #3
+ \endpgfscope
+ % output lead:
+ \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
+ \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
+ \advance\pgf@circ@res@other by \pinlen\relax
+ \ifdim \pgf@circ@res@other > \pgf@circ@res@right
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
+ \pgfusepath{draw}
+ \fi
+ \ifnum #2=1\relax\pgfscope
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
+ \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
+ \endpgfscope\fi
+ }
+ }
+}
+
+%%% #1 direct name #2 negated name #3 drawing (without output)
+\long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
+ \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
+ \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
+}
+
+\pgfcircdeclareieeebufferportpair{buffer}{not}{%
+ \pgfextractx{\pgf@circ@res@left}{\bodyleft}
+ \pgfextracty{\pgf@circ@res@up}{\bodyleft}
+ \pgfextractx{\pgf@circ@res@right}{\bodyright}
+ % \draw input pin
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
+ \pgfpathclose
+ \pgf@circ@draworfill
+ \endpgfscope
+}
+
+\pgfcircdeclareieeebufferportpair{schmitt}{inv schmitt}{%
+ \pgfextractx{\pgf@circ@res@left}{\bodyleft}
+ \pgfextracty{\pgf@circ@res@up}{\bodyleft}
+ \pgfextractx{\pgf@circ@res@right}{\bodyright}
+ % \draw input pin
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
+ \pgfusepath{draw}
+ \pgfscope
+ \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
+ \pgfpathclose
+ \pgf@circ@draworfill
+ \endpgfscope
+ % draw schmitt symbol in normal line thickness
+ \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
+ \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
+ \pgfusepath{draw}
+}
+
+
+\pgfdeclareshape{schmitt symbol}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgf@circ@ieeestd@stdH
+ \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp
+ \pgf@x=-1.5\pgf@y
+ }
+ \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
+ \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
+ \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
+ \anchor{west}{\northwest\pgf@y=0pt}
+ \anchor{w}{\northwest \pgf@y=0pt}
+ \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
+ \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
+ \anchor{north}{\northwest\pgf@x=0pt}
+ \anchor{n}{\northwest\pgf@x=0pt}
+ \anchor{south west}{\northwest\pgf@y=-\pgf@y}
+ \anchor{north east}{\northwest\pgf@x=-\pgf@x}
+ \anchor{north west}{\northwest}
+ \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
+ \backgroundpath{
+ \pgfscope
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfextractx{\pgf@circ@res@left}{\northwest}
+ \pgfextracty{\pgf@circ@res@up}{\northwest}
+ \pgf@circ@res@left=0.7\pgf@circ@res@left
+ \pgf@circ@res@up=0.7\pgf@circ@res@up
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
+ \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
+ \pgfusepath{draw}
+ \endpgfscope
+ }
+}
+
+\pgfdeclareshape{notcirc}{
+ \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
+ \anchor{center}{\pgfpointorigin}
+ \savedanchor\northwest{%
+ \pgf@circ@notradius
+ \pgf@y=\pgf@circ@res@temp
+ \pgf@x=-\pgf@y
+ }
+ \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
+ \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
+ \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
+ \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
+ \anchor{left}{\northwest\pgf@y=0pt}
+ \anchor{west}{\northwest\pgf@y=0pt}
+ \anchor{w}{\northwest \pgf@y=0pt}
+ \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
+ \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
+ \anchor{north}{\northwest\pgf@x=0pt}
+ \anchor{n}{\northwest\pgf@x=0pt}
+ \anchor{south west}{\northwest\pgf@y=-\pgf@y}
+ \anchor{north east}{\northwest\pgf@x=-\pgf@x}
+ \anchor{north west}{\northwest}
+ \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
+ \anchorborder{
+ \pgf@circ@res@left=\pgf@x
+ \pgf@circ@res@up=\pgf@y
+ \northwest\pgf@circ@res@temp=\pgf@y
+ \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
+ {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \northwest\pgf@circ@res@temp=\pgf@y
+ \pgfsetcolor{\ctikzvalof{color}}
+ \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
+ \ifx\tikz@fillcolor\pgfutil@empty
+ % set the default fill color to white
+ \pgfsetfillcolor{white}
+ % ...but override it if the class is defined!
+ \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
+ \else
+ \pgfsetfillcolor{\tikz@fillcolor}
+ \fi
+ \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex
index 858e388363..24585e20ea 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircpath.tex
@@ -363,6 +363,7 @@
%%Mechanical
\def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}}
+\def\pgf@circ@inerter@path#1{\pgf@circ@bipole@path{inerter}{#1}}
\def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}}
\def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}}
\def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}}
@@ -377,6 +378,7 @@
%}
\compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}}
+\compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inerter@path, l=#1}}
\compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}}
\compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}}
\compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}}
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex
index 672cbf78b0..6eecb72c99 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex
@@ -1262,12 +1262,39 @@
% #2 - text inside
% #3 - number of inputs
% #4 = is it a not?
+%
+% option to add a circle for not-output, see
+% https://github.com/circuitikz/circuitikz/issues/385
+%
+\newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse
+\ctikzset{tripoles/european not shape/.initial=ocirc}
+\ctikzset{tripoles/european not symbol/.is choice}
+\ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}}
+\ctikzset{tripoles/european not symbol/circle/.code={%
+\pgf@circ@european@port@circletrue\ctikzset{tripoles/european not shape=ocirc}}}
+\ctikzset{tripoles/european not symbol/ieee circle/.code={%
+\pgf@circ@european@port@circletrue\ctikzset{tripoles/european not shape=notcirc}}}
\long\def\pgfcircdeclareeurologicport#1#2#3#4{
\pgfdeclareshape{european #1 port}
{
\savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
+ \saveddimen{\boutshift}{%
+ \ifpgf@circ@european@port@circle
+ \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
+ \edef\pgf@temp{ocirc}
+ \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}}
+ \ifx\pgf@temp\pgf@circ@temp % it's ocirc
+ \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
+ \else % it's ieee not circ
+ \pgf@circ@notradius % defined together with ieeestd ports
+ \pgf@x=2\pgf@circ@res@temp
+ \fi
+ \else
+ \pgf@x=0pt
+ \fi
+ }
\savedmacro\resize{% automatic
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
\pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
@@ -1324,7 +1351,7 @@
}
\fi
\anchor{out}{\northeast\pgf@y=0pt}
- \anchor{bout}{\right\pgf@y=0pt}
+ \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
\anchor{left}{\left}% edges of component minus leads
\anchor{right}{\right}
@@ -1379,16 +1406,25 @@
\pgfpathlineto{%
\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
%
+ \pgfusepath{draw}
+ %
\edef\pgf@temp{not}
\edef\pgf@circ@temp{#4}
\ifx\pgf@temp\pgf@circ@temp % is a not
- \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
- \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
- {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
+ \ifpgf@circ@european@port@circle
+ \pgfscope
+ \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
+ \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}
+ \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
+ \endpgfscope
+ \else
+ \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
+ {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
+ \pgfusepath{draw}
+ \fi
\fi
%
- \pgfusepath{draw}
- %
\pgfpathmoveto{\pgfpointorigin}
\pgftext{#2}
}
@@ -2209,12 +2245,19 @@
%draw thicker gate lines
\pgfscope
- \pgfpathmoveto{\pgfpoint
- {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
- {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
- \pgfpathlineto{\pgfpoint
- {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
- {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
+ \pgfscope
+ \pgfpathmoveto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
+ {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
+ \pgfpathlineto{\pgfpoint
+ {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
+ {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
+ % set the normal thickness
+ \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
+ \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
+ \pgfsetlinewidth{\@@extrat\pgflinewidth}
+ \pgfusepath{draw}
+ \endpgfscope
\pgfpathmoveto{\pgfpoint
{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
{\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
@@ -3188,7 +3231,15 @@
\anchor{north west}{ \northwest }
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
- \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -3359,7 +3410,15 @@
\anchor{north east}{ \northwest \pgf@x=-\pgf@x }
\anchor{north west}{ \northwest }
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
- \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -3595,7 +3654,15 @@
\anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
\anchor{north west}{ \northwest }
\anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
- \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -3905,7 +3972,15 @@
\anchor{north east}{ \northwest \pgf@x=-\pgf@x }
\anchor{north west}{ \northwest }
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
- \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
% let's start drawing the component
\backgroundpath{
@@ -4107,7 +4182,15 @@
\anchor{north west}{ \northwest }
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
- \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -4329,7 +4412,15 @@
\anchor{north west}{ \northwest }
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
- \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
% let's start drawing the component
\backgroundpath{
@@ -4608,7 +4699,15 @@
\anchor{north west}{ \northwest }
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
- \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
% drawing of the component
\backgroundpath{
@@ -4736,7 +4835,15 @@
\pgf@x=-0.7\pgf@x
}
- \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \northwest
+ \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -4889,7 +4996,15 @@
\pgf@x=-\pgf@x
}
- \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
@@ -5017,8 +5132,15 @@
\pgf@x=-\pgf@x
}
- \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
-
+ \anchor{text}{
+ \ifpgf@circ@center@text
+ \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
+ \else
+ \leftedge
+ \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
+ \fi
+ \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
+ }
\backgroundpath{
\pgfsetcolor{\ctikzvalof{color}}
diff --git a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex
index ac8bbf4296..36c53ee561 100644
--- a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex
@@ -10,8 +10,8 @@
%
% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
-\def\pgfcircversion{1.0.2}
-\def\pgfcircversiondate{2020/03/22}
+\def\pgfcircversion{1.1.0}
+\def\pgfcircversiondate{2020/04/19}
\writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
\usemodule[tikz]
diff --git a/graphics/pgf/contrib/tikz-planets/README.md b/graphics/pgf/contrib/tikz-planets/README.md
index 8cfd1cc000..3fc545aee1 100644
--- a/graphics/pgf/contrib/tikz-planets/README.md
+++ b/graphics/pgf/contrib/tikz-planets/README.md
@@ -4,7 +4,7 @@ These files provide the TikZ-planets package that makes it easy to illustrate ce
# Installation
Move the package (.sty file) to a latex search directory if
- you want to be able to use it from any directory. Ask you
+ you want to be able to use it from any directory. Ask your
system administrator if you need help.
# Requirements
@@ -24,4 +24,5 @@ This repository contains the following files:
- README.md, the current file
# License
-Files are shared under the CC-BY-SA 4.0 license. \ No newline at end of file
+Copyright 2020 Isabelle M. Santos
+This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ \ No newline at end of file
diff --git a/graphics/pgf/contrib/tikz-planets/planets-doc.pdf b/graphics/pgf/contrib/tikz-planets/planets-doc.pdf
index 5d3c61634d..970b3f27ba 100644
--- a/graphics/pgf/contrib/tikz-planets/planets-doc.pdf
+++ b/graphics/pgf/contrib/tikz-planets/planets-doc.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-planets/planets-doc.tex b/graphics/pgf/contrib/tikz-planets/planets-doc.tex
index 0702461061..8e694a014a 100644
--- a/graphics/pgf/contrib/tikz-planets/planets-doc.tex
+++ b/graphics/pgf/contrib/tikz-planets/planets-doc.tex
@@ -1,6 +1,18 @@
+% tikz-planets documentation -- illustrate celestial mechanics with TikZ
+% Version 1.0.2
+
+% Isabelle M. Santos
+% This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
+% To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/
+
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
\documentclass[12pt, twocolumn]{article}
\usepackage{url}
+\usepackage[hidelinks]{hyperref}
\usepackage{planets}
@@ -8,7 +20,7 @@
\title{The TikZ-planets package}
\author{Isabelle M. Santos}
-\date{Version 1.0.1 -- 2020/03/30}
+\date{Version 1.0.2 -- 2020/04/19}
\begin{document}
\maketitle
@@ -35,12 +47,14 @@ Tikz-planets requires the following standard packages to be installed
\end{itemize}
\subsection{License}
-The package can be found at \url{https://framagit.org/Moutmout/tikz-planets.git}. It is under the CC-BY-SA license.
+The package can be found at \url{https://framagit.org/Moutmout/tikz-planets.git}.
+
+This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit \url{http://creativecommons.org/licenses/by-sa/4.0/}.
\section{Usage}
\subsection{Drawing a planet}
Drawing one of the eight solar system planets is rather straightforward, use \verb|\planet[surface=earth]|, replacing the option \verb|earth| with the name of any planet.
-Although they are not planets, the \verb|\planet| command can also be used to draw the Sun and the Moon, by setting the \verb|surface| option.
+Although they are not planets, the \verb|\planet| command can also be used to draw the Sun, the Moon and Pluto, by setting the \verb|surface=<name>| keyword.
\begin{verbatim}
\planet[surface=sun]
@@ -67,31 +81,45 @@ If you need a planet that isn't in the solar system, you can make a generic one
\end{tikzpicture}
\subsection{Rings}
-The four gas giants in the solar system sport a ring.
-In the current version of the package, only Saturn is shown with a ring.
+The four gas giants in the solar system sport a ring, but only Saturn is shown with a ring by default.
+A "Saturn-like" set of rings can be drawn around any planet with the \verb|rings| option.
+A thin ring with a custom radius can be drawn with the \verb|ring=<radius>| option.
+%and a thin ring with the \verb|thin ring| option.
+%Thin rings can be set with a custom radius.
+
+\begin{verbatim}
+\planet[surface=mercury, rings]
+\planet[surface=neptune, ring=1.5]
+\end{verbatim}
+\begin{tikzpicture}
+\planet[surface=mercury, rings]
+\planet[surface=neptune, ring=1.5, centerx=4.4]
+\end{tikzpicture}
\subsection{Rotational characteristics}
Most planets rotate around a set axis that can be tilted with respect to the plane of orbit.
The rotation axis of the Earth, for instance, is tilted by 23.5 degrees.
Uranus spins on its side, with a rotation axis tilted at 90 degrees.
-This can be illustrated using the \verb|tilt| and the \verb|rotation| options.
+This can be illustrated using the \verb|tilt=<angle in degrees>| and the \verb|rotation| options.
+
+Venus rotates in the opposite direction compared to the other planets in the solar system.
+This can be illustrated with the \verb|retrograde| option.
\begin{verbatim}
-\planet[surface=earth, tilt=23.5]
-\planet[surface=uranus, tilt=90, rotation]
-\planet[surface=venus, retrograde, rotation]
+\planet[surface=pluto, tilt=22.5]
+\planet[surface=uranus, tilt=90, rotation,
+ ring=1.7]
+\planet[surface=venus,
+ retrograde, rotation]
\end{verbatim}
\begin{tikzpicture}
-\planet[surface=earth, tilt=23.5]
-\planet[surface=uranus, tilt=90, rotation, centerx=3.3]
+\planet[surface=pluto, tilt=22.5]
+\planet[surface=uranus, tilt=90, rotation, ring=1.7, centerx=3.3]
\planet[surface=venus, rotation, retrograde, centerx=6.6]
\end{tikzpicture}
-Venus rotates in the opposite direction compared to the other planets in the solar system.
-This can be illustrated with the \verb|retrograde| option.
-
\subsection{Phases}
-Half of a planet or moon in in the shadow of the Sun. This can be illustrated with the \verb|phase| keyword, which can take the following values: \verb|new|, \verb|first crescent|, \verb|first half|, \verb|waxing gibbous|, \verb|full|, \verb|waning gibbous|, \verb|last half| or \verb|last crescent|.
+Half of a planet or moon is in the shadow of the Sun. This can be illustrated with the \verb|phase=<name>| keyword, which can take the following values: \verb|new|, \verb|first crescent|, \verb|first half|, \verb|waxing gibbous|, \verb|full|, \verb|waning gibbous|, \verb|last half| or \verb|last crescent|.
\hspace{1em}
@@ -114,15 +142,48 @@ Half of a planet or moon in in the shadow of the Sun. This can be illustrated wi
\node[red, align=center] at (0, -2) {last \\ crescent};
\end{tikzpicture}
+If the phase is specified for a planet with "Saturn-like" rings, then the rings will also be shaded.
+
+\begin{verbatim}
+\planet[surface=saturn,
+ phase=first half, tilt=20]
+\planet[surface=saturn,
+ phase=waxing gibbous, tilt=-20]
+\end{verbatim}
+\begin{tikzpicture}
+\planet[surface=saturn, phase=first half, tilt=20]
+\planet[surface=saturn, phase=waxing gibbous, centerx=4.5, tilt=-20]
+\end{tikzpicture}
+
\subsection{Size and position}
By default, a planet has a radius of $1$ and is centered at $(0, 0)$.
-
To draw schematics illustrating celestial mechanics, it is useful to use several \verb|\planet|s in one figure.
-The position of the center of the planet can be set using the \verb|centerx| and the \verb|centery| keywords.
-The size of the planet is set with the \verb|scale| keyword.
+
+The size of the planet is set with the \verb|scale=<planet radius>| keyword.
+For instance, \verb|scale=2| makes the radius of the planet twice as big.
+
+The position of the center of the planet can be set by specifying the $x$ and $y$ coordinates of the center with the \verb|centerx=<x coordinate>| and/or \verb|centery=<y coordinate>| keywords.
+Alternatively, the coordinates of the planet's center can be set using the \verb|center=<point>| keyword.
+This makes it possible to specify the center of the planet in either cartesian, polar coordinates or named points.
+
+\begin{verbatim}
+\planet[center={(0, 1.5)}, scale=.6]
+\planet[centerx=4, centery = 1]
+\planet[center={(45 : 3)}, scale=1.2]
+\node (A) at (7, 2) {};
+\planet[center={(A)}]
+\end{verbatim}
+\begin{tikzpicture}
+\planet[center={(0, 1.5)}, scale=.6]
+\planet[centerx=4, centery = 1]
+\planet[center={(45 : 3)}, scale=1.2]
+\node (A) at (7, 2) {};
+\planet[center={(A)}]
+\end{tikzpicture}
\onecolumn
\section{Complete examples}
+Here are a few examples of what can be done with the TikZ-planets package. More examples can be found at \url{https://framagit.org/search?utf8=%E2%9C%93&snippets=true&scope=snippet_titles&repository_ref=&search=tikz-planets}.
\subsection{The seasons}
Season's are caused by the tilt of Earth's axis.
This is why summer in the northern hemisphere happens at the same time as winter in the southern hemisphere.
@@ -150,7 +211,7 @@ Half of the Moon is in the shadow of the Sun.
Since the Moon goes around the Earth, the shadows on the near-side of the Moon change.
\begin{verbatim}
- \planet[surface=earth]
+ \planet[surface=earth, phase=first half]
\planet[surface=sun, centerx=10, scale=2]
\planet[surface=moon, phase=first half, centerx=-2.5, scale=.5]
@@ -159,7 +220,7 @@ Since the Moon goes around the Earth, the shadows on the near-side of the Moon c
\planet[surface=moon, phase=first half, centery=2.5, scale=.5]
\end{verbatim}
\begin{tikzpicture}
- \planet[surface=earth]
+ \planet[surface=earth, phase=first half]
\planet[surface=sun, centerx=10, scale=2]
\planet[surface=moon, phase=first half, centerx=-2.5, scale=.5]
@@ -169,34 +230,60 @@ Since the Moon goes around the Earth, the shadows on the near-side of the Moon c
\end{tikzpicture}
\subsection{The solar system}
-You might have learned "My Violent Evil Monster Just Scared Us Nuts" or some other mnemonic to remember the order of the eight (or nine if you're old enough) planets in the solar system.
+You might have learned ``My Violent Evil Monster Just Scared Us Nuts'', ``My Very Excellent Mother Just Served Us Nachos'', or some other mnemonic to remember the order of the eight (or nine if you're old enough) planets in the solar system.
The distances in the following sketch are not to scale, but the radii roughly are.
\begin{verbatim}
\clip (0,-3) rectangle (20, 3);
\planet[surface=sun, scale=28, centerx=-27]
- \planet[surface=mercury, centerx=1.5, scale=.1]
- \planet[surface=venus, centerx=2.5, scale=.25]
- \planet[surface=earth, centerx=3.5, scale=.25]
- \planet[surface=mars, centerx=4.5, scale=.13]
- \planet[surface=jupiter, centerx=8, scale=2.75]
- \planet[surface=saturn, centerx=12, scale=2.3]
- \planet[surface=uranus, centerx=15, scale=1]
- \planet[surface=neptune, centerx=16.8, scale=.97]
+ \planet[surface=mercury, centerx=1.5, tilt=0, scale=.1]
+ \planet[surface=venus, centerx=2.5, tilt=2.6, scale=.25]
+ \planet[surface=earth, centerx=3.5, tilt=23.5, scale=.25]
+ \planet[surface=mars, centerx=4.5, tilt=25.2, scale=.13]
+ \planet[surface=jupiter, centerx=8, tilt=3, scale=2.75]
+ \planet[surface=saturn, centerx=12, tilt=26.7, scale=2.3]
+ \planet[surface=uranus, centerx=15.5, tilt=97.8, scale=1]
+ \planet[surface=neptune, centerx=17.3, tilt=28.3, scale=.97]
\end{verbatim}
\begin{tikzpicture}
\clip (0,-3) rectangle (20, 3);
\planet[surface=sun, scale=28, centerx=-27]
- \planet[surface=mercury, centerx=1.5, scale=.1]
- \planet[surface=venus, centerx=2.5, scale=.25]
- \planet[surface=earth, centerx=3.5, scale=.25]
- \planet[surface=mars, centerx=4.5, scale=.13]
- \planet[surface=jupiter, centerx=8, scale=2.75]
- \planet[surface=saturn, centerx=12, scale=2.3]
- \planet[surface=uranus, centerx=15.5, scale=1]
- \planet[surface=neptune, centerx=17.3, scale=.97]
+ \planet[surface=mercury, centerx=1.5, tilt=0, scale=.1]
+ \planet[surface=venus, centerx=2.5, tilt=2.6, scale=.25]
+ \planet[surface=earth, centerx=3.5, tilt=23.5, scale=.25]
+ \planet[surface=mars, centerx=4.5, tilt=25.2, scale=.13]
+ \planet[surface=jupiter, centerx=8, tilt=3, scale=2.75]
+ \planet[surface=saturn, centerx=12, tilt=26.7, scale=2.3]
+ \planet[surface=uranus, centerx=15.5, tilt=97.8, scale=1]
+ \planet[surface=neptune, centerx=17.3, tilt=28.3, scale=.97]
\end{tikzpicture}
+\twocolumn
+
+\section{Changelog}
+
+\subsection{Version 1.0.2}
+\begin{itemize}
+\item Made planets and wasysym compatible
+\item Possibility to use a point to specify the center of a planet (thus use polar coordinates)
+\item Make a more schematic representation of Jupiter that better fits with the graphical style used for the telluric planets
+\item A ring system can be added around any planet
+\item Ensure the radius of a planet is exactly 1 by default
+\item Thin rings can be drawn with any radius
+\item Draw the phase before rings to avoid having a strange shadow on the rings
+\item Rings typically are in the equatorial plane of their planet: make rings tilt with axial tilt
+\item Use solid color rather than shading for rings so that they have the same appearance when tilted
+\item Added Pluto
+\item Added shading to the rings for each phase
+\item Fixed documentation typos
+\end{itemize}
+\subsection{Version 1.0.1}
+\begin{itemize}
+\item Crescent and gibbous phases
+\item Added Mercury, Venus, Jupiter, Saturn, Uranus and Neptune surfaces
+\item Rotation can now be retrograde
+\item Color used no longer depends on x11names
+\end{itemize}
\end{document} \ No newline at end of file
diff --git a/graphics/pgf/contrib/tikz-planets/planets.sty b/graphics/pgf/contrib/tikz-planets/planets.sty
index 6fcc37304e..a0717ad262 100644
--- a/graphics/pgf/contrib/tikz-planets/planets.sty
+++ b/graphics/pgf/contrib/tikz-planets/planets.sty
@@ -1,6 +1,19 @@
-\ProvidesPackage{planets}
+% Package tikz-planets -- illustrate celestial mechanics with TikZ
+% Version 1.0.2
+
+% Isabelle M. Santos
+% This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
+% To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/
+
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ProvidesPackage{planets}[2020/04/19 v1.0.2 celestial mechanics with Tikz]
\RequirePackage{tikz}
+\usetikzlibrary{decorations.pathmorphing}
+
\RequirePackage{xstring}
% Colors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -18,6 +31,8 @@
\definecolor{neptune4}{rgb}{.12, .56, 1}
\definecolor{neptune5}{rgb}{.42, .35, .8}
\definecolor{neptune_white}{rgb}{94, 1, 1}
+\definecolor{pluto1}{rgb}{.82, .77, .71}
+\definecolor{pluto2}{rgb}{.24, .18, .11}
\definecolor{brownish}{rgb}{.7, .58, .42}
\definecolor{wheat}{rgb}{.96, .87, .7}
@@ -30,27 +45,38 @@
% Keys %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifrotation
+\newif\ifequator
+\newif\ifaxis
\newif\ifretrograde
-\newif\ifring
+\newif\ifrings
\RequirePackage{pgfkeys}
\pgfkeys{
/planet/.is family, /planet,
- surface/.estore in = \surface,
- tilt/.estore in = \tilt,
- phase/.estore in = \phase,
+ surface/.estore in = \surfacename,
+ tilt/.estore in = \axialtilt,
+ phase/.estore in = \planetphase,
rotation/.is if = rotation,
+ equator/.is if = equator,
+ axis/.is if = axis,
retrograde/.is if = retrograde,
+ rings/.is if = rings,
+ ring/.estore in = \ringradius,
color/.estore in = \mycolor,
- centerx/.estore in = \centerx,
- centery/.estore in = \centery,
- scale/.estore in = \scale,
+ center/.code={\pgfkeyssetvalue{center}{#1}\pgfkeysgetvalue{center}{\planetcenter}},
+ centerx/.estore in = \planetcenterx,
+ centery/.estore in = \planetcentery,
+ scale/.estore in = \planetscale,
default/.style = {
surface = none,
tilt = 0,
phase = full,
rotation = false,
+ equator = false,
+ axis = false,
retrograde = false,
+ rings = false,
+ ring =,
color = cyan,
centerx = 0,
centery = 0,
@@ -69,8 +95,8 @@
}
\newcommand{\addrotation}{%
- % equator arrow
\ifretrograde
+ % equator arrow
\draw [->, very thick] (0, 0) -- (-0.4, 0);
% axis arrow
@@ -84,7 +110,7 @@
\fi
}
-\newcommand{\addphase}[1]{%
+\newcommand{\addsurfacephase}[1]{%
\IfEqCase{#1}{%
{new}{\fill [opacity=0.6, black] (0, 0) circle (1);}
{first half}{\fill [opacity=0.6, black] (90:1) arc (90:270:1) -- cycle;}
@@ -99,13 +125,78 @@
}
}
+\newcommand{\drawringpath}[1]{
+ \path[#1, even odd rule]
+ (0, 0) circle [x radius = 1.3, y radius = .13]
+ (0, 0) circle [x radius = 1.7, y radius = .17]
+ (0, 0) circle [x radius = 1.75, y radius = .175]
+ (0, 0) circle [x radius = 2.1, y radius = .21];
+}
+\newcommand{\addringphase}[1]{%
+ \IfEqCase{#1}{%
+ {new}{
+ \clip (-.85, -.25) -- (.85, -.25) -- (1, 0) -- (-1, 0) -- cycle;
+ \drawringpath{inner color=black, outer color=black, opacity=.6}
+ }
+ {first half}{
+ \clip (-1, -.1) -- (-1, .1) -- (-2.2, 0) -- (-2.2, 0) -- cycle;
+ \drawringpath{inner color=black, outer color=black, opacity=.6}
+ }
+ {last half}{
+ \clip (1, -.1) -- (1, .1) -- (2.2, 0) -- (2.2, 0) -- cycle;
+ \drawringpath{inner color=black, outer color=black, opacity=.6}
+ }
+ {first crescent}{
+ \clip (-1.1, 0) -- (-1.5, -.22) -- (0, -.22) -- (1, 0) -- cycle;
+ \drawringpath{inner color=black, outer color=black, opacity=.6}
+ }
+ {last crescent}{
+ \clip (1.1, 0) -- (1.5, -.22) -- (0, -.22) -- (-1, 0) -- cycle;
+ \drawringpath{inner color=black, outer color=black, opacity=.6}
+ }
+ {waxing gibbous}{
+ \clip (-1.2, 0) -- (-1.5, .22) -- (0, .22) -- (1, 0) -- cycle;
+ \drawringpath{inner color=black, outer color=black, opacity=.6}
+ }
+ {waning gibbous}{
+ \clip (1.2, 0) -- (1.5, .22) -- (0, .22) -- (-1, 0) -- cycle;
+ \drawringpath{inner color=black, outer color=black, opacity=.6}
+ }
+ {top half}{
+ %pass
+ }
+ {bottom half}{
+ \drawringpath{inner color=black, outer color=black, opacity=.6}
+ }
+ {full}{
+ %pass
+ }
+ }
+}
+\newcommand{\addrings}{%
+ \drawringpath{inner color=yellowish!90!black,outer color=yellowish!90!black}
+}
+
+\newcommand{\addthinring}[1]{%
+
+ \def\a{#1}
+ \def\b{\a/7}
+ \def\x{ sqrt( (\a*\a-\b*\b*\a*\a) / (\a*\a-\b*\b) ) }
+ \def\y{ sqrt( 1 - (\a*\a-\b*\b*\a*\a) / (\a*\a-\b*\b) ) }
+
+ \begin{scope}
+ \clip (-{\x}, 0) -- ({\x}, 0) -- ({\x}, 1) --({{\a}}, 1) -- ({\a}, -1) -- (-{\a}, -1) -- (-{\a}, 1) -- (-{\x}, 1) -- (-{\x}, 0) -- cycle;
+ \draw[gray] (0, 0) circle ({\a} and {\b});
+ \end{scope}
+}
+
% Surfaces %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand{\sun}{%
+\newcommand{\sunsurface}{%
\draw [yellow!50, ultra thick, fill=yellow!85!red] (0, 0) circle (1);
}
-\newcommand{\mercury}{%
+\newcommand{\mercurysurface}{%
\draw [gray!70!black, ultra thick, fill=gray] (0, 0) circle (1);
\draw [mercury_crater_edge, fill=mercury_crater] ( 0.5 , 0.56 ) circle ( 0.094 );
@@ -124,10 +215,10 @@
\draw [mercury_crater_edge, fill=mercury_crater] ( 0.61 , -0.14 ) circle ( 0.03 );
\draw [mercury_crater_edge, fill=mercury_crater] ( 0.7 , -0.16 ) circle ( 0.01 );
- \draw [mercury_crater_edge, fill=mercury_crater] ( -0.32 , -0.29 ) circle ( 0.02 );
\draw [mercury_crater_edge, fill=mercury_crater] ( -0.47 , -0.41 ) circle ( 0.08 );
\draw [mercury_crater_edge, fill=mercury_crater] ( -0.2 , -0.87 ) circle ( 0.07 );
\draw [mercury_crater_edge, fill=mercury_crater] ( -0.78 , -0.17 ) circle ( 0.03 );
+ \draw [mercury_crater_edge, fill=mercury_crater] ( -0.32 , -0.29 ) circle ( 0.02 );
\draw [mercury_crater_edge, fill=mercury_crater] ( -0.57 , -0.66 ) circle ( 0.02 );
\draw [mercury_crater_edge, fill=mercury_crater] ( -0.38 , 0.49 ) circle ( 0.1 );
@@ -145,11 +236,11 @@
color(1.7cm)=(venus2!90!black);
color(1.9cm)=(venus1)
}
-\newcommand{\venus}{%
+\newcommand{\venussurface}{%
\draw [color=brown!40, shading=Venus, ultra thick] (0, 0) circle (1);
}
-\newcommand{\earth}{
+\newcommand{\earthsurface}{
% Globe
\draw [fill=cyan] (0,0) circle (1);
@@ -168,11 +259,11 @@
\draw [neptune3, ultra thick] (0,0) circle (1);
}
-\newcommand{\moon}{%
- % Disque
+\newcommand{\moonsurface}{%
+ % Disc
\draw [fill=gray!30] (0, 0) circle (1);
- % Crateres
+ % Craters
\draw [gray!60, ultra thick, fill=gray!55] (-.55, .2) circle (.4);
\draw [gray!65, ultra thick, fill=gray!60] (-.1, .65) circle (.3);
@@ -183,18 +274,18 @@
\draw [gray!55, ultra thick, fill=gray!50] (.2, -.2) circle (.2);
- % Petits crateres
+ % Small craters
\draw [gray, very thick, fill=gray!80] (.1, -.7) circle (.05);
\draw [gray, very thick, fill=gray!80] (.8, -.2) circle (.05);
\draw [gray, very thick, fill=gray!80] (-.3, .7) circle (.05);
\draw [gray, very thick, fill=gray!80] (-.1, .6) circle (.05);
\draw [gray, very thick, fill=gray!80] (-.2, 0) circle (.05);
- % Bord
+ % Edge
\draw [gray!40, ultra thick] (0, 0) circle (1);
}
-\newcommand{\mars}{%
+\newcommand{\marssurface}{%
\draw [fill=red!50!brown] (0, 0) circle (1);
% Poles
@@ -205,6 +296,25 @@
\draw [color=red!60!black, ultra thick] (0, 0) circle (1);
}
+\newcommand{\jupitersurface}{
+ \draw[color=brown!60, fill=brown!20, ultra thick] (0, 0) circle (1);
+
+ %Stripes
+ \clip (0, 0) circle (1);
+ \fill [color=brown!70, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (-1.2, -.25) -- (1.1, -.25) -- (1.1, .25) -- (-1.2, .25) -- cycle;
+
+ \fill [color=brown!70, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (130:1) -- (50:1) -- (50:2) arc (50:130:2) -- cycle;
+ \fill [color=brown!70, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (130:-1) -- (50:-1) -- (50:-2) arc (50:130:-2) -- cycle;
+
+ \fill [color=brown!30, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (-1.2, -.03) -- (1.1, -.03) -- (1.1, .03) -- (-1.2, .03) -- cycle;
+
+ \fill [color=brown!50, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (-1.2, .5) -- (1.1, .5) -- (1.1, .54) -- (-1.2, .54) -- cycle;
+ \fill [color=brown!50, decorate, decoration={snake, segment length=5, amplitude=.2, post length=0}] (-1.2, -.5) -- (1.1, -.5) -- (1.1, -.54) -- (-1.2, -.54) -- cycle;
+
+ % Spot
+ \fill[color=red!50!brown] (-.4, -.3) circle (.18 and .14);
+}
+
\pgfdeclareverticalshading{Jupiter}{2cm}{
color(0cm)=(brownish);
color(0.2cm)=(wheat!55!sienna);
@@ -219,52 +329,36 @@
color(1.7cm)=(white);
color(1.9cm)=(wheat!90!black)
}
-\newcommand{\jupiter}{%
- \draw [color=brown!80!yellow, shading=Jupiter, ultra thick] (0, 0) circle (1);
+\newcommand{\shadedjupitersurface}{%
+ \draw [color=brown!50, shading=Jupiter, ultra thick] (0, 0) circle (1);
% Spot
\draw [brownish!50!orangish, thick, fill=orange!50!red] (-0.4, -0.25) circle (.13 and .1);
}
-\pgfdeclareverticalshading{SaturnBottom}{2cm}{
+\pgfdeclareverticalshading{Saturn}{2cm}{
color(0cm)=(whiteish!55!black);
- color(0.2cm)=(greenish!50);
- color(0.3cm)=(whiteish);
- color(0.5cm)=(greenish);
- color(0.6cm)=(whiteish!50!orangish);
- color(1.2cm)=(greenish);
- color(1.4cm)=(wheat!90!black);
- color(1.7cm)=(wheat);
- color(1.9cm)=(pinkish)
-}
-\pgfdeclareverticalshading{SaturnTop}{2cm}{
- color(0cm)=(pinkish);
- color(.1cm)=(wheat);
- color(.3cm)=(wheat!90!black);
- color(.6cm)=(greenish);
- color(1cm)=(whiteish!50!orangish);
- color(1.4cm)=(yellowish!70!orangish);
- color(1.8cm)=(whiteish!55!sienna)
+ color(0.1cm)=(greenish!50);
+ color(0.15cm)=(whiteish);
+ color(0.25cm)=(greenish);
+ color(0.3cm)=(whiteish!50!orangish);
+ color(0.6cm)=(greenish);
+ color(0.7cm)=(wheat!90!black);
+ color(0.85cm)=(wheat);
+ color(0.95cm)=(pinkish);
+ color(1cm)=(pinkish);
+ color(1.1cm)=(wheat);
+ color(1.2cm)=(wheat!90!black);
+ color(1.3cm)=(greenish);
+ color(1.5cm)=(whiteish!50!orangish);
+ color(1.7cm)=(yellowish!70!orangish);
+ color(1.9cm)=(whiteish!55!sienna)
}
-\newcommand{\saturn}{%
- % Top half
- \fill [color=yellowish, shading=SaturnTop, ultra thick] (0:1) arc (0:180:1) -- cycle;
- \draw [yellowish, ultra thick] (0:1) arc (0:180:1);
-
- % Ring
- \path[inner color=black,outer color=yellowish,even odd rule]
- (0, 0) circle [x radius = 1.5, y radius = .25]
- (0, 0) circle [x radius = 1.7, y radius = .3]
- (0, 0) circle [x radius = 1.75, y radius = .33]
- (0, 0) circle [x radius = 1.95, y radius = .38];
-
- % Bottom half
- \fill [color=yellowish, shading=SaturnBottom, ultra thick] (180:1) arc (180:360:1) -- cycle;
- \draw [yellowish, ultra thick] (180:1) arc (180:360:1);
-
+\newcommand{\saturnsurface}{%
+ \draw [color=yellowish, shading=Saturn, ultra thick, shading angle=\axialtilt] (0, 0) circle (1);
}
-\newcommand{\uranus}{%
+\newcommand{\uranussurface}{%
\draw [color=uranus_gray, fill=uranus_blue, ultra thick] (0, 0) circle (1);
}
@@ -277,50 +371,124 @@
color(1.6cm)=(neptune4);
color(1.9cm)=(neptune5)
}
-\newcommand{\neptune}{%
- \draw [color=blue!40, shading=Neptune, ultra thick] (0, 0) circle (1);
+\newcommand{\neptunesurface}{%
+ \draw [color=blue!40, shading=Neptune, ultra thick, shading angle=\axialtilt] (0, 0) circle (1);
+}
+
+\pgfdeclareverticalshading{Pluto}{2cm}{
+ color(0cm)=(pluto1);
+ color(.4cm)=(pluto2);
+ color(.7cm)=(pluto2);
+ color(1.2cm)=(pluto1);
+ color(1.9cm)=(pluto1)
+}
+\newcommand{\plutosurface}{%
+ \fill [shading=Pluto, shading angle=\axialtilt] (0, 0) circle (1);
+
+ \fill [pluto1, thick, domain=-150:100, samples=50]
+ plot ({ .67*sin(\x) * sin(\x) * sin(\x) + .5 },
+ { .65 * cos(\x) - .2 * cos(2*\x) - .1 * cos(3*\x) - .05 * cos(4*\x) - .4 } );
+
+ \draw [color=pluto2!50, ultra thick] (0,0) circle (1);
+}
+
+\newcommand{\genericsurface}{
+ \draw [color=white!50!\mycolor, fill=\mycolor, ultra thick] (0, 0) circle (1);
}
\newcommand{\addsurface}[1]{%
\IfEqCase{#1}{%
- {earth}{\earth}
- {moon}{\moon}
- {sun}{\sun}
- {mars}{\mars}
- {mercury}{\mercury}
- {venus}{\venus}
- {jupiter}{\jupiter}
- {saturn}{\saturn}
- {uranus}{\uranus}
- {neptune}{\neptune}
- {none}{}
+ {earth}{\earthsurface}
+ {moon}{\moonsurface}
+ {sun}{\sunsurface}
+ {mars}{\marssurface}
+ {mercury}{\mercurysurface}
+ {venus}{\venussurface}
+ {jupiter}{\jupitersurface}
+ {shadedjupiter}{\shadedjupitersurface}
+ {saturn}{\saturnsurface}
+ {uranus}{\uranussurface}
+ {neptune}{\neptunesurface}
+ {pluto}{\plutosurface}
+ {none}{\genericsurface}
}
}
% Main command %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand{\planet}[1][]{%
+\newcommand{\planet}[1][]{\begingroup%
\pgfkeys{/planet, default, #1}
- \begin{scope}[shift = {(\centerx, \centery)}, scale = \scale]
+ \pgfkeysifdefined{center}{%if
+ % pass
+ }{%else
+ \def\planetcenter{(\planetcenterx, \planetcentery)}
+ }
- % Circle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- \draw [color=white!50!\mycolor, ultra thick, fill=\mycolor] (0, 0) circle (1);
+ \IfStrEqCase{\surfacename}{{saturn}{\ringstrue}}
- \begin{scope}[rotate=\tilt]
- \addsurface{\surface}
- \end{scope}
+ \begin{scope}[shift = \planetcenter, scale = \planetscale]
+
+ \ifrings
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \begin{scope}[rotate=\axialtilt]% bottom half
+ \clip (0, 0) circle (1);
+ \addsurface{\surfacename}
+ \end{scope}
+ \begin{scope}
+ \addsurfacephase{\planetphase}
+ \end{scope}
+ \begin{scope}[rotate=\axialtilt]
+ \addrings
+ \addringphase{\planetphase}
+ \end{scope}
+ \begin{scope}[rotate=\axialtilt]% top half
+ \clip (-1, 0) rectangle (1, 1);
+ \clip (0, 0) circle (1);
+ \addsurface{\surfacename}
+ \end{scope}
+ \begin{scope}
+ \clip (\axialtilt : -1.1) -- (\axialtilt : 1.1) -- (1.1, 1.1) -- (-1.1, 1.1) -- cycle;
+ \addsurfacephase{\planetphase}
+ \end{scope}
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ \else
+ \begin{scope}[rotate=\axialtilt]
+ \clip (0, 0) circle (1);
+ \addsurface{\surfacename}
+ \end{scope}
+ \addsurfacephase{\planetphase}
+ \fi
\ifrotation
- \begin{scope}[rotate=\tilt]
+ \begin{scope}[rotate=\axialtilt]
\addaxis
\addequator
\addrotation
\end{scope}
\fi
- \addphase{\phase}
+ \ifequator
+ \begin{scope}[rotate=\axialtilt]
+ \addequator
+ \end{scope}
+ \fi
+
+ \ifaxis
+ \begin{scope}[rotate=\axialtilt]
+ \addaxis
+ \end{scope}
+ \fi
+
+ \IfStrEq{\ringradius}{}{%
+ %pass
+ }{%
+ \begin{scope}[rotate=\axialtilt]
+ \addthinring{\ringradius}
+ \end{scope}
+ }%
\end{scope}
+ \endgroup
}