RStudio演示文稿/slidify/pandoc中的两列布局 [英] two-column layouts in RStudio presentations/slidify/pandoc
问题描述
我正在努力想出一个好的系统来生成幻灯片和附带的讲义.理想的系统将具有以下属性:
I'm trying to come up with a good system for generating slides and accompanying handouts. The ideal system would have the following properties:
- 精美的演示文稿(PDF/HTML)和讲义(PDF)布局(讲义中应留有记笔记的空间)
- 嵌入R块,图形,其他JPG/PNG图片等.
- 容易写作
- 使用命令行工具进行构建
- 书目支持 首选
-
pandoc
幻灯片分隔符格式(在指定级别的标题后自动生成新幻灯片) - 我可以接受一些额外的处理(例如,通过
sed
进行处理),但不希望编写庞大的基础架构 - 两列布局:有一个 SO帖子介绍了如何可以从pandoc中获取多列幻灯片,但它是LaTeX而非面向HTML的.
- 能够即时调整嵌入图像的大小(R生成的图形除外)和列宽
- beautiful in both presentation (PDF/HTML) and handout (PDF) layouts (handouts should have room for taking notes)
- embedded R chunks, figures, other JPG/PNG pictures, etc.
- easy to compose
- build using command-line tools
- bibliography support
pandoc
slide separator format (automatically generate a new slide after headers of a specified level) is preferred- I can live with a little bit of additional processing (e.g. via
sed
), but would prefer not to write a huge infrastructure - two-column layouts: there is a SO post on how to get multi-column slides from pandoc, but it is LaTeX- rather than HTML-oriented.
- ability to adjust sizes of embedded images (other than R-generated figures) and column widths on the fly
这是到目前为止我发现的各种选项:
Here's what I've discovered so far about the various options:
- 滑动:
-
尽管解决方法
- 创建讲义的建议是打印为PDF;我想为笔记等留出空间.(我可能会想出一种方法来使用
- Slidify:
- doesn't do
pandoc
slide separator format, although there is a workaround - the suggestion for creating handouts is to print to PDF; I'd like to leave room for notes etc. (I could probably figure out a way to do that using something like PDFtk or
psnup
...)
- 做得很好,包括指定宽度的多列
- 不支持
pandoc
幻灯片分隔符格式 - 我不知道幕后到底发生了什么. RStudio文档描述了常规HTML的翻译过程,但似乎没有涵盖R表示格式(不太一样). (我以前在中做了一些努力,弄清楚如何通过pandoc获得类似RStudio的输出 ...),这意味着我无法从命令行生成幻灯片等.
- does lots of things nicely, including multi-columns with specified widths
- doesn't support
pandoc
slide separator format - I can't figure out what's going on under the hood. There is RStudio documentation that describes the translation process for regular HTML, but it doesn't seem to cover the R presentation format (which isn't quite the same). (I have previously invested some effort in figuring out how to get RStudio-like output via pandoc ...), which means I can't generate slides etc. from the command line.
- 不幸的是,它似乎没有内置的两列格式支持. 谢一晖的HTML5示例没有显示任何两栏示例,并且声称(在幻灯片上5)单击RStudio中的编织HTML"按钮等效于
pandoc -s -S -i -t dzslides --mathjax knitr-slides.md -o knitr-slides.html
,但似乎不是...
- Unfortunately, it seems not to have built-in two-column format support. Yihui Xie's HTML5 example doesn't show any two-column examples, and it claims (on slide 5) that clicking the "Knit HTML" button in RStudio is equivalent to
pandoc -s -S -i -t dzslides --mathjax knitr-slides.md -o knitr-slides.html
, but it doesn't seem to be ...
-
尽管使用了LaTeX多年,但我确实发现LaTeX组合物比降价组合物更痛苦.
- doesn't do
- despite many years of LaTeX use I do find LaTeX composition more of a pain than markdown composition.
毕竟,我的具体问题是:为HTML输出生成两列布局的最佳(最简单)方法是什么?
After all that, my specific question is: what's the best (easiest) way to generate a two-column layout for HTML output?
任何其他建议也将不胜感激.
Any other advice will also be appreciated.
推荐答案
我现在有一种我认为是合理的解决方案,至少应该应用于基于ioslides
的解决方案,并且可能还应将(?)应用于其他基于HTML5的解决方案格式.从此处开始,我添加了
I now have what I think is a reasonable solution that should apply at least to ioslides
-based solutions, and maybe (?) to other HTML5-based formats. Starting here, I added
<style>
div#before-column p.forceBreak {
break-before: column;
}
div#after-column p.forceBreak {
break-after: column;
}
</style>
到我的文档的开头;然后将<p class="forceBreak"></p>
放在带有{.columns-2}
的幻灯片中会破坏该点的列,例如
to the beginning of my document; then putting <p class="forceBreak"></p>
within a slide with {.columns-2}
breaks the column at that point, e.g.
## Latin hypercube sampling {.columns-2}
- sample evenly, randomly across (potentially many) uncertain parameters
<p class="forceBreak"></p>
![](LHScrop.png)
[User:Saittam, Wikipedia](https://commons.wikimedia.org/wiki/File:LHSsampling.png#/media/File:LHSsampling.png)
也许有更好的方法,但这并不太痛苦.
There may be an even better way, but this isn't too painful.
@ChrisMerkord在评论中指出
@ChrisMerkord points out in comments that
.forceBreak { -webkit-column-break-after: always; break-after: column; }
而是工作(我还没有测试过...)
worked instead (I haven't tested ...)
这篇关于RStudio演示文稿/slidify/pandoc中的两列布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!