0

I'm trying to hang indent my long frametitles and can't find a solution how to do it. I tried to use

\begin{frame}[fragile]{\hangindent=2cm Long Frametitle}

but that doesn't do anything. Any suggestions?

Thanks!

  • Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}. - Does How to indent long frametitle (beamer)? help you? – Bobyandbob Nov 13 '17 at 14:44
1

Dirty hack:

\documentclass{beamer}

\makeatletter
\setbeamertemplate{frametitle}{
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \hspace*{0.5cm}
  \begin{beamercolorbox}[sep=0.3cm,left,wd=\dimexpr\the\@tempdima-1cm\relax]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-1ex%
    \if@tempswa\else\csname beamer@fteleft\endcsname\fi%
    \strut\hskip-1cm\insertframetitle\strut\par%
    {%
      \ifx\insertframesubtitle\@empty%
      \else%
      {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
      \fi
    }%
    \vskip-1ex%
    \if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
  \end{beamercolorbox}%
}
\makeatother

\begin{document}

\begin{frame}
\frametitle{Long Frametitle that spans two lines and goes on and on and on and on and on}

\end{frame}


\end{document}
  • You might want to recalculate \textheight. – John Kormylo Nov 14 '17 at 15:18
  • @JohnKormylo Stupid question: why? The textheight is the same as for a multi-line frametitle without hanging indent. (not that the textheight makes sense in either of these cases, but this would be a job for beamer) – user36296 Nov 14 '17 at 15:24
  • I noticed that there wasn't enough room for \rule{\textwidth}{\textheight}, but there is never enough room if you include a title. It's just the beamer way. – John Kormylo Nov 14 '17 at 20:18
  • @JohnKormylo Yes, textheight is currently not very useful in beamer. Unfortunately it seems not so easy to fix this, as things like framezoom make it more complicate. – user36296 Nov 14 '17 at 20:27
  • Actually, I remember that the frame is composed BEFORE the title, so there is no way to communicate the title height to the frame body. \rule{\textwidth}{\dimexpr\textheight-\baselineskip-.666em} is the right size for a single line title. – John Kormylo Nov 15 '17 at 0:36
1

A somewhat less invasive solution:

\documentclass{beamer}

\newsavebox{\bigtitlebox}

\newcommand{\bigtitle}[1]% #1 = multiline frame title
{\bgroup
  \hsize=\dimexpr\paperwidth-.666em\relax
  \global\setbox\bigtitlebox=\vbox{\usebeamerfont{frametitle}%
    \strut#1\strut}%
\egroup
\frametitle{\usebox\bigtitlebox}}

\begin{document}

\begin{frame}
\bigtitle{\hangindent=2cm
Long Frametitle that spans two lines and goes on and on and on and on and on}
%\frametitle{Normal title}
\rule{\textwidth}{\dimexpr\textheight-\ht\bigtitlebox-\dp\bigtitlebox-.666em}
\end{frame}

\end{document}

demo

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.