Tables appears in disorder in appendix section (Rmarkdown)

I'm writing my Ms thesis with R markdown, and I have a problem with the Appendix section. I need to put some tables in the appendix section but when I render it the header of the subsection appears below de table. like this:

I would like to know if there are some way to fix this.

The way I write the code is:

```
# Appendix {-}

## Subsection title

chunk with table
```
R-markdown chunk:

```
title: "Title of my thesis"
subtitle: 
author: 
 - "Student :"
 - "Director: "
output: 
 pdf_document:
  number_sections: true
 latex_engine: xelatex
 template: NULL
 word_document: default
degree: Ms Biology
field: Experimental biology
year: 2021
geometry: left=2cm,right= 2 cm,top=2 cm, bottom=2 cm
papersize: a4
header-includes: 
 - \usepackage{amsmath} 
 - \usepackage{booktabs}
 - \usepackage{pdflscape}
 - \usepackage[justification=raggedright,labelfont=bf,singlelinecheck=false]{caption}
 - \usepackage{setspace}
bibliography: library.bib
csl: apa7.csl
fontsize: 11 pt
indent: true
spacing: 1.5
`` `
And chunk options: 


```
knitr::opts_chunk$set(
      echo = FALSE, 
      warning = FALSE, 
      message = FALSE,
      error =FALSE)
```

I am nearly certain this is a LaTeX setting, note the discussion here.

Could I suggest expanding on your example R Markdown, and include a dummy table that is not placed correctly? That would be a good starting point for others who'd like to help.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.