[Tex/LaTex] Add vertical space between \hline and the row consisting of only \multicolumn (without using \midrule)

multicolumnspacingtables

I want to add vertical space between \hline's and the rows consisting of only \multicolumn. I do not want to use \midrule.

The answers in this question do not work in case of \multicolumn.

enter image description here

Here is MWE:

\documentclass{article}

\begin{document}
\begin{tabular}{ll}
\hline
\multicolumn{2}{c}{Method A}\\
\hline
1) & $\begin{array}{c}a\leftarrow A^Tb \\ c\leftarrow A^Td_Z \end{array}$\\
\hline
\multicolumn{2}{c}{Method B}\\
\hline
2) & $\begin{array}{c}a\leftarrow A^Tb \\ c\leftarrow A^Td_Z \end{array}$\\
\hline
\end{tabular}
\end{document}

Best Answer

The cellspace package lets you define independent minimal spacings at the top and the bottom of a cell. All you have to do then is prefixing the column to which you want to apply these minimal spacings with the letter S. This conflicts with the S qualifier from the siunitx package, which replaces it with the C prefix. It works with usual column types (l, r, c, p, m, X) – you can add column types – but not with S. See the documentation for more details.

\documentclass{article}

\usepackage{cellspace}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}

\begin{document}

\begin{tabular}{l Sl}
\hline
\multicolumn{2}{Sc}{Method A}\\
\hline
1) & $\begin{array}{c}a ← A^Tb \\ c ← A^Td_Z \end{array}$\\
\hline
\multicolumn{2}{Sc}{Method B}\\
\hline
2) & $\begin{array}{c}a ← A^Tb \\ c ← A^Td_Z \end{array}$\\
\hline
\end{tabular}

\end{document} 

enter image description here