55

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 '13 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 '13 at 14:24
  • 7
    The right one is 1 & 2 & 3 \\ \hhline{|=|=|=|} Aug 30 '13 at 14:28
59
\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 '14 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 '15 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 '15 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 '15 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 '15 at 12:35
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.