musa yusuf
musa yusuf

Reputation: 51

A horizontal line in a latex table

I want to put a horizontal line between first and second rows in the following table:

\begin{table}[ht]
    \centering
    \caption{Multi-row table}
    \label{tab:Mergedrows}
    \vspace{1ex}
        \begin{tabular}{|c|c|}
            \hline
            \multirow{2}{*}{Mergedrows}
            &X\\
            &X \\
            \hline
        \end{tabular}
\end{table}

How to do this?

Upvotes: 1

Views: 24020

Answers (1)

Robert
Robert

Reputation: 8571

Just like the documentation to multirow shows: by adding a cline:

\documentclass{article}
\usepackage{multirow}

\begin{document}
\begin{table}[ht]
    \centering
    \caption{Multi-row table}
    \label{tab:Mergedrows}
    \vspace{1ex}
        \begin{tabular}{|c|c|}
            \hline
            \multirow{2}{*}{Mergedrows}
            &X\\
            \cline{2-2} % add this
            &X \\
            \hline
        \end{tabular}
\end{table}
\end{document}

Upvotes: 3

Related Questions