Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I force a line break in rmarkdown's title?

Tags:

r

r-markdown

I have a quite long title in a rmarkdown document and I would like to force a line break in a specific position.

Minimum example:

--- title: "Quite long title want the * line break at the asterisk" output: html_document --- 

I have tried: \n, \newline, \\ and a manual line break. None of them seem to work.

I believe it has to be quite straightforward but I haven't been able to find a solution.

like image 299
Jon Nagra Avatar asked Mar 06 '15 08:03

Jon Nagra


People also ask

How do I break a line in stackoverflow?

Add two spaces at the end, to have a soft line break, that will just add a newline to the rendered text. Add a break and an extra empty line to start a new paragraph.

How do I force a new line in R markdown?

To break a line in R Markdown and have it appear in your output, use two trailing spaces and then hit return .

How do you mark up a line break?

To create a line break or new line ( <br> ), end a line with two or more spaces, and then type return.

How do you insert a line in markdown?

In a Markdown file or widget, enter two spaces before the line break to begin a new paragraph, or enter two line breaks consecutively to begin a new paragraph.


2 Answers

Try using a pipe | in each line:

--- title: |   | Veryyyyyyy     | yyyyyyyyyyyyyy Looooo     | oooooooooooooooo   | oooooooooooong   author: "Foo Bar" date: "6 March 2015" output: html_document --- 

enter image description here

like image 124
Peter Diakumis Avatar answered Sep 24 '22 19:09

Peter Diakumis


For a centered, multi-line title:

--- title: |   <center> Veryyyyyyy </center>   <center> yyyyyyyyyyyyyy Looooo </center>   <center> oooooooooooooooo </center>   <center> oooooooooooong </center>  author: "Foo Bar" date: "6 March 2015" output: html_document --- 

enter image description here

like image 38
filups21 Avatar answered Sep 23 '22 19:09

filups21