# What is preventing progress bar in beamer from showing up?

I'd like to add a progress bar to my presentation (I got the idea from this question) but I believe something is preventing it from showing up in output and I can't seem to figure it out.

Here is my MWE:

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage[danish]{babel}
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{url}
\usepackage{graphics,epsfig, subfigure}
\usepackage{fancybox}
\usepackage{extarrows}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mathtools}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{picture}
\usepackage{fancybox}
\usepackage{xcolor}

\mode<presentation> {

\usetheme{CambridgeUS}

{
\leavevmode%
\hbox{%
\end{beamercolorbox}%
\end{beamercolorbox}}%
\vskip0pt%
}

}
\useinnertheme{circles}
\usefonttheme[onlymath]{serif}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\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@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,
\end{tikzpicture}%
}

{%
\begin{beamercolorbox}[wd=\paperwidth,ht=4ex,center,dp=1ex]{white}%
\progressbar@progressbar%
\end{beamercolorbox}%
}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\setbeamertemplate{frametitle}[default][right]% align the frametitle to the right
\setdefaultlanguage{english}
\setotherlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\setbeamercolor{block title}{bg=green,fg=black}

\AtBeginEnvironment{exampleblock}{\setbeamercolor{item projected}{bg=gray}}

\newfontfamily\arabicfont[Script=Arabic,Scale=0.8]{IRNazli}
\newfontfamily\latinfontsf[Script=Latin,Scale=0.3]{Calibri}
\newfontfamily\arabicfontsf[Script=Arabic,Scale=0.8]{IRNazli}
\newfontfamily\digitfont[Script=Arabic,Scale=0.8]{IRNazli}
\newfontfamily{\F}{IRNazli} % Farsi
\newfontfamily{\I}{IranNastaliq} % Farsi
\newfontfamily{\C}{Calibri}
\setbeamercovered{transparent}

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\newcommand{\myitemII}{\par\vspace{3pt}\hspace{5mm}\LR{\hspace*{3pt}%
\begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
\usebeamercolor[fg]{item projected}
\end{pgfpicture}%
\hspace{1pt}%
}}
% ======================================================
\makeatletter
\DeclareMathSizes{\f@size}{10}{7}{7}
\makeatother

\makeatletter
{

\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\end{beamercolorbox}%
\end{beamercolorbox}%
\fi%
}
\makeatother

%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\title{\F \RL{\textbf{مسئله یادگیری دیکشنری }}}

\author{{\setRTL \F \RL{\textbf{فلان الدین فلانی}}} }
\institute[]
{
\F \RL{\textbf{\normalsize{ دانشگاه فلان}}}
\medskip

}
\date{\F \RL{شهریور ۱۲۹۱}}

\begin{document}

\begin{frame}
\end{frame}

\begin{frame}
\end{frame}

\begin{frame}
\end{frame}

\end{document}


But nothing shows up in the output as a progress bar. I'd like to know what is preventing it from showing up.

EDIT: I think I found the cause; when I remove this part from the code, the progress bar appears in the ouptput document.

\makeatletter
\DeclareMathSizes{\f@size}{10}{7}{7}
\makeatother

\makeatletter
{

\leavevmode%
\@tempdimb=2.4375ex%
\ifnum\beamer@subsectionmax<\beamer@sectionmax%
\multiply\@tempdimb by\beamer@sectionmax%
\else%
\multiply\@tempdimb by\beamer@subsectionmax%
\fi%
\ifdim\@tempdimb>0pt%
\end{beamercolorbox}%
\end{beamercolorbox}%
\fi%
}
\makeatother


But I really don't have a clue what this part of the code is doing because the template was a ready-to-use beamer presentation template that the university recommends to use. So what do you suggest to do?

• Please try if you can reproduce the problem without all the special fonts. This will increase the number of people who can try to help you. – user36296 Sep 24 '16 at 11:11
• That's called debugging. Remove unnecessary parts of the code, check if the problem still persists and so on. If the problem vanishes at some point, you know it is related to the code just removed. – user36296 Sep 24 '16 at 11:13
• Offtopic comments: Don't load packages twice, this is prone to cause problems due to option clashes etc. Furthermore packages like graphicx are not needed in beamer, as beamer already provides these functionalities. – user36296 Sep 24 '16 at 11:18
• BTW: Can you use some longer name for the \F command? Single letter commands can be very troublesome. – user36296 Sep 30 '16 at 17:17
• Offtopic and I really don't know: but are you sure that combining babel and polyglossia are a good idea? tex.stackexchange.com/questions/88481/polyglossia-vs-babel – user36296 Sep 30 '16 at 17:27

