# Spacing of frame title in beamer class

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}
\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 %%%%%%%%%%%%%%%%%
\tableofcontents
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%% Slide Layout %%%%%%%%%%%%%%%%%
\section{section1}
\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{separator}{fg=IITRRed}
\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]

%%%%%%%%%%%%%%%%%%%%%%%%
% Outer theme
%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{background canvas}{}
\setbeamerfont{footline}{series=\bfseries}
\useoutertheme{tree}
\setbeamertemplate{frametitle}{\bfseries\insertframetitle\par\vskip14pt
\begin{textblock*}{200mm}(.93\textwidth,-1.15cm)
\includegraphics[height=1.2cm]{logo_color.jpg}
\end{textblock*}}
\vskip1pt\hskip2pt%
\setbeamertemplate{footline}[frame number]
\pgfpathrectangle{\pgfpoint{0pt}{0pt}}{\pgfpoint{\textwidth}{-2pt}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

• Please can you provide to add your complete code in LaTeX? – Sebastiano Mar 9 '18 at 8:25
• The code has been added – ShiS Mar 9 '18 at 8:43
• With the code you posted I do not get a horizontal line. Is this line part of any of the images which we do not have? Can you also make your code more minimal? – user36296 Mar 9 '18 at 9:44
• Yes, it is a part of image of slide background – ShiS Mar 9 '18 at 9:51
• Then please provide the image. – user36296 Mar 9 '18 at 9:52

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{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}


• Just saw that using \vspace*{3pt} before \begin{frame} also works in solving this problem. – ShiS Mar 9 '18 at 10:26
• @ShiS The basic idea of latex is to keep format and content separated - you should not need such manual hacks if you fix the problem. – user36296 Mar 9 '18 at 10:31