I want to use \onslide<2-> with verbatim environment inside in beamer, e.g.:


This does not work due to overlays and verbatim conflicts... I found out that there is a onlyenv environment that fixes the issue for \only but I cannot find anything for \onslide.

Is there some equivalent to onlyenv for onslide?

| improve this question | | | | |
  • Do you try to add to frame option fragile: \begin{frame}[fragile]? – Zarko Jul 28 '19 at 14:46

According to, e.g., this answer: Uncover lstlisting on a particular slide using \onslide or \uncover, there is no such equivalent, and I also could not find any. You can user \onlyenv with an overlayarea environment to avoid jumps due to overlay animations. This however forces you to initially fix the dimensions of the animated area, which you don't have to when you're using \onslide...

I sometimes resort to creating overlays with external programs. My currently preferred solution is Inkscape + the TexText plugin + this script I developed which crates you several PDF from layer specifications and provides you with a snippet to include in your LaTeX file. Sometimes it's just nice to have a graphical editor, even when you like to use LaTeX.

| improve this answer | | | | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.