1

I use pandoc and custom lua filters to simplify the design of my beamer presentations. Here is an example of the pandoc Markdown I currently write:

# Frame title

::: incremental
## Block title

- [This is the first item]{target="to-some-where" onslide="<1->"}
- [This is the second item]{target="to-some-where-else" onslide="<2->"}
:::

and the LaTeX I currently generate:

\begin{frame}{Frame title}
  \begin{block}{Block title}
    \begin{itemize}[<+->]
      \item \hyperlink<1->{to-some-where}{This is the first item}
      \item \hyperlink<2->{to-some-where-else}{This is the second item}
    \end{itemize}
  \end{block}
\end{frame}

So far, so good, but instead of specifying the overlay (onslide="<1->"), which is tedious, error prone, and makes changes more difficult than what they should be, I'd like to refer to "the current overlay number". My pandoc Markdown would become:

# Frame title

::: incremental
## Block title

- [This is the first item]{target="to-some-where"}
- [This is the second item]{target="to-some-where-else"}
:::

I tried to add the following to my beamer template for pandoc:

\makeatletter
\newcommand{\overlaynumber}{\beamer@overlaynumber}
\makeatother

and to generate:

\item \hyperlink<\overlaynumber{}->{to-some-where-else}{This is the second item}

But the hyperlink is active on all slides, including those where the text is not yet visible.

Of course, I could use my lua filters to somehow count the list items and generate a static overlay specification but this has many drawbacks (I sometimes want to add hyperlinks to something else than a list item, some lists are passed the noincremental attribute, I can have several lists in the same slide, plus other elements...)

Is there a way to obtain this with pure TeX/LaTeX/beamer commands?

1
  • Welcome to TeX.SE!
    – Mensch
    Commented Aug 8, 2023 at 9:44

1 Answer 1

2

You can use relative overlays:

\documentclass{beamer}

\begin{document}
    
\begin{frame}{Frame title}
  \begin{block}{Block title}
    \begin{itemize}[<+->]
      \item \hyperlink<.->{to-some-where}{This is the first item}
      \item \hyperlink<.->{to-some-where-else}{This is the second item}
    \end{itemize}
  \end{block}
\end{frame}

    
\end{document}
2
  • Wonderful. I new these relative overlay specifications and already used them, how can I have missed that? Commented Aug 8, 2023 at 9:35
  • @RenaudPacalet You're welcome! Commented Aug 8, 2023 at 9:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .