如何延长边框列线

如何延长边框列线

我想创建一个表格

输出

如您所见,列边框不实。 有小间隙。 我该如何填补它们?

非常紧急。我随函附上代码。

\documentclass[12pt]{extarticle}
\usepackage{times}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{threeparttable}
\usepackage{amsmath}
\usepackage{rotating}
\usepackage{afterpage}
\usepackage{epstopdf}
\usepackage{adjustbox}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{multicol}
\usepackage{caption}
\usepackage{morefloats}
\usepackage[toc,page]{appendix}
\usepackage{ragged2e}
\usepackage{subfig} 
\usepackage{etoolbox}
\usepackage[section]{placeins}
\usepackage{multirow}
\usepackage{pdflscape}
\usepackage{stackengine}

\geometry{
a4paper,
total={210mm,297mm},
left=25mm,
right=25mm,
top=25mm,
bottom=25mm,
}
%long table commands
\setstackEOL{\#}
\setstackgap{L}{12pt}


\begin{document}


\begin{sidewaystable}[]
\footnotesize
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{ccccccccc|c|ccccc}
    \toprule
    \multicolumn{8}{c}{coefficients}                                                                    &  & \multirow{2}{*}{\Longstack{Modelled\# component}}  & \multicolumn{5}{c}{ decompositions}                                                               \\ \cmidrule(r){2-9} \cmidrule(l){11-15}
    & $x$                  & $y$             & $z$                    & $p$            & $q$            & $r$         & $s$                &                      &                                      & $a$     & $b$     & $c$ & $d$    & $e$    \\ \cmidrule(r){2-15} \cmidrule(l){11-15} \\
    $x$                          & 0.0878                     & -0.0226                    & 0.0021                      &                      &                      &                      & 0.011                &                      & \multirow{2}{*}{co 1}                              & 0.368                & 0.367                & 0.256                       & 0.677                & 0.668                \\
    & (0.0056)                   & (0.0508)                   & (0.1871)                    &                      &                      &                      &                      &                      &                                      & (0.207)              & (0.239)              & (0.132)                     & (0.245)              & (0.205)              \\
    \multicolumn{1}{l}{}                 & [0.0491]                     & [0.1758]                     & [0.0007]                      & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{}                 & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{}        & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} \\
    &                            &                            &                             &                      &                      &                      &                      &                      & \multirow{2}{*}{co 2}                              & 0.361                & 0.476                & 0.163                       & 0.543                & 0.653                \\
    \multicolumn{1}{l}{$y$} & \multicolumn{1}{l}{0.0774} & \multicolumn{1}{l}{0.6732} & \multicolumn{1}{l}{-0.0004} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{ 0.534} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{}                 & (0.299)              & (0.339)              & (0.109)                     & (0.338)              & (0.286)              \\
    & (0.0011)                   & (0.0098)                   & (0.0118)                    &                      &                      &                      &                &                      &                                      &                      &                      &                             &                      &                      \\
    & [0.0089]                     & [0.0289]                     & [0.0002]                      &                      &                      &                      &                      &                      & \multirow{2}{*}{\Longstack{co 1 and \# co 2}} & 0.325                & 0.269                & 0.406                       & 0.857                & 0.828                \\
    &                            &                            &                             &                      &                      &                      &                      &                      &                                      & (0.208)              & (0.266)              & (0.108)                     & (0.250)              & (0.138)              \\ 
    &                            &                            &                             &                      &                      &                      &                      &                      &                                      &                      &                      &                             &                      &                      \\ \midrule
    &                            &                            &                             &                      &                      &                      &                      &                      &                                      &                      &                      &                             &                      &                      \\
    $x$                          & 0.0828                     & -0.0335                    & 0.0029                      & 0.0002               & -0.0092              & -0.0089              & 0.017                &                      & \multirow{2}{*}{co 1}                              & 0.377                & 0.367                & 0.256                       & 0.677                & 0.668                \\
    & (0.0063)                   & (0.0500)                   & (0.1885)                    & (0.0020)             & (0.0011)             & (0.0076)             &                      &                      &                                      & (0.215)              & (0.239)              & (0.132)                     & (0.245)              & (0.205)              \\
    \multicolumn{1}{l}{}                 & [0.0496]                     & [0.1723]                     & [0.0007]                      & [0.0011]               & [0.0073]               & [0.0080]               & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{}                 & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{}        & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} \\
    &                            &                            &                             &                      &                      &                      &                      &                      & \multirow{2}{*}{co 2}                              & 0.492                & 0.58                 & -0.071                      & 0.423                & 0.511                \\
    $y$                     & 0.0764                     & 0.6549                     & -0.0008                     & -0.0002              & -0.0033              & 0.0036               & 0.540                &                      &                                      & (0.365)              & (0.250)              & (0.320)                     & (0.245)              & (0.350)              \\
    & (0.0012)                   & (0.0099)                   & (0.0512)                    & (0.0003)             & (0.0003)             & (0.0013)             &                      & \multicolumn{1}{l}{} & \multicolumn{1}{l}{}                 & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{}        & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} \\
    & [0.0090]                     & [0.0292]                     & [0.0002]                      & [0.0003]               & [0.0015]               & [0.0015]               &                      &                      & \multirow{2}{*}{\Longstack{co 1 and\# co 2}} & 0.391                & 0.292                & 0.317                       & 0.773                & 0.695                \\
    &                            &                            &                             &                      &                      &                      &                      &                      &                                      & (0.226)              & (0.195)              & (0.162)                     & (0.203)              & (0.259)     \\
    &                            &                            &                             &                      &                      &                      &                      &                      &                                      &                      &                      &                             &                      &         \\ \cmidrule(r){1-15}  
\end{tabular}
\end{sidewaystable}
\end{document} 

谢谢查

答案1

您不应该使用垂直线。Booktabs 不是为此而设计的。我建议使用此代码,将siunitx数字对齐到小数点上。

times软件包已过时,无法管理数学字体。我用newtxtext和替换了它newtxmath,后者使用 TeX Gyre Termes(Times 的克隆版本)。我还从 切换tabulararray,因为几乎所有单元格都处于数学模式。

\documentclass[12pt]{extarticle}

\usepackage{newtxtext, newtxmath}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{geometry}
\usepackage{threeparttable}
\usepackage{amsmath}
\usepackage{rotating}
\usepackage{afterpage}
\usepackage{epstopdf}
\usepackage{adjustbox}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{multicol}
\usepackage{caption}
\usepackage{morefloats}
\usepackage[toc,page]{appendix}
\usepackage{ragged2e}
\usepackage{subfig}
\usepackage{etoolbox}
\usepackage[section]{placeins}
\usepackage{multirow}
\usepackage{pdflscape}
\usepackage{stackengine}
\usepackage{makecell, siunitx}%
\geometry{
a4paper,
total={210mm,297mm},
left=25mm,
right=25mm,
top=25mm,
bottom=25mm,
}
%long table commands
\setstackEOL{\#}
\setstackgap{L}{12pt}

 \newcommand\emptycell[1]{\multicolumn{#1}{c}{}}

\begin{document}


\begin{sidewaystable}[]
\footnotesize\sisetup{table-format=-1.4, table-align-text-pre=false, table-align-text-post=false, table-space-text-pre=(, table-space-text-pre=),}
\centering\setlength\aboverulesep{0.65ex}\setlength\belowrulesep{1ex}
\caption{My caption}
\label{my-label}
$ \begin{array}{c*{7}{S}@{\qquad}>{$}c<{$}@{\qquad}*{5}{S}}
 \toprule
 \multicolumn{8}{c}{\text{coefficients}} & \multirowcell{2}[-0.5ex]{ Modelled\\ component}%
 & \multicolumn{5}{c}{\text{decompositions}} \\%
 \cmidrule(lr){2-8} \cmidrule(lr){10-14}
 & {x} & {y} & {z} & {p} & {q} & {r} & {s} & & {a} & {b} & {c} & {d} & {e} \\ %
 \cmidrule(r){2-14} \cmidrule(l){10-14}
 x & 0.0878 & -0.0226 & 0.0021 & \emptycell{3}& 0.011 & \multirowcell{2}{co 1} & 0.368 & 0.367 & 0.256 & 0.677 & 0.668 \\
 & {(}0.0056{)} & {(}0.0508{)} & {(}0.1871{)} &\emptycell{5} & {(}0.207{)} & {(}0.239{)} & {(}0.132{)} & {(}0.245{)} & {(}0.205{)} \\
 \emptycell{1} & [0.0491] & [0.1758] & [0.0007] \\
 \emptycell{8} & \multirow{2}{*}{co 2} & 0.361 & 0.476 & 0.163 & 0.543 & 0.653 \\
y & 0.0774 & 0.6732 & -0.0004 & \emptycell{3} & 0.534 & & {(}0.299{)} & {(}0.339{)} & {(}0.109{)} & {(}0.338{)} & {(}0.286{)} \\
 & {(}0.0011{)} & {(}0.0098{)} & {(}0.0118{)} \\
 & [0.0089] & [0.0289] & [0.0002] & \emptycell{4} & \multirowcell{2}{co 1 and \\ co 2} & 0.325 & 0.269 & 0.406 & 0.857 & 0.828 \\
 \emptycell{9} & {(}0.208{)} & {(}0.266{)} & {(}0.108{)} & {(}0.250{)} & {(}0.138{)} \\
 \midrule
 x & 0.0828 & -0.0335 & 0.0029 & 0.0002 & -0.0092 & -0.0089 & 0.017 & \multirowcell{2}{co 1} & 0.377 & 0.367 & 0.256 & 0.677 & 0.668 \\
 & {(}0.0063{)} & {(}0.0500{)} & {(}0.1885{)} & {(}0.0020{)} & {(}0.0011{)} & {(}0.0076{)} & & & {(}0.215{)} & {(}0.239{)} & {(}0.132{)} & {(}0.245{)} & {(}0.205{)} \\
 & [0.0496] & [0.1723] & [0.0007] & [0.0011] & [0.0073] & [0.0080] \\
 \emptycell{8} & \multirow{2}{*}{co 2} & 0.492 & 0.58 & -0.071 & 0.423 & 0.511 \\
 y & 0.0764 & 0.6549 & -0.0008 & -0.0002 & -0.0033 & 0.0036 & 0.540 & & {(}0.365{)} & {(}0.250{)} & {(}0.320{)} & {(}0.245{)} & {(}0.350{)} \\
 & {(}0.0012{)} & {(}0.0099{)} & {(}0.0512{)} & {(}0.0003{)} & {(}0.0003{)} & {(}0.0013{)} \\
 & [0.0090] & [0.0292] & [0.0002] & [0.0003] & [0.0015] & [0.0015] & & \multirowcell{2}{co 1 and\\ co 2} & 0.391 & 0.292 & 0.317 & 0.773 & 0.695 \\
 \emptycell{9} & {(}0.226{)} & {(}0.195{)} & {(}0.162{)} & {(}0.203{)} & {(}0.259{)} \\
 \cmidrule(r){1-14}
\end{array} $
\end{sidewaystable}

\end{document} 

在此处输入图片描述

相关内容