3

For this theme, how can I center the title and/or the remaining elements on the title page?

\documentclass{beamer}
\usetheme{metropolis}

\title{long long long long long long long long long long long long long long title}
\author{me}
\institute{institute}
\date{1 September 2017}

\begin{document}
    \maketitle
\end{document}

enter image description here

3
\documentclass{beamer}
\usetheme{metropolis}

\title{long long long long long long long long long long long long long long title}
\author{me}
\institute{institute}
\date{1 September 2017}

\makeatletter
\setbeamertemplate{title page}{
  \begin{minipage}[b][\paperheight]{\textwidth}
    \centering  % <-- Center here
    \ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi
    \vfill%
    \ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
    \ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
    \usebeamertemplate*{title separator}
    \ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
    \ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
    \ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
    \vfill
    \vspace*{1mm}
  \end{minipage}
}

\setbeamertemplate{title}{
%  \raggedright%  % <-- Comment here
  \linespread{1.0}%
  \inserttitle%
  \par%
  \vspace*{0.5em}
}
\setbeamertemplate{subtitle}{
%  \raggedright%  % <-- Comment here
  \insertsubtitle%
  \par%
  \vspace*{0.5em}
}
\makeatother

\begin{document}
\begin{frame}
    \titlepage
\end{frame}
\end{document}

enter image description here

  • Thanks for your answer. May I know if there is a difference between \begin{frame} \centering \titlepage \end{frame} and just \maketitle? – Diaa Aug 29 '17 at 20:09
  • 1
    @DiaaAbidou The outcome is the same, if you use \maketitle outside a frame, it will insert \frame{\titlepage}. With \begin{frame} \titlepage \end{frame} you have more freedom to add things to the frame or do \begin{frame}[plain]. In the above code it has no deeper meaning, just a relict of some testing I did to find a suitable spot to add \centering :) – user36296 Aug 29 '17 at 20:22

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.