我正在尝试做本地投影仪风格,将徽标放在底角。简单的情况很容易:
\newcommand{\wmflogo}{
\begin{tikzpicture}[remember picture,overlay]
\node [xshift=0.05\textwidth,yshift=0.05\textheight]
at (current page.south west) {
\includegraphics[width=0.05\textwidth]{logos/Wikimedia-logo_black.eps}};
\end{tikzpicture}
}
\setbeamertemplate{footline}{
\wmflogo
}
...但我们还有一个白色徽标,如果当前前景色是白色,我想要做的是使用白色徽标 ( logos/Wikimedia-logo_white.eps
)。可以这样做吗?我根本找不到如何检查当前前景色的方法,更不用说如何对它进行任何类型的比较或 ifthen 操作了...
答案1
Beamer 将当前前景色存储在\beamer@thc@fg
:
\documentclass{beamer}
\setbeamercolor{background canvas}{bg=blue}
\makeatletter
\edef\whitestring{white}
\newcommand\ifbeamercolorwhite[2]{%
\ifx\beamer@thc@fg\whitestring
#1
\else
#2
\fi
}
\makeatother
\begin{document}
\begin{frame}
\setbeamercolor{normal text}{fg=red}
\usebeamercolor[fg]{normal text}
abc \ifbeamercolorwhite{yes}{no}
\setbeamercolor{normal text}{fg=white}
\usebeamercolor[fg]{normal text}
abc \ifbeamercolorwhite{yes}{no}
\end{frame}
\end{document}