Reputation: 5898
How do I insert a linebreak in the title of an rmarkdown document? This does not work:
---
title: "title \break subtitle"
output: pdf_document
---`
Upvotes: 16
Views: 9950
Reputation: 20811
Use pipes
The pipe symbol at the end of a line in YAML signifies that any indented text that follows should be interpreted as a multi-line scalar value. See the YAML spec.
Specifically, the pipe indicates that (except for the indentation) the scalar value should be interpreted literally in such a way that preserves newlines. Conversely, the
>
character indicates that multi-line "folded" scalar follows, meaning that newlines are converted to spaces.
what is the use of pipe symbol in yaml
---
title: |
| title
| subtitle
output: pdf_document
---
This is a duplicate but I can't find the original.
edit: here it is!
How can I force a line break in rmarkdown's title?
Upvotes: 30