I am trying to make a slideshow for a quiz. In between rounds, I want to put a blank slide with just the title of that round, vertically centered. The title slide should also be vertically centered.

Because the default slides (questions) show the round and question number as a footline, I defined a blank slide command:

% Frame without footline.
\newcommand{\blankframe}[1]{
    {%
    \setbeamertemplate{footline}{}
    \begin{frame}
        \begin{center}
            #1
        \end{center}
    \end{frame}
    }
}

I use this to create a title slide as follows:

\blankframe{
  {\huge My Quiz Title}
  \vfill
  {\scriptsize 2014}
}

and a new round:

\newcommand{\round}[2]{
    \stepcounter{roundCounter}
    \stepcounter{questionCounter}
    \renewcommand{\currentRoundName}{#1}
    \renewcommand{\currentRoundQuestions}{#2}
    \blankframe{
        {\huge #1}
    }
}

But the result is not entirely vertically centered, it's slightly tilted towards the top: Example output

Does anybody know what is going on here? Could it be because of the empty frametitle, and how could I fix that?

Thanks in advance!

Here is a full working example:

\documentclass[xelatex]{beamer}

\usepackage[quiet]{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{xcolor}

\setbeamerfont{question}{size*={14}{1.4em}}

\setbeamertemplate{frametitle}{}
\setbeamertemplate{navigation symbols}{}

\newcounter{roundCounter}
\newcounter{questionCounter}[roundCounter]

\newcommand{\currentRoundName}{}
\newcommand{\currentRoundQuestions}{0}

% Start a new round with 2 arguments:
%  #1    Round name
%  #2    Number of questions in this round. 
\newcommand{\round}[2]{
    \stepcounter{roundCounter}
    \stepcounter{questionCounter}
    \renewcommand{\currentRoundName}{#1}
    \renewcommand{\currentRoundQuestions}{#2}
    \blankframe{
        {\huge #1}
    }
}

% Frame without footline.
\newcommand{\blankframe}[1]{
    {%
    \setbeamertemplate{footline}{}
    \begin{frame}
        \begin{center}
            #1
        \end{center}
    \end{frame}
    }
}

\begin{document}

\blankframe{
  {\huge My Quiz Title}
  \vfill
  {\scriptsize 2014}
}

\round{Warm-up round}{10}

\end{document}
  • Perhaps adding a strategically placed \vfill, as in \blankframe{ {\vfill\huge My Quiz Title} \vfill {\scriptsize 2014} } – Steven B. Segletes Nov 15 '14 at 12:31
up vote 1 down vote accepted

In addition to the titleframe \vfill I mention, in my comment, better centering can also be achieved with more \vfills in the definition of \blankframe.

\documentclass[xelatex]{beamer}

\usepackage[quiet]{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{xcolor}

\setbeamerfont{question}{size*={14}{1.4em}}

\setbeamertemplate{frametitle}{}
\setbeamertemplate{navigation symbols}{}

\newcounter{roundCounter}
\newcounter{questionCounter}[roundCounter]

\newcommand{\currentRoundName}{}
\newcommand{\currentRoundQuestions}{0}

% Start a new round with 2 arguments:
%  #1    Round name
%  #2    Number of questions in this round. 
\newcommand{\round}[2]{
    \stepcounter{roundCounter}
    \stepcounter{questionCounter}
    \renewcommand{\currentRoundName}{#1}
    \renewcommand{\currentRoundQuestions}{#2}
    \blankframe{
        {\huge #1}
    }
}

% Frame without footline.
\newcommand{\blankframe}[1]{
    {%
    \setbeamertemplate{footline}{}
    \begin{frame}
        \vfill\vfill\centering#1\vfill\vfill
    \end{frame}
    }
}

\begin{document}

\blankframe{
  {\vfill\huge My Quiz Title}\vfill
  {\scriptsize 2014}
}

\round{Warm-up round}{10}

\end{document}

enter image description here

enter image description here

  • This does indeed work, thank you very much! – PidgeyUsedGust Nov 15 '14 at 12:44
  • presumably just looks more centred as 3/7 is a better approximation to 1/2 than the original 1/3 is. (there is one \vfill from the frame and you have 3 above and 3 below. – David Carlisle Nov 15 '14 at 13:47
  • @DavidCarlisle Yes. – Steven B. Segletes Nov 15 '14 at 13:54
  • removing the extra fill, or using filll glue would be easier then:-) – David Carlisle Nov 15 '14 at 14:03
  • @DavidCarlisle I know you are suggesting something simple, but I'm confused. If I replace \vfill\vfill\centering#1\vfill\vfill with \vfill\vfill\centering#1\vfill, I would call that an improvement. But if I replace it with \vfill\centering#1, it is not centered. – Steven B. Segletes Nov 15 '14 at 14:47

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.