Sei sulla pagina 1di 7

11/10/2017 color - Beamer: how to change the mini frames coloring - TeX - LaTeX Stack Exchange

Beamer: how to change the mini frames coloring

I want to do the following changes to the mini frames coloring: All previous frames almost the same solid color as the
background so that the squares are barely visible. The current frame and all future frames the color of the foreground.

\documentclass{beamer}
\usetheme{Frankfurt}
\usecolortheme{dove}
\setbeamercolor{section in head/foot}{fg=white, bg=black}
\definecolor{dark-gray}{gray}{0.10} %color for the navigation squares

\makeatletter
\setbeamertemplate{mini frame}
{%
\begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\beamer@boxsize}
{\the\beamer@boxsize}}
\pgfusepath{fill,stroke}
\end{pgfpicture}%
}
\setbeamertemplate{mini frame in current subsection}
{%
\begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\beamer@boxsize}
{\the\beamer@boxsize}}
\pgfsetfillcolor{dark-gray}
\pgfusepath{fill}
\end{pgfpicture}%
}

\def\slideentry#1#2#3#4#5#6{%
%section number, subsection number, slide number, first/last frame, page number, part
number
\ifnum#6=\c@part\ifnum#2>0\ifnum#3>0%
\ifbeamer@compress%
\advance\beamer@xpos by1\relax%
\else%
\beamer@xpos=#3\relax%
\beamer@ypos=#2\relax%
\fi%
\hbox to 2pt{%
\beamer@tempdim=-\beamer@vboxoffset%
\advance\beamer@tempdim by-\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@ypos%
\advance\beamer@tempdim by -.05cm%
\raise\beamer@tempdim\hbox{%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\advance\beamer@tempdim by -\beamer@boxsize%
\advance\beamer@tempdim by 1pt%
\kern\beamer@tempdim
\global\beamer@section@min@dim\beamer@tempdim
\hbox{\beamer@link(#4){%
\usebeamerfont{mini frame}%
\ifnum\c@section=#1%
\ifnum\c@subsection<#2%
\usebeamercolor[fg]{mini frame}%
\ifnum\c@subsectionslide=#3%
\usebeamertemplate{mini frame}%\beamer@minislidehilight%
\else%
\usebeamertemplate{mini frame in current
subsection}%\beamer@minisliderowhilight%
\fi%
\else%
\usebeamercolor{mini frame}%
\color{fg!50!bg}%
\usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
\fi%
\else%

https://tex.stackexchange.com/questions/112220/beamer-how-to-change-the-mini-frames-coloring?rq=1 1/7
11/10/2017 color - Beamer: how to change the mini frames coloring - TeX - LaTeX Stack Exchange
\usebeamercolor{mini frame}%
\color{fg!50!bg}%
\usebeamertemplate{mini frame in other subsection}%\beamer@minislide%
\fi%
}}}\hskip-10cm plus 1fil%
}\fi\fi%
\else%
\fakeslideentry{#1}{#2}{#3}{#4}{#5}{#6}%
\fi\ignorespaces
}

\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{section in
head/foot}%
\usebeamerfont{author in
head/foot}\insertshortauthor~~\beamer@ifempty{\insertshortinstitute}{}
{(\insertshortinstitute)}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{section in
head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{section in
head/foot}%
\usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
\makeatother

\begin{document}

\section{Introduction}
\subsection{Introduction}
\begin{frame}{Frame}
1
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
2
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
3
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
4
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
5
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
6
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
7
\end{frame}

\subsection{Introduction}

https://tex.stackexchange.com/questions/112220/beamer-how-to-change-the-mini-frames-coloring?rq=1 2/7
11/10/2017 color - Beamer: how to change the mini frames coloring - TeX - LaTeX Stack Exchange
\begin{frame}{Frame}
8
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
9
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
10
\end{frame}

\section{Introduction}
\subsection{Introduction}
\begin{frame}{Frame}
11
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
12
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
13
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
14
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
15
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
16
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
17
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
18
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
19
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
20
\end{frame}

\end{document}

This is an update to a question I posted earlier: Beamer: how to change the mini frames from circles to rectangles, but since it
was answered and I suspect that the answer to the updated question is going to differ from the original question I posted this as
a new question.

{beamer} {color} {navigation} {mini-frames}

edited Apr 13 at 12:34 asked May 3 '13 at 17:22

https://tex.stackexchange.com/questions/112220/beamer-how-to-change-the-mini-frames-coloring?rq=1 3/7
11/10/2017 color - Beamer: how to change the mini frames coloring - TeX - LaTeX Stack Exchange
Community Artturi Bjrk
1 221 1 2 7

1 Have you tried a command like \setbeamercolor{navigation symbols}{fg=red} ? (See p. 11 and 72 of


the manual) ? ach May 3 '13 at 19:49

I tried it now and it didn't do what I was looking for. To be clear the code that I posted colors all frames
after the one I'm on in the section I'm in correctly. I would like to color the current frame and following
frames in other sections the same. Artturi Bjrk May 4 '13 at 3:47

Ah I think I misunderstood, navigation symbols are the ones that appear in the lower right by default,
that you can use to navigate, not the boxes / circles that appear in the top for some templates. ach
May 4 '13 at 9:32

1 Hmmm... but I seem to get exactly the result you described. Am I missing something? What id the
difference between the result obtained with the current code (the one in your question) and the desired
result? Gonzalo Medina May 4 '13 at 22:59

1 As the code stands the current frame is colored dark-gray. I would like it to be colored white. All frames
in following sections are colored dark-gray. I would like them to be colored white. Artturi Bjrk May
6 '13 at 2:02

1 Answer

To color the mini frames of slides already shown gray and the current and all future
frames white, the existing solution can be modified like this:

\documentclass{beamer}
\usetheme{Frankfurt}
\usecolortheme{dove}
\setbeamercolor{section in head/foot}{fg=white, bg=black}
\definecolor{dark-gray}{gray}{0.10} %color for the navigation squares

\makeatletter
\setbeamertemplate{mini frame}
{%
\begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\beamer@boxsize}
{\the\beamer@boxsize}}
\pgfusepath{fill,stroke}
\end{pgfpicture}%
}

