TransWikia.com

Custom Navigation in Beamer Footer

TeX - LaTeX Asked on December 31, 2021

I’d like to customize the footer in a Beamer document to show the section name with a bar over the top of the name in the document footer. For example:
enter image description here

Using code found on Stack Exchange, I was able to produce, in the footer, the following:

enter image description here

I was wondering if anyone could suggest changes to my code that produces the latter in order to get to the former (or at least as close as possible). Specifically, I’d like the section name below the symbol, the symbols visible across the page for all sections (with the current section darker) and the shape roughly rectangular. I’d also like, if possible, to enable navigation to the relevant section by clicking on the blocks above the section title.
My code to produce the latter is below,
Many thanks,
Joe

documentclass{beamer}

usepackage{tikz}
usetikzlibrary{shapes,calc,positioning,arrows}
setbeamertemplate{navigation symbols}{}
setbeamertemplate{footline}{%
leavevmode%
  hbox{%
    begin{beamercolorbox}[wd=paperwidth,ht=4.8ex,dp=5.125ex]{palette}%
        insertsectionnavigationhorizontal{paperwidth}{}{hskip0pt plus1filll}
    end{beamercolorbox}%
  }
}

setbeamertemplate{section in head/foot}{%
    ifinsertsectionheadnumber1
        tikznode[draw=blue,fill=blue,shape=signal,very thick,text=white]{insertsectionheadhskip.3cm};
    else
        tikznode[draw=blue,fill=blue,shape=signal,signal from=west, signal to=east,very thick,text=white]     {insertsectionheadhskip.3cm};
  fi
}

setbeamertemplate{section in head/foot shaded}{%
    ifinsertsectionheadnumber1
        tikznode[draw=blue,fill=white,shape=signal,very thick,text=blue]{insertsectionheadhskip.3cm};
    else
        tikznode[draw=blue,fill=white,shape=signal,signal from=west, signal to=east,very thick,text=blue]     {insertsectionheadhskip.3cm};
  fi
}

begin{document}

section{objective 1}

begin{frame} frametitle{My First Slide} Slide 1 end{frame} 

section{objective 2}

begin{frame} frametitle{My Second Slide} Slide 2 end{frame} 

end{document}

One Answer

So if I get you right, you basically want to change the drawing in the TikZ code. First of all we can simply, because the shapes do not differ based on the section. Then we adapt the drawing and the colors to follow your example. Basically the drawing happens in two steps. First fill an area that is to your liking fill[fill=blue,draw=none] (0,0) -| (1.5,0.2) -- (0.4,0.2) -- (0.3,0.3) -- (0.2,0.2) -| cycle;, then add a node below that contains the text node(text)[text=blue,anchor=north west] at (0,0) {strutinsertsectionheadhskip.3cm};

documentclass{beamer}

usepackage{tikz}
usetikzlibrary{shapes,calc,positioning,arrows}
setbeamertemplate{navigation symbols}{}
setbeamertemplate{footline}{%
leavevmode%
  hbox{%
    begin{beamercolorbox}[wd=paperwidth,ht=4.8ex,dp=5.125ex]{palette}%
        insertsectionnavigationhorizontal{paperwidth}{}{hskip0pt plus1filll}
    end{beamercolorbox}%
  }
}

setbeamertemplate{section in head/foot}{%
begin{tikzpicture}%
    node[anchor=north west,inner sep=0pt,outer sep=0pt,text=white] at (0,0.3) {hyperlink{Outlineinsertpartheadnumber.insertsectionheadnumber}{rule{1.5cm}{0.6cm}}};
    fill[fill=blue,draw=none] (0,0) -| (1.5,0.2) -- (0.4,0.2) -- (0.3,0.3) -- (0.2,0.2) -| cycle;
    node(text)[text=blue,anchor=north west] at (0,0) {strutinsertsectionheadhskip.3cm};
end{tikzpicture}
}

setbeamertemplate{section in head/foot shaded}{%
begin{tikzpicture}%
        node[anchor=north west,inner sep=0pt,outer sep=0pt,text=white] at (0,0.3) {hyperlink{Outlineinsertpartheadnumber.insertsectionheadnumber}{rule{1.5cm}{0.6cm}}};
        fill[fill=blue!50,draw=none] (0,0) -| (1.5,0.2) -| cycle;
        node(text)[text=blue,anchor=north west] at (0,0) {strut};
end{tikzpicture}
}

begin{document}

section{objective 1}
begin{frame} frametitle{My First Slide} Slide 1 end{frame} 

section{objective 2}
begin{frame} frametitle{My Second Slide} Slide 2 end{frame} 

section{objective 3}
begin{frame} frametitle{My Second Slide} Slide 2 end{frame} 

end{document}

Addition to your request to have a working link

Actually beamer uses targets that are named Outline<part>.<section> to identify the starting page of a section. beamer also offers the hyperlink command to link to such targets. A quick&dirty solution I found is to put a surface in the background that can be used for the link and then refer to the section by using the given part and section number. Therefore we are adding this line: node[anchor=north west,inner sep=0pt,outer sep=0pt,text=white] at (0,0.3) {hyperlink{Outlineinsertpartheadnumber.insertsectionheadnumber}{rule{1.5cm}{0.6cm}}};

I am sure there is a better solution to create an empty box in the node for the hyperlink to work, in this case you could remove the text=white and maybe also dynamically adjust the size of the node to the actual content. Nevertheless this solution produces a link for the area of the rectangle and button, if you want to see the size, change text=white to text=red and it will be drawn red.

enter image description here

Answered by TobiBS on December 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP