Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to draw a table with two \hline and two vertical line. But as shown in the figure, the first vertical line do not cross the two hline. How to solve this problem?

\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}

output

share|improve this question
2  
Minimize the use of vertical lines in tables. They disturb more than they help. –  Svend Tveskæg Jan 2 at 10:00

2 Answers 2

up vote 5 down vote accepted

As stated in the hhline package documentation, | gives you a vertical line which cuts through a double (or single) hline, whereas # gives a double hline segment between two vlines.

So, to correct your situation (leaving aside the aesthetic issues) simply use, # in place of the | in the argument for \hhline.


\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}

You get the following output.

enter image description here


For further reading, please see the hhline package documentation mentioned above. Also, you may like to see this question as well.

share|improve this answer

Don't use vertical lines in tables; they disturb more than they help.

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\begin{tabular}{ccc}
\toprule
1 & 2 & 3 \\
\midrule
4 & 5 & 6 \\
\midrule
7 & 8 & 9 \\
\bottomrule
\end{tabular}

\end{document}

output

share|improve this answer
2  
It is not the answer to OP's question. –  Przemysław Scherwentke Jan 2 at 10:43
1  
@PrzemysławScherwentke I don't agree with you. We've hand a "don't do this" answers with alternative provided before. Since TeX is about typography, it's not wrong to provide typographical alternatives to what OP asks for. See e.g. What's the quickest way to write “2nd” “3rd” etc in LaTeX –  yo' Jan 2 at 13:53
    
Thanks so much! It is beautiful but MMA gives the answer 'to' the question. –  Eden Harder Jan 2 at 14:21
    
@tohecz Yeah! I agree with you! +1 –  Eden Harder Jan 2 at 14:21
    
@EdenHarder That's just fine. :) I just wouldn't do it like that at all. –  Svend Tveskæg Jan 2 at 14:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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