15

Tables in LaTeX all seem to have slight discontinuities in the outside vertical borders - little notches that are only really visible if you zoom in. Example:

\documentclass{article}

\begin{document}
  \begin{tabular}{|c|c|}
    \hline
    A & B \\ 
    \hline
    C & D \\ 
    \hline
    E & F \\
    \hline
    G & H \\
    \hline
  \end{tabular}
\end{document}

example pic of table

I'm surprised I couldn't find mention of this when I Googled, given how common tables are. Is there some obscure typographical rule that tables should have little notches like this? Is there any good way to get rid of them? Because they kind of bug me.

18

This is fixed with the use of the array package:

enter image description here

\documentclass{article}
\usepackage{array}
\begin{document}
  \begin{tabular}{|c|c|}
    \hline
    A & B \\ 
    \hline
    C & D \\ 
    \hline
    E & F \\
    \hline
    G & H \\
    \hline
  \end{tabular}
\end{document}

This is mentioned in the array package documentation:

enter image description here

  • Perfect, thanks! I should have guessed there would be a package to do that. As far as I can tell, there's a package to do just about anything. – Joseph Montanaro Jan 14 '15 at 22:11
  • … except maybe answer any TeX-related question. Except if you consider tex.stackexchange to be a package, of course ;) – Clément Jan 14 '15 at 22:45
8

Please pardon me for channeling my inner booktabs evangelist:

\documentclass{article}
\usepackage{booktabs}

\begin{document}
  \begin{tabular}{cc}
    \toprule
    A & B \\ 
    \midrule
    C & D \\ 
    E & F \\
    G & H \\
    \bottomrule
  \end{tabular}
\end{document}

You might not think much of the difference with this small table, but when looking at a larger and/or more complex table it is much easier for your eyes to examine the data/contents without being distracted by lines everywhere.

You might find some other pointers in an excellent animated GIF created by Darkhorse Analytics: How to make your tables less terrible (Reddit's title, not my judgment of your table... :~) )

enter image description here

  • 1
    Thanks for the tip. As it happens, I only need a 2x5 table in this particular case. However, I'll certainly keep your advice in mind if I need more complex tables in the future. Also, that is a pretty sweet GIF. – Joseph Montanaro Jan 15 '15 at 4:20

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.