Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: hook to decode overlay specifications #912

Open
jlaurens opened this issue Sep 28, 2024 · 5 comments
Open

Feature request: hook to decode overlay specifications #912

jlaurens opened this issue Sep 28, 2024 · 5 comments

Comments

@jlaurens
Copy link

Add some hook to patch overlay specifications management.

problem

Overlay specifications are absolute. Sometimes, one strongly prefers relative specifications.

For example, you can have 2 different tikz pictures that appear step by step in parallel, instead of one after the other. Step x of picture 1 may appear at the same time as step y of picture 2. Each time you add something new to be uncovered before the pictures, then you have to update both x and y.

Another example concerns sticky notes that appear above the text. Consider the situation where the note should be visible only when a sparse set of elements are uncovered. Each time elements are reordered, or new items are added, the sticky note specification should be updated accordingly.

My ugly solution

I currently have developed a package to add a layer over standard beamer overlay specifications. That works pretty well IMHO, but I had to hack \beamer@masterdecode to intercept the part between '<' and '>' and turn some extended syntax into normal beamer syntax.

The request

Add a hook in \beamer@masterdecode to allow some preflight management of its argument. Something like

  1. rename actual \beamer@masterdecode into \beamer@rawmasterdecode
  2. define \beamer@xtdmasterdecode to be something like
\def\beamer@xtdmasterdecode#1{
  \def\beamer@masterdecodearg{#1}
  \UseHookWithArguments{beamer/masterdecode/N}{1}{\beamer@masterdecodearg}
  \exp_args:NV \beamer@rawmasterdecode \beamer@masterdecodearg
}

Some switch to activate/deactivate this feature

\def\beamerxtdspecon{\def\beamer@masterdecode{\beamer@xtdmasterdecode}}
\def\beamerxtdspecoff{\def\beamer@masterdecode{\beamer@rawmasterdecode}}

and start with \beamerxtdspecoff

@samcarter
Copy link
Collaborator

samcarter commented Sep 28, 2024

To better understand the problem, can you add some example code of something which isn't already possible with the existing relative overlay specifications?

@josephwright
Copy link
Owner

I'm with @samcarter here - beamer has been around for ~20 years with the current relative specs, so we need a clear example of something that doesn't work

@jlaurens
Copy link
Author

jlaurens commented Sep 29, 2024

Never said that there is something that does not work or is not possible, I only said that I made some kind of improvement based on some awful hack and that hooks can avoid that hack. In short, I am looking for some plugin architecture and hooks seem a good starting point.
In next example, we want the "n+1", "n+2" and "n+3" in the tikzpicture be exactly the "n+1", "n+2" and "n+3" of the itemize environment. AFAIK, actual beamer relative overlay specifications strongly depend on what are the "...".

\documentclass{beamer}
\RequirePackage{tikz}
\begin{document}
\begin{frame}
...
\begin{itemize}
\item<n+1-> A
\item<n+2-> B
\item<n+3-> C
\end{itemize}
...
\begin{tikzpicture}
\visible<n+1->{\node at (0,0) {A};}
\visible<n+2->{\node at (0,1) {B};}
\visible<n+3->{\node at (1,0) {C};}
\end{tikzpicture}
\end{frame}
\end{document}

@samcarter
Copy link
Collaborator

You could use https://tex.stackexchange.com/a/50493/36296 to label the overlays

@jlaurens
Copy link
Author

No problem I will stick to the hack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants