Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make LaTeX draw a \hline between each line in tabular without using \hline? [closed]

Tags:

latex

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?

like image 657
vy32 Avatar asked Jul 04 '10 12:07

vy32


People also ask

How do you put a space between two lines in a table LaTeX?

One option is to use the commands \setlength and \arraystretch to change the horizontal spacing (column separation) and the vertical spacing (row separation) respectively.

How do you make a divider line in LaTeX?

Example 02: Using \line Command Another way to create a simple horizontal line on any Latex document is to use the \line command. This command takes x, y slope, and the length of a line.

How do you draw a line in a table in LaTeX?

The vertical bars in the argument of the tabular environment tell LaTeX to separate those columns with a vertical line, and the \hline command creates a horizontal line right across the table; if you only the horizontal line across certain columns you can use the \cline command and tell it which columns you want,e.g. .

How do you draw a straight line in LaTeX?

One of the simplest and most commonly used commands in TikZ is the \draw command. To draw a straight line we use this command, then we enter a starting co-ordinate, followed by two dashes before the ending co-ordinate. We then finish the statement by closing it with a semicolon.


1 Answers

\catcode`@=11
\let \savecr \@tabularcr
\def\@tabularcr{\savecr\hline}
\catcode`@=12

\begin{tabular}{ccc}
1 & 2 & 3\\ 
4 & 5 & 6\\
\end{tabular}
like image 177
Alexey Malistov Avatar answered Oct 17 '22 07:10

Alexey Malistov