在文档中,我想垂直对齐单元格文本。唯一的问题是我的数组包含在 begin {circuitikz} 中,所以我能做的几个测试(特别是 begin {center})不起作用。
你能帮助我吗 ?
\documentclass[border=2mm]{standalone}
usepackage{multirow}
\usepackage[utf8]{inputenc}
\usepackage[siunitx, european, straightvoltages, RPvoltages]{circuitikz}
\begin {document}
\begin{circuitikz}
\node at (0,0)
{\begin{tabular}{|c|c|c|c|}
\hline
Type & Composant & Code & Image résultant\\
\hline
\multirow{7}{*}{Alimentation} & pile & to[battery1] & \begin{circuitikz} \draw (0,0) to[battery1] (2,0);\end{circuitikz} \\
\cline{2-4}
& source de courant & to[isource] & \begin{circuitikz} \draw (0,0) to[isource] (2,0);\end{circuitikz} \\
\cline{2-4}
& source de tension & to[vsource] & \begin{circuitikz} \draw (0,0) to[vsource] (2,0);\end{circuitikz} \\
\cline{2-4}
& source sinusoidale & to[sV] ou to[vsourcesin] & \begin{circuitikz} \draw (0,0) to[sV] (2,0);\end{circuitikz} \\
\cline{2-4}
& source sinusoidale & to[sV] ou to[vsourcesin] & \begin{circuitikz} \draw (0,0) to[sV] (2,0);\end{circuitikz} \\
\cline{2-4}
& source créneau & to[sqV] ou to[vsourcesquare] & \begin{circuitikz} \draw (0,0) to[sqV] (2,0);\end{circuitikz} \\
\cline{2-4}
& source triangulaire & to[tV] ou to[vsourcetri] & \begin{circuitikz} \draw (0,0) to[tV] (2,0);\end{circuitikz} \\
\hline
\end{tabular}
};
\end{document}
答案1
我想知道,为什么在 TikZ 节点中插入此表?删除它并调整图像基线可得到:
\documentclass[border=2mm]{standalone}
\usepackage{makecell, multirow}
\usepackage[siunitx, european, straightvoltages, RPvoltages]{circuitikz}
\begin{document}
\begingroup
\makegapedcells
\setcellgapes{3pt}
\tikzset{every picture/.style={baseline=-0.5ex}}
\begin{tabular}{|c|c|c|c|}
\hline
Type & Composant & Code & Image résultant\\
\hline
\multirow{16}{*}{Alimentation}
& pile & to[battery1] & \begin{circuitikz}
\draw (0,0) to[battery1] (2,0);
\end{circuitikz} \\
\cline{2-4}
& source de courant
& to[isource] & \begin{circuitikz}
\draw (0,0) to[isource] (2,0);
\end{circuitikz} \\
\cline{2-4}
& source de tension
& to[vsource] & \begin{circuitikz}
\draw (0,0) to[vsource] (2,0);
\end{circuitikz} \\
\cline{2-4}
& source sinusoidale
& to[sV] ou to[vsourcesin]
& \begin{circuitikz}
\draw (0,0) to[sV] (2,0);
\end{circuitikz} \\
\cline{2-4}
& source sinusoidale
& to[sV] ou to[vsourcesin]
& \begin{circuitikz}
\draw (0,0) to[sV] (2,0);
\end{circuitikz} \\
\cline{2-4}
& source créneau
& to[sqV] ou to[vsourcesquare]
& \begin{circuitikz}
\draw (0,0) to[sqV] (2,0);
\end{circuitikz} \\
\cline{2-4}
& source triangulaire
& to[tV] ou to[vsourcetri]
& \begin{circuitikz}
\draw (0,0) to[tV] (2,0);
\end{circuitikz} \\
\hline
\end{tabular}
\endgroup
\end{document}