我正在用乳胶制作一个表格,我想在第一行和第二行(开关矢量和 a、b、c)和(输出电压和 Va、Vb、Vc)之间添加更多空间,并且我想在中间有开关矢量和输出电压。
这是乳胶代码:
\usepackage{caption}
\usepackage{array}
\usepackage{booktabs,multirow}
\begin{table}[!ht]
\centering
\vspace{1ex}
\begin{tabular}{|c| p{0.4 cm}| p{0.4 cm}| p{0.4cm}| c | c | c |} \hline
\multirow{3}{*}{
\parbox[c]{.2\linewidth}{\centering Voltage vectors}} &
\multicolumn{3}{l|}{Switching vectors }&
\multicolumn{3}{c|}{Output voltage} \\ \cline{2-7}
\rule{0pt}{4ex}
& a & b & c & Va & Vb & Vc \\ \hline
\rule{0pt}{4ex}
V0& 0 & 0 & 0 & 0 & 0 & 0 \\ \hline
\rule{0pt}{4ex}
V1& 1 & 0 & 0 & 2Udc/3 & -Udc/3 & -Udc/3 \\ \hline
\rule{0pt}{4ex}
V2& 1 & 1 & 0 & Udc/3 & Udc/3 & -2Udc/3 \\ \hline
\rule{0pt}{4ex}
V3& 0& 1 & 0 & -Udc/3 & 2Udc/3 & -Udc/3 \\ \hline
\rule{0pt}{4ex}
V4& 0 & 1 & 1 & -2Udc/3 & Udc/3 & Udc/3 \\ \hline
\rule{0pt}{4ex}
V5& 0 & 0 & 1 & -Udc/3 & -Udc/3 & 2Udc/3 \\ \hline
\rule{0pt}{4ex}
V6& 1 & 0 & 1 & Udc/3 & -2Udc/3 & Udc/3 \\ \hline
\rule{0pt}{4ex}
V7& 1 & 1 & 1 & 0 & 0 & 0\\ \hline
\end{tabular}
\end{table}
答案1
使用bigstrut
随附的包,multirow
您可以在需要更宽间距的行尾执行此命令:
\begin{table}
\centering
\vspace{1ex}
\begin{tabular}{|c| p{0.4 cm}| p{0.4 cm}| p{0.4cm}| c | c | c |}
\hline
\multirow{3}{*}{
\parbox[c]{.2\linewidth}{\centering Voltage vectors}}
& \multicolumn{3}{l|}{Switching vectors }
& \multicolumn{3}{c|}{Output voltage} \bigstrut\\ \cline{2-7}
& a & b & c & Va & Vb & Vc \bigstrut \\ \hline
\rule{0pt}{4ex}
V0& 0 & 0 & 0 & 0 & 0 & 0 \\ \hline
\rule{0pt}{4ex}
V1& 1 & 0 & 0 & 2Udc/3 & -Udc/3 & -Udc/3 \\ \hline
\rule{0pt}{4ex}
V2& 1 & 1 & 0 & Udc/3 & Udc/3 & -2Udc/3 \\ \hline
\rule{0pt}{4ex}
V3& 0& 1 & 0 & -Udc/3 & 2Udc/3 & -Udc/3 \\ \hline
\rule{0pt}{4ex}
V4& 0 & 1 & 1 & -2Udc/3 & Udc/3 & Udc/3 \\ \hline
\rule{0pt}{4ex}
V5& 0 & 0 & 1 & -Udc/3 & -Udc/3 & 2Udc/3 \\ \hline
\rule{0pt}{4ex}
V6& 1 & 0 & 1 & Udc/3 & -2Udc/3 & Udc/3 \\ \hline
\rule{0pt}{4ex}
V7& 1 & 1 & 1 & 0 & 0 & 0\\ \hline
\end{tabular}
\end{table}
\bigstrutjot
通过例如调整\setlength{\bigstrutjot}{4pc}
来获得不同尺寸的间距。
但是,您最好使用booktabs
正在加载的包的想法:
\begin{table}
\centering
\newcommand{\Udc}{U_{\mathrm{dc}}}
\begin{tabular}{c *3{p{0.4cm}} *3{c}}
\toprule
\multirow{2}{*}{Voltage vectors}
& \multicolumn{3}{l}{Switching vectors}
& \multicolumn{3}{c}{Output voltage} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
& a & b & c & Va & Vb & Vc \\
\midrule
V0& 0 & 0 & 0 & $0$ & $0$ & $0$ \\
V1& 1 & 0 & 0 & $2\Udc/3$ & $-\Udc/3$ & $-\Udc/3$ \\
V2& 1 & 1 & 0 & $\Udc/3$ & $\Udc/3$ & $-2\Udc/3$ \\
V3& 0 & 1 & 0 & $-\Udc/3$ & $2\Udc/3$ & $-\Udc/3$ \\
V4& 0 & 1 & 1 & $-2\Udc/3$ & $\Udc/3$ & $\Udc/3$ \\
V5& 0 & 0 & 1 & $-\Udc/3$ & $-\Udc/3$ & $2\Udc/3$ \\
V6& 1 & 0 & 1 & $\Udc/3$ & $-2\Udc/3$ & $\Udc/3$ \\
V7& 1 & 1 & 1 & $0$ & $0$ & $0$ \\
\bottomrule
\end{tabular}
\end{table}
如果需要,您可以添加\renewcommand{\arraystretch}{1.2}
更多内容以增加行间距。请注意,在第二个版本中,我还将电压设置为数学量,以便正确打印减号。
\documentclass{article}
\usepackage{array,booktabs,multirow,bigstrut}
\begin{document}
\begin{table}
\centering
\vspace{1ex}
\begin{tabular}{|c| p{0.4 cm}| p{0.4 cm}| p{0.4cm}| c | c | c |}
\hline
\multirow{3}{*}{
\parbox[c]{.2\linewidth}{\centering Voltage vectors}}
& \multicolumn{3}{l|}{Switching vectors }
& \multicolumn{3}{c|}{Output voltage} \bigstrut\\ \cline{2-7}
& a & b & c & Va & Vb & Vc \bigstrut \\ \hline
\rule{0pt}{4ex}
V0& 0 & 0 & 0 & 0 & 0 & 0 \\ \hline
\rule{0pt}{4ex}
V1& 1 & 0 & 0 & 2Udc/3 & -Udc/3 & -Udc/3 \\ \hline
\rule{0pt}{4ex}
V2& 1 & 1 & 0 & Udc/3 & Udc/3 & -2Udc/3 \\ \hline
\rule{0pt}{4ex}
V3& 0& 1 & 0 & -Udc/3 & 2Udc/3 & -Udc/3 \\ \hline
\rule{0pt}{4ex}
V4& 0 & 1 & 1 & -2Udc/3 & Udc/3 & Udc/3 \\ \hline
\rule{0pt}{4ex}
V5& 0 & 0 & 1 & -Udc/3 & -Udc/3 & 2Udc/3 \\ \hline
\rule{0pt}{4ex}
V6& 1 & 0 & 1 & Udc/3 & -2Udc/3 & Udc/3 \\ \hline
\rule{0pt}{4ex}
V7& 1 & 1 & 1 & 0 & 0 & 0\\ \hline
\end{tabular}
\end{table}
\begin{table}
\centering
\newcommand{\Udc}{U_{\mathrm{dc}}}
\begin{tabular}{c *3{p{0.4cm}} *3{c}}
\toprule
\multirow{2}{*}{Voltage vectors}
& \multicolumn{3}{l}{Switching vectors}
& \multicolumn{3}{c}{Output voltage} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
& a & b & c & Va & Vb & Vc \\
\midrule
V0& 0 & 0 & 0 & $0$ & $0$ & $0$ \\
V1& 1 & 0 & 0 & $2\Udc/3$ & $-\Udc/3$ & $-\Udc/3$ \\
V2& 1 & 1 & 0 & $\Udc/3$ & $\Udc/3$ & $-2\Udc/3$ \\
V3& 0 & 1 & 0 & $-\Udc/3$ & $2\Udc/3$ & $-\Udc/3$ \\
V4& 0 & 1 & 1 & $-2\Udc/3$ & $\Udc/3$ & $\Udc/3$ \\
V5& 0 & 0 & 1 & $-\Udc/3$ & $-\Udc/3$ & $2\Udc/3$ \\
V6& 1 & 0 & 1 & $\Udc/3$ & $-2\Udc/3$ & $\Udc/3$ \\
V7& 1 & 1 & 1 & $0$ & $0$ & $0$ \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
此解决方案仅用于\arraystretch
增加垂直空间。我删除了几个未使用的包。
\documentclass{standalone}
\usepackage{multirow}
\begin{document}
\def\arraystretch{2}%
\begin{tabular}{|c| p{0.4 cm}| p{0.4 cm}| p{0.4cm}| c | c | c |} \hline
\multirow{2}{*}{\centering Voltage vectors} &
\multicolumn{3}{l|}{Switching vectors }&
\multicolumn{3}{c|}{Output voltage} \\ \cline{2-7}
& a & b & c & Va & Vb & Vc \\ \hline
V0& 0 & 0 & 0 & 0 & 0 & 0 \\ \hline
V1& 1 & 0 & 0 & 2Udc/3 & -Udc/3 & -Udc/3 \\ \hline
V2& 1 & 1 & 0 & Udc/3 & Udc/3 & -2Udc/3 \\ \hline
V3& 0& 1 & 0 & -Udc/3 & 2Udc/3 & -Udc/3 \\ \hline
V4& 0 & 1 & 1 & -2Udc/3 & Udc/3 & Udc/3 \\ \hline
\end{tabular}
\end{document}