长桌环境中垂直线位置错误

长桌环境中垂直线位置错误
\documentclass[12pt]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{enumerate}
\usepackage{graphics}
\usepackage{epsfig}
\usepackage{booktabs}
\usepackage{array}
\usepackage{latexsym}
\usepackage[nomarginpar,ignoremp,noheadfoot]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{fancyhdr}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{float}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mathtools}
\usepackage{tabularx}
\usepackage{arydshln}
\usepackage{color}
\usepackage{leftidx}
\usepackage{mathrsfs}
\usepackage[sort&compress]{natbib}
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}


\setcounter{MaxMatrixCols}{10}


\newcolumntype{x}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{y}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}{>{\centering\arraybackslash}p{2em}}
\newcolumntype{D}{>{\centering\arraybackslash}p{3em}}
\newcolumntype{E}{>{\centering\arraybackslash}p{5em}}
\newcolumntype{F}{>{\centering\arraybackslash}p{2.5em}}
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\geometry{headheight=15pt,headsep=1cm,vmargin={3cm,2.5cm},hmargin={2.5cm,2.5cm}}
\setlength{\footskip}{1.5cm}
\setlength{\bibsep}{2pt}

\begin{document}

\LTcapwidth=\textwidth
\centering
\begin{longtable}{y{0.5cm}y{1.2cm}DFFFFFFFFFF}                                              
\caption{Longtable Test}
\label{Table05a}\\                                                      
\multicolumn{13}{c}{{\footnotesize {Panel (a): First Panel}}} \\        \multicolumn{13}{c}{} \\
\toprule
&   &   &   \multicolumn{1}{|c}{\scriptsize{Test}}& \multicolumn{3}{c}{\scriptsize{Test}}&          \multicolumn{6}{c}{\scriptsize{Test}} \\                        
&   &   &   \multicolumn{1}{|c}{\scriptsize{Test}}& \multicolumn{3}{c}{\scriptsize{Test}}&          \multicolumn{3}{c}{\scriptsize{Test}}&          \multicolumn{3}{c}{\scriptsize{Test}} \\            
\scriptsize{Test} & \multicolumn{2}{c|}{\scriptsize{Test}} &    \scriptsize{1} &    \scriptsize{2} &    \scriptsize{3} &    \scriptsize{4} &    \scriptsize{5} &    \scriptsize{6} &    \scriptsize{7} &    \scriptsize{8} &    \scriptsize{9} &    \scriptsize{10} \\ \hline
& \multicolumn{2}{c|}{\scriptsize{Test}} &          {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{\textbf{Test}}  }& {\scriptsize{\textbf{Test}}  }& {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{Test}  }   \\
\bottomrule

\\
\\
\\
\\

\multicolumn{13}{c}{{\footnotesize {Panel (b): Second Panel}}} \\ \multicolumn{13}{c}{} \\
\toprule
&   &   &   \multicolumn{1}{|c}{\scriptsize{Test}}& \multicolumn{3}{c}{\scriptsize{Test}}&          \multicolumn{6}{c}{\scriptsize{Test}} \\                        
&   &   &   \multicolumn{1}{|c}{\scriptsize{Test}}& \multicolumn{3}{c}{\scriptsize{Test}}&          \multicolumn{3}{c}{\scriptsize{Test}}&          \multicolumn{3}{c}{\scriptsize{Test}} \\            
\scriptsize{Test} & \multicolumn{2}{c|}{\scriptsize{Test}} &    \scriptsize{1} &    \scriptsize{2} &    \scriptsize{3} &    \scriptsize{4} &    \scriptsize{5} &    \scriptsize{6} &    \scriptsize{7} &    \scriptsize{8} &    \scriptsize{9} &    \scriptsize{10} \\ \hline
& \multicolumn{2}{c|}{\scriptsize{Test}} &          {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{\textbf{Test}}  }& {\scriptsize{\textbf{Test}}  }& {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{Test}  }&  {\scriptsize{Test}  }   \\
\bottomrule                                             
\end{longtable} 


