微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

RMarkdown投影仪和目录

如何解决RMarkdown投影仪和目录

我正在尝试使用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

我看到的演示文稿的标题顶部是目录,当演示者更改为具有不同部分的新幻灯片时,它将突出显示演示者所在的标题部分。为此,我需要什么代码?理想情况下,我想要在目录中的“今天计划”和“概述”下的简介下,然后是第一天第二天等。最多结论

我也想:

  1. 在右上角的标题添加图片
  2. 页面右下角的页脚中添加页码,例如3/14(仅在标题页之后)

有什么想法吗?预先非常感谢。

要做什么的图片

enter image description here

解决方法

对于标题中的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 位于同一目录。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。