0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Beamer で allowframebreaks フレームのタイトルに「何枚目/何枚中」を表示する

0
Last updated at Posted at 2026-03-10

Beamer でフレームに allowframebreaks を指定すると、フレームの内容が長いときにフレームを分割してくれます。このとき各フレームタイトルには「タイトルI」のように何枚目かを示すローマ数字が付きますが、そうではなく「タイトル (1/2)」「タイトル (2/2)」のように何枚中何枚目かを表示したいこともあると思います。→ 以下で可能です。

slide.tex
\documentclass[t,unicode,10pt]{beamer}

% ---------- フォント設定 ----------
\usepackage{zxjatype}  % 日本語を組版するために必要

% ---------- 分割フレームのタイトルに (何枚目/何枚中) を表示する設定 ----------
\makeatletter
\setbeamertemplate{frametitle continuation}{%
  (\insertcontinuationcount/%
  \number\numexpr\beamer@endpageofframe-\beamer@startpageofframe+1\relax)}
\makeatother

% ========== スライド内容 ==========
\begin{document}

\begin{frame}[allowframebreaks]{タイトル}
あああ \\ あああ \\ あああ \\ あああ \\ あああ \\
あああ \\ あああ \\ あああ \\ あああ \\ あああ \\
あああ \\ あああ \\ あああ \\ あああ \\ あああ \\
あああ \\ あああ \\ あああ \\ あああ \\ あああ \\
あああ \\ あああ \\ あああ \\ あああ \\ あああ \\
\end{frame}

\end{document}

ビルドすると以下のようになります。

image.png

設定内容の説明

  • \makeatletter ... \makeatother で @ を含む内部変数を参照できるようにします。
  • \setbeamertemplate{frametitle continuation}{...} で、タイトルに続く部分のテンプレートを上書きします。
  • \insertcontinuationcount に「何枚目」の数字があるので取得します。
  • \beamer@startpageofframe と \beamer@endpageofframe に分割されたフレームたちの開始ページと終了ページがあるので何枚になったかの計算式を書きます (終了 - 開始 + 1)。
  • 計算式を扱える \numexpr ... \relax で計算式を囲んで \number で文字列にします。

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?