
머리/발의 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
. 이는 비활성 섹션 제목이 투명해 보이는 이유를 설명합니다. 이 시점에서 잔인하게 새로운 색상을 지정하면 문제가 해결됩니다.