我想更改此投影仪文档的编号:
\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
- 第三帧 2/2
我如何更改帧编号?
答案1
有一次,我想让观众在演讲时猜测帧号的顺序,但这个顺序不是随机的。同样的技巧在这里也适用。
正如你所做的那样,你需要更改模板footline
。你所拥有的帧编号由命令控制
\insertframenumber{} / \inserttotalframenumber
并且足以用类似的东西来代替它们
\ifcase\value{framenumber} \or \or 1/2 \or 2/2 \or \fi
这里,是一个 TeX 原语,其功能类似于 switch 语句,在遍历值时\ifcase
根据 的值执行不同的操作, --因此上面的代码跳过了和的值。这里,我已经根据您的问题硬连线了和 ,但您可能希望在这里使用 的变体。framenumber
0,1,2,3,...
\or \or
framenumber
0
1
1/2
2/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}