Debian Codegraph @

texmf-dist/source/latex/beamerappendixnote/beamerappendixnote.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2020 Christoph Semken <[email protected]>
4 % -------------------------------------------------------
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.3 or later is part of all distributions of LaTeX
14 % version 2005/12/01 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19 %
20 %
21 %<*driver>
22 \ProvidesFile{beamerappendixnote.dtx}
23 %</driver>
24 %<package> \ProvidesPackage{beamerappendixnote}
25 %<*package>
26 [2020/07/01 v1.2.0 backposition option]
27 %</package>
28 %<*driver>
29 \documentclass{l3doc}
30
31 %% Packages
32 % This package
33 \usepackage{beamerappendixnote}
34 % Unicode
35 \usepackage{fontspec,unicode-math}
36 % Auxiliary
37 \usepackage{listings,graphicx,xparse}
38
39 %% Layout
40 % Font
41 \setmainfont{TeX Gyre Pagella}
42 % Listings
43 \lstset{
44 basicstyle=\ttfamily,
45 columns=fullflexible,
46 keepspaces=true,
47 }
48 % Links
49 \hypersetup{colorlinks,citecolor=blue,linkcolor=blue,urlcolor=blue}
50
51 %% Definitions
52 \newcommand\fnurl[2]{\href{#1}{#2}\footnote{\url{#1}}}
53 \ExplSyntaxOn
54 \NewDocumentCommand{\example}{m m o}
55 {
56 \IfNoValueTF{#3}
57 {\lstinputlisting{example-#1.tex}}
58 {\lstinputlisting[linerange=#3]{example-#1.tex}}
59 \int_step_inline:nn {#2}
60 {
61 \includegraphics[page=##1,width=.49\linewidth]{example-#1.pdf}
62 \int_if_even:nT {##1} {\newline}
63 }
64 }
65 \ExplSyntaxOff
66
67 \begin{document}
68
69 \GetFileInfo{beamerappendixnote.dtx}
70
71 \title{The \pkg{beamerappendixnote} package}
72
73 \author{Christoph Semken%
74 \thanks{E-mail:
75 \href{mailto:[email protected]}
76 {[email protected]}%
77 }%
78 }
79
80 \date{\fileversion\ --- \filedate}
81
82 \maketitle
83
84 \begin{documentation}
85
86 \noindent Beamer appendix note introduces the \cs{appxnote} command, which puts the note's content on a separate beamer frame, shown by the command \cs{printappxnotes}. It also creates interactive buttons to move back and forth between the two frames.
87
88 \example{basic}{2}
89
90 \clearpage
91 \section{Installation}
92
93 The \pkg{beamerappendixnote} package is available on \fnurl{https://ctan.org/pkg/beamerappendixnote}{CTAN}. The easiest way to install it is through a package manager. For help, see the \fnurl{https://miktex.org/howto/miktex-console}{MiKTeX} or \fnurl{https://www.tug.org/texlive/doc/texlive-en/texlive-en.html\#x1-430005}{TeX Live} manual. To build \pkg{beamerappendixnote} from the source code, follow the instructions in the \verb|README.md| file.
94
95 \section{Usage}
96
97 \begin{function}{\appxnote}
98 \begin{syntax}
99 \cs{appxnote}\oarg{frameoptions}\marg{title}\marg{content}
100 \end{syntax}
101
102 Create a new appendix note. Inserts a \cs{beamergotobutton} to a frame that contains \meta{content}. The appendix frame is created using \cs{printappxnotes}. The button’s text and the title of the appendix frame are both set to \meta{title}. If you specify \meta{frameoptions}, these will be used when creating the beamer frame.
103 \end{function}
104
105 \begin{function}{\printappxnotes}
106 \begin{syntax}
107 \cs{printappxnotes}
108 \end{syntax}
109
110 Prints appendix notes in the order they are created using \cs{appxnote}. Has to be used after the last appendix note. Uses one frame per note. Inserts a \cs{beamerreturnbutton} button to the frame where \cs{appxnote} was called, followed by the content, separated by a \cs{vfill}.
111 \end{function}
112
113
114 \section{Advanced usage}
115
116 \subsection{Change the back button placement}
117
118 To move the back button from the body of the appendix notes into the frame title, load the \pkg{beamerappendixnote} package with the \lstinline{backposition=title} option.
119
120 \example{backtop}{2}[2-2]
121
122 \subsection{Multi-frame notes}
123
124 To create appendix notes spanning multiple frames, set \meta{frameoption} to \lstinline{allowframebreaks}. This works well with the \lstinline{backposition=title} package option, as it makes the back button visible on every frame.
125
126 \example{longnote}{4}
127
128
129
130 \end{documentation}
131
132
133 %\begin{implementation}
134 % \section{Implementation}
135 % \DocInput{beamerappendixnote.dtx}
136 %\end{implementation}
137
138
139 \end{document}
140 %</driver>
141 % \fi
142 % \iffalse
143 %<*package>
144 %<@@=ban>
145 % \fi
146 %
147 % \subsection{Dependencies}
148 %
149 % \begin{macrocode}
150 \RequirePackage{expl3}
151 % \end{macrocode}
152 %
153 % \begin{macrocode}
154 \@ifpackagelater {expl3}{2018/04/22} {} {%
155 \PackageError {beamerappendixnote} {Support package expl3 too old}
156 {%
157 You need to update your installation of the bundles 'l3kernel' and
158 'l3packages'.\MessageBreak
159 Loading~beamerappendixnote~will~abort!%
160 }%
161 \endinput
162 }%
163 % \end{macrocode}
164 %
165 % Identify the package and give the over all version information
166 % \begin{macrocode}
167 \ProvidesExplPackage {beamerappendixnote} {2020/07/01} {1.2.0}
168 {Create notes in appendix frames}
169 % \end{macrocode}
170 %
171 % User level interfaces are all created by \pkg{xparse}.
172 % \begin{macrocode}
173 \RequirePackage{xparse}
174 \RequirePackage{l3keys2e}
175 % \end{macrocode}
176 %
177 % \subsection{Package options}
178 % \begin{macrocode}
179 \keys_define:nn { beamerappendixnote }
180 {
181 backposition .choices:nn = { top, bottom, title } { },
182 backposition .tl_set:N = \g_ban_backposition
183 }
184 \keys_set:nn { beamerappendixnote }
185 {
186 backposition = top
187 }
188 \ProcessKeysOptions { beamerappendixnote }
189 % \end{macrocode}
190 %
191 % \subsection{Data structures}
192 %
193 % Initialise sequences used to store notes
194 % \begin{macrocode}
195 \seq_new:N \g_ban_titles
196 \seq_new:N \g_ban_content
197 \seq_new:N \g_ban_options
198 \cs_generate_variant:Nn \tl_if_eq:nnT { V }
199 % \end{macrocode}
200 %
201 % \subsection{Macros}
202 % \begin{macro}{\appxnote}
203 % Create a new appendix note (store values) and insert a button
204 % Note: using \cs{newcommand} because \cs{NewDocumentCommand} does not support
205 % multiple paragraphs
206 % \begin{macrocode}
207 \newcommand{\appxnote}[3][t]{
208 \seq_gput_right:Nn \g_ban_titles {#2}
209 \seq_gput_right:Nn \g_ban_options {#1}
210 \seq_gput_right:Nn \g_ban_content {#3}
211 \hyperlink{ban-\seq_count:N \g_ban_titles}{\beamergotobutton{#2}}%
212 \label{ban-back-\seq_count:N \g_ban_titles}
213 }
214 % \end{macrocode}
215 % \end{macro}
216 %
217 % \begin{macro}{\@@_print_func:n}
218 % Print an appendix note
219 % Args: title, content, label, back label, options
220 % \begin{macrocode}
221 \cs_set:Npn \print_func:nnnnn #1 #2 #3 #4 #5 {
222 \def\options{#5}
223 \begin{frame}[\expandafter\options]
224 {
225 \tl_if_eq:VnT \g_ban_backposition { title }
226 {
227 \hyperlink{#4}{\beamerreturnbutton{Back}}~
228 }
229 #1
230 }
231 \label{#3}
232
233 \tl_if_eq:VnT \g_ban_backposition { top }
234 {
235 \hyperlink{#4}{\beamerreturnbutton{Back}}
236 \vfill
237 }
238
239 #2
240 \end{frame}
241 }
242 % Get title, content, label, back label and options
243 % Arg: id
244 % \begin{macrocode}
245 \cs_set:Npn \expand_func:n #1 {
246 \print_func:nnnnn {\seq_item:Nn \g_ban_titles {#1}}
247 {\seq_item:Nn \g_ban_content {#1}}
248 {ban-#1}
249 {ban-back-#1}
250 {\seq_item:Nn \g_ban_options {#1}}
251 }
252 % \end{macrocode}
253 % \end{macro}
254 %
255 % \begin{macro}{\printappxnotes}
256 % Print all appendix notes
257 % \begin{macrocode}
258 \NewDocumentCommand{\printappxnotes}{}{
259 \int_step_function:nN {\seq_count:N \g_ban_titles} \expand_func:n
260 }
261 % \end{macrocode}
262 % \end{macro}
263 %
264 % \iffalse
265 %</package>
266 % \fi