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?

3
  • 2
    hhline from package of that name Aug 30, 2013 at 14:17
  • I tried this: 1 & 2 & 3 \\ \hhline{} but then the horizontal line just disappears. I also tried 1 & 2 & 3 \\ \hhline{===} but then the vertical lines were still interrupted. If not that, what is the proper argument for this function?
    – Jelle
    Aug 30, 2013 at 14:24
  • 7
    The right one is 1 & 2 & 3 \\ \hhline{|=|=|=|} Aug 30, 2013 at 14:28

2 Answers 2

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

8
  • 8
    In case you have a table with a double vertical line, see here: tex.stackexchange.com/q/152101/23992
    – Keelan
    Oct 25, 2014 at 21:36
  • 2
    I think there's a spelling error, hhline is not defined. Also, I can't seem to get this to work when the layout is |c c|c c|. Mar 17, 2015 at 11:33
  • 4
    @DmitriNesteruk if hhline is not defined then you have not copied the code correctly to include the hhline package. Mar 17, 2015 at 11:44
  • @DavidCarlisle ahh, missed that, thanks. incidentally, in my case, the argument ended up being |==|==|... but this makes no sense! :) sigh Mar 17, 2015 at 12:33
  • 2
    @DmitriNesteruk why does it make no sense? |==|==| is what I would expect if your columns are specified as |cc|cc| Mar 17, 2015 at 12:35
2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .