在Rmarkdown中将标题分为两行以输出单词 [英] Split title in two lines in Rmarkdown for word output

查看:266
本文介绍了在Rmarkdown中将标题分为两行以输出单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了各种解决方案,这些解决方案可用于pdf和HTML文档输出.但是,没有一个对我有用.如此处建议的那样使用|时:将标题分成多行吗?只是使整个标题消失了.这是代码:

I have seen various solutions around which work for pdf and HTML document output. However, none worked for me for word output. When used | as suggested here: Split the title onto multiple lines? simply made the whole title disappear. Here is the code:

---  
title: |
    | Supporting Information
    | Development and mechanistic bla bla.
author: Some people
output:
  word_document:
    reference_docx: ACS SI style for RMD.docx
mainfont: Arial
---
<style>
body {
text-align: justify}
 p {line-height: 1.5em;}
</style>

任何帮助将不胜感激.

推荐答案

|管道无法与word一起使用.将标题设置为"".对于标题的换行并输出到单词,我们可以使用:

The | pipes do not work together with word. Set the title into "" instead. For a line wrap in the title with output to word we can use:

  \n

(重要:以两个空格开头!).

(important: headed by two spaces!).

---  
title: "Supporting Information  \nDevelopment and mechanistic bla bla."
author: Some people
output: word_document
---

屈服

Yielding

空行

Empty lines

要实现标题词中的空行,需要这些行中的内容",因此我们可以在换行代码后设置一个不间断的空格:

To achieve empty lines within the title word wants "something" in these lines, so we can set a non-breaking space after the line breaking code:

  \n &nbsp;

(再次重要: \n以两个空格开头!).

(important again: \n headed by two spaces!).

---  
title: "Supporting Information  \n &nbsp;  \n Development and mechanistic bla bla."
author: Some people
output: word_document
---

屈服

Yielding

这篇关于在Rmarkdown中将标题分为两行以输出单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