3 %%% Definitions for IPS course
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesClass{ips}[2001/10/02]
8 %%%----- Document class stuff -----------------------------------------------
10 \newif\ifipsslides \ipsslidesfalse
11 \newif\ifipsanswers \ipsanswerstrue
12 \InputIfFileExists{ips.cfg}\relax\relax
15 \PassOptionsToClass{a4, slidesonly}{seminar}
17 \PassOptionsToClass{a4, article, twoside}{seminar}
19 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{seminar}}
23 %%%----- Required packages --------------------------------------------------
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}
33 \ifx\pdfoutput\@@undefined
34 \PassOptionsToPackage{dvips}{xy}
37 \pdfpagewidth\paperwidth
38 \pdfpageheight\paperheight
40 \pdfpagewidth\paperheight
41 \pdfpageheight\paperwidth
44 \RequirePackage[all]{xy}
46 %%%----- Miscellaneous settings ---------------------------------------------
48 \errorcontextlines=999
50 %%%----- Style choices ------------------------------------------------------
52 \renewcommand{\qedsymbol}{$\square$}
53 \def\hex#1{\texttt{0x#1}}
54 \let\emptystring\lambda
55 \let\epsilon\varepsilon
57 \let\emptyset\varnothing
58 \bibliographystyle{mdwalpha}
61 %%%----- Exercise typesetting -----------------------------------------------
63 \exctrcheck{section}{\answrite{\protect\subsection*{Section \thesection}}}
65 %%%----- Diagram typesetting ------------------------------------------------
70 \setbox\z@\hbox{$\scriptstyle\|$}%
71 \dimen8\ht\z@\advance\dimen8\dp\z@%
72 \mathbin{\xy *=<\dimen8>[o][F]{\box\z@} \endxy}%
75 %%%------ Sectioning and headings -------------------------------------------
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}}
90 \def\sectionmark#1{\markboth{#1}{}}
91 \def\subsectionmark#1{\markright{ -- #1}}
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%
102 \csname #1mark\endcsname{#7}%
103 \csname #1summary\endcsname{#7}%
105 \def\@ssect#1#2#3#4#5{\relax}
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}%
117 \def\subsectionsummary{\sm@auxwrite{subsection}}
118 \def\sm@entry#1#2#3{%
120 \let\protect\@unexpandable@protect%
121 \expandafter\ifx\csname sm@summary@#1\endcsname\relax%
122 \expandafter\let\csname sm@summary@#1\endcsname\@empty%
124 \expandafter\xdef\csname sm@summary@#1\endcsname{%
125 \csname sm@summary@#1\endcsname%
126 \expandafter\protect\csname sm@do#2\endcsname{#3}%
130 \def\sm@dosection#1{%
135 \centerline{\sffamily\bfseries\Large #1 -- overview}
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}}
145 \newcounter{sequence}
146 \def\thesequence{\arabic{sequence}}
147 \def\seq{\stepcounter{sequence}\thesequence}
148 \def\resetseq{\setcounter{sequence}{0}}
150 \def\head#1{{\sffamily\bfseries\large #1}\par}
152 %%%------ Page layout for notes ---------------------------------------------
156 \def\slide@clearpage{\if@nobreak\else\par\penalty\z@\fi}
159 %%%----- Slide layout -------------------------------------------------------
164 \slideplacement{here}
170 \def\slideleftmargin{15mm} \let\sliderightmargin=\slideleftmargin
171 \def\slidetopmargin{15mm} \let\slidebottommargin=\slidetopmargin
173 \def\slidearraystretch{1}
175 %%%----- Hacking xcomment ---------------------------------------------------
177 %%% Supports \xcalways...\x which is an escape from the usual commenting.
180 \catcode`\!=12\catcode`\[=12\catcode`\]=12\catcode`\"=12
181 \lccode`\!=`\\\lccode`\[=`\{\lccode`\]=`\}\lccode`\"=`\%
182 \catcode`\~=\active\lccode`\~=`\^^M
185 %% Hack the main loop code
187 \gdef\xcomment@@@#1\@nil{%
192 \def\next{\xcomment@@#1\@nil}%
194 \xc@checkbegin#1\relax begin[]\relax\relax
196 \xc@checkend#1\relax end[]\relax\relax
198 \xc@checkinput#1\relax input[]\relax\relax
200 \xc@checkinclude#1\relax include[]\relax\relax
202 \xc@checkendinput#1\relax endinputss\relax\relax
204 \xc@checkalways#1\relax xcalwaysfoo!x\relax\relax
208 %% New command support
210 \gdef\xc@checkalways#1xcalways#2!x#3\relax#4\relax{%
215 \toks@{#2}\rescan\toks@%
216 \def\next{\the\toks@\xc@always#3\@nil}%
222 \def\xc@always#1\@nil{\xc@begin#1}
223 \def\xcalways#1\x{#1}
225 %%%----- Bugfix -------------------------------------------------------------
227 \def\@bugfix#1\let\@listi#2#3\@@%
228 {\def\normalsize{#1#3}}
229 \expandafter\@bugfix\normalsize\@@
231 \toks@\expandafter{\slidebox@restore}
232 \edef\slidebox@restore{\the\toks@\advance\topsep\parskip}
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@}
243 \setbox\@slidebox\vbox{%
244 \@begindvi % added 1997/04/15 SPQR
246 \ifvoid\slide@footins\else
247 \vskip\skip\slide@footins
250 \unvbox\slide@footins
256 \setbox\@outputbox \box\@cclv
257 \xdef\@freelist{\@freelist\@midlist}%
258 \global \let \@midlist \@empty
260 \ifvoid\footins \else
261 \setbox\@outputbox \vbox {%
262 \boxmaxdepth \@maxdepth
274 \setbox\@outputbox \vbox to\@colht {%
276 \dimen@ \dp\@outputbox
282 \global \maxdepth \@maxdepth
285 %%%----- That's all, folks --------------------------------------------------