summaryrefslogtreecommitdiff
path: root/Master/tlpkg/dviout/SPECIAL/presen.sty
blob: 7a26e569857424cea65a08253ebff03b935af37a (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
% dviout version 3.11 or later has "presentation" mode.
% If you want to present something by a computer without
% OHP sheet, lots of presenter used Microsoft PowerPoint.
% It is certainly useful, but week to use mathematical formulas.
% Now you can use dviout instead of PowerPoint.
% This macro package provides interface macros to create
% a dvi file which would be used in the presentation.
% Copyright(C) 2000 by Yoshiki OTOBE.
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{presen}[2000/02/25 v1.0]
\RequirePackage{ophook}

\newif\if@cover \@coverfalse
\newif\if@each  \@eachfalse
\newcounter{@bkmode}\setcounter{@bkmode}{0}
\newcounter{@scmode}\setcounter{@scmode}{0}
\newcounter{@coverpos}\setcounter{@coverpos}{0}
\newif\if@autoprocess \@autoprocessfalse
\newcounter{@pausenum}\setcounter{@pausenum}{0}
\newcounter{@pausesec}\setcounter{@pausesec}{0}
\newcounter{@viewmode}\setcounter{@viewmode}{0}
\newif\if@keepmargin  \@keepmarginfalse
\DeclareOption{cover}{\@covertrue}
\DeclareOption{uncover}{\@coverfalse}
\DeclareOption{whiteback}{\setcounter{@bkmode}{1}}
\DeclareOption{blackback}{\setcounter{@bkmode}{2}}
\DeclareOption{white}{\setcounter{@scmode}{1}}
\DeclareOption{black}{\setcounter{@scmode}{2}}
\DeclareOption{bottom}{\setcounter{@coverpos}{1}}
\DeclareOption{left}{\setcounter{@coverpos}{2}}
\DeclareOption{right}{\setcounter{@coverpos}{3}}
\DeclareOption{bottomleft}{\setcounter{@coverpos}{4}}
\DeclareOption{bottomright}{\setcounter{@coverpos}{5}}
\DeclareOption{each}{\@eachtrue}  %% DONT USE THIS OPTION. FOR FUTURE.
\DeclareOption{auto}{\@autoprocesstrue}
\DeclareOption{noauto}{\@autoprocessfalse}
\DeclareOption{fit}{\setcounter{@viewmode}{1}}
\DeclareOption{full}{\setcounter{@viewmode}{2}}
\DeclareOption{keepmargin}{\@keepmargintrue}
\DeclareOption{adjustmargin}{\@keepmarginfalse}
\ExecuteOptions{uncover,black,bottom,adjustmargin}
\ProcessOptions\relax

\if@keepmargin\else
  \message{Package presen : Paper size will be ignored.^^J%
    use `keepmargin' option if you want to keep the layout.^^J}%
  \topmargin-.5in
  \headheight0pt
  \headsep0pt
  \advance\textwidth2\oddsidemargin
  \advance\textwidth1in
  \oddsidemargin-.5in
  \evensidemargin\oddsidemargin
  \textheight\linewidth
  \paperheight\textheight
  \advance\textheight-.5in
\fi


% If you fing "each" option is implimented, please forget it.
% "each" option requires more complicated implimentation.
\if@autoprocess
  \special{dviout !A}
\fi

\if@each
  \let\put@presentation\AtOutput
\else
  \let\put@presentation\AtBeginDocument
\fi

\if@cover\UseCoverSheet\fi

\ifcase\c@@bkmode
    \special{dviout N0}%
  \or
    \special{dviout N3}%
  \or
    \special{dviout N4}%
\fi

\ifcase\c@@scmode
    \special{dviout N0}%
  \or
    \special{dviout N1}%
  \or
    \special{dviout N2}%
\fi

\ifcase\c@@coverpos
  \or
    \special{dviout N5}%
  \or
    \special{dviout N7}%
  \or
    \special{dviout N6}%
  \or
    \special{dviout N9}%
  \or
    \special{dviout N8}%
\fi

\ifnum\c@@coverpos>0
  \if@cover\else
    \special{dviout NP}%% ??
    \@covertrue
  \fi
\fi

\if@autoprocess
  \ifcase\c@@viewmode
    \special{dviout !p;!b}% go to presentation mode
  \or
    \special{dviout !p;!bdf}%
  \or
    \special{dviout !p;!bdl}%
  \fi
\fi

% cover sheet will be used.
% If you enter "presentation mode" without \Pause,
% hitting [space] bar will...
% 1. show the page with covering.
% 2. show the page with all contents are shown.
% 3. go to next page...
\def\UseCoverSheet{%
  \if@cover\else\special{dviout NO}\fi
  \@covertrue
}

\def\UnuseCoverSheet{%
  \if@cover\special{dviout NF}\fi
  \@coverfalse
}

% cover sheet will be used.
% but the page will be shown as default if there's no \Pause.
\def\PrepareCoverSheet{%
  \if@cover\else\special{dviout NP}\fi
  \@covertrue
}

% we set cover sheet not to be used temporary.
\def\SuspendCoverSheet{%
  \special{dviout !S}%
}

% If cover sheet is not currently used (e.g., after jumping another file
% or another page), come back to memoried page (e.g., the page the cover
% sheet was suspended) and change the mode to use cover sheet.
\def\ReturnToCoverSheet{%
  \special{dviout !C}%
}

\def\SetTimer#1{\setcounter{@pausesec}{#1}}
\def\Pause{%
  \ifnum\count0=1%
    \@latex@warning{The first page may contain a pause special}%
  \fi
  \if@cover\UseCoverSheet\fi
  \special{pause}%
  \addtocounter{@pausenum}{1}%
}
\def\AutoProcess{%
  \if@autoprocess\else\special{dviout !p}\fi
  \@autoprocesstrue
}
\def\NoAutoProcess{\@autoprocessfalse}
\g@addto@macro\@outputpageh@@kE{\@embedpause}
\AtEndDocument{%
  \g@addto@macro\@outputpageh@@kE{\@embedreturntop}%
}

\def\@embedtimer{%
  \ifnum\c@@pausesec>0%
    \special{dviout `timer \the\c@@pausesec\space je}%
  \fi
}

\def\GoTop{%
  \special{dviout `timer 0}%
  \special{dviout jt}%
}

\def\GoNext{%
  \special{dviout `timer 0}%
  \special{dviout je}%
}

\def\Wait#1{%
  \special{dviout `timer #1}%
}

\def\StartPresentation{%
  \ifcase\c@@viewmode
    \special{dviout !p}% go to presentation mode
  \or
    \special{dviout !p;df}%
  \or
    \special{dviout !p;dl}%
  \fi
}

\def\FinishPresentation{%
  \special{dviout !n}%
}

\let\@embedpause\relax
\h@@koutput

\def\define@embed@macro{
  \gdef\@embedreturntop{%
    \if@autoprocess
      \special{dviout `timer 0}%
      \special{dviout jt}%
    \fi
  }%
  \gdef\@embedpause{%
    \ifnum\c@@pausenum=0%
      \if@autoprocess
        \special{pause}%
        \special{dviout `timer 0 je}%
      \fi
    \fi
    \loop\ifnum\c@@pausenum>0%
      \@embedtimer
      \global\advance\c@@pausenum by -1%
    \repeat
    \if@autoprocess
      \special{dviout `timer \the\c@@pausesec\space je}%
    \fi
  }%
}

\define@embed@macro
\endinput