将页脚添加到部分的开始/标题页

问题描述 投票:0回答:1

我正在创建Beamer幻灯片RMarkdown模板,并使用metropolis主题作为基础。 这已经包括:

  • 编号目录
  • 隐藏标题页上的页脚

现在我想将页脚添加到该部分的开始/标题页(该页面仅包含幻灯片中间下一部分的标题)。我尝试通过此代码 snipet

显示此页面上的页脚
  - |
    \makeatletter
    \def\ps@sectionpage{%
      \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021 | SIMON RESS}}}
    }
    \addtobeamertemplate{section page}{\thispagestyle{sectionpage}}{}
    \makeatother

,但它不起作用。


这是我的(最小工作示例):

幻灯片.rmd

---
title: "Title"
subtitle:  "Subtitle"
author: "Simon"
institute: "RUB"
date: "September 22, 2021"

output:
  beamer_presentation:
    keep_md: true
    keep_tex: no
    latex_engine: xelatex
    #theme: metropolis
    slide_level: 2 # which header level should be printed as slides
    incremental: no
header-includes:
  - \usetheme[numbering=fraction]{metropolis}
  - \definecolor{beaublue}{rgb}{0.74, 0.83, 0.9}
  - \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021 | SIMON RESS}}}
#hide footer on title page:
  - |
    \makeatletter
    \def\ps@titlepage{%
      \setbeamertemplate{footline}{}
    }
    \addtobeamertemplate{title page}{\thispagestyle{titlepage}}{}
    \makeatother
#show footer on section's start/title pages
  - |
    \makeatletter
    \def\ps@sectionpage{%
      \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021 | SIMON RESS}}}
    }
    \addtobeamertemplate{section page}{\thispagestyle{sectionpage}}{}
    \makeatother
#add secrtion numbers to TOC:
  - |
    \setbeamertemplate{section in toc}{
    \leavevmode%
    \inserttocsectionnumber. 
    \inserttocsection\par%
    }
    \setbeamertemplate{subsection in toc}{
    \leavevmode\leftskip=2.5em\inserttocsubsection\par}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```


## Content
\tableofcontents[]

# Level I

Test

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

# Slide with R Output

```{r cars, echo = TRUE}
summary(cars)
```
r latex r-markdown footer beamer
1个回答
1
投票

大都会主题对其部分页面使用硬编码

plain,c,noframenumbering
,但您可以像这样覆盖它们的定义:

---
title: "Title"
subtitle:  "Subtitle"
author: "Simon"
institute: "RUB"
date: "September 22, 2021"

output:
  beamer_presentation:
    keep_md: true
    keep_tex: true
    latex_engine: xelatex
    slide_level: 2 # which header level should be printed as slides
    incremental: no
header-includes:
  - \usetheme[numbering=fraction]{moloch}
  - \definecolor{beaublue}{rgb}{0.74, 0.83, 0.9}
  - \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021 | SIMON RESS}}}
#hide footer on title page:
  - |
    \makeatletter
    \def\ps@titlepage{%
      \setbeamertemplate{footline}{}
    }
    \addtobeamertemplate{title page}{\thispagestyle{titlepage}}{}
    \makeatother
#show footer on section's start/title pages
  - |
    \makeatletter
    \def\ps@sectionpage{%
      \setbeamertemplate{frame footer}{\tiny{\textcolor{beaublue}{Conference 56. Jahrestagung der DGSMP, 2021 | SIMON RESS}}}
    }
    \addtobeamertemplate{section page}{\thispagestyle{sectionpage}}{}
    
    \makeatother
#add secrtion numbers to TOC:
  - |
    \setbeamertemplate{section in toc}{
    \leavevmode%
    \inserttocsectionnumber. 
    \inserttocsection\par%
    }
    \setbeamertemplate{subsection in toc}{
    \leavevmode\leftskip=2.5em\inserttocsubsection\par}
    \makeatletter
    \renewcommand{\moloch@enablesectionpage}{
      \AtBeginSection{
        \ifbeamer@inframe
          \sectionpage
        \else
          \frame[c]{\sectionpage}
        \fi
      }
    }
    \moloch@enablesectionpage
    \makeatother
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```


## Content
\tableofcontents[]

# Level I

Test

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

# Slide with R Output

```{r cars, echo = TRUE}
summary(cars)
```

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.