tags:

views:

62

answers:

1

Is there any obvious or pretty way to have LaTeX automatically put a \hline between each line in a table without having to put a \hline between each line?

I thought about creating a command like:

\newcommand{\EOL}{\\ \hline}

But then I will get non-standard looking tables like this:

3 & 2 & 1 \EOL
1 & 2 & 3 \EOL

Is there a way such that my table bodies could look like:

3 & 2 & 1 \\
1 & 2 & 3 \\

And yet still get the hlines?

+5  A: 
\catcode`@=11
\let \savecr \@tabularcr
\def\@tabularcr{\savecr\hline}
\catcode`@=12

\begin{tabular}{ccc}
1 & 2 & 3\\ 
4 & 5 & 6\\
\end{tabular}
Alexey Malistov
Works perfectly, +1. BTW, if you're interested in a StackOverflow-like site specifically for TeX/LaTeX (which may attract non-programmers), do "commit" here: http://area51.stackexchange.com/proposals/2148/tex-latex-and-friends?referrer=LtGW8MKLMIWU41zfK7oIpw2
ShreevatsaR
Thanks, and I'll check the other site.
vy32