我想在目录之后的所有幻灯片上添加一个“返回”按钮,返回目录本身,但不完全在页脚上(如图所示如何编辑 Beamer 主题 CambridgeUS)。我已手动在第一张幻灯片上使用了它(参见下面的 MWE),但我想将其放在整个文档中(当然,标题和目录框架除外)。有没有办法不手动操作?
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usetheme{Boadilla}
\begin{document}
\title{Apresentação RLZ}
\author{RLZ}
\date{\today}
\begin{frame}
\titlepage
\end{frame}
\section*{Sumário}
\label{toc}
\frame{\tableofcontents}
\begin{frame}
\frametitle{Conceitual}
\framesubtitle{Instituição dos procedimentos eletrônicos, iniciado no encontro de Salvador (julho de 2004) e concretizado em São Paulo (abril de 2005)}
\begin{itemize}[<alert@+>]
\item \textbf{NF-e} -- Nota Fiscal Eletrônica (Emenda Constitucional nº 42)
\item \textbf{NFS-e} -- Nota Fiscal de Serviços Eletrônica
\item \textbf{SPED} -- Sistema Público de Escrituração Digital (Decreto nº 6022/2007)
\end{itemize}
\end{frame}
\vfill
\hyperlink{toc}{\beamergotobutton{Voltar ao início}}
\end{document}
答案1
更新:
我最初提出的解决方案(现在位于底部)与主题相关,因为它涉及模板的重新定义footline
(模板可能因主题而异)。现在,我提出一个更简单的解决方案,它不依赖于所用的主题。这个想法是使用模板background canvas
和\node
(在tikzpicture
具有选项的环境中remember picture,overlay
)将按钮放置在所需位置:
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage[brazil]{babel}
\usetheme{Boadilla}
\newcommand\AddButton{%
\setbeamertemplate{background canvas}{%
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=west] at ([yshift=20pt,xshift=1em]current page.south west)
{\hyperlink{toc}{\beamergotobutton{Voltar ao início}}};
\end{tikzpicture}%
}%
}
\title{Apresentação RLZ}
\author{RLZ}
\date{\today}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}[label=toc]
\tableofcontents
\end{frame}
\AddButton
\section{Test Section}
\begin{frame} test frame \thepage \end{frame}
\begin{frame} test frame \thepage \end{frame}
\begin{frame} test frame \thepage \end{frame}
\end{document}
第一个想法(取决于主题):
这是一种可能性;我的想法是定义一个命令(\AddButton
在我的代码中),将按钮作为主题footline
使用的模板的一部分Boadilla
;只需在按钮必须包含在所有连续帧中的位置发出命令(您可以通过更改我的代码中标记的行中使用的长度来更改按钮的位置% HERE
):
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usetheme{Boadilla}
\makeatletter
\newcommand\AddButton{%
\setbeamertemplate{footline}
{
\leavevmode%
\vskip-15pt% HERE
\hskip1em\hyperlink{toc}{\beamergotobutton{Voltar ao início}}% HERE
\vskip5pt% HERE
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
\usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}%
}
\makeatother
\title{Apresentação RLZ}
\author{RLZ}
\date{\today}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}[label=toc]
\tableofcontents
\end{frame}
\AddButton
\section{Test Section}
\begin{frame} test frame \thepage \end{frame}
\begin{frame} test frame \thepage \end{frame}
\begin{frame} test frame \thepage \end{frame}
\end{document}