matze / mtheme

A modern LaTeX Beamer theme
6.44k stars 845 forks source link

titleformat not working correctly for section titles #371

Open rnhmjoj opened 4 years ago

rnhmjoj commented 4 years ago

Issue description

The option titleformat=allcaps or titleformat section=allcaps doesn't seem to affect the format of section titles, while frame titles, the main title, etc. works.

I have tried either passing these options to the \usetheme or by \metroset.

Trying to reproduce

Minimal code to reproduce the issue

\documentclass{beamer}

\usetheme[titleformat=allcaps]{metropolis}
\begin{document}
\section{Introduction}
\begin{frame}{Metropolis}
\end{frame}
\end{document}

Software tried:

Additional notes

Strangely titleformat=smallcaps do work for section titles, but not titleformat=allsmallcaps.

venkatasg commented 4 years ago

What exactly is the output for the minimal code, and what is it that you want it to produce?

If you want allsmallcaps, you need to ensure that your section text is all lowercase as well. For example, {Introduction} in your MWE should be {introduction} if you want it to be displayed all small caps. Not sure if this is a bug, because the frame titles don't have this issue.

rnhmjoj commented 4 years ago

What exactly is the output for the minimal code, and what is it that you want it to produce?

The output is "Introduction", while I expected "INTRODUCTION"

If you want allsmallcaps, you need to ensure that your section text is all lowercase as well.

Ok, I didn't know this but I'm only interested in the allcaps format.

nzeh commented 3 years ago

I just ran into this, too. I thinkered around a little bit, using the simple introductory example provided in the README. It seems that \metropolis@sectiontitleformat (which is in charge of implementing the conversion to all caps) is completely ignored. I tested this by manually overriding this command to add a prefix to every section title, and nothing happened.

I suspect that the problem may be the surgery that this theme does with the \beamer@section command. This used \patchcmd, which does simple pattern search and replacement in the definition of the command to be patched. If the definition of \beamer@section has changed in the Beamer class, then the pattern the Metropolis theme looks for may not exist. However, the log shows no error that patching failed, so I'm still a bit baffled.

jwettig commented 1 year ago

This is an old issue, but I also ran into it. You can redefine the beamer template for the section page in your preamble:

\makeatletter
\defbeamertemplate{section page}{newprogressbarsectionpage}{
    \centering
    \begin{minipage}{22em}
        \raggedright
        \usebeamercolor[fg]{section title}
        \usebeamerfont{section title}
        \MakeUppercase\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
\setbeamertemplate{section page}[newprogressbarsectionpage]

I just inserted \MakeUppercase in front of \insertsectionhead. For allsmallcaps I think you have to use \MakeLowercase and \scshape.

rnhmjoj commented 1 year ago

Yeah, that's what I have been doing. There is a growing pile of small issues like this one that are not getting fixed. Someone should probably just fork this project as it seems entirely unmaintained. It's sad because metropolis is basically the only well-designed beamer theme.