Tabular disjoint line
As explained here: https://tex.stackexchange.com/a/88939/231952, it is not a good idea to use vertical rules in tables. In any case, to answer your question, these commands will suffice:
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
Table 1. With booktabs
and without vertical rules (best choice):
\begin{tabular}{cc} \toprule
A & 0.002s \\
B & 0.05s \\
C & \\ \bottomrule
\end{tabular}
Table 2. Without booktabs
(i.e. with standard rules):
\begin{tabular}{|c|c|} \hline
A & 0.002s \\
B & 0.05s \\
C & \\ \hline
\end{tabular}
Table 3. With vertical rules and booktabs
:
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\begin{tabular}{|c|c|} \toprule
A & 0.002s \\
B & 0.05s \\
C & \\ \bottomrule
\end{tabular}
If you actually want to draw vertical rules compatible with the rules of booktabs (\toprule
, bottomrule
, \midrule
, etc.), although this is not at all in the spirit of booktabs
, you should use {NiceTabular}
of nicematrix
.
\documentclass{article}
\usepackage{nicematrix}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{NiceTabular}{|c|c|} \toprule
A & 0.002s \\
B & 0.05s \\
C & \\ \bottomrule
\end{NiceTabular}
\caption{}
\end{table}
\end{document}
You need several compilations (because nicematrix
uses PGF/Tikz nodes).