You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在R Markdown Beamer演示文稿中设置页脚短标题?

当然可以实现!不用依赖uiucthemes这类特定主题,我们可以直接利用Beamer本身的内置命令或者R Markdown的自定义配置来完成这个需求,下面给你几个简单可行的方案:

方案1:直接用Beamer的短标题命令

Beamer原生支持设置独立的短标题,只需要在YAML的header-includes里添加\shorttitle{}命令即可,主标题保持原来的设置:

---
title: "Long title that describes my presentation in detail"
output: beamer_presentation
header-includes:
  - \shorttitle{Short Title}
---

这样设置后,演示文稿的首页会显示你定义的长标题,而所有幻灯片的页脚(以及其他调用\insertshorttitle的位置)都会自动替换成短标题——大部分Beamer默认主题的页脚模板都是用\insertshorttitle来显示标题的,所以这个方案基本通用。

方案2:通过\title的可选参数覆盖

如果你想更直接地控制标题的显示逻辑,可以使用Beamer的\title[短标题]{长标题}语法,在header-includes里覆盖默认的标题定义:

---
output: beamer_presentation
header-includes:
  - \title[Short Title]{Long title that describes my presentation in detail}
---

这个方法和方案1效果一致,区别是直接通过\title命令同时定义长短标题,不需要单独写\shorttitle。

方案3:自定义页脚模板(针对特殊主题)

如果遇到某些自定义主题的页脚没有使用\insertshorttitle,那我们可以手动修改页脚模板,强制显示短标题。比如下面的配置会让页脚显示短标题和页码:

---
title: "Long title that describes my presentation in detail"
output: beamer_presentation
header-includes:
  - \shorttitle{Short Title}
  - \setbeamertemplate{footline}{\hfill\insertshorttitle\hfill\insertframenumber/\inserttotalframenumber\vskip2pt}
---

你可以根据自己的需求调整\setbeamertemplate{footline}里的内容,比如调整位置、添加其他元素等。

以上方案都不需要依赖任何第三方主题,完全基于Beamer原生功能实现,亲测有效!

内容的提问来源于stack exchange,提问作者Daniel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 04:04:27