3

I am using beamer to write a report, this is the beamer look like:

\documentclass{beamer}

\usetheme{Madrid}



\setbeamerfont{subtitle}{size=\fontsize{9pt}{14pt},series=\bfseries}

\title{Title}
\subtitle{sub title}
\author{jiangxiaoqiang}
\institute{CPU}

\begin{document}

\frame{\titlepage}

\begin{frame}[c]
\frametitle{Contents}
\tableofcontents
\end{frame}

\section{Demo}


\begin{frame}
\frametitle{Demo}

\end{frame}


\end{document}

Now I found the beamer content align to the left by default. And how to make the beamer contents align to center? I have tried to add c in the beamer define but seems did not work.

\begin{frame}[c]
\frametitle{Contents}
\tableofcontents
\end{frame}
4
  • Just wondering: The contents are itemized using bullets and/or numbers. Aren't they supposed to be left aligned (by the bullets)? Can you specify some specific use cases for center alignment?
    – codeR
    Commented Jun 15 at 14:10
  • I think the beamer content align to center maybe look more beautiful, I was wonder is it possible.
    – Dolphin
    Commented Jun 15 at 14:21
  • Please minimise your code before posting. Having custom images in your footline prevents other people from compiling your code and is really unnecessary for a question about tocs. Commented Jun 15 at 17:10
  • I have remove the unused picture import to make it smooth to compile.
    – Dolphin
    Commented Jun 16 at 4:56

2 Answers 2

4

You could redefine the section in toc template (but please note that if your sections have different lengths, the numbers will no longer nicely align like in an left aligned toc):

\documentclass{beamer}

\usetheme{Madrid}

\title{Title}
\subtitle{sub title}
\author{jiangxiaoqiang}
\institute{CPU}  

\makeatletter
\setbeamertemplate{section in toc}{%
  {%
    \normalsize%
    \begin{pgfpicture}{-1ex}{-0.7ex}{1ex}{1ex}
      \pgftext{\beamer@usesphere{section number projected}{tocsphere}}
      \pgftext{%
        \usebeamerfont*{section number projected}%
        \usebeamercolor{section number projected}%
        \color{fg!90!bg}%
        \inserttocsectionnumber}
    \end{pgfpicture}%
    \kern1.25ex}%
  \inserttocsection\par
}
\makeatother

\begin{document}

\begin{frame}[c]
\frametitle{Contents}
\centering
\tableofcontents
\end{frame}

\section{Demo}

\begin{frame}
\frametitle{Demo}
\end{frame}

\end{document}

enter image description here

3

You could put the \tableofcontent instruction inside a minipage environment of reduced width, and center this minipage: this way everything will be aligned, but centered.

\documentclass{beamer}
\usetheme{Madrid}
\setbeamerfont{subtitle}{size=\fontsize{9pt}{14pt},series=\bfseries}
\title{Title}\subtitle{sub title}
\author{jiangxiaoqiang}\institute{CPU}

\begin{document}

\frame{\titlepage}
\begin{frame}\center
\frametitle{Contents}
\begin{minipage}{.25\linewidth}\tableofcontents\end{minipage}
\end{frame}

\section{Demo}\begin{frame}\frametitle{Demo}\end{frame}
\subsection{SubDemo 1}\begin{frame}\frametitle{SubDemo 1}\end{frame}
\subsection{SubDemo 2}\begin{frame}\frametitle{SubDemo 2}\end{frame}

\end{document}

centered table of content

You must log in to answer this question.

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