将标题拆分为多行?

Tho*_*del 16 markdown yaml r rstudio r-markdown

在R降价文档(html和演示文稿)中,是否可以手动将标题拆分为多行?我试着玩管道产生orrendous输出.

---
title:  'A title I want to split on two lines'
author: 
date: 
output:
  ioslides_presentation
---
Run Code Online (Sandbox Code Playgroud)

Sab*_*DeM 19

对于HTML输出,只需使用<br>标记,而如果您的输出是PDF或PDF表示,则标准LaTeX代码可以使用的断行符号\\.

---
title:  'A title I want to <br> split on two lines'
author: 
date: 
output:
  ioslides_presentation
---
Run Code Online (Sandbox Code Playgroud)

对于PDF

只是为了排除可能性,我试图放\\或者\newline两者都不分裂,所以对于PDF来说似乎有点棘手.\linebreak停止编织解析.也许其他用户可以为knitr PDF解决这个问题.


use*_*804 14

对于PDF输出,实验表明以下工作:

---
title:  'A title I want to  \nsplit on two lines'
author: 
date: 
output: pdf_document
---
Run Code Online (Sandbox Code Playgroud)

那是两个空格\n.

  • 对于我来说,这是唯一适用于`bookdown :: pdf_document2`文档类型的解决方案. (3认同)
  • 也适用于 `word_document` 和 `bookdown::word_document2` (3认同)

Phi*_*p R 14

添加abtract的示例显示了管道的使用 打破线条并包含段落.这适用于标题和其他yaml元素.对于摘要或标题:

---
abstract: |
    What works for the abstract.

    Works for the title, too!
title: |
    | title 
    | subtitle
output: pdf_document 
---
Run Code Online (Sandbox Code Playgroud)

  • 这是一个很好的解决方案。非常感谢您撰写本文。 (3认同)