在R Markdown PowerPoint导出中选择幻灯片布局
我使用R Markdown创建一个PowerPoint。
---
title: "Presentation Title"
author: "That is me"
date: "`r format(Sys.time(), '%d.%m.%Y')`"
output:
powerpoint_presentation:
reference_doc: template.pptx
slide_level: 2
---
如您所见,我使用自定义模板文件template.pptx
。
现在,我的目标是从该模板中选择要使用的布局。我知道officedown
允许块选项布局
(请参阅 https://www.apreshill.com/blog/2021-07-fcedown/ ),但我认为没有其他包装也可以使用。为什么?
当我通过kable
在页面上放置一个表时,使用模板中的“带有字幕的内容”的布局。
```{r results="asis"}
cat("\n\n## Page Title\n\n")
cat("\n\nSome content\n\n")
data.frame(matrix(c(1))) %>% kable
```
当我使用Flextable
时,使用布局“标题和内容”。
```{r results="asis", ft.left=0.9}
cat("\n\n## Page Title\n\n")
cat("\n\nSome content\n\n")
flextable(data.frame(matrix(c(1)))) %>% flextable_to_rmd
```
因此,似乎kable()
可以以某种方式告诉输出使用其他布局。有什么想法,为什么是这种情况?
内容添加标题
此布局用于任何非两列幻灯片,其中包含文本,后跟非文本(例如图像或表格)。
因此,这可能意味着flextable
未被识别为“非文本”内容。我可以添加演示文稿中不会显示的非文本内容吗?我并不希望clearpixel.gif
的时间,而是...
I create a PowerPoint with R markdown.
---
title: "Presentation Title"
author: "That is me"
date: "`r format(Sys.time(), '%d.%m.%Y')`"
output:
powerpoint_presentation:
reference_doc: template.pptx
slide_level: 2
---
As you see, I use a custom template file template.pptx
.
Now my goal ist to select which layout to be used from that template. I know that officedown
allows for a chunk option layout
(see https://www.apreshill.com/blog/2021-07-officedown/), but I think it is possible without the additional package as well. Why?
When I put a table on the page via kable
, the layout "Content with Caption" from the template is used.
```{r results="asis"}
cat("\n\n## Page Title\n\n")
cat("\n\nSome content\n\n")
data.frame(matrix(c(1))) %>% kable
```
When I use flextable
instead, the layout "Title and Content" is used.
```{r results="asis", ft.left=0.9}
cat("\n\n## Page Title\n\n")
cat("\n\nSome content\n\n")
flextable(data.frame(matrix(c(1)))) %>% flextable_to_rmd
```
So it seems that kable()
can somehow tell the output to use the other layout. Any ideas why that is the case?
The Pandoc manual says
Content with Caption
This layout is used for any non-two-column slides which contain text followed by non-text (e.g. an image or a table).
So that probably means that the flextable
is not recognizes as "non-text" content. Can I add non-text content that won't show up in the presentation? It's not that I wish back times of the clearpixel.gif
, but ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对此并不特别骄傲,但是旧的clearpixel可以完成这项工作...
谁找到了一个更清洁的解决方案(隐形元素仍然可以在PPT文件中选择),请在此处友好地将其发布在此处:)
I am not especially proud of this, but the good old clearpixel does the job...
Whoever finds a cleaner solution (the invisible elemente will still be selectable in the PPT file), please kindly post it here :)