1

I'm making a latex beamer with theme Metropolis. If a section name becomes long, it automatically add a line break to keep the length of the section title constant.

\section{Bayesian Estimation for Regression Models}

enter image description here

Or I could achieve a section with no line breaks by using mbox:

\section{\mbox{Bayesian Estimation for Regression Models}}

enter image description here

But as you guys can see, the title of the no-line-break section with mbox is right-aligned. Can you help me to center the title?

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Feb 2 at 5:16

1 Answer 1

1

A centred title would not fit in with all the other right aligned titles. Instead you could use https://topanswers.xyz/tex?q=1041 to increase the width of your section pages so all titles will fit:

\documentclass{beamer}

\usetheme{moloch}% modern fork of the metropolis theme

\makeatletter
\setbeamertemplate{section page}{
  \centering
  \begin{minipage}{\linewidth}
    \raggedright
    \usebeamercolor[fg]{section title}
    \usebeamerfont{section title}
    \insertsectionhead\\[-1ex]
    \usebeamertemplate*{progress bar in section page}
    \par
    \ifx\insertsubsectionhead\@empty\else%
      \usebeamercolor[fg]{subsection title}%
      \usebeamerfont{subsection title}%
      \insertsubsectionhead
    \fi
  \end{minipage}
  \par
  \vspace{\baselineskip}
}
\makeatother

\begin{document}

\section{Bayesian Estimation for Regression Models}


\begin{frame}
test
\end{frame} 

\end{document}

enter image description here

2

You must log in to answer this question.

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