影格編號

影格編號

我想更改此投影機文件的編號:

\documentclass[landscape,9pt]{beamer}                           % COMANDI INIZIALI
\usepackage[italian]{babel}                             % sillabazione italiana
\usepackage[utf8]{inputenc}                             % Per le lettere accentate IN UNIX E IN WINDOWS
\usepackage{ragged2e}                                   % giustifica
\usepackage{amsmath}                                    % Per allineare le equazioni
\usepackage{amssymb}                                    % Per le lettere dell'indicatrice (mathbb)
\usepackage{graphicx} 
\usepackage[export]{adjustbox}
\usepackage[misc,geometry]{ifsym}

\renewcommand{\fontsubfuzz}{1.1pt}                          % Elimina i warning inutili

\justifying                                         % giustifica

\usetheme{CambridgeUS}
\date{29 Aprile 2015}
\author{Gabriele Mazza}
\title{Regressione con regolarizzazioni differenziali per dati spazio-temporali, con applicazione all'analisi della produzione di rifiuti urbani nella provincia di Venezia}

\makeatletter
\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother
\setbeamercolor{date in head/foot}{use=frametitle, bg=frametitle.bg}
\setbeamercolor{subsection in head/foot}{use=framtitle, bg=frametitle.bg}

\begin{document}

\begin{frame}
Title
\end{frame}

\begin{frame}
Frame 1
\end{frame}

\begin{frame}
Frame 2
\end{frame}

\begin{frame}
Last Frame
\end{frame}

\end{document}

我想要的是:

  1. 第一幀和最後一幀沒有編號
  2. 第二幀中的 1/2
  3. 第三幀中的 2/2

如何更改影格編號?

答案1

曾幾何時,我希望有一些不那麼隨機的幀編號序列,供聽眾在我的演講中猜測。同樣的技巧在這裡也適用。

正如您所做的那樣,您需要更改footline模板。在你所擁有的幀數由指令控制

\insertframenumber{} / \inserttotalframenumber

用類似的東西替換它們就足夠了

\ifcase\value{framenumber} \or \or 1/2 \or 2/2 \or \fi

這裡,是一個 TeX 原語,其功能類似於 switch 狀態,在遍歷值時\ifcase根據 的值執行不同的操作, ——因此上面跳過和的值。在這裡,我已根據您的問題進行了硬連線,但您可能想使用此處的變體。framenumber0,1,2,3,...\or \orframenumber011/22/2\inserttotalframenumber

為了完整起見,這是您的完整範例:

\documentclass[landscape,9pt]{beamer}                           % COMANDI INIZIALI
\usepackage[italian]{babel}                             % sillabazione italiana
\usepackage[utf8]{inputenc}                             % Per le lettere accentate IN UNIX E IN WINDOWS
\usepackage{ragged2e}                                   % giustifica
\usepackage{amsmath}                                    % Per allineare le equazioni
\usepackage{amssymb}                                    % Per le lettere dell'indicatrice (mathbb)
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage[misc,geometry]{ifsym}

\renewcommand{\fontsubfuzz}{1.1pt}                          % Elimina i warning inutili

\justifying                                         % giustifica

\usetheme{CambridgeUS}
\date{29 Aprile 2015}
\author{Gabriele Mazza}
\title{Regressione con regolarizzazioni differenziali per dati spazio-temporali, con applicazione all'analisi della produzione di rifiuti urbani nella provincia di Venezia}

\makeatletter
\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \ifcase\value{framenumber} \or \or 1/2 \or 2/2 \or \fi\hspace*{2ex}
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother
\setbeamercolor{date in head/foot}{use=frametitle, bg=frametitle.bg}
\setbeamercolor{subsection in head/foot}{use=framtitle, bg=frametitle.bg}

\begin{document}

\begin{frame}
Title
\end{frame}

\begin{frame}
Frame 1
\end{frame}

\begin{frame}
Frame 2
\end{frame}

\begin{frame}
Last Frame
\end{frame}

\end{document}

編輯 實際上,要按照評論中的要求,使第一幀和最後一幀未編號,而其餘幻燈片從 1 開始向上編號,請將該footline段替換為以下內容:

\makeatletter
\usepackage{etoolbox}
\addtocounter{framenumber}{-1}
\newcounter{realtotalframenumber}
\setbeamertemplate{footline}
{
% strangely \inserttotalframenumber only appears to be defined here
\defcounter{realtotalframenumber}{\inserttotalframenumber-1}
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \ifnum\c@framenumber=0\relax
    \else
    \ifnumcomp{\value{framenumber}}>{\value{realtotalframenumber}}{\relax}
              {\arabic{framenumber}/\arabic{realtotalframenumber}}
    \fi
    \hspace*{2ex}
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother

答案2

這是使用計數器的更自動化的解決方案。

\documentclass[landscape,9pt]{beamer}                           % COMANDI INIZIALI
\usepackage[italian]{babel}                             % sillabazione italiana
\usepackage[utf8]{inputenc}                             % Per le lettere accentate IN UNIX E IN WINDOWS
\usepackage{ragged2e}                                   % giustifica
\usepackage{amsmath}                                    % Per allineare le equazioni
\usepackage{amssymb}                                    % Per le lettere dell'indicatrice (mathbb)
\usepackage{graphicx} 
\usepackage[export]{adjustbox}
\usepackage[misc,geometry]{ifsym}

\renewcommand{\fontsubfuzz}{1.1pt}                          % Elimina i warning inutili

\justifying                                         % giustifica

\usetheme{CambridgeUS}
\date{29 Aprile 2015}
\author{Gabriele Mazza}
\title{Regressione con regolarizzazioni differenziali per dati spazio-temporali, con applicazione all'analisi della produzione di rifiuti urbani nella provincia di Venezia}

\newcounter{aux}%
\newcounter{lastframe}%

\AtBeginDocument{%
  \setcounter{aux}{\number\value{lastframe}}
}%

\makeatletter
\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \ifnum\insertframenumber>0{%
    \ifnum\insertframenumber=\number\value{lastframe}{}%
    \phantom{\insertframenumber{} / \pgfmathparse{\inserttotalframenumber-1}\pgfmathprintnumber[precision=0]{\pgfmathresult}\hspace*{2ex}}%
    \else%
            {\insertframenumber{} / \pgfmathparse{\inserttotalframenumber-1}\pgfmathprintnumber[precision=0]{\pgfmathresult}\hspace*{2ex}}%
        \fi%
        }%
    \else%
    \phantom{\insertframenumber{} / \pgfmathparse{\inserttotalframenumber-1}\pgfmathprintnumber[precision=0]{\pgfmathresult}\hspace*{2ex}}%
    \fi%
  \end{beamercolorbox}}%
  \vskip0pt%
}

\newrobustcmd{\Lastframeinfile}{%
   \immediate\write\@auxout{\string
     \setcounter{lastframe}{\number\value{aux}}%
   }%
}%

\AtEndDocument{%
\setcounter{aux}{\number\value{framenumber}}
    \Lastframeinfile%
}%

\makeatother

\setbeamercolor{date in head/foot}{use=frametitle, bg=frametitle.bg}
\setbeamercolor{subsection in head/foot}{use=framtitle, bg=frametitle.bg}

\addtocounter{framenumber}{-1}


\begin{document}



\begin{frame}
Title
\end{frame}

\begin{frame}
Frame 1
\end{frame}

\begin{frame}
Frame 2
\end{frame}

\begin{frame}
Last Frame
\end{frame}

\end{document}

相關內容