\end{document}

我想在 longtable 环境中创建一个表格,但第 3 列和第 4 列之间的垂直线位置不太好。我尝试使用多列命令为表格中的每一行放置垂直线。但是,垂直线的某些部分缺失,而另一部分出现在第一行,因为我没有在多列中设置垂直线。

答案1

booktabs不喜欢垂直规则。使用普通表格。像这样制定表格规范:{y{0.5cm}y{1.2cm}D|FFFFFFFFFF}|从第一行和第二行中删除多余的内容。\scriptsize在表格开头也只使用一次。

\documentclass[12pt]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{enumerate}
\usepackage{graphics}
\usepackage{epsfig}
\usepackage{booktabs}
\usepackage{array}
\usepackage{latexsym}
\usepackage[nomarginpar,ignoremp,noheadfoot]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{fancyhdr}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{float}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mathtools}
\usepackage{tabularx}
\usepackage{arydshln}
\usepackage{color}
\usepackage{leftidx}
\usepackage{mathrsfs}
\usepackage[sort&compress]{natbib}
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}


\setcounter{MaxMatrixCols}{10}


\newcolumntype{x}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{y}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}{>{\centering\arraybackslash}p{2em}}
\newcolumntype{D}{>{\centering\arraybackslash}p{3em}}
\newcolumntype{E}{>{\centering\arraybackslash}p{5em}}
\newcolumntype{F}{>{\centering\arraybackslash}p{2.5em}}
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\geometry{headheight=15pt,headsep=1cm,vmargin={3cm,2.5cm},hmargin={2.5cm,2.5cm}}
\setlength{\footskip}{1.5cm}
\setlength{\bibsep}{2pt}

\begin{document}

\LTcapwidth=\textwidth
\centering\scriptsize
\begin{longtable}{y{0.5cm}y{1.2cm}D|FFFFFFFFFF}                                              
\caption{Longtable Test}
\label{Table05a}\\                                                      
\multicolumn{13}{c}{{\footnotesize {Panel (a): First Panel}}} \\ \multicolumn{13}{c}{} \\
\hline
&   &   &   \multicolumn{1}{c}{Test}& \multicolumn{3}{c}{Test}&  \multicolumn{6}{c}{Test} \\                        
&   &   &   \multicolumn{1}{c}{Test0}& \multicolumn{3}{c}{Test}&   \multicolumn{3}{c}{Test}&     \multicolumn{3}{c}{Test} \\            
Test & \multicolumn{2}{c|}{Test} &    1 &    2 &    3 &    4 &    5 &    6 &    7 &    8 &    9 &    10 \\ \hline
& \multicolumn{2}{c|}{Test} &   Test &  Test&  Test  &  \textbf{Test}& {\textbf{Test}}& {Test}&  {Test  }&  {Test  }&  {Test  }&  {Test  }   \\
\hline
\\
\\
\\
\\
\multicolumn{13}{c}{{\footnotesize {Panel (a): First Panel}}} \\        \multicolumn{13}{c}{} \\
\hline
&   &   &   \multicolumn{1}{c}{Test}& \multicolumn{3}{c}{Test}&          \multicolumn{6}{c}{Test} \\                        
&   &   &   \multicolumn{1}{c}{Test0}& \multicolumn{3}{c}{Test}&          \multicolumn{3}{c}{Test}&          \multicolumn{3}{c}{Test} \\            
Test & \multicolumn{2}{c|}{Test} &    1 &    2 &    3 &    4 &    5 &    6 &    7 &    8 &    9 &    10 \\ \hline
& \multicolumn{2}{c|}{Test} &   Test &  Test&  Test  &  \textbf{Test}& {\textbf{Test}}& {Test}&  {Test  }&  {Test  }&  {Test  }&  {Test  }   \\
\hline                                          
\end{longtable} 


\end{document}

在此处输入图片描述

相关内容