Progress bar for latex-beamer
Here you have some customizable progress bars (part of a project I am working on):
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\definecolor{pbblue}{HTML}{0A75A8}% filling color for the progress bar
\definecolor{pbgray}{HTML}{575757}% background color for the progress bar
\makeatletter
\def\progressbar@progressbar{} % the progress bar
\newcount\progressbar@tmpcounta% auxiliary counter
\newcount\progressbar@tmpcountb% auxiliary counter
\newdimen\progressbar@pbht %progressbar height
\newdimen\progressbar@pbwd %progressbar width
\newdimen\progressbar@tmpdim % auxiliary dimension
\progressbar@pbwd=\linewidth
\progressbar@pbht=1.5ex
% the progress bar
\def\progressbar@progressbar{%
\progressbar@tmpcounta=\insertframenumber
\progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwd
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb
\begin{tikzpicture}[rounded corners=2pt,very thin]
\shade[top color=pbgray!20,bottom color=pbgray!20,middle color=pbgray!50]
(0pt, 0pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht);
\shade[draw=pbblue,top color=pbblue!50,bottom color=pbblue!50,middle color=pbblue] %
(0pt, 0pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht);
\draw[color=normal text.fg!50]
(0pt, 0pt) rectangle (\progressbar@pbwd, \progressbar@pbht)
node[pos=0.5,color=normal text.fg] {\textnormal{%
\pgfmathparse{\insertframenumber*100/\inserttotalframenumber}%
\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,\%%
}%
};
\end{tikzpicture}%
}
\addtobeamertemplate{headline}{}
{%
\begin{beamercolorbox}[wd=\paperwidth,ht=4ex,center,dp=1ex]{white}%
\progressbar@progressbar%
\end{beamercolorbox}%
}
\makeatother
\begin{document}
\begin{frame}
test
\end{frame}
\begin{frame}
test
\end{frame}
\begin{frame}
test
\end{frame}
\begin{frame}
test
\end{frame}
\end{document}
And a close-up image of the bar:
Two little variations; first using a circle as progress indicator:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\definecolor{pbblue}{HTML}{0A75A8}% color for the progress bar and the circle
\makeatletter
\def\progressbar@progressbar{} % the progress bar
\newcount\progressbar@tmpcounta% auxiliary counter
\newcount\progressbar@tmpcountb% auxiliary counter
\newdimen\progressbar@pbht %progressbar height
\newdimen\progressbar@pbwd %progressbar width
\newdimen\progressbar@rcircle % radius for the circle
\newdimen\progressbar@tmpdim % auxiliary dimension
\progressbar@pbwd=\linewidth
\progressbar@pbht=1pt
\progressbar@rcircle=2.5pt
% the progress bar
\def\progressbar@progressbar{%
\progressbar@tmpcounta=\insertframenumber
\progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwd
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb
\begin{tikzpicture}
\draw[pbblue!30,line width=\progressbar@pbht]
(0pt, 0pt) -- ++ (\progressbar@pbwd,0pt);
\filldraw[pbblue!30] %
(\the\dimexpr\progressbar@tmpdim-\progressbar@rcircle\relax, .5\progressbar@pbht) circle (\progressbar@rcircle);
\node[draw=pbblue!30,text width=3.5em,align=center,inner sep=1pt,
text=pbblue!70,anchor=east] at (0,0) {\insertframenumber/\inserttotalframenumber};
\end{tikzpicture}%
}
\addtobeamertemplate{headline}{}
{%
\begin{beamercolorbox}[wd=\paperwidth,ht=4ex,center,dp=1ex]{white}%
\progressbar@progressbar%
\end{beamercolorbox}%
}
\makeatother
\begin{document}
\begin{frame}
test
\end{frame}
\begin{frame}
test
\end{frame}
\begin{frame}
test
\end{frame}
\begin{frame}
test
\end{frame}
\end{document}
And the close-up:
And now using a triangle as progress-indicator (inspired by the theme Ignasi mentioned in his answer):
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\definecolor{pbgray}{HTML}{575757}% background color for the progress bar
\makeatletter
\def\progressbar@progressbar{} % the progress bar
\newcount\progressbar@tmpcounta% auxiliary counter
\newcount\progressbar@tmpcountb% auxiliary counter
\newdimen\progressbar@pbht %progressbar height
\newdimen\progressbar@pbwd %progressbar width
\newdimen\progressbar@tmpdim % auxiliary dimension
\progressbar@pbwd=\linewidth
\progressbar@pbht=1pt
% the progress bar
\def\progressbar@progressbar{%
\progressbar@tmpcounta=\insertframenumber
\progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwd
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb
\begin{tikzpicture}[very thin]
\draw[pbgray!30,line width=\progressbar@pbht]
(0pt, 0pt) -- ++ (\progressbar@pbwd,0pt);
\draw[draw=none] (\progressbar@pbwd,0pt) -- ++ (2pt,0pt);
\draw[fill=pbgray!30,draw=pbgray] %
( $ (\progressbar@tmpdim, \progressbar@pbht) + (0,1.5pt) $ ) -- ++(60:3pt) -- ++(180:3pt) ;
\node[draw=pbgray!30,text width=3.5em,align=center,inner sep=1pt,
text=pbgray!70,anchor=east] at (0,0) {\insertframenumber/\inserttotalframenumber};
\end{tikzpicture}%
}
\addtobeamertemplate{headline}{}
{%
\begin{beamercolorbox}[wd=\paperwidth,ht=5ex,center,dp=1ex]{white}%
\progressbar@progressbar%
\end{beamercolorbox}%
}
\makeatother
\begin{document}
\begin{frame}
test
\end{frame}
\begin{frame}
test
\end{frame}
\begin{frame}
test
\end{frame}
\begin{frame}
test
\end{frame}
\end{document}
And the close-up:
For ConTeXt, I have written a module visualcounter that allows one to visualize any ConTeXt counter. It provides a few predefined visualizers.
See the documentation for details. The basic usage is
\usemodule[visualcounter]
\definevisualcounter
[pagevisualized] % visualizer
[progressbar] % inherit from
[counter=userpage]
\usevisualcounter{pagevisualizer}
where the first argument is the name of the visualizer that you want to define, the 2nd (optional) argument is the predefined visualizer from which you can inherit settings, and counter is the name of counter that the visualizer should display. See the tests/
subdirectory on github for detailed examples.
The image below shows four visualizers for page numbers and itemizations.
Sylvain Bouveret already developed a progressbar theme for beamer. You can find it in his web page. It's a 'complete' (inner, outer, color, font) theme but here you have a little example with just using \useoutertheme{progressbar}
. Bootom triangle moves under the line according actual slide.