| 1 |
%% talkdoc -- (talkdoc.tex) documentation |
| 2 |
%% The documentation for the talk class |
| 3 |
%% Author: Martin Wiebusch |
| 4 |
%% |
| 5 |
%% This file may be distributed and/or modified under the |
| 6 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 7 |
%% of this license or (at your option) any later version. |
| 8 |
%% The latest version of this license is in |
| 9 |
%% http://www.latex-project.org/lppl.txt |
| 10 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 11 |
%% version 2003/12/01 or later. |
| 12 |
|
| 13 |
\documentclass[12pt]{ltxdoc} |
| 14 |
\usepackage[small,bf]{caption} |
| 15 |
\usepackage{mdwtab}\setlength{\doublerulesep}{0pt} |
| 16 |
|
| 17 |
\addtolength{\oddsidemargin}{0.5in} |
| 18 |
|
| 19 |
\newcommand{\ccmd}[1]{\texttt{\symbol{`\\}\symbol{`@}#1}} |
| 20 |
|
| 21 |
\newcommand{\mref}[2]{\textsl{#1\space\ref{#2}}} |
| 22 |
\newcommand{\mrefs}[1]{\textsl{#1}} |
| 23 |
|
| 24 |
\newcommand{\pkg}[1]{\textsf{#1}} |
| 25 |
\newcommand{\var}[1]{\textrm{$\langle$\textit{#1}$\rangle$}} |
| 26 |
\newcommand{\txt}[1]{\textrm{#1}} |
| 27 |
|
| 28 |
\setlength{\parskip}{\medskipamount} |
| 29 |
|
| 30 |
\renewenvironment{quote}{\list{}{\leftmargin\parindent}\item[]}{\endlist} |
| 31 |
|
| 32 |
\newcommand{\lastupdated}{31 August 2025} |
| 33 |
\title{The \pkg{talk} Document Class\thanks{This file has version number 2.0, |
| 34 |
last revised \lastupdated}} |
| 35 |
\author{Martin Wiebusch} |
| 36 |
|
| 37 |
\sloppy |
| 38 |
|
| 39 |
\begin{document} |
| 40 |
\maketitle |
| 41 |
\begin{abstract} |
| 42 |
The \pkg{talk} document class allows you to create slides for screen |
| 43 |
presentations or printing on transparencies. It also allows you to print |
| 44 |
personal notes for your talk. You can create overlays and display structure |
| 45 |
information (current section / subsection, table of contents) on your slides. |
| 46 |
The main feature that distinguishes \pkg{talk} from other presentation |
| 47 |
classes like \pkg{beamer}, \pkg{prosper} or \pkg{powerdot} is that it allows |
| 48 |
the user to define an arbitrary number of \emph{layouts} and switch between |
| 49 |
these layouts from slide to slide. For examle, the default layout of the |
| 50 |
\pkg{talk-sidebars} style shows a (navigatable) table of contents in a bar on |
| 51 |
the right side of each slide, but it also provides a |nosidebar| layout |
| 52 |
where the sidebar is removed to make space for more content. This way you can |
| 53 |
present information in different formats but still maintain a consistent |
| 54 |
design throughout your presentation. |
| 55 |
|
| 56 |
The \pkg{talk} class makes no restrictions on the slide design whatsoever. |
| 57 |
The entire look and feel of the presentation can be defined by the user. The |
| 58 |
style definitions should be put in a separate sty file. Currently the package |
| 59 |
comes with two pre-defined slide styles: |talk-simple.sty| and |
| 60 |
|talk-sidebars.sty|. The former is a simple design for short talks while |
| 61 |
the latter is better for longer seminars with content structured into |
| 62 |
sections and subsections. Customising your presentation style is easy and |
| 63 |
|talk-simple.sty| contains lots of comments to guide you through the |
| 64 |
process. |
| 65 |
\end{abstract} |
| 66 |
\newpage |
| 67 |
\tableofcontents |
| 68 |
% |
| 69 |
% |
| 70 |
% |
| 71 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 72 |
\section{Installation and Requirements} |
| 73 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 74 |
% |
| 75 |
% |
| 76 |
The \pkg{talk} class requires the packages \pkg{environ}, \pkg{pgf} version |
| 77 |
1.18 or above, \pkg{graphicx}, \pkg{xstring} and \pkg{multido}. The |
| 78 |
|talk-sidebars| style additionally requires \pkg{hyperref}. They can all be |
| 79 |
obtained from |
| 80 |
\begin{quote} |
| 81 |
|http://www.ctan.org|. |
| 82 |
\end{quote} |
| 83 |
|
| 84 |
To install the \pkg{talk} class, you have to copy the files |talk.cls|, |
| 85 |
|talk-simple.sty| and |talk-sidebars.sty| to a place where \LaTeX\ can find |
| 86 |
them. |
| 87 |
% |
| 88 |
% |
| 89 |
% |
| 90 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 91 |
\section{Using \pkg{talk}} |
| 92 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 93 |
% |
| 94 |
% |
| 95 |
When using \pkg{talk} the visual `look and feel' of your presentation is |
| 96 |
determined by \emph{style package} which is separate from the core |talk| |
| 97 |
document class. Currently \pkg{talk} comes with two such packages called |
| 98 |
|talk-simple.sty| and |talk-sidebars.sty|. The former is a simple design for |
| 99 |
short talks while the latter is better for longer seminars with content |
| 100 |
structured into sections and subsections. |
| 101 |
|
| 102 |
To see the two built-in style packages in action take a look at the example |
| 103 |
files |simple-example.tex| and |sidebars-example.tex|. This will give you a |
| 104 |
good idea of how to use \pkg{talk} in practice. You may notice that the two tex |
| 105 |
files are actually quite similar. This is not accidental. The \pkg{talk} |
| 106 |
package defines a common interface so that, when writing your presentation, you |
| 107 |
can focus on content and do not have to worry about presentation. The visual |
| 108 |
aspects of the presentation are defined in the style file. One of the |
| 109 |
distinguishing features of \pkg{talk} is that style packages can define an |
| 110 |
arbitrary number of \emph{layouts}. The idea is that the layouts provided by a |
| 111 |
style package have consistent design but cater for slightly different types of |
| 112 |
content. For example, you may want a different layout for the slide where you |
| 113 |
show an outline of your talk, but it should still have the same colour scheme |
| 114 |
and fonts as the regular slides. |
| 115 |
|
| 116 |
As a \pkg{talk} user you are strongly encouraged to create your own styles by |
| 117 |
modifying one of the built-in style files. The file |talk-simple.sty| is a good |
| 118 |
starting point. It contains lots of comments and tips on how to customise it. A |
| 119 |
more in-depth guide to writing your own style file can be found in |
| 120 |
\mref{section}{sec:styles}. In this section we will discuss the common interface |
| 121 |
defined by the \pkg{talk}class, i.e.\ we will see how to create a |
| 122 |
presentation using the \pkg{talk} class and some ready-to-use style package |
| 123 |
like |talk-sidebars.sty|. |
| 124 |
|
| 125 |
\begin{figure} |
| 126 |
\begin{quote} |
| 127 |
|\documentclass[|\var{options}|]{talk}|\\ |
| 128 |
|\usepackage{|\var{style-def}|}|\\ |
| 129 |
$\vdots$\\ |
| 130 |
\txt{(more package inclusions)}\\ |
| 131 |
$\vdots$\\ |
| 132 |
|\title{|\var{title}|}|\\ |
| 133 |
|\author{|\var{author}|}|\\ |
| 134 |
|\date{|\var{date}|}|\\ |
| 135 |
$\vdots$\\ |
| 136 |
\txt{(global specifications required by \var{style-def})}\\ |
| 137 |
$\vdots$\\ |
| 138 |
|\begin{document}|\\ |
| 139 |
| \begin{slide}[|\var{slide-style}|]{|\var{slide-title}|}|\\ |
| 140 |
| |\txt{(body of first slide)}\\ |
| 141 |
| \end{slide}|\\ |
| 142 |
| \begin{notes}|\\ |
| 143 |
| |\txt{(notes on first slide)}\\ |
| 144 |
| \end{notes}|\\ |
| 145 |
| |$\vdots$\\ |
| 146 |
| |\txt{(more slides and notes)}\\ |
| 147 |
| |$\vdots$\\ |
| 148 |
| \section[|\var{short title}|]{|\var{long title}|}|\\ |
| 149 |
| |$\vdots$\\ |
| 150 |
| |\txt{(more slides and notes)}\\ |
| 151 |
| |$\vdots$\\ |
| 152 |
| \subsection[|\var{short title}|]{|\var{long title}|}|\\ |
| 153 |
| |$\vdots$\\ |
| 154 |
| |\txt{(more slides and notes)}\\ |
| 155 |
| |$\vdots$\\ |
| 156 |
| |\txt{(more sections and subsections)}\\ |
| 157 |
| |$\vdots$\\ |
| 158 |
|\end{document}| |
| 159 |
\end{quote} |
| 160 |
\caption{\label{fig:structure} The general structure of a presentation |
| 161 |
\texttt{tex} file.} |
| 162 |
\end{figure} |
| 163 |
The general structure of a presentation |tex| file is shown in |
| 164 |
\mref{figure}{fig:structure}. Note that you can structure your talk in the |
| 165 |
usual way with |\section| and |\subsection| commands. How these commands are |
| 166 |
handled depends on the loaded style package. |
| 167 |
% |
| 168 |
% |
| 169 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 170 |
\subsection{Class Options} |
| 171 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 172 |
% |
| 173 |
\label{ssec:options} |
| 174 |
The \pkg{talk} class is loaded in the first line of the listing in |
| 175 |
\mref{figure}{fig:structure}: |
| 176 |
\begin{quote} |
| 177 |
|\documentclass[|\var{options}|]{talk}| |
| 178 |
\end{quote} |
| 179 |
The available options are |
| 180 |
\begin{center} |
| 181 |
|screen|, |slides|, |notes|, |rotate| and |norotate|. |
| 182 |
\end{center} |
| 183 |
The \pkg{talk} class is built upon the |article| class, so it will pass all |
| 184 |
unknown options to |article|. Thus, in principle, all options of the |article| |
| 185 |
class can be used with the \pkg{talk} class as well. However, some options like |
| 186 |
|twocolumn| etc.\ may lead to undesired results. |
| 187 |
|
| 188 |
The options |screen|, |slides| and |notes| determine the \emph{mode} |
| 189 |
in which your presentation is compiled. The options |rotate| and |
| 190 |
|norotate| only take effect in the |slides| mode. |
| 191 |
|
| 192 |
\DescribeMacro{screen} |
| 193 |
Use the |screen| mode to create a screen presentation. With this option |
| 194 |
the paper size is set to the slide size, so that your slides can be displayed |
| 195 |
without white margins using the fullscreen mode of your favorite document |
| 196 |
viewer. |
| 197 |
|
| 198 |
\DescribeMacro{slides\\rotate\\norotate} |
| 199 |
If you use the |slides| mode your presentation is prepared for printout on |
| 200 |
transparencies. The slides are centered horizontally and vertically on normal |
| 201 |
paper. The default paper size is A4, but you can change it by using any of the |
| 202 |
paper size options of the |article| class. The options |rotate| and |
| 203 |
|norotate| determine whether or not the slides are rotated by 90 degrees in |
| 204 |
counterclockwise direction. By default rotation is enabled. |
| 205 |
\DescribeMacro{\slidesmag} |
| 206 |
In |slides| mode the slides can also be magnified. You can set the magnification |
| 207 |
factor with |
| 208 |
\begin{quote} |
| 209 |
|\slidesmag{|\var{factor}|}|. |
| 210 |
\end{quote} |
| 211 |
|
| 212 |
\DescribeMacro{notes} |
| 213 |
The |notes| mode allows you to print personal notes for your presentation. In |
| 214 |
this mode the slides are inserted in the flowing text, between your annotations. |
| 215 |
% |
| 216 |
% |
| 217 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 218 |
\subsection{Style Packages and Layouts} |
| 219 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 220 |
% |
| 221 |
Style definitions for the \pkg{talk} class are most conveniently included |
| 222 |
through a separate \emph{style package}. Style packages can be included with the |
| 223 |
usual |\usepackage| command: |
| 224 |
\begin{quote} |
| 225 |
|\usepackage[|\var{package-options}|]{|\var{style-package}|}|. |
| 226 |
\end{quote} |
| 227 |
By convention, \pkg{talk} style package names should start with |talk-|, e.g.\ |
| 228 |
|talk-simple| or |talk-sidebars|. The available package options depend on the |
| 229 |
chosen style package. The principal task of a \pkg{talk} style package is to |
| 230 |
set the width and height of the slides and define a number of \emph{layouts}. |
| 231 |
\DescribeMacro{\layout} To switch between different slide styles you can |
| 232 |
use the command |
| 233 |
\begin{quote} |
| 234 |
|\layout{|\var{layout-name}|}|. |
| 235 |
\end{quote} |
| 236 |
To change the layout for only one slide you can pass a layout name as an |
| 237 |
optional argument to the |slide| or |multislide| environment. |
| 238 |
|
| 239 |
\DescribeMacro{talk-simple} The |talk-simple| style package provides a simple |
| 240 |
but appealing design for short presentations. It defines a |default| layout for |
| 241 |
regular slides, a |notitle| layout where the slide title is removed to make |
| 242 |
more space for content and a |onlytitle| layout where the slide body is not |
| 243 |
shown and only the slide title is printed centered on the slide. (The latter |
| 244 |
is useful for emphasising the start of a new topic.) \DescribeMacro{\titlecolor} |
| 245 |
You can customise the colour of the title with the |\titlecolor| command. The |
| 246 |
syntax is |
| 247 |
\begin{quote} |
| 248 |
|\titlecolor{|\var{red-value}|,|\var{green-value}|,|% |
| 249 |
\var{blue-value}|}| |
| 250 |
\end{quote} |
| 251 |
where \var{red-value}, \var{green-value} and \var{blue-value} are numbers |
| 252 |
between 0 and 1. |
| 253 |
|
| 254 |
For further customisations (like adding background images or defining new |
| 255 |
layouts) you can simply copy the file |talk-simple.sty| and modify it. It's |
| 256 |
easier than you might think. The file contains lots of comments which guide |
| 257 |
you through the process. More information about style packages can be found |
| 258 |
in \mref{section}{sec:styles}. |
| 259 |
|
| 260 |
\DescribeMacro{talk-sidebars} The |talk-sidebars| style package is intended for |
| 261 |
longer presentations like seminar talks which consist of multiple sections and |
| 262 |
sub-sections. It displays the table of contents in a sidebar on the right of |
| 263 |
each slide and highlights the (sub-)section that you are currently in. It uses |
| 264 |
the \pkg{hyperref} package to make the sidebar \emph{navigatable}: you can jump |
| 265 |
to a different section or sub-section by clicking on the title in the sidebar. |
| 266 |
The style package has one option, |compress|, which affects the way in which |
| 267 |
sections and sub-sections are displayed in the sidebar. It defines defines a |
| 268 |
|default| layout for regular slides, an |outline| layout for showing the |
| 269 |
outline of the talk (i.e.\ the sections and sub-sections) at the start of the |
| 270 |
presentation, a |nosidebar| layout which removes the side bar to make more |
| 271 |
space for content and a |notitle| layout which also removes the title of the |
| 272 |
slide. |
| 273 |
|
| 274 |
\DescribeMacro{\backgroundcolor}% |
| 275 |
\DescribeMacro{\sidebarcolor}% |
| 276 |
\DescribeMacro{\titlecolor}% |
| 277 |
\DescribeMacro{\sidebartitlecolor}% |
| 278 |
\DescribeMacro{\highlightcolor}% |
| 279 |
The colours of the |talk-sidebars| style can be customised with the commands |
| 280 |
listed in \mref{table}{tab:colorcmds}. Their syntax is the same as for the |
| 281 |
|\titlecolor| command in |talk-simple|. |
| 282 |
\begin{table} |
| 283 |
\centering |
| 284 |
\begin{tabular}{lp{3in}} |
| 285 |
\hlx{hhv[1pt]} |
| 286 |
Command & Effect \\ |
| 287 |
\hlx{hv[1pt]} |
| 288 |
|\backgroundcolor| & sets the colour of the slide background\\ |
| 289 |
|\sidebarcolor| & sets the colour of the sidebar\\ |
| 290 |
|\titlecolour| & sets the colour of the slide title\\ |
| 291 |
|\sidebartitlecolor| & sets the colour of the sidebar title\\ |
| 292 |
|\highlightcolor| & sets the colour of highlighted sections and |
| 293 |
subsections in the sidebar\\ |
| 294 |
\hlx{hh} |
| 295 |
\end{tabular} |
| 296 |
\caption{\label{tab:colorcmds}The colour commands of the \pkg{sidebars} |
| 297 |
package} |
| 298 |
\end{table} |
| 299 |
% |
| 300 |
% |
| 301 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 302 |
\subsection{Global Specifications} |
| 303 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 304 |
% |
| 305 |
\DescribeMacro{\title}\DescribeMacro{\author}\DescribeMacro{\date} |
| 306 |
Like the |article| class, \pkg{talk} allows you to specify the title, author |
| 307 |
and date of your talk with the commands |
| 308 |
\begin{quote} |
| 309 |
|\title[|\var{short-title}|]{|\var{title}|}|\\ |
| 310 |
|\author[|\var{short-author}|]{|\var{author}|}|\\ |
| 311 |
|\date{|\var{date}|}| |
| 312 |
\end{quote} |
| 313 |
\DescribeMacro{\maketitleslide} Style packages should define a |
| 314 |
|\maketitleslide| command which generates a title slide showing this |
| 315 |
information. In what context the short versions \var{short-title} and |
| 316 |
\var{short-author} are used depends on the style package. The |
| 317 |
\pkg{talk-sidebars} package uses the long versions on the title slide but |
| 318 |
displays \var{short-title} and \var{short-author} in the side bar. Other style |
| 319 |
packages may also define addtitional commands, that allow you to specify |
| 320 |
additional information like institute, logo, place where the talk was given |
| 321 |
etc. |
| 322 |
% |
| 323 |
% |
| 324 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 325 |
\subsection{Environments} |
| 326 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 327 |
% |
| 328 |
The \pkg{talk} class defines three environments: |slide|, |multislide| and |
| 329 |
|notes|. All typeset material in your talk should be enclosed in one of these |
| 330 |
environments. |
| 331 |
|
| 332 |
\DescribeMacro{slide} |
| 333 |
The |slide| environment is the most important environment in the \pkg{talk} |
| 334 |
class. It allows you to typeset the contents of your slides. Its syntax is: |
| 335 |
\begin{quote} |
| 336 |
|\begin{slide}[|\var{layout-name}|]{|\var{slide-title}|}|\\ |
| 337 |
| |\txt{(slide body)}\\ |\end{slide}| |
| 338 |
\end{quote} |
| 339 |
The \var{style-name} argument is optional. It must be the name of one of the |
| 340 |
layouts defined in style package you have loaded. If no \var{layout-name} |
| 341 |
argument is given, \pkg{talk} uses the layout specified in the last call of the |
| 342 |
|\layout| command. |
| 343 |
|
| 344 |
\DescribeMacro{notes} |
| 345 |
The |notes| environment allows you to include annotations to your slides in |
| 346 |
the |tex| file. The contents of the |notes| environment are ignored if you |
| 347 |
compile your presentation in the |screen| or |slides| mode. |
| 348 |
|
| 349 |
\DescribeMacro{multislide} |
| 350 |
The |multislide| environment can be used to create overlays. Its syntax is: |
| 351 |
\begin{quote} |
| 352 |
|\begin{multislide}[|\var{layout-name}|]{|\var{sub-slides}|}|% |
| 353 |
|{|\var{slide-title}|}|\\ |
| 354 |
| |\txt{(slide body)}\\ |
| 355 |
|\end{multislide}| |
| 356 |
\end{quote} |
| 357 |
As for the |slide| environment the optional \var{layout-name} argument and the |
| 358 |
\var{slide-title} argument specify the layout and the slide title. The |
| 359 |
\var{sub-slides} argument has to be an integer number greater than zero. It |
| 360 |
specifies the number of sub-slides that the |multislide| environment will |
| 361 |
generate. In the body of the |multislide| environment, you can use the commands |
| 362 |
|\fromslide|, |\toslide| and |\onlyslide| to specify which material goes on |
| 363 |
which sub-slide. |
| 364 |
|
| 365 |
\DescribeMacro{\fromslide}\DescribeMacro{\toslide}\DescribeMacro{\onlyslide} |
| 366 |
The syntax of the commands |\fromslide|, |\toslide| and |\onlyslide| is: |
| 367 |
\begin{quote} |
| 368 |
|\fromslide*{|$n$|}{|\var{material}|}|\\ |
| 369 |
|\toslide*{|$n$|}{|\var{material}|}|\\ |
| 370 |
|\onlyslide*{|$n$|}{|\var{material}|}| |
| 371 |
\end{quote} |
| 372 |
The |\fromslide*| command ignores \var{material} on the first $n-1$ sub-slides. |
| 373 |
The |\toslide*| command ignores \var{material} on all sub-slides after the |
| 374 |
$n$-th. The |\onlyslide*| command ignores \var{material} on all sub-slides exept |
| 375 |
the $n$-th. If you use the unstarred commands |\fromslide|, |\toslide| and |
| 376 |
|\onlyslide| the \var{material} is not ignored but made invisible, so that it |
| 377 |
still uses up the space (pretty much like the |\phantom| command). |
| 378 |
% |
| 379 |
% |
| 380 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 381 |
\subsection{Positioning Tools} |
| 382 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 383 |
% |
| 384 |
Unlike ordinary text documents slides often contain many graphical elements or |
| 385 |
graphics and text in `non-standard' arrangements. Positioning these elements |
| 386 |
with standard \LaTeX commands can be challenging. The \pkg{talk} package |
| 387 |
provides a couple of positioning commands which make this task a bit easier. |
| 388 |
|
| 389 |
\DescribeMacro{\shiftbox} The |\shiftbox| command lets you freely position |
| 390 |
text and graphics relative to the \emph{current point} (i.e.\ the point on the |
| 391 |
current baseline where the next character would be inserted). The syntax is |
| 392 |
\begin{quote} |
| 393 |
|\shiftbox[|\var{anchor}|]{|\var{x}|}{|\var{y}|}{|\var{material}|}| |
| 394 |
\end{quote} |
| 395 |
The \var{material} will be set in a horizontal box (like |\mbox|) and placed |
| 396 |
a horizontal distance \var{x} and a vertical distance \var{y} away from the |
| 397 |
current point. With the optional argument \var{anchor} you can specify which |
| 398 |
corner of the box containing \var{material} should be placed at that location. |
| 399 |
Use |tl| for the top-left corner, |br| for the bottom-right corner and |tr| or |
| 400 |
|bl| for the other two corners. Instead of a lowercase |b| you can also use an |
| 401 |
uppercase |B| to anchor at the baseline of the box containing \var{material}. |
| 402 |
The default for \var{anchor} is |Bl|. |
| 403 |
|
| 404 |
Note that the |\shiftbox| does not use up any space on the current line, i.e.\ |
| 405 |
it does not move the current point. Thus, if you call |\shiftbox| multiple times |
| 406 |
in a row the relative positions of the boxes will be as you expect them to be. |
| 407 |
For example, |
| 408 |
\begin{quote} |
| 409 |
|\shiftbox[bl]{1cm}{1mm}{foo}|\\ |
| 410 |
|\shiftbox[tl]{1cm}{-1mm}{bar}| |
| 411 |
\end{quote} |
| 412 |
will print `foo' and `bar' one centimetre to the right of the current point. |
| 413 |
The words will be left-aligned on top of each other with a 2\,mm vertical gap |
| 414 |
between them. |
| 415 |
|
| 416 |
The |\shiftbox| command gives you maximal freedom in the way you position |
| 417 |
things on the slide. But quite often you just want to show two things (e.g.\ a |
| 418 |
picture and some text) side by side. \DescribeMacro{\twocolumn} In this case it |
| 419 |
is simpler to use the |\twocolumn| command. The syntax is |
| 420 |
\begin{quote} |
| 421 |
|\twocolumn[|\var{fraction}|]{|\var{valign}|}{|\var{left-material}|}{|\var{right-material}|}| |
| 422 |
\end{quote} |
| 423 |
This will show \var{left-material} in the left column and \var{right-material} |
| 424 |
in the right column. The command uses up the entire available horizontal space. |
| 425 |
The \var{valign} argument determines how the material in the two columns is |
| 426 |
vertically aligned. The possible values are |t| (top-aligned), |c| (centered) |
| 427 |
and |b| (bottom-aligned). The optional \var{fraction} argument lets you control |
| 428 |
the relative width of the columns. It defaults to 0.5, in which case the two |
| 429 |
columns have the same width. |
| 430 |
% |
| 431 |
% |
| 432 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 433 |
\subsection{Title and Contents Pages} |
| 434 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 435 |
% |
| 436 |
\label{sec:toc} |
| 437 |
Most talks begin with a title page showing the title of the talk, the name of |
| 438 |
the speaker and possibly additional information like the date and place where |
| 439 |
the talk is given, the institute of the speaker etc. For long talks you'll also |
| 440 |
want to show an `outline' or `table of contents' of your talk at the beginning. |
| 441 |
|
| 442 |
\DescribeMacro{\maketitleslide} Style packages for the \pkg{talk} class should |
| 443 |
define a |\maketitleslide| command which generates the title slide using the |
| 444 |
information specified with the |\title|, |\author| and |\date| (and possibly |
| 445 |
some other) commands. |
| 446 |
|
| 447 |
\DescribeMacro{\tableofcontents} Style packages may also redefine the standard |
| 448 |
\LaTeX\ command |\tableofcontents| in such a way that it produces a suitable |
| 449 |
table of contents. This command should be used in the body of a slide, e.g. |
| 450 |
\begin{quote} |
| 451 |
|\begin{slide}[outline]{Contents}|\\ |
| 452 |
| \tableofcontents|\\ |
| 453 |
|\end{slide}| |
| 454 |
\end{quote} |
| 455 |
|
| 456 |
For some talks the table of contents may not fit on one slide. The \pkg{talk} |
| 457 |
class cannot break material into multiple slides automatically, but it allows |
| 458 |
you to split the table of contents manually. To do this you can pass an |
| 459 |
optional argument to the |\tableofcontents| command, which has the following |
| 460 |
form: |
| 461 |
\begin{quote} |
| 462 |
|\tableofcontents[|\var{fromsec}|.|\var{fromsubsec}% |
| 463 |
|-|\var{tosec}|.|\var{tosubsec}|]| |
| 464 |
\end{quote} |
| 465 |
where \var{fromsec}, \var{fromsubsec}, \var{tosec} and \var{tosubsec} are |
| 466 |
integer numbers. Their names are self-explaining. Note that the argument of |
| 467 |
|\tableofcontents| must always have the form given above. If you wan to display |
| 468 |
the sections 3 to 5 with all their subsections on one slide, you have to write |
| 469 |
\begin{quote} |
| 470 |
|\tableofcontents[3.0-5.99]| |
| 471 |
\end{quote} |
| 472 |
(assuming that section 5 does not have more than 99 subsections). |
| 473 |
% |
| 474 |
% |
| 475 |
% |
| 476 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 477 |
\section{The \pkg{talk} Class for Package Writers} |
| 478 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 479 |
% |
| 480 |
% |
| 481 |
\label{sec:styles} |
| 482 |
The entire look-and-feel of a \pkg{talk} presentation is determined by external |
| 483 |
style packages. The macros provided by the \pkg{talk} class itself only take |
| 484 |
care of more technical issues like |
| 485 |
\begin{itemize} |
| 486 |
\item magnifying and positioning the slides on the paper, |
| 487 |
\item creating overlays, |
| 488 |
\item keeping a table of contents that is accessible on every slide, |
| 489 |
\item keeping a catalog of layouts and allowing the user to switch |
| 490 |
between them. |
| 491 |
\end{itemize} |
| 492 |
To create your own \pkg{talk} style the best starting point is the file |
| 493 |
|talk-simple.sty|. It contains lots of comments which explain what is happening |
| 494 |
and give you tips for how to customise it. If you want a more structured |
| 495 |
explanation just continue reading. |
| 496 |
% |
| 497 |
% |
| 498 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 499 |
\subsection{Mode Conditionals} |
| 500 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 501 |
% |
| 502 |
As we have seen in \mref{section}{ssec:options} a \pkg{talk} presentation can be |
| 503 |
compiled in three different modes: |slides|, |screen| and |notes|. To implement |
| 504 |
mode-specific behaviour the \pkg{talk} class provides the following |if| |
| 505 |
commands: |
| 506 |
\DescribeMacro{\@ifslides}\DescribeMacro{\@ifscreen}\DescribeMacro{\@ifnotes} |
| 507 |
\begin{quote} |
| 508 |
|\@ifslides{|\var{if-code}|}{|\var{else-code}|}|\\ |
| 509 |
|\@ifscreen{|\var{if-code}|}{|\var{else-code}|}|\\ |
| 510 |
|\@ifnotes{|\var{if-code}|}{|\var{else-code}|}| |
| 511 |
\end{quote} |
| 512 |
The \var{if-code} is executed if the talk is compiled in |slides|, |screen| or |
| 513 |
|notes| mode, respectively, and the \var{else-code} is executed otherwise. |
| 514 |
% |
| 515 |
% |
| 516 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 517 |
\subsection{Slide Dimensions} |
| 518 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 519 |
% |
| 520 |
\DescribeMacro{\slidewidth}\DescribeMacro{\slideheight} |
| 521 |
The width and height of the slides can be accessed through the |\slidewidth| and |
| 522 |
|\slideheight| commands. |
| 523 |
\DescribeMacro{\@slidesize} |
| 524 |
However, to set the slide dimensions you should always use the command |
| 525 |
\begin{quote} |
| 526 |
|\@slidesize{|\var{width}|}{|\var{height}|}| |
| 527 |
\end{quote} |
| 528 |
as it also adjusts the papersize and slide positioning. |
| 529 |
% |
| 530 |
% |
| 531 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 532 |
\subsection{Global Specifications} |
| 533 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 534 |
% |
| 535 |
\DescribeMacro{\@title}\DescribeMacro{\@author}\DescribeMacro{\@date} |
| 536 |
The title, author and date set by the user with the |\title|, |\author| and |
| 537 |
|\date| commands are stored in the macros |\@title|, |\@author| and |\@date|. |
| 538 |
If you intend to display additional information like the speakers institute on |
| 539 |
your slides you should define an |\institute| command in analogy to the commands |
| 540 |
above: |
| 541 |
\begin{quote} |
| 542 |
|\gdef\@institute{}|\\ |
| 543 |
|\newcommand{\institute}[1]{\gdef\@institute{#1}}| |
| 544 |
\end{quote} |
| 545 |
% |
| 546 |
% |
| 547 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 548 |
\subsection{Counters} |
| 549 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 550 |
% |
| 551 |
\DescribeMacro{slide\\subslide} |
| 552 |
In addition to the standard counters of the |article| class, \pkg{talk} defines |
| 553 |
the counters |slide| and |subslide|. The number of the current slide is stored |
| 554 |
in |slide|. The slides of a |multislide| environment have the same |slide| |
| 555 |
number and different |subslide| numbers. |
| 556 |
|
| 557 |
\DescribeMacro{\theslide}\DescribeMacro{\thesubslide}% |
| 558 |
The commands |\theslide| and |\thesubslide| can be used to print the slide or |
| 559 |
subslide number, respectively. They are defined as |
| 560 |
\begin{quote} |
| 561 |
|\newcommand{\theslide}{\arabic{slide}}|\\ |
| 562 |
|\newcommand{\thesubslide}{\theslide.\arabic{subslide}}| |
| 563 |
\end{quote} |
| 564 |
You can redefine them to change the way the slide and subslide numbers |
| 565 |
are displayed |
| 566 |
|
| 567 |
\DescribeMacro{\theslidelabel} |
| 568 |
For printing labels on your slides you should use the |\theslidelabel| |
| 569 |
command. It calls |\theslide| when you are in a |slide| environment and |
| 570 |
|\thesubslide| when you are in a |multislide| environment. |
| 571 |
% |
| 572 |
% |
| 573 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 574 |
\subsection{Layouts} |
| 575 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 576 |
% |
| 577 |
To change the look-and-feel of your slides you have to redefine some or all of |
| 578 |
the following commands: |
| 579 |
\begin{quote} |
| 580 |
|\@makeslide|\\ |
| 581 |
|\@makenotesslide|\\ |
| 582 |
|\@maketocsection|\\ |
| 583 |
|\@maketocsubsection| |
| 584 |
\end{quote} |
| 585 |
These commands will be called by the |slide|, |multislide| and |notes| |
| 586 |
environments. Their exact meaning will be explained later on. |
| 587 |
\DescribeMacro{\@newlayout} To create a layout you have to wrap a |
| 588 |
|\@newslidestyle| command around your definitions. A typical layout definition |
| 589 |
takes the form |
| 590 |
\begin{quote} |
| 591 |
|\@newlayout{|\var{layout-name}|}{|\\ |
| 592 |
| \renewcommand{\@makeslide}{|\var{stuff}|}|\\ |
| 593 |
| \renewcommand{\@maketocsection}[3]{|\var{stuff}|}|\\ |
| 594 |
| \renewcommand{\@maketocsubsection}[4]{|\var{stuff}|}|\\ |
| 595 |
|}| |
| 596 |
\end{quote} |
| 597 |
|
| 598 |
The |\@newlayout| command simply dumps its second argument into a macro |
| 599 |
called |\talk@sty@|\var{layout-name}. When the layout is loaded |
| 600 |
with |\layout{|\var{layout-name}|}| or with the optional argument of the |
| 601 |
|slide| environment, all the |\@make|\ldots\ commands are reset to their default |
| 602 |
definitions. Then the macro |\talk@sty@|\var{layout-name} is executed. |
| 603 |
|
| 604 |
Note that the |\renewcommand| calls in the second argument of |\@newslidestyle| |
| 605 |
appear in the definition of the |\talk@sty@|\var{style-name} command. Therefore |
| 606 |
the arguments of |\@maketocsection| and |\@maketocsubsection| have to be |
| 607 |
referenced with double hashes, for example |
| 608 |
\begin{quote} |
| 609 |
|\@newslidestyle{|\var{style-name}|}{|\\ |
| 610 |
| \renewcommand{\@maketocsection}[3]{Section ##1: ##3}|\\ |
| 611 |
|}| |
| 612 |
\end{quote} |
| 613 |
Single hashes would refer to the arguments of |\talk@sty@|\var{style-name}. |
| 614 |
% |
| 615 |
% |
| 616 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 617 |
\subsection{Typesetting Slides} |
| 618 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 619 |
% |
| 620 |
\DescribeMacro{\@slidetitle}\DescribeMacro{\@slidebody} |
| 621 |
The |slide| and |multislide| environments store the slide title in the macro |
| 622 |
|\@slidetitle| and the slide body in the macro |\@slidebody|. When you redefine |
| 623 |
the various |\@make|\ldots\ commands you can therefore use |\@slidetitle| and |
| 624 |
|\@slidebody| to insert the title and body of the current slide. |
| 625 |
|
| 626 |
\DescribeMacro{\@makeslide} To generate a slide the |slide| environment |
| 627 |
executes the macro |\@makeslide| inside a |\parbox| with width and height set |
| 628 |
to the dimensions of the slide. When |\@makeslide| is called the current point |
| 629 |
will always be in the upper left corner of the parbox. Thus, you can use the |
| 630 |
|\shiftbox| command to place graphical elements (e.g.\ a background image) |
| 631 |
and text elements (e.g.\ the slide title or body) using coordinates relative |
| 632 |
to the top-left corner of the slide. This is the method used in the |
| 633 |
|talk-simple.sty| and |talk-sidebars.sty| style packages. |
| 634 |
|
| 635 |
Before the |
| 636 |
call to |\@makeslide| it executes several commands that set the bounding box of |
| 637 |
the picture to a box of width |\slidewidth| and height |\slideheight| and |
| 638 |
scales and rotates the picture in accordance with the on the compilation mode |
| 639 |
and class options. The |\@makeslide| macro should therefore expand to a |
| 640 |
sequence of valid \pkg{pgf} commands which draw the slide inside a box of width |
| 641 |
|\slidewidth| and height |\slideheight|, with the origin located at the |
| 642 |
lower-left corner. \DescribeMacro{\@slidebox} To obtain an LR box containing |
| 643 |
the properly scaled and rotated slide you can use the |\@slidebox| macro. |
| 644 |
|
| 645 |
\DescribeMacro{\@makenotesslide} If you compile in the |notes| mode the |slide| |
| 646 |
and |multislide| environments call |\@makenotesslide| to insert the current |
| 647 |
slide in the flowing text. By default the |\@makenotesslide| command simply |
| 648 |
centers the parbox containing the slide horizontally. You can change this |
| 649 |
behaviour by redefining the |\@makenotesslide| command. For example, if you |
| 650 |
only want to print the title of each slide in your notes, you should include |
| 651 |
something like |
| 652 |
\begin{quote} |
| 653 |
|\renewcommand{\@makenotesslide}{|\\ |
| 654 |
| \begin{center}\textbf{\@slidetitle}\end{center}|\\ |
| 655 |
|}| |
| 656 |
\end{quote} |
| 657 |
in your style definition. \DescribeMacro{\@slidebox} The parbox with the fully |
| 658 |
assembled slide can be accessed with the |\@slidebox| command. The default |
| 659 |
definition of |\@makenotesslide| is |
| 660 |
\begin{quote} |
| 661 |
|\newcommand{\@makenotesslide}{|\\ |
| 662 |
| \par\hspace*{\fill}\@slidebox\hspace*{\fill}\par|\\ |
| 663 |
|}| |
| 664 |
\end{quote} |
| 665 |
|
| 666 |
Note how the \pkg{talk} gives you complete artistic freedom in the design of |
| 667 |
your slides: It lets you define the macros that generate the slides while |
| 668 |
contents like the slide title and body are previously stored in macros like |
| 669 |
|\@slidetitle| and |\@slidebody|, so that you can insert them where you like. |
| 670 |
For completeness we now summarise all commands yielding user defined contents: |
| 671 |
\begin{description} |
| 672 |
\item[\ccmd{slidetitle}] Title of the current slide. |
| 673 |
\item[\ccmd{slidebody}] Body of the current slide. |
| 674 |
\item[\texttt{\symbol{`\\}theslidelabel}] Label of the current slide. Shows |
| 675 |
the slide number in a |slide| environment and the slide and subslide number |
| 676 |
in a |multislide| environment. |
| 677 |
\item[\ccmd{title}] Title of the presentation. |
| 678 |
\item[\ccmd{shorttitle}] Short version of the title. |
| 679 |
\item[\ccmd{author}] Author of the presentation. |
| 680 |
\item[\ccmd{shortauthor}] Short version of the author. |
| 681 |
\item[\ccmd{date}] Date specified with the |\date| command (|\today| by |
| 682 |
default). |
| 683 |
\item[\ccmd{tableofcontents}] Prints the table of contents. See the next |
| 684 |
subsection for more information. |
| 685 |
\end{description} |
| 686 |
% |
| 687 |
% |
| 688 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 689 |
\subsection{The Table of Contents} |
| 690 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 691 |
% |
| 692 |
\DescribeMacro{\@tableofcontents} |
| 693 |
The table of contents of your talk can be created with the |\@tableofcontents| |
| 694 |
macro. Its name is slightly misleading because, in fact, it allows you to |
| 695 |
display any kind of structure information on your slides. For example, you can |
| 696 |
use it to print only the title of the current section. |
| 697 |
|
| 698 |
\DescribeMacro{\@maketocsection}\DescribeMacro{\@maketocsubsection} |
| 699 |
The |\@tableofcontents| macro expands to a series of |\@maketocsection| and |
| 700 |
|\@maketocsubsection| commands. By default these commands do nothing. You can |
| 701 |
control the appearence of the table of contents by redefining them. Their syntax |
| 702 |
is |
| 703 |
\begin{quote} |
| 704 |
|\@maketocsection{|\var{section}|}{|\var{short-title}|}{|\var{long-title}|}| |
| 705 |
\\[\medskipamount] |
| 706 |
|\@maketocsubsection{|\var{section}|}{|\var{subsection}|}%|\\ |
| 707 |
| {|\var{short-title}|}{|\var{long-title}|}| |
| 708 |
\end{quote} |
| 709 |
where \var{section} and \var{subsection} are integer numbers. |
| 710 |
|
| 711 |
\DescribeMacro{\@ifcurrentsection}\DescribeMacro{\@ifcurrentsubsection} |
| 712 |
Note that the |\@tableofcontents| macro always expands to the full list of |
| 713 |
sections and subsections. To implement a special treatment for the |
| 714 |
\emph{current} section or subsection you can use the |\@ifcurrentsection| and |
| 715 |
|\@ifcurrentsubsection| commands. Their syntax is |
| 716 |
\begin{quote} |
| 717 |
|\@ifcurrentsection{|\var{number}|}{|\var{if-code}|}{|\var{else-code}|}|\\ |
| 718 |
|\@ifcurrentsubsection{|\var{number}|}{|\var{if-code}|}{|\var{else-code}|}| |
| 719 |
\end{quote} |
| 720 |
The \var{if-code} is executed if \var{number} matches the current section or |
| 721 |
subsection, respectively, and \var{else-code} is executed otherwise. For |
| 722 |
example, if you want to display the current section in the top left corner of |
| 723 |
each slide, your style definition should look somewhat like |
| 724 |
\begin{quote} |
| 725 |
|\newslidestyle{|\var{style-name}|}{|\\ |
| 726 |
| \renewcommand{\@maketocsection}[3]{|\\ |
| 727 |
| \@ifcurrentsection{##1}{##3}{}|\\ |
| 728 |
| }|\\ |
| 729 |
| \renewcommand{\@makeslidecontent}{|\\ |
| 730 |
| \@tableofcontents|\\ |
| 731 |
| |$\vdots$\\ |
| 732 |
| }|\\ |
| 733 |
| |$\vdots$\\ |
| 734 |
|}| |
| 735 |
\end{quote} |
| 736 |
|
| 737 |
\DescribeMacro{\tableofcontents} |
| 738 |
Most talks begin with an outline of the talk's contents. As a package writer you |
| 739 |
should therefore provide a |\tableofcontents| command that allows the user to |
| 740 |
print the full table of contents. (\pkg{talk} already defines the |
| 741 |
|\tableofcontents| command, but it does nothing by default.) You can achieve |
| 742 |
this, too, by redefining |\@maketocsection| and |\@maketocsubsection| and then |
| 743 |
calling |\@tableofcontents|. |
| 744 |
|
| 745 |
\DescribeMacro{\@ifinrange} |
| 746 |
However, if the table of contents does not fit on one slide, the user should be |
| 747 |
able to split it, using an optional range argument of the form shown in |
| 748 |
\mref{section}{sec:toc}. It is the package writers task to implement this |
| 749 |
feature, but the parsing of the range argument is done by the |\@ifinrange| |
| 750 |
macro. Its syntax is |
| 751 |
\begin{quote} |
| 752 |
|\@ifinrange{|\var{sec}|}{|\var{subsec}|}{|\var{range}|}{|\var{if-code}|}{|\var{else-code}|}| |
| 753 |
\end{quote} |
| 754 |
\var{sec} and \var{subsec} are section and subsection numbers and \var{range} is |
| 755 |
a string of the form |
| 756 |
\begin{quote} |
| 757 |
\var{fromsec}|.|\var{fromsubsec}|-|\var{tosec}|.|\var{tosubsec} |
| 758 |
\end{quote} |
| 759 |
The \var{if-code} is executed if the subsection specified by \var{sec} and |
| 760 |
\var{subsec} lies in the range specified by \var{range}, the \var{else-code} is |
| 761 |
executed otherwise. |
| 762 |
|
| 763 |
A typical definition of the |\tableofcontents| command will therefore look as |
| 764 |
follows: |
| 765 |
\begin{quote} |
| 766 |
|\renewcommand{\tableofcontents}[1][0.0-99.99]{|\\ |
| 767 |
| \bgroup|\\ |
| 768 |
| \def\@maketocsection##1##2##3{|\\ |
| 769 |
| \@ifinrange{##1}{0}{#1}{|\\ |
| 770 |
| ##1.\space ##3\par|\\ |
| 771 |
| }{}|\\ |
| 772 |
| }|\\ |
| 773 |
| \def\@maketocsubsection##1##2##3##4{|\\ |
| 774 |
| \@ifinrange{##1}{##2}{#1}{|\\ |
| 775 |
| ##1.##2.\space ##3\par|\\ |
| 776 |
| }{}|\\ |
| 777 |
| }|\\ |
| 778 |
| \@tableofcontents|\\ |
| 779 |
| \egroup|\\ |
| 780 |
|}| |
| 781 |
\end{quote} |
| 782 |
If you use grouping (|\bgroup| and |\egroup| or curly brackets) and plain \TeX\ |
| 783 |
definitions (|\def| instead of |\renewcommand|), as shown above, your |
| 784 |
definitions remain local to the goup, so you don't have to worry about restoring |
| 785 |
the original definitions of |\@maketocsection| and |\@maketocsubsection|. A more |
| 786 |
sophisticated definition of the |\tableofcontents| command can be found in |
| 787 |
|sidebars.sty|. |
| 788 |
% |
| 789 |
% |
| 790 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 791 |
\subsection{Paragraph Spacing} |
| 792 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 793 |
% |
| 794 |
The \pkg{talk} class and the accompanying style packages |talk-simple.sty| and |
| 795 |
|talk-sidebars.sty| make extensive use of the |\parbox| command and the |
| 796 |
|minipage| environment to position text elements. The standard definitions of |
| 797 |
these commands have the unfortunate property that they override the global |
| 798 |
setting for |\parskip| which controls the space inserted between paragraphs. |
| 799 |
You can set |\parskip| globally to something non-zero, but inside parboxes and |
| 800 |
minipages the separation between paragraphs will still be zero. (Try it out!) |
| 801 |
This behaviour may be acceptable in document classes like |article| where |
| 802 |
parboxes and minipages are only uses in exceptional circumstances, but becomes |
| 803 |
problematic when virtually all visible material lives inside a parbox or |
| 804 |
minipage. \DescribeMacro{\setparskip} To mitigate this \pkg{talk} provides the |
| 805 |
|\setparskip| command which sets the value of |\parskip| for all following |
| 806 |
paragraphs, including those inside parboxes or minipages. The syntax is |
| 807 |
\begin{quote} |
| 808 |
|\setparskip{|\var{glue}|}| |
| 809 |
\end{quote} |
| 810 |
where \var{glue} is a glue item to be used to separate paragraphs. For example, |
| 811 |
the |talk-simple.sty| and |talk-sidebars.sty| packages use |
| 812 |
\begin{quote} |
| 813 |
|\setparskip{1.5ex plus0.5ex minus0.5ex}| |
| 814 |
\end{quote} |
| 815 |
% |
| 816 |
% |
| 817 |
% |
| 818 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 819 |
\newpage |
| 820 |
\section{Contact} |
| 821 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 822 |
% |
| 823 |
% |
| 824 |
For comments, bug reports, feature requests or submitting style packages please |
| 825 |
raise an issue at |
| 826 |
\begin{quote} |
| 827 |
|https://github.com/mwiebusch78/talk| |
| 828 |
\end{quote} |
| 829 |
|
| 830 |
\bigskip |
| 831 |
\begin{flushright} |
| 832 |
Martin Wiebusch, \lastupdated |
| 833 |
\end{flushright} |
| 834 |
\end{document} |
| 835 |
|
| 836 |
|