\def\slideentry#1#2#3#4#5#6{%
%section number, subsection number, slide number, first/last frame, page number, part
number
\ifnum#6=\c@part\ifnum#2>0\ifnum#3>0%
\ifbeamer@compress%
\advance\beamer@xpos by1\relax%
\else%
\beamer@xpos=#3\relax%
\beamer@ypos=#2\relax%
\fi%
\hbox to 2pt{%
\beamer@tempdim=-\beamer@vboxoffset%
\advance\beamer@tempdim by-\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@ypos%
\advance\beamer@tempdim by -.05cm%
\raise\beamer@tempdim\hbox{%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\advance\beamer@tempdim by -\beamer@boxsize%
\advance\beamer@tempdim by 1pt%
\kern\beamer@tempdim
\global\beamer@section@min@dim\beamer@tempdim
\hbox{\beamer@link(#4){%
\usebeamerfont{mini frame}%
\ifnum\c@section>#1%
\color{dark-gray}%
\else%
\ifnum\c@section=#1%
\ifnum\c@subsection>#2%
\color{dark-gray}%

https://tex.stackexchange.com/questions/112220/beamer-how-to-change-the-mini-frames-coloring?rq=1 4/7
11/10/2017 color - Beamer: how to change the mini frames coloring - TeX - LaTeX Stack Exchange
\else%
\ifnum\c@subsection=#2%
\ifnum\c@subsectionslide>#3%
\color{dark-gray}%
\else%
\color{white}%
\fi%
\else%
\color{white}%
\fi%
\fi%
\else%
\color{white}%
\fi%
\fi%
\usebeamertemplate{mini frame}%
}}}\hskip-10cm plus 1fil%
}\fi\fi%
\else%
\fakeslideentry{#1}{#2}{#3}{#4}{#5}{#6}%
\fi\ignorespaces
}

\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{section in
head/foot}%
\usebeamerfont{author in
head/foot}\insertshortauthor~~\beamer@ifempty{\insertshortinstitute}{}
{(\insertshortinstitute)}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{section in
head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{section in
head/foot}%
\usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
\makeatother

\begin{document}

\section{Introduction}
\subsection{Introduction}
\begin{frame}{Frame}
1
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
2
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
3
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
4
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
5
\end{frame}

https://tex.stackexchange.com/questions/112220/beamer-how-to-change-the-mini-frames-coloring?rq=1 5/7
11/10/2017 color - Beamer: how to change the mini frames coloring - TeX - LaTeX Stack Exchange
\subsection{Introduction}
\begin{frame}{Frame}
6
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
7
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
8
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
9
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
10
\end{frame}

\section{Introduction}
\subsection{Introduction}
\begin{frame}{Frame}
11
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
12
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
13
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
14
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
15
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
16
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
17
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
18
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
19
\end{frame}

\subsection{Introduction}
\begin{frame}{Frame}
20

https://tex.stackexchange.com/questions/112220/beamer-how-to-change-the-mini-frames-coloring?rq=1 6/7
11/10/2017 color - Beamer: how to change the mini frames coloring - TeX - LaTeX Stack Exchange
\end{frame}

\end{document}

Explanation

The decision whether a mini frame should be colored gray or white is made in ll. 39-
59, where the section, subsection, and "frame in subsection" numbers of the currently
processed mini frame are subsequently compared to the actual position in the
presentation. This is necessary as the "absolute" frame number of the current mini
frame isn't available.

edited May 8 '13 at 15:55 answered May 8 '13 at 14:32


diabonas
19.5k 3 74 120

Is there a similar way to force the coloring of the "normal" nav bullets from e.g. the Frankfurt theme? By
the ordinary criteria - current subsection highlighted, the rest dimmed? It seems to me the answer must
be somewhere in your code, but I cannot dechifer it. My problem is in this question:
tex.stackexchange.com/questions/228256/ Thriveth Feb 16 '15 at 0:22

https://tex.stackexchange.com/questions/112220/beamer-how-to-change-the-mini-frames-coloring?rq=1 7/7

Potrebbero piacerti anche