Debian Codegraph @

texmf-dist/tex/plain/present/present.tex

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % present.tex
4 % Some macros for preparing presentations in TeX, using pdftex
5 % Version 2.2.1
6 % Copyright 2010-2019 Matthias Meister
7 %
8 % This work may be distributed and/or modified under the
9 % conditions of the LaTeX Project Public License, either version 1.3
10 % of this license or (at your option) any later version.
11 % The latest version of this license is in
12 % http://www.latex-project.org/lppl.txt
13 %
14 % This work has the LPPL maintenance status 'maintained'.
15 %
16 % The Current Maintainer of this work is:
17 %
18 % Matthias Meister ([email protected])
19 %
20 % The work consists of the following files:
21 % present.tex (the macro collection)
22 % present-transitions.tex (additional macros, providing transition effects)
23 % HowToTalkTeX.tex (an example of present.tex in use and a documentation)
24 % HowToTalkTeX.pdf (pdf obtained from HowToTalkTex.tex with pdftex)
25 % Stern.png (auxiliary file)
26 % Sagnac.pdf (auxiliary file)
27 % Pfeil1.pdf (auxiliary file)
28 % Pfeil2.pdf (auxiliary file)
29 % Pfeil3.pdf (auxiliary file)
30 % Pfeil4.pdf (auxiliary file)
31 % background.png (auxiliary file)
32 %
33 % (The auxiliary files are used in present.tex and HowToTalkTeX.tex, and
34 % therefore should remain unchanged, too)
35 %
36 % With reference to the definitions in the LaTeX Project Public License, for the
37 % purposes of this work a 'Base Interpreter' is a program implementing the TeX
38 % language.
39 %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41
42 \catcode`\@=11
43
44
45 \parindent0pt % Indentation probably not good for presentation
46 \parskip0pt % Neither is automatic extra space between paragraphs
47
48 \def\StandardAspect{% % Define "slide format", basically determined
49 \pdfpagewidth=120mm % by aspect ratio of screen
50 \pdfpageheight=90mm % StandardAspect gives 4:3 aspect ratio
51 \vsize=67mm %
52 \hsize=110mm % If you change these values,
53 \hoffset=-20.4mm % do so with care.
54 \voffset=-12.4mm %
55 }
56
57 \def\WideAspect{% % WideAspect gives 144:90 aspect ratio
58 \pdfpagewidth=144mm %
59 \pdfpageheight=90mm %
60 \vsize=67mm % If you change these values,
61 \hsize=134mm % do so with care
62 \hoffset=-20.4mm %
63 \voffset=-12.4mm %
64 }
65
66
67 %
68 % Set some fonts
69 %
70 \font\titlefont=cmssbx10 at 20pt % Define fonts for title of presentation
71 \font\normalfont=cmss12 % ordinary text
72 \font\slidetitlefont=cmssbx10 % title of a slide
73 \font\linkbarfont=cmss8 % the LinkBar (see below)
74 \font\it=cmti12
75 %
76 \baselineskip=15pt
77 % %% Below fonts for math are adapted to 12pt size
78 \font\tfont=cmr12
79 \font\sfont=cmr9
80 \font\ssfont=cmr7
81 \font\tifont=cmmi12
82 \font\sifont=cmmi9
83 \font\ssifont=cmmi7
84 \font\tsyfont=cmsy10 at 12pt
85 \font\ssyfont=cmsy9
86 \font\sssyfont=cmsy7
87 \font\texfont=cmex10 at 12 pt
88 \font\sexfont=cmex9
89 \font\ssexfont=cmex7
90 %
91 \textfont0=\tfont
92 \scriptfont0=\sfont
93 \scriptscriptfont0=\ssfont
94 \textfont1=\tifont
95 \scriptfont1=\sifont
96 \scriptscriptfont1=\ssifont
97 \textfont2=\tsyfont
98 \scriptfont2=\ssyfont
99 \scriptscriptfont2=\sssyfont
100 \textfont3=\texfont
101 \scriptfont3=\sexfont
102 \scriptscriptfont3=\ssexfont
103 %
104
105 %
106 % Definitions to allow referencing the last page of a document
107 %
108 \newwrite\wl@stpage
109 \newread\rl@stpage
110 \def\bye{%
111 \immediate\openout\wl@stpage=\jobname.lp% The number of the last slide is written in a file
112 \write\wl@stpage{\the\pageno}% % with extension .lp
113 \closeout\wl@stpage
114 \par\vfill
115 \supereject
116 \end
117 }
118 \def\LP{undef}
119 \openin\rl@stpage=\jobname.lp
120 \ifeof\rl@stpage\closein\rl@stpage\message{RUN AGAIN to get correct number of last page!}
121 \else\read\rl@stpage to \LP\fi
122
123 %
124 % Define some colours
125 %
126 % The commands below handle colour without color.tex, directly with pdftex
127 % Added October 3rd, 2010
128
129 % Define colours
130 \def\backgroundcolour{1.0 1.0 1.0} % Colour of page background
131 \def\textcolour{0.0 0.0 1.0} % Colour of text
132 \def\attentioncolour{1 0 0} % Colour for "Attention"
133
134 \newdimen\vsh@ft % vertical shift for background image, vsh@ft+\voffset=-25.4mm
135 \newdimen\hsh@ft % horizontal shift for background image, hsh@ft+\hoffset=-25.4mm
136 \vsh@ft=-13mm
137 \hsh@ft=-5mm
138
139 \def\bl@nk{ } % Introduced this
140 \newcount\colst@ck
141 \colst@ck=\pdfcolorstackinit page {\textcolour\bl@nk rg \textcolour\bl@nk RG} % and modified this on March 20, 2012
142 \def\popst@ck{\pdfcolorstack\colst@ck pop}
143 \def\setcolour#1{\pdfcolorstack\colst@ck push {#1 rg #1 RG}\aftergroup\popst@ck}
144 \long\def\coloured#1#2{{\setcolour#1#2}}
145 \long\def\att#1{\coloured\attentioncolour{#1}}
146 \def\bgc@lset{\relax}
147 \def\setbgcolour#1{\def\bgc@lset{\begingroup\pdfcolorstack\colst@ck push {#1 rg #1 RG}\aftergroup\popst@ck
148 \vbox to 0pt{\kern\vsh@ft\hbox to 0pt{%
149 \kern\hsh@ft\vrule depth0pt height\pdfpageheight width\pdfpagewidth\hss}\vss}
150 \nointerlineskip
151 \endgroup}}
152
153
154 \def\NewSlide{\vfill\eject} % Begin a new slide; slide number increases
155
156 \def\NewFrame{\vfill\eject\advance\pageno by -1} % Begin new frame ("same" slide, with changes)
157 % slide number does not change
158
159 \def\SlideTitle#1{% % Set the slide title, show it as the headline
160 \global\headline{% % of the slide in slidetitlefont, with a
161 \vbox to 5mm{% % horizontal line separating the headline from
162 \hbox to \hsize{\slidetitlefont #1}% % the main body of the slide
163 \vskip3pt plus 1fil minus 1fil
164 \hrule height 1pt depth 0pt
165 }}}
166
167 \def\SlideFoot{% % Set the footline of the slide, separated by
168 \global\footline{% % a horizontal slide from the main body of the
169 \vbox to 5mm {% % slide. This macro takes no argument.
170 \hrule height 1pt depth 0pt % Several possibilities are provided below.
171 \vskip3pt plus 1fil minus 1fil % Only one of the following options should be
172 \hbox to \hsize{% % uncommented.
173 \rlap{\LinkBar}\phantom{\PageBar}\hfil{\normalfont\the\pageno/\LP}\hfil\PageBar% Links to sections,
174 % %slide number, page navigation
175 %\hfil\the\pageno/\LP\hfil% % Slide number; \LP is number of last slide
176 %% % empty
177 }}}}
178
179 \def\LinkBar{% % If you use LinkBar, you have to define it and possibly redefine
180 LinkBar} % it at several places in your talk. The definition given
181 % just prints "LinkBar", in order to show where it goes.
182
183 \def\PageBar{% % This provides page navigation: Next page, previous page,
184 \hbox{% % going back and forth in page history
185 \pagelink{PrevPage}{\image[width4mm]{Pfeil2.pdf}}\kern2mm
186 \pagelink{NextPage}{\image[width4mm]{Pfeil1.pdf}}\kern2mm
187 \pagelink{GoBack}{\image[width4mm]{Pfeil3.pdf}}\kern2mm
188 \pagelink{GoForward}{\image[width4mm]{Pfeil4.pdf}}
189 }}
190
191 %
192 % Make #2 a link to the destination named #1 in the presentation.
193 % A destination is created and named with the \target control word.
194 %
195 \def\link#1#2{%
196 \pdfstartlink attr {/Border [0 0 0]} goto name {#1}
197 #2%
198 \pdfendlink}
199
200 %
201 % Creates named destination at position where it is issued. #1 is name of destination.
202 %
203 \def\target#1{%
204 \pdfdest name {#1} xyz\relax}
205
206 %
207 % Used in the PageBar. Uses the predefined actions PrevPage etc.
208 %
209 \def\pagelink#1#2{%
210 \pdfstartlink
211 attr {/Border [0 0 0]} user {/Subtype /Link /A <</S /Named /N /#1>>}%
212 #2%
213 \pdfendlink}
214
215 %
216 % Sets a rectangular area of the screen to be a link to a destination.
217 % #1 is the destination (in the same document); it can be a named or other destination
218 % #2 defines the rectangle which is the active link area, specified by
219 % four space separated numbers corresponding to lower left and upper right corners
220 % #3 is the border width (in "default user-space units")
221 % #4 is the RGB-color, specified as three space separated numbers R G B between 0 and 1
222 %
223 \def\linkarea#1#2#3#4{%
224 \pdfannot{%
225 /Subtype /Link
226 /Rect [#2]
227 /Border [0 0 #3]
228 /C [#4]
229 /A << /S /GoTo /D (#1) >>}}
230
231 %
232 % Make #2 a link to the web destination #1
233 %
234 \def\weblink#1#2{%
235 \pdfstartlink attr {/Border [0 0 0]} user {/Subtype /Link /A << /S /URI /URI (#1) >>}%
236 #2\pdfendlink}
237
238 %
239 % Make #3 a link to destination #2 in file #1 (a pdf-file). One of several possible forms of a destination
240 % is [page /Fit], where "page" is the page number in the file, counting from 0
241 % Named destinations are also possible
242 %
243 \def\filelink#1#2#3{%
244 \pdfstartlink attr {/Border [0 0 0]} user {/Subtype /Link /A << /S /GoToR /F (#1) /D #2 /NewWindow true >>}%
245 #3\pdfendlink}
246
247 %
248 % Includes an image. The image file name is #2, and #1 is a specification of the dimension of the
249 % image (will be scaled accordingly) in the usual TeX syntax (width, height, depth).
250 %
251 \def\image[#1]#2{%
252 \pdfximage #1 {#2}\pdfrefximage\pdflastximage}
253
254 %\def\movie#1#2#3{%
255 %\pdfstartlink attr {/Border [0 0 0]} user {/Subtype /Link /A << /S /Launch /F (mplayer -noborder -ontop -geometry #2 #1) >>}%
256 %#3\pdfendlink}
257
258 \footline{} % Set some
259 \StandardAspect % default values
260
261 %
262 % Added 28. August 2010. Not part of version 1.0
263 %
264 % Setting / unsetting a background image. If no background image is used, the background shows background colour
265 %
266 \def\h@lpr{\relax}
267 \def\BIM@G{\relax}
268 \def\SetBackground#1{\def\BIM@G{#1}}
269 \def\UnsetBackground{\def\BIM@G{\relax}}
270 \output{%
271 \shipout\vbox{%
272 \bgc@lset
273 \ifx\BIM@G\h@lpr \else
274 {\vbox to 0pt{\kern\vsh@ft\hbox to 0pt{\kern\hsh@ft\image[width\pdfpagewidth height\pdfpageheight]{\BIM@G}\hss}\vss}%
275 \nointerlineskip}\fi
276 \makeheadline
277 \pagebody
278 \makefootline}
279 \advancepageno
280 \ifnum\outputpenalty>-20000\else\dosupereject\fi}
281
282 \def\rm{\fam=0} %% Added 14. September 2010. Use roman font in math.
283
284 %%%
285 %%% Macros for incremental showing of slides (frames).
286 %%% Added 29. March 2012
287 %%%
288 \newcount\ind@x
289 \newcount\m@xind
290 \long\def\Frames#1#2{\m@xind=#1\long\def\Fr@mes{#2}}
291 \def\endFrames{\ind@x=0%
292 \loop\advance\ind@x by 1\begingroup\Fr@mes\endgroup\ifnum\ind@x<\m@xind\NewFrame\repeat}
293 \def\onframe#1#2{\ifnum\ind@x=#1#2\else\relax\fi}
294 \def\afterframe#1#2{\ifnum\ind@x>#1#2\else\relax\fi}
295 \def\beforeframe#1#2{\ifnum\ind@x<#1#2\else\relax\fi}
296 \def\hide{\setcolour\backgroundcolour}
297 \catcode`\@=12