There is an old answer that gives the trick to do that in latex, but in needs a bit of adaptation to pandoc. One needs to add this to the latex code:
\catcode`@=11
\let \savecr \@tabularcr
\def\@tabularcr{\savecr\hline}
\catcode`@=12
However, it doesn't work if you add it through header-includes, probably because it is too late in the template. So the solution is to create a new template pandoc -D latex > template.tex
(or use your usual template) and to add the previous code at the top, just after \documentclass
. Then:
---
title: "Untitled"
output:
pdf_document:
keep_tex: yes
template: "template.tex"
---
Produces lines at every row. The problem is, then, that the top and bottom line are doubled.
This is impossible for a docx output. Pandoc's docx template allow very little customization, and only of paragraph style.
For the sake of completeness, the html solution is even easier:
---
title: "Untitled"
output: html_document
---
<style>
th, td {
border-bottom: 2px solid black;
}
</style>