为什么我在表格中使用“\morecmidrules”时水平线未对齐?

为什么我在表格中使用“\morecmidrules”时水平线未对齐?

我正在尝试绘制一张带有两条独立双线的大表格。尽管它们是分开的,但我希望它们垂直对齐在一起。

这是我得到的输出:

在此处输入图片描述

我的源代码:

\documentclass[]{IEEEtran}



\usepackage{amsmath}

\usepackage{ragged2e}
\usepackage{tabularx}
\usepackage{booktabs}
\newcolumntype{C}{ >{ \arraybackslash \Centering } X }

\usepackage{adjustbox}
\usepackage{float}
\restylefloat{table}



\begin{document}



\begin{table*}[]

    \caption{Comparison of STC Simulation Accuracy Results for This Work and Ref. }
    \label{table:PV_mod_STC_comp}
    \centering
    \renewcommand{\arraystretch}{1.3}



    \begin{tabularx}{1\textwidth}{c| *{5}{|C} *{1}{C} *{4}{|C} *{1}{C}}



        \toprule



        & \multicolumn{5}{c}{\textbf{This Work}}  & \multicolumn{5}{c}{\textbf{Ref.}}
        \\
        \cmidrule(lr){2-6} \morecmidrules \cmidrule(lr){2-6}
        \cmidrule(lr){7-11} \morecmidrules \cmidrule(lr){7-11}



        & c-Si & a-Si:H & CIGS & Si:H/$\mu$C & CdTe/CdS & c-Si & a-Si:H & CIGS & Si:H/$\mu$C & CdTe/CdS
        \\
        \midrule



        & \rotatebox[]{90}{ LG250S1C  } & \rotatebox[]{90}{P-LE055} & \rotatebox[]{90}{TS-155C2} & \rotatebox[]{90}{U-EA110} & \rotatebox[]{90}{FS 380} & \rotatebox[]{90}{  LG250S1C  } & \rotatebox[]{90}{P-LE055} & \rotatebox[]{90}{TS-155C2} & \rotatebox[]{90}{U-EA110} & \rotatebox[]{90}{FS 380} 
        \\
        \midrule


        \textbf{STC} & \multicolumn{10}{c}{\textbf{Simulated Values}}
        \\
        \midrule


        $P_{mp}$  & $250.3$ &  $55$ &  $155$ & $111$ & $80.1$ & $263.9$ & $64$ & $167.5$ & $126.2$ & $78$
        \\


        $V_{mp}$ & $30$ &  $16.5$ &  $65.6$ & $53$ & $48.8$ & $31.4$ & $16.7$ & $69.7$ & $56.4$ & $47.2$
        \\


        $I_{mp}$ & $8.33$ &  $3.33$ &  $2.36$ & $2.09$ & $1.64$ & $8.39$ & $3.83$ & $2.41$ & $2.24$ & $1.65$
        \\


        $V_{oc}$  & $37.6$ &  $23.1$ &  $87$ & $71.1$ & $60.9$ & $37.6$ & $23$ & $86.9$ & $71$ & $60.8$
        \\


        \midrule
        \textbf{STC} & \multicolumn{10}{c}{\textbf{PARE}}
        \\
        \midrule


        $P_{mp}$  & $0.12$ &  $0$ &  $0$ & $0.91$ & $0.13$ & $5.56$ & $16.3$ & $8.1$ & $14.8$ & $2.45$
        \\


        $V_{mp}$ & $0.67$ &  $0$ &  $1.6$ & $1.9$ & $0.62$ & $5.51$ & $1.23$ & $7.9$ & $4.4$ & $2.63$
        \\


        $I_{mp}$ & $0.72$ &  $0$ &  $1.7$ & $2.5$ & $0.61$ & $0.04$ & $15$ & $0.19$ & $9.8$ & $0.15$
        \\


        $V_{oc}$  & $0$ &  $0.43$ &  $0.12$ & $0.14$ & $0.16$ & $0.1$ & $0$ & $0$ & $0$ & $0$
        \\

        \bottomrule



    \end{tabularx}


\end{table*}



\end{document}

答案1

你想要左右规则,然后是垂直间隙,然后再次是左右规则,所以

    \\
    \cmidrule(lr){2-6}  \cmidrule(lr){7-11}
    \morecmidrules
    \cmidrule(lr){2-6}  \cmidrule(lr){7-11}

在此处输入图片描述

答案2

无关:

  • 垂直规则与水平规则配合不好booktabs。因此我建议删除它们
  • 如果列中的数字在小数点处对齐,则印象会更好
  • 我不会使用tabularx环境,而是使用 basectabular

考虑到上面的表格变成:

在此处输入图片描述

\documentclass{IEEEtran}
\usepackage{amsmath}

\usepackage{ragged2e}
\usepackage{rotating}   % <--- added
\usepackage{booktabs,
            makecell,   % <--- added
            tabularx}   % <--- in table example is not used
\newcolumntype{C}{>{\Centering} X }
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\setcellgapes{1pt}
\usepackage{siunitx}    % for SI units and S table column type

%\usepackage{adjustbox} % <--- don't use
%\usepackage{float}     % <--- don't use
%\restylefloat{table}

\begin{document}
    \begin{table*}
\caption{Comparison of STC Simulation Accuracy Results for This Work and Ref. }
    \label{table:PV_mod_STC_comp}
    \centering
%    \renewcommand{\arraystretch}{1.3}
    \settowidth\rotheadsize{LG250S1C}
    \makegapedcells
\begin{tabular}{>{$}c<{$}
                %*{5}{|C} *{1}{C} *{4}{|C} *{1}{C}} % <-- your definitions, very strange 
                *{10}{S[table-format=3.2]}
                             }
    \toprule
        & \multicolumn{5}{c}{\thead{This Work}}
        & \multicolumn{5}{c}{\thead{Ref.}}                              \\
    \cmidrule[0.5pt](lr){2-6} \cmidrule[0.5pt](lr){7-11}
        & {c-Si} & {a-Si:H}  & {CIGS} & {Si:H/$\mu$C} & {CdTe/CdS}
        & {c-Si} & {a-Si:H}  & {CIGS} & {Si:H/$\mu$C} & {CdTe/CdS}      \\
    \cmidrule(lr){2-6} \cmidrule(lr){7-11}
        & \rothead{LG250S1C} & \rothead{P-LE055} & \rothead{TS-155C2}
                 & \rothead{U-EA110}  & \rothead{FS 380}
        & \rothead{LG250S1C} & \rothead{P-LE055} & \rothead{TS-155C2}
                 & \rothead{U-EA110}  & \rothead{FS 380}                \\
    \midrule
\textbf{STC}
        & \multicolumn{10}{c}{\thead{Simulated Values}}                 \\
    \midrule
P_{mp}  & 250.3 & 55    & 155   & 111       & 80.1
        & 263.9 & 64    & 167.5 & 126.2     & 78                        \\
V_{mp}  & 30    & 16.5  & 65.6  &  53       & 48.8
        & 31.4  & 16.7  & 69.7  &  56.4     & 47.2                      \\
I_{mp}  &  8.33 &  3.33 &  2.36 &   2.09    &  1.6
        &  8.39 &  3.83 &  2.41 &   2.24    &  1.65                     \\
V_{oc}  & 37.6  & 23.1  & 87    & 71.1      & 60.9
        & 37.6  & 23    & 86.9  & 71        & 60.8                      \\
    \midrule
\textbf{STC} & \multicolumn{10}{c}{\thead{PARE}}                        \\
    \midrule
P_{mp}  & 0.12  &  0    &  0    & 0.91      & 0.13
        & 5.56  & 16.3  &  8.1  & 14.8      & 2.45                      \\
V_{mp}  & 0.67  &  0    &  1.6  & 1.9       & 0.62
        & 5.51  &  1.23 &  7.9  & 4.4       & 2.63                      \\
I_{mp}  & 0.72  &  0    &  1.7  & 2.5       & 0.61
        & 0.04  & 15    &  0.19 & 9.8       & 0.15                      \\
V_{oc}  & 0     &  0.43 &  0.12 & 0.14      & 0.16
        & 0.1   &  0    &  0    & 0         & 0                         \\
    \bottomrule
\end{tabular}
    \end{table*}
\end{document}

相关内容