2

When I write:

#Head1  
##Head2  
###Head3  
####Head4  

The first three headers are successfully displayed in the pdf output.
But for the ###Head4, it cannot separate with the next line, the next line sentence just starts at the end of the head, not automatically start a new line.

I tried to add a double space after the Head4, it still failed.

I also tried to add a blank line after Head4, but it still failed!

Could anyone help me to deal with this issue? Thanks a lot!!!!

enter image description here

enter image description here

Phil
  • 7,287
  • 3
  • 36
  • 66
Hannah
  • 21
  • 1
  • 3
    That is correct. The fourth level is inline, in the same way that it is for [APA style](https://apastyle.apa.org/style-grammar-guidelines/paper-format/headings). If you want something different, you could use a [different pandoc template](https://bookdown.org/yihui/rmarkdown/pdf-document.html#custom-templates-1). – Taren Sanders Oct 17 '21 at 23:20
  • I have tried *template: quarterly-report.tex* at the beginning, it shows "Could not find data file templates\quarterly-report.tex". – Hannah Oct 17 '21 at 23:42
  • 1
    Does this answer your question? [Level 4 Heading issue in R Markdown](https://stackoverflow.com/questions/33134416/level-4-heading-issue-in-r-markdown) – Taren Sanders Oct 18 '21 at 01:24
  • @Hannah sorry if that wasn't clear. *quarterly-report.tex* is an example of a custom template. You can search the web for custom latex templates to find one that fits your needs. It needs to go in the same folder as the .Rmd file. – Taren Sanders Oct 18 '21 at 01:25
  • @Taren Sanders Thanks for your sharing, this helps a lot! – Hannah Oct 18 '21 at 03:43
  • @Taren Sanders Thanks! I have created a new tex file in the same path as the rmd file, but it didn't run successfully. – Hannah Oct 18 '21 at 03:45
  • 2
    Just for the record: I votes to close as duplicate of https://stackoverflow.com/questions/33134416/level-4-heading-issue-in-r-markdown , unfortunately the close notice will display "off-topic" as reason because the majority voted this way .... makes no sense, but that's what the system does – samcarter_is_at_topanswers.xyz Oct 18 '21 at 08:53

1 Answers1

-2

not best practice probably, but a good ol' <br> would probably do it.

  • 2
    `
    ` is a HTML command, and pdf output is handled with LaTeX, so this wouldn't work. The equivalent LaTeX command would be `\newline`.
    – Taren Sanders Oct 18 '21 at 01:27