在投影仪中,使用外部主题树使阴影标题与幻灯片顶部齐平

在投影仪中,使用外部主题树使阴影标题与幻灯片顶部齐平

我使用以下代码(大致)在投影机标题。标题的内容使用 进行设置outertheme tree。阴影方法大致基于 的方法Singapore。问题是我在幻灯片的最顶部有一排浅绿色,而我希望深绿色一直延伸到顶部。

\PassOptionsToPackage{rgb}{xcolor}
\documentclass{beamer}
\definecolor{acol}{rgb}{.5,1,.5}
\definecolor{bcol}{rgb}{.1,.6,.2}
\colorlet{bcol1}{bcol!25!black}
\setbeamercolor{title in head/foot}{fg=acol,bg=}
\setbeamercolor{section in head/foot}{fg=acol,bg=}
\setbeamercolor{subsection in head/foot}{fg=acol,bg=}
\setbeamercolor{upper separation line head}{bg=bcol1}
\setbeamercolor{lower separation line head}{bg=bcol1}
\makeatletter
\useoutertheme{tree}
\pgfdeclarehorizontalshading{beamer@headfade}{\dimexpr5.4375ex+3pt}
{%
  color(0cm)=(bcol1);
  color(\paperwidth)=(acol)%
}
\addtoheadtemplate{\vskip 3pt\pgfuseshading{beamer@headfade}\vskip\dimexpr -3pt-10.875ex}{}
\makeatother
\begin{document}

  \title{Title}
  \section{A Section}
  \subsection{A Subsection}

  \begin{frame}{A Frame}{A Subframe}
    Some text
  \end{frame}

\end{document}

大概是我计算错误或者在某个地方使用了错误的值,但每次我推某个东西的时候,某个东西就会弹回来,我似乎就是无法把它弄对。(可能是因为我像往常一样被 的beamer代码迷宫迷住了。)

任何提示都将非常感激!

light green peeking at very top

答案1

我收到您提供的 MWE 的错误。它显示为以下行,表示\dimexpr无法在垂直模式下使用:

\pgfdeclarehorizontalshading{beamer@headfade}{\dimexpr5.4375ex+3pt}

我刚刚将其删除,它对我有用(顶部没有一行):

\pgfdeclarehorizontalshading{beamer@headfade}{5.4375ex+3pt}

\PassOptionsToPackage{rgb}{xcolor}
\documentclass{beamer}
\definecolor{acol}{rgb}{.5,1,.5}
\definecolor{bcol}{rgb}{.1,.6,.2}
\colorlet{bcol1}{bcol!25!black}
\setbeamercolor{title in head/foot}{fg=acol,bg=}
\setbeamercolor{section in head/foot}{fg=acol,bg=}
\setbeamercolor{subsection in head/foot}{fg=acol,bg=}
\setbeamercolor{upper separation line head}{bg=bcol1}
\setbeamercolor{lower separation line head}{bg=bcol1}
\makeatletter
\useoutertheme{tree}
\pgfdeclarehorizontalshading{beamer@headfade}{5.4375ex+3pt}
{%
  color(0cm)=(bcol1);
  color(\paperwidth)=(acol)%
}
\addtoheadtemplate{\vskip 3pt\pgfuseshading{beamer@headfade}\vskip\dimexpr -3pt-10.875ex}{}
\makeatother
\begin{document}

  \title{Title}
  \section{A Section}
  \subsection{A Subsection}

  \begin{frame}{A Frame}{A Subframe}
    Some text
  \end{frame}

\end{document}

enter image description here

相关内容