[Tex/LaTex] Section name with fancyhdr in beamer

beamerfancyhdrheader-footersectioning

I am trying to add the name of the section in the fancyhdf foot of a beamer presentation but the following command does not work. I have found some help that suggests the command \renewcommand{\subsubsectionmark}[1]{\markright{\thesubsubsection\ #1}} but this does not work in my case. I copy/paste all the working code:

%%%%%%%%%%%%%%%%%%%%%%
% Class and packages %
%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt]{beamer}
\usetheme{default}
\usepackage{calc}
\usepackage{lipsum}
\usepackage{everypage}
\usepackage{layout}
\usepackage{empheq}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{ccaption}
\usepackage{subfigure}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{psfrag}
\usepackage{hyperref}
\usepackage{bm}
\usepackage{pdfpages}
\usepackage[british]{babel}
\usepackage[applemac]{inputenc}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{setspace}
\usepackage{color}
\hypersetup{
    bookmarks=true,         % show bookmarks bar?
    unicode=false,          % non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,        % show Acrobat’s toolbar?
    pdfmenubar=true,        % show Acrobat’s menu?
    pdffitwindow=false,     % window fit to page when opened
    pdfstartview={FitH},    % fits the width of the page to the window
    pdftitle={My title},    % title
    pdfauthor={Author},     % author
    pdfsubject={Subject},   % subject of the document
    pdfcreator={Creator},   % creator of the document
    pdfproducer={Producer}, % producer of the document
    pdfkeywords={keyword1} {key2} {key3}, % list of keywords
    pdfnewwindow=true,      % links in new window
    colorlinks=false,       % false: boxed links; true: colored links
    linkcolor=red,          % color of internal links
    citecolor=green,        % color of links to bibliography
    filecolor=magenta,      % color of file links
    urlcolor=cyan           % color of external links
}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright}m{#1}}
\newcolumntype{C}[1]{>{\centering}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft}m{#1}}

%%%%%%%%%%%%
% Template %
%%%%%%%%%%%%
% Page dimension
\paperwidth=16cm
\paperheight=12cm
\textwidth=14cm
\oddsidemargin=-1.5cm
\topmargin=0cm
\headsep=5pt
\marginparsep=0.3cm
\marginparwidth=1cm
\voffset=-2cm
\hoffset=0cm
\setbeamertemplate{frametitle}{\insertframetitle} 

% Header
\def\title#1{\gdef\@title{#1}\gdef\stored@title{#1}}
\setbeamertemplate{navigation symbols}{}
\pagestyle{fancy}
\fancyhf{}
\lhead{{\footnotesize\textbf{school}}\hspace{10pt}{\scriptsize departement - \@title}}
\rhead{\scriptsize\thepage}
\renewcommand{\headrulewidth}{0pt}

% Footer
\lfoot{\scriptsize\today}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\rfoot{\fancyplain{}{\rightmark }}

% Title frame
\fancypagestyle{fancyonlheadings}{
\renewcommand{\headrulewidth}{0pt}
\lhead{\scriptsize full school name and so on\\
\textbf{Institute name}}
\lfoot{\scriptsize\today}
\rhead{}
}


%%%%%%%%%%%
% Aliases %
%%%%%%%%%%%
\def \be {\begin{equation}}
\def \ee {\end{equation}}
\def \d {\mathrm{d}}
\def \D {\mathrm{D}}
\newcommand{\unit}[1]{ \, \small\mathrm{#1}}

%%%%%%%%%%%%%%%%%
% Last settings %
%%%%%%%%%%%%%%%%%
\begin{document}
% In beamer, these changes have no effect in preamble
\textheight=10cm
\headheight=0.5cm
\footskip=5pt


%%%%%%%%%
% Title %
%%%%%%%%%
% Title template
\defbeamertemplate*{title page}{customized}[1][]{
\thispagestyle{fancyonlheadings}
\large{\textbf{SCHOOLNAME}}\\\vspace{10pt}
{\usebeamercolor[fg]{title}\Huge\@title}\\\vspace{2cm}
{\Large\insertsubtitle}\\\vfill\vspace{2cm}
{\Large\insertauthor}\par
{\Large\insertinstitute}\\\vspace{0.5cm}
{\small\today}
}

% Title data
\title{Titleeeee}
\subtitle{subtitleeee}
\author{me}
\date{\today}
\institute{schoool}

\maketitle

%%%%%%%%%%%%%%%%
% Presentation %
%%%%%%%%%%%%%%%%
\section{Introduction}

\begin{frame}{title of the slide}
\lipsum[3]
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Conclusion}
\begin{frame}{title of the slide}
\lipsum[3]
\end{frame}


\begin{frame}
\begin{Large}
\begin{center}
Thanks for your attention!\\ \vspace{10pt}
%\includegraphics[width=0.6\textwidth]{fig/steel1.jpg} \\ \vspace{5pt}
Any question?
\end{center}
\end{Large}
\end{frame}

\end{document}

My problem is in the %footer part. Can someone help me?

Thanks in advance
philus

Best Answer

If there is no important reason for using fancyhdr with beamer, I'd suggest to declare headers and footers with footline and headline beamertemplates which is the beamer's way.

Following code shows an starting point.

%%%%%%%%%%%%%%%%%%%%%%
% Class and packages %
%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt]{beamer}
\usetheme{default}
\usepackage{lipsum}
\usepackage[british]{babel}
\usepackage[applemac]{inputenc}
\hypersetup{
    bookmarks=true,         % show bookmarks bar?
    unicode=false,          % non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,        % show Acrobat’s toolbar?
    pdfmenubar=true,        % show Acrobat’s menu?
    pdffitwindow=false,     % window fit to page when opened
    pdfstartview={FitH},    % fits the width of the page to the window
    pdftitle={My title},    % title
    pdfauthor={Author},     % author
    pdfsubject={Subject},   % subject of the document
    pdfcreator={Creator},   % creator of the document
    pdfproducer={Producer}, % producer of the document
    pdfkeywords={keyword1} {key2} {key3}, % list of keywords
    pdfnewwindow=true,      % links in new window
    colorlinks=false,       % false: boxed links; true: colored links
    linkcolor=red,          % color of internal links
    citecolor=green,        % color of links to bibliography
    filecolor=magenta,      % color of file links
    urlcolor=cyan           % color of external links
}

%%%%%%%%%%%%
% Template %
%%%%%%%%%%%%
% Page dimension
\paperwidth=16cm
\paperheight=12cm
\textwidth=14cm
\oddsidemargin=-1.5cm
\topmargin=0cm
\headsep=5pt
\marginparsep=0.3cm
\marginparwidth=1cm
\voffset=-2cm
\hoffset=0cm
\setbeamertemplate{frametitle}{\insertframetitle} 

% Header
\def\title#1{\gdef\@title{#1}\gdef\stored@title{#1}}
\setbeamertemplate{navigation symbols}{}

\setbeamerfont{section in head/foot}{size=\scriptsize}
\setbeamertemplate{headline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,left]{section in head/foot}%
    \usebeamerfont{section in head/foot}\hspace*{1cm}{\footnotesize\textbf{school}}\hspace{10pt}{ departement - \@title}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.65ex,dp=1.5ex,right]{section in head/foot}%
    \usebeamerfont{section in head/foot}\thepage\hspace*{1cm}
  \end{beamercolorbox}}%
  \vskip0pt%
}

