LaTex will keep all rows of a table on the same page if possible. However, I found that, if I render a RMarkdown document into a PDF file, a table may span two pages if it is near the end of a page. This is odd to me because I believe the RMarkdown file is actually converted to a LaTex file before generating the PDF file.
---
title : "Table"
output :
pdf_document
---
# Section 1
# Section 2
# Section 3
# Section 4
# Section 5
# Section 6
# Section 7
# Section 8
# Section 9
# Section 10
# Section 11
# Section 12
# Section 13
Column 1 | Column 2 |
------------- | -------------|
1) Cell | Cell |
2) Cell | Cell |
3) Cell | Cell |
4) Cell | Cell |
5) Cell | Cell |
6) Cell | Cell |
7) Cell | Cell |
8) Cell | Cell |
9) Cell | Cell |
10) Cell | Cell |
11) Cell | Cell |
12) Cell | Cell |
13) Cell | Cell |
14) Cell | Cell |
15) Cell | Cell |
16) Cell | Cell |
17) Cell | Cell |
18) Cell | Cell |
If this is saved in temp.Rmd
and then converted to a PDF file by render("temp.Rmd", output_file="temp.pdf")
, the first twelve rows appear on page one and the remaining rows appear on page 2:
Is it possible to ask render (or pandoc?) to add additional lines before a table if necessary such that all rows of a table will appear on the same page?