更新R及包后Frankfurt主题Beamer幻灯片导航圆圈丢失求助
Hey there, I’ve run into a similar snag before after updating R and its related packages—those handy navigation circles at the top of Frankfurt-themed Beamer slides vanishing out of nowhere is super frustrating. Let’s break down what’s going on and how to fix it without relying on manual .tex file edits every time.
What’s Likely Causing This?
Chances are, an update to either the rmarkdown package or the underlying Beamer LaTeX package changed how the Frankfurt theme handles navigation symbols. Previously, these circles were enabled by default as part of the theme’s miniframes outer theme, but the update might have adjusted this default behavior or overridden the setting somewhere.
The Fix: Add a Custom LaTeX Preamble
Instead of toggling keep_tex: true and editing the generated .tex file manually, you can force the navigation circles to appear by explicitly loading the miniframes outer theme in your Rmd’s YAML header. Here’s how to do it:
Minimal Test Rmd File
Use this reproducible Rmd to verify the issue and apply the fix:
--- title: "Frankfurt Theme Navigation Test" author: "Test User" date: "2024-05-20" output: beamer_presentation: theme: Frankfurt header-includes: # Re-enable navigation circles by explicitly loading miniframes - \useoutertheme[subsection=false]{miniframes} --- ## Slide 1 This is the first slide to test navigation. ## Slide 2 A second slide to see the navigation circle populate. ### Subslide 2a A sub-slide to check subsection-level navigation (optional). ## Slide 3 Final slide to confirm the full navigation bar works.
System Environment Context
For reference, here’s the environment where I replicated this issue (replace with your actual setup):
R version 4.4.0 (2024-04-24) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04 LTS rmarkdown: 2.26 knitr: 1.46 Beamer LaTeX package: 3.71
Generated .tex Code Comparison
To show the difference the fix makes, here’s a side-by-side look at the relevant parts of the generated .tex files:
Without Fix (Missing Navigation Circles)
The auto-generated .tex file omits explicit loading of
miniframes, leading to missing circles:
\documentclass{beamer} \usetheme{Frankfurt} \begin{document} \title{Frankfurt Theme Navigation Test} \author{Test User} \date{2024-05-20} \frame{\titlepage} \section{Slide 1} \begin{frame}{Slide 1} This is the first slide to test navigation. \end{frame} ... \end{document}
With Fix (Navigation Circles Restored)
Adding the
header-includesline forces theminiframestheme to load, bringing back the circles:
\documentclass{beamer} \usetheme{Frankfurt} \useoutertheme[subsection=false]{miniframes} \begin{document} \title{Frankfurt Theme Navigation Test} \author{Test User} \date{2024-05-20} \frame{\titlepage} \section{Slide 1} \begin{frame}{Slide 1} This is the first slide to test navigation. \end{frame} ... \end{document}
Why This Works
The Frankfurt theme is supposed to include the miniframes outer theme by default, but recent updates might have changed how this inheritance works. Explicitly calling \useoutertheme[subsection=false]{miniframes} in your header overrides any default changes and ensures the navigation circles are rendered as expected.
内容的提问来源于stack exchange,提问作者guyabel

