我想向使用Rstudio创建的R演示文稿(Rpres)幻灯片中的一个或多个幻灯片添加全屏背景图像。我知道Rstudio的R演示文稿幻灯片使用reveal.js框架来获得所有漂亮的令人眼花缭乱的效果,我想要实现的最接近的方法是遵循这里的示例:https://www.uvm.edu/rsenr/vtcfwru/R/fledglings/14_Slideshows.html,并在幻灯片开始之前添加以下行:
--- &slidebg bg:url(atlas.png);background-size:cover
### Introduction: about this talk
Blah blah blah...但是,虽然我看到了图像,但它没有居中,图像只覆盖了可用文本区域--也就是说,图像似乎被裁剪了,并且图像周围有很大的页边距。如果有一种方法可以使图像居中并删除图像周围的边距,我就会得到我想要的东西。我不希望在编织完Rpres文件后再去修改html。而且,我不希望用html重新编码我的幻灯片--我喜欢在Rstudio中用markdown创建我的幻灯片。
我确实尝试了这里的建议:Rpresentation in Rstudio - Make image fill out the whole screen具体地说,关于使用http://github.com/regisb/reveal.js-fullscreen-img的注释,但我不能让它工作--要么是建议的解决方案不能很好地处理Rpres文件,要么是自述文件中的信息不足以让我拼凑出一个杂乱无章的东西来让它工作。
这似乎是一个非常简单的请求。当然,像给幻灯片添加背景图片这样简单的事情也不会这么难吧?有什么想法吗?
发布于 2015-12-05 00:10:53
下面是来自这里的另一个答案:Rstudio 0.98.1028 add background image only to title slide
您可以使用包含图像作为背景的自定义css文件。我们将其命名为css-file.css:
<style>
/* Your other css */
body {
background-image: url(http://goo.gl/yJFbG4);
background-position: center center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: 100% 100%;
}
.section .reveal .state-background {
background-image: url(http://goo.gl/yJFbG4);
background-position: center center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: 100% 100%;
}
</style>您可以将其包含在.Rpres文件的开头:
test
========================================================
author:
date:
css:css-file.css这应该会在标题页上给你一个背景图像,并且经过一些编辑,也会出现在下面的页面上。
哈!
https://stackoverflow.com/questions/34090164
复制相似问题