如何在 rmarkdown 的 knitr 输出中控制带有图像的标题下的行?

时间:2021-01-04 09:14:46

标签: r-markdown knitr

在 R Markdown 中某些输出格式(例如 output: github_document)的标题 (#) 下会出现一行,但在其他格式中则不会。有没有办法显式控制这个参数?

所需的输出,使用

---
output: github_document
---

github_document

输出使用:

---
output: html_document
---

html_document

输出使用:

---
output: distill::distill_article
---

distill::distill_article

我的理想是以 distill_article 格式复制 github_document 的输出(下面有一行,图像旁边的文本),但我也只满足于以 html_document 格式复制该行。

以下目标输出的完整代码:

---
output: github_document
---

<style>
body {text-align: justify}
</style>

# distill for R Markdown <img src="rmarkdown.png" align="right" height="200" style="margin-left: 60px" />

This is some text underneath of the title. Lasciate ogne speranza voi ch'entrate. I grow old, I grow old. I shall wear the bottoms of my trousers rolled. Shall I part my hair behind? Do I dare to eat a peach? I shall wear white flannel trousers and walk upon the beach. I have heard the mermaids singing each to each.

I do not think that they will sing to me.

1 个答案:

答案 0 :(得分:0)

您可以使用虚线 ---- 来获得相同的效果:

# distill for R Markdown 

--------------------------------------------------------------

This is some text underneath of the title. Lasciate ogne speranza voi ch'entrate. I grow...

提取 R Markdown


这是标题下方的一些文字。 Lasciate ogne speranza voi ch'entrate。我长大了...

这是带有图像的 html 输出:

enter image description here