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