41761fdc |
1 | %%% -*-latex-*- |
2 | %%% |
3 | %%% Definitions for IPS course |
4 | |
76f457cb |
5 | \NeedsTeXFormat{LaTeX2e} |
6 | \ProvidesClass{ips}[2001/10/02] |
7 | |
8 | %%%----- Document class stuff ----------------------------------------------- |
9 | |
10 | \newif\ifipsslides \ipsslidesfalse |
11 | \newif\ifipsanswers \ipsanswerstrue |
12 | \InputIfFileExists{ips.cfg}\relax\relax |
13 | |
14 | \ifipsslides |
15 | \PassOptionsToClass{a4, slidesonly}{seminar} |
16 | \else |
17 | \PassOptionsToClass{a4, article, twoside}{seminar} |
18 | \fi |
19 | \DeclareOption*{\PassOptionsToClass{\CurrentOption}{seminar}} |
20 | \ProcessOptions |
21 | \LoadClass{seminar} |
22 | |
41761fdc |
23 | %%%----- Required packages -------------------------------------------------- |
24 | |
25 | \RequirePackage[palatino, helvetica, courier, maths=cmr]{mdwfonts} |
26 | \RequirePackage{fancyhdr} |
27 | \RequirePackage[T1]{fontenc} |
28 | \RequirePackage{mdwtab, mathenv, crypto, mdwthm, mdwmath} |
29 | \RequirePackage[within=section]{exercise} |
30 | \RequirePackage{amssymb} |
31 | \RequirePackage{url} |
32 | |
33 | \ifx\pdfoutput\@@undefined |
76f457cb |
34 | \PassOptionsToPackage{dvips}{xy} |
41761fdc |
35 | \else |
41761fdc |
36 | \ifarticle |
37 | \pdfpagewidth\paperwidth |
38 | \pdfpageheight\paperheight |
39 | \else |
40 | \pdfpagewidth\paperheight |
41 | \pdfpageheight\paperwidth |
42 | \fi |
43 | \fi |
76f457cb |
44 | \RequirePackage[all]{xy} |
41761fdc |
45 | |
46 | %%%----- Miscellaneous settings --------------------------------------------- |
47 | |
48 | \errorcontextlines=999 |
49 | |
50 | %%%----- Style choices ------------------------------------------------------ |
51 | |
52 | \renewcommand{\qedsymbol}{$\square$} |
53 | \def\hex#1{\texttt{0x#1}} |
54 | \let\emptystring\lambda |
55 | \let\epsilon\varepsilon |
56 | \let\phi\varphi |
57 | \let\emptyset\varnothing |
58 | \bibliographystyle{mdwalpha} |
59 | \sloppy |
60 | |
61 | %%%----- Exercise typesetting ----------------------------------------------- |
62 | |
63 | \exctrcheck{section}{\answrite{\protect\subsection*{Section \thesection}}} |
64 | |
65 | %%%----- Diagram typesetting ------------------------------------------------ |
66 | |
67 | \turnradius={4pt} |
68 | |
69 | \def\ocat{ |
70 | \setbox\z@\hbox{$\scriptstyle\|$}% |
71 | \dimen8\ht\z@\advance\dimen8\dp\z@% |
72 | \mathbin{\xy *=<\dimen8>[o][F]{\box\z@} \endxy}% |
73 | } |
74 | |
75 | %%%------ Sectioning and headings ------------------------------------------- |
76 | |
77 | \ifarticle |
78 | \fancyhf{} |
79 | \fancyhead[LE]{\textbf{\nouppercase{\leftmark}}} |
80 | \fancyhead[RO]{\textbf{\nouppercase{\rightmark}}} |
81 | \fancyfoot[LE, RO]{\thepage} |
82 | \def\headrulewidth{\z@} |
83 | \fancypagestyle{plain}{\fancyhead{}} |
84 | \def\sectionmark#1{\markboth{\thesection.\ #1}{}} |
85 | \def\subsectionmark#1{\markright{\thesubsection.\ #1}} |
86 | \let\emptyslide\relax |
87 | \let\topic\@gobble |
88 | \pagestyle{fancy} |
89 | \else |
90 | \def\sectionmark#1{\markboth{#1}{}} |
91 | \def\subsectionmark#1{\markright{ -- #1}} |
92 | \newcount\@emptyslide |
93 | \newpagestyle{slide}% |
94 | {\ifnum\@emptyslide=\c@slide\else\textbf{\thetitle}\hfil\fi}% |
95 | {\ifnum\@emptyslide=\c@slide\else\leftmark\rightmark\hfil\theslide\fi} |
96 | \slidepagestyle{slide} |
97 | \def\emptyslide{\global\@emptyslide\c@slide}% |
98 | \def\@sect#1#2#3#4#5#6[#7]#8{% |
99 | \ifnum #2>\c@secnumdepth\else% |
100 | \refstepcounter{#1}% |
101 | \fi% |
102 | \csname #1mark\endcsname{#7}% |
103 | \csname #1summary\endcsname{#7}% |
104 | } |
105 | \def\@ssect#1#2#3#4#5{\relax} |
106 | \newtoks\sm@toks |
107 | \newcount\sm@count |
108 | \def\sm@auxwrite#1#2{\immediate\write\@auxout |
109 | {\noexpand\sm@entry{\the\sm@count}{#1}{#2}}} |
110 | \def\sectionsummary{% |
111 | \global\advance\sm@count\@ne% |
112 | \expandafter\let\expandafter\@next% |
113 | \csname sm@summary@\the\sm@count\endcsname% |
114 | \ifx\@next\relax\else\@next\sm@endsummary\fi% |
115 | \sm@auxwrite{section}% |
116 | } |
117 | \def\subsectionsummary{\sm@auxwrite{subsection}} |
118 | \def\sm@entry#1#2#3{% |
119 | \begingroup% |
120 | \let\protect\@unexpandable@protect% |
121 | \expandafter\ifx\csname sm@summary@#1\endcsname\relax% |
122 | \expandafter\let\csname sm@summary@#1\endcsname\@empty% |
123 | \fi% |
124 | \expandafter\xdef\csname sm@summary@#1\endcsname{% |
125 | \csname sm@summary@#1\endcsname% |
126 | \expandafter\protect\csname sm@do#2\endcsname{#3}% |
127 | }% |
128 | \endgroup% |
129 | } |
130 | \def\sm@dosection#1{% |
131 | \begingroup\slide% |
132 | \emptyslide% |
133 | \noindent\vadjust{}% |
134 | \vskip10\p@% |
135 | \centerline{\sffamily\bfseries\Large #1 -- overview} |
136 | \vskip10\p@% |
137 | \begingroup\itemize |
138 | } |
139 | \def\sm@endsummary{\enditemize\endgroup\endslide\endgroup} |
140 | \def\sm@dosubsection#1{\item\relax\@tempswatrue#1} |
141 | \def\sm@dotopic#1{\if@tempswa:\@tempswafalse\else;\fi\space#1} |
142 | \def\topic{\sm@auxwrite{topic}} |
143 | \fi |
144 | |
53aa10b5 |
145 | \newcounter{sequence} |
146 | \def\thesequence{\arabic{sequence}} |
147 | \def\seq{\stepcounter{sequence}\thesequence} |
148 | \def\resetseq{\setcounter{sequence}{0}} |
149 | |
41761fdc |
150 | \def\head#1{{\sffamily\bfseries\large #1}\par} |
151 | |
152 | %%%------ Page layout for notes --------------------------------------------- |
153 | |
154 | \ifarticle |
155 | \raggedbottom |
156 | \def\slide@clearpage{\if@nobreak\else\par\penalty\z@\fi} |
157 | \fi |
158 | |
159 | %%%----- Slide layout ------------------------------------------------------- |
160 | |
161 | \slidewidth=260mm |
162 | \slideheight=160mm |
163 | |
164 | \slideplacement{here} |
165 | \slideframewidth=1pt |
166 | \centerslidesfalse |
167 | |
168 | \def\slidefuzz{20pt} |
169 | |
170 | \def\slideleftmargin{15mm} \let\sliderightmargin=\slideleftmargin |
171 | \def\slidetopmargin{15mm} \let\slidebottommargin=\slidetopmargin |
172 | |
173 | \def\slidearraystretch{1} |
174 | |
175 | %%%----- Hacking xcomment --------------------------------------------------- |
176 | %%% |
177 | %%% Supports \xcalways...\x which is an escape from the usual commenting. |
178 | |
179 | \begingroup |
180 | \catcode`\!=12\catcode`\[=12\catcode`\]=12\catcode`\"=12 |
181 | \lccode`\!=`\\\lccode`\[=`\{\lccode`\]=`\}\lccode`\"=`\% |
182 | \catcode`\~=\active\lccode`\~=`\^^M |
183 | \lowercase{ |
184 | %% |
185 | %% Hack the main loop code |
186 | %% |
187 | \gdef\xcomment@@@#1\@nil{% |
188 | \def\@tempa{#1}% |
189 | \ifx\@tempa\@empty |
190 | \let\next\xcomment@ |
191 | \else |
192 | \def\next{\xcomment@@#1\@nil}% |
193 | \@testtrue |
194 | \xc@checkbegin#1\relax begin[]\relax\relax |
195 | \if@test |
196 | \xc@checkend#1\relax end[]\relax\relax |
197 | \if@test |
198 | \xc@checkinput#1\relax input[]\relax\relax |
199 | \if@test |
200 | \xc@checkinclude#1\relax include[]\relax\relax |
201 | \if@test |
202 | \xc@checkendinput#1\relax endinputss\relax\relax |
203 | \if@test |
204 | \xc@checkalways#1\relax xcalwaysfoo!x\relax\relax |
205 | \fi\fi\fi\fi\fi\fi |
206 | \next} |
207 | %% |
208 | %% New command support |
209 | %% |
210 | \gdef\xc@checkalways#1xcalways#2!x#3\relax#4\relax{% |
211 | \def\@tempa{#1}% |
212 | \ifx\@tempa\@empty% |
213 | \@testfalse% |
214 | \endgroup% |
215 | \toks@{#2}\rescan\toks@% |
216 | \def\next{\the\toks@\xc@always#3\@nil}% |
217 | \fi% |
218 | } |
219 | } |
220 | \endgroup |
221 | |
222 | \def\xc@always#1\@nil{\xc@begin#1} |
223 | \def\xcalways#1\x{#1} |
224 | |
225 | %%%----- Bugfix ------------------------------------------------------------- |
226 | |
227 | \def\@bugfix#1\let\@listi#2#3\@@% |
228 | {\def\normalsize{#1#3}} |
229 | \expandafter\@bugfix\normalsize\@@ |
230 | |
231 | \toks@\expandafter{\slidebox@restore} |
232 | \edef\slidebox@restore{\the\toks@\advance\topsep\parskip} |
233 | |
234 | \ifarticle |
235 | \def\@bugfix#1\penalty\z@#2\@@{\def\outputloop@savedslides{#1#2}} |
236 | \expandafter\@bugfix\outputloop@savedslides\@@ |
237 | \toks@\expandafter{\output@savedslide} |
238 | \def\@strange@hack{\begingroup\output{\unvbox\@cclv}\penalty-\@M\endgroup} |
239 | \edef\output@savedslide{\noexpand\@strange@hack\the\toks@} |
240 | \fi |
241 | |
242 | \def\@makeslide{% |
243 | \setbox\@slidebox\vbox{% |
244 | \@begindvi % added 1997/04/15 SPQR |
245 | \unvbox\@cclv |
246 | \ifvoid\slide@footins\else |
247 | \vskip\skip\slide@footins |
248 | \vfil |
249 | \footnoterule |
250 | \unvbox\slide@footins |
251 | \unskip |
252 | \fi |
253 | \vskip\z@}} |
254 | |
255 | \def\@makecol{% |
256 | \setbox\@outputbox \box\@cclv |
257 | \xdef\@freelist{\@freelist\@midlist}% |
258 | \global \let \@midlist \@empty |
259 | \@combinefloats |
260 | \ifvoid\footins \else |
261 | \setbox\@outputbox \vbox {% |
262 | \boxmaxdepth \@maxdepth |
263 | \unvbox \@outputbox |
264 | \vskip \skip\footins |
265 | \vfil |
266 | \footnoterule |
267 | \unvbox \footins |
268 | \unskip |
269 | }% |
270 | \fi |
271 | \ifvbox\@kludgeins |
272 | \@makespecialcolbox |
273 | \else |
274 | \setbox\@outputbox \vbox to\@colht {% |
275 | \@texttop |
276 | \dimen@ \dp\@outputbox |
277 | \unvbox \@outputbox |
278 | \vskip -\dimen@ |
279 | \@textbottom |
280 | }% |
281 | \fi |
282 | \global \maxdepth \@maxdepth |
283 | } |
284 | |
285 | %%%----- That's all, folks -------------------------------------------------- |
286 | |
287 | \endinput |