Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\insertframetitle can't be used inside \MakeUppercase if there is a framebreak. #802

Closed
u-fischer opened this issue Oct 20, 2022 · 12 comments

Comments

@u-fischer
Copy link

The definition of \insertframetitle tries to call a template if a framebreak is detected, and this breaks in \MakeUppercase.

! Argument of \XC@col@rlet has an extra }.
<inserted text> 
                \par 
l.158 \end{frame}

Perhaps the definition could be made more safe by protecting the template with a \CaseSwitch?

\documentclass{beamer}
\makeatletter
\long\def\beamer@@frametitle[#1]#2{%
  \ifblank{#2}{}{%
    \gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space
     \CaseSwitch
       {\usebeamertemplate*{frametitle continuation}}
       {\usebeamertemplate*{frametitle continuation}}
       {\usebeamertemplate*{frametitle continuation}}
       {\usebeamertemplate*{frametitle continuation}}%
      \fi}}%
  \gdef\beamer@frametitle{#2}%
  \gdef\beamer@shortframetitle{#1}%
}%
}
\makeatother

\defbeamertemplate*{frametitle}{uppercase}{\MakeUppercase{\insertframetitle}}
\begin{document}

\begin{frame}[allowframebreaks]
\frametitle{Flussdiagramm}

aaaa

\framebreak

bbb

\end{frame}
\end{document}
@samcarter
Copy link
Collaborator

@u-fischer Thanks for reporting!

@samcarter samcarter reopened this Nov 23, 2022
@samcarter
Copy link
Collaborator

samcarter commented Nov 23, 2022

Reopening this issue for now as this would break the metropolis theme.

The proposed fix is stored in https://github.com/josephwright/beamer/tree/802-Uppercase-frametitle and a PR is opened for metropolis at matze/mtheme#391

@samcarter
Copy link
Collaborator

samcarter commented Nov 23, 2022

The Trigon theme suffers from the same problem. I left a heads-up issue at https://gitlab.com/thlamb/beamertheme-trigon/-/issues/7

Update: The author is informed and very helpfully agreed to prepare an update for when this goes live for beamer. Half of the problem solved :)

@samcarter
Copy link
Collaborator

@josephwright There seems to be no reaction from metropolis, so I was looking into your suggestion of doing some first aid via filehooks. My current approach is to revert back to the old definition before metropolis, let it patch whatever it wants and then overwrite the definition again at the end of the file. Is this what you had in mind or is there some better solution?

\documentclass{beamer}

\makeatletter
\AddToHook{file/beamerfontthememetropolis.sty/before}{%
  \renewcommand<>\frametitle{\alt#1{\@dblarg\beamer@@frametitle}{\beamer@gobbleoptional}}
  \long\def\beamer@@frametitle[#1]#2{%
    \ifblank{#2}{}{%
      \gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
    \gdef\beamer@frametitle{#2}%
    \gdef\beamer@shortframetitle{#1}%
  }%
  }
}

\AddToHook{file/beamerfontthememetropolis.sty/after}{%
  \renewcommand<>\frametitle{\alt#1{\@dblarg\beamer@@frametitle}{\beamer@gobbleoptional}}
  \long\def\beamer@@frametitle[#1]#2{%
    \ifblank{#2}{}{%
      \gdef\insertframetitle{{%
        \metropolis@frametitleformat{#2}%
        \ifnum\beamer@autobreakcount>0
          \relax{}\space%
          \beamer@insertframetitlecontinuation%
        \fi%
      }}%
    \gdef\beamer@frametitle{#2}%
    \gdef\beamer@shortframetitle{#1}%
    }%
  }
}
\makeatother

\usetheme{metropolis}

\begin{document}

\begin{frame}[allowframebreaks]
\frametitle{Flussdiagramm}

aaaa

\framebreak

bbb

\end{frame}
\end{document}
	
\end{document}

@josephwright
Copy link
Owner

@samcarter Looks good to me

@samcarter
Copy link
Collaborator

@josephwright Thanks! I'll merge the changes

@samcarter
Copy link
Collaborator

@josephwright Could you coordinate with @lambtho12 about the timing of the next release so that the trigon theme can be updated accordingly?

@lambtho12
Copy link

I will prepare the patch for Trigon sometime next week in a separate branch.
I subscribed to the RSS feed for beamer on CTAN so I will be notified directly when the update is available. I will then merge the patch and publish Trigon as well.

@lambtho12
Copy link

FYI, Trigon patch is ready. I will merge as soon as new version of beamer hits CTAN.

@samcarter
Copy link
Collaborator

@lambtho12 FYI: Joseph released beamer v3.69 2023-02-20 earlier today. It should currently make its way around the ctan mirrors and be available there within the next 24 hours or so.

@lambtho12
Copy link

Awesome. Thanks for the notif. I will package an publish Trigon this evening after work.

@lambtho12
Copy link

Just published fix on CTAN as well. Works as expected with latest Beamer.

Findus23 pushed a commit to Findus23/vienna-theme that referenced this issue Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants