在 Beamer 中悬挂缩进框架标题

在 Beamer 中悬挂缩进框架标题

我正在尝试挂起缩进我的长框架标题,但找不到解决方案。我尝试使用

\begin{frame}[易碎]{\hangindent=2cm 长 Frametitle}

但这没有任何作用。有什么建议吗?

谢谢!

答案1

肮脏的黑客:

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

答案2

一种侵入性较小的解决方案:

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

演示

相关内容