使用水平阴影调整信息线外部主题

使用水平阴影调整信息线外部主题

infolines我正在尝试通过在脚注线的每个框的边缘添加阴影来改进外部主题。举一个非常简单的例子,我的代码是:

\documentclass{beamer}

% use shading packages
\usepackage{tikz}
\usetikzlibrary{shadings}

\useoutertheme{infolines} %current section at the top; author, institution, title, date and page at bottom

% define shading
\makeatletter
\AtBeginDocument{
    \usebeamercolor{author in head/foot}
    \usebeamercolor{institute in head/foot}

    \pgfdeclarehorizontalshading{beamer@authorinstituteshade}{2.25ex}{%
        color(10em)=(author in head/foot.bg);
        color(18em)=(institute in head/foot.bg)
    }
}

% Adjust footline (use just author/institution/date/page)
\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
        \usebeamerfont{author in head/foot}\insertshortauthor
        \pgfuseshading{beamer@authorinstituteshade}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{institute in head/foot}%
        \usebeamerfont{institute in head/foot}\insertshortinstitute
    \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

\usecolortheme{beaver}
\setbeamercolor{author in head/foot}{bg=red!60!black,fg=white}
\setbeamercolor{institute in head/foot}{bg=red!40!,fg=black}

\usefonttheme{structuresmallcapsserif}

\title{Title}
\author{Author}
\institute{Institute}
\date{Date}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\end{document}

输出如下: 在此处输入图片描述 我在这里故意选择丑陋的颜色,以使事情更加明显。实际上,我想要的是脚线中红色和粉红色区域的共享边界处的“混合”感觉;粉红色和灰色区域也是如此。因此,我有以下三个问题:

-为什么阴影区域没有与我放置它的框垂直对齐?

-我怎样才能将它向左移动以调整到盒子的边缘?

-在阴影的定义中,这里:

\pgfdeclarehorizontalshading{beamer@authorinstituteshade}{2.25ex}{%
        color(10em)=(author in head/foot.bg);
        color(18em)=(institute in head/foot.bg)
}

如何设置阴影的高度以自动匹配调用它的框的高度,而不是手动设置为相同的高度{2.25ex}?

在此先感谢您的帮助!

答案1

也许可以使用单一阴影来代替?

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{shadings}

\useoutertheme{infolines} 
\usecolortheme{beaver}

\setbeamercolor{author in head/foot}{parent=palette primary,bg=,fg=white}
\setbeamercolor{title in head/foot}{parent=palette secondary,bg=,fg=white}
\setbeamercolor{date in head/foot}{parent=palette tertiary,bg=,fg=black}
\setbeamercolor{section in head/foot}{parent=palette primary,bg=}
\setbeamercolor{subsection in head/foot}{parent=palette secondary,bg=}

\colorlet{titleleft}{red!60!black}
\colorlet{titlemiddle}{red!40!}
\colorlet{titleright}{gray!40}

\pgfdeclarehorizontalshading[titleleft,titlemiddle,titleright]      {beamer@frametitleshade}{\paperheight}{%
    color(0\paperwidth)=(titleleft);
    color(0.15\paperwidth)=(titleleft);
  color(0.5\paperwidth)=(titlemiddle);
  color(0.85\paperwidth)=(titleright);
  color(\paperwidth)=(titleright)
}

\makeatletter
\setbeamertemplate{footline}
{
    \leavevmode%
    \setbox\beamer@tempbox=\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}%
        }%
        \vskip-\beamer@tempdim%
        \beamer@tempdim=\ht\beamer@tempbox%
        \advance\beamer@tempdim by 4pt%
        \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{20pt}
            \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
            \pgfusepath{clip}
            \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
        \end{pgfpicture}
        \vskip-\beamer@tempdim%
        \box\beamer@tempbox%    
}%

\setbeamertemplate{headline}
{
    \leavevmode%
    \setbox\beamer@tempbox=\hbox{%
        \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,right]{section in head/foot}%
            \usebeamerfont{section in head/foot}\insertsectionhead\hspace*{2ex}
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,left]{subsection in head/foot}%
            \usebeamerfont{subsection in head/foot}\hspace*{2ex}\insertsubsectionhead
        \end{beamercolorbox}%
        }%
        \beamer@tempdim=\ht\beamer@tempbox%
        \advance\beamer@tempdim by 4pt%
        \vskip-\beamer@tempdim%
        \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{20pt}
            \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
            \pgfusepath{clip}
            \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
        \end{pgfpicture}
        \vskip-\beamer@tempdim%
        \box\beamer@tempbox%    
        \vskip0pt%
}
\makeatother


\title{Title}
\author{Author}
\institute{Institute}
\date{Date}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\end{document}

在此处输入图片描述

(基于https://tex.stackexchange.com/a/311829/36296

相关内容