我希望我的框架标题背景水平淡入背景图像。
我试图修改此处找到的垂直梯度的解决方案:Beamer 主题背景图像呈淡入淡出(=渐变为透明)状态通过将“淡出底部”替换为“淡出右侧”等。但是,我无法让框架标题出现在水平淡出区域内(或覆盖此区域中的任何其他文本)---此处给出的解决方案在框架标题下方创建了一个淡出覆盖层(而我希望淡出覆盖层位于标题后面)。本质上,我想要的是此处找到的淡出到透明的版本:我怎样才能在投影仪中得到水平阴影的框架标题?
我正在使用马德里主题。
我将非常感激您所给予的任何帮助。
谢谢!
编辑:(抱歉不太雅致)代码如下:
\documentclass[aspectratio=169]{beamer}
\usetheme{Madrid}
%For the semi-transparent text boxes
\usepackage[framemethod=tikz]{mdframed}
\newmdenv[tikzsetting={draw=black,fill=tan,fill opacity=0.92, line width=0pt},
backgroundcolor=none,leftmargin=10,rightmargin=10,innertopmargin=4pt]
{titleBox}
\usepackage{ragged2e}
\usepackage{etoolbox,color,amsfonts}
\justifying
\title{My title}
\author[me]{Me}
\institute{My institute}
\date{Date}
%For the semi-transparent footline
\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\pgfsetfillopacity{.65}\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\pgfsetfillopacity{1}\insertshortauthor~~(\insertshortinstitute)
\end{beamercolorbox}%
\pgfsetfillopacity{.75}\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\pgfsetfillopacity{1}\insertshorttitle
\end{beamercolorbox}%
\pgfsetfillopacity{.65}\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
\usebeamerfont{date in head/foot}\pgfsetfillopacity{1}\insertshortdate{}\hspace*{2em}
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
%Various color/structure definitions (some of the custom colors are used elsewhere)
\definecolor{tan}{RGB}{244,229,192}
\definecolor{mypurple}{RGB}{88,68,70}
\definecolor{mytan}{RGB}{255,199,0}
\definecolor{wyte}{RGB}{210,210,210}
\setbeamercolor*{palette primary}{use=structure,fg=tan,bg=mypurple}
\setbeamercolor*{palette secondary}{use=structure,fg=mypurple,bg=tan}
\setbeamercolor*{palette tertiary}{use=structure,fg=tan,bg=mypurple}
\setbeamercolor{item projected}{fg=white,bg=mypurple}
\setbeamertemplate{enumerate items}[default]
\setbeamertemplate{navigation symbols}{}
\setbeamercolor{block title}{fg=mypurple}
\setbeamercolor{local structure}{fg=mypurple}
\setbeamertemplate{itemize item}[triangle]
\setbeamercolor{block title}{fg=white,bg=mypurple}
\setbeamercolor{block body}{fg=black,bg=wyte}
\setbeamercolor{title}{fg=black, bg=mytan}
\setbeamertemplate{title page}[default][colsep=-4bp,rounded=true]
\setbeamercolor*{frametitle}{fg=tan}
\usepackage{graphicx}
%For background image
\usebackgroundtemplate%
{%
\includegraphics[width=\paperwidth,height=\paperheight]{intro.jpg}%
}
\begin{document}
\begin{frame
\begin{titleBox}
\begin{center}
My Title
\end{center}
\end{titleBox}
\end{frame}
\begin{frame}{Introduction}%The title bg here is what I want to fade; but not the fg
\begin{titleBox}
Goal of the talk...
\end{titleBox}
\end{frame}
\end{document}
答案1
这是一个解决方案。它相当不雅观,因为它涉及垂直重新定位单独的框---一个用于淡入淡出,另一个用于框架标题。淡入淡出的右侧比我想要的更清晰,但这里有相关的代码添加:
\usepackage{tikz}
\usetikzlibrary{fadings}%To set up the fade parameters
\begin{tikzfadingfrompicture}[name=fade right]
\shade[left color=transparent!15,
right color=transparent!100] (0,0) rectangle (2,2);
\end{tikzfadingfrompicture}
\setbeamertemplate{headline}
{
\hbox{%For the fade box---this has to come first otherwise the title won't appear ``on top'' of the faded box
\tikz\fill[scale=1.5,path fading= fade right, mypurple] (0,0) rectangle (.45\paperwidth,0.5);
}%
\vspace{-3.5em}
\hbox{%For the frame title
\pgfsetfillopacity{0}\begin{beamercolorbox}[wd=\paperwidth,ht=5.5ex,dp=3ex,left]{frame title}%
\usebeamerfont{frame title}\pgfsetfillopacity{1}\hspace{1em}{\large\insertframetitle}
\end{beamercolorbox}}%
}