How to draw missing vertical lines in tabular

tables

I want to draw missing vertical lines in a tabular. I think \multirow{2}{*}{} prevents table's vertical line to be drawn.

My code:

\documentclass{article}
\usepackage[a4paper,margin=1in,landscape]{geometry}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{booktabs}

\begin{document}
\begin{center}
    \begin{table*}[!t]  %
        \centering
        \caption{Results ...}
        \begin{tabular}{|c|c|c|c|c|c|c|c|c|}
          \hline
          \textbf{Test} & \multicolumn{2}{c|}{Workflow} & Method
          & \multirow{2}{*}{\makecell{Completion                                                 \\ Time (min)}}
                        & \multirow{2}{*}{\makecell{Gas Used for                                               \\
          \textit{submitJob} (gas)}}
                        & \multirow{2}{*}{\makecell{Gas Used for                                               \\
          \textit{processPayment} (gas)}}
                        & \multirow{2}{*}{\makecell{Actual/Complete                                            \\ Cost
          (\textit{Cent})}}
                        & \multirow{2}{*}{\makecell{Failed}}                                                   \\
          \cmidrule(lr){2-3}
                        &       $|V|$                   & $|E|$                                                \\
          \hline
          $T_1$         & 16                            & 28 & ALGO & 27 & 1722983 & 1942770 & 0.827/0.827 & 0 \\ \hline
        \end{tabular}
    \end{table*}
\end{center}
\end{document}

output:

enter image description here

Wanted output:enter image description here

Best Answer

You can use nicematrix with the hvlines option. The command for both multirow and multicolumn cells is \Block.

Remember that \Block does not cause the cells to be skipped so && is necessary between the Workflow and Method cells. Also don't forget to compile twice.

The line \NiceMatrixOptions{cell-space-limits = 2pt} is optional and creates some additional vertical space between rows.

enter image description here

\documentclass{article}
\usepackage[a4paper,margin=1in,landscape]{geometry}
\usepackage{nicematrix}

\begin{document}
\begin{center}
    \begin{table*}[!t]  %
        \centering
        \caption{Results ...}
        \NiceMatrixOptions{cell-space-limits = 2pt}
        \begin{NiceTabular}{ccccccccc}[hvlines]
          \Block{2-1}{\textbf{Test}} & \Block{1-2}{Workflow} && \Block{2-1}{Method} & \Block{2-1}{Completion\\Time (min)}
                        & \Block{2-1}{Gas Used for\\ \textit{submitJob} (gas)}
                        & \Block{2-1}{Gas Used for\\ \textit{processPayment} (gas)}
                        & \Block{2-1}{Actual/Complete\\ Cost (\textit{Cent})}
                        & \Block{2-1}{Failed}\\
          & $|V|$ & $|E|$ \\
          $T_1$ & 16 & 28 & ALGO & 27 & 1722983 & 1942770 & 0.827/0.827 & 0
        \end{NiceTabular}
    \end{table*}
\end{center}
\end{document}
Related Question