Tikz: Arranging of a Table with Tikz elements
You can nest tabulars.
\documentclass[11pt,a4paper,DIV=calc]{scrartcl}
\usepackage{tikz}
\usepackage[europeanresistors,americaninductors,straightvoltages]{circuitikz}
\usepackage{amsmath,amssymb,amsthm}
\begin{document}
\begin{table}
\centering
\tikzset{baseline={([yshift=-0.5ex]current bounding box.center)}}% fixed position of current bounding box
\begin{tabular}{|c|c|c|}
\hline
Bauteil:
& Schaltbild:
& Ersatzschaltbild:
\\
\hline
Kondensator:
& \begin{circuitikz}
\draw (0,0) to [C,o-o] (2,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [C,l=$C$,o-] (2,0)
to [R,l=$r_\mathrm{C}$,-o] (4,0);
\end{circuitikz}
\\ \hline
Spule:
& \begin{circuitikz}
\draw (0,0) to [L,o-o] (2,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [L,l=$L$,o-] (2,0)
to [R,l=$r_\mathrm{L}$,-o] (4,0);
\end{circuitikz}
\\ \hline
Diode:
& \begin{circuitikz}
\draw (0,0) to [D*,o-o] (2,0);
\end{circuitikz}
& \begin{tabular}{cc}
leitend &
sperrend\\
\begin{circuitikz}
\draw (0,0) to [V=$U_D$,o-] (2,0)
to [R,l=$r_\mathrm{D}$,-o] (4,0);
\end{circuitikz} & \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\end{tabular}\\ \hline
MOSFET:
& \begin{circuitikz}
\draw (0,0) to node[nigfete,rotate=90,scale=0.85](nigfet){} (0,0);
\end{circuitikz}
& \begin{tabular}{cc} leitend &
sperrend \\
\begin{circuitikz}
\draw (0,0) to [R,l=$R_{\mathrm{on}}$,o-o] (2,0);
\end{circuitikz} & \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\end{tabular}
\\ \hline
IGBT:
& \begin{circuitikz}
\draw (0,0) to node[nigbt,rotate=90](nigigbt2){} (0,0);
\end{circuitikz}
& \begin{tabular}{cc} leitend &
sperrend \\ \begin{circuitikz}
\draw (0,0) to [V=$U_\mathrm{D}$,o-] (2,0)
to [R,l=$r_{\mathrm{S}}$,-o] (4,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\end{tabular}
\\ \hline
\end{tabular}
\captionof{table}{Elektronische Bauelemente und deren Ersatzschaltbilder}
\label{tab:ESB}
\end{table}
\end{document}
In order to properly align the circuits, you may want to put both in one circuitikz
and work with local bounding boxes. This allows you to center things according to the circuitikz
rules, i.e. align the circuits.
\documentclass[11pt,a4paper,DIV=calc]{scrartcl}
\usepackage{tikz}
\usepackage[europeanresistors,americaninductors,straightvoltages]{circuitikz}
\usetikzlibrary{calc}
\usepackage{amsmath,amssymb,amsthm}
\begin{document}
\begin{table}
\centering
\begingroup
\tikzset{baseline={([yshift=-0.5ex]current bounding box.center)},every
picture/.append style={execute at end picture={\path (current bounding
box.north) -- ++ (0,2pt) (current bounding
box.south) -- ++ (0,-2pt);}}}% fixed position of current bounding box
\begin{tabular}{|c|c|c|}
\hline
Bauteil:
& Schaltbild:
& Ersatzschaltbild:
\\
\hline
Kondensator:
& \begin{circuitikz}
\draw (0,0) to [C,o-o] (2,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [C,l=$C$,o-] (2,0)
to [R,l=$r_\mathrm{C}$,-o] (4,0);
\end{circuitikz}
\\ \hline
Spule:
& \begin{circuitikz}
\draw (0,0) to [L,o-o] (2,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [L,l=$L$,o-] (2,0)
to [R,l=$r_\mathrm{L}$,-o] (4,0);
\end{circuitikz}
\\ \hline
Diode:
& \begin{circuitikz}
\draw (0,0) to [D*,o-o] (2,0);
\end{circuitikz}
&
\begin{circuitikz}
\begin{scope}[local bounding box=leitend]
\draw (0,0) to [V=$U_D$,o-] (2,0)
to [R,l=$r_\mathrm{D}$,-o] (4,0);
\end{scope}
\path let \p1=($(leitend.east)-(leitend.west)$) in
\pgfextra{\xdef\mywidth{\x1}};
\begin{scope}[local bounding box=sperrend,xshift=\mywidth/2+2.6cm]
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{scope}
\path (leitend.north) node[above]{leitend} (sperrend|-leitend.north)
node[above]{sperrend};
\end{circuitikz}
\\ \hline
MOSFET:
& \begin{circuitikz}
\draw (0,0) to node[nigfete,rotate=90,scale=0.85](nigfet){} (0,0);
\end{circuitikz}
&
\begin{circuitikz}
\begin{scope}[local bounding box=leitend]
\draw (0,0) to [R,l=$R_{\mathrm{on}}$,o-o] (2,0);
\end{scope}
\path let \p1=($(leitend.east)-(leitend.west)$) in
(leitend.center) --++ (-\mywidth/2,0)
\pgfextra{\xdef\mywidth{\x1}};
\begin{scope}[local bounding box=sperrend,xshift=\mywidth/2+2.6cm]
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{scope}
\path (leitend.north) node[above]{leitend} (sperrend|-leitend.north)
node[above]{sperrend};
\end{circuitikz}
\\ \hline
IGBT: & \begin{circuitikz}
\draw (0,0) to node[nigbt,rotate=90](nigigbt2){} (0,0);
\end{circuitikz}
& \begin{circuitikz}
\begin{scope}[local bounding box=leitend]
\draw (0,0) to [V=$U_\mathrm{D}$,o-] (2,0)
to [R,l=$r_{\mathrm{S}}$,-o] (4,0);
\end{scope}
\path let \p1=($(leitend.east)-(leitend.west)$) in
\pgfextra{\xdef\mywidth{\x1}};
\begin{scope}[local bounding box=sperrend,xshift=\mywidth/2+2.6cm]
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{scope}
\path (leitend.north) node[above]{leitend} (sperrend|-leitend.north)
node[above]{sperrend};
\end{circuitikz}
\\ \hline
\end{tabular}\endgroup
\captionof{table}{Elektronische Bauelemente und deren Ersatzschaltbilder}
\label{tab:ESB}
\end{table}
\end{document}
Here is a different version using \multicolumn
and \multirow
as well as 4 instead of 3 columns:
\documentclass[11pt,a4paper,DIV=calc]{scrartcl}
\usepackage{tikz}
\usepackage[europeanresistors,americaninductors,straightvoltages]{circuitikz}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{multirow}
\begin{document}
\begin{table}
\centering
\tikzset{baseline={([yshift=-0.5ex]current bounding box.center)}}% fixed position of current bounding box
\begin{tabular}{|c|c|cc|}
\hline
Bauteil:
& Schaltbild:
& \multicolumn{2}{c|}{Ersatzschaltbild:}
\\
\hline
Spule:
& \begin{circuitikz}
\draw (0,0) to [L,o-o] (2,0);
\end{circuitikz}
& \multicolumn{2}{c|}{\begin{circuitikz}
\draw (0,0) to [L,l=$L$,o-] (2,0)
to [R,l=$r_\mathrm{L}$,-o] (4,0);
\end{circuitikz}}
\\ \hline
\multirow{4}{*}{Diode:}
& \multirow{4}{*}{\begin{circuitikz}
\draw (0,0) to [D*,o-o] (2,0);
\end{circuitikz}}
& leitend:
& sperrend:\\
&& \begin{circuitikz}
\draw (0,0) to [V=$U_D$,o-] (2,0)
to [R,l=$r_\mathrm{D}$,-o] (4,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
\end{tabular}
\captionof{table}{Elektronische Bauelemente und deren Ersatzschaltbilder}
\label{tab:ESB}
\end{table}
\end{document}
Here is the code for the complete table:
\documentclass[11pt,a4paper,DIV=calc]{scrartcl}
\usepackage{tikz}
\usepackage[europeanresistors,americaninductors,straightvoltages]{circuitikz}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{multirow}
\begin{document}
\begin{table}
\centering
\tikzset{baseline={([yshift=-0.5ex]current bounding box.center)}}% fixed position of current bounding box
\begin{tabular}{|c|c|cc|}
\hline
Bauteil:
& Schaltbild:
& \multicolumn{2}{c|}{Ersatzschaltbild:}
\\
\hline
Kondensator:
& \begin{circuitikz}
\draw (0,0) to [C,o-o] (2,0);
\end{circuitikz}
& \multicolumn{2}{c|}{\begin{circuitikz}
\draw (0,0) to [C,l=$C$,o-] (2,0)
to [R,l=$r_\mathrm{C}$,-o] (4,0);
\end{circuitikz}}
\\ \hline
Spule:
& \begin{circuitikz}
\draw (0,0) to [L,o-o] (2,0);
\end{circuitikz}
& \multicolumn{2}{c|}{\begin{circuitikz}
\draw (0,0) to [L,l=$L$,o-] (2,0)
to [R,l=$r_\mathrm{L}$,-o] (4,0);
\end{circuitikz}}
\\ \hline
\multirow{4}{*}{Diode:}
& \multirow{4}{*}{\begin{circuitikz}
\draw (0,0) to [D*,o-o] (2,0);
\end{circuitikz}}
& leitend:
& sperrend:\\
&& \begin{circuitikz}
\draw (0,0) to [V=$U_D$,o-] (2,0)
to [R,l=$r_\mathrm{D}$,-o] (4,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
\multirow{3}{*}{MOSFET:}
& \multirow{3}{*}{\begin{circuitikz}
\draw (0,0) to node[nigfete,rotate=90,scale=0.85](nigfet){} (0,0);
\end{circuitikz}}
& leitend:
& sperrend:\\
&& \begin{circuitikz}
\draw (0,0) to [R,l=$R_{\mathrm{on}}$,o-o] (2,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
\multirow{4}{*}{IGBT:}
& \multirow{4}{*}{\begin{circuitikz}
\draw (0,0) to node[nigbt,rotate=90](nigigbt2){} (0,0);
\end{circuitikz}}
& leitend:
& sperrend:\\
&& \begin{circuitikz}
\draw (0,0) to [V=$U_\mathrm{D}$,o-] (2,0)
to [R,l=$r_{\mathrm{S}}$,-o] (4,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
\end{tabular}
\captionof{table}{Elektronische Bauelemente und deren Ersatzschaltbilder}
\label{tab:ESB}
\end{table}
\end{document}
With the help of the cellspace
package you can also add a little bit of white space on the inside of each cell in order to prevent the images from overlapping with the horizontal lines. With the help of \tikzset{baseline={([yshift=0.5ex]0,0)}}
, the two tikzpictures can also be aligned with respect to the horizontal lines, as suggested by John Kormylo and Schrödinger's cat.
\documentclass[11pt,a4paper,DIV=calc]{scrartcl}
\usepackage{tikz}
\usepackage[europeanresistors,americaninductors,straightvoltages]{circuitikz}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{multirow}
\usepackage{array,cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}
\begin{document}
\begin{table}
\centering
\tikzset{baseline={([yshift=0.5ex]0,0)}}
\begin{tabular}{|Sc|Sc|ScSc|}
\hline
Bauteil:
& Schaltbild:
& \multicolumn{2}{Sc|}{Ersatzschaltbild:}
\\
\hline
Kondensator:
& \begin{circuitikz}
\draw (0,0) to [C,o-o] (2,0);
\end{circuitikz}
& \multicolumn{2}{Sc|}{\begin{circuitikz}
\draw (0,0) to [C,l=$C$,o-] (2,0)
to [R,l=$r_\mathrm{C}$,-o] (4,0);
\end{circuitikz}}
\\ \hline
Spule:
& \begin{circuitikz}
\draw (0,0) to [L,o-o] (2,0);
\end{circuitikz}
& \multicolumn{2}{Sc|}{\begin{circuitikz}
\draw (0,0) to [L,l=$L$,o-] (2,0)
to [R,l=$r_\mathrm{L}$,-o] (4,0);
\end{circuitikz}}
\\ \hline
\multirow{5}{*}{Diode:}
& \multirow{5}{*}{\begin{circuitikz}
\draw (0,0) to [D*,o-o] (2,0);
\end{circuitikz}}
& leitend:
& sperrend:\\
&& \begin{circuitikz}
\draw (0,0) to [V=$U_D$,o-] (2,0)
to [R,l=$r_\mathrm{D}$,-o] (4,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
\multirow{4}{*}{MOSFET:}
& \multirow{4}{*}{\begin{circuitikz}
\draw (0,0) to node[nigfete,rotate=90,scale=0.85](nigfet){} (0,0);
\end{circuitikz}}
& leitend:
& sperrend:\\
&& \begin{circuitikz}
\draw (0,0) to [R,l=$R_{\mathrm{on}}$,o-o] (2,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
\multirow{5}{*}{IGBT:}
& \multirow{5}{*}{\begin{circuitikz}
\draw (0,0) to node[nigbt,rotate=90](nigigbt2){} (0,0);
\end{circuitikz}}
& leitend:
& sperrend:\\
&& \begin{circuitikz}
\draw (0,0) to [V=$U_\mathrm{D}$,o-] (2,0)
to [R,l=$r_{\mathrm{S}}$,-o] (4,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
\end{tabular}
\captionof{table}{Elektronische Bauelemente und deren Ersatzschaltbilder}
\label{tab:ESB}
\end{table}
\end{document}
This addresses the vertical alignment, specifically aligning the leads instead of the boxes. There are a number of ways to add space at the borders. \arraystretch
is a built in feature of tabular and (when large enough) makes every row the same height.
\documentclass[11pt,a4paper,DIV=calc]{scrartcl}
\usepackage{tikz}
\usepackage[europeanresistors,americaninductors,straightvoltages]{circuitikz}
\usepackage{amsmath,amssymb,amsthm}
\begin{document}
\begin{table}
\centering
\tikzset{baseline={(0,-0.5ex)}}% fixed position of current bounding box
\def\arraystretch{3}%
\begin{tabular}{|c|c|c|}
\hline
Bauteil:
& Schaltbild:
& Ersatzschaltbild:
\\
\hline
Kondensator:
& \begin{circuitikz}
\draw (0,0) to [C,o-o] (2,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [C,l=$C$,o-] (2,0)
to [R,l=$r_\mathrm{C}$,-o] (4,0);
\end{circuitikz}
\\ \hline
Spule:
& \begin{circuitikz}
\draw (0,0) to [L,o-o] (2,0);
\end{circuitikz}
& \begin{circuitikz}
\draw (0,0) to [L,l=$L$,o-] (2,0)
to [R,l=$r_\mathrm{L}$,-o] (4,0);
\end{circuitikz}
\\ \hline
Diode:
& \begin{circuitikz}
\draw (0,0) to [D*,o-o] (2,0);
\end{circuitikz}
& leitend: \begin{circuitikz}
\draw (0,0) to [V=$U_D$,o-] (2,0)
to [R,l=$r_\mathrm{D}$,-o] (4,0);
\end{circuitikz}
sperrend: \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
MOSFET:
& \begin{circuitikz}
\draw (0,0) to node[nigfete,rotate=90,scale=0.85](nigfet){} (0,0);
\end{circuitikz}
& leitend: \begin{circuitikz}
\draw (0,0) to [R,l=$R_{\mathrm{on}}$,o-o] (2,0);
\end{circuitikz}
sperrend: \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
IGBT:
& \begin{circuitikz}
\draw (0,0) to node[nigbt,rotate=90](nigigbt2){} (0,0);
\end{circuitikz}
& leitend: \begin{circuitikz}
\draw (0,0) to [V=$U_\mathrm{D}$,o-] (2,0)
to [R,l=$r_{\mathrm{S}}$,-o] (4,0);
\end{circuitikz}
sperrend: \begin{circuitikz}
\draw (0,0) to [short,-o] (0.5,0);
\draw (1,0) to [short,o-] (1.5,0);
\end{circuitikz}
\\ \hline
\end{tabular}
\captionof{table}{Elektronische Bauelemente und deren Ersatzschaltbilder}
\label{tab:ESB}
\end{table}
\end{document}