From 88be3061db22405869f48992f1213b4ea7d3e613 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 5 Apr 2021 22:35:56 +0000 Subject: circuitikz (6apr21) git-svn-id: svn://tug.org/texlive/trunk@58757 c570f23f-e606-0410-a88d-b1316a301751 --- .../third/circuitikz/circuitikz-context.pdf | Bin 17743 -> 17743 bytes .../texmf-dist/doc/generic/circuitikz/CHANGELOG.md | 16 +- .../texmf-dist/doc/latex/circuitikz/changelog.tex | 24 +- .../doc/latex/circuitikz/circuitikzmanual.pdf | Bin 1133938 -> 1159128 bytes .../doc/latex/circuitikz/circuitikzmanual.tex | 275 ++++++++++++++++----- .../tex/context/third/circuitikz/t-circuitikz.tex | 4 +- .../tex/generic/circuitikz/pgfcirc.defines.tex | 34 ++- .../tex/generic/circuitikz/pgfcircbipoles.tex | 123 +++++++-- .../tex/generic/circuitikz/pgfcirclabel.tex | 11 +- .../tex/generic/circuitikz/pgfcircmultipoles.tex | 20 +- .../texmf-dist/tex/latex/circuitikz/circuitikz.sty | 4 +- 11 files changed, 408 insertions(+), 103 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf b/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf index f26913dd19f..8af7545362b 100644 Binary files a/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf and b/Master/texmf-dist/doc/context/third/circuitikz/circuitikz-context.pdf differ diff --git a/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md b/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md index ce72f206aec..bea664a036d 100644 --- a/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md +++ b/Master/texmf-dist/doc/generic/circuitikz/CHANGELOG.md @@ -1,5 +1,19 @@ -The major changes among the different circuitikz versions are listed here. See for a full list of changes. +The major changes among the different CircuiTikZ versions are listed here. See for a full list of changes. + +* Version 1.3.3 (2021-04-04) + + Several usability additions in this version, and one small fix that could + change the look of your circuit (without affecting correctness). Some of the + arrow shapes are now configurable. + + - Added options to fine-tune the position of labels and annotations + - Added options to change arrow tips on variable resistors, inductors and + capacitors as well as in potentiometers + - Added options to change arrow tips on switches + - Added anchors to inductance to add core lines + - Fixed the default direction of tunable arrows (with an option to go back to + the old ones) * Version 1.3.2 (2021-03-14) diff --git a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex index 5b4be6d089f..88bbe4d435f 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/changelog.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/changelog.tex @@ -1,9 +1,31 @@ %DO NOT EDIT THIS AUTOMATICALLY GENERATED FILE, run "make changelog" at toplevel!!! -The major changes among the different circuitikz versions are listed +The major changes among the different CircuiTikZ versions are listed here. See \url{https://github.com/circuitikz/circuitikz/commits} for a full list of changes. \begin{itemize} +\item + Version 1.3.3 (2021-04-04) + + Several usability additions in this version, and one small fix that + could change the look of your circuit (without affecting correctness). + Some of the arrow shapes are now configurable. + + \begin{itemize} + \tightlist + \item + Added options to fine-tune the position of labels and annotations + \item + Added options to change arrow tips on variable resistors, inductors + and capacitors as well as in potentiometers + \item + Added options to change arrow tips on switches + \item + Added anchors to inductance to add core lines + \item + Fixed the default direction of tunable arrows (with an option to go + back to the old ones) + \end{itemize} \item Version 1.3.2 (2021-03-14) diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf index d0a6ea3ea33..3bf600da2f8 100644 Binary files a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf and b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.pdf differ diff --git a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex index 1f3d694044b..c7558aab600 100644 --- a/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex +++ b/Master/texmf-dist/doc/latex/circuitikz/circuitikzmanual.tex @@ -186,10 +186,10 @@ The use of \Circuitikz\ is, of course, not limited to academic teaching. The pac \subsection{License} Copyright \copyright{} -2007--2020 by Massimo Redaelli, -2013-2020 by Stefan Erhardt, -2015-2020 by Stefan Lindner, -and 2018-2020 by Romano Giannetti. +2007--2021 by Massimo Redaelli, +2013--2021 by Stefan Erhardt, +2015--2021 by Stefan Lindner, +and 2018--2021 by Romano Giannetti. 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} @@ -203,7 +203,7 @@ This package is author-maintained. Permission is granted to copy, distribute and \end{table} \footnotetext{\ConTeXt\ support was added mostly thanks to Mojca Miklavec and Aditya Mahajan.} -\noindent \TikZ\ will be automatically loaded. +\noindent \TikZ\ will be automatically loaded; additionally, the \TikZ{} libraries \texttt{calc}, \texttt{arrows.meta}, \texttt{bending}, and \texttt{fpu} are loaded (the last one is used only on demand). \noindent Circui\TikZ\ commands are just \TikZ\ commands, so a minimum usage example would be: @@ -215,7 +215,7 @@ This package is author-maintained. Permission is granted to copy, distribute and The stable version of the package should come with your \LaTeX\ distribution. Downloading the files from CTAN and installing them locally is, unfortunately, a distribution-dependent task and sometime not so trivial. If you search for \texttt{local texmf tree} and the name of your distribution on \url{https://tex.stackexchange.com/} you will find a lot of hints. -Anyway, the easiest way of using whichever version of \Circuitikz\ is to point to the github page \url{https://circuitikz.github.io/circuitikz/} of the project, and download the version you want. You will download a simple (biggish) file, called \texttt{circuitikz.sty}. +Anyway, the easiest way of using whichever version of \Circuitikz\ is to point to the github page \url{https://circuitikz.github.io/circuitikz/} of the project, and download the version you want. You will download a simple (biggish) file, called \texttt{circuitikzgit.sty}. Now you can just put this file in your local \texttt{texmf} tree, if you have one, or simply adding it into the same directory where your main file resides, and then use @@ -223,7 +223,7 @@ Now you can just put this file in your local \texttt{texmf} tree, if you have on \usepackage[...options...]{circuitikzgit} \end{verbatim} -instead of \texttt{circuitikz}. This is also advantageous for ``future resilience''; the authors try hard not to break backward compatibility with new versions, but sometime things happen. +instead of \texttt{circuitikz}. This is also advantageous for ``future resilience''; the authors try hard not to break backward compatibility with new versions, but sometimes, things happen. \subsection{Requirements} \begin{itemize} @@ -233,12 +233,16 @@ instead of \texttt{circuitikz}. This is also advantageous for ``future resilienc \end{itemize} \subsection{Incompatible packages} -\TikZ's own \texttt{circuit} library, which is based on \Circuitikz, (re?)defines several styles used by this library. In order to have them work together you can use the \texttt{compatibility} package option, which basically prefixes the names of all \Circuitikz\ \texttt{to[]} styles with an asterisk. +\TikZ's own \texttt{circuit} library, which was based on \Circuitikz, (re?)defines several styles used by this library. In order to have them work together you can use the \texttt{compatibility} package option, which basically prefixes the names of all \Circuitikz\ \texttt{to[]} styles with an asterisk. 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}. +Anyway, the compatibility code is a \emph{best effort} task and only very lightly tested --- the authors advice is to choose one or the other, without mixing them. + Another thing to take into account is that any \TikZ{} figure (and \Circuitikz{} ones qualify) \textbf{will} have problems if you use the \texttt{babel} package with a language that changes active characters (most of them). The solution is normally to add the line \verb|\usetikzlibrary{babel}| in your preamble, after loading \TikZ{} or \Circuitikz. This will normally solve the problem; some language also requires using \verb|\deactivatequoting| or the option \texttt{shorthands=off} for \texttt{babel}. Please check the documentation of \TikZ{} or this question \href{https://tex.stackexchange.com/questions/166772/problem-with-babel-and-tikz-using-draw}{on \TeX{} stackexchange site}. +Finally, the \TikZ{} library \texttt{bending} is loaded by the package, and its effects (the bending of the arrows on curved paths) will affect also the rest of your drawings. + \subsection{Known bugs and limitation}\label{sec:bugs} \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. @@ -277,33 +281,34 @@ The \texttt{use fpu reciprocal} key seems to have no side effects, but given tha \subsection{Incompabilities between version}\label{sec:incompatible-changes} -Here, we will provide a list of incompabilitys between different version of circuitikz. We will try to hold this list short, but sometimes it is easier to break with old syntax than including a lot of switches and compatibility layers. -You can check the used version at your local installation using the macro \verb!\pgfcircversion{}!. +Here, we will provide a list of incompabilitys between different version of \Circuitikz. We will try to hold this list short, but sometimes it is easier to break with old syntax than including a lot of switches and compatibility layers. In general, changes that would invalidate a circuit (changes of polarity of components and so on) are almost always protected by a flag; the same is not true for purely aesthetic changes. +If unsure, you can check the version at your local installation using the macro \verb!\pgfcircversion{}!. \begin{itemize} + \item Version 1.3.3 fixes the direction of the arrows in tunable elements; before this version, they were more or less random, now the arrow goes from bottom left to top right. You have the option to go back to the old behavior with \texttt{\textbackslash ctikzset\{bipoles/fix tunable direction=false\}}. As a compensation for the fuss, now the arrows are configurable. To learn more, see the FAQ:~\ref{faq:tunable-arrow}. \item Version 1.3.1 removes the warning if you do not specify a voltage direction. - \item After 1.2.7 a big code reorganization (which by the way fixed some bug) has been made; no changes should be visible, but a fallback point at 1.2.7 has been added. - \item You \textbf{must} upgrade to v1.2.7 or newer if you use a \TikZ{} 3.1.8 or 3.1.8a (but better upgrade both packages to the current version). - \item After v1.2.1: \textbf{Important:} the routine that implement the \texttt{to[...]} component positioning has been rewritten. That should enhance the line joins in path, and it's safer, but it can potentially change behavior. + \item After 1.2.7 a big code reorganization (which had the collateral effect of fixing some bug) has been made; no changes should be visible, but a fallback point at 1.2.7 has been added. + \item You \textbf{must} upgrade to v1.2.7 or newer if you use a \TikZ{} 3.1.8 or 3.1.8a (but better upgrade both packages to the current version). You can check the \TikZ{} version installed using the macro \verb|\pgfversion|. + \item After v1.2.1: \textbf{Important:} the routine that implements the \texttt{to[...]} component positioning has been rewritten. That should enhance the line joins in paths, and it's safer, but it can potentially change some old behavior. One of the changes is that the previous routine did the wrong thing if you used \texttt{(node) to[...]} (you should use an anchor or a coordinate, not a node there --- like \texttt{(node.anchor) to[...]}). The other one was that in the structure \texttt{... to[...] node[pos=\emph{something}] (coord)} the value of \texttt{pos} was completely wrong (even if you don't use \texttt{pos} explicitly, remember it's \texttt{pos=0.5} by default). - Additionally, the old code disrupted the \TikZ{} path-fill mechanism, so that you could get away with using the \texttt{fill} option on paths and having just the components to be filled, not the path. That was incorrect, although sometime it was handy. + Additionally, the old code disrupted the \TikZ{} path-fill mechanism, so that you could get away with using the \texttt{fill} option on paths and having just the components filled, not the path. That was incorrect, although sometime it was handy (sorry). See the FAQ at section~\ref{faqs:nodes} for more information. \item After v1.2.0: voltage arrows, symbols and label positions are calculated with a rewritten routine. There should be little change, \emph{unless} you touched internal values\dots - \item After v1.1.3: during the 1.1.0 --- 1.1.2 version, the inverted Schmitt buffer in IEEE style ports was called \texttt{inv schmitt} (with an additional space). The correct name is \texttt{invschmitt port} (the same as the legacy american port). - \item After v1.1.2: the position of \texttt{american} voltages for the \texttt{open} bipoles (you can revert to old behavior, see section~\ref{sec:sub-voltage-position}). + \item After v1.1.3: from version 1.1.0 to version 1.1.2, the inverted Schmitt buffer in IEEE style ports was called \texttt{inv schmitt} (with an additional space). The correct name is \texttt{invschmitt port} (the same as the legacy american port). + \item After v1.1.2: the position of \texttt{american} voltages for the \texttt{open} bipoles changed (you can revert to the old behavior, see section~\ref{sec:sub-voltage-position}). \item After v0.9.7: the position of the text of transistor nodes has changed; see section~\ref{sec:transistors-labels}. \item After v0.9.4: added the concept of styling of circuits. It should be backward compatible, but it's a big change, so be ready to use the \texttt{0.9.3} snapshot (see below for details). - \item After v0.9.0: the parameters \texttt{tripoles/american or port/aaa}, \texttt{...bbb}, \texttt{...ccc} and \texttt{...ddd} are no longer used and are silently ignored; the same stands for \texttt{nor}, \texttt{xor}, and \texttt{xnor} ports. - \item After v0.9.0: voltage and current directions/sign (plus and minus signs in case of \texttt{american voltages} and arrows in case of \texttt{european voltages} have been rationalized with a couple of new options (see details in section~\ref{curr-and-volt}. The default case is still the same as v0.8.3. + \item After v0.9.0: the parameters \texttt{tripoles/american or port/aaa}, \texttt{...bbb}, \texttt{...ccc} and \texttt{...ddd} are no longer used and are silently ignored; the same stands for the similarly named parameters in \texttt{nor}, \texttt{xor}, and \texttt{xnor} ports. + \item After v0.9.0: voltage and current directions/signs (plus and minus signs in case of \texttt{american voltages} and arrows in case of \texttt{european voltages}) have been rationalized with a couple of new options (see details in section~\ref{curr-and-volt}). The default case is still the same as v0.8.3, to avoid potentially wrong circuits, but you would be better off with one of the new voltage directions (\texttt{EFvoltages} or \texttt{RPvoltages}) for newer circuits. \item Since v0.8.2: voltage and current label directions (\texttt{v<=} / \texttt{i<=}) do NOT change the orientation of the drawn source shape anymore. Use the \texttt{invert} option to rotate the shape of the source. Furthermore, from this version on, the current label (\texttt{i=}) at current sources can be used independent of the regular label (\texttt{l=}). - \item Since v0.7?: The label behaviour at mirrored bipoles has changes, this fixes the voltage drawing, but perhaps you have to adjust your label positions. - \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, there exists an option to use the old behaviour. + \item Since v0.7: The label behavior at mirrored bipoles has changed, this fixes the voltage drawing, but perhaps you have to adjust your label positions. + \item Since v0.5.1: The parts \texttt{pfet}, \texttt{pigfete}, \texttt{pigfetebulk}, and \texttt{pigfetd} are now mirrored by default. Please adjust your yscale-option to correct this. + \item Since v0.5: New voltage counting direction, there exists an option to use the old behavior. \end{itemize} If you have older projects that show compatibility problems, you have two options: @@ -332,7 +337,7 @@ Circuit people are very opinionated about their symbols. In order to meet the in There are arguably way too much options in \Circuitikz, as you can see in the following list. Since version \texttt{1.0}, it is recommended to just use the basic ones --- voltage directions (you \textbf{should} specify one of them), \texttt{siunitx}, the global style (\texttt{american} or \texttt{european}) and use styles (see~\ref{sec:styling}) for the remaining options. -The standard options are what the authors like, for example you get this: +The standard options are set by historical reason, and reflect the preferences of the author that introduced them. For example you get this: \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -352,8 +357,6 @@ Feel free to load the package with your own cultural options: \end{tabular} \end{center} -\textbf{However}, most of the global package options are not available in \ConTeXt; in that case you can always use the appropriate \verb|\tikzset{}| or \verb|\ctikzset{}| command after loading the package. - \begin{LTXexample}[varwidth=true,linerange={1-1,3-6}] \begin{circuitikz} [circuitikz/voltage=american, circuitikz/resistor=american] % line not printed @@ -363,6 +366,8 @@ Feel free to load the package with your own cultural options: \end{circuitikz} \end{LTXexample} +\textbf{However}, most of the global package options are not available in \ConTeXt; in that case you can always use the appropriate \verb|\tikzset{}| or \verb|\ctikzset{}| command after loading the package. + \medskip{} \noindent Here is the list of all the options: @@ -462,7 +467,7 @@ Let's start with the first type of component, 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 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. +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] @@ -473,7 +478,7 @@ The symbol for the current source can surprise somebody; this is actually the eu \end{circuitikz} \end{LTXexample} -You can use a single path or multiple path when drawing your circuit, it's just a question of style (but be aware that closing path could be non-trivial, see section~\ref{sec:line-joins}), and you can use standard \TikZ\ lines (\verb|--|, \verb+|-+ or similar) for the wires. Nonetheless, sometime using the \Circuitikz\ specific \texttt{short} component for the wires can be useful, because then we can add labels and nodes at it, like for example in the following circuit, where we add a current (with the key \texttt{i=...}, see section~\ref{sec:currents}) and a connection dot (with the special shortcut \texttt{-*} which adds a \texttt{circ} node at the end of the connection, see sections~\ref{sec:terminals} and~\ref{sec:bipole-nodes}). +You can use a single path or multiple paths when drawing your circuit, it's just a question of style (but be aware that closing paths perfectly could be non-trivial, see section~\ref{sec:line-joins}), and you can use standard \TikZ\ lines (\verb|--|, \verb+|-+ or similar) for the wires. Nonetheless, sometime using the \Circuitikz{} specific \texttt{short} component for the wires can be useful, because then we can add labels and poles at them, like for example in the following circuit, where we add a current (with the key \texttt{i=...}, see section~\ref{sec:currents}) and a connection dot (with the special shortcut \texttt{-*} which adds a \texttt{circ} node at the end of the connection, see sections~\ref{sec:terminals} and~\ref{sec:bipole-nodes}). \begin{LTXexample}[varwidth=true] \begin{circuitikz}[american] @@ -486,7 +491,7 @@ You can use a single path or multiple path when drawing your circuit, it's just \end{circuitikz} \end{LTXexample} -One of the problems with this circuit is that we would like to have the current in a different position, such as for example on the upper side of the resistors, so that Kirchoff's Current Law at the node is better shown to students. No problem; as you can see in section~\ref{curr-and-volt} you can use the position specifier \verb|<>^_| after the key \texttt{i}: +One of the problems with this circuit is that we would like to have the current labels in a different position, such as for example on the upper side of the resistors, so that Kirchoff's Current Law at the node is better shown to students. No problem; as you can see in section~\ref{curr-and-volt} you can use the position specifiers \verb|<>^_| after the key \texttt{i}: \begin{LTXexample}[varwidth=true] \begin{circuitikz}[american] @@ -501,9 +506,10 @@ One of the problems with this circuit is that we would like to have the current Finally, we would like to add voltages indication for carrying out the current formulas; as the default position of the voltage signs seems a bit cramped to me, I am adding the \texttt{voltage shift} parameter to make a bit more space for it\dots -\begin{LTXexample}[varwidth=true] +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] \begin{circuitikz}[american, voltage shift=0.5] - \draw (0,0) to[isource, l=$I_0$, v=$V_0$] (0,3) + \draw (0,0) + to[isource, l=$I_0$, v=$V_0$] (0,3) to[short, -*, i=$I_0$] (2,3) to[R=$R_1$, i>_=$i_1$] (2,0) -- (0,0); \draw (2,3) -- (4,3) @@ -514,9 +520,10 @@ Finally, we would like to add voltages indication for carrying out the current f \emph{Et voilá!}. Remember that this is still \LaTeX, which means that you have done a description of your circuit, which is, in a lot of way, independent of the visualization of it. If you ever have to adapt the circuit to, say, a journal that force European style and flows instead of currents, you just change a couple of things and you have what seems a completely different diagram: -\begin{LTXexample}[varwidth=true] +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] \begin{circuitikz}[european, voltage shift=0.5] - \draw (0,0) to[isourceC, l=$I_0$, v=$V_0$] (0,3) + \draw (0,0) + to[isourceC, l=$I_0$, v=$V_0$] (0,3) to[short, -*, f=$I_0$] (2,3) to[R=$R_1$, f>_=$i_1$] (2,0) -- (0,0); \draw (2,3) -- (4,3) @@ -527,9 +534,10 @@ Finally, we would like to add voltages indication for carrying out the current f And finally, this is still \TikZ, so that you can freely mix other graphics element to the circuit. -\begin{LTXexample}[varwidth=true] +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] \begin{circuitikz}[american, voltage shift=0.5] - \draw (0,0) to[isource, l=$I_0$, v=$V_0$] (0,3) + \draw (0,0) + to[isource, l=$I_0$, v=$V_0$] (0,3) to[short, -*, f=$I_0$] (2,3) to[R=$R_1$, f>_=$i_1$] (2,0) -- (0,0); \draw (2,3) -- (4,3) @@ -546,24 +554,24 @@ And finally, this is still \TikZ, so that you can freely mix other graphics elem The idea is to draw a two-stage amplifier for a lesson, or exercise, on the different qualities of BJT and MOSFET transistors. -Please Notice that this section uses the ``new'' position for transistors labels, enabled since version \texttt{0.9.7}. You should refer to older manuals to see how to do the same with older versios; basically the transistor's names where put with a different \verb|node{}| command. +Please Notice that this section uses the ``new'' position for transistors labels, enabled since version \texttt{0.9.7}. You should refer to older manuals to see how to do the same with older versions; basically the transistor's names where put with an additional \verb|node{}| command. Also 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. +The idea is using relative coordinates and named nodes as much as possible, so that changes in the circuit are easily done by changing just a few numbers that select relative positions and using symmetries. Crucially, this kind of spproach make each block reusable in other diagrams bu just changing one coordinate. First of all, let's define a handy function to show the position of nodes: \def\normalcoord(#1){coordinate(#1)} -\def\showcoord(#1){node[circle, red, draw, inner sep=1pt, +\def\showcoord(#1){coordinate(#1) node[circle, red, draw, inner sep=1pt, pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm, - pin edge={red, overlay}]45:#1}](#1){}} + pin edge={red, overlay}]45:#1}](#1-node){}} \let\coord=\normalcoord \let\coord=\showcoord \begin{lstlisting} \def\normalcoord(#1){coordinate(#1)} -\def\showcoord(#1){node[circle, red, draw, inner sep=1pt, +\def\showcoord(#1){coordinate(#1) node[circle, red, draw, inner sep=1pt, pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm, - pin edge={red, overlay}]45:#1}](#1){}} + pin edge={red, overlay}]45:#1}](#1-node){}} \let\coord=\normalcoord \let\coord=\showcoord \end{lstlisting} @@ -664,7 +672,7 @@ This is the final circuit, with the nodes still marked: }} \def\killdepth#1{{\raisebox{0pt}[\height][0pt]{#1}}} \def\coord(#1){coordinate(#1)} -\def\coord(#1){node[circle, red, draw, inner sep=1pt,pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm, pin edge={red, overlay,}]45:#1}](#1){}} +\def\coord(#1){coordinate(#1) node[circle, red, draw, inner sep=1pt,pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm, pin edge={red, overlay,}]45:#1}](#1-node){}} \begin{circuitikz}[american, ] \draw (0,0) node[nmos,](Q1){\killdepth{Q1}}; \draw (Q1.S) to[R, l2^=$R_S$ and \SI{5}{k\ohm}] ++(0,-3) node[vee](VEE){$V_{EE}=\SI{-10}{V}$}; %define VEE level @@ -702,7 +710,7 @@ This is the final circuit, with the nodes still marked: }} \def\killdepth#1{{\raisebox{0pt}[\height][0pt]{#1}}} \def\coord(#1){coordinate(#1)} -\def\coord(#1){node[circle, red, draw, inner sep=1pt,pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm, pin edge={red, overlay,}]45:#1}](#1){}} +\def\coord(#1){coordinate(#1) node[circle, red, draw, inner sep=1pt,pin={[red, overlay, inner sep=0.5pt, font=\tiny, pin distance=0.1cm, pin edge={red, overlay,}]45:#1}](#1-node){}} \begin{circuitikz}[american, ] \draw (0,0) node[nmos,](Q1){\killdepth{Q1}}; \draw (Q1.S) to[R, l2^=$R_S$ and \SI{5}{k\ohm}] ++(0,-3) node[vee](VEE){$V_{EE}=\SI{-10}{V}$}; %define VEE level @@ -873,17 +881,6 @@ I want a reusable block, so I will start from a coordinate and then use only rel \end{circuitikz} \end{minipage} -\begin{minipage}{0.7\linewidth} - - If you look closer, you can notice that the new flip-flop has no lead in the bottom pin; this is due to the fact that there is no label here, and leads are drawn in flip-flops only if there is a label. This can be fixed by adding a blank label (like \verb|td=~|); otherwise you have to utilize the anchors on the internal ``not'' circle. - -\end{minipage}\hfill -\begin{minipage}{0.2\linewidth} - \begin{circuitikz}[scale=0.8, transform shape] - \node[sr-ff]{}; - \end{circuitikz} -\end{minipage} - Now we can add the ``and'' gates. For example, we can add the gates to the right like this: \begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] @@ -1719,7 +1716,7 @@ The anchor is positioned just on the corner of the segmented line crossing the c \subsubsection{Resistive components customization} -You can change the scale of these components (all the resistive bipoles together) by setting the key \texttt{resistors/scale} (default \texttt{1.0}). Similarly, you can change the widths by setting \texttt{resistors/width} (default \texttt{0.8}). +\paragraph{Geometry.} You can change the scale of these components (all the resistive bipoles together) by setting the key \texttt{resistors/scale} (default \texttt{1.0}). Similarly, you can change the widths by setting \texttt{resistors/width} (default \texttt{0.8}). You can change the width of these components (all the resistive bipoles together) by setting the key \texttt{resistors/width} to something different from the default \texttt{0.8}. @@ -1737,6 +1734,24 @@ For the american style resistors, you can change the number of ``zig-zags'' by s \end{circuitikz} \end{LTXexample} +\paragraph{Arrows.\label{sec:tunablearrows}} You can change the arrow tips used in tunable resistors (\texttt{vR}, \texttt{tgeneric}) with the key \texttt{tunable end arrow} and in potentiometers with the key \texttt{wiper end arrow} (by default the key is the word ``\texttt{default}'' to obtain the default arrow, which is \texttt{latexslim} for both). +Also you can change the start arrow with the corresponding \texttt{tunable start arrow} or \texttt{wiper start arrow} (the default value ``\texttt{default}'' is equivalent to \texttt{\{\}} for both, which means no arrow). + +You can change that globally or locally, as ever. The tip specification is the one you can find in the \TikZ{} manual (``Arrow Tip Specifications''). + +\begin{LTXexample}[varwidth, basicstyle=\small\ttfamily] + \begin{circuitikz}[american] + % globally all the potentiometrs + \ctikzset{wiper end arrow={Kite[open]}} + \draw (0,0) to[tgeneric] ++(2,0) + % set locally on this variable resistor + to[vR, tunable end arrow={Stealth[red]}, + tunable start arrow={Bar}, invert] ++(0,-2) + to[pR] ++(-2,0); + \end{circuitikz} +\end{LTXexample} + + \subsection{Capacitors and inductors: dynamical bipoles} \subsubsection{Capacitors} @@ -1764,22 +1779,23 @@ For capacitive sensors, see section~\ref{sec:sensors-anchors}. You can change the scale of the capacitors by setting the key \texttt{capacitors/scale} to something different from the default \texttt{1.0}. +Variable capacitors arrow tips follow the settings of resistors, see section~\ref{sec:tunablearrows}. + \subsubsection{Inductors} If the \texttt{cuteinductors} option is active (default behaviour), or the style \texttt{[cute inductors]} is used, the inductors are displayed as follows: \begin{groupdesc} \ctikzset{inductor=cute} \circuitdescbip[cuteinductor]{L}{Inductor}{cute inductor}(midtap/90/0.1) - \circuitdescbip[cutechoke]{cute choke}{Choke}{} - \circuitdescbip[vcuteinductor]{vL}{Variable inductor}{variable cute inductor} - \circuitdescbip[scuteinductor]{sL}{Inductive sensor}{cute inductive sensor}( label/0/0.3 ) + \circuitdescbip[vcuteinductor]{vL}{Variable inductor}{variable cute inductor}(core west/135/0.1, core east/45/0.1) + \circuitdescbip[scuteinductor]{sL}{Inductive sensor}{cute inductive sensor}(label/0/0.3) \end{groupdesc} If the \texttt{americaninductors} option is active (or the style \texttt{[american inductors]} is used), the inductors are displayed as follows: \begin{groupdesc} \ctikzset{inductor=american} \circuitdescbip[americaninductor]{L}{Inductor}{american inductor}(midtap/90/0.3) - \circuitdescbip[vamericaninductor]{vL}{Variable inductor}{variable american inductor} + \circuitdescbip[vamericaninductor]{vL}{Variable inductor}{variable american inductor}(core west/135/0.1, core east/45/0.1) \circuitdescbip[samericaninductor]{sL}{Inductive sensor}{american inductive sensor}( label/0/0.3 ) \end{groupdesc} @@ -1787,16 +1803,23 @@ Finally, if the \texttt{europeaninductors} option is active (or the style \textt \begin{groupdesc} \ctikzset{inductor=european} \circuitdescbip[fullgeneric]{L}{Inductor}{european inductor}(midtap/90/0.1) - \circuitdescbip[tfullgeneric]{vL}{Variable inductor}{variable european inductor} + \circuitdescbip[tfullgeneric]{vL}{Variable inductor}{variable european inductor}(core west/135/0.1, core east/45/0.1) \circuitdescbip[sfullgeneric]{sL}{Inductive sensor}{european inductive sensor}( label/0/0.3 ) \ctikzset{inductor=cute} % back to default \end{groupdesc} +For historical reasons, \emph{chokes} comes only in the \texttt{cute}. You can use the \texttt{core west} and \texttt{core east} anchors (see~\ref{sec:inductors-core-anchors}) to build your own core lines for the other inductors. + +\begin{groupdesc} + \circuitdescbip[cutechoke]{cute choke}{Choke}{} +\end{groupdesc} \subsubsection{Inductors customizations}\label{sec:tweak-l} You can change the scale of the inductors by setting the key \texttt{inductors/scale} to something different from the default \texttt{1.0}. +Variable inductors arrow tips follow the settings of resistors, see section~\ref{sec:tunablearrows}. + You can change the width of these components (all the inductors together, unless you use style or scoping) by setting the key \texttt{inductors/width} to something different from the default, which is \texttt{0.8} for american and european inductors, and \texttt{0.6} for cute inductors. Moreover, you can change the number of ``coils'' drawn by setting the key @@ -1804,7 +1827,7 @@ Moreover, you can change the number of ``coils'' drawn by setting the key \begin{LTXexample}[varwidth=true] \begin{circuitikz}[ - longL/.style = {cute choke, inductors/scale=0.75, + longL/.style = {cute inductor, inductors/scale=0.75, inductors/width=1.6, inductors/coils=9}] \draw (0,1.5) to[L, l=$L$] ++(4,0); \draw (0,0) to[longL, l=$L$] ++(4,0); @@ -1813,7 +1836,7 @@ Moreover, you can change the number of ``coils'' drawn by setting the key \end{circuitikz} \end{LTXexample} -Chokes (which comes only in the \texttt{cute} style) can have single and double lines, and can have the line thickness adjust (the value is relative to the thickness of the inductor). +\paragraph{Chokes} can have single and double lines, and can have the line thickness adjusted (the value is relative to the thickness of the inductor). In general, you should use the anchors (see~\ref{sec:inductors-core-anchors}) to add core lines to inductors. \begin{LTXexample}[varwidth=true] \begin{circuitikz}[american] @@ -1827,10 +1850,12 @@ Chokes (which comes only in the \texttt{cute} style) can have single and double \end{circuitikz} \end{LTXexample} + \subsubsection{Inductors anchors} For inductive sensors, see section~\ref{sec:sensors-anchors}. +\paragraph{Taps.} Inductors have an additional anchor, called \texttt{midtap}, that connects to the center of the coil ``wire''. Notice that this anchor could be on one side or the other of the component, depending on the number of loops of the element; if you need a fixed position, you can use the geographical anchors. \begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] @@ -1847,6 +1872,26 @@ to[L, loops=6, name=D] ++(2,0); \end{circuitikz} \end{LTXexample} +\paragraph{Core anchors.}\label{sec:inductors-core-anchors} +Inductors have additional anchors to add core lines (for historical reasons, there is a \texttt{cute choke} component also, but to use inductors in the chosen style you better use these anchors). The anchors are called \texttt{core west} and \texttt{core east} and they are positioned at a distance that you can tweak with the \texttt{\textbackslash ctikzset} key \texttt{bipoles/inductors/core distance} (default \texttt{2pt}). + +\begin{LTXexample}[varwidth, basicstyle=\small\ttfamily] + \begin{circuitikz}[] + \ctikzset{american} + \draw (0,3) to[L=$L$, name=myL] ++(2,0); + \draw[thick] (myL.core west) -- (myL.core east); + \ctikzset{cute inductors} + \draw (0,1.5) to[L=$L$, name=myL] ++(2,0); + \draw[densely dashed] (myL.core west) -- (myL.core east); + \ctikzset{european, bipoles/inductors/core distance=4pt} + \draw (0,0) to[L=$L$, name=myL, label distance=2pt] ++(2,0); + \draw[thick, double] (myL.core west) -- (myL.core east); + \end{circuitikz} +\end{LTXexample} + +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}. + + \subsection{Diodes and such} There are three basic styles for diodes: \texttt{empty} (fillable in color), \texttt{full} (completely filled with the draw color) and \texttt{stroke} (empty, but with a line across them). @@ -4258,6 +4303,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} + \paragraph{Cute switches anchors} The nodes-style switches have the following anchors: @@ -4470,6 +4516,45 @@ Finally, the size can be changed using the parameter \texttt{tripoles/spdt/width \end{circuitikz} \end{LTXexample} +\subsubsection{Switch arrows\label{sec:switcharrows}} + +You can change the arrow tips used in all switches (traditional and ``cute'') with the key \texttt{switch end arrow} (by default the key is the word ``\texttt{default}'' to obtain the default arrow, which is \texttt{latexslim}). +Also you can change the start arrow with the corresponding \texttt{switchable start arrow} or \texttt{wiper start arrow} (the default value ``\texttt{default}'' is equivalent to \texttt{\{\}}, which means no arrow). They keys are settable with \verb|\ctikzset| as with \verb|\tikzset| (to ease their usage in nodes). + +You can change that globally or locally, as ever. The tip specification is the one you can find in the \TikZ{} manual (``Arrow Tip Specifications''). + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz} + \draw (0,2) to[cspst] ++(2,0) + node[cute spdt up arrow, anchor=in]{}; + \draw (0,0) to[cspst] ++(2,0) + node[cute spdt up arrow, anchor=in, + switch start arrow={Bar[red]}, + switch end arrow={Triangle[blue]}]{}; +\end{circuitikz} +\end{LTXexample} + + +\paragraph{Rotary switch arrows.} You can change the rotary switch arrow shape in the same way as you change the ones in regular switches. Notice however that if you set either \texttt{switch end arrow} or \texttt{switch start arrow} they will be followed only if you have set both arrows with \texttt{<->} or equivalent, otherwise just one will be used. + +\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 (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){}; +\ctikzset{switch end arrow={Triangle[blue]}} +\ctikzset{switch start arrow={Bar[red]}} +\begin{scope}[yshift=-2cm] + \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 (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){}; +\end{scope} +\end{circuitikz} +\end{LTXexample} + \subsection{Logic gates} @@ -5762,7 +5847,7 @@ A couple of examples are shown below. -\section{Labels and similar annotations} +\section{Labels, voltages and currents} \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -5813,7 +5898,8 @@ Long names/styles for the bipoles can be used: \label{sec:labels-and-annotations} Since Version 0.7, beside the original label (\texttt{l}) option, there is a new option to place a second label, called annotation (\texttt{a}) at each bipole. -The position of annotations and labels can be adjusted with \verb|_| and \verb|^|. +\subsubsection{Label and annotation position.} +When drawing a component left-to-right, the label \texttt{l} is by default above the component, and the annotation \texttt{a} is by default below it. The position of annotations and labels can be adjusted adding the characters \verb|_| or \verb|^| to the key. \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -5827,7 +5913,39 @@ The position of annotations and labels can be adjusted with \verb|_| and \verb| \end{circuitikz} \end{LTXexample} -\textbf{Caveat:} when \TikZ{} processes the options, there will be problems if the label (or annotation, voltage, or current) contains one of the characters $=$ (equal) or $,$ (comma) --- because the parser search for those two characters to delimit the arguments, giving unexpected errors and wrong output. +For passive components, you can use \texttt{type=text} as a shortcut for \texttt{type, l=text}: + +\begin{LTXexample}[varwidth=true] +\begin{circuitikz} + \draw (0,0) to[R=$R_1$,a=1<\kilo\ohm>] (2,0); +\end{circuitikz} +\end{LTXexample} + +Notice though that in active component (sources of either voltage or current) the shortcut will set the voltage (\texttt{v}) or current (\texttt{i}) property. + +\paragraph{Adjust label and annotation position.}\label{sec:adjust-label-position} +Normally the package will guess a good position for the label or annotation; if you do not like it, +you can add\footnote{Since version \texttt{1.3.3}} (or remove, with negative values) distance using the keys \texttt{label position} and \texttt{annotation distance}. + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz} + \draw (0,0) to[sR, l=$R$, label distance=-4pt] (2,0) + to [sR, l=$R$] (4,0); +\end{circuitikz} +\end{LTXexample} + +\begin{LTXexample}[varwidth=true, basicstyle=\small\ttfamily] +\begin{circuitikz}[american] + \ctikzset{bipoles/inductors/core distance=4pt} + \draw (0,1) to[L=$L$, name=myL] ++(2,0); + \draw[thick, double] (myL.core west) -- (myL.core east); + \draw (0,0) to[L=$L$, name=myL, label distance=2pt] ++(2,0); + \draw[thick, double] (myL.core west) -- (myL.core east); +\end{circuitikz} +\end{LTXexample} + +\subsubsection{Special symbols in labels and annotations.} +When \TikZ{} processes the options, there will be problems if the label (or annotation, voltage, or current) contains one of the characters $=$ (equal) or $,$ (comma) --- because the parser search for those two characters to delimit the arguments, giving unexpected errors and wrong output. These two characters can be protected from the option parser using an extra set of braces. \begin{LTXexample}[varwidth=true] @@ -5842,7 +5960,7 @@ These two characters can be protected from the option parser using an extra set \end{circuitikz} \end{LTXexample} -\textbf{(Even more) Caveat:} up to version \texttt{1.2.7}, due to the way in which \Circuitikz{} used to processes the options, even that was not sufficient, so you must protect that tokens even more, for example using an \verb|\mbox| command, or redefining the characters with a \TeX\ \verb|\def|: +\textbf{Caveat:} up to version \texttt{1.2.7}, due to the way in which \Circuitikz{} used to processes the options, even that was not sufficient, so you must protect that tokens even more, for example using an \verb|\mbox| command, or redefining the characters with a \TeX\ \verb|\def|: \begin{LTXexample}[varwidth=true] \begin{circuitikz} @@ -5858,7 +5976,8 @@ These two characters can be protected from the option parser using an extra set \end{LTXexample} -\noindent The default orientation of labels is controlled by the options \texttt{smartlabels}, \texttt{rotatelabels} and \texttt{straightlabels} (or the corresponding \texttt{label/align} keys). Here are examples to see the differences: +\subsubsection{Labels and annotation orientation.} +The default orientation of labels is controlled by the options \texttt{smartlabels}, \texttt{rotatelabels} and \texttt{straightlabels} (or the corresponding \texttt{label/align} keys). Here are examples to see the differences: \begin{LTXexample}[varwidth=true] \begin{circuitikz} \ctikzset{label/align = straight} @@ -7607,6 +7726,32 @@ In versions up to \texttt{1.2.7}, use for example \verb|\mbox{}| or define \verb \faqA Yes, it's a known bug (or misfeature, or limitation, or a fact of life). See section~\ref{sec:bugs}. \Circuitikz{} is not compatible with \texttt{pic}s at this point. +\subsection{Tunable components}\label{faq:tunable-arrow} + +\faqQ The direction of the arrows in variable resistors or capacitors changed! + +\faqA Yes, it changed in \texttt{v1.3.3}. + +Version 1.3.3 fixes the direction of the arrows in tunable elements; before this version, they were more or less random, now the arrow goes from bottom left to top right. You have the option to go back to the old behavior with \texttt{\textbackslash ctikzset\{bipoles/fix tunable direction=false\}}. As a compensation for the fuss, now the arrows are configurable. + + +\begin{LTXexample}[pos=t, basicstyle=\small\ttfamily] +\begin{circuitikz}[european] + \draw (1,0) node{new default} (4,0) node{old default} (7,0) node{new!}; + \foreach [count=\i] \comp in + {variable american resistor, variable european resistor, + variable cute inductor, variable american inductor, tfullgeneric, + variable capacitor} { + \draw (0,-\i) node[left]{\texttt{\comp}} to[\comp, name=E] ++(2,0); + \ctikzset{bipoles/fix tunable direction=false} + \draw (3,-\i) to[\comp, name=E] ++(2,0); + \ctikzset{bipoles/fix tunable direction=true, tunable end arrow={Bar}} + \draw (6,-\i) to[\comp, name=E] ++(2,0); + } +\end{circuitikz} +\end{LTXexample} + + \section{Defining new components} \begin{quote} diff --git a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex index fcc31889fee..0724a8fcf7c 100644 --- a/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex +++ b/Master/texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex @@ -10,8 +10,8 @@ % % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. -\def\pgfcircversion{1.3.2} -\def\pgfcircversiondate{2021/03/14} +\def\pgfcircversion{1.3.3} +\def\pgfcircversiondate{2021/04/04} \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion} \usemodule[tikz] diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex index b22da300eff..218f3777827 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex @@ -67,7 +67,9 @@ \newdimen \pgfstartlinewidth %%>>> -% arrow tips, ported over old arrows library (deprecated)%<<<1 +% arrow tips macros and utilities %<<<1 + +% the default arrow is latexslim, which has been ported over old arrows library (deprecated) % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library % this was the original definition of latex' tips, renamed to avoid clashes % @@ -99,6 +101,36 @@ } \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim} + +% select the arrows using available defaults. +\def\pgfcirc@arrow@default{default} +% choose the arrows to use. Use #2 and #3 if the key is equal to "default" +% arguments: type, default start, default end +\def\pgfcirc@set@arrows#1#2#3{% + \pgfkeysifdefined{\circuitikzbasekey/#1 start arrow}% + {\edef\@@start{\ctikzvalof{#1 start arrow}}}% + {\edef\@@start{\pgfcirc@arrow@default}} + \pgfkeysifdefined{\circuitikzbasekey/#1 end arrow}% + {\edef\@@end{\ctikzvalof{#1 end arrow}}}% + {\edef\@@end{\pgfcirc@arrow@default}} + \ifx\@@start\pgfcirc@arrow@default + \pgfsetarrowsstart{#2}% + \else + \pgfsetarrowsstart{\@@start}% + \fi + \ifx\@@end\pgfcirc@arrow@default + \pgfsetarrowsend{#3}% + \else + \pgfsetarrowsend{\@@end}% + \fi +} + +\def\pgf@circ@declare@family@arrows#1{% + \ctikzset{#1 start arrow/.initial={default}} + \ctikzset{#1 end arrow/.initial={default}} + \tikzset{#1 start arrow/.style={\circuitikzbasekey/#1 start arrow={##1}}} + \tikzset{#1 end arrow/.style={\circuitikzbasekey/#1 end arrow={##1}}} +} %%>>> %% Macros to do things depending on the class%<<<1 diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex index 5a4d5b0d288..78dd1379fbe 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex @@ -13,6 +13,18 @@ %% Standard bipole shapes declarations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Generic macro and flags for bipoles %<<< +% Fixing tunable directions +\newif\ifpgf@circ@fixtunable@dir +\ctikzset{bipoles/fix tunable direction/.is if=pgf@circ@fixtunable@dir} +\ctikzset{bipoles/fix tunable direction=true} +% choosing several arrows +\pgf@circ@declare@family@arrows{tunable} +\pgf@circ@declare@family@arrows{wiper} +\pgf@circ@declare@family@arrows{switch} +%>>> + + %%%%%%%%%%%%%%%%%%%%%%%% % Resistive components: generics, resistors, wires %%%%%%%%%%%%%%%%%%%%%%%% @@ -104,6 +116,7 @@ \ctikzset{bipoles/multiwire/spacing/.initial=0.05} % crossing wires \ctikzset{bipoles/crossing/size/.initial=.2} + %%>>> %% Shapes for generic, resistives and wires components %<<< @@ -269,9 +282,14 @@ \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth} \pgf@circ@draworfill \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfcirc@set@arrows{tunable}{}{latexslim} + \ifpgf@circ@fixtunable@dir + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \else + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \fi \pgfusepath{draw} \endpgfscope } @@ -493,7 +511,7 @@ \endpgfscope \pgfscope %\pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{wiper}{}{latexslim} \pgfextractx{\pgf@circ@res@other}{\wiper} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} @@ -501,7 +519,7 @@ \endpgfscope } -%% Zig zag resistores +%% Zig-zag resistors \def\pgf@circ@zigzag#1{% \divide \pgf@circ@res@step by \numexpr4*\zigs\relax @@ -561,9 +579,14 @@ \pgf@circ@zigzag{.5} \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfcirc@set@arrows{tunable}{}{latexslim} + \ifpgf@circ@fixtunable@dir + \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \else + \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}} + \fi \pgfusepath{draw} \endpgfscope } @@ -594,7 +617,7 @@ \pgfscope %\pgfsetlinewidth{\pgfstartlinewidth} - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{wiper}{}{latexslim} \pgfextractx{\pgf@circ@res@other}{\wiper} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}} @@ -857,9 +880,14 @@ \pgfusepath{draw} \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \pgfcirc@set@arrows{tunable}{}{latexslim} + \ifpgf@circ@fixtunable@dir + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} + \else + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}} + \fi \pgfusepath{draw} \endpgfscope @@ -967,6 +995,18 @@ \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}} % +% generic core anchor settings +\ctikzset{bipoles/inductors/core distance/.initial={2pt}} +\def\pgfcir@basic@core@anchors{% + \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}} + \anchor{core east}{% + \northeast\advance\pgf@y by\coredistance + } + \anchor{core west}{% + \northeast\advance\pgf@y by\coredistance\pgf@x=-\pgf@x + } +} +% \ctikzset{bipoles/americaninductor/height/.initial=.3} \ctikzset{bipoles/americaninductor/height 2/.initial=.1} \ctikzset{bipoles/americaninductor/width/.initial=.8} @@ -1013,7 +1053,8 @@ } } \anchor{midtap}{\midtap} -} + \pgfcir@basic@core@anchors + } {\ctikzvalof{bipoles/cuteinductor/lower coil height}} {cuteinductor} {\ctikzvalof{bipoles/cuteinductor/height}} @@ -1056,6 +1097,7 @@ } \anchor{midtap}{\midtap} \pgfcirc@border@extend@full{1}{2}{1.6}{2.6} + \pgfcir@basic@core@anchors } {\ctikzvalof{bipoles/cuteinductor/lower coil height}} {scuteinductor} @@ -1158,6 +1200,13 @@ } } \anchor{midtap}{\midtap} + \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}} + \anchor{core east}{% + \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance + } + \anchor{core west}{% + \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x + } } {\ctikzvalof{bipoles/vcuteinductor/lower coil height}} {vcuteinductor} @@ -1175,7 +1224,7 @@ {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2} \pgfscope - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{tunable}{}{latexslim} \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}} \pgfusepath{draw} @@ -1206,6 +1255,7 @@ } } \anchor{midtap}{\midtap} + \pgfcir@basic@core@anchors } {\ctikzvalof{bipoles/americaninductor/height 2}} {americaninductor} @@ -1246,6 +1296,7 @@ } \anchor{midtap}{\midtap} \pgfcirc@border@extend@full{1}{2}{1.6}{2.6} + \pgfcir@basic@core@anchors } {\ctikzvalof{bipoles/americaninductor/height 2}} {samericaninductor} @@ -1289,6 +1340,13 @@ } } \anchor{midtap}{\midtap} + \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}} + \anchor{core east}{% + \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance + } + \anchor{core west}{% + \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x + } } {\ctikzvalof{bipoles/vamericaninductor/height 2}} {vamericaninductor} @@ -1313,7 +1371,7 @@ \pgfusepath{stroke} \pgfscope - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{tunable}{}{latexslim} \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}} \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}} \pgfusepath{draw} @@ -1324,6 +1382,7 @@ \pgfcircdeclarebipolescaled{inductors} { \anchor{midtap}{\northeast\pgf@x=0pt\relax} + \pgfcir@basic@core@anchors } {\ctikzvalof{bipoles/fullgeneric/height}} {fullgeneric} @@ -1342,6 +1401,7 @@ \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}% \anchor{midtap}{\northeast\pgf@x=0pt\relax} \pgfcirc@border@extend@full{1}{2}{1}{2} + \pgfcir@basic@core@anchors } {\ctikzvalof{bipoles/fullgeneric/height}} {sfullgeneric} @@ -1364,6 +1424,13 @@ \pgfcircdeclarebipolescaled{inductors} { \anchor{midtap}{\northeast\pgf@x=0pt\relax} + \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}} + \anchor{core east}{% + \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance + } + \anchor{core west}{% + \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance\pgf@x=-\pgf@x + } } {\ctikzvalof{bipoles/tfullgeneric/height}} {tfullgeneric} @@ -1378,9 +1445,14 @@ \pgfusepath{draw,fill} \pgfscope - \pgfsetarrowsend{latexslim} - \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} - \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfcirc@set@arrows{tunable}{}{latexslim} + \ifpgf@circ@fixtunable@dir + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \else + \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}} + \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}} + \fi \pgfusepath{draw} \endpgfscope } @@ -3777,7 +3849,7 @@ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}} \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{switch}{}{latexslim} \pgfsetbeveljoin \pgfusepath{draw} \endpgfscope @@ -3801,7 +3873,7 @@ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{switch}{}{latexslim} \pgfsetbeveljoin \pgfusepath{draw} \endpgfscope @@ -4059,7 +4131,7 @@ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}} \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{switch}{}{latexslim} \pgfusepath{draw} } @@ -4071,7 +4143,7 @@ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}} \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{switch}{}{latexslim} \pgfusepath{draw} } @@ -4358,7 +4430,7 @@ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}} \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{switch}{}{latexslim} \pgfusepath{draw} } @@ -4367,10 +4439,9 @@ { \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node - \pgfsetarrowsstart{latexslim} + \pgfcirc@set@arrows{switch}{latexslim}{latexslim} \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}} \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} \pgfusepath{draw} } @@ -4381,7 +4452,7 @@ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}} \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right} - \pgfsetarrowsend{latexslim} + \pgfcirc@set@arrows{switch}{}{latexslim} \pgfusepath{draw} } % %>>> diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex index 465f704ded7..8e2b4372c68 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex @@ -30,6 +30,11 @@ \ctikzset{bipole annotation style/.append style={#1}} }} +\ctikzset{label distance/.initial={0pt}} +\ctikzset{annotation distance/.initial={0pt}} +\tikzset{label distance/.code={\ctikzset{label distance={#1}}}} +\tikzset{annotation distance/.code={\ctikzset{annotation distance={#1}}}} + %% Options \ctikzset{label/.style = { l={#1} } } \ctikzset{l/.code = { @@ -182,13 +187,13 @@ % scale the distances in function of zoom, so that they are not % dependent on it but on font size. Thanks to @marmot % https://tex.stackexchange.com/a/476018/38080 - % the coeffcient is adjusted so that the distance is more or less + % the coefficient is adjusted so that the distance is more or less % the same for rotated labels and straight ones (although it will % depend on the font, so it's not exact). \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale} - \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale} + \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale} \ifnum \ctikzvalof{bipole/#1/position}>0 %we need some more space for placement below, due to mid-anchor \else % we do not have <= in \ifnum... @@ -227,7 +232,7 @@ \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}% \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale} - \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale} + \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale} \pgfmathadd{\pgf@circ@labanc}{90} \pgfmathround{\pgfmathresult} \def\pgf@circ@labanctext{\pgf@circ@labanc} diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex index 82b156c46d3..6acaa06aa99 100644 --- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex +++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex @@ -730,13 +730,29 @@ \ifpgf@circ@rotaryarrow \pgfscope % arrow - \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi + \pgfcirc@set@arrows{switch}{\ifpgf@circ@rotaryarrow@ccw latexslim\fi}{\ifpgf@circ@rotaryarrow@cw latexslim\fi} \pgf@circ@setlinewidth{bipoles}{\pgflinewidth} \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node \pgftransformrotate{\wiper} \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}} \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right} - \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi + \ifpgf@circ@rotaryarrow@ccw + \ifpgf@circ@rotaryarrow@cw + % both here, maintain values + \relax + \else + % only ccw: remove end arrow + \pgfsetarrowsend{} + \fi + \else + \ifpgf@circ@rotaryarrow@cw + % only cw: remove start arrow + \pgfsetarrowsstart{} + \else + % none: shouldn't happen + \relax + \fi + \fi \pgfusepath{draw} \endpgfscope \fi diff --git a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty index 83ac0f569df..1caeedf93e9 100644 --- a/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty +++ b/Master/texmf-dist/tex/latex/circuitikz/circuitikz.sty @@ -12,8 +12,8 @@ \NeedsTeXFormat{LaTeX2e} -\def\pgfcircversion{1.3.2} -\def\pgfcircversiondate{2021/03/14} +\def\pgfcircversion{1.3.3} +\def\pgfcircversiondate{2021/04/04} \ProvidesPackage{circuitikz}% [\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion] -- cgit v1.2.3