summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/circuitikz
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-04-23 21:10:29 +0000
committerKarl Berry <karl@freefriends.org>2022-04-23 21:10:29 +0000
commit08f4ce2dd6bd62811f5f7ef4486dff2cad9d2489 (patch)
treeac89ea52e52c1d9d594fd283b38b0aa4e2d109dd /Master/texmf-dist/doc/latex/circuitikz
parent94f37765fbf85a717ee0106d1eee3689582eb9d9 (diff)
circuitikz (23apr22)
git-svn-id: svn://tug.org/texlive/trunk@63111 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/circuitikz')
-rw-r--r--Master/texmf-dist/doc/latex/circuitikz/changelog.tex71
-rw-r--r--Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdfbin1485592 -> 1518613 bytes
-rw-r--r--Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex301
-rw-r--r--Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty10
4 files changed, 335 insertions, 47 deletions
diff --git a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex
index a1599a272c5..f4200948a67 100644
--- a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex
+++ b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex
@@ -5,6 +5,67 @@ full list of changes.
\begin{itemize}
\item
+ Version 1.5.0 (2022-04-22)
+
+ In this version, several internal changes have been included in order
+ to streamline and organize better the components and to change the
+ management of color. The changes are pretty deep and subtle, so a bug
+ or unexpected behaviour is always possible. You can use the 1.4.6
+ rollback point in case of trouble, but be sure to report any bug.
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Added connectors shapes, and included the BNC into that class;
+ thanks to
+ \href{https://github.com/circuitikz/circuitikz/issues/611}{Alexander
+ Sauter for suggesting them and helping in the design}
+ \item
+ Added nullator and norator shapes, suggested by
+ \href{https://github.com/circuitikz/circuitikz/issues/615}{user
+ atticus-sullivan on GitHub}
+ \item
+ Added buzzer and reversed buzzer bipoles, suggested by
+ \href{https://tex.stackexchange.com/q/640501/38080}{user Michael.H}
+ \item
+ Added ``dot'' anchors to inductances
+ \item
+ Added ``boxed only'' option for some circular blocks, suggested by
+ \href{https://github.com/circuitikz/circuitikz/issues/621}{user
+ myzinsky}
+ \item
+ Added DIN antenna shape, suggested by
+ \href{https://github.com/circuitikz/circuitikz/issues/620}{user
+ myzinsky}
+ \item
+ Fixed block/input arrow connection, thanks to
+ \href{https://github.com/circuitikz/circuitikz/issues/613}{Laurenz
+ Preindl for reporting}
+ \item
+ Fixed a problem with generic tunable arrows, noticed thanks to
+ \href{https://tex.stackexchange.com/q/637182/38080}{this question on
+ TeX.SX}
+ \end{itemize}
+
+ Internal changes:
+
+ \begin{itemize}
+ \tightlist
+ \item
+ Added a generic drawing function for shapes, which are now drawn
+ always in background
+ \item
+ Added a hook system to be able to change component drawing settings
+ per-shape, per-class or globally
+ \item
+ All the 250+ shapes are now ``protected'' by possible external arrow
+ and arced corners parameters
+ \item
+ Completely changed the management of the shapes' color, thanks to
+ \href{https://github.com/circuitikz/circuitikz/issues/605}{GitHub
+ user muzimuzhi}
+ \end{itemize}
+\item
Version 1.4.6 (2022-02-04)
A nasty bug fix and some hack to avoid that some global Ti\emph{k}Z
@@ -509,7 +570,7 @@ full list of changes.
Rewrite of the path generation macros
\item
Several small bugs fixed (no one ever used some
- ``f\^{}\textgreater{}'' options\ldots{})
+ ``f\^{}\textgreater{}'' options\ldots)
\end{itemize}
\item
Version 1.2.0 (2020-06-21)
@@ -871,7 +932,7 @@ A detailed list of changes can be seen below.
\item
Fixed a (puzzling) problem with coupler2
\item
- Fixed a compatibility problem with newer PGF (\textgreater{}3.0.1a)
+ Fixed a compatibility problem with newer PGF (\textgreater3.0.1a)
\end{itemize}
\item
Version 0.9.2 (2019-06-21)
@@ -1021,7 +1082,7 @@ A detailed list of changes can be seen below.
\item
Fixed direction of controlled american voltage source
\item
- ``v\textless{}='' and ``i\textless{}='' do not rotate the sources
+ ``v\textless='' and ``i\textless='' do not rotate the sources
anymore(see them as ``counting direction indication'', this can be
different then the shape orientation); Use the option ``invert'' to
change the direction of the source/apperance of the shape.
@@ -1057,7 +1118,7 @@ A detailed list of changes can be seen below.
\item
Allow use of voltage label at a {[}short{]}
\item
- Correct line joins between path components (to{[}\ldots{}{]})
+ Correct line joins between path components (to{[}\ldots{]})
\item
New Pole-shape .-. to fill perpendicular joins
\item
@@ -1086,7 +1147,7 @@ A detailed list of changes can be seen below.
\item
Fixed varcap symbol at small scalings
\item
- New packet-option "straightvoltages, to draw straight(no curved)
+ New packet-option ``straightvoltages, to draw straight(no curved)
voltage arrows
\item
New option ``invert'' to revert the node direction at paths
diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf
index 5372b620349..98f4c5b3a20 100644
--- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf
+++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex
index f2996033512..37e8bffc107 100644
--- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex
+++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex
@@ -198,13 +198,13 @@ Correcting this will need a big rewrite of the path routines, and although the a
This same issue create a lot of problem of compatibility between \Circuitikz{} and the new \texttt{pic} Ti\emph{k}Z feature, so basically don't put components into \texttt{pic}s.
-Also, notice that most components will interact in a funny way with global path options, like \texttt{rounded corners} or the arrow options (like \texttt{->} or \texttt{shorten <} and so on). Depending on the specific component, some parameter is inherited by the internal shape, and some other is reset,\footnote{This is not easy to fix. We want some option to go through --- fill color, dashed pattern for example --- and some other to stay only in the outer path; and if the background shape need some option for drawing the internal shape, like for example a rounded corner, it \emph{must} reset the external option. So there is no perfect solution.} so basically it's better not to use them.
+Also, notice that several components will interact in a funny way with global path options. Depending on the specific component, some parameter is inherited by the internal shape, and some other is reset. This is not easy to fix in general. We want some option to go through --- fill color, dashed pattern for example --- and some other to stay only in the outer path; and if the background shape need some option for drawing the internal shape, like for example a rounded corner, it \emph{must} reset the external option. So there is no perfect solution, although since \texttt{v1.5.0} the shapes have been ``robustified'', so that by default arced corners and arrows parameters will \emph{not} be propagated into the shape.
Arrows with \texttt{to[]} components don't work, anyway, so basically avoid this situation.
\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
\begin{circuitikz}[]
\draw (0,3) to[R] ++(3,0) node[npn, anchor=B]{};
- % arrows will not work and give bad results
+ % arrows will not work and give strange results
% so basically do not use them!
\draw[<->] (0,1.5) to[R] ++(3,0) node[npn, anchor=B]{};
\draw[shorten <=10pt] (0,0) to[R] ++(3,0)
@@ -2286,6 +2286,32 @@ Inductors have additional anchors to add core lines (for historical reasons, the
Notice that the core lines will \textbf{not} change the position of labels. You have to move them by hand if needed (or position them on the other side); see~\ref{sec:adjust-label-position}.
+\paragraph{Dot anchors.}
+Inductances have also ``dot'' anchors\footnote{proposed by Romano in a discussion by \href{https://github.com/circuitikz/circuitikz/issues/618}{GitHub user AndreaDiPietro92}},
+to help positioning dots when specifying mutual inductance signs. The anchors are name \texttt{lr dot} (for lower right dot), \texttt{ur dot} (upper right) and so on:
+\begin{quote}
+ \showanchors{cuteinductorshape}{}(lr dot/-45/0.2, ur dot/45/0.2, ll dot/-135/0.2, ul dot/135/0.2)
+ \quad
+ \showanchors{cuteinductorshape}{}(ur dot/-60/0.3, ul dot/-120/0.3, core west/135/0.2, core east/45/0.2)
+\end{quote}
+and as you can see, you have to be careful if you use dot anchors and core anchors together.
+You can change the position of the dots by changing the keys \texttt{bipoles/inductors/dot x distance} (default \texttt{4pt}), which represent how much the dot extends outside the component width, and the corresponding \texttt{dot y distance} (default \texttt{1pt}), which serves the same scope in the height direction.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[]
+ \ctikzset{bipoles/inductors/.cd, dot x distance=3pt,
+ dot y distance=0pt}
+ \draw (0,2) to[L=$L_1$, name=l1] ++(3,0);
+ \draw (0,0) to[L, l_=$L_2$, name=l2, inductors/width=1.4,
+ inductors/coils=11] ++(3,0);
+ \path (l1.ur dot) node[circ]{} (l2.ul dot) node[circ]{};
+ \draw ([yshift=-0.2cm]l1.south)
+ to[out=-45, in=45] node[right]{$M$}
+ ([yshift=0.2cm]l2.north);
+\end{circuitikz}
+\end{LTXexample}
+
+Notice that the position of the dot anchors does not coincide with the position of the dots in the transformers (see section~\ref{sec:transformers}), because there they depend on the size of the complete double-bipole more that on the size of the inductances.
\subsection{Diodes and such}
@@ -2590,6 +2616,42 @@ The transformer shapes vector group options can be specified for the primary (\t
\end{circuitikz}
\end{LTXexample}
+\subsubsection{Nullator and norator}
+
+These are special elements used in some approaches to model ideal amplifiers\footnote{See \href{https://en.m.wikipedia.org/wiki/Nullor}{the Wikipedia article}; suggested by \href{https://github.com/circuitikz/circuitikz/issues/615}{user atticus-sullivan on GitHub}.}.
+
+\begin{groupdesc}
+\circuitdescbip*{nullator}{Nullator element (virtual short circuit; forces V and I to zero)}{}
+\circuitdescbip*{norator}{Norator element (admits any combination of V and I)}{}
+\end{groupdesc}
+
+They are in the \texttt{sources} class, but they are not treated like sources in the labelling sense (they have both \texttt{bipoles/is voltage=false} and \texttt{bipoles/is current=false}, see~\ref{sec:source-vif}).
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz}[american]
+ \draw (0,0) node[ground](GND){}
+ to [I,l=$i_s$,invert]
+ ++(0,2.5) -- ++(1.5,0) coordinate(up)
+ to[nullator, v=0, i=0, name=A]
+ (up|-GND) node[ground]{};
+ \draw (up) to[R, *-*] ++(2,0) coordinate(out)
+ to[norator, v^=$v_o$]
+ (out|-GND) node[ground]{};
+\end{circuitikz}
+\end{LTXexample}
+
+The symbol shapes used here seems to be the most common in publications; if you prefer the shapes from the Wikipedia article, you can use the following definitions:
+
+\begin{LTXexample}[varwidth=true]
+\tikzset{noratorW/.style={voosource,
+ bipoles/oosource/circlesize=0.5,
+ bipoles/oosource/circleoffset=0.5},
+ nullatorW/.style={esource, sources/scale=0.5}}
+\begin{tikzpicture}
+ \draw (0,0) to[nullatorW] ++(2,0) to[noratorW] ++(0, -2);
+\end{tikzpicture}
+\end{LTXexample}
+
\subsubsection{DC sources}
\begin{groupdesc}
\circuitdescbip*{dcvsource}{DC voltage source}{}
@@ -2966,13 +3028,14 @@ If (default behaviour) \texttt{europeangfsurgearrester} option is active (or the
If otherwise \texttt{americangfsurgearrester} option is active (or the style \texttt{[american gas filled surge arrester]} is used), the shorthands the shorthands \texttt{gas filled surge arrester} and \texttt{gf surge arrester} are equivalent to the american version of the component.
\end{framed}
-
-
\begin{groupdesc}
\circuitdescbip*{lamp}{Lamp}{}
\circuitdescbip*{bulb}{Bulb}{}
\circuitdescbip*{loudspeaker}{loudspeaker}{}( north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, left/135/0.2, right/45/0.2, center/-135/0.2)
\circuitdescbip*{mic}{mic}{}( north/90/0.4, north east/45/0.4, east/0/0.4, south east/-45/0.4, south/-90/0.4, south west/-135/0.4, west/180/0.4, north west/135/0.4, left/135/0.2, right/45/0.2, center/-135/0.2)
+ \circuitdescbip*{buzzer}{Buzzer\footnotemark}{}(left/135/0.6, right/45/0.6)
+ \circuitdescbip*{rbuzzer}{Reversed buzzer}{}(left/135/0.6, right/45/0.6)
+ \footnotetext{Buzzers were suggested by \href{https://tex.stackexchange.com/questions/640501/buzzer-symbol-in-circuitikz}{user Michael.H on TeX.SX}}
\end{groupdesc}
You can use microphones and loudspeakers with \texttt{waves} (see section~\ref{sec:RF}) too:
@@ -3129,6 +3192,7 @@ The arrows are the ones set with the keys \texttt{tunable start arrow} and \text
\end{LTXexample}
Notice also the need to force a transparency group if you want a semitransparent arrow.
+
\subsection{Terminal shapes}\label{sec:terminals}
These are the so-called ``bipole nodes'' shapes, or poles (see section~\ref{sec:bipole-nodes}). These nodes are always filled; the ``open'' versions (starting with an \texttt{o}) are by default filled with the color specified by the key \texttt{open nodes fill} (by default \texttt{white}), but you can override locally it with the \texttt{fill} parameter.
@@ -3154,11 +3218,14 @@ Since version 0.9.0, ``bipole nodes'' shapes have all the standard geographical
The size of the poles is controlled by the key \texttt{nodes width} (default \texttt{0.04}, relative to the basic length).
Be sure to see section~\ref{sec:bipole-nodes} for more usage and configurability.
+\subsection{Connectors}\label{sec:connectors}
+
+Connectors have a class by themselves (\texttt{connectors}), so you can use the \texttt{scale}, \texttt{fill} and \texttt{thickness} properties as usual.
\subsubsection{BNC connector/terminal}
\begin{groupdesc}
- \circuitdesc*{bnc}{BNC connector}{}(left/135/0.6, right/45/0.6, center/-90/0.6, hot/0/0.6, zero/-135/0.6)
+ \circuitdesc*{bnc}{BNC connector}{}(left/135/0.6, right/45/0.6, center/-45/0.6, hot/0/0.6, zero/-135/0.6, shield/-90/0.4)
\end{groupdesc}
The BNC connector is defined so that you can easily connect it as input or output (but remember that you need to flip the text if you flip the component):
@@ -3183,14 +3250,88 @@ It also has a \texttt{zero} anchor if you need to rotate it about its real cente
\end{circuitikz}
\end{LTXexample}
+\subsubsection{IEC 60617 socket-plug connectors}
+
+Plug and socket connectors (modeled on the IEC60617 standard) are available\footnote{Since \texttt{v1.5.0}; thanks to Alexander Sauter for suggesting them and \href{https://github.com/circuitikz/circuitikz/issues/611}{helping in the design}.} both in path-style form and, with separated but matching shapes for plug and socket, in node-style. There are two differently oriented shapes for each type to ease the construction of ``split'' connections (see the examples below). \textbf{Notice} that the elements in the following table are scaled by a factor 1.5, to better show the position of the anchors.
+
+\begin{groupdesc}
+ \ctikzset{connectors/scale=1.5}
+ \circuitdescbip[iecconn]{iec connector}{IEC 60617 connector}{iecconn}(left/145/0.3, right/45/0.3, center/-90/0.4, plug center/90/0.4, socket center/-135/0.3)
+ \circuitdesc{iecconnshape}{IEC 60617 connector}{\tiny text}(left/145/0.3, right/45/0.3, center/-90/0.2)
+ \circuitdesc{iecsocketL}{IEC 60617 female socket, left side}{\tiny text}(left/145/0.3, right/45/0.3, center/-90/0.2, socket center/0/0.2)
+ \circuitdesc{iecplugR}{IEC 60617 male plug, right side}{\tiny text}(left/145/0.3, right/45/0.3, center/-90/0.2, plug center/90/0.4)
+ \circuitdesc{iecplugL}{IEC 60617 male plug, left side}{\tiny text}(left/145/0.3, right/45/0.3, center/-90/0.2, plug center/90/0.4)
+ \circuitdesc{iecsocketR}{IEC 60617 female socket, right side}{\tiny text}(left/145/0.3, right/45/0.3, center/-90/0.4, socket center/-135/0.3)
+\end{groupdesc}
+
+The \texttt{center} anchors (as well as the text position) of the split elements of the connectors are on the side of the component (similar to what happens with grounds and supply voltage arrows) to ease the most common use.
+
+Also, the text for the plug nodes is raised to the same level of the text in the sockets, and it will ignore descendants, so that the two text lines up when the two components are put side by side.
+
+The \texttt{plug center} anchor always point to the center of the rectangular plug shape, and the \texttt{socket center} to the center of the semicircle in the sockets.
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,1) node[bnc]{} to[R] ++(2,0)
+ to[iec connector] ++(1,0);
+ \draw (0,0) node[bnc]{} to[R] ++(2,0)
+ to[iec connector, invert] ++(1,0);
+\end{circuitikz}
+\end{LTXexample}
+
+Aligning ``disconnected'' plugs and sockets is reasonably easy:
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,2) to[iec connector, name=C1] ++(2,0) coordinate(stop)
+ (C1.nw) node[above left, inner xsep=0pt]{s1}
+ (C1.ne) node[above right, inner xsep=0pt]{p1};
+ \draw (0,1) coordinate(tmp) -- (tmp-|C1.left)
+ node[iecsocketL](S2){s2};
+ \draw (0,0) coordinate(tmp) (tmp-|C1.socket center)
+ node[iecplugR](P3){p3} (P3.right) -- (tmp-|stop);
+ \draw[red, dashed] ([yshift=1cm]C1.socket center) -- ++(0,-4);
+\end{circuitikz}
+\end{LTXexample}
+
+You can choose the best shape when rotating them, to simplify the positioning (shape rotates around the \texttt{center} anchor).
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}
+ \draw (0,0) -| ++(1,-1) node[iecsocketL, rotate=-90]{}
+ (2,-1) -| ++(1,1) node[iecplugR, rotate=90]{};
+\end{circuitikz}
+\end{LTXexample}
+
+Choosing the proper left/right shape results in easily build ``mixed'' connectors; you can use the node text position properties to have lined-up labels, but remember that the text is outside the bounding box:
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[]
+ \path (0,2); % for the bounding box, text is not accounted for
+ \draw (0,1) -- ++(1,0) node[iecsocketL](s1){S1};
+ \draw [red] (s1.e) node[iecplugR](p1){P1} (p1.e) -- ++(1,0);
+ \draw (0,0) -- ++(1,0) node[iecplugL](p2){P2};
+ \draw[blue] (p2.e) node[iecsocketR](s2){S2} (s2.e) -- ++(1,0);
+\end{circuitikz}
+\end{LTXexample}
+
+You can use the \texttt{plug center} anchor to add the IEC ``multiplier'':
+
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{circuitikz}[]
+ \draw (0,0) to[iec connector, connectors/scale=2, name=A,
+ a={\small\ttfamily output bus}] ++(3,0);
+ \draw (A.plug center) ++(-.2,-.4) -- ++(.4,.8) node[above]{8};
+\end{circuitikz}
+\end{LTXexample}
\subsection{Block diagram components}
\noindent Contributed by Stefan Erhardt.
\begin{groupdesc}
- \circuitdesc*{mixer}{mixer}{}( w/180/0.1,s/-90/0.1,e/0/0.1,n/90/0.1 )
+ \circuitdesc*{mixer}{mixer}{}( w/180/0.1,s/-90/0.1,e/0/0.1,n/90/0.1, center/-120/0.3, geocenter/-60/.3 )
\circuitdesc*{adder}{adder}{}( west/180/0.1,south/-90/0.1,east/0/0.1,north/90/0.1 )
- \circuitdesc*{oscillator}{oscillator}{}( w/180/0.1,s/-90/0.1,e/0/0.1,n/90/0.1 )
+ \circuitdesc*{oscillator}{oscillator}{}( w/180/0.1,s/-90/0.1,e/0/0.1,n/90/0.1, center/45/0.2, geocenter/-45/.3 )
\circuitdesc*{circulator}{circulator}{}( left/180/0.1,down/-90/0.1,right/0/0.1, up/90/0.1 )
\circuitdesc*{wilkinson}{wilkinson divider}{}( in/180/0.1, out2/45/0.1, out1/-45/0.1 )
\circuitdesc*{splitter}{resistive splitter\footnotemark}{}( in/180/0.1, out2/45/0.1, out1/-45/0.1 )
@@ -3253,7 +3394,16 @@ The ports of the \texttt{mixer}, \texttt{adder}, \texttt{oscillator} and \texttt
;\end{circuitikz}
\end{LTXexample}
-Moreover, the have proper border anchors since version \texttt{1.2.3}, so you can do things like this:
+The \texttt{oscillator} has a displaced \texttt{center} anchor, to simplify the task of putting it at the left side of a circuit; it also as a special position for the node text. The four round elements (mixer, circulator, adder, and the oscillator) have a \texttt{geocenter} anchor which corresponds always to the center of the circle.
+\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily]
+\begin{tikzpicture}[>=Stealth]
+ \draw (0,0)node[oscillator](O){$f_0$} -- ++(1,0);
+ \draw[blue, ->] (1,1) -- (O.center);
+ \draw[red, ->] (1,1) -- (O.geocenter);
+\end{tikzpicture}
+\end{LTXexample}
+
+Moreover, the have proper border anchors since version \texttt{1.2.3} (and fixed for boxed elements in \texttt{1.5.0}), so you can do things like this:
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
@@ -3394,15 +3544,16 @@ Some two-ports have the option to place a normal label (\texttt{l=}) and a inner
\end{circuitikz}
\end{LTXexample}
+
\paragraph{Box option}
-Some devices have the possibility to add a box around them. The inner symbol scales down to fit inside the box.
+Several devices have the possibility to add a box around them with the \texttt{box} or \texttt{boxed} option. The inner symbol scales down to fit inside the box. For the ``circled'' devices (mixer, adder, oscillator and circulator) the inner circle is normally drawn, unless you use the \texttt{box only} or \texttt{boxed only} option.\footnote{Since 1.5.0, suggested by \href{https://github.com/circuitikz/circuitikz/issues/621}{GitHUb user myzinsky}}
\begin{LTXexample}[varwidth=true]
\begin{circuitikz} \draw
- (0,0) node[mixer,box,anchor=east] (m) {}
- to[amp,box,>,-o] ++(2.5,0)
- (m.west) node[inputarrow] {} to[short,-o] ++(-0.8,0)
- (m.south) node[inputarrow,rotate=90] {} --
- ++(0,-0.7) node[oscillator,box,anchor=north] {};
+ (0,0) node[mixer, box only, anchor=east](m){}
+ to[amp, boxed, >, -o] ++(2.5,0)
+ (m.west) node[inputarrow]{} to[short,-o] ++(-0.8,0)
+ (m.south) node[inputarrow,rotate=90]{} --
+ ++(0,-0.7) node[oscillator, box, anchor=north]{};
\end{circuitikz}
\end{LTXexample}
@@ -4244,6 +4395,8 @@ Notes that in the transmission and receiving antennas, the ``waves'' are outside
\begin{groupdesc}
\circuitdesc*{bareantenna}{Bare Antenna}{A}( top/90/0.1, bottom/180/0.3, left/180/0.3, right/45/0.3, center/0/0.3 )
+ \circuitdesc*{dinantenna}{DIN antenna\footnotemark}{A}(left/135/0.6, right/45/0.6, center/-45/0.6)
+ \footnotetext{Since 1.5.0, suggested by \href{https://github.com/circuitikz/circuitikz/issues/621}{GitHUb user myzinsky}}
\circuitdesc*{bareTXantenna}{Bare TX Antenna}{Tx}( top/90/0.1, center/180/0.3, waves/90/0.3 )
\circuitdesc*{bareRXantenna}{Bare RX Antenna}{Rx}( top/90/0.1, center/0/0.3, waves/90/0.3 )
\circuitdesc{waves}{Waves}{}( north/90/0.4, north east/45/0.4, east/-45/0.4, south east/-45/0.4,
@@ -4341,7 +4494,7 @@ The symbols can also be used along a path, using the transistor-path-syntax(\tex
-\subsection{Double bipoles (transformers)}
+\subsection{Double bipoles (transformers)}\label{sec:transformers}
Transformers automatically use the inductor shape currently selected. These are the three possibilities:
\begin{groupdesc}
@@ -8240,10 +8393,45 @@ To correct the line ending, there are support shapes to fill the missing rectang
\section{Colors}
-Color support in \Circuitikz{} is quite limited. You will have no problem if:
+
+Color support in \Circuitikz{} has been quite limited since version 1.5.0; form that one onward there has been an effort to make component's behavior more intuitive.
+
+Part of the problem is how colors in paths are treated by \TikZ{} itself; you can see part of the discussion \href{https://github.com/circuitikz/circuitikz/issues/605}{this issue} and in \href{https://tex.stackexchange.com/questions/634987/pgf-basic-layer-struggling-again-with-colors}{this question on TeX.SX} --- many thanks to \texttt{@muzimuzhi} for helping there. Basically, nodes are drawn \emph{after} the path is completed, and color is applied to the path at the end. Look at this code (pure \TikZ, no \Circuitikz{} here):
+
+\begin{LTXexample}[varwidth=true]
+\tikz \draw[thick] (0,0) -- (1,0) {[color=red] -- (2,0) node[draw]{}} --(3,0);
+
+\tikz \draw[thick] (0,0) -- (1,0) [color=red] -- (2,0) node[draw]{} --(3,0);
+\end{LTXexample}
+
+So the path is drawn with the last ``effective'' (in current group) color. The deferred behavior of the color properties is very difficult to track for \Circuitikz, especially when the shorthand \texttt{color-name} (e.g., \texttt{red} instead of \texttt{color=red}) is used. \Circuitikz{} will try to patch the default commands to keep track of the ``current color''; if it fails will give a warning like \texttt{patch failed, use only explicit color=...}.
+
+Before 1.5.0, \Circuitikz{} used black as the default color. Now it tries to follow the current color, as \TikZ does normally; but notice that there is a difference with the fill strategy:
+
+\begin{LTXexample}[pos=t]
+\color{red}
+Red text
+\tikz \draw (0,0) -- node[draw] {x} (1,0) -- node[draw=cyan] {y} (2,0);
+\tikz \draw (0,0) to[R] (2,0) to[R,color=cyan] (4,0) to [generic] (6,0) to [fullgeneric] (8,0);
+
+\color{blue}
+Blue text
+\tikz \draw (0,0) -- node[draw] {x} (1,0) -- node[draw=cyan] {y} (2,0);
+\tikz \draw (0,0) to[R] (2,0) to[R,color=cyan] (4,0) to [generic] (6,0) to [fullgeneric] (8,0);
+
+\color{black}
+Black text
+\tikz \draw[fill=yellow] (0,0) -- node[draw, fill] {x} (1,0) -- node[draw=cyan] {y} (2,0);
+\tikz \draw[fill=yellow] (0,0) to[R] (2,0) to[R,color=cyan] (4,0) to [generic] (6,0) to [fullgeneric] (8,0);
+\end{LTXexample}
+
+\Circuitikz{} components that are fillable will inherit the \texttt{fill} property of the path (it is almost impossible to do otherwise) as if the \texttt{fill} flag was present. ``Full''-type elements (for example, full diodes or similar) are filled with the draw color; elements with intrinsic labels (i.e., labels that are part of the shape, like signs on amplifiers and pin numbers in chip) are drawn with the ``draw'' colors.
+
+Basically, you should have no problem if:
\begin{enumerate}
- \item You stick to use styles (see~\ref{sec:styling-fillcolor}) for filling your components, or using a direct \texttt{fill=...} option directly;
- \item when coloring whole circuits, use the option \texttt{color=...} in your global picture options or in the \verb|\draw| command (not just the color name as a shorthand);
+ \item You stick to use styles (see~\ref{sec:styling-fillcolor}) for filling your components, or using a direct \texttt{fill=...} option in the component node or \texttt{to} option;
+ \item do not try to change the color mid-path; sometimes it works (see the examples below), but it's better to avoid it (using different paths is better);
+ \item when coloring whole circuits, it's better to use the option \texttt{color=...} in your global picture options or in the \verb|\draw| command (not just the color name as a shorthand);
\item forget about transparency.
\end{enumerate}
@@ -8251,9 +8439,8 @@ Nevertheless, if you really need to do strange things with colors you can read o
\subsection{Shape colors}
-The color of the components is stored in the key \verb!\circuitikzbasekey/color!. Circui\TikZ\ tries to follow the color set in \TikZ, although sometimes it fails. If you change color in the picture, please do not use just the color name as a style, like \verb![red]!, but rather assign the style \verb![color=red]!.
+The color of the components is stored in the key \verb!\circuitikzbasekey/color!. Circui\TikZ\ tries to follow the color set in \TikZ, although sometimes it fails. The following circuit will fail to draw the circuit in red if the patching of the inner commands of \TikZ{} fails, like for example in \ConTeXt{}.
-Compare for instance
\begin{LTXexample}[varwidth=true]
\begin{circuitikz} \draw[red]
(0,2) node[and port](myand1){1}
@@ -8264,7 +8451,7 @@ Compare for instance
;\end{circuitikz}
\end{LTXexample}
-and
+If you see this problem, please do not use just the color name as a style, like \verb![red]!, but rather assign the style \verb![color=red]!.
\begin{LTXexample}[varwidth=true]
\begin{circuitikz} \draw[color=red]
@@ -8276,7 +8463,7 @@ and
;\end{circuitikz}
\end{LTXexample}
-One can of course change the color \emph{in medias res}:
+One can of course change the color directly in the component:
\begin{LTXexample}[pos=t, varwidth=true]
\begin{circuitikz} \draw
(0,0) node[pnp, color=blue](pnp2){q1}
@@ -8288,7 +8475,8 @@ One can of course change the color \emph{in medias res}:
;\end{circuitikz}
\end{LTXexample}
-The all-in-one stream of bipoles poses some challanges, as only the actual body of the bipole, and not the connecting lines, will be rendered in the specified color.
+The all-in-one stream of bipoles poses some challenges, as only the actual body of the bipole, and not the connecting lines, will be rendered in the specified color (Notice that the following example uses the special \texttt{siunitx} shorthand; you can use it only in simple cases like here, in general using the full \verb|\SI{}| or \verb|\qty{}| commands).
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz} \draw
(0,0) to[V=1<\volt>] (0,2)
@@ -8297,16 +8485,28 @@ The all-in-one stream of bipoles poses some challanges, as only the actual body
;\end{circuitikz}
\end{LTXexample}
-Which, for some bipoles, can be frustrating:
+The postponed application of colors creates problem if you want to use arrows for voltages, because the ``arrows'' are partially part of the path, partially nodes:
+
+\begin{LTXexample}[varwidth=true]
+\begin{circuitikz} \draw
+ (0,0){[red] to[V=1<\volt>] (0,2) }
+ to[R=1<\ohm>] (2,2)
+ to[C=1<\farad>] (2,0) -- (0,0)
+;\end{circuitikz}
+\end{LTXexample}
+
+...and that can become quite frustrating:
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz} \draw
- (0,0){to[V=1<\volt>, color=red] (0,2) }
+ (0,0) to[V=1<\volt>, color=red] (0,2)
to[R=1<\ohm>] (2,2)
to[C=1<\farad>] (2,0) -- (0,0)
;\end{circuitikz}
\end{LTXexample}
-The only way out is to specify different paths:
+In those cases, the only way out is to specify different paths (and/or using advanced voltages, see~\ref{sec:vif-anchors})
+
\begin{LTXexample}[varwidth=true]
\begin{circuitikz} \draw[color=red]
(0,0) to[V=1<\volt>, color=red] (0,2);
@@ -8315,8 +8515,6 @@ The only way out is to specify different paths:
;\end{circuitikz}
\end{LTXexample}
-And yes: this is a bug and \emph{not} a feature\ldots
-
\subsection{Fill colors}
Since version 0.9.0, you can also fill most shapes with a color (the manual specifies which ones are fillable or not). The syntax is quite intuitive:
@@ -8332,7 +8530,7 @@ Since version 0.9.0, you can also fill most shapes with a color (the manual spec
\end{LTXexample}
-This fill color will override any color defined by the style (see section~\ref{sec:styling-fillcolor}). If you want to override a style fill color with no-fill for a specific component, you need to override the style --- it's a bit unfortunate but it should be an exceptional thing anyway:
+This fill color will override any color defined by the style (see section~\ref{sec:styling-fillcolor}). If you want to override a style fill color with no-fill for a specific component, you need to override the style --- it's a bit unfortunate, but should be an exceptional thing anyway. Notice that in simple case \texttt{fill opacity} works, but don't count too much on it.
\begin{LTXexample}[varwidth=true]
\begin{circuitikz}
@@ -8341,13 +8539,14 @@ This fill color will override any color defined by the style (see section~\ref{s
\draw[red] (1.5,3) -- (1.5, -1);
\draw
(0,2) node[and port](myand1){1}
- (0,0) node[and port, fill=cyan](myand2){2}
+ (0,0) node[and port, fill=cyan, fill opacity=0.7](myand2){2}
(2,1) node[xnor port, circuitikz/logic ports/fill=none
](myxnor){3}
(myand1.out) -| (myxnor.in 1)
(myand2.out) -| (myxnor.in 2)
;\end{circuitikz}
\end{LTXexample}
+
You can combine shape colors with fill colors, too, but you should use the \texttt{draw} color option style for this:
\begin{LTXexample}[varwidth=true]
@@ -8360,14 +8559,11 @@ You can combine shape colors with fill colors, too, but you should use the \text
;\end{circuitikz}
\end{LTXexample}
-This is because, as you can see from the following example in port \texttt{2}, you can't specify both a fill and a color in the node (yes, it's a bug too, but it's quite complex to solve given the current circuit\TikZ{} architecture).
-A workaround is shown in port \texttt{3}:
-
\begin{LTXexample}[varwidth=true]
\begin{circuitikz} \draw
(0,2) node[and port, color=black](myand1){1}
(0,0) node[and port, color=blue, fill=cyan](myand2){2}
- (2,1) {[color=blue] node[xnor port, fill=cyan](myxnor){3}}
+ (2,1) node[xnor port, color=red, fill=cyan](myxnor){3}
(myand1.out) -| (myxnor.in 1)
(myand2.out) -| (myxnor.in 2)
;\end{circuitikz}
@@ -8375,7 +8571,7 @@ A workaround is shown in port \texttt{3}:
\subsubsection{Background colors different from white}
-Notice also that the connection point are always filled, although the color \emph{tries} to follow the color of the filling of the component (but look at section~\ref{sec:transparent-poles}). Moreover, if you want to pass fill transparency down to path-style components, you \emph{have} to put it into the options of the \verb|\draw| command.
+Notice also that the connection point are always filled, and the color \emph{tries} to follow the color of the filling of the component (but look at section~\ref{sec:transparent-poles}). Moreover, if you want to pass fill transparency down to path-style components, you \emph{have} to put it into the options of the \verb|\draw| command.
\begin{LTXexample}[varwidth=true, pos=t]
\begin{circuitikz}
@@ -8886,11 +9082,37 @@ at the start of anchors and macros definition, and use (for example, the exact c
\end{lstlisting}
in all the \texttt{savedanchors}.
-Then, in the drawing part, you should start with:
+Then, to draw your component, you should start with\footnote{Since \texttt{v1.5.0}; component defined with this mechanism will not be compatible with older \Circuitikz{}.}:
\begin{lstlisting}
- \pgf@circ@scaled@Rlen=\scaledRlen
+ \pgf@circ@draw@component{%
+ \pgf@circ@scaled@Rlen=\scaledRlen
+ ...
+ }
\end{lstlisting}
-and then use \verb|\pgf@circ@scaled@Rlen| (or the anchors) as default lengths while you draw it.
+and then use \verb|\pgf@circ@scaled@Rlen| (or the anchors) as the default length while you draw it.
+
+The special command \verb|\pgf@circ@draw@component| will issue a \texttt{\textbackslash behindforegroundpath} command, and take care of calling the start and end hooks for the component. Notice that, given the use of \texttt{\textbackslash behindforegroundpath}, you must take care to use the path you define here! The path itself is protected bu a \texttt{pgfscope} (and so also by a \TeX{} group), so local definitions will be reset after exiting.
+
+\subsubsection{The internal hook system}\label{sec:drawing-hooks}
+
+Since version \texttt{v1.5.0}, before starting the drawing of any component, \Circuitikz{} will check for the existence of three different hooks, in the following order (suppose that the shape name is \texttt{\emph{myname}}, and it has a class \texttt{\emph{myclass}}:
+\begin{itemize}
+ \item \texttt{\textbackslash ctikz@hook@start@draw@component@\emph{myname}}
+ \item \texttt{\textbackslash ctikz@hook@start@draw@class@\emph{myclass}}
+ \item \texttt{\textbackslash ctikz@hook@start@draw@default}
+\end{itemize}
+The first one that is defined in the current (or outer) scope is used, and the following ones are not used. This hooks can be used to set drawing parameters, or to reset them to a known state: \TikZ{} normally inherit most of the drawing option, but that can lead to surprises (like unexpected arrows, etc.).
+
+In the same way, before leaving \verb|\pgf@circ@draw@component|, a set of similar hooks (with \texttt{end} instead of \texttt{start}) is tried, with the same logic.
+
+The only predefined hook is \texttt{\textbackslash ctikz@hook@start@draw@default}, which is set to the equivalent of:
+\begin{lstlisting}
+ \pgfsetshortenstart{+0pt}\pgfsetshortenend{+0pt}\pgfsetarrows{-}%
+ \def\pgf@circ@reset@rounded{\pgfsetcornersarced{\pgfpointorigin}}%
+\end{lstlisting}
+which mean that, by default, arrows parameters are reset to the default (no shorten, no arrows) and that corners are not rounded. If you want to override them, just define the appropriate hook for you component/class and the generic one will not be called.
+
+No \texttt{...@end@draw@...} hook is defined by default.
\subsubsection{Finishing your work}
@@ -9147,8 +9369,7 @@ Here a series of example, contributed by several people, is shown with their cod
\subsection{An example with the \texttt{compatibility} option}
\label{ex:compatibility}
-\IfFileExists{compatibility.pdf}
-{\fbox{\includegraphics{compatibility.pdf}}}
+\IfFileExists{compatibility.pdf}{\fbox{\includegraphics{compatibility.pdf}}}{}%
\begin{lstlisting}
\documentclass{standalone}
diff --git a/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty b/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty
index 25a5b5f9e82..8ed0088ca20 100644
--- a/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty
+++ b/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty
@@ -133,7 +133,10 @@
\IfBooleanTF{#1}{%
\draw (0,0) node[#3,scale=#2, fill=fillcol](N){#5};
}{
- \draw (0,0) node[#3,scale=#2](N){#5};
+ % if it's non-fillable, red should not go through
+ \draw (0,0) node[#3,scale=#2,
+ % fill=red
+ ](N){#5};
}
\IfValueT{#6}{%
\foreach \n/\a/\d in {#6} \path(N.\n) \showcoord(\n)<\a:\d>;
@@ -164,7 +167,10 @@
\IfBooleanTF{#1}{%
\draw (0,0) to[#3, name=B, fill=fillcol] (2,0);
}{
- \draw (0,0) to[#3, name=B] (2,0);
+ % if it's non-fillable, red should not go through
+ \draw (0,0) to[#3, name=B,
+ %fill=red
+ ] (2,0);
}
\IfValueT{#7}{%
\foreach \n/\a/\d in {#7} \path(B.\n) \showcoord(\n)<\a:\d>;