1

I am preparing a lecture note in beamer. I want to make headings in the middle of the frame which should look like frametitle or framesubtitle boxes. In the following MWE, I am using a block to create it, but I want the block body to be empty. How do I achieve this?

\documentclass[aspectratio=169,10pt, notheorems]{beamer}
\usefonttheme{serif}
\usetheme{CambridgeUS}
\usepackage{xcolor}
\setbeamercolor{background canvas}{bg=black}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{structure}{fg=magenta}
\setbeamercolor{structure}{bg=black}

\begin{document}
    \begin{frame}{Frame title}{Frame subtitle}
        Proof of a theorem ends here. Title heading for the next section should appear in the following box.
        \begin{block}{This box should look like frame title box}
        \end{block}
        Title heading for the next subsection should appear in the following box.
        \begin{block}{This box should look like frame subtitle box}
        \end{block}
    \end{frame}
\end{document}

PS: This answer did not help.

0

You can lookup the definition by searching where your frametitle template gets defined. For the theme CambridgeUS you will find, that it uses beamerouterthemedefault.sty and hence you can borrow the definition of the beamercolorbox from there and strip it of everything that is only used in the special purpose of a frametitle. Then you can easily use it in your MWE like this:

\documentclass[aspectratio=169,10pt, notheorems]{beamer}
\usefonttheme{serif}
\usetheme{CambridgeUS}
\usepackage{xcolor}
\setbeamercolor{background canvas}{bg=black}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{structure}{fg=magenta}
\setbeamercolor{structure}{bg=black}

\begin{document}
\begin{frame}{Frame title}{Frame subtitle}
    Proof of a theorem ends here. Title heading for the next section should appear in the following box.

\begin{beamercolorbox}[sep=0.3cm,left,wd=\textwidth]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-1ex%
    \strut This box should look like frame title box \strut\par%
    {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}This box should look like frame subtitle box\strut\par}%
    \vskip-1ex%
\end{beamercolorbox}%
\end{frame}
\end{document}

which results in:

enter image description here


If you want a box of full paper width and with the text split in two parts, here we go:

\documentclass[aspectratio=169,10pt, notheorems]{beamer}
\usefonttheme{serif}
\usetheme{CambridgeUS}
\usepackage{xcolor}
\setbeamercolor{background canvas}{bg=black}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{structure}{fg=magenta}
\setbeamercolor{structure}{bg=black}

\begin{document}
\begin{frame}{Frame title}{Frame subtitle}
    Proof of a theorem ends here. Title heading for the next section should appear in the following box.

\begin{beamercolorbox}[sep=0.3cm,left,wd=\paperwidth]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-1ex%
    \strut This box should look like frame title box \strut\par%
    \vskip-1ex%
\end{beamercolorbox}%

\begin{beamercolorbox}[sep=0.3cm,left,wd=\paperwidth]{frametitle}
    {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}This box should look like frame subtitle box\strut\par}%
    \vskip-1ex%
\end{beamercolorbox}%
\end{frame}
\end{document}
2
  • Thank you for your help. A couple of issues here. The width of the box is not completely as the original one. I tried replacing \textwidth by \framewidth without a fruitful result. Secondly, I actually wanted separate boxes for frametitle and framesubtitle (in your answer framesubtitle box comes with frametitle always). Then learning from this answer I commented out \strut This box should look like frame title box \strut\par and that gives me my desired result. Sep 9 '20 at 15:54
  • @SubhajitPaul you are welcome, I added a modified code, can you check if this is what you anticipated?
    – TobiBS
    Sep 9 '20 at 20:58

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.