2

I'm using the Copenhagen template to create a beamer-style latex presentation. However, I am unable to break the section title line so that the entire text can be seen. I would like to know how I could solve this problem. Perhaps a solution would be to increase this bar in black and decrease the bar in green, however I don't know how to do that.enter image description here

2

The probably easiest way to prevent long section headings from being cut off is to use the optional argument of the section command in order to provide a shortened version of the section headings for the use in the header. The table of contents will still show the longer version of the section's heading.

enter image description here

\documentclass{beamer}
\usetheme{copenhagen}

\begin{document}
\section{section heading}
\section[shortened section heading]{a very very long heading that would get cut off inside of a narrower beamercolorbox}
\begin{frame}
contents
\end{frame}

\end{document}

If you insist on showing the full section title in the header while at the same time making sure, the black box does take up more than 50% of the frame's width, you may want to take a look at the following suggestion:

enter image description here

\documentclass{beamer}
\usetheme{copenhagen}

\makeatletter
\defbeamertemplate*{headline}{custom split theme}
{%
  \leavevmode%
  \@tempdimb=2.4375ex%
  \ifnum\beamer@subsectionmax<\beamer@sectionmax%
    \multiply\@tempdimb by\beamer@sectionmax%
  \else%
    \multiply\@tempdimb by\beamer@subsectionmax%
  \fi%
  \ifdim\@tempdimb>0pt%
    \advance\@tempdimb by 1.825ex%
    \begin{beamercolorbox}[wd=.75\paperwidth,ht=\@tempdimb]{section in head/foot}%
      \vbox to\@tempdimb{\vfil\insertsectionnavigation{.75\paperwidth}\vfil}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.25\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
    \end{beamercolorbox}%
  \fi%
}
\makeatother

\begin{document}
\section{section heading}
\section{a very very long heading that would get cut off inside of a narrower beamercolorbox}
\begin{frame}
contents
\end{frame}

\end{document}

Side note: Inside of the copenhagen theme, which internally uses the split outer theme, the left box in the header usually contains the section headings, while the right box contains subsection headings. Since I significantly reduced the width of the right box, it now no longer contains subsection headings.

1
  • 1
    Thank you for the answer! Would it be possible to insert a line break in a long title? Jun 13 at 19:10
3
+50

Here I do two things out of the ordinary. I create a placeholder \section to reserve a blank line. Then, I use a \Longstack to create the actual section title taking up two lines.

\documentclass{beamer}
\usepackage{stackengine}
\usetheme{copenhagen}
\setstackEOL{\\}
\begin{document}
\section{section heading}
\begin{frame}
contents section heading
\end{frame}
\section{~}% PLACEHOLDER
\section{\Longstack[r]{a very very long heading that would get cut off inside
  \\ of a narrower beamercolorbox}}
\begin{frame}
contents long title
\end{frame}
\section{Next}
\begin{frame}
contents Next
\end{frame}
\section{Last}
\begin{frame}
contents Last
\end{frame}
\end{document}

enter image description here

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.