加宽表格中的某些列

加宽表格中的某些列

我想让电压输出中的 Valpha 和 Vbeta 列更宽,同时减小电压编号列的宽度。代码如下:

\documentclass[review]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.gif,.jpg}

\usepackage{lineno,hyperref}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath, nccmath}
\usepackage{cclicenses}
\usepackage{caption}
\usepackage{lscape}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{framed} % Framing content
\usepackage{nomencl} % Nomenclature package
\usepackage{hyperref}
\usepackage{booktabs,multirow}
%\usepackage[noabbrev,nameinlink]{cleveref}
\usepackage[nameinlink]{cleveref}
\makenomenclature
\setlength{\nomitemsep}{-\parskip} % Baseline skip between items
\modulolinenumbers[5]
\begin{document}
\begin{table}[!ht]
\centering
\begin{tabular}{c| p{0.6cm} | p{0.6cm}| p{0.6cm} | p{1.0cm}| p{1.0cm} | c | 
c } \hline \hline
\multicolumn 1 {c|}{Voltage $N^{\circ}$} &
\multicolumn {3} {c|}{\centering Switching states } &
\multicolumn 2 {c|}{Voltage output} &
\multicolumn 1 {c|}{Magnitude} &
\multicolumn 1 {c}{Phase} \\   \hline \hline
$V_n$ & \centering$S_a$ &\centering $ S_b$ & \centering$ S_c$ & $\: \: \: 
\:V_{\alpha}$ & $\: \: \: \:V_{\beta}$ & $U_{ref}$ & $\alpha$ \\ \hline
$V_{1p}$  &  \centering 1 & \centering 0 & \centering 0 & $U_{dc}$/3  
&\centering0 & $U_{dc}$/3 & 0 \\
$V_{1n}$  &  \centering 0 & \centering -1 & \centering -1 & $U_{dc}$/3  
&\centering0 & $U_{dc}$/3 & 0 \\
$V_{2p}$  &  \centering 1 & \centering 1 & \centering 0 & $U_{dc}$/6  
&\centering$\sqrt{3}$ $\frac{U_{dc}}{6}$  & $U_{dc}$/3 & $\pi/3$ \\
\end{tabular}
\end{table} 
\end{document}

从下图可以看出,我无法在最后一行 Vbeta 中写出所有的表达式

在此处输入图片描述

答案1

通过定义列类型的居中版本,可以大大简化表格代码p。而且,由于您正在加载booktabs包,我还建议您使用它的宏来使表格看起来更加开放和易于阅读。

在此处输入图片描述

\documentclass[review]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.gif,.jpg}

\usepackage{lineno}
\modulolinenumbers[5]
\usepackage{graphicx}
\usepackage{amssymb,amsmath,nccmath}
\usepackage{cclicenses}
%%\usepackage{caption} % is loaded automatically by 'subcaption'
\usepackage{lscape,array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} % centered 'p' col.
%%\usepackage{natbib} % is loaded automatically by elsarticle doc class
\usepackage{subcaption}
\usepackage{framed}  % Framing content
\usepackage{nomencl} % Nomenclature package
\makenomenclature
\setlength{\nomitemsep}{-\parskip}\usepackage{booktabs,multirow}

%% Load the next two packages *last*:
\usepackage[colorlinks]{hyperref}
\usepackage[nameinlink]{cleveref}

\begin{document}
\begin{table}[!ht]
\centering
\begin{tabular}{@{} c *{3}{C{0.6cm}} *{2}{C{1.5cm}} c c @{}} 
\toprule
Voltage N\textsuperscript{o} & \multicolumn{3}{c}{Switching states} & 
\multicolumn{2}{c}{Voltage output} & Magnitude & Phase \\   
\cmidrule(lr){2-4} \cmidrule(lr){5-6}
$V_n$ & $S_a$ & $S_b$ & $S_c$ & $V_{\alpha}$ & $V_{\beta}$ & $U_{\mathrm{ref}}$ & $\alpha$ \\ 
\midrule
$V_{1p}$ & 1 & 0    & 0    & $U_{dc}/3$ & 0                    & $U_{dc}/3$ & 0 \\
$V_{1n}$ & 0 & $-1$ & $-1$ & $U_{dc}/3$ & 0                    & $U_{dc}/3$ & 0 \\
$V_{2p}$ & 1 & 1    & 0    & $U_{dc}/6$ & $\sqrt{3}\,U_{dc}/6$ & $U_{dc}/3$ & $\pi/3$ \\
\bottomrule
\end{tabular}
\end{table} 
\end{document}

相关内容