问题描述
我在 rmarkdown :: beamer_presentation
中使用了自定义的 LaTex投影仪主题
.根据这些SO答案(
我尝试过的方法:在 beamerouterthemeTHEMENAME.sty
中定义自定义脚线 \ mode< presentation>...脚线百分比\ setbeamertemplate {footline} {\ leavevmode%\ hyperlink {目录---目录} {\ includegraphics [width = 12mm,trim = 0mm 0.4mm 0mm 0mm] {img/my_logo.png}}\ hfill\hyperlinkappendixstart{\insertframenumber/\inserttotalframenumber}\ vspace {3mm}}\ mode< all>
有关完整的MWE,请参阅我的.
在正常的投影仪代码中,您可以简单地在框架上附加标签,但是Rmarkdown看起来太愚蠢,无法正确解析 \中的方括号\开始{frame} [label = outline]
....烦人!
作为解决方法,您可以使用诸如节名之类的内容,降价会自动为其插入标签:
---副标题:具有R-markdown的光束预视"研究所:某处"日期:`r format(Sys.time(),'%B%d,%Y')`";作者:唐老鸭"输出:#beamer_presentation:默认bookdown :: pdf_book:base_format:rmarkdown :: beamer_presentation#包括:#in_header:preamble.tex主题:"THEMENAME";latex_engine:xelatex目录:假slide_level:2keep_tex:是标头包括:-\ AtBeginDocument {\ title {MWE} \ titleframe}-\ AtEndDocument {\ begin {closingframe} lalala \ end {closingframe}}-\ makeatletter \ beamer @ ignorenonframefalse \ makeatother---```{r setup,include = FALSE}knitr :: opts_chunk $ set(echo = FALSE)```##大纲{.unnumbered}\目录# 部分##带子弹滑<!-=======================================================--子弹1-第2弹-子弹3<!-附录-><!-=======================================================-```{=乳胶}\ end {frame}\附录\ begin {frame}```
并在底线使用此目标
%足迹\ setbeamertemplate {footline} {\ leavevmode%\ hyperlink {outline} {\ includegraphics [width = 12mm,trim = 0mm 0.4mm 0mm 0mm] {example-image}}\ hfill\hyperlinkappendixstart{\insertframenumber/\inserttotalframenumber}\ vspace {3mm}}
I use a custom LaTex beamer theme
in an rmarkdown::beamer_presentation
.As per these SO answers (LaTex theme, colon, theme path), I used several modifications of the YAML header and beamerthemeTHEMENAME.sty
.These LaTex hacks are necessary to apply the LaTex Beamer theme
smoothly in the rmarkdown::beamer_presentation
.
For the foot line defined in beamerouterthemeTHEMENAME.sty
, it would be very nice to have a hyperlink from the logo to the table of contents
slide (like the slide numbers are linked to the appendix
).
What I tried: define custom foot line in beamerouterthemeTHEMENAME.sty
\mode<presentation>
...
% Foot line
\setbeamertemplate{footline}{
\leavevmode%
\hyperlink{toc---table-of-contents}{\includegraphics[width=12mm,trim=0mm 0.4mm 0mm 0mm]{img/my_logo.png}}
\hfill
\hyperlinkappendixstart{\insertframenumber/\inserttotalframenumber}
\vspace{3mm}
}
\mode<all>
For a complete MWE, see my SO question here.
In normal beamer code, you could simply attach a label to the frame, but Rmarkdown seems to be too stupid to correctly parse the square brackets in \begin{frame}[label=outline]
.... annoying!
As a workaround you could use something like a section name for which markdown will automatically insert a label:
---
subtitle: "Beamer presnetation with R-markdown"
institute: "some place"
date: "`r format(Sys.time(), '%B %d, %Y')`"
author: "Donald Duck"
output:
# beamer_presentation: default
bookdown::pdf_book:
base_format: rmarkdown::beamer_presentation
# includes:
# in_header: preamble.tex
theme: "THEMENAME"
latex_engine: xelatex
toc: false
slide_level: 2
keep_tex: true
header-includes:
- \AtBeginDocument{\title{MWE}\titleframe}
- \AtEndDocument{\begin{closingframe}lalala\end{closingframe}}
- \makeatletter\beamer@ignorenonframefalse\makeatother
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Outline {.unnumbered}
\tableofcontents
# section
## Slide with Bullets
<!-- ======================================================== -->
- Bullet 1
- Bullet 2
- Bullet 3
<!-- Appendix -->
<!-- ======================================================== -->
``` {=latex}
\end{frame}
\appendix
\begin{frame}
```
and use this target in the footline
% Footline
\setbeamertemplate{footline}{
\leavevmode%
\hyperlink{outline}{\includegraphics[width=12mm,trim=0mm 0.4mm 0mm 0mm]{example-image}}
\hfill
\hyperlinkappendixstart{\insertframenumber/\inserttotalframenumber}
\vspace{3mm}
}
这篇关于使用自定义的投影仪主题在rmarkdown :: beamer_presentation中创建从徽标到目录幻灯片的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!