[Tex/LaTex] Spacing of frame title in beamer class

beamerspacing

enter image description hereSlide background image

Please refer to the attached image. I am making a presentation using beamer class and latex template of IIT Roorkee. The frame title "Work done in this semester" is coming too much above the horizontal blue line. I want to center it such that the white space above the title and below the title is almost same. How should I do it?

The latex code is as follows:

\documentclass[compress]{beamer}

\usetheme{IITR} % To use the theme of IITR for beamer class in Latex
\usepackage{ragged2e}
\apptocmd{\frame}{}{\justifying}{}
\usepackage{textpos}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{helvet}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz, graphicx}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{headline}{}
\setbeamercovered{transparent}
\usebackgroundtemplate{\includegraphics [width=\paperwidth,height=\paperheight]{slide_bg.png}}
\usepackage{url}

%%%%%%%%%%%%% Title Slide %%%%%%%%%%%%%%%%%

\title{ABC}
%\subtitle{Subtitle of the Talk}
\vspace{200mm}

\author[My name]{{\small  \textbf{Presented by}\\ \vspace{0.75mm}
         \small \color{IITRBlue}\textbf{xyz}\\ \vspace{0.75mm} {\small \color{black}\textbf{Enrollment no -} \color{IITRBlue} \textbf{123}} \\ \vspace{0.75mm} \small \color{black}\textbf{Project guide -} \color{IITRBlue} \textbf{YBT}}} % auteur
\date{\textbf{{\today}} \vspace{3em}}
%\institute{\url{abc@iitr.ac.in}\\
%\href{http://faculty.iitr.ac.in/\textasciitilde abc/}{http://faculty.iitr.ac.in/\textasciitilde abc/}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%% Title Slide %%%%%%%%%%%%%%%%%
{\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{titleslide_bg.png}}
\begin{frame}[plain,t]%{INDIAN INSTITUTE OF TECHNOLOGY ROORKEE}
\titlepage
\begin{textblock*}{200mm}(.94\textwidth,-8.75cm)
\includegraphics[height=.98cm]{logo_white.png}
\end{textblock*}
\end{frame}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%% TOC Slide %%%%%%%%%%%%%%%%%
\begin{frame}[t]{Table of Contents}
\tableofcontents
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%% Slide Layout %%%%%%%%%%%%%%%%%
\section{section1}
\begin{frame}{Table of Contents}
\tableofcontents[currentsection, hidesubsections]
\end{frame}

\begin{frame}[t]{\LARGE Work done in this semester}
\begin{itemize}
    \item Big Bang Big Crunch optimization algorithm
\justifying
\item MOR of LTI – SISO systems via BBBC algorithm and Pade approximation 
\justifying 
\end{itemize}

\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%% Slide Layout %%%%%%%%%%%%%%%%%
\section{section2}
\begin{frame}[t]{Slide 2 section2 (text in bullet form)}
\begin{itemize}
\item example1
\item example2
\item example3
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%% Slide Layout %%%%%%%%%%%%%%%%%
\subsection{subsection 2.1}
\begin{frame}[t]{Slide 2 subsection2.1 (text in block form)}
\begin{block}{Theorem1}
Write theorem 1 text here.
\end{block}
\begin{block}{Theorem2}
Write theorem 2 text here.

Example 1

Example 2

Example 3

Example 4
\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%% Slide Layout %%%%%%%%%%%%%%%%%
{\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{white_bg.png}}
\begin{frame}[plain,c]
\begin{center}
\definecolor{IITRBlue}{RGB}{26,33,141}
{\color{IITRBlue}\LARGE \underline{Thanks.}}
\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}

The .sty file is given as follows It can also be downloaded from https://www.iitr.ac.in/Main/pages/_en_IITR_Presentation__en_.html:

\ProvidesPackage{beamerthemeIITR}[2015/07/20]
\usefonttheme[onlylarge]{structurebold}

%%%%%%%%%%%%%%%%%%%%%%%
% Colours
%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{IITRBlue}{RGB}{26,33,141}
\definecolor{IITRRed}{RGB}{213,24,0}
\definecolor{SubduedBlue}{RGB}{107,142,168}
\usecolortheme[named=IITRBlue]{structure}

\usecolortheme{rose}
\setbeamercolor{item}{fg=SubduedBlue}
\setbeamercolor{title}{fg=IITRBlue}
\setbeamercolor{block title}{fg=IITRBlue,bg=IITRBlue!15!white}
\setbeamercolor{block body}{fg=black}
\setbeamercolor{section in head/foot}{fg=IITRRed}
\setbeamercolor{separator}{fg=IITRRed}
\setbeamercolor{page number in head/foot}{fg=white}
\setbeamercolor{footline}{bg=IITRBlue!30!white,fg=black}
\setbeamercolor{mini frame}{fg=SubduedBlue}
\setbeamertemplate{mini frame in other subsection}[default][40]
\setbeamersize{text margin left=1em,text margin right=1em}

%%%%%%%%%%%%%%%%%%%%%%%%
% Inner theme
%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{pifont}
\useinnertheme{rounded}
\setbeamertemplate{itemize items}{\ding{113}}
\setbeamertemplate{enumerate items}[default]
\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block alerted begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block example begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}

%%%%%%%%%%%%%%%%%%%%%%%%
% Outer theme
%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{background canvas}{}
\setbeamerfont{footline}{series=\bfseries}
\useoutertheme{tree}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{frametitle}{\bfseries\insertframetitle\par\vskip14pt
\begin{textblock*}{200mm}(.93\textwidth,-1.15cm)
\includegraphics[height=1.2cm]{logo_color.jpg}
\end{textblock*}}
\setbeamertemplate{headline}{%
\vskip1pt\hskip2pt%
\hspace*{23pt}\insertnavigation{.65\paperwidth}}
\setbeamertemplate{footline}[frame number]
\addtobeamertemplate{title page}{\vskip20pt}{\vfil\centering%
\pgfpathrectangle{\pgfpoint{0pt}{0pt}}{\pgfpoint{\textwidth}{-2pt}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Best Answer

The problem is that normally your theme has an headline, which you disabled with \setbeamertemplate{headline}{}, thus the space which is normally occupied by the headline is missing. To compensate for the remaining space I suggest \setbeamertemplate{headline}{\vskip3pt} instead (you might have to experiment with the exact value of the vertical space)

Some other points:

  • \usepackage{graphicx} is unnecessary for beamer

  • Don't manually put formatting instructions like \LARGE in macro arguments, change the respective font instead: \setbeamerfont{frametitle}{size=\LARGE,series=\bfseries}

  • If you insert an image where you define both the height and the width, add \keepaspectratio, otherwise the image will be distorted.


\documentclass[compress]{beamer}

\usepackage{textpos}

\setbeamertemplate{headline}{\vskip3pt}

\setbeamertemplate{frametitle}{%
    \insertframetitle\par\vskip14pt
    \begin{textblock*}{200mm}(.93\textwidth,-1.3cm)
        \includegraphics[height=1.2cm]{example-image}
    \end{textblock*}}

\usebackgroundtemplate{\includegraphics [width=\paperwidth,height=\paperheight,keepaspectratio]{YdRyj}}

\setbeamerfont{frametitle}{size=\LARGE,series=\bfseries}

\begin{document}

\begin{frame}[t]
    \frametitle{Work done in this semester}
\end{frame}

\end{document}

enter image description here

Related Question