Home > OS >  fourth level title in R markdown appears after the code chunk
fourth level title in R markdown appears after the code chunk

Time:08-17

Part of my rmarkdown contains the following:

#### Chapter X

```{r}
wilcox.test(blah)
```

but the title (#### Chapter X) appears after the code chunk in rmarkdown. I need it to be where I write it (as in before the code chunk).

These are my output settings:

output:
  pdf_document:
    df_print: kable
    toc: yes
    toc_depth: 2
    latex_engine: xelatex
    keep_tex: yes
    number_sections: true
editor_options: 
  chunk_output_type: inline

How can I adjust that?

CodePudding user response:

This question: enter image description here

CodePudding user response:

I'm not sure if it's the best possible solution, but the same problem has been addressed here:

https://github.com/jgm/pandoc/issues/1658

Simply using the command:

#### Title 4
\mbox{}

solved the issue.

  • Related