This is too long for a comment.

Actually @samcarter figured out the problem: this is how things go wrong

• You insert progress bar into the headline template by \addtobeamertemplate
• You define a new headline template called arabic split theme by \defbeamertemplate*.
• Since you are calling the starred version, BEAMER will define and then install this template.
• The progress bar is erased.

To be more precise, the official description of \addtobeamertemplate reads:

This command adds the ⟨pre-text⟩ before the text that is currently installed as the template ⟨element name⟩ and the ⟨post-text⟩ after it. This allows you a limited form of modification of existing templates.
...
If a new template is installed, any additions will be deleted. On the other hand, you can repeatedly use this command to add multiple things.

And the official description of \defbeamertemplate reads:

This command installs a prede ned option for the template ⟨element name⟩. Once this command has been used, users can access the prede ned template using the \setbeamertemplate command.
...
The starred version of the command installs the predefined template option, but then immediately calls \setbeamertemplate for this option. This is useful for the default templates.

So you have several choices:

• Delete * from \def..., so the new-defined style will not be installed and progress bar will remain.
• Exchange the order of \add... and \def... so nothing can erase the progress bar.
• Include the progress bar in the definition of a new template.
• Thank you for your answer. The point is I like the way outline is being showed in this theme, so I wouldn't change the theme (if that's what you meant by template) and obviously I do want to have both the progress bar and defined header. – Gigili Oct 1 '16 at 19:46

With some tricks from my answer to write right to left beamer presentations, especially for lists and alignment of text.

You may need to update the package bidi which ensures changing the direction of the text in case of right to left languages

\documentclass{beamer}
\usepackage{tikz}
\usepackage{polyglossia}

\usetheme{CambridgeUS}
\usefonttheme[onlymath]{serif}

\setdefaultlanguage[numerals=eastern]{farsi}
\setotherlanguage{english}

\newfontfamily\farsifont[Script=Arabic,Scale=0.8]{Amiri}
\newfontfamily\farsifontsf[Script=Arabic,Scale=0.8]{Amiri}
\newfontfamily\digitfont[Script=Arabic,Scale=0.8]{Amiri}
\newfontfamily{\F}[Script=Arabic]{Amiri} % Farsi
\newfontfamily{\I}[Script=Arabic]{Amiri} % Farsi
\newfontfamily{\C}{Amiri}

% right to left list
\makeatletter
\newcommand{\RTList}{\raggedleft\rightskip\@totalleftmargin}
\makeatother

% right to left triangle for label item
\setbeamertemplate{itemize item}{\scriptsize\raise1.25pt%
\hbox{\donotcoloroutermaths$\blacktriangleleft$}}

\setbeamertemplate{enumerate items}[ball] % or circle

\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@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,
\end{tikzpicture}%
}
{%
\begin{beamercolorbox}[wd=\paperwidth,ht=4ex,center,dp=1ex]{white}%
\progressbar@progressbar%
\end{beamercolorbox}%
}
}{}
\makeatother

\title{\F\bfseries مسئله یادگیری دیکشنری }

\author{\F\bfseries فلان الدین فلانی
\and
دانشگاه فلان }

\date{\F  شهریور ۱۲۹۱ }

\begin{document}
\everypar{\rightskip\rightmargin}

\begin{frame}
\everypar{}
\maketitle
\end{frame}

\section{فصل أول}
\subsection{عنوان أول}
\begin{frame}{}
متن نمونه

\begin{itemize}\RTList
\item مورد اول
\end{itemize}

\begin{enumerate}\RTList
\item مورد اول
\begin{enumerate}\RTList
\item  مورد اول
\item  مورد ثان
\end{enumerate}
\end{enumerate}

\end{frame}
\end{document}


• Thank you for your answer. The Problem is the defined header of CambridgeUS theme which shows the outline of presentation disappears and I don't want that. – Gigili Oct 1 '16 at 19:41
• Try to update your distribution especially bidi and tikz – Salim Bou Oct 1 '16 at 20:48