1

I'm using minted to highlight some code. With the escapeinside I can add custom LaTeX code. For example:

\begin{minted}[escapeinside=||]{py}
def f(x):
    y = x|\colorbox{green}{**}|2
    return y
\end{minted}

now I'd like to add an efect to the beamer frame:

  • show the code without the colorbox
  • advance the presentation
  • show the code with the colorbox

that would be a typical beamer transition modifier like <2->.

Trying to merge both features I tried:

...
y = x|<2->\colorbox{green}{**}|2
...

but it didn't worked: the <2-> was rendered as it.

Is it possible to add some effects like <2-> or \pause or equivalent inside a minted environment?

5
  • 1
    You can help us to help you by providing the code for a small document that shows your problem. Just edit your question and add the code. Feb 14 '17 at 0:09
  • Does the \colorbox{green} work? If yes you could simply use a custom colour and redefine it from white to green between the overlay. Feb 14 '17 at 0:11
  • @samcarter, the \colorbox{} works. The text is rendered highlighted and the ** is enclosed in a green box.
    – mmoya
    Feb 14 '17 at 10:02
  • Can you make your code compilabale? This would be a great staring point. Feb 14 '17 at 10:08
  • I filled a request in GH, check the suggestion there.
    – mmoya
    Mar 2 '17 at 8:21
1

Instead of trying to bring overlays into minted, maybe redefining the colour between the overlays could be enough:

\documentclass{beamer}

\definecolor{mycolor}{rgb}{1,1,1}

\begin{document}

\begin{frame}<1-2>
    \only<2>{\definecolor{mycolor}{rgb}{0,1,0}}
    \colorbox{mycolor}{test}
\end{frame} 

\end{document}

enter image description here

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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