I want to quickly wrap certain environments my cursor is within with text.
In my specific situation, I want to wrap the frame
environment with the text
\makeatletter
\gdef\beamer@currentmode{beamer}
\makeatother
and
\makeatletter
\gdef\beamer@currentmode{handout}
\makeatother
Here's a MWE to illustrate my situation:
1 \documentclass[handout]{beamer}
2
3 \begin{document}
4
5 \begin{frame}
6
7 \frametitle{Foo}
8
9 \begin{block}{First Block}<+->
10 Foo bar.
11 \end{block}
12
13 \begin{block}{Second Block}<+->
14 Foo bar.
15 \end{block}
16
17 \end{frame}
18
19 \makeatletter
20 \gdef\beamer@currentmode{beamer}
21 \makeatother
22 \begin{frame}
23
24 \frametitle{Bar}
25
26 \begin{block}{First Block}<+->
27 Foo \uncover<+->{bar.}
28 \end{block}
29
30 \begin{block}{Second Block}<+->
31 Spam \uncover<+->{eggs.}
32 \end{block}
33
34 \end{frame}
35 \makeatletter
36 \gdef\beamer@currentmode{handout}
37 \makeatother
38
39 \end{document}
If my cursor is anywhere between lines 5
and 17
, then issuing my desired command would produce:
1 \documentclass[handout]{beamer}
2
3 \begin{document}
4
5 \makeatletter
6 \gdef\beamer@currentmode{beamer}
7 \makeatother
8 \begin{frame}
9
10 \frametitle{Foo}
11
12 \begin{block}{First Block}<+->
13 Foo bar.
14 \end{block}
15
16 \begin{block}{Second Block}<+->
17 Foo bar.
18 \end{block}
19
20 \end{frame}
21 \makeatletter
22 \gdef\beamer@currentmode{handout}
23 \makeatother
24
25 \makeatletter
26 \gdef\beamer@currentmode{beamer}
27 \makeatother
28 \begin{frame}
29
30 \frametitle{Bar}
31
32 \begin{block}{First Block}<+->
33 Foo \uncover<+->{bar.}
34 \end{block}
35
36 \begin{block}{Second Block}<+->
37 Spam \uncover<+->{eggs.}
38 \end{block}
39
40 \end{frame}
41 \makeatletter
42 \gdef\beamer@currentmode{handout}
43 \makeatother
44
45 \end{document}
Ideally, this command would toggle the wrapping, so with the cursor anywhere between lines 19
and 37
in the original file would produce:
1 \documentclass[handout]{beamer}
2
3 \begin{document}
4
5 \begin{frame}
6
7 \frametitle{Foo}
8
9 \begin{block}{First Block}<+->
10 Foo bar.
11 \end{block}
12
13 \begin{block}{Second Block}<+->
14 Foo bar.
15 \end{block}
16
17 \end{frame}
18
19 \begin{frame}
20
21 \frametitle{Bar}
22
23 \begin{block}{First Block}<+->
24 Foo \uncover<+->{bar.}
25 \end{block}
26
27 \begin{block}{Second Block}<+->
28 Spam \uncover<+->{eggs.}
29 \end{block}
30
31 \end{frame}
32
33 \end{document}
Is this doable with the tools provided by AUCTeX?