如何缩进长框架标题(beamer)?

如何缩进长框架标题(beamer)?

我在 中有 (子) 节编号\frametitle,如果框架标题太长而无法放在一行中,我希望有一个缩进(类似于默认的 LaTeX 行为)。我尝试添加\hangindent=3em参数\frametitle,但这没有帮助。

例子:

\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}

期望的结果将是这样的:

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

背景:带有(子)节编号和实际(子)节标题的整个\frametitle命令由以下命令生成:

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

答案1

也许您正在寻找类似的东西:

\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}

这是第二帧的图像,显​​示了标题第二行的缩进:

在此处输入图片描述

相关内容