1
\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}

I'd like to create a table with longtable environment, but a vertical line between 3rd and 4th columns is not palced well. I tried to place the vertical line for every each row in the table by using multicolumn command. But, some part of vertical line are missing and the other appears in the first row that I didn't put a vertical line setup in multicolumn.

2

booktabs doesn't like vertical rules. Use normal tabular. Make table specification like this: {y{0.5cm}y{1.2cm}D|FFFFFFFFFF} and remove extra | from first and second rows. Also use \scriptsize just once in the beginning of the table.

\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}

enter image description here

  • Thank you so much AboAmmar! The problem has been solved thanks to you. – Tex Maker Sep 24 '15 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.