Search code examples
latexbeamer

How to globally shrink the width of the content in frames in beamer?


I would like to shrink the width of the content in the frames in a beamer presentation. For now, I am doing this by using a minipage environment in each and every frame. Is there a way to globally shrink this width in order to avoid shrinking the width manually in each frame?

\documentclass[9pt,trans,xcolor={table},envcountsect]{beamer} % Plain

\usefonttheme[onlymath]{serif}
\usetheme[shownavsym,right]{Aalborg}

\setbeamertemplate{section in toc}[sections numbered] % Automatic enumeration of sections
\setbeamertemplate{blocks}[rounded][shadow=true] 

\definecolor{dgreen}{rgb}{0.,0.6,0.} 
\definecolor{aaublue}{RGB}{33,26,82}% dark blue

\usepackage{etoolbox} % In order to still use an outdated beamer version

\AtBeginEnvironment{theorem}{%
\setbeamertemplate{itemize items}[circle]                    % Shape of bullet-points
\setbeamercolor{block title}{bg=dgreen!100!white,fg=white}%
\setbeamercolor{itemize item}{fg=dgreen!100!white}%
\setbeamercolor{itemize subitem}{fg=dgreen!100!white}%
\setbeamercolor{itemize subsubitem}{fg=dgreen!100!white}%
\setbeamercolor{enumerate item}{fg=dgreen!100!black}%
\setbeamercolor{enumerate subitem}{fg=dgreen!100!black}%
\setbeamercolor{enumerate subsubitem}{fg=dgreen!100!black}%
}

\AtBeginEnvironment{definition}{%
\setbeamertemplate{itemize items}[circle]                    % Shape of bullet-points
\setbeamercolor{block title}{bg=blue,fg=white}%
\setbeamercolor{itemize item}{fg=blue}%
\setbeamercolor{itemize subitem}{fg=blue}%
\setbeamercolor{itemize subsubitem}{fg=blue}%
\setbeamercolor{enumerate item}{fg=blue}%
\setbeamercolor{enumerate subitem}{fg=blue}%
\setbeamercolor{enumerate subsubitem}{fg=blue}%
}

\setbeamercolor*{block body}{bg=black!10!white,fg=black} 
\setbeamercolor*{block body alerted}{bg=normal text.bg!90!black,fg=black} 
\setbeamercolor*{block body example}{bg=normal text.bg!90!black,fg=black} 
\setbeamercolor*{block title}{parent=structure2,bg=normal text.bg!0!blue}
\setbeamercolor*{block title alerted}{use={normal text,alerted text},fg=alerted text.fg!0!white,bg=normal text.bg!10!red}
\setbeamercolor*{block title example}{use={normal text,example text},fg=white,bg=cyan}
\setbeamercolor*{block title theorem}{use={normal text,example text},fg=example text.fg!100!normal text.fg,bg=normal text.bg!0!dgreen}

\makeatletter
\pgfdeclareverticalshading[lower.bg,upper.bg]{bmb@transition}{200cm}{color(0pt)=(lower.bg); color(4pt)=(lower.bg); color(4pt)=(upper.bg)}
\makeatother

\setbeamertemplate{theorems}[numbered]
\addtobeamertemplate{theorem begin}{\normalfont}

\let\definition\undefined
\newtheorem{definition}{\translate{Definition}}[section]


\begin{document}

\begin{frame}[<+->]{Globally shrink the frame width}
    \begin{minipage}{0.89\textwidth}
        \begin{definition}
            \begin{itemize}
                \item Wanted: Reduction of the width of all content in all frames.
            \end{itemize}        
        \end{definition}
    \end{minipage}
\end{frame}

\end{document}

Solution

  • You can use \setbeamersize{...} to adjust the left and right text margin:

    \documentclass[9pt,trans,xcolor={table},envcountsect]{beamer} % Plain
    
    \usefonttheme[onlymath]{serif}
    \usetheme[shownavsym,right]{Aalborg}
    
    \setbeamertemplate{section in toc}[sections numbered] % Automatic enumeration of sections
    \setbeamertemplate{blocks}[rounded][shadow=true] 
    
    \definecolor{dgreen}{rgb}{0.,0.6,0.} 
    \definecolor{aaublue}{RGB}{33,26,82}% dark blue
    
    \usepackage{etoolbox} % In order to still use an outdated beamer version
    
    \AtBeginEnvironment{theorem}{%
    \setbeamertemplate{itemize items}[circle]                    % Shape of bullet-points
    \setbeamercolor{block title}{bg=dgreen!100!white,fg=white}%
    \setbeamercolor{itemize item}{fg=dgreen!100!white}%
    \setbeamercolor{itemize subitem}{fg=dgreen!100!white}%
    \setbeamercolor{itemize subsubitem}{fg=dgreen!100!white}%
    \setbeamercolor{enumerate item}{fg=dgreen!100!black}%
    \setbeamercolor{enumerate subitem}{fg=dgreen!100!black}%
    \setbeamercolor{enumerate subsubitem}{fg=dgreen!100!black}%
    }
    
    \AtBeginEnvironment{definition}{%
    \setbeamertemplate{itemize items}[circle]                    % Shape of bullet-points
    \setbeamercolor{block title}{bg=blue,fg=white}%
    \setbeamercolor{itemize item}{fg=blue}%
    \setbeamercolor{itemize subitem}{fg=blue}%
    \setbeamercolor{itemize subsubitem}{fg=blue}%
    \setbeamercolor{enumerate item}{fg=blue}%
    \setbeamercolor{enumerate subitem}{fg=blue}%
    \setbeamercolor{enumerate subsubitem}{fg=blue}%
    }
    
    \setbeamercolor*{block body}{bg=black!10!white,fg=black} 
    \setbeamercolor*{block body alerted}{bg=normal text.bg!90!black,fg=black} 
    \setbeamercolor*{block body example}{bg=normal text.bg!90!black,fg=black} 
    \setbeamercolor*{block title}{parent=structure2,bg=normal text.bg!0!blue}
    \setbeamercolor*{block title alerted}{use={normal text,alerted text},fg=alerted text.fg!0!white,bg=normal text.bg!10!red}
    \setbeamercolor*{block title example}{use={normal text,example text},fg=white,bg=cyan}
    \setbeamercolor*{block title theorem}{use={normal text,example text},fg=example text.fg!100!normal text.fg,bg=normal text.bg!0!dgreen}
    
    \makeatletter
    \pgfdeclareverticalshading[lower.bg,upper.bg]{bmb@transition}{200cm}{color(0pt)=(lower.bg); color(4pt)=(lower.bg); color(4pt)=(upper.bg)}
    \makeatother
    
    \setbeamertemplate{theorems}[numbered]
    \addtobeamertemplate{theorem begin}{\normalfont}
    
    \let\definition\undefined
    \newtheorem{definition}{\translate{Definition}}[section]
    
    \setbeamersize{text margin right=2cm,text margin left=1cm}
    
    \begin{document}
    
    \begin{frame}[<+->]{Globally shrink the frame width}
    %    \begin{minipage}{0.89\textwidth}
            \begin{definition}
                \begin{itemize}
                    \item Wanted: Reduction of the width of all content in all frames.
                \end{itemize}        
            \end{definition}
    %    \end{minipage}
    \end{frame}
    
    \end{document}
    

    enter image description here