Debian Codegraph @

texmf-dist/doc/latex/stex/packages/stex-notesslides.tex

raw
1 \begin{sfragment}{Introduction}
2 The \pkg{notesslides} document class is derived from |beamer.cls|~\cite{beamerclass:on},
3 it adds a ``notes version'' for course notes that is more suited to printing than the one
4 supplied by |beamer.cls|.
5
6 The \pkg{notesslides} class takes the notion of a slide frame from Till Tantau's excellent
7 \pkg{beamer} class and adapts its notion of frames for use in the \sTeX and \OMDoc. To
8 support semantic course notes, it extends the notion of mixing frames and explanatory
9 text, but rather than treating the frames as images (or integrating their contents into
10 the flowing text), the \pkg{notesslides} package displays the slides as such in the course
11 notes to give students a visual anchor into the slide presentation in the course (and to
12 distinguish the different writing styles in slides and course notes).
13
14 In practice we want to generate two documents from the same source: the slides for
15 presentation in the lecture and the course notes as a narrative document for home
16 study. To achieve this, the \pkg{notesslides} class has two modes: \emph{slides mode} and
17 \emph{notes mode} which are determined by the package option.
18 \end{sfragment}
19
20 \begin{sfragment}{Package Options}
21 The \pkg{notesslides} class takes a variety of class options:
22
23 \begin{variable}{slides,notes} The options |slides| and |notes| switch between slides
24 mode and notes mode (see \sref{sec:user:notesslides}).
25 \end{variable}
26
27 \begin{variable}{sectocframes} If the option |sectocframes| is given, then for the
28 |sfragment|s, special frames with the |sfragment| title (and number) are generated.
29 \end{variable}
30
31 \begin{variable}{frameimages,fiboxed}
32 If the option |frameimages| is set, then slide mode also shows the
33 |\frameimage|-generated frames (see \sref{sec:user:frameimage}). If also the |fiboxed|
34 option is given, the slides are surrounded by a box.
35 \end{variable}
36 \end{sfragment}
37
38 \begin{sfragment}[id=sec:user:notesslides]{Notes and Slides}
39
40 \begin{environment}{frame}
41 Slides are represented with the |frame| environment just like in the \pkg{beamer} class,
42 see~\cite{Tantau:ugbc} for details.
43 \end{environment}
44
45 \begin{environment}{note}
46 The \pkg{notesslides} class adds the |note| environment for encapsulating the course
47 note fragments.
48 \end{environment}
49
50 \begin{dangerbox}
51 Note that it is essential to start and end the |notes| environment at the start of the
52 line -- in particular, there may not be leading blanks -- else {\LaTeX} becomes confused
53 and throws error messages that are difficult to decipher.
54 \end{dangerbox}
55
56 By interleaving the |frame| and |note| environments, we can build course notes as shown
57 here:
58
59 \begin{stexcode}
60 \ifnotes\maketitle\else
61 \frame[noframenumbering]\maketitle\fi
62
63 \begin{note}
64 We start this course with ...
65 \end{note}
66
67 \begin{frame}
68 \frametitle{The first slide}
69 ...
70 \end{frame}
71 \begin{note}
72 ... and more explanatory text
73 \end{note}
74
75 \begin{frame}
76 \frametitle{The second slide}
77 ...
78 \end{frame}
79 ...
80 \end{stexcode}
81
82 \begin{function}{\ifnotes}
83 Note the use of the |\ifnotes| conditional, which allows different treatment between
84 |notes| and |slides| mode -- manually setting |\notestrue| or |\notesfalse| is strongly
85 discouraged however.
86 \end{function}
87
88 \begin{dangerbox}
89 We need to give the title frame the |noframenumbering| option so that the frame
90 numbering is kept in sync between the slides and the course notes.
91 \end{dangerbox}
92
93 \begin{dangerbox}
94 The \pkg{beamer} class recommends not to use the |allowframebreaks| option on frames
95 (even though it is very convenient). This holds even more in the |notesslides| case: At
96 least in conjunction with |\newpage|, frame numbering behaves funnily (we have tried to
97 fix this, but who knows).
98 \end{dangerbox}
99 \end{sfragment}
100
101 \begin{function}{\inputref*}
102 If we want to transclude a the contents of a file as a note, we can use a new variant
103 |\inputref*| of the |\inputref| macro: |\inputref*{foo}| is equivalent to
104 |\begin{note}\inputref{foo}\end{note}|.
105 \end{function}
106
107 \begin{environment}{nparagraph, nparagraph, ndefinition, nexample, nsproof, nassertion}
108 There are some environments that tend to occur at the top-level of |note|
109 environments. We make convenience versions of these: e.g. the |nparagraph| environment
110 is just an |sparagraph| inside a |note| environment (but looks nicer in the source,
111 since it avoids one level of source indenting). Similarly, we have the |nfragment|,
112 |ndefinition|, |nexample|, |nsproof|, and |nassertion| environments.
113 \end{environment}
114
115 \begin{sfragment}{Customizing Header and Footer Lines}
116 The \pkg{notesslides} package and class comes with a simple default theme named
117 \pkg{sTeX} that provided by the \pkg{beamterthemesTeX}. It is assumed as the default
118 theme for \sTeX-based notes and slides.
119 The result in |notes| mode (which is like the |slides| version except that the slide
120 hight is variable) is
121
122 \includegraphics[width=.95\textwidth]{\stexdocpath/../lib/img/notes-frame}
123
124 The footer line can be customized. In particular the logos.
125
126 \begin{function} {\setslidelogo}
127 The default logo provided by the \pkg{notesslides} package is the {\sTeX} logo it can be
128 customized using |\setslidelogo{|\meta{logo name}|}|.
129 \end{function}
130
131 \begin{function}{\setsource}
132 The default footer line of the \pkg{notesslides} package mentions copyright and
133 licensing. In \pkg{notesslides} |\source| stores the author's name as the copyright
134 holder. By default it is the author's name as defined in the |\author| macro in the
135 preamble. |\setsource{|\meta{name}|}| can change the writer's name.
136 \end{function}
137
138 \begin{function}{\setlicensing}
139 For licensing, we use the Creative Commons Attribuition-ShareAlike license by default to
140 strengthen the public domain. If package |hyperref| is loaded, then we can attach a
141 hyperlink to the license logo. |\setlicensing[|\meta{url}|]{|\meta{logo name}|}| is used
142 for customization, where \meta{url} is optional.
143 \end{function}
144 \end{sfragment}
145
146 \begin{sfragment}[id=sec:user:frameimages]{Frame Images}
147 Sometimes, we want to integrate slides as images after all -- e.g. because we already
148 have a PowerPoint presentation, to which we want to add \sTeX notes.
149
150 \begin{function}{\frameimage,\mhframeimage}
151 In this case we can use |\frameimage[|\meta{opt}|]{|\meta{path}|}|, where \meta{opt} are
152 the options of |\includegraphics| from the \pkg{graphicx} package~\cite{CarRah:tpp99}
153 and \meta{path} is the file path (extension can be left off like in
154 |\includegraphics|). We have added the |label| key that allows to give a frame label
155 that can be referenced like a regular |beamer| frame.
156
157 The |\mhframeimage| macro is a variant of |\frameimage| with repository support. Instead
158 of writing
159 \begin{stexcode}
160 \frameimage{\MathHub{fooMH/bar/source/baz/foobar}}
161 \end{stexcode}
162 we can simply write (assuming that |\MathHub| is defined as above)
163 \begin{stexcode}
164 \mhframeimage[fooMH/bar]{baz/foobar}
165 \end{stexcode}
166 Note that the |\mhframeimage| form is more semantic, which allows more advanced document
167 management features in \textsf{MathHub}.
168 \end{function}
169
170 If |baz/foobar| is the ``current module'', i.e. if we are on the \textsf{MathHub} path
171 \ldots|MathHub/fooMH/bar|\ldots, then stating the repository in the first optional
172 argument is redundant, so we can just use
173 \begin{stexcode}
174 \mhframeimage{baz/foobar}
175 \end{stexcode}
176 \end{sfragment}
177
178 \begin{function}{\textwarning}
179 The |\textwarning| macro generates a warning sign: \textwarning
180 \end{function}
181
182
183 \begin{sfragment}{Ending Documents Prematurely}
184 \begin{function}{\prematurestop,\afterprematurestop}
185 For prematurely stopping the formatting of a document, \sTeX provides the
186 |\prematurestop| macro. It can be used everywhere in a document and ignores all input
187 after that -- backing out of the |sfragment| environments as needed. After that -- and
188 before the implicit |\end{document}| it calls the internal |\afterprematurestop|, which
189 can be customized to do additional cleanup or e.g. print the bibliography.
190
191 |\prematurestop| is useful when one has a driver file, e.g. for a course taught multiple
192 years and wants to generate course notes up to the current point in the lecture. Instead
193 of commenting out the remaining parts, one can just move the |\prematurestop| macro.
194 This is especially useful, if we need the rest of the file for processing, e.g. to
195 generate a theory graph of the whole course with the already-covered parts marked up as
196 an overview over the progress; see |import_graph.py| from the |lmhtools|
197 utilities~\cite{lmhtools:github:on}.
198 \end{function}
199
200 Text fragments and modules can be made more re-usable by the use of global variables. For
201 instance, the admin section of a course can be made course-independent (and therefore
202 re-usable) by using variables (actually token registers) |courseAcronym| and |courseTitle|
203 instead of the text itself. The variables can then be set in the \sTeX preamble of the
204 course notes file.
205 \end{sfragment}
206
207
208 \begin{sfragment}{Global Document Variables}
209 To make document fragments more reusable, we sometimes want to make the content depend
210 on the context. We use \defemph{document variables} for that.
211
212 \begin{function}{\setSGvar,\useSGvar}
213 |\setSGvar{|\meta{vname}|}{|\meta{text}|}| to set the global variable \meta{vname} to
214 \meta{text} and |\useSGvar{|\meta{vname}|}| to reference it.
215 \end{function}
216
217 \begin{function}{\ifSGvar}
218 With|\ifSGvar| we can test for the contents of a global variable: the macro call
219 |\ifSGvar{|\meta{vname}|}{|\meta{val}|}{|\meta{ctext}|}| tests the content of the global
220 variable \meta{vname}, only if (after expansion) it is equal to \meta{val}, the
221 conditional text \meta{ctext} is formatted.
222 \end{function}
223 \end{sfragment}
224
225 \begin{sfragment}[id=sec:user:excursions]{Excursions}
226 In course notes, we sometimes want to point to an ``excursion'' -- material that is either
227 presupposed or tangential to the course at the moment -- e.g. in an appendix. The typical
228 setup is the following:
229
230 \begin{stexcode}
231 \excursion{founif}{../fragments/founif.en}
232 {We will cover first-order unification in}
233 ...
234 \begin{appendix}\printexcursions\end{appendix}
235 \end{stexcode}
236
237 It generates a paragraph that references the excursion whose source is in the file
238 |../fragments/founif.en.tex| and automatically books the file for the |\printexcursions|
239 command that is used here to put it into the appendix. We will look at the mechanics now.
240
241 \begin{function}{\excursion}
242 The |\excursion{|\meta{ref}|}{|\meta{path}|}{|\meta{text}|}| is syntactic sugar for
243
244 \begin{stexcode}
245 \begin{nparagraph}[title=Excursion]
246 \activateexcursion{founif}{../ex/founif}
247 We will cover first-order unification in \sref{founif}.
248 \end{nparagraph}
249 \end{stexcode}
250 \end{function}
251
252 \begin{function}{\activateexcursion,\printexcursion,\excursionref}
253 Here |\activateexcursion{|\meta{path}|}| augments the |\printexcursions| macro by a call
254 |\inputref{|\meta{path}|}|. In this way, the |\printexcursions| macro (usually in the
255 appendix) will collect up all excursions that are specified in the main text.
256
257 Sometimes, we want to reference -- in an excursion -- part of another. We can use
258 |\excursionref{|\meta{label}|}| for that.
259 \end{function}
260
261 \begin{function}{\excursiongroup}
262 Finally, we usually want to put the excursions into an |sfragment| environment and add
263 an introduction, therefore we provide the a variant of the |\printexcursions| macro:
264 |\excursiongroup[id=|\meta{id}|,intro=|\meta{path}|]| is equivalent to
265 \begin{stexcode}
266 \begin{note}
267 \begin{sfragment}[id=<id>]{Excursions}
268 \inputref{<path>}
269 \printexcursions
270 \end{sfragment}
271 \end{note}
272 \end{stexcode}
273 \end{function}
274 \end{sfragment}
275
276 \begin{dangerbox}
277 When option |book| which uses |\pagestyle{headings}| is given and semantic macros are
278 given in the |sfragment| titles, then they sometimes are not defined by the time the
279 heading is formatted. Need to look into how the headings are made. This is a problem of
280 the underlying \pkg{document-structure} package.
281 \end{dangerbox}
282
283 %%% Local Variables:
284 %%% mode: latex
285 %%% TeX-master: "../stex-manual"
286 %%% End: