# How to indent long frametitle (beamer)?

I have (sub)section numbers in the \frametitle, and I want an indentation if the frame title is too long to fit in one line (similar to default LaTeX behavior). I fiddeled around with adding \hangindent=3em to the \frametitle argument but this does not help.

Example:

\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{1.1 A long frametitle that produces a linebreak line line line line line}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.

\end{frame}
\end{document}


The desired outcome would be something like:

1.1 A long frametitle that produces a linebreak
line line line line line


1.1 A long frametitle that produces a linebreak
line line line line line


Background: The whole \frametitle command with (sub)section number and actual (sub)section heading is generated by the following command:

\newcommand{\frametitledef}{\frametitle{
\ifnum\value{subsection}=0
\thesection{} \insertsection{}
\else
\ifnum\value{subsubsection}=0
\thesection{}.\thesubsection{} \insertsubsection{}
\else
\thesection{}.\thesubsection{}.\thesubsubsection{} \insertsubsubsection{}
\fi
\fi
}}

-
Do you want to indent the second line? How do you insert the section number. Maybe a simple \llap{} should solve the problem. –  Marco Daniel Mar 9 '12 at 15:25
I don't know if I understood your question corrcetly; perhaps you want something like this \frametitle{\parbox[t]{.9\paperwidth}{\hangindent=1.6em\raggedright 1.1 A long frametitle that produces a linebreak line line line line line}}? –  Gonzalo Medina Mar 9 '12 at 16:22
Thank you for your remarks. @MarcoDaniel: In the actual presentation, the section numbers are generated via a command. If you are interested, I could post it. I tried with \llap{}, but could not solve the problem. @GonzaloMedina: Yes, you have understood correctly. Furthermore, it really does what I wanted. However, this still needs some manual tuning. –  JonasK Mar 9 '12 at 16:50
@JonasK: I think I now understand, please see my answer below. –  Gonzalo Medina Mar 9 '12 at 22:18

Perhaps something like this is what you are looking for:

\documentclass{beamer}

\newcommand{\frametitledef}{\frametitle{%
\ifnum\value{subsection}=0
\parbox[t]{1em}{\thesection}%
\parbox[t]{\dimexpr0.9\paperwidth-1em\relax}{\insertsection}%
\else
\ifnum\value{subsubsection}=0
\parbox[t]{2em}{\thesection.\thesubsection}%
\parbox[t]{\dimexpr0.9\paperwidth-2em\relax}{\insertsubsection}%
\else
\parbox[t]{3em}{\thesection.\thesubsection.\thesubsubsection}%
\parbox[t]{\dimexpr0.9\paperwidth-3em\relax}{\insertsubsubsection}%
\fi
\fi
}}

\begin{document}
\section{test}
\frame{test}

\subsection{A long frametitle that produces a linebreak line line line line line}

\begin{frame}
\frametitledef

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
\end{frame}

\end{document}


Here's an image of the second frame showing the indentation for the second line of the title:

-
Sorry for the late response, but this works perfectly. Thank you very much for your help! –  JonasK Mar 21 '12 at 9:05