最小示例:
\begin{frame}
\newcommand \ovStepA 1
\newcommand \ovStepB 4
\newcommand \ovStepC 9
\newcommand \predOf[1] {%
% ???
}
\newcommand \succOf[1] {%
% ???
}
\only<-\predOf\ovStepB>{visible until step B (excluded)} % should expand to \only<-3>{...}
\only<\ovStepB->{visible from step B (included)}
\only<-\ovStepC>{visible up to step C (included)}
\only<\succOf\ovStepC->{visible after step C (excluded)} % should expand to \only<10->{...}
\end{frame}
覆盖规范是否有这样的语法(类似于 Git 如何让您引用HEAD
as的前身HEAD^
),或者如何拥有\predOf
和\succOf
运行一些基本算术?
答案1
您可以使用\inteval
(来自xfp
包):
\documentclass{beamer}
\usepackage{xfp}
\newcommand\predOf[1]{\inteval{#1-1}}
\newcommand\succOf[1]{\inteval{#1+1}}
\begin{document}
\begin{frame}
\newcommand\ovStepA{1}
\newcommand\ovStepB{4}
\newcommand\ovStepC{9}
\only<-\predOf{\ovStepB}>{visible until step B (excluded)}
\only<\ovStepB->{visible from step B (included)}
\only<-\ovStepC>{visible up to step C (included)}
\only<\succOf{\ovStepC}->{visible after step C (excluded)}
\end{frame}
\end{document}