Beamer フレームタイトル: 複数行のタイトルの間隔を広げる

Beamer フレームタイトル: 複数行のタイトルの間隔を広げる

私はカスタムビーマーテーマで、複数行を占める長いフレームタイトルに問題があります。その場合、タイトルは上方向にスライドしますが、スペースを下方向に使用したいです。 短いタイトルでも問題ない 長いタイトルはタイトル上部のスペースを使用します

どちらの場合も同じ間隔を維持したいのですが、どのような選択肢がありますか?

  • \frametitle[long]{longFrameTitle}より大きな間隔でオプションを定義できますか?
  • タイトルが n 文字より長い場合に自動的に間隔を増やす if ステートメントを記述できますか?
  • と呼ばれるものを定義できますか\longframetitle?

  • 長いタイトルの各フレームに手動でスペースを挿入できますか?

問題は数フレームだけなので、最も簡単な解決策を探しています。

これまで試してみたがうまくいかなかったこと:

\setbeamertemplate{frametitle}{%
\begin{beamercolorbox}[

    wd=\paperwidth,
    leftskip=1cm,
    rightskip=1cm,
    ht=5ex,dp=1.5ex
]{frame title}%
    \usebeamerfont{frame title}\insertframetitle%
\end{beamercolorbox}%
}

\setbeamertemplate{longframetitle}{%
\begin{beamercolorbox}[
    sep=-7cm,
    wd=\paperwidth,
    leftskip=1cm,
    rightskip=1cm,
    ht=5ex,dp=1.5ex
    ]{frame title}%
    \usebeamerfont{frame title}\insertframetitle%
\end{beamercolorbox}%
}

答え1

非常に効果的と思われる解決策は、次のマクロを使用することです。

\newcommand{\longframetitle}[2]{\frametitle{\tikz[inner xsep=0pt,baseline]{\node[anchor=base west] (titlePos) {\phantom{short fittitius title}};
\node[anchor=base west,text width=#1 ex] at (titlePos.base west) {#2};
}}}%\longframetitle{lenght of the line of the multiline title in ex}{title}

あなたの具体的なケースでは:

\documentclass[11pt]{beamer}
\usetheme{leipzig}
\begin{document}
\title{short Title}

\newcommand{\longframetitle}[2]{\frametitle{\tikz[inner xsep=0pt,baseline]{\node[anchor=base west] (titlePos) {\phantom{short fittitius title}};
\node[anchor=base west,text width=#1 ex] at (titlePos.base west) {#2};
}}}%\longframetitle{lenght in ex}{title} 

\begin{frame}
    \frametitle{short Title}
\end{frame}

\begin{frame}
\longframetitle{50}{Looooooooooooooooooong Title which\\[-2pt] occupies multiple lines}

\end{frame}

\end{document}

2行の長いフレームタイトル

関連情報