简体   繁体   English

使用rmarkdown和knitr将部分添加到Beamer演示中

[英]Add sections to beamer presentation using rmarkdown and knitr

I am trying to add section slides to a beamer presentation written in rmarkdown using the latex command \\section{} . 我正在尝试使用乳胶命令\\section{}将部分幻灯片添加到以rmarkdown编写的投影仪演示文稿中。 However, it gets inserted between a \\begin{frame} & \\end{frame} automatically during the conversion, which causes the compilation to fail. 但是,在转换过程中会自动将其插入\\begin{frame}\\end{frame} ,这会导致编译失败。 Is there any way to stop this happening so that the section slide can be added without having to manually edit the tex file? 有什么方法可以阻止这种情况的发生,以便可以添加章节幻灯片而无需手动编辑tex文件?

Here is my rmarkdown code: 这是我的rmarkdown代码:

---
title: "Beamer presentation"
output: beamer_presentation
---

\section{Section one}

which gets converted to: 转换为:

\title{Beamer presentation}

\begin{document}
\frame{\titlepage}

\begin{frame}
\section{Section one}
\end{frame}

\end{document}

Slides and section slides are both defined by markdown headings, a series of # character at the beggining of a line, the number of # indicating the hierarchical level of the title. 幻灯片和节幻灯片均由降价标题,一系列限定#在一行的beggining,数量字符#指示的标题的分层等级。

By default [the level that defines frames] is the highest header level in the hierarchy that is followed immediately by content, and not another header, somewhere in the document. 默认情况下,[定义框架的级别]是层次结构中的最高标题级别,紧随其后的是内容,而不是文档中某处的另一个标题。

All title of higher level than this one will become section titles. 高于此级别的所有标题将成为部分标题。

From the rmarkdown documentation ; 来自rmarkdown文档 ; See also the pandoc documentation on slideshows . 另请参见幻灯片上pandoc文档

For instance : 例如 :

# Section title

## Frame title

Frame content

### Subtitle inside a frame

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM