
ヘッド/フットの fg/bg の色とは独立して、ヘッド/フットのセクションのフォントの色を変更することは可能ですか?
編集: これが MWE です:
\documentclass{beamer}
\useoutertheme{miniframes}
\setbeamercolor{palette tertiary}{fg=white,bg=black}
\begin{document}
\section{sec 1}
\begin{frame}
sec 1
\end{frame}
\section{sec 2}
\begin{frame}
sec 2
\end{frame}
\end{document}
ヘッダー内のアクティブなセクション名の色を赤に変更し、非アクティブなセクション名の色を青に変更し、3 次パレットの色を白と黒のままにしたい場合は、どうすればよいでしょうか。
答え1
これは動作するはずです:
\setbeamercolor{section in head/foot}{parent=palette tertiary,fg=red}
\setbeamertemplate{section in head/foot shaded}{\color{blue}\usebeamertemplate{section in head/foot}}
説明
最初の行を見てください。 はsection in head/foot
から色を継承しpalette tertiary
、 を再定義する、と書かれていますfg=red
。したがって、palette tertiary
は変更されず、アクティブなセクション タイトルは赤に設定されます。
同様に、非アクティブなセクション タイトルにも次のようなものが必要です\setbeamercolor{section in head/foot shaded}{parent=palette tertiary,fg=blue}
。はい、これらの色を設定できます。ただし、Beamer はこれを決して使用しません。次のコードを参照してくださいbeamerbasenavigation.sty
。
\def\sectionentry#1#2#3#4#5{% section number, section title, page \ifnum#5=\c@part% \beamer@section@set@min@width \box\beamer@sectionbox\hskip1.875ex plus 1fill% \beamer@xpos=0\relax% \beamer@ypos=1\relax% \setbox\beamer@sectionbox= \hbox{\def\insertsectionhead{#2}% \def\insertsectionheadnumber{#1}% \def\insertpartheadnumber{#5}% {% \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}% \ifnum\c@section=#1% \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot}}}% \else% \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot shaded}}}% \fi}% }% \ht\beamer@sectionbox=1.875ex% \dp\beamer@sectionbox=0.75ex% \fi\ignorespaces}
\ifnum\c@section=#1
セクションタイトルに影を付けるかどうかのチェックがあることがわかります。ただし、カラーテーマはすでに に適用されています\usebeamercolor[fg]{section in head/foot}
。したがって、\setbeamercolor{section in head/foot shaded}{parent=palette tertiary,fg=blue}
合法ではありますが役に立ちません。
しかし、まだもう一度チャンスがあります。\ifnum
の後には があります\usebeamertemplate{section in head/foot shaded}
。 これは で定義されますbeamerouterthemedefault.sty
。
\defbeamertemplate*{section in head/foot shaded}{default}[1][50] {\color{fg!#1!bg}\usebeamertemplate{section in head/foot}}
bg
とfg
は の色であることに注目してくださいsection in head/foot
。これは、非アクティブなセクション タイトルが透明に見える理由を説明しています。この時点で新しい色を強制的に割り当てると、問題は解決します。