经常需要自定义演示的标题页。
例如,我们想要:
基础外观:
---
title: "My beautiful presentation"
author: "John Doe"
institute: "New Town University"
output:
beamer_presentation:
latex_engine: lualatex
keep_tex: true
header-includes: |
\usepackage{tikz}
\usepackage[absolute,overlay]{textpos}
\usetheme{metropolis}
---
然后奇怪的是,当我想通过(
title:
等被删除)添加一些东西时:
\setbeamertemplate{title page}{
\insertsubtitle{My new presentation}
}
...我的标题页消失了(现在目录是第一页)。
当我尝试通过
\begin{textblock*} ... \end{textblock*}
或 \includegraphics[trim= ...]{pic.png}
添加新标签时,情况相同
当保留标题等时 - 我们只能看到副标题/文本块/图片:
哪里有问题?
更新。
在标签下,我假设在所需位置有一个文本。抱歉造成误会。
看这张图片,如何做到这一点?
我还想问一下,这个方案如何与rmarkdown结合起来?在
header-includes
中逐帧添加是可以的,但是如何通过#、##等方式用R代码添加帧呢?
如果您使用
\setbeamertemplate{title page}{
...
}
您指示 Latex 丢弃现有的标题页并将其替换为您在此模板中编写的任何代码。
此外,语法
\insertsubtitle{My new presentation}
是错误的。要设置副标题,您应该使用 \subtitle{...}
(不在标题页内!),如果您想在自定义标题页中插入副标题,您可以使用 \insertsubtitle
(该宏没有任何参数! )
- 删除标题页码;
使用
plain
框架
- 添加徽标或横幅;
使用
\titlegraphic{...}
- 移动标题、副标题等;
如果您只需要进行较小的修改,您可以调整标题页上使用的相应模板。例如,要将标题图形居中并在其上方添加一些文本,请调整
title graphic
模板。
如果您需要彻底修改标题页,请从您使用的主题中复制定义,然后进行您喜欢的更改。
从大都会主题的定义开始,并将其修改为您喜欢的任何布局
- 添加标签;
就像在任何其他带有
label=...
选项的框架中一样
\documentclass{beamer}
\title{text}
\author{names}
\usetheme{moloch}
\addtobeamertemplate{title graphic}{\centering some text here\par}{}
\titlegraphic{\includegraphics[width=3cm]{example-image-duck}}
\begin{document}
\begin{frame}[plain,label=whatever]
\titlepage
\end{frame}
\end{document}
---
output:
beamer_presentation:
latex_engine: lualatex
keep_tex: true
header-includes: |
\usetheme{moloch}
\addtobeamertemplate{title graphic}{\centering some text here\par}{}
\titlegraphic{\includegraphics[width=3cm]{example-image-duck}}
\AfterBeginDocument{\title{text}\author{names}}
---
## {.plain}
\titlepage
##
\tableofcontents
# a new section
## next frame