summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/abspos/demo.tex
blob: ba2b7ab867440d95f1df8c2dffaef56722df3ceb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
\documentclass{beamer}
\usefonttheme{serif}
\beamertemplatenavigationsymbolsempty

\usepackage{xcoffins}
\usepackage{abspos}
\usepackage{ragged2e}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{newfile}

\newoutputstream{io}

\ExplSyntaxOn

\cs_generate_variant:Nn \tl_replace_all:Nnn { Nxx }

\NewDocumentCommand \ExampleFrame { m +v } {

    \tl_set:Nn \l_tmpa_tl {#2}
    \tl_replace_all:Nxx \l_tmpa_tl { \iow_char:N \^^M } { \iow_char:N \^^J }
    \regex_replace_once:nnN { ^\v* } { } \l_tmpa_tl

    \openoutputfile{demo#1.tex}{io}
    \addtostream{io}{\l_tmpa_tl}
    \closeoutputstream{io}

    \frame{\input{demo#1}}

}

\ExplSyntaxOff

\begin{document}

\ExampleFrame{1}{
% In preamble:
% \usepackage{tikz}
\absput{\tikz{
    \draw[line width=8pt, lightgray] circle[radius=3.25];
}}
\absput[angle=10, scale=5]{Hello!}
\absput[pg-b, y=.5cm]{\thepage}
}

\ExampleFrame{2}{
% In preamble:
% \usepackage{ragged2e}
% \usepackage{lipsum}
\absput[width=8cm]{
    \justifying
    \lipsum[1][1-5] % Example text
}
}

\ExampleFrame{3}{
\absposset{scale=5}
\absput{Scaled!}
}

\begin{frame}
\NewCoffin \MyCoffin
\SetHorizontalCoffin \MyCoffin {My Coffin}
\absputcoffin[scale=2] \MyCoffin
\end{frame}

\end{document}