3

I'm doing a presentation on beamer. I have two author names. I want them centered and display on separate lines. Also I want the date to be on lower part centered. Currently all of them are left aligned. How can I do this?

This is my code:

\documentclass[12pt]{beamer}
\usepackage[utf8]{inputenc}
\usetheme{metropolis}
\usecolortheme{beaver}


\title[About Beamer]{Graph Representation Techniques}
\author{Author A \and Author B }
\vspace{3pt}
\date{\today}

\begin{document}

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

\end{document}

enter image description here

1

2 Answers 2

5

Another approach would be to alter the definition of the title page. This can not only be used to centre the authors but also the space before the title can easily be adjusted to fit your needs.

\documentclass[12pt]{beamer}
\usepackage[utf8]{inputenc}
\usetheme{metropolis}
\usecolortheme{beaver}


\title[About Beamer]{Graph Representation Techniques}
\author[Author A and Author B]{Author A\\ Author B }
\date{\today}

\setbeamertemplate{title page}{
  \begin{minipage}[b][\paperheight]{\textwidth}
    \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}
    \centering % NEW
    \ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
    \vspace*{3pt} % NEW
    \ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
    \ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
    \vfill
    \vspace*{1mm}
  \end{minipage}
}

\setbeamertemplate{title}{
%  \raggedright%
    \centering
  \linespread{1.0}%
  \inserttitle%
  \par%
  \vspace*{0.5em}
}

\begin{document}

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

\end{document}
7
  • How can I center the title as well ?
    – Robur_131
    Jul 15, 2018 at 10:27
  • 1
    @Robur_131 move the line \centering % NEW 3 lines up before the title Jul 15, 2018 at 11:09
  • I assume that you have the latest version of the beamer document class (2018/02/20 v3.50) installed on your system. The OP, in contrast, is working with the 2017/01/23 v3.41 version, because that's what ShareLaTeX provides. Is there any way to ascertain if your solution method works with this older version of beamer?
    – Mico
    Jul 15, 2018 at 11:17
  • @Mico I just tested with 3.41 and my solution still works. Unfortunately yours fails because the old beamer version does not like the \centering in the author field. Jul 15, 2018 at 11:26
  • @Mico ! Argument of \beamer@stripands has an extra }. <inserted text> \par l.7 \author{\centering Author A \\ Author B} Jul 15, 2018 at 11:29
3

I suggest you replace

\author{Author A \and Author B }
\vspace{3pt}
\date{\today}

with

\author{\centering Author A \\ Author B}
\vspace{3pt}
\date{\centering\today}

Just out of idle curiosity: Why don't you want the title centered as well? Having the title left-aligned, but the authors and date centered, looks a bit odd.


A full MWE (minimum working example):

enter image description here

\documentclass[12pt]{beamer}
%\usepackage[utf8]{inputenc} % that's the default nowadays
\usetheme{metropolis}
\usecolortheme{beaver}

\title[About Beamer]{Graph Representation Techniques}
\author{\centering Author A \\ Author B}
\vspace{3pt}
\date{\centering\today}

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

Addendum: To center the title string as well, I suggest you change

\title[About Beamer]{Graph Representation Techniques}

to

\title[About Beamer]{\hspace{\fill}Graph Representation Techniques\hspace*{\fill}}

Note that this works for title strings that fit on one line. I trust this isn't much of a constraint in practice: Titles of beamer presentations always "work" best if they're short -- the shorter, the better!

The resulting title page (document compiled with XeLaTeX) looks like this:

enter image description here

7
  • Can you edit your answer and add how to center the title as well? Also, running this code on sharelatex produces some errors. Is it normal? Image link: imgur.com/a/qKNvvS7
    – Robur_131
    Jul 15, 2018 at 10:25
  • @Robur_131 - I'll edit my answer to show how to center the title as well. About the error messages: Did you compile the sample document under either XeLaTeX or LuaLaTeX? The reason I ask is that the metropolis theme says that it wants to be compiled under either XeLaTeX or LuaLaTeX.
    – Mico
    Jul 15, 2018 at 10:33
  • Currently the compiler is showing pdfLatex.
    – Robur_131
    Jul 15, 2018 at 10:37
  • @Robur_131 - Did you notice the following warning message in the log file, if the document is compiled under pdflatex: "Package beamerthememetropolis Warning: You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts on input line 95." I guess one can use the metropolis theme with pdflatex, but one won't get the Fira fonts for which this theme was designed.
    – Mico
    Jul 15, 2018 at 10:40
  • 1
    @Robur_131 - Wow, that's positively ancient, by software standards. Any chance you can find a more up-to-date system to compile your document?
    – Mico
    Jul 15, 2018 at 11:00

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.