Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add multiple lines in the title of a PDF output in Quarto using RStudio?

I am trying to create a PDF file using Quarto in R. In the title, I want three lines: School Name, Exam (i.e., Annual or Mid-term) and Subject (i.e., Mathematics, Statistics, etc.). All these three elements will be in different lines. So, I tried using the following code.

title: `r paste0("School Name", "\\linebreak ","Annual Exam","\\linebreak ","Mathematics")`

But this is giving me an error when I render the document. So, instead of one backtick, I also tried using three backticks. But still, I could not render the document. Can you help me how I can do this?

like image 781
Eva Avatar asked Oct 19 '25 00:10

Eva


1 Answers

Try as the following,

---
title: |
  School Name \
  Annual Exam \
  Mathematics
format: pdf
---

## Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

The following also works,

---
title: |
   | School Name 
   | Annual Exam 
   | Mathematics
format: pdf
---

## Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

multiline title

like image 185
Shafee Avatar answered Oct 22 '25 03:10

Shafee