为什么在类型“X”列中使用“\multicolumn”时会出现不必要的列空间?

为什么在类型“X”列中使用“\multicolumn”时会出现不必要的列空间?

\multicolumn我的两列前面有多余的空格,这是不应该存在的。我认为这个问题与在带有类型列的表中使用有关X

在此处输入图片描述

我的源代码:

\documentclass{IEEEtran}


\usepackage{fontspec}


\usepackage{tabularx}

    \newcolumntype{C}{ >{ \arraybackslash \Centering } X }

    \renewcommand \tabularxcolumn [1] {  >{ \centering } m{#1} }



\renewcommand{\tabularxcolumn}[1]{ >{\centering}m{#1} }


\usepackage{booktabs}

\usepackage{ragged2e}

\usepackage{makecell}

\usepackage{multirow}
\setlength\extrarowheight{10pt}

\usepackage{float}

\usepackage[defaultmathsizes, subdued, italic, LGRgreek, symbolre, symbolmisc]{mathastext}

\newcommand{\multcolhsize}[1]{\dimexpr #1\hsize + #1\tabcolsep + \tabcolsep \relax}

\usepackage{adjustbox}

\begin{document}

\newcommand{\RERInteractionSumm}{\sum_{j \in \mathnormalbold{R}, \thinspace j \neq i} P_{R, \thinspace j}^{\adjustbox{raise=0.1\baselineskip}{*}} \thinspace w_{ij}}

\begin{table*}[htb]

    % Table options

        % Caption
        \caption{Comparison of SDSCR obtained by}
        \label{table:SDSCR_full_v_app_27}

        % Center the table
        \centering


    \begin{tabularx}{\textwidth}{>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=1.35\hsize}C |>{\hsize=1.35\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C}

        \toprule


        $\left| V_{R, \thinspace i} \right|^{2}$ &  $\left| Z_{RR, \thinspace ii} \right|$& $P_{R, \thinspace i}^{\adjustbox{raise=0.05\baselineskip}{*}}$
        & \multicolumn{2}{>{\hsize=\multcolhsize{2}}C|}{
                        $ \displaystyle \RERInteractionSumm$
                                                    }
        & \multicolumn{2}{>{\hsize=\multcolhsize{2}}C|}{
                        $\left| S_{eq, \thinspace i}^{\adjustbox{raise=0.05\baselineskip}{*}} \right|$
                                                        }
        & \multicolumn{2}{>{\hsize=\multcolhsize{2}}C}{$SDSCR_{i}$}
        \\
        \Xhline{0.2mm}


        $0.992$ & $0.0941$ & $3$ & $-1.05-0.095j$ & $-0.95-0.513j$ & $1.95$ & $2.11$ & $5.41$ & $4.99$
        \\


        $0.995$ & $0.0921$ & $3$ & $-1.08-0.108j$ & $-0.97-0.529j$ & $1.92$ & $2.10$ & $5.62$ & $5.16$
        \\


        $0.997$ & $0.0910$ & $3$ & $-1.09-0.115j$ & $-0.98-0.537j$ & $1.91$ & $2.09$ & $5.73$ & $5.25$
        \\

        $0.999$ & $0.0900$ & $3$ & $-1.11-0.124j$ & $-1.00-0.547j$ & $1.90$ & $2.08$ & $5.86$ & $5.35$
        \\


        $1.001$ & $0.0886$ & $3$ & $-1.12-0.132j$ & $-1.01-0.557j$ & $1.88$ & $2.07$ & $6.01$ & $5.46$
        \\

        $1.003$ & $0.0872$ & $3$ & $-1.14-0.143j$ & $-1.02-0.569j$ & $1.86$ & $2.06$ & $6.16$ & $5.58$
        \\

        $1.005$ & $0.0858$ & $3$ & $-1.16-0.154j$ & $-1.04-0.582j$ & $1.85$ & $2.05$ & $6.34$ & $5.72$
        \\

        $1.007$ & $0.0843$ & $3$ & $-1.18-0.166j$ & $-1.06-0.596j$ & $1.83$ & $2.04$ & $6.54$ & $5.87$
        \\

        $1.009$ & $0.0827$ & $3$ & $-1.21-0.180j$ & $-1.07-0.612j$ & $1.80$ & $2.02$ & $6.77$ & $6.04$
        \\

        $1.011$ & $0.0809$ & $3$ & $-1.23-0.196j$ & $-1.09-0.630j$ & $1.78$ & $2.01$ & $7.02$ & $6.23$
        \\

        \bottomrule



    \end{tabularx}

\end{table*}


\end{document}

答案1

  • 使用tabularx环境来处理手头的表格似乎有点大材小用。此外,tabularx环境的标志性功能之一就是,自动换行,从未使用过。我建议您使用array环境,或者,如果表格必须绝对、肯定地跨越两列的宽度,tabular*则使用环境。无论使用哪种环境,都无需计算单元格宽度等。

  • 我还想建议您省略所有垂直线(它们是不需要的),并且不要那么慷慨地使用 的值\extrarowheight

    在此处输入图片描述


\documentclass{IEEEtran}

\usepackage{fontspec}
\usepackage{array,ragged2e,booktabs,float}
\newcolumntype{C}{>{\Centering\arraybackslash} X }
\setlength\extrarowheight{4pt}

\usepackage[defaultmathsizes, subdued, italic, 
    LGRgreek, symbolre, symbolmisc]{mathastext}
\newcommand{\RERInteractionSumm}{%
   \sum_{j\in\mathbf{R},j\neq i} P_{R,j}^* w_{ij}}

\begin{document}
\begin{table*}[htb]
\caption{Comparison of SDSCR obtained by...}
\label{table:SDSCR_full_v_app_27}

\centering
%% First version: use an 'array' env.

$\begin{array}{@{} *{9}{c} @{}}
\toprule
| V_{R,i}|^{2} & | Z_{RR,ii}| & P_{R,i}^* & 
\multicolumn{2}{c}{\displaystyle\RERInteractionSumm}& 
\multicolumn{2}{c}{| S_{eq,  i}^*|}& 
\multicolumn{2}{c@{}}{\mathrm{SDSCR}_{i}}
\\
\cmidrule(r){1-1}
\cmidrule(lr){2-2}
\cmidrule(lr){3-3}
\cmidrule(lr){4-5}
\cmidrule(lr){6-7}
\cmidrule(l){8-9}
0.992 & 0.0941 & 3 & -1.05-0.095j & -0.95-0.513j & 1.95 & 2.11 & 5.41 & 4.99
\\
0.995 & 0.0921 & 3 & -1.08-0.108j & -0.97-0.529j & 1.92 & 2.10 & 5.62 & 5.16
\\
0.997 & 0.0910 & 3 & -1.09-0.115j & -0.98-0.537j & 1.91 & 2.09 & 5.73 & 5.25
\\
0.999 & 0.0900 & 3 & -1.11-0.124j & -1.00-0.547j & 1.90 & 2.08 & 5.86 & 5.35
\\
1.001 & 0.0886 & 3 & -1.12-0.132j & -1.01-0.557j & 1.88 & 2.07 & 6.01 & 5.46
\\
1.003 & 0.0872 & 3 & -1.14-0.143j & -1.02-0.569j & 1.86 & 2.06 & 6.16 & 5.58
\\
1.005 & 0.0858 & 3 & -1.16-0.154j & -1.04-0.582j & 1.85 & 2.05 & 6.34 & 5.72
\\
1.007 & 0.0843 & 3 & -1.18-0.166j & -1.06-0.596j & 1.83 & 2.04 & 6.54 & 5.87
\\
1.009 & 0.0827 & 3 & -1.21-0.180j & -1.07-0.612j & 1.80 & 2.02 & 6.77 & 6.04
\\
1.011 & 0.0809 & 3 & -1.23-0.196j & -1.09-0.630j & 1.78 & 2.01 & 7.02 & 6.23
\\
\bottomrule
\end{array}$

\vspace{1cm}

%%% Second version: use a 'tabular*' env.
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} *{9}{c} }
\toprule
$| V_{R,i}|^{2}$ & $| Z_{RR,ii}|$ & $P_{R,i}^*$ & 
\multicolumn{2}{c}{$\displaystyle\RERInteractionSumm$}& 
\multicolumn{2}{c}{$| S_{eq,  i}^*|$}& 
\multicolumn{2}{c}{$\mathrm{SDSCR}_{i}$}
\\
\cmidrule{1-1}
\cmidrule{2-2}
\cmidrule{3-3}
\cmidrule{4-5}
\cmidrule{6-7}
\cmidrule{8-9}
$0.992$ & $0.0941$ & $3$ & $-1.05-0.095j$ & $-0.95-0.513j$ & $1.95$ & $2.11$ & $5.41$ & $4.99$
\\
$0.995$ & $0.0921$ & $3$ & $-1.08-0.108j$ & $-0.97-0.529j$ & $1.92$ & $2.10$ & $5.62$ & $5.16$
\\
$0.997$ & $0.0910$ & $3$ & $-1.09-0.115j$ & $-0.98-0.537j$ & $1.91$ & $2.09$ & $5.73$ & $5.25$
\\
$0.999$ & $0.0900$ & $3$ & $-1.11-0.124j$ & $-1.00-0.547j$ & $1.90$ & $2.08$ & $5.86$ & $5.35$
\\
$1.001$ & $0.0886$ & $3$ & $-1.12-0.132j$ & $-1.01-0.557j$ & $1.88$ & $2.07$ & $6.01$ & $5.46$
\\
$1.003$ & $0.0872$ & $3$ & $-1.14-0.143j$ & $-1.02-0.569j$ & $1.86$ & $2.06$ & $6.16$ & $5.58$
\\
$1.005$ & $0.0858$ & $3$ & $-1.16-0.154j$ & $-1.04-0.582j$ & $1.85$ & $2.05$ & $6.34$ & $5.72$
\\
$1.007$ & $0.0843$ & $3$ & $-1.18-0.166j$ & $-1.06-0.596j$ & $1.83$ & $2.04$ & $6.54$ & $5.87$
\\
$1.009$ & $0.0827$ & $3$ & $-1.21-0.180j$ & $-1.07-0.612j$ & $1.80$ & $2.02$ & $6.77$ & $6.04$
\\
$1.011$ & $0.0809$ & $3$ & $-1.23-0.196j$ & $-1.09-0.630j$ & $1.78$ & $2.01$ & $7.02$ & $6.23$
\\
\bottomrule
\end{tabular*}
\end{table*}

\end{document}

相关内容