2

I'm currently drawing borders like so:

begin{tabular}{|c|c|c|}
 \hline
 a & b & c \\
 \hline
 d & e & f \\
 \hline
 g & i & j \\
 \hline
\end{tabular}

However, this requires a \hline between every row. Is there a concise, and preferable native, method of drawing all borders?

  • Welcome to TeX.SX! Please help us help you by making your code example compilable (a MWE). – TeXnician Sep 4 '18 at 10:28
  • By native, I assume you mean still using tabular? If you are open to using a different table environment, you can use tabu with \everyrow{\hline}. – David Purton Sep 4 '18 at 10:31
  • @TeXnician By compilable, do you mean to include the \documentclass, \begin{document} and \end{document} sections? – George Tian Sep 4 '18 at 10:37
  • 1
    @GeorgeTian Off-topic, but such a data-prison style for your tables might not be the best choice. Please have a look at betterposters.blogspot.com/2012/08/the-data-prison.html – user36296 Sep 4 '18 at 11:29
  • 1
    @GeorgeTian inf.ethz.ch/personal/markusp/teaching/guides/guide-tables.pdf provides a short example how to produce nice looking tables in latex. – user36296 Sep 4 '18 at 11:38
3

Since you say you are open to using a different table environment, try tabu. It has many options including \everyrow{}, which can be used to insert lines at every row.

\documentclass{article}
\usepackage{tabu}
\begin{document}
\everyrow{\hline}
\begin{tabu}{|c|c|c|}
  a & b & c \\
  d & e & f \\
  g & i & j \\
\end{tabu}
\end{document}
  • A slightly off-topic question. I have read that tabu has some bugs which will not be fixed until the next version. On ctan, the latest version appears to be from 2011, which indicates to be that the 'next version' is not out yet. Will any updates affect my work in the next year or so? – George Tian Sep 4 '18 at 11:43
  • @GeorgeTian, yes I gather that tabu has some issues, and not everyone is a fan. I use it often though and don't have problems. I think it's more or less abandoned by its developer, so I wouldn't hold my breath for updates. – David Purton Sep 4 '18 at 11:54

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.