Код

Код

Я делаю презентацию с помощью проектора, и она довольно длинная. Она разделена на разделы, и в конце каждого раздела я буду делать перерыв. Следовательно, я хотел бы иметь двойной счетчик текущего слайда. Например: предположим, что я сейчас нахожусь на 3-м слайде раздела 2 (состоящего из 20 слайдов), а раздел 1 состоит из 50 слайдов, первый счетчик будет 3/20, а второй 53/70 (если разделов всего два).

Вот моя рабочая среда:

\documentclass[t,10pt,xcolor=dvipsnames]{beamer}
 \mode<presentation>
 {
 \usetheme{AnnArbor}
 \setbeamercovered{transparent}
\useinnertheme{rounded}
   \usecolortheme{spruce}
 }

  \setbeamercolor{section in head/foot}{fg=White}
\section{Sec1}
\subsection{Sub 1}
\begin{frame}{Fra 1}
\end{frame}
\begin{frame}{Fra 2}
\end{frame}
\begin{frame}{Fra 3}
\end{frame}
\section{Sec2}
\subsection{Sub 1}
\begin{frame}{Fra 1}
\end{frame}
\begin{frame}{Fra 2}
\end{frame}
\end{document}

Любая помощь?

решение1

Никаких новых счетчиков не нужно, просто немного вычислений. Beamer сохраняет номера страниц, где начинается и заканчивается раздел, в макросах \insertsectionstartpageи \insertsectionendpage. Таким образом, количество страниц в разделе можно вычислить с помощью

\insertsectionendpage-\insertsectionstartpage+1

Номер страницы в разделе:

\insertframenumber-\insertsectionstartpage+1

где \insertframenumberхранится номер страницы текущего кадра.

Исправьте их с помощью команды \patchcmdfrom package etoolboxв Beamer, которая вставляет нижнюю строку \beamer@@tmpl@footline, и у вас будет счетчик страниц раздела слева и общий счетчик страниц справа в нижней строке.

Код

\documentclass[t,10pt,xcolor=dvipsnames]{beamer}

\usepackage{etoolbox}

\mode<presentation>
{
  \usetheme{AnnArbor}
  \setbeamercovered{transparent}
  \useinnertheme{rounded}
  \usecolortheme{spruce}
}
\setbeamercolor{section in head/foot}{fg=White}

\makeatletter
% change author box alignment 
\patchcmd{\beamer@@tmpl@footline}% <cmd>
  {center}% <search>
  {left}% <replace>
  {}% <success>
  {}% <failure>

% add page to author box
\patchcmd{\beamer@@tmpl@footline}% <cmd>
  {\usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}}% <search>
  {\def\sectotpage{\number\numexpr\insertsectionendpage-\insertsectionstartpage+1}%
   \def\pageinsec{\number\numexpr\insertframenumber-\insertsectionstartpage+1}%
   \rlap{\hspace*{2ex}\pageinsec{} / \sectotpage} \hfill
  \usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}}% <replace>
  {}% <success>
  {}% <failure>
\makeatother

\author{Author}

\begin{document}
\newcommand\nf{\frame{Frame in Section~\thesection.}}

\section{Sec 1}
\nf\nf\nf\nf\nf

\section{Sec 2}
\nf\nf\nf\nf\nf\nf

\section{Sec 3}
\nf\nf\nf\nf\nf\nf\nf

\end{document}

Выход

введите описание изображения здесь

Связанный контент