5

I am using navigation bars in the top of a beamer slide. The problem is that the circles are not centered. How can I center them with respect to the section title?

My code is

\PassOptionsToPackage{svgnames}{xcolor}
\documentclass[demo]{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,shadows}
\usepackage[bars]{beamerthemetree}%Beamer theme v 2.2
\usepackage{beamerthemebars}
\usepackage{ifthen}
\usepackage{multimedia}
\mode<presentation>
\usepackage{ragged2e}
\usepackage{etoolbox}
\apptocmd{\frame}{\justifying}{}{}
\usepackage{multicol}
\addtobeamertemplate{block begin}{}{\justifying}

%Theme commands
\setbeamerfont{headline}{size=\footnotesize}
\setbeamerfont{section in head/foot}{size=\tiny}
%\setbeamersize{text margin left=10pt,text margin right=10pt}
\newcommand\Wider[2][3em]{%
\makebox[\linewidth][c]{%
  \begin{minipage}{\dimexpr\textwidth+#1\relax}
  \raggedright#2
  \end{minipage}%
  }%
}
\setbeamercovered{highly dynamic}
\usetheme{Ilmenau}% Beamer theme v 3.0
\useoutertheme[subsection=true]{smoothbars}%{miniframes}%%Beamer Outer Theme-circles on top
\usefonttheme{serif}
\useinnertheme{circles} %rectangle bullet points instead of circle ones
\setbeamercolor{navigation symbols dimmed}{fg=red!80!black}
\setbeamercolor{navigation symbols}{fg=red!80!black}
\usefonttheme{professionalfonts}%math in english
% 
\newcommand*\oldmacro{}%Pages at the bottom right corner
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
  \oldmacro\hfill%
  \insertframenumber\,}

