在 R markdown 文档(html 和演示文稿)中,是否可以手动将标题拆分为多行?我尝试玩管道,它产生了可怕的输出。
---
title: 'A title I want to split on two lines'
author:
date:
output:
ioslides_presentation
---
添加摘要的示例展示了管道的使用 |换行并包含段落。这也适用于标题和其他 yaml 元素。对于摘要或标题:
---
abstract: |
What works for the abstract.
Works for the title, too!
title: |
| title
| subtitle
output: pdf_document
---
对于 HTML 输出,只需使用
<br>
标签,而如果您的输出是 PDF 或 PDF 演示文稿,则由 \\
给出的用于换行的标准 LaTeX 代码应该可以工作。
---
title: 'A title I want to <br> split on two lines'
author:
date:
output:
ioslides_presentation
---
为了排除可能性,我尝试放置
\\
或 \newline
,两者都不会拆分,所以对于 PDF 来说似乎有点棘手。 \linebreak
停止 knitr 解析。也许另一个用户可以解决 knitr PDF 的这个问题。
对于 PDF 输出,实验表明以下方法有效:
---
title: 'A title I want to \nsplit on two lines'
author:
date:
output: pdf_document
---
即两个空格后跟
\n
。
使用
\\linebreak
进行 pdf 输出。