LaTeX semiverbatim and fancyvrb

I am creating a presentation using the LaTex pool package. Beamer comes with an environment called "semiverbatim" which is similar to "verbatim" but allows commands to be placed within the environment. This is useful in the control panel to control how the frame overlays unfold. For example:

\begin{frame}[fragile, shrink]
  \frametitle{Some Code Sample}
\begin{semiverbatim}
private String foobar() \{
    String s = "val"
    \alert<2->{s = null};}
    return s;
\}
\end{semiverbatim}
\end{frame}

      

This will cause the third line to turn red in the second frame transition step.

This is all well and good, but the semiverbatim environment, as well as the verbatim environment, is rather limited. I would like to use the "Verbatim" environment from the fancyvrb package.

Anyway, use "Verbatim" the same way as "semiverbatim" is used?

+2


source to share


2 answers


I'm not very lucky, I'm afraid. I can get it to \alert

work fine, but only without the overlay specification:

\ documentclass {beamer}
\ usepackage {fancyvrb}
\ begin {document}
\ begin {frame} [fragile]
\ frametitle {Some Code Sample}
\ begin {Verbatim} [commandchars = {\\ []}]
private String foobar () {
    String s = "val"
    \ alert [s = null];}
    return s;
}
\ end {Verbatim}
\ end {frame}
\ end {document}


It \alert<2->

breaks when I try and changing the code <

and code >

doesn't seem to help.

+2


source


Not sure if it helps you directly, but when I loaded the source into the ray slider I used the package list, lstset and lstlisting environment. I never use any openings in the code, so I haven't tested this interaction.



0


source







All Articles