问题描述
我正在尝试使用RMarkdown投影仪创建第一组幻灯片。
到目前为止我所拥有的:
---
title: title
author: author
date: date
output: beamer_presentation: default
ioslides_presentation: default
linkcolor: blue
---
## Plan for today
text
## Outline
text
## Day 1
text
## Day 2
text
## Day 3
text
## Day 4
text
## Day 5
text
我看到的演示文稿的标题顶部是目录,当演示者更改为具有不同部分的新幻灯片时,它将突出显示演示者所在的标题部分。为此,我需要什么代码?理想情况下,我想要在目录中的“今天计划”和“概述”下的简介下,然后是第一天,第二天等。最多结论。
我也想:
有什么想法吗?预先非常感谢。
解决方法
对于标题中的TOC,最好在predefined themes中选择支持此TOC的目录,例如 Szeged ,然后在YAML中使用theme: Szeged
指定它。 / p>
要获得所需的轮廓,您需要使用第一级(以#
开头)和第二级(以##
开头)标题的正确组合,请参见下文。我还设置了slide_level: 3
。
在右上角添加徽标,在页脚和自定义标题幻灯片中添加页码,需要在用于编译最终PDF输出的模板中插入一些LaTeX代码。您可以使用.Rmd文件的YAML标头中的includes
选项,将代码包含在单独的.tex文件中,以实现此目的。它应该看起来像这样:
presentation.Rmd
---
output:
beamer_presentation:
theme: Szeged
slide_level: 3
includes:
in_header: header.tex
---
# Introduction
## Plan for today
text
## Outline
text
# Day 1
text
# Day 2
and so on ...
# Conclusion
your conclusion
header.tex
% add custom title slide
\setbeamertemplate{title page}{
\inserttitle\\[0.5ex]
\insertauthor\\[0.5ex]
\insertdate
\pagenumbering{gobble}
\thispagestyle{plain}
}
% remove title slides at beginning of sections
\AtBeginSection{}
\AtBeginSubsection{}
% add page counter to the footer
\setbeamertemplate{footline}[frame number]
\setbeamertemplate{frametitle}{}
% add logo
\usepackage{textpos}
\addtobeamertemplate{frametitle}{}{%
\begin{textblock*}{100mm}(0.9\textwidth,0.5cm)
\includegraphics[height=0.5cm,width=1cm]{logo}
\end{textblock*}}
徽标是here中的.PNG文件。为了使图像更好地显示,您可能需要对位置和大小进行一些调整。请注意, header.tex 和 logo.png 必须与 presentation.Rmd 位于同一目录。