在 Beamer 中自定义 footline

在 Beamer 中自定义 footline

我正在努力自定义投影仪幻灯片的脚注线。我希望它们与标题栏对称(用反向水平阴影圆角)。到目前为止,我的脚注线具有我想要的大多数属性,但没有位于幻灯片的最右侧。我该如何解决这个问题?

这是我的 mwe

\documentclass[]{beamer}

\usepackage{pgfplots}

%%%%%%%%%% frame title
\definecolor{titleleft}{rgb}{0.0, 0.75, 1.0}
\definecolor{titleright}{rgb}{0.94, 0.97, 1.0}

\setbeamercolor*{frametitle}{fg=white}

\makeatletter
\pgfdeclarehorizontalshading[titleleft,titleright]{beamer@frametitleshade}{0.7\paperheight}{%
  color(10pt)=(titleleft);
  color(0.91\paperwidth)=(titleright)}
\pgfdeclarehorizontalshading[titleright,titleleft]{beamer@bottomtitleshade}{0.7\paperheight}{%
  color(10pt)=(titleright);
  color(0.91\paperwidth)=(titleleft)}

\defbeamertemplate*{frametitle}{horizontal shading}
{%
  \nointerlineskip%
  \vskip+3pt%
  \hbox{\leavevmode
    \advance\beamer@leftmargin by -12bp%
    \advance\beamer@rightmargin by -12bp%
    \beamer@tempdim=\textwidth%
    \advance\beamer@tempdim by \beamer@leftmargin%
    \advance\beamer@tempdim by \beamer@rightmargin%
    \hskip-\Gm@lmargin\hbox{%
      \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
          \vbox{}\vskip-.75ex%
          \leftskip1cm%
          \rightskip0.1cm plus1fil\leavevmode
          \insertframetitle%
          \ifx\insertframesubtitle\@empty%
            \strut\par%
          \else
          \par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
           \fi%
          \nointerlineskip
          \vbox{}%
          \end{minipage}}%
      \beamer@tempdim=\ht\beamer@tempbox%
      \advance\beamer@tempdim by 2pt%
      \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
        \usebeamercolor{frametitle right}
%        \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}} 
         \pgfsetcornersarced{\pgfpoint{4mm}{4mm}}
         \pgfpathrectanglecorners{\pgfpoint{.05\paperwidth}{0}}{\pgfpoint{.9\paperwidth}{\beamer@tempdim}}
        \pgfusepath{clip}
        \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
      \end{pgfpicture}
      \hskip-\paperwidth%
      \box\beamer@tempbox%
    }%
    \hskip-\Gm@rmargin%
  }%
  \vskip-2pt
  }
\makeatother

%%%%%%%%% end frame title

%%%%%%%%% footline
\makeatletter
\setbeamertemplate{footline}
{
    \leavevmode%
    \setbox\beamer@tempbox=\hbox{%
      \begin{beamercolorbox}[wd=\textwidth,ht=5.25ex,dp=2ex,center]{blue}%
      \end{beamercolorbox}%
    }%
        \beamer@tempdim=\ht\beamer@tempbox%
        \advance\beamer@tempdim by 2pt%
        \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{15pt}
        \usebeamercolor{frametitle right}
        \pgfsetcornersarced{\pgfpoint{4mm}{4mm}}
        \pgfpathrectanglecorners{\pgfpoint{.3\paperwidth}{0}}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
        \pgfusepath{clip}
        \pgftext[base, left]{\pgfuseshading{beamer@bottomtitleshade}}
        \end{pgfpicture}
        \vskip-\beamer@tempdim%
        \box\beamer@tempbox%    
}%
\makeatother

\beamertemplatenavigationsymbolsempty
%%%%%%%%% end footline

\begin{document}

\begin{frame}
  \frametitle{XXX}
  \begin{itemize}
  \item blablabla
  \item blablabla
  \item blablabal
  \end{itemize}
\end{frame}

\end{document}

这是实际结果 实际结果

答案1

你可以使用 TikZ 节点,这样你就不必自己处理颜色阴影等所有杂乱的东西

\documentclass[]{beamer}

\definecolor{titleleft}{rgb}{0.0, 0.75, 1.0}
\definecolor{titleright}{rgb}{0.94, 0.97, 1.0}
\setbeamercolor{author in head/foot}{fg=white}

\usepackage{tikz}

%%%%%%%%% footline
\setbeamertemplate{footline}{
  \begin{beamercolorbox}[ht=1cm,dp=0.2cm,center]{}%
  \begin{tikzpicture}
    \node[
      shade, 
      left color=titleleft, 
      right color=titleright,
      text width=.85\textwidth,
      rounded corners=0.3cm,
      minimum height=0.7cm,
      font={\small\usebeamercolor[fg]{author in head/foot}},
      inner xsep=0.5cm
    ] at (0,0) {\insertshortauthor};
  \end{tikzpicture}  
  \end{beamercolorbox}
}%

\author{names}

\beamertemplatenavigationsymbolsempty

\begin{document}

\begin{frame}
  \frametitle{XXX}
  \begin{itemize}
  \item blablabla
  \item blablabla
  \item blablabal
  \end{itemize}
\end{frame}

\end{document}

在此处输入图片描述

相关内容