Beamer 颜色框无法扩展以覆盖帧数

Beamer 颜色框无法扩展以覆盖帧数

beamer我在 lyx 中的 Latex 序言:

\usetheme{Madrid}
\hypersetup{pdfpagemode=None}
\defbeamertemplate*{footline}{mytheme}
{
   \leavevmode%
   \hbox{%
   \begin{beamercolorbox}[wd=.7\paperwidth,ht=2.75ex,dp=1ex,center]{author in head/foot}%
     \usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)
   \end{beamercolorbox}%
   \begin{beamercolorbox}[wd=.3\paperwidth,ht=2ex,dp=1ex,right]{framenumber}%
    \usebeamerfont{framenumber}\insertframenumber/\inserttotalframenumber\hspace*{2ex} 
     \end{beamercolorbox}}%
      \vskip0pt%
}
\usebeamertemplate{mytheme}
\usefonttheme[onlymath]{serif}

盒子颜色不延伸到帧号(它显示为黑白,半个盒子是作者)。

答案1

以下可能更接近预期的输出:

在此处输入图片描述

\documentclass{beamer}
\usetheme{Madrid}

\hypersetup{pdfpagemode=None}
\defbeamertemplate*{footline}{mytheme}
{
   \leavevmode%
   \hbox{%
   \begin{beamercolorbox}[wd=.7\paperwidth,ht=2.75ex,dp=1ex,center]{author in head/foot}%
     \usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)
   \end{beamercolorbox}%
   \begin{beamercolorbox}[wd=.3\paperwidth,ht=2.75ex,dp=1ex,right]{author in head/foot}%
    \usebeamerfont{framenumber}\insertframenumber/\inserttotalframenumber\hspace*{2ex} 
     \end{beamercolorbox}}%
      \vskip0pt%
}
\usebeamertemplate{mytheme}
\usefonttheme[onlymath]{serif}

\title{title}
\author{Author name}
\institute{Institute}
\begin{document}
\begin{frame}
\frametitle{frametitle}
contents
\end{frame}
\end{document}

答案2

通过使用,\begin{beamercolorbox}[wd=.3\paperwidth,ht=2.75ex,dp=1ex,right]{framenumber}您可以绘制一个具有该framenumber颜色的框。此颜色通常不存在。您可以将其定义为您喜欢的任何颜色,也可以使用\setbeamercolor{framenumber}{parent={author in head/foot}}它使其与脚线左侧的颜色相同:

\documentclass{beamer}

\setbeamercolor{framenumber}{parent={author in head/foot}}

\usetheme{Madrid}
\hypersetup{pdfpagemode=None}
\defbeamertemplate*{footline}{mytheme}
{
   \leavevmode%
   \hbox{%
   \begin{beamercolorbox}[wd=.7\paperwidth,ht=2.75ex,dp=1ex,center]{author in head/foot}%
     \usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)
   \end{beamercolorbox}%
   \begin{beamercolorbox}[wd=.3\paperwidth,ht=2.75ex,dp=1ex,right]{framenumber}%
    \usebeamerfont{framenumber}\insertframenumber/\inserttotalframenumber\hspace*{2ex} 
     \end{beamercolorbox}}%
      \vskip0pt%
}
\usebeamertemplate{mytheme}
\usefonttheme[onlymath]{serif}

\begin{document}
\begin{frame}
content...
\end{frame}
\end{document}

相关内容