[Tex/LaTex] Recalibrating \hline vertical spacing to that of \cline

tables

How do I alter the spacing dimensions of \hline so as to replicate those of \cline?

I have drawn a series of (empty-celled) tables using \hline for lines spanning whole tables and, e.g., \cline{1-2} for lines spanning just one column. Much later, realizing that I need to overlay them, I can now see that \hline adds to the total row height in a way that \cline does not.

(For instance, look at the superposed tables below. Within each pair, the one on the left has two internal horizontal lines, the one of the left none. The pair on the left use \hline and the top and bottom lines fail to align. The pair on the right align properly (I think) and use \cline.

enter image description here )

(The alternative is going through my document, changing \hline to \cline{1-1}, \cline{1-2}, or \cline{1-3} on a case-by-case basis. Tedious.)

\documentclass{article}
\begin{document}

\begin{tabular}{|c|}
\hline 
 \\ \hline
  \\ \hline
   \\ \hline
\end{tabular}
%
\hspace{\tabcolsep}%
\llap{
\begin{tabular}{|c|}
\hline 
 \\
  \\
   \\ \hline
\end{tabular}
}
%
\quad
%
\begin{tabular}{|c|}
\cline{1-1}
 \\ \cline{1-1}
  \\ \cline{1-1}
   \\ \cline{1-1}
\end{tabular}
%
\hspace{\tabcolsep}%
\llap{
\begin{tabular}{|c|}
\cline{1-1}
 \\ 
  \\ 
   \\ \cline{1-1}
\end{tabular}
}

\end{document}

Best Answer

The mis-match comes beacuse of two lines in the middle. They add to the height. You can compensate to them in the second table using \extrarowheight from array package.

\documentclass{article}
\usepackage{array}
\begin{document}

    \begin{tabular}{|c|}

\hline
 \\ \hline
  \\ \hline
   \\ \hline
\end{tabular}
%
\hspace{\tabcolsep}%
{\extrarowheight=0.6\arrayrulewidth   %%% <<-- this one within a group, adjust suitably
\llap{
\begin{tabular}{|c|}
\hline
 \\
  \\
   \\ \hline
\end{tabular}
}
}
%
\quad
%
\begin{tabular}{|c|}
\cline{1-1}
 \\ \cline{1-1}
  \\ \cline{1-1}
   \\ \cline{1-1}
\end{tabular}
%
\hspace{\tabcolsep}%
\llap{
\begin{tabular}{|c|}
\cline{1-1}
 \\
  \\
   \\ \cline{1-1}
\end{tabular}
}

\end{document}

enter image description here

You can also do it manually, row-wise by adding \\[\arrayrulewidth] like in

\hspace{\tabcolsep}%
%{\extrarowheight=0.6\arrayrulewidth   %%% <<-- this one within a group
\llap{
\begin{tabular}{|c|}
\hline
 \\[\arrayrulewidth]
  \\[\arrayrulewidth]
   \\ \hline
\end{tabular}

\extrarowheight approach can be approximate while adding space row-wise is accurate.