Warm tip: This article is reproduced from serverfault.com, please click

Change width of beamercolorbox of new section slide in RMarkdown

发布于 2020-12-01 10:19:23

I am new to beamer and am making a presentation in RMarkdown whose MWE is as follows:

---
title: "Presentation Title"
author: "Name"
institute: "Institute"
date: "Date"
output:
  beamer_presentation:
    incremental: true
    theme: "Berlin"
    colortheme: "dove"
    fonttheme: "structurebold"
    includes:
      in_header: preamble.tex
classoption: "aspectratio=169"

---

# Introductions

## subsection 1

- content A

- content B

# Course Details

# Getting Started

# Summary

preamble.tex is as follows:

\usepackage{caption}
\captionsetup[figure]{labelformat=empty}
\setbeamercolor{frametitle}{fg=white,bg=black} %section slide title
\setbeamercolor{section in foot}{fg=white, bg=black} % footsections
\setbeamercolor{part title}{fg=white, bg=black}
\setbeamertemplate{footline}
{
 \hbox{%
  \begin{beamercolorbox}[wd=.33\paperwidth,ht=2.6ex,dp=1ex,left,leftskip=2ex]{section in foot} % footsection 1
    \usebeamerfont{section in foot}\insertshortauthor
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.33\paperwidth,ht=2.6ex,dp=1ex,center]{section in foot} % footsection 2
    \usebeamerfont{section in foot} \inserttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.34\paperwidth,ht=2.6ex,dp=1ex,right,rightskip=2ex]{section in foot} % footsection 3
    \usebeamerfont{section in foot} email
  \end{beamercolorbox}}%

  \vskip0pt%
}

Currently the section titles look like this:

enter image description here

I want the beamercolorbox containing the section titles to stretch through the entire pagewidth. I'm unable to identify the correct beamer attribute to do that. Please suggest how I may achieve this.

Questioner
wrahool
Viewed
0
samcarter_is_at_topanswers.xyz 2020-12-01 18:40:42

You can modify your preamble.tex like this:

\usepackage{caption}
\captionsetup[figure]{labelformat=empty}
\setbeamercolor{frametitle}{fg=white,bg=black} %section slide title
\setbeamercolor{section in foot}{fg=white, bg=black} % footsections
\setbeamercolor{part title}{fg=white, bg=black}
\setbeamertemplate{footline}
{
 \hbox{%
  \begin{beamercolorbox}[wd=.33\paperwidth,ht=2.6ex,dp=1ex,left,leftskip=2ex]{section in foot} % footsection 1
    \usebeamerfont{section in foot}\insertshortauthor
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.33\paperwidth,ht=2.6ex,dp=1ex,center]{section in foot} % footsection 2
    \usebeamerfont{section in foot} \inserttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.34\paperwidth,ht=2.6ex,dp=1ex,right,rightskip=2ex]{section in foot} % footsection 3
    \usebeamerfont{section in foot} email
  \end{beamercolorbox}}%

  \vskip0pt%
}


\setbeamertemplate{section page}{
  \centering
  \begin{columns}
  \begin{column}{\paperwidth}
  \begin{beamercolorbox}[sep=12pt,center]{part title}
    \usebeamerfont{section title}\insertsection\par
  \end{beamercolorbox}
  \end{column}
  \end{columns}
}

enter image description here