\newenvironment<>{varblock}[2][.9\textwidth]{%
  \setlength{\textwidth}{#1}
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \usebeamertemplate{block begin}}
  {\par%
    \usebeamertemplate{block end}%
  \end{actionenv}}

\beamertemplatenavigationsymbolsempty
\begin{document}
  \section{Introduction}
  \subsection{1.1}
  \frame{Empty}
  \subsection{1.2}
  \frame{Empty}
  \subsection{1.3}
  \frame{Empty}
  \subsection{1.4}
  \frame{Empty}
\end{document}

And my output is

enter image description here

  • have you found an answer for this question ? I am looking for it too. – Manuel Selva Jun 17 '15 at 13:05
  • as the circles are a theme option, you quite likely need to edit the theme. – ikrabbe Jun 17 '15 at 13:10
  • The dots for the templates are defined in beamerouterthemedefault.sty. I haven't found the width of the section titles yet, but you can add a constant right offset at the begin{pgfpicture} lines (negative first coordinate). To shift the dots 10pts you would change the first {0pt} to {-10pt}. – ikrabbe Jun 17 '15 at 14:22
1

This seems to work, in beamerouterthemedefault.sty. I leave it for others to modify the default theme, as I don't know much about pgfplots:

\newbox\secheadsize
\defbeamertemplate*{mini frame}{default}
{%
 \setbox\secheadsize=\hbox{\usebeamerfont{section in head/foot}\insertsectionhead}
  \begin{pgfpicture}{-.25\wd\secheadsize}{0pt}{0.1cm}{0.1cm}
    \pgfpathcircle{\pgfpoint{0.05cm}{0.05cm}}{0.05cm}
    \pgfusepath{fill,stroke}
  \end{pgfpicture}%
}
[action]
{
  \setbeamersize{mini frame size=0.14cm,mini frame offset=.03cm}
}

\defbeamertemplate*{mini frame in current section}{default}
{%
  \begin{pgfpicture}{0pt}{0pt}{0.1cm}{0.1cm}
    \pgfpathcircle{\pgfpoint{0.05cm}{0.05cm}}{0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

\defbeamertemplate*{mini frame in current subsection}{default}
{%
 \setbox\secheadsize=\hbox{\usebeamerfont{section in head/foot}\insertsectionhead}
 \begin{pgfpicture}{-.25\wd\secheadsize}{0pt}{0.1cm}{0.1cm}
    \pgfpathcircle{\pgfpoint{0.05cm}{0.05cm}}{0.05cm}
    \pgfusepath{stroke}
  \end{pgfpicture}%
}

You have to copy/modify the beamerouterthemedefault.sty and search for the \defbeamertemplate*{mini frame}{default}, identify the block I changed and replace it with my code or insert the coordinates by hand.

  • what does this have to do with pgfplots? and instead of altering beamerouterthemedefault.sty, wouldn't it be better to use \patchcmd from etoolbox since the op already loads it? in which case i imagine the relevant code to change appears in the \slideentry command of beamerbasenavigation.sty – aeroNotAuto Jun 23 '15 at 23:48
  • @aeroNotAuto as there wasn't even a little trial to get in some direction, solving the question I just dove into the code and tried to find out what happens behind the scenes here. You see the pgf commands in the macros. Feel free to provide a better or more convenient answer. – ikrabbe Jun 24 '15 at 8:22
  • first, i must mention that your answer does not work for me. it appears to shift all the mini frames by an even amount. what section titles did you test with? also please note that pgf and pgfplots are not one and the same. – aeroNotAuto Jun 24 '15 at 18:53
1

Don't consider this an answer, but I wanted to give you something to play with in case you need to do this right now. I unfortunately don't have time to look into it this week, but I might be able to get you started, since I have created custom Beamer themes for my alma mater as well as the corporation I currently work for. I spoke to someone else at tex.se that is much more familiar with the Beamer internals. Hopefully they'll be able to post a full answer soon.

I would would not alter beamerouterthemedefault.sty and if you're not trying to create your own theme (for reuse), I would just stick with etoolbox since you are already using it. Using etoolbox to temporarily alter some code in beamerbasenavigation.sty will change the positioning of the mini frames. As proof, you can add this to your preamble (full code below):

\makeatletter
\newlength{\random@spacing}
\newlength{\another@spacing}
\patchcmd{\slideentry}{
    \multiply\beamer@tempdim by\beamer@xpos
    \advance\beamer@tempdim by -\beamer@boxsize
    \advance\beamer@tempdim by 1pt}{
    \multiply\beamer@tempdim by\beamer@xpos
    \advance\beamer@tempdim by -\beamer@boxsize
    \advance\beamer@tempdim by 1pt
    \setlength{\random@spacing}{22pt}
    \divide\random@spacing by #1
    \setlength{\another@spacing}{3pt}
    \multiply\another@spacing by #1
    \advance\random@spacing by \another@spacing
    \advance\beamer@tempdim by \random@spacing}{}{}
\makeatother

which should produce this:

miniFrames

You can see that the mini frames have been shifted by different amounts, depending on the section they belong to. Obviously this is only part way to the answer you're looking for, as the placement of the mini frames is not tied to the length of the corresponding section titles yet. Note that using \insertsectionhead here will use the section of the current slide so it will be the same value for all the groups of mini frames, and they will all be shifted by the same amount, regardless of the length of the title above them.

You can play with the values 22pt in \setlength{\random@spacing}{22pt} and 3pt in \setlength{\another@spacing}{3pt} to change where the mini frames that correspond to different section titles are placed. You could change the math, or even insert conditional/if statements if you're desperate for a one-off solution.

This should give you a general idea of what's involved, but hopefully we'll get that other answer soon, which should be applicable in the general sense. Your example with the additional section is here:

\PassOptionsToPackage{svgnames}{xcolor}
\documentclass[demo]{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,shadows}
\usepackage[bars]{beamerthemetree}%Beamer theme v 2.2
\usepackage{beamerthemebars}
\usepackage{ifthen}
\usepackage{multimedia}
\mode<presentation>
\usepackage{ragged2e}
\usepackage{etoolbox}
\apptocmd{\frame}{\justifying}{}{}
\usepackage{multicol}
\addtobeamertemplate{block begin}{}{\justifying}

%Theme commands
\setbeamerfont{headline}{size=\footnotesize}
\setbeamerfont{section in head/foot}{size=\tiny}
%\setbeamersize{text margin left=10pt,text margin right=10pt}
\newcommand\Wider[2][3em]{%
\makebox[\linewidth][c]{%
  \begin{minipage}{\dimexpr\textwidth+#1\relax}
  \raggedright#2
  \end{minipage}%
  }%
}
\setbeamercovered{highly dynamic}
\usetheme{Ilmenau}% Beamer theme v 3.0
\useoutertheme[subsection=true]{smoothbars}%{miniframes}%%Beamer Outer Theme-circles on top
%-----the only change to the code is here:
\makeatletter
\newlength{\random@spacing}
\newlength{\another@spacing}
\patchcmd{\slideentry}{
    \multiply\beamer@tempdim by\beamer@xpos
    \advance\beamer@tempdim by -\beamer@boxsize
    \advance\beamer@tempdim by 1pt}{
    \multiply\beamer@tempdim by\beamer@xpos
    \advance\beamer@tempdim by -\beamer@boxsize
    \advance\beamer@tempdim by 1pt
    \setlength{\random@spacing}{22pt}
    \divide\random@spacing by #1
    \setlength{\another@spacing}{3pt}
    \multiply\another@spacing by #1
    \advance\random@spacing by \another@spacing
    \advance\beamer@tempdim by \random@spacing}{}{}
\makeatother
%-----
\usefonttheme{serif}
\useinnertheme{circles} %rectangle bullet points instead of circle ones
\setbeamercolor{navigation symbols dimmed}{fg=red!80!black}
\setbeamercolor{navigation symbols}{fg=red!80!black}
\usefonttheme{professionalfonts}%math in english
% 
\newcommand*\oldmacro{}%Pages at the bottom right corner
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
  \oldmacro\hfill%
  \insertframenumber\,}

\newenvironment<>{varblock}[2][.9\textwidth]{%
  \setlength{\textwidth}{#1}
  \begin{actionenv}#3%
    \def\insertblocktitle{#2}%
    \par%
    \usebeamertemplate{block begin}}
  {\par%
    \usebeamertemplate{block end}%
  \end{actionenv}}

\beamertemplatenavigationsymbolsempty
\begin{document}
  \section{Experimental Set-Up}
  \subsection{1.1}
  \frame{Empty}
  \subsection{1.2}
  \frame{Empty}
  \subsection{1.3}
  \frame{Empty}
  \section{Analysis-How to}
  \subsection{1.1}
  \frame{Empty}
  \subsection{1.2}
  \frame{Empty}
  \subsection{1.3}
  \frame{Empty}
  \subsection{1.4}
  \frame{Empty}
  \subsection{1.5}
  \frame{Empty}
  \section{Preliminary Results}
  \subsection{1.1}
  \frame{Empty}
  \subsection{1.2}
  \frame{Empty}
  \subsection{1.3}
  \frame{Empty}
  \subsection{1.4}
  \frame{Empty}  
  \section{Conclusion}
\end{document}
  • This seems to work and looks very clean. Good Job! – ikrabbe Jun 24 '15 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.