本文介绍了覆盖rmarkdown主题以更改html页面宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将rmarkdown的输出扩展到html.我一直在尝试此解决方案,但没有成功(尽管我使用的是cerulean主题,但根据评论).还尝试按照此处所述添加css
元素-无效.
I'm trying to widen the output of rmarkdown to html. I've been trying this solution with no success (although I'm using the cerulean theme, that should be responsive according to comments). Also tried adding a css
element as described here - no effect.
我该如何进行这项工作?
How can I make this work?
推荐答案
将这些样式定义直接添加到您的RMarkdown文档中:
Add these style definitions directly to your RMarkdown document:
<style>
.main-container {
width: 100%;
max-width: unset;
}
</style>
或者,您可以通过在YAML标头如此处所述:
Alternatively you can put the style definitions in an external file like styles.css
which you link to by setting the appropriate options in the YAML header as described here:
---
output:
html_document:
css: styles.css
---
两个选项都对我有用.
这篇关于覆盖rmarkdown主题以更改html页面宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!