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?
One option is to use the commands \setlength and \arraystretch to change the horizontal spacing (column separation) and the vertical spacing (row separation) respectively.
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.
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. .
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.
\catcode`@=11
\let \savecr \@tabularcr
\def\@tabularcr{\savecr\hline}
\catcode`@=12
\begin{tabular}{ccc}
1 & 2 & 3\\
4 & 5 & 6\\
\end{tabular}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With