1

I have the following code for a table:

\bgroup
\def\arraystretch{1.5}
\begin{table}[ht]
\textbf{\caption{My Table}} % title of Table
\centering % used for centering table
\begin{tabular}{ c|ccc } 
 \hline
 Col1 & Col2 & Col3 & Col4\\[5pt]
 \hline
 \multirow{2}{*}{Merged Cell} & A12 & A13 & A14\\ 
 \cmidrule(lr){2-4}
  & A22 & A23 & A24 \\ 
\hline
 \end{tabular}
\end{table}
\egroup

When I run this code, I find that the vertical line between the 1st and 2nd column is discontinuous. Not sure why this is happening.

1

Booktabs adds vertical padding around its rules (aboverulesep and belowrulesep), which explains the discontinuity. Setting these to -0.2pt (half the thickness of a standard line) solves the problem.

You also can load boldline to emulate the variable thickness of booktabs rules, but you loose the possibility to trim \cmidrules.

Here is an example of both solutions:

    \documentclass{article}
    \usepackage[utf8]{inputenc}
    \usepackage{multirow, booktabs, caption, boldline, cellspace}
\captionsetup{font=bf}
\setlength\cellspacetoplimit{8pt}
\setlength\cellspacebottomlimit{\cellspacetoplimit}

    \begin{document}

\bgroup
\aboverulesep = -0.2pt
\belowrulesep = -0.2pt
\def\arraystretch{1.5}
\begin{table}[!ht]
  \caption{My Table} % title of Table
  \centering % used for centering table
  \begin{tabular}{ c|ccc }
    \toprule
    Col1 & Col2 & Col3 & Col4 \\[5pt]
    \midrule
    \multirow{2}{*}{Merged Cell} & A12 & A13 & A14 \\
    \cmidrule(lr){2-4}
                                 & A22 & A23 & A24 \\
    \bottomrule
  \end{tabular}
\end{table}
\egroup

\vskip 1cm
\begin{table}[!ht]
  \caption{My Table} % title of Table
  \centering % used for centering table
  \begin{tabular}{ c|Sccc }
    \hlineB{2}
    Col1 & Col2 & Col3 & Col4 \\
    \hlineB{1.5}
    \multirow{2}{*}[-4.6pt]{Merged Cell} & A12 & A13 & A14 \\
    \clineB{2-4}{1.5}
                                         & A22 & A23 & A24 \\
    \hlineB{2}
  \end{tabular}
\end{table}

\end{document} 

enter image description here

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.