0

I am using beamertheme focus for an upcoming presentation.

I need to customise the default theme as follows

beamertheme-focus modifications needed

I already know how to change the default colour of the headline in my theme. However, I don't know how to insert the logo (a vector graphic) such that it aligns in-flush with the bottom line of the headline shading, and shall appreciate help in achieving this (if possible in every slide, not just the title slide of the presentation).

2
  • 1
    Please add a MWE. – vi pa Feb 7 '20 at 0:04
  • the titlepage is defined in beamerinnerthemefocus.sty – vi pa Feb 7 '20 at 11:29
1

In the same folder of your document you should create a file called beamerouterthemefocus.sty with the following content:

  % Copyright (C) 2018-2019 Pasquale Claudio Africa and the LaTeX community.
% A full list of contributors can be found at
%
%     https://github.com/elauksap/focus-beamertheme
% 
% This file is part of beamerthemefocus.
% 
% beamerthemefocus is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
% 
% beamerthemefocus is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
% 
% You should have received a copy of the GNU General Public License
% along with beamerthemefocus. If not, see <http://www.gnu.org/licenses/>.

\mode<presentation>

\RequirePackage{appendixnumberbeamer} % Don't number appendix frames.
% Fix hyperref warning caused by \appendix
% (https://tex.stackexchange.com/questions/192686/hyperref-warning-caused-by-beamer-appendix).
\newcommand*{\bkmtranslateto}{\languagename}
\newcommand*{\bkmtranslate}[1]{%
    \ifcsname tr@@@\bkmtranslateto @#1\endcsname
    \csname tr@@@\bkmtranslateto @#1\endcsname
    \else
    #1%
    \fi
}
\pdfstringdefDisableCommands{\let\translate\bkmtranslate}
\RequirePackage{bookmark}

\RequirePackage{etoolbox} % \BeforeBeginEnvironment.
\RequirePackage{tikz}


% FRAMETITLE TEMPLATES. --------------------------------------------------------
\defbeamertemplate*{frametitle}{focus}{%
    % If not title page.
    \ifnum\value{framenumber}>0%
%        \vspace{-1pt}%
%        \begin{beamercolorbox}[wd=\paperwidth,leftskip=0.55cm,rightskip=0.55cm,sep=0.2cm]{frametitle}%
%            \strut\insertframetitle\strut%
%\hfill\includegraphics[scale=0.3]{logoUCL}\vskip0pt
%        \end{beamercolorbox}%
\usebeamercolor{frametitle}\colorlet{focus@@temp}{bg}
\tikz[remember picture, overlay] {
\fill[color=focus@@temp] (current page.north west) rectangle ([yshift=-1.5cm]current page.north east) node[anchor= south east,inner sep=0pt]{\includegraphics[scale=0.3]{logoUCL}};
\node[anchor=north west] at ([shift={(0.55cm,-0.55cm)}]current page.north west) {\insertframetitle};
}
    \fi%
}

% Plain header.
\defbeamertemplate*{frametitle}{plain}{%
    % If not title page.
    \ifnum\value{framenumber}>0%
        \vspace{-1pt}%
        \begin{beamercolorbox}[wd=\paperwidth,leftskip=0.55cm,rightskip=0.55cm,sep=0.2cm,ignorebg]{frametitle}%
            \strut%
        \end{beamercolorbox}%
    \fi%
}


% FOOTLINE TEMPLATES. ----------------------------------------------------------
% Lenghts for the progress bar footline.
\newlength{\focus@pbar@height}% Progress bar height.
\newlength{\focus@pbar@leftoffset}
\newlength{\focus@pbar@rightoffset}

\defbeamertemplate*{footline}{progressbar}{%
    % If not appendix.
    \ifnum\mainend<0% From package appendixnumberbeamer.
        %
        \settowidth{\focus@pbar@leftoffset}{1}%
        \addtolength{\focus@pbar@leftoffset}{1.5em}%
        %
        \settowidth{\focus@pbar@rightoffset}{\inserttotalframenumber}%
        \addtolength{\focus@pbar@rightoffset}{1.5em}%
        %
        % If not title page.
        \ifnum\c@framenumber>0%
            \ifnum\c@framenumber<\inserttotalframenumber%
                \begin{tikzpicture}[inner xsep=0.5em, inner ysep=0.5ex]\usebeamerfont{footline}
                    \pgfmathsetmacro{\focus@pbar@progress}%
                        {(\paperwidth-\focus@pbar@leftoffset-\focus@pbar@rightoffset)*(\insertframenumber/\inserttotalframenumber)}

                    \clip (0,0) rectangle ++(\paperwidth,\the\focus@pbar@height);
                    \fill[footline.bg] (0,0) rectangle ++(\the\focus@pbar@leftoffset,\the\focus@pbar@height);

                    \fill[footline.bg] (\the\focus@pbar@leftoffset,0) rectangle ++(\focus@pbar@progress pt,\the\focus@pbar@height)
                                       ++(0,{-0.5*\the\focus@pbar@height}) node[anchor=east, text=footline.fg] {\strut\insertframenumber};

                    \fill[footline.bg] (\paperwidth,0) rectangle ++(-\the\focus@pbar@rightoffset,\the\focus@pbar@height)
                                       ++(0,{-0.5*\the\focus@pbar@height}) node[anchor=west, text=footline.fg] {\strut\inserttotalframenumber};
                \end{tikzpicture}%
            \else%
                \begin{tikzpicture}[inner xsep=0.5em, inner ysep=0.5ex]
                    \clip (0,0) rectangle ++(\paperwidth,\the\focus@pbar@height);
                    \fill[footline.bg] (0,0) rectangle ++(\paperwidth,\the\focus@pbar@height);

                    \node[anchor=east, footline.fg] at ({\paperwidth-\the\focus@pbar@rightoffset},{0.5*\focus@pbar@height}) {\strut\insertframenumber};
                    \node[footline.fg] at ({\paperwidth-\the\focus@pbar@rightoffset},{0.5*\focus@pbar@height}) {\strut/};
                    \node[anchor=west, footline.fg] at ({\paperwidth-\the\focus@pbar@rightoffset},{0.5*\focus@pbar@height}) {\strut\inserttotalframenumber};
                \end{tikzpicture}%
            \fi%
        \fi%
    \fi%
}

% Full bar footline.
\defbeamertemplate*{footline}{fullbar}{%
    % If not appendix.
    \ifnum\mainend<0% From package appendixnumberbeamer.
        %
        \settowidth{\focus@pbar@leftoffset}{1}%
        \addtolength{\focus@pbar@leftoffset}{1.5em}%
        %
        \settowidth{\focus@pbar@rightoffset}{\inserttotalframenumber}%
        \addtolength{\focus@pbar@rightoffset}{1.5em}%
        %
        % If not title page.
        \ifnum\c@framenumber>0%
            \begin{tikzpicture}[inner xsep=0.5em, inner ysep=0.5ex]
                \clip (0,0) rectangle ++(\paperwidth,\the\focus@pbar@height);
                \fill[footline.bg] (0,0) rectangle ++(\paperwidth,\the\focus@pbar@height);

                \node[anchor=east, footline.fg] at ({\paperwidth-\the\focus@pbar@rightoffset},{0.5*\focus@pbar@height}) {\strut\insertframenumber};
                \node[footline.fg] at ({\paperwidth-\the\focus@pbar@rightoffset},{0.5*\focus@pbar@height}) {\strut/};
                \node[anchor=west, footline.fg] at ({\paperwidth-\the\focus@pbar@rightoffset},{0.5*\focus@pbar@height}) {\strut\inserttotalframenumber};
            \end{tikzpicture}%
        \fi%
    \fi%
}

% Empty footline.
\defbeamertemplate*{footline}{none}{}

\DeclareOptionBeamer{numbering}{\def\beamer@focus@numbering{#1}}
\ExecuteOptionsBeamer{numbering=progressbar}
\ProcessOptionsBeamer

\def\beamer@focus@numberingprogressbar{progressbar}
\def\beamer@focus@numberingfullbar{fullbar}
\def\beamer@focus@numberingnone{none}


% BACKGROUND CANVAS TEMPLATES. -------------------------------------------------
\defbeamertemplate*{background canvas}{focus}{%
    \begin{tikzpicture}
        \clip (0,0) rectangle ++(\paperwidth,\paperheight);
        \fill[normal text.bg] (0,0) rectangle ++(\paperwidth,\paperheight);
    \end{tikzpicture}%
}

\defbeamertemplate*{background canvas}{focusplain}{%
    \begin{tikzpicture}
        \clip (0,0) rectangle ++(\paperwidth,\paperheight);
        \fill[normal text.bg] (0,0) rectangle ++(\paperwidth,\paperheight);
    \end{tikzpicture}%
}

\defbeamertemplate*{background canvas}{focusframe}{%
    \begin{tikzpicture}
        \clip (0,0) rectangle ++(\paperwidth,\paperheight);
        \fill[frametitle.bg] (0,0) rectangle ++(\paperwidth,\paperheight);        
    \end{tikzpicture}%
}


% HOOKS FOR CREATING FRAMES. ---------------------------------------------------
\BeforeBeginEnvironment{frame}{%
    \setbeamertemplate{background canvas}[focus]%
    \setbeamertemplate{frametitle}[focus]%
    %
    % Reset footline height and determine it for the current slide.
    \setlength{\focus@pbar@height}{0cm}%
    \focus@calculatefootheight%
    %
    % If not appendix.
    \ifnum\mainend<0 % From package appendixnumberbeamer.
        \settoheight{\focus@pbar@height}{\usebeamerfont{footline}1234567890/}%
        \addtolength{\focus@pbar@height}{6pt}%
        %
        \ifx\beamer@focus@numbering\beamer@focus@numberingprogressbar%
            \setbeamertemplate{footline}[progressbar]%
        \else%
            \ifx\beamer@focus@numbering\beamer@focus@numberingfullbar%
                \setbeamertemplate{footline}[fullbar]%
            \fi%
        \fi%
        %
        \focus@calculatefootheight%
    \fi%
}

% Enable noframenumbering option.
\define@key{beamerframe}{noframenumbering}[true]{%
    \setbeamertemplate{footline}[none]%
    \setlength{\focus@pbar@height}{0cm}%
    \focus@calculatefootheight%
    %
    \addtocounter{framenumber}{-1}%
}


% Enable plain option.
\define@key{beamerframe}{plain}[true]{%
    \setbeamertemplate{background canvas}[focusplain]%
    \setbeamertemplate{frametitle}[plain]%
    %
    \setbeamertemplate{footline}[none]%
}


% Full vertical centering
% (from https://tex.stackexchange.com/questions/247826/beamer-full-vertical-centering).
\define@key{beamerframe}{c}[true]{%
    \beamer@frametopskip=0pt plus 1fill\relax%
    \beamer@framebottomskip=0pt plus 1fill\relax%
    \beamer@frametopskipautobreak=0pt plus 0.4\paperheight\relax%
    \beamer@framebottomskipautobreak=0pt plus 0.6\paperheight\relax%
    \def\beamer@initfirstlineunskip{}%
}


% Enable focus option.
\providebool{focus@standout}
\define@key{beamerframe}{focus}[true]{%
    \booltrue{focus@standout}%
    \begingroup%
        \setkeys{beamerframe}{noframenumbering}%
        \setbeamertemplate{background canvas}[focusframe]%
        \setbeamertemplate{frametitle}[plain]%
        %
        \setkeys{beamerframe}{c}%
        \centering%
        \usebeamerfont{focusframe}%
        \usebeamercolor[fg]{frametitle}%
}

\apptocmd{\beamer@reseteecodes}
{%
    \ifbool{focus@standout}%
    {%
        \endgroup%
        \boolfalse{focus@standout}%
    }{}%
}{}{}


% Recalculate the footline's size and refresh other parameters.
% Partially copied from the definition of \beamer@calculateheadfoot.
\def\focus@calculatefootheight{%
    \footheight=\focus@pbar@height%
    \advance\footheight by 4pt%
    \sidebarheight=\paperheight%
    \advance\sidebarheight by-\headheight%
    \advance\sidebarheight by\headdp%
    \advance\sidebarheight by-\footheight%
    \advance\sidebarheight by 4pt%
    \footskip=\footheight%
    \textheight=\paperheight%
    \advance\textheight by-\footheight%
    \advance\textheight by-\headheight%
    \@colht\textheight%
    \@colroom\textheight%
    \vsize\textheight%
}

\mode<all>

Always in the same folder you should create a second file called beamerinnerthemefocus.sty with the following content:

% Copyright (C) 2018-2019 Pasquale Claudio Africa and the LaTeX community.
% A full list of contributors can be found at
%
%     https://github.com/elauksap/focus-beamertheme
% 
% This file is part of beamerthemefocus.
% 
% beamerthemefocus is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
% 
% beamerthemefocus is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
% 
% You should have received a copy of the GNU General Public License
% along with beamerthemefocus. If not, see <http://www.gnu.org/licenses/>.

\mode<presentation>

\RequirePackage{tikz}


% CUSTOMIZE STRUCTURE ELEMENTS. ------------------------------------------------
\setbeamertemplate{blocks}[default]

\setbeamertemplate{section in toc}[square]
\setbeamertemplate{subsection in toc}[square]

\setbeamertemplate{itemize items}[square]
\setbeamertemplate{itemize subitem}[triangle]


% STRUCTURE FRAME TEMPLATE DEFINITIONS. ----------------------------------------
% Title page.
\defbeamertemplate*{title page}{focus}{%
    {%
        \usebeamercolor{frametitle}\colorlet{focus@@temp}{bg}%
        \begin{tikzpicture}[overlay, remember picture]
            \fill[color=focus@@temp] (current page.north west) rectangle ([shift = {(0, -0.2\paperheight)}] current page.north east) node[anchor=south east,inner ysep=0 pt] {\includegraphics[scale=0.3]{logoUCL}};
        \end{tikzpicture}
    }
    \begin{beamercolorbox}[sep=1pt,left]{institute}
        \usebeamercolor[fg]{frametitle}
        \usebeamerfont{institute}\insertinstitute
    \end{beamercolorbox}
\vskip4em\par
%    \begin{beamercolorbox}[sep=8pt,left]{title}
%\usebeamercolor[bg]{normal text}
%      \usebeamerfont{title}\inserttitle\par 
%        {\usebeamerfont{subtitle}\insertsubtitle\par}%
%    \end{beamercolorbox}

\begin{minipage}[t]{\textwidth}
\usebeamerfont{title}\inserttitle\par 
        {\usebeamerfont{subtitle}\insertsubtitle\par}%
    \end{minipage}
    %\vspace{-1.65\baselineskip}
%    \begin{minipage}[b][0.35\paperheight]{\textwidth}
%        \vspace{\baselineskip}
%        \usebeamerfont{title}
%        \usebeamercolor[fg]{frametitle}
%        \inserttitle
%    \end{minipage}
%    
%    \begin{minipage}[t][0.1\paperheight]{\textwidth}
%        \usebeamerfont{subtitle}
%        \usebeamercolor[fg]{frametitle}
%        \insertsubtitle
%    \end{minipage}
%    
%    % Set the title graphic in a zero-height box, so that
%    % the position of other elements is not affected.
    {\vfuzz=9999pt\vbox to 0pt {
        \raggedleft
        \inserttitlegraphic
    }}
\vskip4em\par   
    \begin{minipage}[t]{\textwidth}
        \usebeamerfont{author}
        \insertauthor
    \end{minipage}
%    
    %\vspace*{\baselineskip}
%    \begin{minipage}[t]{\textwidth}
%        \usebeamerfont{institute}
%        \insertinstitute
%    \end{minipage}

    \vspace*{\baselineskip}
    \begin{minipage}[t]{\textwidth}
        \usebeamerfont{date}
        \insertdate
    \end{minipage}
    \vspace*{0pt plus 100fill}   
    \addtocounter{framenumber}{-1}
}

% Section page.
\defbeamertemplate*{section page}{focus}{%
    {%
        \usebeamercolor{frametitle}\colorlet{focus@@temp}{bg}%
        \begin{tikzpicture}[overlay, remember picture]
            \fill[color=focus@@temp] (current page.north west) rectangle ([shift = {(0, -0.45\paperheight)}] current page.north east)node[anchor=south east,inner ysep=0 pt] {\includegraphics[scale=0.3]{logoUCL}};
        \end{tikzpicture}%
    }

    \vspace{-2.5\baselineskip}
    \begin{minipage}[b][0.45\paperheight]{\textwidth}
        \usebeamerfont{sectiontitle}
        \usebeamercolor[fg]{frametitle}
        \let\hyperlink\@secondoftwo\insertsection
    \end{minipage}

    \vspace{1.5\baselineskip}
    \begin{minipage}[t][0.55\paperheight]{\textwidth}
        \usebeamerfont{subsectiontitle}
        \usebeamercolor[bg]{frametitle}
        \insertsubsection
    \end{minipage}
}

\AtBeginSection[]{%
    \begin{frame}[plain, noframenumbering]{}
        \sectionpage
    \end{frame}%
}

% Subsection page.
\defbeamertemplate*{subsection page}{focus}{%
    {%
        \usebeamercolor{frametitle}\colorlet{focus@@temp}{bg}%
        \begin{tikzpicture}[overlay, remember picture]
        \fill[color=focus@@temp] (current page.north west) rectangle ([shift = {(0, -0.45\paperheight)}] current page.north east)node[anchor=south east,inner ysep=0 pt] {\includegraphics[scale=0.3]{logoUCL}};
        \end{tikzpicture}%
    }

    \vspace{-2.5\baselineskip}
    \begin{minipage}[b][0.45\paperheight]{\textwidth}
        \usebeamerfont{sectiontitle}
        \usebeamercolor[fg]{frametitle}
        \let\hyperlink\@secondoftwo\insertsection
    \end{minipage}

    \vspace{1.5\baselineskip}
    \begin{minipage}[t][0.55\paperheight]{\textwidth}
        \usebeamerfont{subsectiontitle}
        \usebeamercolor[bg]{frametitle}
        \insertsubsection
    \end{minipage}
}

\AtBeginSubsection[]{%
    \begin{frame}[plain, noframenumbering]{}
        \subsectionpage
    \end{frame}%
}

\mode<all>

The result after setting \setbeamercolor{frametitle}{bg=black} in your document is as follow:

result-1 result-2 result-3

9
  • thank you so much for your answer. Would you be kind to include an additional information in your answer (in a subsection, maybe) for a solution to typeset this logo at this same position (top right, aligned flush with bottom line of header) for every frame (and not just the title frame) of the presentation (which goes beyond answering my question)? – Dr Krishnakumar Gopalakrishnan Feb 8 '20 at 19:12
  • I think that shoul be better define a new style files for the theme with little modifications for get more reliable results. I'll try. – vi pa Feb 8 '20 at 19:51
  • @Krishna I've modify my answer for your request – vi pa Feb 8 '20 at 21:52
  • works like a charm. Thank you for your efforts! This is so nicely done. Marked as accepted. – Dr Krishnakumar Gopalakrishnan Feb 9 '20 at 17:04
  • There are two major issues in your solution. The \framesubtitle gets suppressed (i.e. not typeset at all!), and specifying the [t] option for top-alignment of content within frames causes the text to encroach deep into the frametitle area. Can you please help to fix this? – Dr Krishnakumar Gopalakrishnan Feb 9 '20 at 19:20

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.