From 69bc5e90d3ee464d7b3f03f2bc8453239586b742 Mon Sep 17 00:00:00 2001 From: Anno Knierim Date: Tue, 1 Oct 2024 19:35:02 +0200 Subject: [PATCH 1/6] Add circuitikz to packages --- common/packages.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/packages.tex b/common/packages.tex index 2b664384..d52c2b4c 100644 --- a/common/packages.tex +++ b/common/packages.tex @@ -111,6 +111,8 @@ shapes, } +\usepackage[siunitx, nooldvoltagedirection]{circuitikz} + \usegdlibrary{trees} \usepackage[compat=1.1.0]{tikz-feynman} From 13cca34981c41f8c2f1c172b86ad05838b9e55bf Mon Sep 17 00:00:00 2001 From: Anno Knierim Date: Tue, 1 Oct 2024 19:35:33 +0200 Subject: [PATCH 2/6] Add two circuitikz examples to latex slides --- latex/content/tikz.tex | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/latex/content/tikz.tex b/latex/content/tikz.tex index f49c5105..0f959dde 100644 --- a/latex/content/tikz.tex +++ b/latex/content/tikz.tex @@ -126,3 +126,62 @@ \section{Zeichnen mit TikZ} }; \end{CodeExample} \end{frame} + +\begin{frame}[fragile]{CircuiTikZ} + \begin{CodeExample}{0.65}[Einfacher Schaltkreis] + \begin{minted}{latex} + \begin{circuitikz} + \draw (0,0) -- (0, 1.3) + to[open, o-o, l=$U$] (0, 1.8) + -- (0,3) + -- (2,3) + to[R] (2,0) -- (0,0); + \end{circuitikz} + \end{minted} + \CodeResult + \begin{circuitikz} + \draw (0,0) -- (0, 1.3) + to[open, o-o, l=$U$] (0, 1.8) + -- (0,3) -- (2,3) + to[R=$R$] (2,0) -- (0,0); + \end{circuitikz} + \end{CodeExample} +\end{frame} + +\begin{frame}[fragile]{CircuiTikZ} + \begin{CodeExample}{0.65}[Komplexerer Schwingkreis] + \begin{minted}{latex} + \begin{circuitikz} + \ctikzset{bipoles/cuteswitch/thickness=0.5} + \draw (0, 0) -- (0, 3) + to[R=\qty{14.0}{\ohm}] (2, 3) + to[battery2, v^<=\qty{34.0}{\volt}] (3, 3) + -- (4, 3); + \draw (0, 1.5) -- (2, 1.5) + to[C=\qty{6.20}{\micro\farad}] (3, 1.5) + -- (3.35, 1.5) node[right, cute spdt up] (S2) {}; + \draw (4, 3) -- (S2.out 1); + \draw (S2.out 2) -- (4, 0) + -- (3, 0) + to[L=\qty{54.0}{\milli\henry}] (2, 0) + -- (0,0); + \end{circuitikz} + \end{minted} + \CodeResult + \begin{circuitikz} + \ctikzset{bipoles/cuteswitch/thickness=0.5} + \draw (0, 0) -- (0, 3) + to[R=\qty{14.0}{\ohm}] (2, 3) + to[battery2, v^<=\qty{34.0}{\volt}] (3, 3) + -- (4, 3); + \draw (0, 1.5) -- (2, 1.5) + to[C=\qty{6.20}{\micro\farad}] (3, 1.5) + -- (3.35, 1.5) node[right, cute spdt up] (S2) {}; + \draw (4, 3) -- (S2.out 1); + \draw (S2.out 2) -- (4, 0) + -- (3, 0) + to[L=\qty{54.0}{\milli\henry}] (2, 0) + -- (0,0); + \end{circuitikz} + \end{CodeExample} +\end{frame} From 30aa628cafeab8faa7efafc26a589288f8eac349 Mon Sep 17 00:00:00 2001 From: Anno Knierim Date: Tue, 1 Oct 2024 21:35:29 +0200 Subject: [PATCH 3/6] Remove redundant option --- common/packages.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/packages.tex b/common/packages.tex index d52c2b4c..e0af884e 100644 --- a/common/packages.tex +++ b/common/packages.tex @@ -111,7 +111,7 @@ shapes, } -\usepackage[siunitx, nooldvoltagedirection]{circuitikz} +\usepackage[siunitx]{circuitikz} \usegdlibrary{trees} \usepackage[compat=1.1.0]{tikz-feynman} From 88caf89c39238cab357235686055ee0a7fa37ab6 Mon Sep 17 00:00:00 2001 From: Anno Knierim Date: Tue, 1 Oct 2024 21:38:08 +0200 Subject: [PATCH 4/6] Improve code, add docs links --- latex/content/tikz.tex | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/latex/content/tikz.tex b/latex/content/tikz.tex index 0f959dde..39ef73fe 100644 --- a/latex/content/tikz.tex +++ b/latex/content/tikz.tex @@ -84,7 +84,11 @@ \section{Zeichnen mit TikZ} \end{CodeExample} \end{frame} -\begin{frame}[fragile]{Tikz-Feynman} +\begin{frame}[fragile]{% + Tikz-Feynman + \hfill + \doc{http://mirrors.ctan.org/graphics/pgf/contrib/tikz-feynman/tikz-feynman.pdf}{tikz-feynman} +} \begin{Packages} \mintinline{latex}+\usepackage{tikz-feynman}+ \end{Packages} @@ -127,7 +131,14 @@ \section{Zeichnen mit TikZ} \end{CodeExample} \end{frame} -\begin{frame}[fragile]{CircuiTikZ} +\begin{frame}[fragile]{% + CircuiTi\textit{k}Z + \hfill + \doc{http://mirrors.ctan.org/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf}{circuitikz} +} + \begin{Packages} + \mintinline{latex}+\usepackage[siunitx]{circuitikz}+ + \end{Packages} \begin{CodeExample}{0.65}[Einfacher Schaltkreis] \begin{minted}{latex} \begin{circuitikz} @@ -135,7 +146,8 @@ \section{Zeichnen mit TikZ} to[open, o-o, l=$U$] (0, 1.8) -- (0,3) -- (2,3) - to[R] (2,0) -- (0,0); + to[R] (2,0) + -- (0,0); \end{circuitikz} \end{minted} \CodeResult @@ -143,12 +155,13 @@ \section{Zeichnen mit TikZ} \draw (0,0) -- (0, 1.3) to[open, o-o, l=$U$] (0, 1.8) -- (0,3) -- (2,3) - to[R=$R$] (2,0) -- (0,0); + to[R=$R$] (2,0) + -- (0,0); \end{circuitikz} \end{CodeExample} \end{frame} -\begin{frame}[fragile]{CircuiTikZ} +\begin{frame}[fragile]{CircuiTi\textit{k}Z} \begin{CodeExample}{0.65}[Komplexerer Schwingkreis] \begin{minted}{latex} \begin{circuitikz} @@ -177,8 +190,8 @@ \section{Zeichnen mit TikZ} \draw (0, 1.5) -- (2, 1.5) to[C=\qty{6.20}{\micro\farad}] (3, 1.5) -- (3.35, 1.5) node[right, cute spdt up] (S2) {}; - \draw (4, 3) -- (S2.out 1); - \draw (S2.out 2) -- (4, 0) + \draw (4, 3) -- (S2.out 1) node[right] {$a$}; + \draw (S2.out 2) node[right] {$b$} -- (4, 0) -- (3, 0) to[L=\qty{54.0}{\milli\henry}] (2, 0) -- (0,0); From 6b4cca4e66b8ac896d2aad4011f0e38e6c5f85b9 Mon Sep 17 00:00:00 2001 From: Anno Knierim Date: Wed, 2 Oct 2024 09:15:24 +0200 Subject: [PATCH 5/6] Follow DIN EN 60617-4 for resistors and inductors --- common/packages.tex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/packages.tex b/common/packages.tex index e0af884e..dab77082 100644 --- a/common/packages.tex +++ b/common/packages.tex @@ -111,7 +111,11 @@ shapes, } -\usepackage[siunitx]{circuitikz} +\usepackage[ + europeanresistors, % follow DIN EN 60617-4 + americaninductors, % follow DIN EN 60617-4 + siunitx +]{circuitikz} \usegdlibrary{trees} \usepackage[compat=1.1.0]{tikz-feynman} From 7f5b8f23ca7f9b1090e9611e56d1d78ef3ccc20a Mon Sep 17 00:00:00 2001 From: Anno Knierim Date: Wed, 2 Oct 2024 09:15:56 +0200 Subject: [PATCH 6/6] Change order of tikz-feynman and circuitikz, add minor code improvements --- latex/content/tikz.tex | 134 ++++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 63 deletions(-) diff --git a/latex/content/tikz.tex b/latex/content/tikz.tex index 39ef73fe..2fe62870 100644 --- a/latex/content/tikz.tex +++ b/latex/content/tikz.tex @@ -84,60 +84,20 @@ \section{Zeichnen mit TikZ} \end{CodeExample} \end{frame} -\begin{frame}[fragile]{% - Tikz-Feynman - \hfill - \doc{http://mirrors.ctan.org/graphics/pgf/contrib/tikz-feynman/tikz-feynman.pdf}{tikz-feynman} -} - \begin{Packages} - \mintinline{latex}+\usepackage{tikz-feynman}+ - \end{Packages} - \begin{CodeExample}{0.65}[Tree-Graph] - \begin{minted}{latex} - \feynmandiagram [horizontal=a to b] { - i1 -- [fermion] a -- [fermion] i2, - a -- [photon] b, - f1 -- [fermion] b -- [fermion] f2, - }; - \end{minted} - \CodeResult - \feynmandiagram [horizontal=a to b] { - i1 -- [fermion] a -- [fermion] i2, - a -- [photon] b, - f1 -- [fermion] b -- [fermion] f2, - }; - \end{CodeExample} -\end{frame} - -\begin{frame}[fragile]{Tikz-Feynman} - \begin{CodeExample}{0.65}[Tree-Graph] - \begin{minted}{latex} - \feynmandiagram [horizontal=a to b] { - i1 [particle=$\symup{e}^-$] - -- [fermion] a - -- [fermion] i2 [particle=$\symup{e}^+$], - a -- [photon, edge label=$\symup{γ}$] b, - f1 [particle=$\symup{μ}^-$] - -- [fermion] b - -- [fermion] f2 [particle=$\symup{μ}^+$], - }; - \end{minted} - \CodeResult - \feynmandiagram [horizontal=a to b] { - i1 [particle=$\symup{e}^-$] -- [fermion] a -- [fermion] i2 [particle=$\symup{e}^+$], - a -- [photon, edge label=$\symup{γ}$] b, - f2 [particle=$\symup{μ}^+$] -- [fermion] b -- [fermion] f1 [particle=$\symup{μ}^-$], - }; - \end{CodeExample} -\end{frame} - +%% CircuiTikZ \begin{frame}[fragile]{% CircuiTi\textit{k}Z \hfill \doc{http://mirrors.ctan.org/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf}{circuitikz} } \begin{Packages} - \mintinline{latex}+\usepackage[siunitx]{circuitikz}+ + \begin{minted}{latex} + \usepackage[ + europeanresistors, % DIN EN 60617-4 folgen + americaninductors, % DIN EN 60617-4 folgen + siunitx + ]{circuitikz} + \end{minted} \end{Packages} \begin{CodeExample}{0.65}[Einfacher Schaltkreis] \begin{minted}{latex} @@ -162,39 +122,87 @@ \section{Zeichnen mit TikZ} \end{frame} \begin{frame}[fragile]{CircuiTi\textit{k}Z} - \begin{CodeExample}{0.65}[Komplexerer Schwingkreis] + \begin{CodeExample}{0.68}[Komplexerer Schwingkreis] \begin{minted}{latex} \begin{circuitikz} \ctikzset{bipoles/cuteswitch/thickness=0.5} \draw (0, 0) -- (0, 3) - to[R=\qty{14.0}{\ohm}] (2, 3) + to[R, l=$R$, a=\qty{14.0}{\ohm}] (2, 3) to[battery2, v^<=\qty{34.0}{\volt}] (3, 3) -- (4, 3); \draw (0, 1.5) -- (2, 1.5) to[C=\qty{6.20}{\micro\farad}] (3, 1.5) - -- (3.35, 1.5) node[right, cute spdt up] (S2) {}; - \draw (4, 3) -- (S2.out 1); - \draw (S2.out 2) -- (4, 0) - -- (3, 0) - to[L=\qty{54.0}{\milli\henry}] (2, 0) - -- (0,0); + -- (3.35, 1.5) node[right, cute spdt mid] (S) {}; + \draw (4, 3) -- (S.out 1) node[right] {$a$}; + \draw (0, 0) -- (1.8, 0) + to[L=\qty{54.0}{\milli\henry}] (3.2, 0) + -- (4, 0) + -- (S.out 2) node[right] {$b$}; \end{circuitikz} \end{minted} \CodeResult \begin{circuitikz} \ctikzset{bipoles/cuteswitch/thickness=0.5} \draw (0, 0) -- (0, 3) - to[R=\qty{14.0}{\ohm}] (2, 3) + to[R, l=$R$, a=\qty{14.0}{\ohm}] (2, 3) to[battery2, v^<=\qty{34.0}{\volt}] (3, 3) -- (4, 3); \draw (0, 1.5) -- (2, 1.5) to[C=\qty{6.20}{\micro\farad}] (3, 1.5) - -- (3.35, 1.5) node[right, cute spdt up] (S2) {}; - \draw (4, 3) -- (S2.out 1) node[right] {$a$}; - \draw (S2.out 2) node[right] {$b$} -- (4, 0) - -- (3, 0) - to[L=\qty{54.0}{\milli\henry}] (2, 0) - -- (0,0); + -- (3.35, 1.5) node[right, cute spdt mid] (S) {}; + \draw (4, 3) -- (S.out 1) node[right] {$a$}; + \draw (0, 0) -- (1.8, 0) + to[L=\qty{54.0}{\milli\henry}] (3.2, 0) + -- (4, 0) + -- (S.out 2) node[right] {$b$}; \end{circuitikz} \end{CodeExample} \end{frame} + +%% Tikz-Feynman +\begin{frame}[fragile]{% + Tikz-Feynman + \hfill + \doc{http://mirrors.ctan.org/graphics/pgf/contrib/tikz-feynman/tikz-feynman.pdf}{tikz-feynman} +} + \begin{Packages} + \mintinline{latex}+\usepackage{tikz-feynman}+ + \end{Packages} + \begin{CodeExample}{0.65}[Tree-Graph] + \begin{minted}{latex} + \feynmandiagram [horizontal=a to b] { + i1 -- [fermion] a -- [fermion] i2, + a -- [photon] b, + f1 -- [fermion] b -- [fermion] f2, + }; + \end{minted} + \CodeResult + \feynmandiagram [horizontal=a to b] { + i1 -- [fermion] a -- [fermion] i2, + a -- [photon] b, + f1 -- [fermion] b -- [fermion] f2, + }; + \end{CodeExample} +\end{frame} + +\begin{frame}[fragile]{Tikz-Feynman} + \begin{CodeExample}{0.65}[Tree-Graph] + \begin{minted}{latex} + \feynmandiagram [horizontal=a to b] { + i1 [particle=$\symup{e}^-$] + -- [fermion] a + -- [fermion] i2 [particle=$\symup{e}^+$], + a -- [photon, edge label=$\symup{γ}$] b, + f1 [particle=$\symup{μ}^-$] + -- [fermion] b + -- [fermion] f2 [particle=$\symup{μ}^+$], + }; + \end{minted} + \CodeResult + \feynmandiagram [horizontal=a to b] { + i1 [particle=$\symup{e}^-$] -- [fermion] a -- [fermion] i2 [particle=$\symup{e}^+$], + a -- [photon, edge label=$\symup{γ}$] b, + f2 [particle=$\symup{μ}^+$] -- [fermion] b -- [fermion] f1 [particle=$\symup{μ}^-$], + }; + \end{CodeExample} +\end{frame}