Beamer TOC: セクション番号を右揃えにする

Beamer TOC: セクション番号を右揃えにする

私は、ビーマーの目次の各セクションをセクション番号とともに表示するために、大文字のローマ数字 (I、II、...) を使用しようとしています。次の MWE は全体的には機能しますが、ローマ数字、つまりセクション タイトルが揃っていないことがわかります。代わりに、ローマ数字は左揃えで、セクション番号とタイトルの間の距離は固定されているため、ローマ数字の幅に応じてセクションが右に移動します。

[この MWE の作成中、問題をよりわかりやすくするために、2 番目のセクションに番号 25 を付けたいと考えました。これは、XXV が I よりも (II と比較して) はるかに広いためです。ただし、セクション カウンターを 24 に設定し、thesectionフレーム タイトルで正しく 25 に設定されているにもかかわらず、inserttocsectionnumberTOC のコマンドは2ではなく のみを生成します25。この問題の解決策、つまり TOC が独自のカウントではなく実際のセクション番号を取得するように強制する解決策があればよいと思います。]

\documentclass[t, sansserif, onlymath, 10pt]{beamer}%\mode<handout>

\makeatletter
\defbeamertemplate{section in toc}{sections numbered roman}{%
  \@Roman\inserttocsectionnumber.\ %
  \inserttocsection\par}
  \renewcommand*{\numberline}[1]{%
  \hb@xt@\@tempdima{\hfil#1 }%
}
\makeatother

\begin{document}

\setbeamertemplate{section in toc}[sections numbered roman]
\setbeamerfont{section in toc}{size=\normalsize, family = \sffamily}
\setbeamerfont{section in toc}{shape = \normalfont}

\begin{frame}
  \frametitle{Overview}
  \tableofcontents[currentsection]
\end{frame}
\section{section one}
\begin{frame}
  \frametitle{xxx1 \thesection}
\end{frame}

\setcounter{section}{24}

\section{section two/twenty-five}
\begin{frame}
  \frametitle{xxx2 \thesection}
\end{frame}

\setbeamercovered{transparent}
\begin{frame}
\frametitle{{Agenda}}   
\begin{enumerate}[I.]
\item <1|handout: 1> { Overview} \\
\vspace{0.9cm}
\item <0|handout: 1> {sec1}\\
\vspace{0.9cm}
\item <0|handout: 1> {sec 2: }\\
\end{enumerate}
\end{frame}

\end{document}

最後のスライドを含めると、私が望む結果がほぼ得られます (実際、これが私の目的ですが、自動化が必要です)。"enumerate" パッケージを使用すると、"列挙" が右揃えになり、セクション タイトルも右揃えになることがわかります。

文書の序文では、コード

  \defbeamertemplate{section in toc}{sections numbered roman}{%
  \@Roman\inserttocsectionnumber.\ %
  \inserttocsection\par}

ローマ数字を使用し、セクションタイトルの前にセクション番号を挿入します。

  \renewcommand*{\numberline}[1]{%
  \hb@xt@\@tempdima{\hfil#1 }%
  }

から取得したコマンドを使用して数字を右揃えにしようとします目次の数字を右揃えにする ただし、これはむしろセクションとサブセクション間の相対的な配置に関するものであり、上記の抜粋したコードではうまくいきません。

答え1

簡単な回避策:

ローマ数字を固定幅のボックス内に配置する

\documentclass[t, sansserif, onlymath, 10pt]{beamer}%\mode<handout>

\makeatletter
\defbeamertemplate{section in toc}{sections numbered roman}{%
  \makebox[0.8cm]{\hfill\@Roman\inserttocsectionnumber.}\space%
  \inserttocsection\par
}
\makeatother

\begin{document}

\setbeamertemplate{section in toc}[sections numbered roman]

\begin{frame}
  \frametitle{Overview}
  \tableofcontents
\end{frame}

\section{section one}
\begin{frame}
  \frametitle{xxx1 \thesection}
\end{frame}

\makeatletter
\beamer@tocsectionnumber=24
\makeatother

\section{section two/twenty-five}
\begin{frame}
  \frametitle{xxx2 \thesection}
\end{frame}

\end{document}

ここに画像の説明を入力してください

関連情報