How can I remove the margin showed in figure below? There is no any definition for headline (I define only footline). All defined options for frame title is:




\setmainfont{CMU Serif}

\setbeamersize{text margin left=10pt, text margin right=5pt} 

\setbeamerfont{block title}{size=\small}
%spacing between lines

%remove navigation symbols
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{frametitle continuation}{}
%new colors
\definecolor{back}{rgb}{0.98, 0.98,0.98 }
\definecolor{2green}{rgb}{0, 0.16, 0.26}
\definecolor{anti-flashwhite}{rgb}{0.95, 0.95, 0.96}
\definecolor{green-for-code}{rgb}{0, 0.6, 0}

%defining colors of elements
\setbeamercolor{frametitle}{fg=white, bg=2green}
\setbeamercolor{section in toc}{fg=2green}
\setbeamercolor{enumerate item}{fg=2green}
\setbeamercolor{enumerate subitem}{fg=2green}
\setbeamercolor{itemize item}{fg=2green}
\setbeamercolor{itemize subitem}{fg=2green}
\setbeamercolor{description item}{fg=2green}
\setbeamercolor{block title}{fg = white, bg = 2green!60}
\setbeamercolor{block body}{fg = black, bg = anti-flashwhite}
\setbeamercolor{caption name}{fg=2green}


%templates for elements
\defbeamertemplate{description item}{align left}{\insertdescriptionitem        \hfill}
\setbeamertemplate{description item}[align left]
\setbeamertemplate{enumerate item}{\textbf{\theenumi}.}

%defining the footline
    \begin{beamercolorbox}[wd=0.9\paperwidth,ht=10ex,dp=1ex,right]    {subsection in head/foot}%
        \color{2green}{\insertsection} \hspace*{0ex}
    \begin{beamercolorbox}[wd=0.1\paperwidth,ht=10ex,dp=1ex,right]    {subsection in head/foot}%
        \color{2green}{\insertframenumber{}} / \inserttotalframenumber    \hspace*{5ex}






    \item item1
    \item item1

  • 1
    Please make a minimal working example (MWE) – user36296 Sep 25 '18 at 8:09
  • I've added the MWE – Vasya Pravdin Sep 27 '18 at 16:36
  • Would it be possible to reduce the code the minimum necessary to reproduce the error. Especially can you make an example which does not need special fonts to compile? – user36296 Sep 27 '18 at 16:42
  • Furthermore there is a syntax error in \author{XXX}{XXX}}. And you don't need \usepackage{graphicx} or \usepackage{hyperref} with beamer. – user36296 Sep 27 '18 at 16:43
  • 1
    Funnily enough this space at the left margin is caused by changing the right margin – user36296 Sep 27 '18 at 17:29

The problem is that the unit pt is not a fixed length, but depends on the current font size. This means that if the frametitle takes the margin into account, this margin has another size than when the position of the frametitle on the frame is calculated.

To circumvent this problem, use a fixed unit to define your margin, e.g. cm.


\setbeamersize{text margin left=0.3cm, text margin right=0.3cm} 
\setbeamercolor{frametitle}{fg=white, bg=black}




enter image description here

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.