1

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:

\setbeamerfont{frametitle}{size={\large}}
\setbeamerfont{framesubtitle}{size={\footnotesize}}

Problem

MWE:

 \documentclass[10pt]{beamer}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{english}
\setmainfont{CMU Serif}

\DeclareMathOperator*{\argminB}{argmax} 
\setbeamersize{text margin left=10pt, text margin right=5pt} 

\usefonttheme{professionalfonts} 
\setbeamerfont{frametitle}{size={\large}}
\setbeamerfont{framesubtitle}{size={\footnotesize}}
\setbeamerfont{block title}{size=\small}
%spacing between lines
\usepackage{setspace}

%remove navigation symbols
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
\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}
\usepackage{multirow}



%defining colors of elements
\setbeamercolor{frametitle}{fg=white, bg=2green}
\setbeamercolor{section in toc}{fg=2green}
\setbeamercolor{title}{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}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}


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


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

   \title{Title}
\subtitle{subTitle}
\author{}

\date{}




\begin{document}
%---------------------------% 

{
\setbeamertemplate{footline}{} 
\begin{frame}
    \titlepage
\end{frame}
}


\section{Sectio}
\subsection{subsection}

%---------------------------% 
\begin{frame}[fragile]{\insertsubsection}
\begin{block}{}
Text
\end{block}
\begin{itemize}
    \item item1
    \item item1
\end{itemize}
\end{frame}
%---------------------------%

\end{document}
  • 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
1

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.

\documentclass{beamer}

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

\begin{document}

\begin{frame}{Test}
text
\end{frame}

\end{document}

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.