如何在覆盖规范中提及覆盖的前身/后继?

如何在覆盖规范中提及覆盖的前身/后继?

最小示例:

\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 如何让您引用HEADas的前身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}

在此处输入图片描述

相关内容