\setbeamertemplate{footline}{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left]{section in head/foot}%
    \usebeamerfont{section in head/foot}\hspace*{1cm}\today
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{section in head/foot}%
    \usebeamerfont{section in head/foot} \insertsection\hspace*{1cm}
  \end{beamercolorbox}}%
  \vskip0pt%
}



%%%%%%%%%%%
% Aliases %
%%%%%%%%%%%
\def \be {\begin{equation}}
\def \ee {\end{equation}}
\def \d {\mathrm{d}}
\def \D {\mathrm{D}}
\newcommand{\unit}[1]{ \, \small\mathrm{#1}}

%%%%%%%%%%%%%%%%%
% Last settings %
%%%%%%%%%%%%%%%%%
\begin{document}
% In beamer, these changes have no effect in preamble
\textheight=10cm
\headheight=0.5cm
\footskip=5pt


%%%%%%%%%
% Title %
%%%%%%%%%
% Title template
\defbeamertemplate*{title page}{customized}[1][]{
%\thispagestyle{fancyonlheadings}
\large{\textbf{SCHOOLNAME}}\\\vspace{10pt}
{\usebeamercolor[fg]{title}\Huge\@title}\\\vspace{2cm}
{\Large\insertsubtitle}\\\vfill\vspace{2cm}
{\Large\insertauthor}\par
{\Large\insertinstitute}\\\vspace{0.5cm}
{\small\today}
}

% Title data
\title{Titleeeee}
\subtitle{subtitleeee}
\author{me}
\date{\today}
\institute{schoool}

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

%%%%%%%%%%%%%%%%
% Presentation %
%%%%%%%%%%%%%%%%
\section{Introduction}

\begin{frame}{title of the slide}
\lipsum[3]
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Conclusion}
\begin{frame}{title of the slide}
\lipsum[3]
\end{frame}


\begin{frame}
\begin{Large}
\begin{center}
Thanks for your attention!\\ \vspace{10pt}
%\includegraphics[width=0.6\textwidth]{fig/steel1.jpg} \\ \vspace{5pt}
Any question?
\end{center}
\end{Large}
\end{frame}

\end{document}

enter image description here