diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex')
-rw-r--r-- | Master/texmf-dist/doc/latex/circuitikz/changelog.tex | 30 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf | bin | 536781 -> 646978 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex | 761 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty | 26 |
4 files changed, 698 insertions, 119 deletions
diff --git a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex index 03932fa52a8..6dff87100c1 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex @@ -6,6 +6,36 @@ full list of changes. \begin{itemize} \tightlist \item + Version 0.9.1 + + \begin{itemize} + \tightlist + \item + Added old LaTeX versions for 0.8.3, 0.7, 0.6 and 0.4 + \item + Added the option to have inline transformers and gyrators + \item + Added rotary switches + \item + Added more configurable bipole nodes (connectors) and more shapes + \item + Added 7-segment displays + \item + Added vacuum tubes by J. op den Brouw + \item + Made the open shape of dcisources configurable + \item + Made the arrows on vcc and vee configurable + \item + Fixed anchors of diamondpole nodes + \item + Fixed a bug (\#205) about unstable anchors in the chip components + \item + Fixed a regression in label placement for some values of scaling + \item + Fixed problems with cute switches anchors + \end{itemize} +\item Version 0.9.0 (2019-05-10) \begin{itemize} diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf Binary files differindex 9b9b163278d..46599c3840d 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex index bbbfec74028..0b66a590029 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex @@ -6,18 +6,23 @@ % !TeX encoding = utf8 \documentclass[a4paper, titlepage]{article} -\usepackage{a4wide} %smaller borders +\usepackage{a4wide} % smaller borders \usepackage{titling} \def\modern{ \usepackage{fontspec} - \defaultfontfeatures{Ligatures=TeX, Numbers=OldStyle,Mapping=tex-text ,SmallCapsFeatures={LetterSpace=8, Numbers=OldStyle}} - %\setmainfont{Gentium Book Basic} + \defaultfontfeatures{ + Ligatures=TeX, + Numbers=OldStyle, + Mapping=tex-text, + SmallCapsFeatures={LetterSpace=8, Numbers=OldStyle} + } + % \setmainfont{Gentium Book Basic} } -%do not split this line in more lines, otherwise "make git-manual" will show the wrong version +% do not split this line in more lines, otherwise "make git-manual" will show the wrong version \usepackage[siunitx, RPvoltages]{circuitikz} -% Let this being the same as the chosen voltage direction for coherence +% Let this be the same as the chosen voltage direction for coherence \def\chosenvoltoption{RPvoltages} \usepackage{ifxetex,ifluatex} @@ -30,10 +35,10 @@ % pdflatex \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} - %\usepackage{babel} + % \usepackage{babel} \fi \fi -\def\tightlist{} %needed for latest pandoc-versions(pandoc used for including changelog) +\def\tightlist{} % needed for latest pandoc-versions(pandoc used for including changelog) \usepackage{microtype} \sisetup{load=derived} % loading \siemens @@ -46,10 +51,21 @@ \let\SX@Info=\relax % silence showexpl a bit... \makeatother % -\lstset{pos=l,width=-99pt, overhang=0pt,hsep=\columnsep,vsep=\bigskipamount, - rframe=single,numbers=left,numberstyle=\tiny,numbersep=.3em, xleftmargin=1em, - columns=flexible, language=[LaTeX]TEX,breaklines=true, - basicstyle=\normalsize\ttfamily,tabsize=3} +\lstset{ + pos=l, + width=-99pt, + overhang=0pt, + hsep=\columnsep, + vsep=\bigskipamount, + rframe=single, + numbers=left, + numberstyle=\tiny, + numbersep=.3em, + xleftmargin=1em, + columns=flexible, + language=[LaTeX]TEX,breaklines=true, + basicstyle=\normalsize\ttfamily,tabsize=3 +} \usepackage{booktabs} \renewcommand{\arraystretch}{1.2} @@ -58,15 +74,15 @@ \usepackage{hyperref} \hypersetup{ bookmarks=false, % show bookmarks bar? - pdftitle={CircuiTikZ \pgfcircversion\ - manual}, % title - pdfauthor={Massimo Redaelli, Stefan Lindner, Stefan Erhardt, Romano Giannetti}, % author + pdftitle={CircuiTikZ \pgfcircversion\ - manual}, % title + pdfauthor={Massimo Redaelli, Stefan Lindner, Stefan Erhardt, Romano Giannetti}, % authors pdfsubject={CircuiTikZ manual}, % subject of the document - pdfkeywords={}, % list of keywords - colorlinks=true, % false: boxed links; true: colored links - linkcolor=black, % color of internal links - citecolor=black, % color of links to bibliography - filecolor=black, % color of file links - urlcolor=black % color of external links + pdfkeywords={}, % list of keywords + colorlinks=true, % false: boxed links; true: colored links + linkcolor=blue, % color of internal links + citecolor=blue, % color of links to bibliography + filecolor=blue, % color of file links + urlcolor=blue % color of external links } \usepackage{imakeidx} \usepackage{textcomp} @@ -143,6 +159,8 @@ After he left University in 2010 the development of \Circuitikz\ slowed down, si 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. +\subsection{License} +Copyright \copyright\ 2007--2019 Massimo Redaelli. This package is author-maintained. Permission is granted to copy, distribute and/or modify this software under the terms of the \LaTeX\ Project Public License, version 1.3.1, or the GNU Public License. This software is provided ‘as is’, without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. \subsection{Loading the package} \begin{table}[h] @@ -189,11 +207,14 @@ instead of \texttt{circuitikz}. This is also advantageous for ``future resilienc So, if loaded with said option, one must write \verb!(0,0) to[*R] (2,0)! and, for transistors on a path, \verb!(0,0) to[*Tnmos] (2,0)!, and so on (but \verb!(0,0) node[nmos] {}!). See example at page~\pageref{ex:compatibility}. -\subsection{License} -Copyright \copyright\ 2007--2019 Massimo Redaelli. This package is author-maintained. Permission is granted to copy, distribute and/or modify this software under the terms of the \LaTeX\ Project Public License, version 1.3.1, or the GNU Public License. This software is provided ‘as is’, without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. +\subsection{Known bugs and limitation}\label{sec:bugs} -\subsection{Feedback} -The easiest way to contact the authors is via the official Github repository: \url{https://github.com/circuitikz/circuitikz/issues} +\Circuitikz{} will \textbf{not work} correctly with global (in the main \texttt{circuitikz} environment, or in \texttt{scope} environments) \emph{negative} scale parameters (\texttt{scale}, \texttt{xscale} or \texttt{yscale}), unless \texttt{transform shape} is also used, and even in this cases the behavior is not guaranteed. +Neither it will work with angle-changing scaling (when \texttt{xscale} is different form \texttt{yscale}) and with the global \texttt{rotate} parameter. + +Correcting this will need a big rewrite of the path routines, and although the authors are thinking about solving it, don't hold your breath; it will need changing a lot of interwoven code (labels, voltages, currents and so on). Contributions and help would be highly appreciated. + +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. \subsection{Incompabilities between version} @@ -207,7 +228,20 @@ You can check the used version at your local installation using the macro \verb! \item Since v0.5.1: The parts pfet, pigfete, pigfetebulk and pigfetd are now mirrored by default. Please adjust your yscale-option to correct this. \item Since v0.5: New voltage counting direction, here exists an option to use the old behaviour \end{itemize} -For older projects, you can use an older version locally using the git-version and picking the correct commit from the repository (branch gh-pages). + +If you have older projects that show compatibility problems, you have two options: +\begin{itemize} + \item you can use an older version locally using the git-version and picking the correct commit from the repository (branch gh-pages) or the main GitHub site directly; + \item if you are using \LaTeX, the distribution has embedded several important old versions: \texttt{0.4}, \texttt{0.6}, \texttt{0.7} and \texttt{0.8.3}. To switch to use them, you simply change your \verb|\usepackage| invocation like + \begin{lstlisting} + \usepackage[]{circuitik-0.8.3} % or circuitikz-0.4, 0.6... + \end{lstlisting} + You have to take care of the options that may have changed between versions. +\end{itemize} + + +\subsection{Feedback} +The easiest way to contact the authors is via the official Github repository: \url{https://github.com/circuitikz/circuitikz/issues} \subsection{Package options} \label{sec:package-options} @@ -225,8 +259,8 @@ Feel free to load the package with your own cultural options: \begin{center} \begin{tabular}{ll}\toprule - \LaTeX & \ConTeXt \\ \midrule - \verb!\usepackage[american]{circuitikz}! & \verb!\usemodule[circuitikz][american]!\\ + \LaTeX & \ConTeXt \\ \midrule + \verb!\usepackage[american]{circuitikz}! & \verb!\usemodule[circuitikz][american]!\\ \bottomrule \end{tabular} \end{center} @@ -278,7 +312,7 @@ Feel free to load the package with your own cultural options: \item \texttt{rotatelabels}: labels on bipoles are always printed aligned along the bipole; \item \texttt{smartlabels}: labels on bipoles are rotated along the bipoles, unless the rotation is very close to multiples of 90°; \item \texttt{compatibility}: makes it possibile to load \Circuitikz\ and \TikZ\ circuit library together. - \item Voltage directions: until v0.8.3, there was an error in the coherence between american and european voltages styles (see section~\ref{curr-and-volt} for the batteries. This has been fixed, but to guarantee backward compatibility and nasty surprises, the fix is available with new options: + \item Voltage directions: until v0.8.3, there was an error in the coherence between american and european voltages styles (see section~\ref{curr-and-volt}) for the batteries. This has been fixed, but to guarantee backward compatibility and to avoid nasty surprises, the fix is available with new options: \begin{itemize} \item \texttt{oldvoltagedirection}: Use old way of voltage direction having a difference between european and american direction, with wrong default labelling for batteries; \item \texttt{nooldvoltagedirection}: The standard from 0.5 onward, utilize the (German?) standard of voltage arrows in the direction of electric fields (without fixing batteries); @@ -315,12 +349,12 @@ somewhere in your document preamble. It will load automatically the needed packa \subsection{Getting started with \Circuitikz: a current shunt} -Let's say we want to prepare a circuit to teach how a current shunt works; the idea is just draw a current generator, a couple of resistors in parallel, and the indication of currents and voltages for the discussion. +Let's say we want to prepare a circuit to teach how a current shunt works; the idea is to draw a current generator, a couple of resistors in parallel, and the indication of currents and voltages for the discussion. -A circuit in \Circuitikz is drawn into a \texttt{circuitikz} environment (which is really an alias for a \texttt{tikzpicture} one). In this first example we will use absolute coordinates. -The electrical components can be divided in two big categories: the one that are bipoles and are placed along a path (also known as \texttt{to}-style component, for their usage) and components that are nodes and can have any number of poles, or connections. +A circuit in \Circuitikz is drawn into a \texttt{circuitikz} environment (which is really an alias for \texttt{tikzpicture}). In this first example we will use absolute coordinates. +The electrical components can be divided in two main categories: the one that are bipoles and are placed along a path (also known as \texttt{to}-style component, for their usage), and components that are nodes and can have any number of poles or connections. -Let's start with the first type of components and build a basic mesh: +Let's start with the first type of component, and build a basic mesh: \begin{LTXexample}[varwidth=true] \begin{circuitikz}[] @@ -329,7 +363,7 @@ Let's start with the first type of components and build a basic mesh: \end{circuitikz} \end{LTXexample} -The symbol for the current source can surprise somebody; this is actually the european-style symbol, and the symbols chosen reflects the default options of loaded in the package (see section~\ref{sec:package-options}). Let's change the style for now (the author of the tutorial, Romano, is European but he has used since ever American style circuit, so\dots); and while at it, let add the other branch and some label. +The symbol for the current source can surprise somebody; this is actually the european-style symbol, and the type of symbol chosen reflects the default options of the package (see section~\ref{sec:package-options}). Let's change the style for now (the author of the tutorial, Romano, is European - but he has always used American-style circuits, so \dots); and while we're at it, let's add the other branch and some labels. \begin{LTXexample}[varwidth=true] \begin{circuitikz}[american] @@ -407,10 +441,10 @@ And finally, this is still \TikZ, so that you can freely mix other graphics elem \end{circuitikz} \end{LTXexample} -\subsection{A more complex tutorial: circuits Romano's style.} +\subsection{A more complex tutorial: circuits, Romano style.} \begingroup % do not propagate to the rest of the manual -The idea is to draw a two-stage amplifier for a lesson, or exercise, on the different qualities of BJT an MOSFET transistors. +The idea is to draw a two-stage amplifier for a lesson, or exercise, on the different qualities of BJT and MOSFET transistors. Notice that this is a more ``personal'' tutorial, showing a way to draw circuits that is, in the author's opinion, highly reusable and easy to do. The idea is using relative coordinates and named nodes as much as possible, so that changes in the circuit are easily done by changing keys numbers of position, and crucially, each block is reusable in other diagrams. @@ -437,7 +471,7 @@ The idea is that you can use \verb|\coord()| instead of \verb|coordinate()| in p After the circuit is drawn, simply commenting out the second definition of \verb|\coord| will hide all the markers. -So let's start with the first stage transistor; given that my preferred way of drawing a MOSFET is with arrows, I'll start issuing the command \verb|\ctikzset{tripoles/mos style/arrows}|: +So let's start with the first stage transistor; given that my preferred way of drawing a MOSFET is with arrows, I'll start with the command \verb|\ctikzset{tripoles/mos style/arrows}|: \ctikzset{tripoles/mos style/arrows} \def\killdepth#1{{\raisebox{0pt}[\height][0pt]{#1}}} @@ -450,7 +484,7 @@ So let's start with the first stage transistor; given that my preferred way of d \end{circuitikz} \end{LTXexample} -Another thing I like to modify with respect to the standard is the position of the arrows in transistors, which are normally midway the symbol. Issuing the following settings will move the arrows to the end or start of the corresponding pin. +Another thing I like to modify with respect to the standard is the position of the arrows in transistors, which are normally in the middle the symbol. Using the following settings will move the arrows to the start or end of the corresponding pin. \ctikzset{tripoles/mos style/arrows, tripoles/npn/arrow pos=0.8, @@ -465,7 +499,7 @@ tripoles/nmos/arrow pos=0.8, tripoles/pmos/arrow pos=0.6, } \end{lstlisting} -The tricky thing about \verb|\killdepth{}| macro is a finicky details; I do not like the standard position of labels on transistors (which is near the collector/drain) so I plot the label at the right of the \texttt{center} anchor. Without the \verb|\killdepth| macro, the labels of different transistor will be adjusted so that the center of the box is at the \texttt{center} anchor, and as an effect, labels with descenders (like Q) will have a different baseline than labels without. You can see this here (it's really subtle): +The tricky thing about \verb|\killdepth{}| macro is finnicky details; I do not like the standard position of labels on transistors (which is near the collector/drain) so I plot the label at the right of the \texttt{center} anchor. Without the \verb|\killdepth| macro, the labels of different transistor will be adjusted so that the center of the box is at the \texttt{center} anchor, and as an effect, labels with descenders (like Q) will have a different baseline than labels without. You can see this here (it's really subtle): \begin{LTXexample}[varwidth=true] @@ -607,11 +641,11 @@ This is the final circuit, with the nodes still marked: \section{The components} -Components in \Circuitikz{} come in two forms: a path-style form, to be used in \texttt{to} path specifications, and node-style, which will be instantiated by a \texttt{node} specification. +Components in \Circuitikz{} come in two forms: path-style, to be used in \texttt{to} path specifications, and node-style, which will be instantiated by a \texttt{node} specification. \subsection{Path-style components} -The path-style components are used as in the following way: +The path-style components are used as shown below: \begin{lstlisting} \begin{circuitikz} \draw (0,0) to[#1=#2, #options] (2,0); @@ -625,7 +659,7 @@ Most path-style components can be used as a node-style components; to access the \subsubsection{Anchors} -Normally, path-style component do not need anchors, although they have them just in case you need them. You have the basic ``geographical'' anchors (bipoles are defined horizontally and then rotate as needed): +Normally, path-style components do not need anchors, although they have them just in case you need them. You have the basic ``geographical'' anchors (bipoles are defined horizontally and then rotated as needed): \begin{center} \begin{circuitikz}[ ] @@ -797,6 +831,14 @@ If the component can be filled it will be specified in the description. In addit \circuitdesc*{plain amp}{Plain amplifier}{}( out/45/0.3 ) \end{groupdesc} +Sometime, components will expose internal (sub-)shapes that can be accessed with the syntax \texttt{\textsl{<node name>}-\textsl{<internal node name>}} (a dash is separating the node name and the internal node name); that will be shown in the description as a blue ``anchor'': + +\begin{groupdesc} +\circuitdesc{rotaryswitch}{Rotary switch}{}(in/-180/0.2, cin/145/0.2, center/-90/0.2, mid/0/0.4, out 1/0/0.2, +cout 1/180/0.2)[out 1.n/90/0.2, out 4.w/0/0.3] +\end{groupdesc} + + \subsection{Grounds and supply voltages} 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. @@ -809,14 +851,33 @@ For the grounds, the \texttt{center} anchor is put on the connecting point of th \circuitdesc{nground}{Noiseless ground}{} \circuitdesc{pground}{Protective ground}{} \circuitdesc{cground}{Chassis ground\footnotemark}{} - \footnotetext{These last three were contributed by Luigi «Liverpool»)} + \footnotetext{These last three were contributed by Luigi «Liverpool»} \circuitdesc{eground}{European style ground}{} \circuitdesc{eground2}{European style ground, version 2\footnotemark}{} - \footnotetext{These last two were contributed by \texttt{@fotesan})} + \footnotetext{These last two were contributed by \texttt{@fotesan}} \circuitdesc{vcc}{VCC/VDD}{} \circuitdesc{vee}{VEE/VSS}{} \end{groupdesc} +\subsubsection{Power supplies} + +The power supplies are normally drawn with the arrows shown in the list above. +You can change them using all the options of the \texttt{arrows.meta} package (see the Ti\emph{k}Z manual for details) by changing the key \texttt{monopoles/vcc/arrow} and \texttt{monopoles/vee/arrow} (the default for both is \texttt{legacy}, which will use the old code for drawing them). Notes that the anchors are at the start of the connecting lines! + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \def\coord(#1){\showcoord(#1)<0:0.3>} + \draw (0,0) + node[vcc](vcc){VCC} \coord(vcc) ++(2,0) + node[vee](vee){VEE} \coord(vee); + \ctikzset{monopoles/vcc/arrow={Stealth[red, width=6pt, length=9pt]}} + \ctikzset{monopoles/vee/arrow={Latex[blue]}} + \draw (0,-2) + node[vcc](vcc){VCC} \coord(vcc) ++(2,0) + node[vee](vee){VEE} \coord(vee); +\end{circuitikz} +\end{LTXexample} + \subsubsection{Grounds anchors} Anchors for grounds are a bit strange, given that they have the \texttt{center} spot at the same location than \texttt{north} and all the ground will develop ``going down'': @@ -915,7 +976,7 @@ Since version 0.9.0 you have more options for the measuring instruments. You can \end{circuitikz} \end{LTXexample} -This kind of component will maintain the symbol horizontal whatever the orientation: +This kind of component will keep the symbol horizontal, whatever the orientation: \begin{LTXexample}[varwidth=true] \begin{circuitikz}[american] @@ -939,7 +1000,7 @@ The plain \texttt{rmeter} is the same, without the measuring arrow: \end{LTXexample} -If you prefer, you have the option to use square meters, to have more visual difference from generators: +If you prefer it, you have the option to use square meters, in order to have more visual difference from generators: \begin{LTXexample}[varwidth=true] \begin{circuitikz}[american] @@ -950,7 +1011,7 @@ If you prefer, you have the option to use square meters, to have more visual dif \end{circuitikz} \end{LTXexample} -Another possibility is to use the QUCS\footnote{QUCS is an open source circuit simulator: \url{http://qucs.sourceforge.net/}}-styled probes, which have the nice property of explictly showing the type of connection (in series or parallel) of the meter: +Another possibility is to use QUCS\footnote{QUCS is an open source circuit simulator: \url{http://qucs.sourceforge.net/}}-style probes, which have the nice property of explictly showing the type of connection (in series or parallel) of the meter: \begin{LTXexample}[varwidth=true] \begin{circuitikz}[american] @@ -974,7 +1035,7 @@ If you want to explicitly show a power measurement, you can use the power probe \end{circuitikz} \end{LTXexample} -The final possibility is to use oscilloscopes, like for example: +The final possibility is to use oscilloscopes. For example: \begin{LTXexample}[varwidth=true] \begin{circuitikz}[american] @@ -988,8 +1049,7 @@ The final possibility is to use oscilloscopes, like for example: \end{circuitikz} \end{LTXexample} -Or, if you want a more physical structure for the measurement setup: - +Or, if you want a more physical structure for the measurement setup: \begin{LTXexample}[varwidth=true, pos=b] \begin{circuitikz}[american] @@ -1127,7 +1187,7 @@ The package options \texttt{fulldiode}, \texttt{strokediode}, and \texttt{emptyd \end{framed} -\subsection{Basic dynamical bipoles} +\subsection{Capacitors and inductors: dynamical bipoles} \begin{groupdesc} \circuitdescbip{capacitor}{Capacitor}{C} \circuitdescbip[polarcapacitor]{polar capacitor}{Polar capacitor}{pC} @@ -1215,7 +1275,7 @@ Similarly, if (default behaviour) \texttt{europeanvoltages} option is active (or \subsection{Noise sources} -In this case, the ``direction'' of the source has no sense. Noise sources are filled in gray by default, but if you choose the dashed style, they become fillable. +In this case, the ``direction'' of the source is undefined. Noise sources are filled in gray by default, but if you choose the dashed style, they become fillable. \begin{groupdesc} \circuitdescbip[vsourceN]{noise voltage source}{Sinusoidal voltage source}{vsourceN, nV} @@ -1275,6 +1335,18 @@ Notice that if you choose the dashed style, the noise sources are fillable: \circuitdescbip*{dcisource}{DC current source}{} \end{groupdesc} +The size of the broken part of the DC current source is configurable by changing the value of \texttt{bipoles/dcisource/angle} (default \texttt{80}); values must be between 0 (no circle at all, probably not useful) and 90 (full circle, again not useful). +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[dcvsource] ++(2,0) + to [dcisource, fill=yellow] ++(2,0) ; + \ctikzset{bipoles/dcisource/angle=45} + \draw (0,-2) to[dcvsource] ++(2,0) + to [dcisource, fill=yellow] ++(2,0) ; +\end{circuitikz} +\end{LTXexample} + + \subsection{Mechanical Analogy} \begin{groupdesc} \circuitdescbip*{damper}{Mechanical Damping}{} @@ -1339,11 +1411,11 @@ You can use microphones and loudspeakers with \texttt{waves} (see section~\ref{s \noindent Contributed by Stefan Erhardt. \begin{groupdesc} - \circuitdesc*{mixer}{\scshape mixer}{}( 1/180/0.1,2/-90/0.1,3/0/0.1,4/90/0.1 ) - \circuitdesc*{adder}{\scshape adder}{}( west/180/0.1,south/-90/0.1,east/0/0.1,north/90/0.1 ) - \circuitdesc*{oscillator}{\scshape oscillator}{} - \circuitdesc*{circulator}{\scshape circulator}{} - \circuitdesc*{wilkinson}{\scshape wilkinson divider}{}( in/180/0.1, out2/45/0.1, out1/-45/0.1 ) + \circuitdesc*{mixer}{mixer}{}( 1/180/0.1,2/-90/0.1,3/0/0.1,4/90/0.1 ) + \circuitdesc*{adder}{adder}{}( west/180/0.1,south/-90/0.1,east/0/0.1,north/90/0.1 ) + \circuitdesc*{oscillator}{oscillator}{} + \circuitdesc*{circulator}{circulator}{} + \circuitdesc*{wilkinson}{wilkinson divider}{}( in/180/0.1, out2/45/0.1, out1/-45/0.1 ) \end{groupdesc} \begin{groupdesc} @@ -1525,7 +1597,7 @@ For all transistors a body diode (or freewheeling diode) can automatically be dr \end{circuitikz} \end{LTXexample} -The Base/Gate connection of all transistors can be disable by using the options \textit{nogate} or \textit{nobase}, respectively. The Base/Gate anchors are floating, but there an additional anchor "nogate"/"nobase", which can be used to point to the unconnected base: +The Base/Gate connection of all transistors can be disabled by the options \textit{nogate} or \textit{nobase}, respectively. The Base/Gate anchors are floating, but there is an additional anchor "nogate"/"nobase", which can be used to point to the unconnected base: \begin{LTXexample}[varwidth=true] \begin{circuitikz} \draw (2,0) node[npn,nobase](npn){}; @@ -1550,7 +1622,7 @@ To draw the PMOS circle non-solid, use the option \texttt{emptycircle} or the co \circuitdesc{pmos,emptycircle}{\scshape pmos}{} \end{groupdesc} -If you prefer different position of the arrows in transistors and FETs, you can adjust them like this (it works for the other BJT-based transistors, too): +If you prefer a different position of the arrows in transistors and FETs, you can adjust them like this (it works for the other BJT-based transistors, too): \begin{LTXexample}[varwidth=true] \begin{circuitikz} \ctikzset{tripoles/mos style/arrows, @@ -1626,7 +1698,7 @@ Similarly \textsc{njfet} and \textsc{pjfet} have \texttt{gate}, \texttt{source} ;\end{circuitikz} \end{LTXexample} -For \textsc{npn}, \textsc{pnp}, \textsc{nigbt}, and \textsc{pigbt} transistors the anchors are \texttt{base}, \texttt{emitter} and \texttt{collector} anchors (which can be abbreviated with \texttt{B}, \texttt{E} and \texttt{C}): +For \textsc{npn}, \textsc{pnp}, \textsc{nigbt} and \textsc{pigbt} transistors, the anchors are \texttt{base}, \texttt{emitter} and \texttt{collector} anchors (which can be abbreviated with \texttt{B}, \texttt{E} and \texttt{C}): \begin{LTXexample}[varwidth=true] \begin{circuitikz} \draw @@ -1702,21 +1774,131 @@ The \texttt{name} property is available also for bipoles, although this is usefu \subsection{Electronic Tubes} + +Electronic tubes, also known as vacuum tubes, control current flow between electrodes. They come in many different flavours. +\small{Contributed by J. op den Brouw (\texttt{J.E.J.opdenBrouw@hhs.nl}).} + +\begin{groupdesc} + \circuitdesc*{diodetube}{Tube Diode}{}(anode/90/0.2, cathode/-90/0.2 ) + \circuitdesc*{triode}{Triode}{}(anode/90/0.2, cathode/-90/0.2, grid/180/0.2 ) + \circuitdesc*{tetrode}{Tetrode}{}(anode/90/0.2, cathode/-90/0.2, grid/190/0.2,screen/170/0.2 ) + \circuitdesc*{pentode}{Pentode}{}(anode/90/0.2, cathode/-90/0.2, grid/190/0.2,screen/180/0.2,suppressor/170/0.2 ) +\end{groupdesc} + +Note that the \verb|diodetube| is used as component name to avoid clashes with the semiconductor diode. +Normally, the filament is not drawn. If you want a filament, put the \verb|filament| option in the node description: + +\begin{groupdesc} + \circuitdesc*{diodetube,filament}{Tube Diode}{}(anode/90/0.2, filament 1/-135/0.2, filament 2/-45/0.2 ) +\end{groupdesc} + +Sometimes, you don't want the cathode to be drawn (but you do want the filament). Use the \verb|nocathode| option in the node description: + +\begin{groupdesc} + \circuitdesc*{diodetube,filament,nocathode}{Tube Diode}{}(anode/90/0.2 ) +\end{groupdesc} + +If you want a full cathode to be drawn, use the \verb|fullcathode| option in the node description. You can then use the anchors \verb|cathode 1| and \verb|cathode 2|. + +\begin{groupdesc} + \circuitdesc*{diodetube,fullcathode}{Tube Diode}{}(anode/90/0.2, cathode 1/-135/0.2, cathode 2/-45/0.2 ) +\end{groupdesc} + +These circuit elements are fully configurable, and the attributes are described below: + +\begin{tabular}{l | l | l} + + Key & Default value & Description\\ + \hline + \verb|tubes/width| & \verb|1| & relative width \\ + \verb|tubes/height| & \verb|1.4| & relative height \\ + \verb|tubes/tube radius| & \verb|0.40| & radius of tube circle \\ + \verb|tubes/anode distance| & \verb|0.40| & distance from center \\ + \verb|tubes/anode width| & \verb|0.40| & width of an anode/plate \\ + \verb|tubes/grid protrusion| & \verb|0.25| & distance from center \\ + \verb|tubes/grid dashes| & \verb|5| & number of grid dashes \\ + \verb|tubes/grid separation| & \verb|0.2| & separation between grids \\ + \verb|tubes/grid shift| & \verb|0.0| & y shift of grids from center \\ + \verb|tubes/cathode distance| & \verb|0.40| & distance from grid \\ + \verb|tubes/cathode width| & \verb|0.40| & width of a cathode \\ + \verb|tubes/cathode corners| & \verb|0.06| & corners of the cathode wire \\ + \verb|tubes/cathode right extend| & \verb|0.075| & extension at the right side \\ + \verb|tubes/filament distance| & \verb|0.1| & distance from cathode \\ + \verb|tubes/filament angle| & \verb|15| & angle from the centerpoint \\ +\end{tabular} + +Conventionally, the model of the tube is indicated at the \verb|east| anchor: + +\begin{LTXexample}[varwidth] +\ctikzset{tubes/width=1.4} +\ctikzset{tubes/height=1} + +\begin{circuitikz} +\draw (0,0) node[triode] (Tri) {}; +\draw (Tri.east) node[right] {12AX7}; +\end{circuitikz} +\end{LTXexample} + +Example triode amplifier: + +\begin{lstlisting} +\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[R=$R_g$] (Rg |- start) +(Rg) to[short,*-] ++(1,0) + node[triode,anchor=grid] (Tri) {} ++(2,0) +(Tri.cathode) to[R=$R_c$,-*] (Tri.cathode |- start) +(Tri.anode) to [R=$R_a$] ++(0,2) + to [short] ++(3.5,0) node(Vatop) {} + to [V<=$V_a$] (Vatop |- start) + to [short] (start) +(Tri.anode) ++(0,0.2) to[C=$C_o$,*-o] ++(2,0) +(Tri.cathode) ++(0,-0.2) to[short,*-] ++(1.5,0) node(Cctop) {} + to[C=$C_c$,-*] (start -| Cctop) +; +\draw[red,thin,dashed] (Tri.north west) rectangle (Tri.south east); +\draw (Tri.east) node[right] {12AX7}; +\end{circuitikz} +\end{lstlisting} + +\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[R=$R_g$] (Rg |- start) +(Rg) to[short,*-] ++(1,0) + node[triode,anchor=grid] (Tri) {} ++(2,0) +(Tri.cathode) to[R=$R_c$,-*] (Tri.cathode |- start) +(Tri.anode) to [R=$R_a$] ++(0,2) + to [short] ++(3.5,0) node(Vatop) {} + to [V<=$V_a$] (Vatop |- start) + to [short] (start) +(Tri.anode) ++(0,0.2) to[C=$C_o$,*-o] ++(2,0) +(Tri.cathode) ++(0,-0.2) to[short,*-] ++(1.5,0) node(Cctop) {} + to[C=$C_c$,-*] (start -| Cctop) +; +\draw[red,thin,dashed] (Tri.north west) rectangle (Tri.south east); +\draw (Tri.east) node[right] {12AX7}; +\end{circuitikz} + \begin{groupdesc} \circuitdesc*{magnetron}{Magnetron}{}( anode/-90/0.2, cathode1/135/0.2, cathode2/45/0.2, left/180/0.2, right/0/0.2, top/90/0.4 ) \end{groupdesc} + \begin{LTXexample}[varwidth=true] - \begin{circuitikz} - \draw (0,-2)node[rground](gnd){} to[voltage source,v<={HV}]++(0,3)--++(1,0)to[V,n=DC]++(2,0); - \draw (2,-1) node[magnetron,scale=1](magn){}; - \draw (DC.left)++(-0.2,0)to [short,*-] ++(0,-1) to [short] (magn.cathode1); - \draw (DC.right)++(0.2,0)to [short,*-] ++(0,-1) to [short] (magn.cathode2); - \draw (magn.anode) to [short] (magn.anode|-gnd) node[rground]{}; - \draw (magn.cathode1)node[above]{$1$}; - \draw (magn.cathode2)node[above]{$2$}; - \draw[->](magn.east) --++(1,0)node[right]{$RF_{out}$}; - \end{circuitikz} +\begin{circuitikz} +\draw (0,-2)node[rground](gnd){} to[voltage source,v<={HV}]++(0,3)--++(1,0)to[V,n=DC]++(2,0); +\draw (2,-1) node[magnetron,scale=1](magn){}; +\draw (DC.left)++(-0.2,0)to [short,*-] ++(0,-1) to [short] (magn.cathode1); +\draw (DC.right)++(0.2,0)to [short,*-] ++(0,-1) to [short] (magn.cathode2); +\draw (magn.anode) to [short] (magn.anode|-gnd) node[rground]{}; +\draw (magn.cathode1)node[above]{$1$}; +\draw (magn.cathode2)node[above]{$2$}; +\draw[->](magn.east) --++(1,0)node[right]{$RF_{out}$}; +\end{circuitikz} \end{LTXexample} \subsection{RF components} @@ -1795,7 +1977,7 @@ The symbols can also be used along a path, using the transistor-path-syntax(T in -\subsection{Double bipoles} +\subsection{Double bipoles (transformers)} Transformers automatically use the inductor shape currently selected. These are the three possibilities: \begin{groupdesc} @@ -1825,8 +2007,6 @@ Transformers with core are also available: \ctikzset{inductor=cute} % reset default \end{groupdesc} - - \subsubsection{Double dipoles anchors} All the double bipoles/quadrupoles have the four anchors, two for each port. @@ -1886,7 +2066,55 @@ A couple of examples follow: ;\end{circuitikz} \end{LTXexample} +\subsubsection{Double dipoles customization} + +You can change the aspect of a quadpole using the corresponding parameters \texttt{quadpoles/*/width} and \texttt{quadpoles/*/heigth} (substitute the star for \texttt{transformer}, \texttt{transformer core} or \texttt{gyrator}; default value is \texttt{1.5} for all). You have to be careful to not choose value that overlaps the components! + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} +\ctikzset{quadpoles/transformer/width=1, + quadpoles/transformer/height=2} + \draw (0,0) node[transformer] (T) {} + (T.base) node{K} + (T.inner dot A1) node[circ]{} + (T.inner dot B2) node[circ]{}; +\end{circuitikz} +\end{LTXexample} +Another very useful parameter is \texttt{quadpoles/*/inner} (default \texttt{0.4}) that determine which part of the component is the ``vertical'' one. So, setting that parameter to 1 will eliminate the horizontal part of the component (obviously, to maintain the general aspect ratio you need to change the width also): + + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} +\draw (0,0) node[transformer] (T) {} + (T.A1) node[anchor=east] {A1} + (T.A2) node[anchor=east] {A2} + (T.B1) node[anchor=west] {B1} + (T.B2) node[anchor=west] {B2} + (T.base) node{K} ; +\ctikzset{quadpoles/transformer/inner=1, quadpoles/transformer/width=0.6} +\draw (0,-3) node[transformer] (P) {} + (P.base) node{T} + (P.inner dot A2) node[ocirc]{} + (P.inner dot B2) node[ocirc]{}; +\end{circuitikz} +\end{LTXexample} + +This can be useful if you want to put seamlessly something in series with either side of the component; for simplicity, you have a style setting \texttt{quadpoles style} to toggle between the standard shape of double bipoles (called \texttt{inward}, default) and the one without horizontal leads (called \texttt{inline}): + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} +\ctikzset{inductor=cute, quadpoles style=inline} +\draw + (0,0) to[R] ++(0,-2) + node[transformer, anchor=A1](T){} + (T.A2) node[ground](GND){} + (T.inner dot A1) node[font=\small\boldmath]{$\oplus$} + (T.inner dot B2) node[]{$+$} + (T.B1) node[above, ocirc]{} + (T.B2) -- (GND); +\end{circuitikz} +\end{LTXexample} \subsection{Amplifiers} @@ -2052,7 +2280,7 @@ To flip the amplifier in the horizontal direction, you can use \texttt{xscale=-1 \end{circuitikz} \end{LTXexample} -Notice that the label is fully mirrored, so check below for the generic way of changing this. +Notice that the label is fully mirrored, so check below for the generic way to change this. You can use the new key \texttt{en amp text A} to change the infinity symbol with an A: @@ -2120,9 +2348,6 @@ Path style: \begin{groupdesc} \circuitdesc{currarrow}{Arrows (current and voltage)}{} \circuitdesc{inputarrow}{Arrow to draw at its tip, useful for block diagrams.}{} - \circuitdesc{circ}{Connected terminal}{} - \circuitdesc{ocirc}{Unconnected terminal}{} - \circuitdesc{diamondpole}{Diamond-style terminal}{} \circuitdesc{jump crossing}{Jumper-style crossing node}{} \circuitdesc{plain crossing}{Plain style crossing node}{} \circuitdesc{waves}{Waves}{}( north/90/0.4, north east/45/0.4, east/-45/0.4, south east/-45/0.4, @@ -2131,6 +2356,18 @@ Path style: \circuitdesc*{bnc}{BNC connector}{}(left/135/0.6, right/45/0.6, center/-90/0.6, hot/0/0.6, zero/-135/0.6) \end{groupdesc} +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 white, but you can override it with the \texttt{fill} parameter. + +\begin{groupdesc} + \circuitdesc{circ}{Connected terminal}{} + \circuitdesc{ocirc}{Unconnected terminal}{} + \circuitdesc{diamondpole}{Diamond-square terminal}{} + \circuitdesc{odiamondpole}{Open diamond-square terminal}{} + \circuitdesc{squarepole}{Square-shape terminal}{} + \circuitdesc{osquarepole}{Open square-shape terminal}{} +\end{groupdesc} + + Moreover, you have the arrow tip \texttt{latexslim} which is an arrow similar to the old (in deprecated \texttt{arrows} library) \texttt{latex'} element: \begin{LTXexample}[varwidth=true] @@ -2139,10 +2376,8 @@ Moreover, you have the arrow tip \texttt{latexslim} which is an arrow similar to \end{circuitikz} \end{LTXexample} - - \subsubsection{Terminal shapes} -Since version 0.9.0, \texttt{circ}, \texttt{ocirc} , and \texttt{diamondpole} have all the standard geographical anchors, so you can do things like these: +Since version 0.9.0, ``bipole nodes'' shapes have all the standard geographical anchors, so you can do things like these: \begin{LTXexample}[varwidth=true] \begin{circuitikz}[american,] @@ -2251,16 +2486,33 @@ These are all of the to-style type: while this is a node-style component: \begin{groupdesc} - \circuitdesc{spdt}{spdt}{}( in/180/0.2, out 1/0/0.2, out 2/0/0.2 ) + \circuitdesc{spdt}{spdt}{}( in/180/0.2, out 1/0/0.2, out 2/0/0.2 ) \end{groupdesc} +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) node[spdt] (Sw) {} + (Sw.in) node[left] {in} + (Sw.out 1) node[right] {out 1} + (Sw.out 2) node[right] {out 2} +;\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} \draw + (0,0) to[C] (1,0) to[toggle switch , n=Sw] (2.5,0) + -- (2.5,-1) to[battery1] (1.5,-1) to[R] (0,-1) -| (0,0) + (Sw.out 2) -| (2.5, 1) to[R] (0,1) -- (0,0) +;\end{circuitikz} +\end{LTXexample} + \subsubsection{Cute switches} These switches have been introduced after version 0.9.0, and they come in also in to-style and in node-style, but they are size-matched so that they can be used together in a seamless way. The path element (to-style) are: \begin{groupdesc} \circuitdescbip[cuteclosedswitch]{cute closed switch}{Cute closed switch}{ccsw}(mid/90/0.2, in/-135/0.2, out/-45/0.2) - \circuitdescbip[cuteopenswitch]{cute open switch}{Cute open switch}{cosw} + \circuitdescbip[cuteopenswitch]{cute open switch}{Cute open switch}{cosw}(out/45/0.2)[out.s/-90/0.2] \circuitdescbip[cuteclosingswitch]{cute closing switch}{Cute closing switch}{ccgsw} \circuitdescbip[cuteopeningswitch]{cute opening switch}{Cute opening switch}{cogsw} \end{groupdesc} @@ -2274,7 +2526,7 @@ while the node-style components are the single-pole, double-throw (\texttt{spdt} \circuitdesc{cute spdt down arrow}{Cute spdt down with arrow}{} \end{groupdesc} -\subsubsection{Switches anchors} +\paragraph{Cute switches anchors} The nodes-style switches have the following anchors: @@ -2282,30 +2534,38 @@ The nodes-style switches have the following anchors: \begin{circuitikz} \def\coorda(#1)<#2>{node[circle, red, draw, inner sep=1pt,pin={[red, overlay, inner sep=0.5pt, font=\small, pin distance=0.1cm, pin edge={red, overlay,}]#2:#1}](#1){}} \path (0,-1) -- (3,1); %bbox - \draw (0, 0) node[cute spdt up arrow](CS){}; - \draw (2, 0) node[cute spdt up arrow](CS){}; + \draw (0, 0) node[spdt](S){}; + \foreach \a/\b in {center/0, in/-135, out 1/45, out 2/-45} + \path (S.\a) \coorda(\a)<\b>; + \draw (3, 0) node[cute spdt up arrow](CS){}; \foreach \a/\b in {center/0, in/-135, out 1/45, out 2/-45, mid/135} - \path (CS.\a) \coorda(\a)<\b>; + \path (CS.\a) \coorda(\a)<\b>; + \draw (6, 0) node[cute spdt up arrow](CS2){}; + \foreach \a/\b in {cin/-135, cout 1/45, cout 2/-45} + \path (CS2.\a) \coorda(\a)<\b>; \end{circuitikz} +Please notice the position of the normal anchors at the border of the \texttt{ocirc} shape for the cute switches; they are thought to be compatible with an horizontal wire going out. +Additionaly, you have the \texttt{cin}, \texttt{cout 1} y \texttt{cout 2} which are anchors on the center of the contacts. -\begin{LTXexample}[varwidth=true] -\begin{circuitikz} \draw - (0,0) node[spdt] (Sw) {} - (Sw.in) node[left] {in} - (Sw.out 1) node[right] {out 1} - (Sw.out 2) node[right] {out 2} -;\end{circuitikz} -\end{LTXexample} +For more complex situations, the contact nodes are available\footnote{Thanks to \texttt{@marmot} on \href{https://tex.stackexchange.com/a/492599/38080}{tex.stackexchange.com}.} using the syntax \emph{name of the node}\texttt{-in}, \dots\texttt{-out 1} and \dots\texttt{-out 2}, with all their anchors. \begin{LTXexample}[varwidth=true] -\begin{circuitikz} \draw - (0,0) to[C] (1,0) to[toggle switch , n=Sw] (2.5,0) - -- (2.5,-1) to[battery1] (1.5,-1) to[R] (0,-1) -| (0,0) - (Sw.out 2) -| (2.5, 1) to[R] (0,1) -- (0,0) -;\end{circuitikz} +\begin{circuitikz} +\draw (0,0) node[cute spdt up] (S1) {} + (S1.in) node[left] {in} + (S1.out 1) node[right] {out 1}; + \draw (0,-2) node[cute spdt up, + /tikz/circuitikz/bipoles/cuteswitch/height=0.8] (S2) {} + (S2.in) node[left] {in} + (S2.out 2) node[right] {out 2}; + \draw [red] (S1-in.s) -- (S2-in.n); + \draw [blue] (S1-out 2.s) -- (S2-out 1.n); +\end{circuitikz} \end{LTXexample} + + The \texttt{mid} anchor in the cute switches (both path- and node-style) can be used to combine switches to get more complex configurations: \begin{LTXexample}[varwidth=true] @@ -2317,9 +2577,10 @@ The \texttt{mid} anchor in the cute switches (both path- and node-style) can be \end{circuitikz} \end{LTXexample} -\subsubsection{Cute switches customization} +\paragraph{Cute switches customization} -You can use the key \texttt{bipoles/cuteswitch/thickness} to decide the thickness of the switch lever. The units are the diameter of the \texttt{ocirc} connector, and the default is \texttt{1}. +You can use the key \texttt{bipoles/cuteswitch/thickness} to decide the thickness of the switch lever. +The units are the diameter of the \texttt{ocirc} connector, and the default is \texttt{1}. \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -2331,6 +2592,156 @@ You can use the key \texttt{bipoles/cuteswitch/thickness} to decide the thicknes \end{circuitikz} \end{LTXexample} +Finally, the switches are normally drawn using the \texttt{ocirc} shape, but you can change it, as in the following example, with the key \texttt{bipoles/cuteswitch/shape}. Be careful that the shape is used with its defaults (which can lead to strange results), and that the standard anchors will be correct only for \texttt{circ} and \texttt{ocirc} shapes, so you have to use the internal node syntax to connect it. + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \begin{scope} + \ctikzset{bipoles/cuteswitch/thickness=0.5, + bipoles/cuteswitch/shape=circ} + \draw (0,2) node[cute spdt up](S1){}; + \ctikzset{bipoles/cuteswitch/thickness=0.25, + bipoles/cuteswitch/shape=emptyshape} + \draw (0,0) node[cute spdt up](S2){}; + \draw (S2.cin) node[draw, inner sep=2pt]{}; + \draw (S2.cout 1) node[draw, inner sep=2pt]{}; + \draw (S2.cout 2) node[draw=red, inner sep=2pt]{}; + \end{scope} + \draw (0,-2) node[cuteclosedswitchshape, yscale=-1](S3){}; + \draw [densely dashed] (S1.mid)--(S2.mid)--(S3.mid); +\end{circuitikz} +\end{LTXexample} + + +\subsubsection{Rotary switches} + +Rotary switches are a kind of generic multipole switches; they are implemented as a strongly customizable element (and a couple of styles to simplify its usage). The basic element is the following one, and it has the same basic anchors of the cute switches, included the access to internal nodes (shown in blue here). + +\begin{groupdesc} +\circuitdesc{rotaryswitch}{Rotary switch}{}(in/-180/0.2, cin/145/0.2, center/-90/0.2, mid/0/0.4, out 1/0/0.2, +cout 1/180/0.2)[out 1.n/90/0.2, out 4.w/0/0.3] +\end{groupdesc} + +Notice that the name of the shape is \texttt{rotaryswitch}, no spaces. +The default rotary switch component has 5 channels (this is set in the parameter \texttt{multipoles/rotary/channels}), spanning form \SI{-60}{\degree} to \SI{60}{\degree} (parameter \texttt{multipoles/rotary/angle}) and with the wiper at \SI{20}{\degree} (parameter \texttt{multipoles/rotary/wiper}). + +Moreover, there are by default no arrows on the wiper; you can set this with the parameter \texttt{multipoles/rotary/arrow} which can assume the values \texttt{none}, \texttt{cw} (clockwise), \texttt{ccw} (counterclockwise) or \texttt{both}. + +To simplify the usage of the component, a series of styles are defined: \texttt{rotary switch=\textsl{<channels>} in \textsl{<angle>} wiper \textsl{<wiper angle>}} (notice the space in the name of the style!). Using \texttt{rotary switch} without parameters will generate a default switch. + +To add arrows, you can use the styles \texttt{rotary switch -} (no arrow, whatever the default), \texttt{rotary switch <-} (counterclockwise arrow), \texttt{rotary switch ->} (clockwise) and \texttt{rotary switch <->} (both). + +Notice that the defaults of the styles are the same as the default values of the parameters, but that if you change globally the defaults using the keys mentioned above, you only change the defaults for the ``bare'' component \texttt{rotaryswitch}, not for the styles. + + +\begin{LTXexample}[varwidth=true, pos=t, basicstyle=\small\ttfamily] +\begin{circuitikz} +\ctikzset{multipoles/rotary/arrow=both} +\draw (0,0) -- ++(1,0) node[rotary switch <-=8 in 120 wiper 40, anchor=in](A){}; +\draw (3,0) -- ++(1,0) node[rotary switch, anchor=in](B){}; % default values +\draw[red] (A.out 4) -| (3,0); +\draw[blue] (A-out 2.n) -- ++(0,0.5) -| (B-out 1.n); +\draw (B.out 3) -- ++(1,0) node[rotary switch -=5 in 90 wiper 15, anchor=in](C){}; +\draw (C.out 3) -- ++(1,0) node[rotary switch ->, xscale=-1, anchor=out 3](D){}; +\draw[green, dashed] (B.mid) -- ++(-.5,-1) -| (C.mid); +\end{circuitikz} +\end{LTXexample} + +\paragraph{Rotary switch anchors} + +Rotary switches anchors are basically the same as the cute switches, including access (with the \texttt{\textsl{<node name>}-<anchor name>} notation) to the internal connection nodes. The geographical anchors work as expected, marking the limits of the component. + +\showanchors{rotary switch}{}(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, center/-120/0.3) +\qquad +\showanchors{rotary switch=25 in 120 wiper 10}{}(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, center/-120/0.3) + +In addition to the anchors they have in common with the cute switches, the rotary switch has the so called ``angled'' anchors and the ``external square anchors''. \emph{Angled anchors}, called \texttt{aout 1}, \texttt{aout 2} and so forth, are anchors placed on the output poles at the same angle as the imaginary lines coming from the input pole; \emph{square anchors}, called \texttt{sqout 1}\dots, are located on an imaginary square surrounding the rotary switch on the same line. + +\bigskip + +\begin{circuitikz} + \begin{scope}[scale=2, transform shape] + \clip (-1,-.4) rectangle (1,.6); + \draw (0,0) node[rotary switch=9 in 90 wiper 10](Z){}; + \draw [dashed, blue] (Z.cin) -- (Z.sqout 4); + \end{scope} + \path (Z.aout 4) \showcoord(aout 4)<-15:0.4>; + \path (Z.sqout 4) \showcoord(sqout 4)<0:0.4>; + \path (Z.out 3) \showcoord(out 3)<15:0.4>; + \path (Z.cout 3) \showcoord(cout 3)<180:0.4>; + \draw (8,0) node[rotary switch -=31 in 150 wiper 10](D){}; + \foreach \i in {1,...,31} \draw (D.sqout \i) -- (D.aout \i); + \foreach \l/\a/\d in {north/90/0.2, north east/45/0.2, east/0/0.2, + south east/-45/0.2, south/-90/0.2, south west/-135/0.2, west/180/0.2, north west/135/0.2, + center/-145/0.7} + \path (D.ext \l) \showcoord(ext \l)<\a:\d>; + \path (D.aout 12) \showcoordb(aout 12)<-5:0.4>; + \path (D.sqout 12) \showcoordb(sqout 12)<0:0.4>; + \draw[blue, densely dotted] (D.ext north west) rectangle (D.ext south east); +\end{circuitikz} + +The code for the diagram at the left, above, without the markings for the anchors, is: +\begin{lstlisting}[basicstyle=\small\ttfamily] +\begin{circuitikz} + \draw (8,0) node[rotary switch -=31 in 150 wiper 10](D){}; + \foreach \i in {1,...,31} \draw (D.sqout \i) -- (D.aout \i); + \draw[blue, densely dotted] (D.ext north west) rectangle (D.ext south east); +\end{circuitikz} +\end{lstlisting} + +One possible application for the angled and the ``on square'' anchors is that you can use them to move radially from the output poles, for example for adding numbers: + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz} +\draw (0,0) node[rotary switch=13 in 120 wiper 0](S){}; +\foreach \i in {1,...,13} % requires "calc" + \path ($(S.aout \i)!1ex!(S.sqout \i)$) + node[font=\tiny\color{red}]{\i}; +\end{circuitikz} +\end{LTXexample} + +Finally, notice that the value of width for the rotary switches is taken from the one for the ``cute switches'' which in turn is taken from the width of traditional \texttt{spdt} switch, so that they match (notice that the ``center'' anchor is better centered in the rotary switch, so you have to explicitly align them). + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz} + \draw (0,0) node[color=blue, rotary switch=2 in 35 wiper 30, + anchor=in](R){}; + \draw (0,-1) node[cute spdt up, anchor=in](C){}; + \draw (0,-2) node[color=blue, rotary switch=3 in 35 wiper 30, + anchor=in](R){}; +\end{circuitikz} +\end{LTXexample} + +\paragraph{Rotary switch customization} + +Apart from the basic customization seen above (number of channels, etc.) you can change, as in the cute switches, the shape used by the connection points with the parameter \texttt{multipoles/rotary/shape}, and the thickness of the wiper with \texttt{multipoles/rotary/thickness}. The optional arrow has thickness equal to the standard bipole thickness \texttt{bipoles/thickness} (default 2). + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \ctikzset{multipoles/rotary/thickness=0.5} + \draw (0,1.6) node[rotary switch ->, color=blue](S1){}; + \ctikzset{multipoles/rotary/shape=circ} + \draw (0,0) node[rotary switch ->](S2){}; + \ctikzset{bipoles/thickness=0.5} + \draw (0,-1.6) node[rotary switch ->, color=red](S3){}; +\end{circuitikz} +\end{LTXexample} + +Finally, the size can be changed using the parameter \texttt{tripoles/spdt/width} (default 0.85). + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,2) node[rotary switch ->, color=blue](S1){}; + \ctikzset{tripoles/spdt/width=1.6, fill=cyan, + multipoles/rotary/shape=osquarepole} + \draw (0,0) node[rotary switch ->](S2){}; +\end{circuitikz} +\end{LTXexample} + + + \subsection{Logic gates} Logic gates, with two or more input, are supported. Albeit in principle these components are multipoles, the are considered tripoles here, for historical reasons (when they just had two inputs). @@ -2511,10 +2922,7 @@ In the case of \textsc{not}, there are only \texttt{in} and \texttt{out} (althou -\subsection{Chips} -%%% This chapter is in the new format --- description and components. -%%% The idea is to try to reorganize the manual before the next release. -%%% See issue #24 +\subsection{Chips (integrated circuits)} \texttt{CircuiTikZ} supports two types of variable-pin chips: DIP (Dual-in-Line Package) and QFP (Quad-Flat Package). \begin{groupdesc} @@ -2654,6 +3062,83 @@ Look at the following example, which is easily put into a macro. \draw (C.s) -- ++(0,-1) node[ground]{}; \end{circuitikz}\end{LTXexample} +\subsection{Seven segment displays} + +\begin{groupdesc} + \circuitdesc*{bare7seg}{Seven segment display}{} +\end{groupdesc} + +The seven segment display lets you show values as if they were displayed in a classical seven segment display.\footnote{This component has been loosely inspired by the package \texttt{SevenSeg} by Germain Gondor, 2009, see \href{http://www.texample.net/tikz/examples/seven-segment-display/}{\TeX{}example.net}.} + +The main ``bare'' component is the one shown above, but for simplicity a couple of style interfaces are defined: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) node[seven segment val=A dot off box on]{}; + \draw (1,0) node[seven segment val=- dot none box on]{}; + \draw (0,-2) node[seven segment bits=1001001 dot empty box on]{}; + \draw (1,-2) node[seven segment bits=0011101 dot none box off]{}; +\end{circuitikz} +\end{LTXexample} + +There are two main configuration methods. The first one is \texttt{seven segment val}, which will take an hexadecimal number or value and display it: the possible values are \texttt{0,...,15}, plus \texttt{A, B, C, D, E, F} (or lowercase) and the symbol \texttt{-} (minus). + + +The other interface is \texttt{seven segment bits}, where you specify seven bits saying which segment must be on (please never specify a different number of bits, it will throw a very obscure error); you can see in the anchors the name of each segment. + +The option \texttt{dot} specifies if you want a decimal dot or not. The key \texttt{none} will remove the dot and the space it would take; \texttt{empty} will not show the dot at all but reserve the space, and \texttt{on} or \texttt{off} will show the dot in the corresponding state. + +The option \texttt{box} (can be \texttt{on} or \texttt{off}) simply toggles the drawing of the external box. You can separate it from the display with the key \texttt{seven seg/box sep} (default \texttt{1pt}), and it will use the thickness specified in \texttt{multipoles/thickness} (The same as the chips). + +You can use these option with the ``bare'' object \texttt{bare7seg} and the keys \texttt{seven seg/bits} (default \texttt{0000000}), \texttt{seven seg/dot} (default \texttt{none}) and \texttt{seven seg/box} (default \texttt{off}); there is no option equivalent to the \texttt{val} interface. + +\subsubsection{Seven segments anchors} + +These are the anchors for the seven segment displays; notice that when the \texttt{dot} parameter is not \texttt{none}, the cell is a bit wider at the right side. + +\begingroup +\ctikzset{seven seg/color off=gray, multipoles/thickness=1} +\showanchors{bare7seg}{}(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, center/-140/0.5) +\ctikzset{seven seg/dot=off} +\ctikzset{seven seg/box=on} +\showanchors{bare7seg}{}(north/90/0.4, north east/45/0.4, east/0/0.4, +south east/-45/0.4, south/-90/0.4, center/-140/0.5) +\ctikzset{seven seg/box=off} +\showanchors{bare7seg}{}(a/90/0.4, b/45/0.4, c/0/0.4, d/-90/0.4, +e/-129/0.4, f/145/0.4, g/190/0.4, dot/-45/0.2) +\endgroup + +\subsubsection{Seven segments customization} + +You can change several parameters to adjust the displays: +\begin{lstlisting}[basicstyle=\small\ttfamily] +\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen +\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness +\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments +\ctikzset{seven seg/box sep/.initial=1pt}% external box gap +\ctikzset{seven seg/color on/.initial=red}% color for segment "on" +\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off" +\end{lstlisting} + +A couple of examples following: + +\begin{LTXexample}[varwidth=true, pos=b, basicstyle=\small\ttfamily] +\begin{circuitikz}[scale=0.5] +\ctikzset{seven seg/width=0.2, seven seg/thickness=2pt} +\foreach \i in {0,...,15} \path (\i,0) + node[seven segment val=\i dot on box off]{}; +\ctikzset{seven seg/color on=black} +\foreach \i in {0,...,15} \path (\i,-1.5) + node[seven segment val=\i dot off box off, fill=gray!30!white]{}; +\ctikzset{seven seg/color on=green, seven seg/color off=yellow!30} +\foreach \i in {0,...,15} \path[color=red] (\i,-3) + node[seven segment val=\i dot none box on, xslant=0.2]{}; +\end{circuitikz} +\end{LTXexample} + + \section{Labels and similar annotations} \begin{LTXexample}[varwidth=true] @@ -2719,7 +3204,7 @@ The position of (a) and (l) labels can be adjusted with \_ and \^, respectively. \end{circuitikz} \end{LTXexample} -\textbf{Caveat:} notice that the way in which \texttt{circuitikz} processes the options, there will be problems if the label (or annotation, or voltage, or current) contains one of the characters $=$ (equal) or $,$ (comma), giving unexpected errors and wrong output. +\textbf{Caveat:} notice that the way in which \texttt{circuitikz} processes the options, there will be problems if the label (or annotation, voltage, or current) contains one of the characters $=$ (equal) or $,$ (comma), giving unexpected errors and wrong output. These two characters must be protected to the option parser using an \verb|\mbox| command, or redefining the characters with a \TeX\ \verb|\def|: \begin{LTXexample}[varwidth=true] @@ -3239,9 +3724,49 @@ This could be especially useful if you define a style, to use like this: \end{LTXexample} +\subsection{Nodes (also called poles)}\label{sec:bipole-nodes} + +You can add nodes to the bipoles, positioned at the coordinates surrounding the component. The general style to use is \texttt{bipole nodes=\{start\}\{stop\}}, where \texttt{start} and \texttt{stop} are the nodes --- to be chosen between \texttt{none}, \texttt{circ}, \texttt{ocirc}, \texttt{squarepole}, \texttt{osquarepole}, \texttt{diamondpole}, \texttt{odiamondpole} and \texttt{rectfill}\footnote{You can use other shapes too, but at your own risk\dots Moreover, notice that \texttt{none} is not really a node, just a special word used to say ``do not put any node here''.} (see section~\ref{sec:support}). -\subsection{Nodes} +\begin{LTXexample}[varwidth=true, + basicstyle=\small\ttfamily + ] +\begin{circuitikz} + \ctikzset{bipoles/length=.5cm, nodes width=0.1}%small components, big nodes + \foreach \a/\p [evaluate=\a as \b using (\a+180)] in + {-90/none, -60/circ, -30/ocirc, 0/diamondpole, 30/odiamondpole, 60/squarepole, 90/osquarepole} + \draw (0,0) to[R, bipole nodes={none}{\p}] ++(\a:1.5) node[font=\tiny, anchor=\b]{\p}; +\end{circuitikz} +\end{LTXexample} + + + +These bipole nodes are added after the path is drawn, as every node in Ti\emph{k}Z --- this is the reason why they are always filled (with the main color the normal nodes, with white the open ones), in order to ``hide'' the wire below. You can override the fill color if you want; but notice that if you draw things in two different paths, you will have ``strange'' results; notice that in the second line of resistors the second wire is starting from the center of the white \texttt{ocirc} of the previous path. + +\begin{LTXexample}[varwidth=true, + pos=t, basicstyle=\small\ttfamily + ] +\begin{circuitikz} + \draw (0,0) to[R, *-o] ++(2,0) to[R, -d] ++(2,0) + to[R, bipole nodes={diamondpole}{odiamondpole, fill=red}] ++(2,0); + \draw (0,-1) to[R, *-o] ++(2,0) ; + \draw (2,-1) to[R, -d] ++(2,0) to[R, bipole nodes={none}{squarepole}] ++(2,0); +\end{circuitikz} +\end{LTXexample} + +You can define shortcuts for the \texttt{bipole bodes} you use most; for example if you want a shortcut for a bipole with open square node in red in the right side you can: + +\begin{LTXexample}[varwidth=true, + basicstyle=\small\ttfamily + ] +\begin{circuitikz} + \ctikzset{-s/.style = {bipole nodes={none}{osquarepole, fill=red}}} + \draw (0,0) to[R, -s] ++(2,0); +\end{circuitikz} +\end{LTXexample} + +There are several predefined shorthand as the above; in the following pages you can see all of them. \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -3577,7 +4102,7 @@ Placing labels, currents and voltages works also, please note, that mirroring an \subsection{Line joins between Path Components} \label{sec:line-joins} -Line joins should be calculated correctly, if the are on the same path and if the path is not closed. For example, the following path is not closed correctly (\textit{--cycle} does not work here!): +Line joins should be calculated correctly - if they are on the same path, and the path is not closed. For example, the following path is not closed correctly (\textit{--cycle} does not work here!): \begin{LTXexample}[varwidth=true] \begin{tikzpicture}[line width=3pt,european] \draw (0,0) to[R]++(2,0)to[R]++(0,2) @@ -3754,6 +4279,18 @@ Just substitute every occurrence of the environment \verb!circuitikz! with \verb Use \verb|\def{\eq}{=}| \verb!to[R = $R_1\eq 12V$]! and \verb!to[ospst = open{,} 3s]! instead; see caveat in section~\ref{sec:labels-and-annotations}. +\bigskip + +\noindent Q: I tried to change the direction of the $y$ axis with \texttt{yscale=-1}, but the circuit is completely messed up. + +\noindent A: Yes, it's a known bug (or misfeature, or limitation). See section~\ref{sec:bugs}. Don't do that. + + +\bigskip + +\noindent Q: I tried to put a diode in a \texttt{pic}, but it's coming out badly rotated. + +\noindent A: Yes, it's a known bug (or misfeature, or limitation). See section~\ref{sec:bugs}. \Circuitikz{} is not compatible with \texttt{pic}s at this point. \section{Defining new components} @@ -3794,7 +4331,7 @@ The suggested way to start working on a new component is to use the utilities of \begin{document} -\circuitdescbip*{damper}{Mechanical damping\footnotemark}{}(left/135/0.2, right/45/0.2, center/-90/0.3) +\circuitdescbip*{damper}{Mechanical damping}{}(left/135/0.2, right/45/0.2, center/-90/0.3) \geolrcoord{dampershape, fill=yellow} @@ -3807,9 +4344,9 @@ The suggested way to start working on a new component is to use the utilities of \end{document} \end{lstlisting} -This will compile in something like this (in this case, we are using a couple of existing components to check everything is ok): +This will compile to something like this (in this case, we are using a couple of existing components to check everything is ok): -\circuitdescbip*{damper}{Mechanical damping\footnotemark}{}(left/135/0.2, right/45/0.2, center/-90/0.3) +\circuitdescbip*{damper}{Mechanical damping}{}(left/135/0.2, right/45/0.2, center/-90/0.3) \geolrcoord{dampershape, fill=yellow} @@ -3930,7 +4467,7 @@ Looking at the implementation of the \texttt{spring} element, a possible impleme which leads to: -\circuitdescbip*{viscoe}{Mechanical viscoelastic element\footnotemark}{}(left/135/0.2, right/45/0.2, center/-90/0.3) +\circuitdescbip*{viscoe}{Mechanical viscoelastic element}{}(left/135/0.2, right/45/0.2, center/-90/0.3) \geolrcoord{viscoeshape, fill=yellow} @@ -3953,11 +4490,11 @@ Adding a node-style component is much more straightforward. Just define it by fo Once you have a satisfactory element, you should \begin{itemize} \item Clean up your code; - \item write a piece of documentation explaining its use with example; + \item write a piece of documentation explaining its use, with an example; \item Propose the element for inclusion in the GitHub page of the project (you will have to license this as explained in that page, of course). \end{itemize} -The best way of contributing is forking the project, adding your component in the correct files, modify the manual and creating a pull request for the developers to merge. Anyway, if this is a problem, just open an issue and someone (when they have time\dots) will answer. +The best way of contributing is forking the project, adding your component in the correct files, modifying the manual and creating a pull request for the developers to merge. Anyway, if this is a problem, just open an issue and someone (when they have time\dots) will answer. diff --git a/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty b/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty index 6e773c3c570..d158bb21a52 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty +++ b/Master/texmf-dist/doc/latex/circuitikz/ctikzmanutils.sty @@ -32,7 +32,8 @@ % optional: scale of the component in the entry % mandatory shape name, description, node text: % optional between (): anchor specification list -\NewDocumentCommand{\circuitdesc}{s O{1} m m m d()} +% optional between []: internal nodes specification list +\NewDocumentCommand{\circuitdesc}{s O{1} m m m d() d[]} { \twopartbox{% \begin{circuitikz}[] @@ -44,16 +45,20 @@ \IfValueT{#6}{% \foreach \n/\a/\d in {#6} \path(N.\n) \showcoord(\n)<\a:\d>; } + \IfValueT{#7}{% + \foreach \n/\a/\d in {#7} \path(N-\n) \showcoordb(N-\n)<\a:\d>; + } \end{circuitikz}% }{\sloppy% {#4, type: node\IfBooleanT{#1}{, fillable}% - } (\texttt{node[#3]\{#5\}}) \index{#3} } + } (\texttt{node[#3]\IfValueT{#7}{(N)}\{#5\}}) \index{#3} } } % description of a path-style component: % optional: main name, if different from above % mandatory component name, description, comma separated alias % optional between (): anchor specification list -\NewDocumentCommand{\circuitdescbip}{s o m m m d()} +% optional between []: internal nodes specification list +\NewDocumentCommand{\circuitdescbip}{s o m m m d() d[]} { \index{#3} \tikz\foreach \i in {#5} {\index{\i|see{#3}} }; \twopartbox{% @@ -66,13 +71,15 @@ \IfValueT{#6}{% \foreach \n/\a/\d in {#6} \path(B.\n) \showcoord(\n)<\a:\d>; } + \IfValueT{#7}{% + \foreach \n/\a/\d in {#7} \path(B-\n) \showcoordb(B-\n)<\a:\d>; + } \end{circuitikz}% }{\sloppy% \texttt{\textbf{#3}}: #4, \texttt{type: path-style\IfBooleanT{#1}{, fillable}% - \IfValueTF{#2}{% - , nodename: #2shape.%\drawphantomshape{#2shape}% - }{ - , nodename: #3shape.%\drawphantomshape{#3shape}% + \IfValueT{#7}{, \texttt{name=B}}% + \IfValueTF{#2}{, nodename: #2shape.%\drawphantomshape{#2shape}% + }{, nodename: #3shape.%\drawphantomshape{#3shape}% } }% \ifthenelse{\equal{#5}{}}{}{% @@ -92,6 +99,11 @@ [red, inner sep=0.5pt, font=\small, pin distance=#3\pgf@circ@Rlen, pin edge={red, }% ]#2:#1}](#1){}} +\def\showcoordb(#1)<#2:#3>{% + node[circle, blue, draw, inner sep=1pt,pin={% + [blue, inner sep=0.5pt, font=\small, + pin distance=#3\pgf@circ@Rlen, pin edge={blue, }% + ]#2:#1}](#1){}} \makeatother % show anchors of a node component: % optional: options of the circuitikz environment |