4

I wrote a custom beamer style. The frame titles height is larger than the standard one. Due to this the frame moves downward over the foot-line and the lower border.

How can I correct the frame height to stay between frame-title and foot-line using \defbeamertemplate or similar?

An example presentation

\documentclass[10pt,aspectratio=169]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\usetheme{mwe}

\author{an Author}
\title{a Title}
\subtitle{a subtitle}
\date{\today}

%%% DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{frame}{title}
\begin{tikzpicture}
\draw [very thick] (0,0)rectangle(\textwidth,\textheight);
\end{tikzpicture}
\end{frame}

\end{document}

beamerthememwe.sty

\mode<presentation>

\RequirePackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}

% Settings
\useoutertheme{mwe}

\mode<all>

beamerouterthememwe.sty

\mode<presentation>

% Frame title
\defbeamertemplate*{frametitle}{mwe}[1][]
{
    \begin{tikzpicture}
        \useasboundingbox[]
            (0,0)rectangle(\textwidth+0.5\paperwidth-0.5\textwidth,.135\paperheight);
        \node [ anchor=east,
        font=\LARGE,
        black,
        minimum height=10pt,
        align=center]
            at (current bounding box.east)
            {\textbf{\insertframetitle}};
    \end{tikzpicture}
    \vspace*{5pt}
}


\defbeamertemplate*{footline}{mwe}[1][]
{
    \begin{tikzpicture}
        \useasboundingbox [draw] (0,\the\textheight) -- (\the\paperwidth,\the\textheight);

        \node [anchor=south west, font=\tiny, black]
            at ($(current bounding box.west)+(5pt,0)$)
            {\insertauthor};

        \node [anchor=south, font=\tiny, black]
            at (current bounding box)
            {\insertdate};

        \node [anchor=south east, font=\tiny, black]
            at ($(current bounding box.east)+(-5pt,0)$)
            {\insertframenumber/\inserttotalframenumber};

        \draw [double distance = 0.6pt, line cap=round,color=black]
            ($(current bounding box.west)+(5pt,11pt)$) --
            ($(current bounding box.east)+(-5pt,11pt)$);

    \end{tikzpicture}
}
\mode<all>

This is the output: The big frame shows the dimension of the frame-area.

enter image description here


