使用RMarkdown将投影仪演示文稿嵌入到常规文档中 [英] Embedding a beamer presentation in a regular document with RMarkdown

查看:104
本文介绍了使用RMarkdown将投影仪演示文稿嵌入到常规文档中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是用markdown(更具体地说是rmarkdown)编写一个文档,该文档可以同时编译为常规PDF(或其他)文件演示文稿.时间,来自同一来源. (使用knitr.)场景:除常规文本外,文档还包括每个段落的一句话摘要,这些摘要应作为要点显示在演示文稿中.

My aim is write a document in markdown (rmarkdown, more specifically), that can be compiled both to a regular PDF (or other) file and a beamer presentation at the same time, from the same source. (Using knitr.) Scenario: the document includes, in addition to the regular text, one sentence summaries for each paragraph and these should go to the presentation as the bullet points.

我知道我可以将文档编译为几种不同的格式knitr同时输出格式,但是这里的问题是另外一个问题:文档的内容.如何包含这些句子...?我必须以某种方式标记它们,并实现将它们 not 编译为常规PDF,,同时仅将它们编译进入投影仪演示!

I know that I can compile a document to several different output formats at the same time with knitr, but the problem here is something else: the content of the document. How to include those sentences...? I must mark them somehow, and achieve that they're not compiled into the regular PDF, and at the same time only they should be compiled into the beamer presentation!

这里有什么解决方案?

(我打算用bookdown来做到这一点,但我觉得没关系.)

(I'm planning to do this with bookdown, but I have the feeling that it doesn't matter.)

推荐答案

我终于设法建立了一种可行的方法-我认为-完美,尽管它有一些不太优雅的解决方案,所以有很多可能(很大)的改进空间.

I finally managed to put together an approach which is working - I believe - perfectly, although it has some not-really-elegant solutions, and therefore there is very likely (a lot of) room for improvement.

基本思想是在HTML和PDF中都包括边距注释,然后这些边距注释就是将在演示文稿中显示的那些边距注释.因此,它们有两个目的:对该段的简要概述(某种Tufte风格)和创建演示文稿的基础.

The basic idea is to include margin notes, both in HTML and PDF, and then these margin notes are those that will be displayed in the presentation. So they serve two purpose: a quick summary of the paragraph (somewhat Tufte-style) and the basis for creating the presentation.

该演示文稿仅以一种格式提供,没有增量版本,其中要点一一出现. (实际上,根本没有更多的要点,文本只是以句子的形式显示在不同的段落中.)

The presentation comes only in one format, there is no incremental version, where bullet points appear one-by-one. (Actually, there are no more bullet points at all, texts are simply displayed as sentences in different paragraphs.)

为此,我使用了自定义块功能>:

To achieve this, I used the custom block function of bookdown:

    Text

    ```{block, type="handout"}
    Margin note
    ```

    Text

以下是详细信息:

  • 编译为HTML时,自定义块可以使用适当的type方便地编译为div,因此我们要做的就是在CSS文件中设置其格式:
  • When compiling to HTML, the custom block conveniently compiles into a div, with appropriate type, so all we have to do is the format it in the CSS file:
p {
  text-align: justify;
  width: 80%;
  margin-left: 0;
  margin-right: 20%;
}
li:not(.chapter) {
  text-align: justify;
  width: 80%;
  margin-left: 0;
  margin-right: 20%;
}
.handout {
  float: right;
  clear: right;
  width: 18%;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  line-height: 1.3;
  vertical-align: baseline;
  position: relative;
}
.handout p {
  font-size:100%;
  line-height:1.3;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto;
}

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