LaTeX 半逐字和 fancyvrb
我正在使用 beamer LaTex 包创建演示文稿。投影仪 带有一个名为“semiverbatim”的环境,就像 “逐字”,但允许您在环境中放置命令。 这在投影仪中非常有用,可以控制帧的叠加方式 展开。例如:
\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}
这将导致第三行在第二阶段显示为红色 帧过渡。
这一切都很好,然而,“半逐字”的环境, 就像“逐字记录”环境一样,非常有限。我想 使用 fancyvrb 包中的“Verbatim”环境。
无论如何,是否可以像“半逐字”一样使用“逐字” 用过的?
I'm creating a presentation using the beamer LaTex package. Beamer
comes with an environment called "semiverbatim" which is like
"verbatim", but allows you to place commands inside the environment.
This is useful in beamer to control how the overlays of a frame
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 appear red in the second stage of
the frame transition.
This is all good and fine, however, the "semiverbatim" environment,
much like the "verbatim" environment, is pretty limited. I would like
to use the "Verbatim" environment from the fancyvrb package.
Is there anyway to use "Verbatim" in the same way "semiverbatim" is
used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
恐怕我运气不太好。我可以让
\alert
正常工作,但只有没有覆盖规范:当您尝试
\alert<2->
时,它会中断,并且更改<
和>
的 catcode 似乎没有帮助。I'm not having much luck, I'm afraid. I can get the
\alert
to work okay, but only without an overlay specification:When you try
\alert<2->
it breaks, and changing catcodes of<
and>
doesn't seem to help.不确定它是否可以直接帮助您,但是当我将源代码加载到投影仪幻灯片中时,我使用了列表包、lstset 和 lstlisting 环境。不过,我从未在代码中使用任何揭示,因此我还没有测试这种交互。
Not sure if it helps you directly, but when I've loaded source into a beamer slide, I used the listings package, lstset, and the lstlisting environment. I never use any reveals in the code, though, so I haven't tested that interaction.