summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-06-16 03:01:15 +0000
committerNorbert Preining <norbert@preining.info>2021-06-16 03:01:15 +0000
commit2c0c7988beae1efa245bfb9fec0a25d41d88047d (patch)
treeeb29ed898d242ae356a592081c53f11dbd751870 /graphics
parent2faf2507ca4d1d6d153f4c2b4c4c78479d459f06 (diff)
CTAN sync 202106160301
Diffstat (limited to 'graphics')
-rw-r--r--graphics/pgf/contrib/circuitikz/README.md3
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/changelog.tex20
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdfbin17727 -> 17727 bytes
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdfbin1415056 -> 1425888 bytes
-rw-r--r--graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex132
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/circuitikz.sty4
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex2
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex353
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex257
-rw-r--r--graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex4
10 files changed, 644 insertions, 131 deletions
diff --git a/graphics/pgf/contrib/circuitikz/README.md b/graphics/pgf/contrib/circuitikz/README.md
index d92c284d5c..2f7593a7d2 100644
--- a/graphics/pgf/contrib/circuitikz/README.md
+++ b/graphics/pgf/contrib/circuitikz/README.md
@@ -31,7 +31,8 @@ in the preamble and compile away, both with PS and PDF target output.
### Development version
-If you want to use the git version, just append a git to the package name:
+If you want to use the git version, go to the [GitHub page for the project](https://circuitikz.github.io/circuitikz/), download the lasted version (or the one you want to use) — it's the links called "download the latest version in a single file". You will have a file called `circuitikzgit.sty` that you should put somewhere in your LaTeX input path; the best place is in the same directory where your main file live. Then, just use it instead of the normal one:
+
```latex
\usepackage[siunitx, RPvoltages]{circuitikzgit}
```
diff --git a/graphics/pgf/contrib/circuitikz/doc/changelog.tex b/graphics/pgf/contrib/circuitikz/doc/changelog.tex
index 06f7943120..beda5193df 100644
--- a/graphics/pgf/contrib/circuitikz/doc/changelog.tex
+++ b/graphics/pgf/contrib/circuitikz/doc/changelog.tex
@@ -5,6 +5,26 @@ full list of changes.
\begin{itemize}
\item
+ Version 1.3.8 (2021-06-15)
+
+ The big news of this release is the ability to selectively draw the
+ pins of the integrated circuit and mux-demuxes symbols.
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Add \texttt{draw\ only\ pins} feature to \texttt{dipchip} and
+ \texttt{qfpchip}, thanks to
+ \href{https://github.com/circuitikz/circuitikz/pull/550}{Jonathan P.
+ Spratte}, and a similar option to control the pins of
+ \texttt{muxdemux}
+ \item
+ Make \texttt{dipchip} and \texttt{qfpchip} respect
+ \texttt{no\ input\ leads} option
+ \item
+ Several corrections to the manual
+ \end{itemize}
+\item
version 1.3.7 (2021-06-01)
Minor release, mainly documentation upgrades.
diff --git a/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf b/graphics/pgf/contrib/circuitikz/doc/circuitikz-context.pdf
index 97c9b5bad0..2ddae0db93 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 716dc9abab..ab4806c059 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 7b2a70245d..de355dd43c 100644
--- a/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
+++ b/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.tex
@@ -60,7 +60,9 @@
\makeindex[title=Index of the components, intoc=true]
\begin{document}
-
+% change numbering to roman to avoid a duplicate hyperref target on page 1
+% Thanks to Ulrike Fischer for helping here
+\pagenumbering{roman}
\title{\Circuitikz \\{\large version \pgfcircversion{} (\pgfcircversiondate)}}
\author{Massimo A. Redaelli (\email{m.redaelli@gmail.com})\\
Stefan Lindner (\email{stefan.lindner@fau.de})\\
@@ -100,8 +102,9 @@
\maketitle
+% go back to arabic numbering after the titlepage
+\pagenumbering{arabic}
\tableofcontents
-\cleardoublepage
\section{Introduction}
@@ -114,7 +117,7 @@
\end{minipage}
\subsection{About}
-\Circuitikz\ was initiated by Massimo Redaelli in 2007, who was working as a research assistant at the Polytechnic University of Milan, Italy, and needed a tool for creating exercises and exams.
+\Circuitikz{} was initiated by Massimo Redaelli in 2007, who was working as a research assistant at the Polytechnic University of Milan, Italy, and needed a tool for creating exercises and exams.
After he left University in 2010 the development of \Circuitikz\ slowed down, since \LaTeX\ is mainly established in the academic world. In 2015 Stefan Lindner and Stefan Erhardt, both working as research assistants at the University of Erlangen-Nürnberg, Germany, joined the team and now maintain the project together with the initial author. In 2018 Romano Giannetti, full professor of Electronics at Comillas Pontifical University of Madrid, joined the team.
The use of \Circuitikz\ is, of course, not limited to academic teaching. The package gets widely used by engineers for typesetting electronic circuits for articles and publications all over the world.
@@ -162,11 +165,13 @@ instead of \texttt{circuitikz}. This is also advantageous for ``future resilienc
\subsection{Requirements}
\begin{itemize}
- \item \texttt{tikz}, version $\ge 3$;
+ \item \texttt{tikz}, version $\ge >3.1.5b$ (it \emph{should} work with any version 3 and up, but better use a newer one);
\item \texttt{xstring}, not older than 2009/03/13;
\item \texttt{siunitx}, if using \texttt{siunitx} option.
\end{itemize}
+This manual has been typeset with \Circuitikz{} \pgfcircversion (\pgfcircversiondate) on \TikZ{} \pgfversion (\pgfversiondate).
+
\subsection{Incompatible packages}
\TikZ's own \texttt{circuit} library, which was based on \Circuitikz, (re?)defines several styles used by this library. In order to have them work together you can use the \texttt{compatibility} package option, which basically prefixes the names of all \Circuitikz\ \texttt{to[]} styles with an asterisk.
@@ -659,14 +664,14 @@ First of all, let's define a handy function to show the position of nodes:
\def\normalcoord(#1){coordinate(#1)}
\def\showcoord(#1){coordinate(#1) node[circle, red, draw, inner sep=1pt,
pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm,
- pin edge={red, overlay}]45:#1}](#1-node){}}
+ pin edge={red, overlay}]45:#1}](){}}
\let\coord=\normalcoord
\let\coord=\showcoord
\begin{lstlisting}
\def\normalcoord(#1){coordinate(#1)}
\def\showcoord(#1){coordinate(#1) node[circle, red, draw, inner sep=1pt,
pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm,
- pin edge={red, overlay}]45:#1}](#1-node){}}
+ pin edge={red, overlay}]45:#1}](){}}
\let\coord=\normalcoord
\let\coord=\showcoord
\end{lstlisting}
@@ -805,7 +810,7 @@ This is the final circuit, with the nodes still marked:
}}
\def\killdepth#1{{\raisebox{0pt}[\height][0pt]{#1}}}
\def\coord(#1){coordinate(#1)}
-\def\coord(#1){coordinate(#1) node[circle, red, draw, inner sep=1pt,pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm, pin edge={red, overlay,}]45:#1}](#1-node){}}
+\def\coord(#1){coordinate(#1) node[circle, red, draw, inner sep=1pt,pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm, pin edge={red, overlay,}]45:#1}](){}}
\begin{circuitikz}[american, ]
\draw (0,0) node[nmos,](Q1){\killdepth{Q1}};
\draw (Q1.S) to[R, l2^=$R_S$ and \SI{5}{k\ohm}] ++(0,-3) node[vee](VEE){$V_{EE}=\SI{-10}{V}$}; %define VEE level
@@ -1804,8 +1809,12 @@ And finally do:
\section{The components: list}
+This section is dedicated to the full list of available components.
+
\subsection{Grounds and supply voltages}
+Ground symbols and power supplies --- they have two different classes for styling.
+
\subsubsection{Grounds}
For the grounds, the \texttt{center} anchor is put on the connecting point of the symbol, so that you can use them directly in a \texttt{path} specification.
@@ -1864,6 +1873,7 @@ Note that the anchors are at the start of the connecting lines, and that geograp
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
+ % next macro is available in ctikzmanutils.sty
\def\coord(#1){\showcoord(#1)<0:0.3>}
\draw (0,0)
node[vcc](vcc){VCC} \coord(vcc) ++(2,0)
@@ -3087,12 +3097,12 @@ It also has a \texttt{zero} anchor if you need to rotate it about its real cente
\circuitdescbip*{phaseshifter}{phase shifter}{}
\circuitdescbip*{vphaseshifter}{var.\ phase shifter}{}
\circuitdescbip*{detector}{detector}{}
- \circuitdescbip*{sdcdc}{single wire DC/DC converter}{}
+ \circuitdescbip*{sdcdc}{single wire DC/DC converter\footnotemark}{}
+ \footnotetext{the converter blocks added by \texttt{olfline}}
\circuitdescbip*{sacdc}{single phase AC/DC converter}{}
\circuitdescbip*{sdcac}{single phase DC/AC converter}{}
\circuitdescbip*{tacdc}{three phases AC/DC converter}{}
\circuitdescbip*{tdcac}{three phases AC/DC converter}{}(left/170/0.5, right/5/0.5, center/-90/0.3, ac1/45/0.1, ac2/-5/.3, ac3/-45/.1, dc1/135/.3, dc2/185/.3)
- \footnotetext{the converter blocks added by \texttt{olfline}}
\end{groupdesc}
\begin{groupdesc}
@@ -3484,7 +3494,7 @@ You can change the size of the Schottky ``hook'' changing the parameter \texttt{
\end{circuitikz}
\end{LTXexample}
-\paragraph{Ferroelectric transistors} You can add the ferroelectric modifier\footnotetext{suggested by \href{https://github.com/circuitikz/circuitikz/issues/515}{Mayeul Cantan}} to the \texttt{*mos} and \texttt{*fet} transistor types. Similarly to the Schottky bipolar transistors, you activate it by adding the \texttt{ferroel gate} key (there is also a \texttt{no ferroel base} key that can be used if you use the other one as a default).
+\paragraph{Ferroelectric transistors} You can add the ferroelectric modifier\footnote{suggested by \href{https://github.com/circuitikz/circuitikz/issues/515}{Mayeul Cantan}} to the \texttt{*mos} and \texttt{*fet} transistor types. Similarly to the Schottky bipolar transistors, you activate it by adding the \texttt{ferroel gate} key (there is also a \texttt{no ferroel base} key that can be used if you use the other one as a default).
The mark will follow the \texttt{transistors} class thickness, but you can adjust it independently using the class parameter \texttt{modifier thickness} as in passive components --- this value is relative to the class' thickness.
@@ -3986,7 +3996,7 @@ Example triode amplifier:
\begin{circuitikz}
\draw (0,0) node (start) {}
to[sV=$V_i$] ++(0,2+\ctikzvalof{tubes/height})
- to[C=$C_i$] ++(2,0) node (Rg) {}
+ to[C=$C_i$] ++(2,0) coordinate(Rg)
to[R=$R_g$] (Rg |- start)
(Rg) to[short,*-] ++(1,0)
node[triode,anchor=control] (Tri) {} ++(2,0)
@@ -4007,7 +4017,7 @@ Example triode amplifier:
\begin{circuitikz}
\draw (0,0) node (start) {}
to[sV=$V_i$] ++(0,2+\ctikzvalof{tubes/height})
- to[C=$C_i$] ++(2,0) node (Rg) {}
+ to[C=$C_i$] ++(2,0) coordinate(Rg)
to[R=$R_g$] (Rg |- start)
(Rg) to[short,*-] ++(1,0)
node[triode,anchor=control] (Tri) {} ++(2,0)
@@ -4731,7 +4741,9 @@ But notice that the ``A'' is also flipped by the \texttt{xscale} parameter. So t
\subsubsection{Designing your own amplifier}\label{sec:muxdemux-amplis}
If you need a different kind of amplifier, you can use the \texttt{muxdemux}
-(see section~\ref{sec:muxdemuxes}) shape for defining one that suits your needs (you need version \texttt{1.0.0} for this to work).
+(see section~\ref{sec:muxdemuxes}) shape for defining one that suits your needs
+(you need version \texttt{1.0.0} for this to work,
+and \texttt{1.3.8} for the \texttt{draw only...} option).
\begin{LTXexample}[varwidth=true]
\tikzset{tdax/.style={muxdemux,
@@ -4739,8 +4751,8 @@ If you need a different kind of amplifier, you can use the \texttt{muxdemux}
NB=4, NT=5}, font=\scriptsize\ttfamily}}
\begin{circuitikz}
\draw (0,0) node[tdax](A){TDA1};
- \draw (2.5,0) node[tdax,
- muxdemux def={Rh=0.5}]{TDA2};
+ \draw (2.5,0) node[tdax, muxdemux def={Rh=0.5},
+ draw only top pins={1,4-5}]{TDA2};
\end{circuitikz}
\end{LTXexample}
@@ -6050,9 +6062,32 @@ drawing of the leads by using the boolean key
\texttt{logic ports draw input leads} (default \texttt{true}) or, locally,
with the style \texttt{no inputs leads} (that can be reverted with
\texttt{input leads}).
-
The main difference between setting \texttt{external pins width} to \texttt{0} or using \texttt{no inputs lead} is that in the first case the normal pin anchors and the border anchors will coincide, and in the second case they will not move and stay where they should have been if the leads were drawn.
+You can draw only selected pins and leave out the rest by setting the keys
+\texttt{multipoles/draw only \emph{side} pins} and the corresponding style
+\texttt{draw only \emph{side} pins} where \texttt{\emph{side}} can be \texttt{left}, \texttt{right},
+\texttt{top}, \texttt{bottom}.
+Those key accept a comma separated list of
+pin numbers or ranges of pin numbers (a range is given as
+\texttt{$\langle$start$\rangle$ - $\langle$end$\rangle$}, ends are inclusive).
+The numbers will not be expanded in any way, except those given as ends of
+ranges. A special value (and the initial one) is \texttt{all}, in which case all
+pins are drawn. The anchors will be adjusted, such that each \texttt{\emph{x}pin
+\textit{n}} will be placed at the end of the pins which are drawn, and coincide
+with the \texttt{b\emph{x}pin \textit{n}} anchors for the suppressed pins.
+
+\begin{LTXexample}[varwidth=true]
+ \begin{circuitikz}
+ \node [muxdemux, muxdemux def={NL=4, NR=3, NT=5, NB=3, w=2,
+ inset w=0.5, Lh=4, inset Lh=2.0, inset Rh=1.0,
+ square pins=1},
+ draw only right pins={1,3},
+ draw only top pins={1-3},
+ draw only bottom pins={3}](C) at (0,0) {X};
+ \end{circuitikz}
+\end{LTXexample}
+
\subsubsection{Mux-Demux anchors}
Mux-demuxes have a plethora of anchors. As in the case of chips, the geographic anchors mark the rectangle occupied by the component, without taking into account the pin leads.
@@ -6185,22 +6220,20 @@ Finally, you can play with them to create chips that have generic numbers of pin
You can scale chips with the key \texttt{chips/scale}. As ever, that will \textbf{not} scale text size of the labels, when they are printed.
+The line thickness of the main shape is controlled by \texttt{multipoles/thickness} (default 2) and the one of the external pins/pads with \texttt{multipoles/external pins thickness} (default 1).
+
You can customize the DIP chip with the key \texttt{multipoles/dipchip/width} (with a default of \texttt{1.2}) and the key \texttt{multipoles/dipchip/pin spacing} (default \texttt{0.4}) that are expressed in fraction of basic lengths (see section~\ref{sec:components-size}).
The height of the chip will be equal to half the numbers of pins multiplied by the spacing, plus one spacing for the borders.
For the QFP chips, you can only chose the pin spacing with \texttt{multipoles/qfpchip/pin spacing} key.
-The pins of the chip can be ``hidden'' (that is, just a spot in the border, optionally marked with a number) or ``stick out'' with a thin lead by setting \texttt{multipoles/external pins width} greater than 0 (default value is \texttt{0.2}, so you'll have leads as shown above).
-Moreover, you can transform the thin lead into a pad by setting the key \texttt{multipoles/external pad fraction} to something different form 0 (default is \texttt{0}); the value expresses the fraction of the pin spacing space that the pad will use on both sides of the pin.
-
The number of pins is settable with the key \texttt{num pins}.
\textbf{Please notice} that the number of pins \textbf{must} be \emph{even} for \texttt{dipchip}s and \emph{multiple of 4} for \texttt{qfpchip}s, otherwise havoc will ensue.
-You can, if you want, avoid printing the numbers of the pin with \texttt{hide numbers} (default \texttt{show numbers}) if you prefer positioning them yourself (see the next section for the anchors you can use).
-The font used for the pins is adjustable with the key \texttt{multipoles/font} (default \verb|\tiny|)
-For special use you can suppress the orientation mark with the key \texttt{no topmark} (default \texttt{topmark}).
+The pins of the chip can be ``hidden'' (that is, just a spot in the border, optionally marked with a number) or ``stick out'' with a thin lead by setting \texttt{multipoles/external pins width} greater than 0 (default value is \texttt{0.2}, so you'll have leads as shown above).
+Moreover, you can transform the thin lead into a pad by setting the key \texttt{multipoles/external pad fraction} to something different form 0 (default is \texttt{0}); the value expresses the fraction of the pin spacing space that the pad will use on both sides of the pin.
-The line thickness of the main shape is controlled by \texttt{multipoles/thickness} (default 2) and the one of the external pins/pads with \texttt{multipoles/external pins thickness} (default 1).
+You can, if you want, avoid printing the numbers of the pin with \texttt{hide numbers} (default \texttt{show numbers}) if you prefer positioning them yourself (see the next section for the anchors you can use).
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
@@ -6218,16 +6251,23 @@ The line thickness of the main shape is controlled by \texttt{multipoles/thickne
\end{circuitikz}
\end{LTXexample}
+
+Also, you can suppress the drawing of the pins, by using the style \texttt{no inputs leads} (that can be reverted with \texttt{input leads}). The main difference between setting \texttt{external pins width} to \texttt{0} or using \texttt{no inputs lead} is that in the first case the normal pin anchors and the border anchors will coincide, and in the second case they will not move and stay where they should have been if the leads were drawn.
+
+For special use you can suppress the orientation mark with the key \texttt{no topmark} (default \texttt{topmark}).
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
\draw (0,0) node[dipchip,
- num pins=8,
+ num pins=8, no topmark,
external pins width=0.0](C){IC1};
\draw (C.pin 1) -- ++(-0.5,0) to[R]
++(0,-1.5) node[ground]{};
\end{circuitikz}
\end{LTXexample}
+The font used for the pins is adjustable with the key \texttt{multipoles/font} (default \verb|\tiny|)
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
\ctikzset{multipoles/font={\color{red}\tiny}}
@@ -6239,6 +6279,39 @@ The line thickness of the main shape is controlled by \texttt{multipoles/thickne
\end{circuitikz}
\end{LTXexample}
+You can draw only selected pins and leave out the rest by setting
+\texttt{multipoles/draw only pins}\footnote{Added by
+\href{https://github.com/circuitikz/circuitikz/pull/550}{Jonathan P. Spratte in \texttt{v1.3.8}}}.
+This key accepts a comma separated list of
+pin numbers or ranges of pin numbers (a range is given as
+\texttt{$\langle$start$\rangle$ - $\langle$end$\rangle$}, ends are inclusive).
+The numbers will not be expanded in any way, except those given as ends of
+ranges. A special value (and the initial one) is \texttt{all}, in which case all
+pins are drawn. The anchors will be adjusted, such that each \texttt{pin
+\textit{n}} will be placed at the end of the pins which are drawn, and coincide
+with the \texttt{bpin \textit{n}} anchors for the suppressed pins.
+
+
+\begin{LTXexample}[varwidth=true]
+ \begin{circuitikz}
+ \draw (0,3) node[dipchip,
+ num pins=8,
+ draw only pins={1, 3, 5-8}](C){IC1};
+ \draw (C.pin 1) -- ++(-0.5,0) to[R]
+ ++(0,-1.5) node[ground]{};
+ \foreach \x in {1,...,8} {
+ \draw[red] (C.pin \x) circle[radius=2pt];
+ \draw[blue] (C.bpin \x) circle[radius=1pt];
+ }
+ \draw (0, 0) node[qfpchip, draw only pins={1-2, 6, 8, 4},
+ external pad fraction=4, num pins=12](Q){};
+ \foreach \x in {1,...,12} {
+ \draw[red] (Q.pin \x) circle[radius=2pt];
+ \draw[blue] (Q.bpin \x) circle[radius=1pt];
+ }
+ \end{circuitikz}
+\end{LTXexample}
+
\subsubsection{Chips anchors}
Chips have anchors on pins and global anchors for the main shape.
@@ -6556,12 +6629,15 @@ The default orientation of labels is controlled by the options \texttt{smartlabe
\end{LTXexample}
\subsubsection{Stacked (two lines) labels.}
-You also can use stacked (two lines) labels. The example should be self-explanatory: the two lines are specified as \texttt{l2=}\emph{line1}\texttt{ and }\emph{line2}. You can use the keys \texttt{l2 halign} to control horizontal position (\texttt{l}eft, \texttt{c}enter, \texttt{r}ight) and \texttt{l2 valign} to control the vertical one (\texttt{b}ottom, \texttt{c}enter, \texttt{t}op). The default values for alignement are thought for vertical components (where the stacke labels are more natural), in other positions you have to force them.
+
+When using \texttt{circuitikz} in LaTeX, you can use stacked (two lines) labels. The example should be self-explanatory: the two lines are specified as \texttt{l2=}\emph{line1}\texttt{ and }\emph{line2}. You can use the keys \texttt{l2 halign} to control horizontal position (\texttt{l}eft, \texttt{c}enter, \texttt{r}ight) and \texttt{l2 valign} to control the vertical one (\texttt{b}ottom, \texttt{c}enter, \texttt{t}op). The default values for alignement are thought for vertical components (where the stacke labels are more natural), in other positions you have to force them.
Notice that you \textbf{can't use} the compact \texttt{<...>} notation for \texttt{siunitx} with stacked labels. Before \texttt{v1.3.6} the label was ignored, but that has been converted into an error.
Since \texttt{v1.3.6} you have the same possibility with the \texttt{annotation} (just use \texttt{a2=...}, \verb|a2_=...|, \texttt{a2 valign} and so on. Notice that the default position for stacked annotation is \texttt{v2 halign=l}.
+The \texttt{l2} and \texttt{a2} will only work in LaTeX because they use a \texttt{tabular} environment in their implementation. For plain TeX and ConTeXt you have to use \texttt{l} and \texttt{a} and build the stack of labels externally.
+
%
% This is hacky --- better not to publish it for now
%
@@ -8842,7 +8918,8 @@ Here a series of example, contributed by several people, is shown with their cod
\begin{LTXexample}[varwidth=true,pos=t]
\begin{circuitikz}[smallR/.style={european resistor, resistors/scale=0.5}]
- \draw (0,0) node[tacdcshape, anchor=ac2](acdc){} to[smallR] ++(-2,0) -- node[circ](point){} ++(-.5,0);
+ \draw (0,0) node[tacdcshape, anchor=ac2](acdc){} to[smallR] ++(-2,0)
+ -- coordinate(point) node[circ](){} ++(-.5,0);
\draw (acdc.ac1) to[nos, invert, mirror, name=switch,color=red] ++(-2,0) -- (point);
\draw (acdc.ac3) to[smallR] ++(-2,0)
-- (point)
@@ -8850,7 +8927,8 @@ Here a series of example, contributed by several people, is shown with their cod
to[tmultiwire] ++(-.5,0)
node[gridnode, anchor=right]{};
\node[above=.3cm,color=red] at (switch) {fault};
- \draw (acdc.dc1) to[smallR,l=HVDC line] ++(2,0) node[tdcacshape, anchor=dc1](dcac){};
+ \draw (acdc.dc1) to[smallR,l=HVDC line] ++(2,0 )
+ node[tdcacshape, anchor=dc1](dcac){};
\draw (acdc.dc2) -- (dcac.dc2);
\draw (dcac.right) to[ooosource,prim=delta,sec=delta,tert=wye,invert] ++(1.5,0)
to[tmultiwire] ++(.5,0) node[gridnode,anchor=left]{};
diff --git a/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty b/graphics/pgf/contrib/circuitikz/tex/circuitikz.sty
index c87b1251d5..110df9ce82 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.3.7}
-\def\pgfcircversiondate{2021/06/01}
+\def\pgfcircversion{1.3.8}
+\def\pgfcircversiondate{2021/06/15}
\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 9c49d71525..d32e7d2e2e 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirc.defines.tex
@@ -31,7 +31,7 @@
\pgfkeys{\circuitikzbasekey/.is family}
-\def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}}
+\def\circuitikzset{\expandafter\pgfqkeys\expandafter{\circuitikzbasekey}}
\let\ctikzset\circuitikzset
\def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
\def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex
index 23e0d40b7f..9abaf1e8b6 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex
@@ -18,6 +18,16 @@
%
\ctikzset{multipoles/thickness/.initial=2}
\ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
+\ctikzset{multipoles/draw only pins/.initial={all}}
+\ctikzset{multipoles/draw only left pins/.initial={all}}
+\ctikzset{multipoles/draw only right pins/.initial={all}}
+\ctikzset{multipoles/draw only top pins/.initial={all}}
+\ctikzset{multipoles/draw only bottom pins/.initial={all}}
+\pgfqkeys{/tikz}{draw only pins/.add code={}{\ctikzset{multipoles/draw only pins={#1}}}}
+\pgfqkeys{/tikz}{draw only left pins/.add code={}{\ctikzset{multipoles/draw only left pins={#1}}}}
+\pgfqkeys{/tikz}{draw only right pins/.add code={}{\ctikzset{multipoles/draw only right pins={#1}}}}
+\pgfqkeys{/tikz}{draw only top pins/.add code={}{\ctikzset{multipoles/draw only top pins={#1}}}}
+\pgfqkeys{/tikz}{draw only bottom pins/.add code={}{\ctikzset{multipoles/draw only bottom pins={#1}}}}
% DIP (dual in line package) chips
\ctikzset{multipoles/dipchip/width/.initial=1.2}
\ctikzset{multipoles/dipchip/num pins/.initial=8}
@@ -113,9 +123,23 @@
% Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
% a lot of thanks to @marmot for the un-rotation hint
% https://tex.stackexchange.com/a/473571/38080
+% modifications for 'draw only pins' by Jonathan P. Spratte
% DIP (dual in line package) chips
+% helper macro to set the anchors inside a loop (to expand the current count)
+\pgfutil@protected\def\pgf@circ@make@dippin@anchor#1%
+ {%
+ \expandafter\gdef\csname pgf@anchor@dipchip@pin #1\endcsname
+ {%
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
+ {\pgf@circ@dippinanchor{#1}{1}}
+ {\pgf@circ@dippinanchor{#1}{0}}%
+ }%
+ \expandafter\gdef\csname pgf@anchor@dipchip@bpin #1\endcsname
+ {\pgf@circ@dippinanchor{#1}{0}}%
+ }
+
\pgfdeclareshape{dipchip}{
\savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
@@ -123,6 +147,14 @@
\pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
\def\numpins{\the\pgf@circ@count@a}
}
+ \savedmacro\pgf@circ@pins@list
+ {%
+ \pgfkeysgetvalue
+ {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
+ \expandafter\pgf@circ@set@list
+ \expandafter\pgf@circ@pins@list
+ \expandafter{\pgf@circ@temp}%
+ }%
\savedanchor\centerpoint{%
\pgf@x=-.5\wd\pgfnodeparttextbox%
\pgf@y=-.5\ht\pgfnodeparttextbox%
@@ -259,62 +291,85 @@
\repeatpgfmathloop
\fi
\endpgfscope
+ % draw external pins or pads
\ifdim\pgf@circ@res@other>0pt
+ \ifpgfcirc@draw@input@leads
\pgfscope
\pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
\pgf@circ@count@a=\numpins\relax
\divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
+ \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
+ \ifnum\padfrac>0
+ \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
+ \fi
\pgfmathloop%
\ifnum\pgf@circ@count@a>0
- \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
- \ifnum\padfrac>0
- \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
- % left side pads
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- % right side pads
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \else
- % left side pins
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- % right side pins
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \fi
+ % left side
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
+ {%
+ \ifnum\padfrac>0
+ % pads
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \else
+ % pins
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \fi
+ }
+ {}%
+ % right side
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins+1-\pgf@circ@count@a}
+ {%
+ \ifnum\padfrac>0
+ % pads
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \else
+ % pins
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \fi
+ }
+ {}%
\advance\pgf@circ@count@a by -1\relax%
\repeatpgfmathloop
\pgfusepath{stroke}
\endpgfscope
\fi
+ \fi
}%
- % \pgf@sh@s@<name of the shape here> contains all the code for the shape
- % and is executed just before a node is drawn.
\pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
- % Start with the maximum pin number and go backwards.
- \pgf@circ@count@a=\numpins\relax
- \pgfmathloop%
+ \pgf@circ@count@a=\numpins
+ \pgfmathloop
\ifnum\pgf@circ@count@a>0
- % we will create two anchors per pin: the "normal one" like `pin 1` for the
- % electrical contact, and the "border one" like `bpin 1` for labels.
- % they will coincide if `external pins width` is set to 0.
- \expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
- }
- \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
- }
- \advance\pgf@circ@count@a by -1\relax%
- \repeatpgfmathloop%
- }%
+ % we will create two anchors per pin: the "normal one" like `pin 1` for the
+ % electrical contact, and the "border one" like `bpin 1` for labels.
+ % they will coincide if `external pins width` is set to 0.
+ % see the helper function above the start of the shape definition (by Jonathan P. Spratte)
+ \expandafter\pgf@circ@make@dippin@anchor\expandafter{\the\pgf@circ@count@a}%
+ \advance\pgf@circ@count@a by -1\relax
+ \repeatpgfmathloop
+ }%
}
% QFP (quad flat package) chips
+% helper macro to set the anchors inside a loop (to expand the current count)
+\pgfutil@protected\def\pgf@circ@make@qfppin@anchor#1%
+ {%
+ \expandafter\gdef\csname pgf@anchor@qfpchip@pin #1\endcsname
+ {%
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
+ {\pgf@circ@qfppinanchor{#1}{1}}
+ {\pgf@circ@qfppinanchor{#1}{0}}%
+ }%
+ \expandafter\gdef\csname pgf@anchor@qfpchip@bpin #1\endcsname
+ {\pgf@circ@qfppinanchor{#1}{0}}%
+ }
\pgfdeclareshape{qfpchip}{
\savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
@@ -323,6 +378,14 @@
\pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
\def\numpins{\the\pgf@circ@count@a}
}
+ \savedmacro\pgf@circ@pins@list
+ {% some magic here, thanks to Jonathan P. Spratte
+ \pgfkeysgetvalue
+ {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
+ \expandafter\pgf@circ@set@list
+ \expandafter\pgf@circ@pins@list
+ \expandafter{\pgf@circ@temp}%
+ }%
\savedanchor\centerpoint{%
\pgf@x=-.5\wd\pgfnodeparttextbox%
\pgf@y=-.5\ht\pgfnodeparttextbox%
@@ -507,6 +570,7 @@
\fi
\endpgfscope
\ifdim\pgf@circ@res@other>0pt
+ \ifpgfcirc@draw@input@leads
\pgfscope
\pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
\pgf@circ@count@a=\numpins%
@@ -517,44 +581,69 @@
\ifnum\padfrac>0
\pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
% left side pads
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
+ {%
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ }{}%
% bottom side pads
- \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
- \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
+ {%
+ \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
+ }{}%
% right side pads
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
+ {%
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ }{}%
% top side pads
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
- \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
- \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
+ {%
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
+ \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
+ \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
+ }{}%
\else
% left side pins
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
+ {%
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ }{}%
% bottom side pins
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
+ {%
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
+ }{}%
% right side pins
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
+ {%
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
+ }{}%
% top side pins
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
+ \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
+ {%
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
+ }{}%
\fi
\advance\pgf@circ@count@a-1\relax%
\repeatpgfmathloop
\pgfusepath{stroke}
\endpgfscope
\fi
+ \fi
}%
% \pgf@sh@s@<name of the shape here> contains all the code for the shape
% and is executed just before a node is drawn.
@@ -563,14 +652,9 @@
\pgf@circ@count@a=\numpins%
\pgfmathloop%
\ifnum\pgf@circ@count@a>0
- \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}%
- }
- \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}%
- }
+ \expandafter\pgf@circ@make@qfppin@anchor\expandafter{\the\pgf@circ@count@a}%
\advance\pgf@circ@count@a-1\relax%
- \repeatpgfmathloop%
+ \repeatpgfmathloop%
}%
}
@@ -1520,21 +1604,103 @@
\tikzset{ALU/.style={muxdemux,
muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
+
%generic mux-demux shape
+
+% helper macros to set the anchors inside a loop (to expand the current count)
+% left
+\pgfutil@protected\def\pgf@circ@make@muxdemux@L@anchor#1%
+ {%
+ \expandafter\gdef\csname pgf@anchor@muxdemux@lpin #1\endcsname
+ {%
+ \pgf@circ@if@num@in@list\pgf@circ@Lpins@list{#1}
+ {\pgf@circ@muxdemux@L@anchor{#1}{1}}
+ {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
+ }%
+ \expandafter\gdef\csname pgf@anchor@muxdemux@blpin #1\endcsname
+ {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
+ }
+% right
+\pgfutil@protected\def\pgf@circ@make@muxdemux@R@anchor#1%
+ {%
+ \expandafter\gdef\csname pgf@anchor@muxdemux@rpin #1\endcsname
+ {%
+ \pgf@circ@if@num@in@list\pgf@circ@Rpins@list{#1}
+ {\pgf@circ@muxdemux@R@anchor{#1}{1}}
+ {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
+ }%
+ \expandafter\gdef\csname pgf@anchor@muxdemux@brpin #1\endcsname
+ {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
+ }
+% bottom
+\pgfutil@protected\def\pgf@circ@make@muxdemux@B@anchor#1%
+ {%
+ \expandafter\gdef\csname pgf@anchor@muxdemux@bpin #1\endcsname
+ {%
+ \pgf@circ@if@num@in@list\pgf@circ@Bpins@list{#1}
+ {\pgf@circ@muxdemux@B@anchor{#1}{1}}
+ {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
+ }%
+ \expandafter\gdef\csname pgf@anchor@muxdemux@bbpin #1\endcsname
+ {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
+ }
+% top
+\pgfutil@protected\def\pgf@circ@make@muxdemux@T@anchor#1%
+ {%
+ \expandafter\gdef\csname pgf@anchor@muxdemux@tpin #1\endcsname
+ {%
+ \pgf@circ@if@num@in@list\pgf@circ@Tpins@list{#1}
+ {\pgf@circ@muxdemux@T@anchor{#1}{1}}
+ {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
+ }%
+ \expandafter\gdef\csname pgf@anchor@muxdemux@btpin #1\endcsname
+ {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
+ }
+
+
\pgfdeclareshape{muxdemux}{
\savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
\saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
\savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
% pins on the four sides
- % \savedmacro\NL{%
- % \pgf@circ@count@a=\ctikzvalof{multipoles/muxdemux/NL}%
- % \def\NL{\the\pgf@circ@count@a}
- % }
\savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
\savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
\savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
\savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
\savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
+ % pin lists
+ \savedmacro\pgf@circ@Lpins@list
+ {%
+ \pgfkeysgetvalue
+ {\circuitikzbasekey/multipoles/draw only left pins}\pgf@circ@temp
+ \expandafter\pgf@circ@set@list
+ \expandafter\pgf@circ@Lpins@list
+ \expandafter{\pgf@circ@temp}%
+ }%
+ \savedmacro\pgf@circ@Rpins@list
+ {%
+ \pgfkeysgetvalue
+ {\circuitikzbasekey/multipoles/draw only right pins}\pgf@circ@temp
+ \expandafter\pgf@circ@set@list
+ \expandafter\pgf@circ@Rpins@list
+ \expandafter{\pgf@circ@temp}%
+ }%
+ \savedmacro\pgf@circ@Tpins@list
+ {%
+ \pgfkeysgetvalue
+ {\circuitikzbasekey/multipoles/draw only top pins}\pgf@circ@temp
+ \expandafter\pgf@circ@set@list
+ \expandafter\pgf@circ@Tpins@list
+ \expandafter{\pgf@circ@temp}%
+ }%
+ \savedmacro\pgf@circ@Bpins@list
+ {%
+ \pgfkeysgetvalue
+ {\circuitikzbasekey/multipoles/draw only bottom pins}\pgf@circ@temp
+ \expandafter\pgf@circ@set@list
+ \expandafter\pgf@circ@Bpins@list
+ \expandafter{\pgf@circ@temp}%
+ }%
% topleft and topright sizes
\savedanchor{\topleft}{%
\pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
@@ -1681,7 +1847,8 @@
\fi
\pgfmathloop%
\ifnum\pgf@circ@count@a>0
- %%%%%
+ %%%%% check if we want to draw this pin
+ \pgf@circ@if@num@in@list\pgf@circ@Lpins@list\pgf@circ@count@a{%
\ifdim\pgf@circ@res@down>0pt % check if we have an inset
\ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
% for lower pins we have to shift them down
@@ -1716,6 +1883,7 @@
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
\fi
%%%%%
+ }{}% close the pin list check
\advance\pgf@circ@count@a by -1\relax%
\repeatpgfmathloop\fi%
% right pins
@@ -1724,8 +1892,11 @@
\topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
\pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
\ifnum\pgf@circ@count@a>0
+ %%%%% check if we want to draw this pin
+ \pgf@circ@if@num@in@list\pgf@circ@Rpins@list\pgf@circ@count@a{%
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
+ }{}%
\advance\pgf@circ@count@a by -1\relax%
\repeatpgfmathloop\fi%
% bottom pins
@@ -1736,6 +1907,8 @@
\pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
\pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step}
\ifnum\pgf@circ@count@a>0
+ %%%%% check if we want to draw this pin
+ \pgf@circ@if@num@in@list\pgf@circ@Bpins@list\pgf@circ@count@a{%
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step}
{-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
\ifnum\squarepins>0
@@ -1745,6 +1918,7 @@
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step}
{-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
\fi
+ }{}%
\advance\pgf@circ@count@a by -1\relax%
\repeatpgfmathloop\fi%
% top pins
@@ -1755,6 +1929,8 @@
\pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
\pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step}
\ifnum\pgf@circ@count@a>0
+ %%%%% check if we want to draw this pin
+ \pgf@circ@if@num@in@list\pgf@circ@Tpins@list\pgf@circ@count@a{%
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step}
{\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
\ifnum\squarepins>0
@@ -1764,6 +1940,7 @@
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@count@a-0.5)*\pgf@circ@res@step}
{\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
\fi
+ }{}%
\advance\pgf@circ@count@a by -1\relax%
\repeatpgfmathloop\fi%
% end drawing pins; stroke them
@@ -1781,12 +1958,7 @@
% we will create two anchors per pin: the "normal one" like `lpin 1` for the
% external leads, and the "border one" like `blpin 1` for internal ones.
% they will coincide if `external pins width` is set to 0.
- \expandafter\xdef\csname pgf@anchor@muxdemux@lpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{1}%
- }
- \expandafter\xdef\csname pgf@anchor@muxdemux@blpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{0}%
- }
+ \expandafter\pgf@circ@make@muxdemux@L@anchor\expandafter{\the\pgf@circ@count@a}%
\advance\pgf@circ@count@a by -1\relax%
\repeatpgfmathloop%
% right anchors
@@ -1796,12 +1968,7 @@
% we will create two anchors per pin: the "normal one" like `rpin 1` for the
% external leads, and the "border one" like `brpin 1` for internal ones.
% they will coincide if `external pins width` is set to 0.
- \expandafter\xdef\csname pgf@anchor@muxdemux@rpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{1}%
- }
- \expandafter\xdef\csname pgf@anchor@muxdemux@brpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{0}%
- }
+ \expandafter\pgf@circ@make@muxdemux@R@anchor\expandafter{\the\pgf@circ@count@a}%
\advance\pgf@circ@count@a by -1\relax%
\repeatpgfmathloop%
% bottom anchors
@@ -1811,12 +1978,7 @@
% we will create two anchors per pin: the "normal one" like `bpin 1` for the
% external leads, and the "border one" like `bbpin 1` for internal ones.
% they will coincide if `external pins width` is set to 0.
- \expandafter\xdef\csname pgf@anchor@muxdemux@bpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{1}%
- }
- \expandafter\xdef\csname pgf@anchor@muxdemux@bbpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{0}%
- }
+ \expandafter\pgf@circ@make@muxdemux@B@anchor\expandafter{\the\pgf@circ@count@a}%
\advance\pgf@circ@count@a by -1\relax%
\repeatpgfmathloop%
% top anchors
@@ -1826,12 +1988,7 @@
% we will create two anchors per pin: the "normal one" like `tpin 1` for the
% external leads, and the "border one" like `btpin 1` for internal ones.
% they will coincide if `external pins width` is set to 0.
- \expandafter\xdef\csname pgf@anchor@muxdemux@tpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{1}%
- }
- \expandafter\xdef\csname pgf@anchor@muxdemux@btpin\space\the\pgf@circ@count@a\endcsname{%
- \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{0}%
- }
+ \expandafter\pgf@circ@make@muxdemux@T@anchor\expandafter{\the\pgf@circ@count@a}%
\advance\pgf@circ@count@a by -1\relax%
\repeatpgfmathloop%
}%
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex
index ac87e08304..86732077b0 100644
--- a/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex
+++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircutils.tex
@@ -120,4 +120,261 @@
}
\long\def\ctikzsubcircuitactivate#1{\csname #1@setanchors\endcsname}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Basic utility macros
+%%
+%% Functions provided here are:
+%% \pgf@circ@ifempty{<argument>}{<true>}{<false>}
+%% Tests whether <argument> is completely empty.
+%% \pgf@circ@ifblank{<argument>}{<true>}{<false>}
+%% Tests whether <argument> is either empty or only contains spaces.
+%% \pgf@circ@trimspaces@do{<argument>}{<next>}
+%% Trims at most one space from either end of <argument> and forwards the
+%% result to <next> as <next>{<trimmed argument>}
+
+% these two are pretty standard code
+\long\def\pgf@circ@ifempty#1%
+ {%
+ \if\relax\detokenize{#1}\relax
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi
+ }
+\long\def\pgf@circ@ifblank#1%
+ {%
+ \if\relax\detokenize\expandafter{\pgfutil@gobble#1.}\relax
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi
+ }
+
+% \pgfutil@trimspaces needs two expansions. The first expansion we'll do during
+% the definition.
+\def\pgf@circ@trimspaces@do#1%
+ {%
+ \def\pgf@circ@trimspaces@do##1%
+ {\expandafter\pgf@circ@trimspaces@do@\expandafter{#1}}%
+ }
+\expandafter\pgf@circ@trimspaces@do\expandafter{\pgfutil@trimspaces{#1}}
+\def\pgf@circ@trimspaces@do@#1#2{#2{#1}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% list handling
+%%
+%% Contribution by Jonathan P. Spratte (blame him!)
+%%
+%% The list implementation here has a few limitations. Those are:
+%% 1. not long, so no \par in the lists (but many used functions in pgfutil
+%% aren't long as well)
+%% 2. list elements can't contain a Q with category code 3 (but the used
+%% function \pgfutil@trimspaces doesn't support them as well, and this
+%% should be a very rare token anyway)
+%% 3. list elements can't contain the token \pgf@circ@set@list as that is used
+%% as the end marker
+%% 4. currently these lists are meant for numeric data (hence only
+%% \pgf@circ@if@num@in@list is provided as a test), as a result there is
+%% another limitation for the data here. If the list element contains no
+%% hyphen '-', the element will be stored without further processing
+%% 'as-is' (well, after trimming spaces). If there is a hyphen we assume
+%% well-behaved input data and will interpret this as a num-range without
+%% further tests.
+%%
+%% Functions provided here are:
+%% \pgf@circ@set@list<macro>{<csv-list>}
+%% Parses the <csv-list> and stores the result inside <macro> (local
+%% assignment). If a num-range given as <start - stop> (with or without
+%% spaces) is found it will be expanded to <start>,<start+1>,...,<stop>.
+%% \pgf@circ@if@num@in@list<macro>{<value>}{<true>}{<false>}
+%% Checks whether <value> (numeric value, evaluated once with \numexpr) is
+%% found inside the list stored in <macro>. There are two special cases: If
+%% <macro> is undefined <false> is executed. If the list contains only one
+%% element and that is `all' <true> is executed.
+
+% set the catcode of our marker
+\chardef\pgf@circ@temp=\the\catcode`\Q
+\catcode`\Q=3
+
+% lists will have the structure
+% <marker><element 1><marker>...<element n><marker>
+% As marker we use a Q with category 3. Under the assumption that no list
+% element does ever contain that token we can set the elements without braces,
+% allowing us to use \pgfutil@in@ to search for elements (see above). The other
+% token that isn't allowed to show up in the list is \pgf@circ@set@list, that we
+% use as another marker during parsing.
+% The other big restriction in this implementation is that lists can't contain a
+% \par (but \pgfutil@in@ doesn't support that anyway so there is not much
+% sense in supporting it here)
+\pgfutil@protected\def\pgf@circ@set@list#1#2%
+ {%
+ % clear the error flag
+ \let\pgf@circ@error@marker\pgf@circ@undefined
+ % set the list
+ \edef#1%
+ {Q\pgf@circ@set@list@sanitize#2,\pgf@circ@set@list,\pgf@circ@set@list}%
+ % there was an error, throw the error message, recovery was already done by
+ % ignoring the offending elements.
+ \ifx\pgf@circ@error@marker\relax
+ \begingroup
+ \newlinechar`\^^J
+ \pgfutil@packageerror{circuitikz}
+ {%
+ Unallowed marker found in list^^J%
+ \pgfutil@unexpanded{#2}.^^J%
+ Offending elements were ignored.%
+ }
+ {Lists can't contain a Q with category code 3}%
+ \endgroup
+ \fi
+ }
+% just a utility for the <marker> test
+\def\pgf@circ@set@list@gobbletomarker#1Q{}
+% quick way to check whether list parsing is done by gobbling up to a marker, in
+% this case the marker is \pgf@circ@set@list
+\def\pgf@circ@set@list@sanitize@checkend#1\pgf@circ@set@list{}
+% will only be called after the last element is handled, will gobble the
+% remainder of the current sanitizing step
+\def\pgf@circ@set@list@sanitize@end\pgf@circ@set@list#1\pgf@circ@set@list{}
+% grabs the next list element, checks whether we're done, and if not sanitizes
+% it (meaning stripping spaces from either end and placing the <marker>).
+\def\pgf@circ@set@list@sanitize#1,%
+ {%
+ \pgf@circ@set@list@sanitize@checkend
+ #1\pgf@circ@set@list@sanitize@end\pgf@circ@set@list
+ \pgf@circ@set@list@sanitize@a{#1}%
+ }
+% testing whether a list element contains the used <marker> expandably, if it
+% does set the flag, else continue sanitizing.
+\def\pgf@circ@set@list@sanitize@a#1%
+ {%
+ \expandafter\pgf@circ@ifempty\expandafter
+ % if this is empty no marker was found
+ {\pgf@circ@set@list@gobbletomarker#1Q}
+ {%
+ \pgf@circ@ifblank{#1}
+ {}% ignore blank entries
+ {\pgf@circ@trimspaces@do{#1}\pgf@circ@set@list@sanitize@b}%
+ }
+ {%
+ % panic, there was a marker found in a list element. We'll recover by
+ % ignoring the current element after setting a flag. When we do
+ % \csname ...\endcsname on an undefined macro name TeX will let that
+ % macro to relax and we exploit this to expandable set a flag and
+ % gobbling the result.
+ \expandafter\pgfutil@gobble\csname pgf@circ@error@marker\endcsname
+ }%
+ % get the next element
+ \pgf@circ@set@list@sanitize
+ }
+% we'll protect any element from further expanding using \unexpanded and place
+% the marker after the element, and ignore empty/blank elements
+\def\pgf@circ@set@list@sanitize@b#1%
+ {%
+ \expandafter\pgf@circ@ifempty\expandafter
+ % if this is empty no hyphen is found
+ {\pgf@circ@gobbletohyphen#1-}
+ {\pgfutil@unexpanded{#1}Q}
+ {\pgf@circ@set@list@parse@range{#1}}%
+ }
+\def\pgf@circ@gobbletohyphen#1-{}
+\def\pgf@circ@set@list@parse@range#1{\pgf@circ@set@list@parse@range@a#1Q}
+\def\pgf@circ@set@list@parse@range@a#1-#2Q%
+ {%
+ \expandafter\pgf@circ@set@list@parse@range@b
+ \the\numexpr#1\expandafter Q\the\numexpr#2Q%
+ }
+\def\pgf@circ@set@list@parse@range@b#1Q#2Q%
+ {%
+ \ifnum#1<#2
+ % expand to the range from #1 to #2 (inclusive)
+ \pgf@circ@set@list@range{#1}{#2}%
+ \else
+ \ifnum#2<#1
+ % if #2 is smaller than #1 just swap the order
+ \pgf@circ@set@list@range{#2}{#1}%
+ \else
+ % last case, they are equal, so just put the result here
+ #1Q%
+ \fi
+ \fi
+ }
+\def\pgf@circ@set@list@parse@range@norange#1Q#2{\pgfutil@unexpanded{#2}Q}
+\def\pgf@circ@set@list@range#1#2%
+ {%
+ #1Q%
+ \ifnum#1<#2
+ \expandafter\pgfutil@secondoftwo
+ \fi
+ \pgfutil@gobble
+ {\expandafter\pgf@circ@set@list@range\expandafter{\the\numexpr#1+1}{#2}}%
+ }
+
+% flag for special value
+\def\pgf@circ@all@flag{QallQ}
+\pgfutil@protected\def\pgf@circ@if@num@in@list#1#2%
+ {%
+ % test whether the list macro is defined, if it isn't result is false
+ \pgfutil@ifx\pgf@circ@undefined#1%
+ {\pgfutil@secondoftwo}
+ {%
+ % test whether the list macro is just the special value 'all', if so
+ % true, else search (and start that by evaluating a numexpr)
+ \pgfutil@ifx\pgf@circ@all@flag#1%
+ {\pgfutil@firstoftwo}
+ {%
+ \expandafter\pgf@circ@if@num@in@list@a\expandafter
+ {\the\numexpr#2}%
+ #1%
+ }%
+ }%
+ }
+% next step is expanding the list macro
+\pgfutil@protected\def\pgf@circ@if@num@in@list@a#1#2%
+ {\expandafter\pgf@circ@if@num@in@list@b\expandafter{#2}{#1}}
+% now use \pgfutil@in@ to check whether there is the searched list element
+\pgfutil@protected\def\pgf@circ@if@num@in@list@b#1#2%
+ {%
+ \begingroup
+ % put the <marker> around the number to make sure only full matches are
+ % found. \pgfutil@in@ will set \ifpgfutil@in@ to true if it finds a match
+ \pgfutil@in@{Q#2Q}{#1}%
+ \expandafter
+ \endgroup
+ \ifpgfutil@in@
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi
+ }
+
+% reset the catcode of Q
+\catcode`\Q=\pgf@circ@temp
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% temporary fix for old TikZ versions (remove me)
+%%
+%% All blame to Romano Giannetti for this code!
+%%
+%% This tries to be smart and provide \pgfutil@unexpanded and \pgfutil@ifx if
+%% PGF doesn't provide them.
+
+\ifx\pgfutil@unexpanded\pgf@circ@undefined
+ \ifpgfutil@format@is@context
+ \let\pgfutil@unexpanded\normalunexpanded
+ \else
+ \let\pgfutil@unexpanded\unexpanded
+ \fi
+\fi
+
+\ifx\pgfutil@ifx\pgf@circ@undefined
+ \long\def\pgfutil@ifx#1#2{%
+ \ifx#1#2%
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi}
+\fi
+
\endinput
diff --git a/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex b/graphics/pgf/contrib/circuitikz/tex/t-circuitikz.tex
index 671a47c952..75f05cdaf6 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.3.7}
-\def\pgfcircversiondate{2021/06/01}
+\def\pgfcircversion{1.3.8}
+\def\pgfcircversiondate{2021/06/15}
\writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
\usemodule[tikz]