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

假装没事ソ 提交于 2019-12-21 07:57:42

问题


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?


回答1:


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

\begin{tabular}{ccc}
1 & 2 & 3\\ 
4 & 5 & 6\\
\end{tabular}


来源:https://stackoverflow.com/questions/3174697/make-latex-draw-a-hline-between-each-line-in-tabular-without-using-hline

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!