68

I need to draw a double line after the first row in a table, but when using \hline twice, this interrupts the vertical lines:

\documentclass{article}
\begin{document}

\begin{tabular}{|c|c|c|}
\hline 
1 & 2 & 3 \\ \hline \hline
4 & 5 & 6 \\ \hline
7 & 8 & 9 \\ \hline
\end{tabular}

\end{document}

produces:

enter image description here

This is without using any additional packages. How can I change this is such a ways that the vertical lines are not interrupted?

Jelle
  • 1,343

2 Answers2

65
\documentclass{article}
\usepackage{hhline}
\begin{document}

\begin{tabular}{|c|c|c|}
\hline 
1 & 2 & 3 \\ \hhline{|=|=|=|}
4 & 5 & 6 \\ \hline
7 & 8 & 9 \\ \hline
\end{tabular}

\end{document}

enter image description here

user1271772
  • 594
  • 6
  • 26
David Carlisle
  • 757,742
3

With {NiceTabular} of nicematrix, the vertical rules cross the double horizontal rules (of \hline\hline).

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

\begin{NiceTabular}{|c|c|c|} \hline 1 & 2 & 3 \ \hline \hline 4 & 5 & 6 \ \hline 7 & 8 & 9 \ \hline \end{NiceTabular}

\end{document}

Output of the above code

In fact, with {NiceTabular}, you have a key hvlines to draw all the horizontal and vertical rules and you still have the ability to put a \Hline\Hline where you want (\Hline is provided by nicematrix and draws the rule with PGF/TikZ instead of using the standard \hline).

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

\begin{NiceTabular}{ccc}[hvlines] 1 & 2 & 3 \ \Hline\Hline 4 & 5 & 6 \ 7 & 8 & 9 \ \end{NiceTabular}

\end{document}

The output is the same.

F. Pantigny
  • 40,250