I've read the answer given here but haven't been able to modify the code to allow me to insert \hline between each row added to my table.

How can the code by modified to insert \hline each time a new row is defined?

So there would be a line between R1C1 | R1C2 and R2C1 | R2C2 just like there's a line between the headers and the main table contents.

Table without bordered rows

1 Answer 1


The insertion of \@gobble at the start of \foorows in the linked answer is meant to gobble the first & of the row. You can insert \hline just before that to always insert a horizontal rule with every \addtotable:

enter image description here



  \g@addto@macro\foorows{\hline\@gobble}% Insert horizontal rule and gobble first &



  \begin{tabular}{ |c|c|c|c| }
    Header 1 & Header 2 & Header 3 & Header 4 \\ \hline % Header row

  • Worked perfectly! Thank you for you prompt and informative reply. Mar 9, 2017 at 7:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .