beamer
beamer copied to clipboard
overlay specification range by length
\only<a-b>{bla bla bla}
displays text from slide a to slide b
The range is specified from the start to the end.
The range could also be specified from its starting point and its length such that for example
\only<a--n>{bla bla bla}
would be equivalent to \only<a-(a+n-1)>{bla bla bla}
That's \only<a-(n)>
New feature I guess since it is not available in beamer 2021/05/26 v3.63
@jlaurens It is available since version 0.92 from 2004, but you need a +, e.g. \only<2-+(2)>{f}
See section "9.6.4 Incremental Specifications" of the user guide for more information

It does not work because '+(...)' has side effects.
Next document creates 6 frames instead of 4
\documentclass{beamer}
\begin{document}
\begin{frame}
\insertslidenumber\\
\only<2-+(1)>{Should be from 2 to 2}
\only<2-+(2)>{Should be from 2 to 3}
\only<2-+(3)>{Should be from 2 to 4}
\end{frame}
\end{document}
\documentclass{beamer}
\begin{document}
\begin{frame}
\Huge
\insertslidenumber
\only<2>{Should be from 2 to 2}
\only<+(1)-+(2)>{Should be from 2 to 3}
\only<+(0)-+(2)>{Should be from 2 to 4}
\end{frame}
\end{document}
That is not what I am asking for. Given a slide number a and a positive number n, I want some material to be displayed only from slide number a to slide number a+n-1.
This is useful in 2 different situations at least.
Actually, one is using for example \only<10-13>{From 10 to 13}
- when we insert a slide before, we must change 10 to 11 and 13 to 14
- when 10 is the result of a macro, then 13 must also be the result of a macro.
If we would have something like \only<10--4>{From 10 to 13}
- when we insert a slide before, we must only change 10 to 11
- when 10 is the result of a macro, then 13 is automatically computed
Another syntax proposal.
Something like '\only<10-*(4)> {bla bla bla}' could mean "display bla bla bla 4 times starting at slide 10".
\only< -*(4)>{}
could mean "display bla bla bla 4 times starting at slide \beamerpauses".
@jlaurens You don't want a +
in there: beamer
interprets that as 'step and include the current frame number'. So for example
\only<4-.(4)>
for frames 4, 5, 6, 7, not
\only<4-+(4)>
(which will be off in frames 44, 45, 46, 47)
https://www.texdev.net/2014/01/17/the-beamer-slide-overlay-concept/
As I said the +
syntax does not work, unfortunately, the .
syntax does not work either.
\documentclass{beamer}
\begin{document}
\begin{frame}
\insertslidenumber\\
\begin{itemize}
\item<+(1)-> This is on the second and all following slides
\item<+(1)-> This is on the third and all following slides
\item<+-> This is also on the third and all following slides
\end{itemize}
\only<1-2>{On slides 1, 2 GOOD\\}
\only<1-.(2)>{On slides 1, 2 BAD\\}
\end{frame}
\end{document}
The text "On slides 1, 2 GOOD" appears on slides 1 and 2 as expected whereas the text "On slides 1, 2 BAD" appears on all the slides. The ...(...)
overlay syntax seems to rely on the value of the beamerpause
counter which is not what I am asking for.
Your example is mixing explicit and +
/.
syntax, which is always 'interesting'. You've stepped the counter three times, so you'd need .(-2)
in the example. I'd therefore go for
\documentclass{beamer}
\begin{document}
\begin{frame}
\insertslidenumber\\
\begin{itemize}
\item<+(1)-> This is on the second and all following slides
\item<+(1)-> This is on the third and all following slides
\item<+-> This is also on the third and all following slides
\end{itemize}
\only<1-.2>{On slides 1, 2 GOOD\\}
\only<.(-2)-.(-1)>{On slides 1, 2 BAD\\}
\end{frame}
\end{document}
This does not work.
Given a
and n
two positive integers, the question is to replace the syntax <a-b>
where b==a+n-1
by a unique syntax that only depends on a
and n
.
It does not work because '+(...)' has side effects.
True but you can replace the second two + by . to avoid over-incrementing the counter, then I think it does what you want however more directly I guess you want
\documentclass{beamer}
\begin{document}
\begin{frame}
\insertslidenumber\\
\only<2-\the\numexpr2+0\relax>{Should be from 2 to 2}
\only<2-\the\numexpr2+1\relax>{Should be from 2 to 3}
\only<2-\the\numexpr2+2\relax>{Should be from 2 to 4}
\end{frame}
\end{document}
which explicitly is <2-n>
with n being 0 1 and 2
@davidcarlisle I cannot use the dot either. What I want is something like
\only<2-:(1)>{Should be from 2 to 2}
\only<2-:(2)>{Should be from 2 to 3}
\only<2-:(3)>{Should be from 2 to 4}
In each overlay specification above, the start of the range appears exactly once, as well as the length.
In the beamer overlay specification parser,
-
<first>-:(<length>)
is replaced by< first >-<last>
where<last> == <first>+<length>-1
- when
:(<length>)
does not follow a dash, or no number is before the dash, then:(n)
could act exactly like.(n)
.