1

SO I am creating a table, but the alignment of the vertical line is off. The code looks like this:

\begin{table}
\small
\hline
\begin{tabular}{p{0.07\linewidth}||p{0.07\linewidth} p{0.07\linewidth}p{0.07\linewidth}p{0.07\linewidth} p{0.07\linewidth}|p{0.07\linewidth}p{0.07\linewidth} p{0.07\linewidth}p{0.07\linewidth}p{0.07\linewidth}p{0.07\linewidth}|} 
 & \multicolumn{5}{c|}{\textbf{Baseline specification}} & \multicolumn{5}{c}{\textit{Robustness specification}} \\
    \hline
\textbf{Variables} & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) & (10) \\
    \hline
    Default risk & 8.04 (2.57)^{***} & 0.22 (0.39) & 0.20 (0.36) & 3.38 (1.26)^{***} & 3.30 (1.25)^{**} & 4.48 (11.48) & 0.36 (2.09) & 4.09 (2.95)  & -45.27 (19.51)^{**} &  28.10 (13.01)^{*}
    \\
    \hline
    Liquidity & -0.16 (0.08)^{***} &  0.02 (0.03) & 0.05 (0.03) &  -0.02 (0.03) &  -0.02 (0.03) & 201.44 (107.13)^{*}  & 38.91 (23.61) & 7.96 (12.16) & 346.21 (37.71)^{***} &   2187.21 (1031.47)^{*}
    \\
\hline
\end{tabular}
\caption{.}
\label{Table 1.}
\end{table}

I excluded many rows but the vertical line is many times misaligned.

But the vertical line is not aligned for many rows. How can I solve this?

1

The problem has to do with the amount of content you want to cram within the text block width. It's probably better to stack this into a larger (taller) table. Here's one option using design elements from booktabs:

enter image description here

\documentclass{article}

\usepackage[margin=1in]{geometry}
\usepackage{booktabs}

\begin{document}

\newcommand{\sstar}{\textsuperscript{*}}
\newcommand{\dstar}{\textsuperscript{**}}
\newcommand{\tstar}{\textsuperscript{***}}

\noindent
\begin{tabular}{ l *{5}{ r @{\hspace{.5\tabcolsep}} l } }
  \toprule
  & \multicolumn{10}{c}{\textbf{Baseline specification}} \\
  \cmidrule(lr){2-11}
  \textbf{Variables} & 
    \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(5)} \\
  \midrule
  Default risk &   8.04  & (2.57)\tstar & 0.22 & (0.39) & 0.20 & (0.36) &   3.38  & (1.26)\tstar &   3.30  & (1.25)\dstar \\
  Liquidity    & $-0.16$ & (0.08)\tstar & 0.02 & (0.03) & 0.05 & (0.03) & $-0.02$ & (0.03)       & $-0.02$ & (0.03)       \\
  
  \addlinespace[.5\normalbaselineskip]
  
  & \multicolumn{10}{c}{\textbf{Robustness specification}} \\
  \cmidrule(lr){2-11}
  & 
    \multicolumn{2}{c}{(6)} & \multicolumn{2}{c}{(7)} & \multicolumn{2}{c}{(8)} & \multicolumn{2}{c}{(9)} & \multicolumn{2}{c}{(10)} \\
  \midrule
  Default risk &   4.48 & (11.48)        &  0.36 & (2.09)  & 4.09 & (2.95)  & $-45.27$ & (19.51)\dstar &   28.10 & (13.01)\sstar   \\
  Liquidity    & 201.44 & (107.13)\sstar & 38.91 & (23.61) & 7.96 & (12.16) &  346.21  & (37.71)\tstar & 2187.21 & (1031.47)\sstar \\
  \bottomrule
\end{tabular}

\end{document}

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.