需要在 Beamer 中居中显示标题

需要在 Beamer 中居中显示标题

我要制作一个演示文稿,我需要指定每个页面的分类(未分类),这些分类位于最顶部(框架标题上方)和最底部。\setbeamertemplate{headline}{UNCLASSIFIED}例如,我尝试使用,但它所做的只是将分类粘贴在最左侧。当我在内添加它时\begin{center}{}\end{center},什么也没发生。无论哪种情况,我都无法获得页脚。

\documentclass[t]{beamer}
\begin{document}
\section{Background:  The Problem}
\frame{
\setbeamertemplate{headline}
{
\begin{center}
{\bf UNCLASSIFIED} 
\end{center}
}
\frametitle{Background:  The Problem}
\begin{itemize}
{\small
\item stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff;
\item stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff;
\item stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff;
\item stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff;
\item stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff;
\item stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff;}
\end{itemize}
\setbeamertemplate{footline}
{
\begin{center}{\bf UNCLASSIFIED}
\end{center}
}
}
\end{document}

答案1

您可以尝试这样的事情:

\documentclass[t]{beamer}

\defbeamertemplate{headline}{class}[1]{%
    \vskip5pt%
    \makebox[\paperwidth][c]{\textbf{#1}}%
}

\defbeamertemplate{footline}{class}[1]{%
    \vskip-3pt
    \begin{minipage}[t][2cm][t]{\paperwidth}
        \centering
        \textbf{#1}\\
    \end{minipage}
}

\begin{document}

    \setbeamertemplate{headline}[class]{unclassified}
    \setbeamertemplate{footline}[class]{unclassified}
    \begin{frame}
        \frametitle{Background:  The Problem}
        test
    \end{frame}

    \setbeamertemplate{headline}[class]{classified}
    \setbeamertemplate{footline}[class]{classified}
    \begin{frame}
        \frametitle{Background:  The Problem}
        test
    \end{frame}

\end{document}

在此处输入图片描述

相关内容