\newcommand*{\BlockImage}[3]
{
   \begin{column}{#1\textwidth}
   \begin{block}{\footnotesize #2}
      \centering
      \includegraphics[width=\textwidth,
                       height=.75\beamer@frametextheight,
                       keepaspectratio]{#3}
   \end{block}
   \end{column}
}

final workaround

\makeatletter
\newlength{\frameheadheight}
\setlength{\frameheadheight}{2cm}
\newlength{\frametextheight}
\setlength{\frametextheight}{\paperheight}
\addtolength{\frametextheight}{-\footheight}
\addtolength{\frametextheight}{-\headheight}
\addtolength{\frametextheight}{-\frameheadheight}
\makeatother

\newcommand*{\BlockImg}[3]
{
   \begin{column}{#1\textwidth}
   \vskip-.5\frameheadheight
   \begin{block}{\footnotesize #2}
      \centering
      \includegraphics[%width=\textwidth,
                       height=.75\frametextheight,
                       keepaspectratio]{#3}
   \end{block}
   \end{column}
}
18
  • 2
    Can you please make a MWE? Commented Mar 5, 2018 at 14:35
  • 1
    your code fragments do not compile and reproducing your problem without a lot of guesswork is impossible. Commented Mar 5, 2018 at 14:47
  • Oh, that is normal. \textheight only factors in the footline and the headline, not the frametitle. What do you need the textheight for? Commented Mar 5, 2018 at 15:12
  • It scales the boxes and all the other stuff. I mean i.e. an itemize will not shrink because it runs over the footer first.
    – Alex44
    Commented Mar 5, 2018 at 15:15
  • See tex.stackexchange.com/q/368710/36296 and the questions marked as duplicates for some methods how to access the actual remaining space of the frame. Commented Mar 5, 2018 at 15:18

1 Answer 1

1

The problem that your itemize did not shrink above the footline is totally unrelated to the frametitle or the textheight. The problem is that your footline has zero height. If you increase the height of the footline, the items will shrink above it:

\documentclass[10pt,aspectratio=169]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\RequirePackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}

\mode<presentation>

% Frame title
\defbeamertemplate*{frametitle}{mwe}[1][]
{
    \begin{tikzpicture}
        \useasboundingbox[]
            (0,0)rectangle(\textwidth+0.5\paperwidth-0.5\textwidth,.135\paperheight);
        \node [ anchor=east,
        font=\LARGE,
        black,
        minimum height=10pt,
        align=center]
            at (current bounding box.east)
            {\textbf{\insertframetitle}};
    \end{tikzpicture}
    \vspace*{5pt}
}


\defbeamertemplate*{footline}{mwe}[1][]
{
        \vskip1.8\baselineskip
    \begin{tikzpicture}
        \useasboundingbox [draw] (0,\the\textheight) -- (\the\paperwidth,\the\textheight);

        \node [anchor=south west, font=\tiny, black]
            at ($(current bounding box.west)+(5pt,0)$)
            {\insertauthor};

        \node [anchor=south, font=\tiny, black]
            at (current bounding box)
            {\insertdate};

        \node [anchor=south east, font=\tiny, black]
            at ($(current bounding box.east)+(-5pt,0)$)
            {\insertframenumber/\inserttotalframenumber};

        \draw [double distance = 0.6pt, line cap=round,color=black]
            ($(current bounding box.west)+(5pt,11pt)$) --
            ($(current bounding box.east)+(-5pt,11pt)$);

    \end{tikzpicture}
}
\mode<all>

\author{an Author}
\title{a Title}
\subtitle{a subtitle}
\date{\today}

%%% DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{frame}{title}
\begin{itemize}
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\end{itemize}
\end{frame}

\begin{frame}{title}
\begin{itemize}
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\item t
\end{itemize}
\end{frame}

\end{document}

For creating some height to scale images:

\documentclass[10pt,aspectratio=169]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\RequirePackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}

\mode<presentation>

% Frame title
\defbeamertemplate*{frametitle}{mwe}[1][]
{
    \begin{tikzpicture}
        \useasboundingbox[]
            (0,0)rectangle(\textwidth+0.5\paperwidth-0.5\textwidth,.135\paperheight);
        \node [ anchor=east,
        font=\LARGE,
        black,
        minimum height=10pt,
        align=center]
            at (current bounding box.east)
            {\textbf{\insertframetitle}};
    \end{tikzpicture}
    \vspace*{5pt}
}


\defbeamertemplate*{footline}{mwe}[1][]
{
        \vskip1.8\baselineskip
    \begin{tikzpicture}
        \useasboundingbox [draw] (0,\the\textheight) -- (\the\paperwidth,\the\textheight);

        \node [anchor=south west, font=\tiny, black]
            at ($(current bounding box.west)+(5pt,0)$)
            {\insertauthor};

        \node [anchor=south, font=\tiny, black]
            at (current bounding box)
            {\insertdate};

        \node [anchor=south east, font=\tiny, black]
            at ($(current bounding box.east)+(-5pt,0)$)
            {\insertframenumber/\inserttotalframenumber};

        \draw [double distance = 0.6pt, line cap=round,color=black]
            ($(current bounding box.west)+(5pt,11pt)$) --
            ($(current bounding box.east)+(-5pt,11pt)$);

    \end{tikzpicture}
}
\mode<all>

\makeatletter
\newlength{\myheight}
\setlength{\myheight}{\paperheight}
\addtolength{\myheight}{-\footheight}
\addtolength{\myheight}{-\headheight}
\addtolength{\myheight}{-1.95cm}
\makeatother

\author{an Author}
\title{a Title}
\subtitle{a subtitle}
\date{\today}

%%% DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{frame}{title}
\begin{tikzpicture}
\draw [very thick] (0,0)rectangle(\textwidth,\myheight);
\end{tikzpicture}

\end{frame}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .