-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpset.cls
417 lines (359 loc) · 12 KB
/
pset.cls
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\ProvidesClass{pset}
\LoadClass[12pt,oneside,article]{memoir}
%Load standard packages, fontspec, etc.
%Load standard packages, fontspec, etc.
\usepackage{amsmath,amsthm}
\usepackage[MnSymbol]{mathspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{xspace}
\usepackage{lineno}
\usepackage{datetime}
\usepackage{seqsplit}
\usepackage{linguex}
\usepackage{hyperref}
\urlstyle{rm}
% \usepackage{color}
% \usepackage{colornames}
\usepackage[dvipsnames]{xcolor}
\usepackage{memhfixc}
% Bibliography options for biblatex (fold)
%
%
\usepackage[style=authoryear-comp,sorting=nyt,firstinits,natbib,url=false,doi=false,isbn=false]{biblatex}
\renewcommand{\nameyeardelim}{ }
\renewcommand*\bibnamedash{\rule[0.5ex]{23pt}{0.3pt} }
% Turn titles into hyperlinks using data from the url field
\newbibmacro{string+url}[1]{%
\iffieldundef{url}{#1}{\href{\thefield{url}}{#1}}}
\DeclareFieldFormat{title}{\usebibmacro{string+url}{\mkbibemph{#1}}}
\DeclareFieldFormat[article]{title}{\usebibmacro{string+url}{\mkbibquote{#1}}}
% Suppress "In:" for article citations.
\renewbibmacro{in:}{%
\ifentrytype{article}{}{%
\printtext{\bibstring{in}\intitlepunct}}}
% Replace periods with commas in citations.
\renewcommand*{\newunitpunct}{\addcomma\space}
% Turn name+year in citations into hyperlinks (rather than just the year)
% \let\abx@macro@citeOrig\abx@macro@cite
% \renewrobustcmd*\abx@macro@cite[1]{%
% \printtext[bibhyperref]{%
% \let\bibhyperref\relax\relax%
% \abx@macro@citeOrig{#1}%
% }%
% }
% \let\abx@macro@textciteOrig\abx@macro@textcite
% \renewrobustcmd*\abx@macro@textcite[1]{%
% \printtext[bibhyperref]{%
% \let\bibhyperref\relax\relax%
% \abx@macro@citeOrig{#1}%
% }%
% }
\let\abx@macro@citeOrig\abx@macro@cite
\renewbibmacro{cite}{%
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@citeOrig%
}%
}
\let\abx@macro@textciteOrig\abx@macro@textcite
\renewbibmacro{textcite}{%
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@textciteOrig%
}%
}%
% \newtoggle{cbx:hyperref}
% \toggletrue{cbx:hyperref}
%
% \DeclareFieldFormat{bibhyperref}{% Adapted from bibhyperref format in biblatex.def
% \iftoggle{cbx:hyperref}
% {\bibhyperref{#1}}
% {#1}}
%
% \renewbibmacro*{cite}{% Adapted from cite macro in authoryear.cbx
% \printtext[bibhyperref]{% Enclose cite macro output in hyperlink
% \global\togglefalse{cbx:hyperref}% Prevent nested hyperlinks
% \iffieldundef{shorthand}
% {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
% {\usebibmacro{cite:label}%
% \setunit{\addspace}}
% {\printnames{labelname}%
% \setunit{\nameyeardelim}}%
% \usebibmacro{cite:labelyear+extrayear}}
% {\usebibmacro{cite:shorthand}}%
% \global\toggletrue{cbx:hyperref}}}
%
% \DeclareCiteCommand{\textcite}% Adapted from \textcite command in authoryear.cbx
% {\boolfalse{cbx:parens}}
% {\usebibmacro{citeindex}%
% \printtext[bibhyperref]{% Enclose textcite macro output in hyperlink
% \global\togglefalse{cbx:hyperref}% Prevent nested hyperlinks
% \usebibmacro{textcite}%
% \iffieldundef{postnote}% Include closing parenthesis if no postnote
% {\ifbool{cbx:parens}
% {\bibcloseparen\global\boolfalse{cbx:parens}}
% {}}
% {}}%
% \global\toggletrue{cbx:hyperref}}
% {\ifbool{cbx:parens}
% {\bibcloseparen\global\boolfalse{cbx:parens}}
% {}%
% \multicitedelim}
% {\iffieldundef{postnote}
% {}
% {\usebibmacro{textcite:postnote}}}
%
% % Hack? I copied this from authoryear.cbx verbatim and it now seems to work as i wanted. Bizarre.
% \DeclareCiteCommand{\parencite}[\mkbibparens]
% {\usebibmacro{prenote}}
% {\usebibmacro{citeindex}%
% \usebibmacro{cite}}
% {\multicitedelim}
% {\usebibmacro{postnote}}
%
% \DeclareCiteCommand*{\parencite}[\mkbibparens]
% {\usebibmacro{prenote}}
% {\usebibmacro{citeindex}%
% \usebibmacro{citeyear}}
% {\multicitedelim}
% {\usebibmacro{postnote}}
%(end)
%% A bit more flexibility to avoid overfull boxes
\tolerance=200
\setlength{\emergencystretch}{2em}
%Typography
%(fold)
\setmainfont[Mapping=tex-text]{Minion Pro}
\setromanfont[Mapping=tex-text,Numbers=OldStyle,Ligatures={Common}]{Minion Pro}
\setsansfont[Mapping=tex-text,Scale=MatchLowercase]{Myriad Pro}
\setmonofont[Mapping=tex-text,Scale=MatchLowercase]{Inconsolata}
\setmathsfont(Digits,Latin,Greek){Minion Pro}
\setmathsf[Scale=MatchLowercase]{Myriad Pro}
\setmathtt[Scale=MatchLowercase]{Inconsolata}
\setmathbb[Scale=MatchUppercase]{msbm10}
%(end)
\providecommand{\doi}[1]{\href{http://dx.doi.org/#1}{\nolinkurl{doi:#1}}}
\setlength{\droptitle}{-1in}
% \renewcommand{\refdash}{}
%% Make the style for Chapters and sections: handout
%(fold)
\makechapterstyle{default}{
\renewcommand\thesection{\arabic{section}}
\setsecheadstyle{\large\scshape\MakeLowercase}
\setsubsecheadstyle{\normalsize\bfseries}
\setaftersubsubsecskip{-1em}
\setsubsubsecheadstyle{\small\itshape}
\renewcommand{\printchaptername}{}
\renewcommand{\chapternamenum}{}
\renewcommand{\chapnumfont}{\chaptitlefont}
\renewcommand{\printchapternum}{\chapnumfont \thechapter\space}
\renewcommand{\afterchapternum}{}
\renewcommand{\printchaptername}{\secheadstyle}
\renewcommand{\cftchapterfont}{\normalfont}
\renewcommand{\cftchapterpagefont}{\normalfont\scshape}
\renewcommand{\cftchapterpresnum}{\scshape}
%\renewcommand{\cftchapterleader}{}
%\renewcommand{\cftchapterafterpnum}{\cftparfillskip}
\captiontitlefont{\small}
%\settocdepth{chapter}
\maxsecnumdepth{chapter}
\setsecnumdepth{subsection}
% reduce skip after section heading
\setaftersecskip{1.7ex}
\setbeforesecskip{0.5\onelineskip}
% set name of bibliography to 'references'
\renewcommand{\bibname}{\mdseries\large\scshape\MakeLowercase References}
% Title flush left
\pretitle{\flushleft\large\scshape\vspace{.5\baselineskip}\MakeLowercase}
\posttitle{}% \par\vspace{-0.5em}\rule[3pt]{\columnwidth}{.5pt}\vspace{0em}}
\preauthor{\vspace{2pt}\flushleft\textsf\normalsize}
\postauthor{}
\predate{}
\postdate{\vskip1.25em}
% 'abstract' bigger skip from title
\renewcommand{\abstractname}{\normalfont\scriptsize}
\renewcommand{\abstracttextfont}{\normalfont\scriptsize}
%\abstractrunin
}
%(end)
\makepagestyle{default}
\newcommand{\@defaultmarks}{%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\thechapter. \ %
\fi
\fi
##1}{}}
\def\sectionmark##1{%
\markright{##1}}
}
\makepsmarks{default}{\@defaultmarks}
\makepsmarks{default}{}
\makeoddhead{default}{}{}{\scshape\thepage}
\makeevenhead{default}{}{}{\scshape\thepage}
\makeevenfoot{default}{}{}{\vspace{.5in}{\scriptsize\textsf{\color{Gray} \courseshort \ // Problem set \psetnumber}}}
\makeoddfoot{default}{}{}{\vspace{.5in}{\scriptsize\textsf{\color{Gray} \courseshort \ // Problem set \psetnumber}}}
\makepagestyle{nopset}
\newcommand{\@nopsetmarks}{%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\thechapter. \ %
\fi
\fi
##1}{}}
\def\sectionmark##1{%
\markright{##1}}
}
\makepsmarks{nopset}{\@nopsetmarks}
\makepsmarks{nopset}{}
\makeoddhead{nopset}{}{}{\scshape\thepage}
\makeevenhead{nopset}{}{}{\scshape\thepage}
\makeevenfoot{nopset}{}{}{\vskip 3em{\scriptsize\textsf{\color{Gray} \courseshort }}}
\makeoddfoot{nopset}{}{}{\vskip 3em{\scriptsize\textsf{\color{Gray} \courseshort }}}
\makepagestyle{exam}
\newcommand{\@exammarks}{%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\thechapter. \ %
\fi
\fi
##1}{}}
\def\sectionmark##1{%
\markright{##1}}
}
\makepsmarks{exam}{\@exammarks}
\makepsmarks{exam}{}
\makeoddhead{exam}{}{}{\scshape\thepage}
\makeevenhead{exam}{}{}{\scshape\thepage}
\makeevenfoot{exam}{}{}{\vskip 3em{\scriptsize\textsf{\color{Gray} \courseshort \ // \examname }}}
\makeoddfoot{exam}{}{}{\vskip 3em{\scriptsize\textsf{\color{Gray} \courseshort \ // \examname }}}
%%(end)
%% Define timestamp using current time and date.
\def\twodigits#1{\ifnum#1<10 0\fi\the#1}
\newcommand{\shorttoday}{\twodigits\month.\twodigits\day.\hspace{.1em}\number\year}
\dmyyyydate
\newcommand{\timestamp}{\shorttoday; \xxivtime}
\newcommand{\myoffice}{32-D834}
\newcommand{\myhomepage}{\href{http://web.mit.edu/apca/}{web.mit.edu/apca}}
\newcommand{\coursename}{Course name}
\newcommand{\courseshort}{}
\newcommand{\courseroom}{Room}
\newcommand{\courseweb}{course website}
\newcommand{\myaff}{}
\newcommand{\coursemeets}{}
\newcommand{\myem}{apca@mit.edu}
\date{}
\author{}
% \date{{\scriptsize\href{mailto:\myem}{\textsf\myem}}\\[.01em] {\scriptsize\textsc{\MakeTextLowercase\myoffice}}}
% \title{\coursename}
\newcommand{\myaffiliation}[1]{\renewcommand{\myaff}{#1}}
\newcommand{\myemail}[1]{\renewcommand{\myem}{#1}}
\newcommand{\website}[1]{\renewcommand{\courseweb}{\href{#1}{#1}}}
\newcommand{\course}[1]{\renewcommand{\coursename}{{#1}\xspace}}
\newcommand{\courseno}[1]{\renewcommand{\courseshort}{{#1}\xspace}}
\newcommand{\blurb}[1]{\renewcommand{\courseblurb}{#1}}
\newcommand{\meets}[1]{\renewcommand{\coursemeets}{#1}}
\newcommand{\room}[1]{\renewcommand{\courseroom}{#1}}
\newcommand{\term}[1]{%
\gdef\puBa{#1}}
\renewcommand{\maketitlehooka}{%
\par\noindent{\footnotesize\textsf\courseshort \ \also \footnotesize\textsf\puBa }}
\newcommand{\puBa}{}
% \author{\thisterm}
\newcommand{\headernote}[1]{%
\gdef\puB{#1}
\renewcommand{\maketitlehooka}{%
\par\noindent{\scriptsize\textsf\puB}}}
\newcommand{\puB}{}
\newcommand{\meetings}{Meetings: \textsc{\MakeTextLowercase\coursemeets}}
\newcommand{\coursewebsite}{Course website: \textsf\courseweb}
\newcommand{\pset}[1]{\renewcommand{\psetnumber}{#1}}
\newcommand{\psetnumber}{1}
\newcommand{\exam}[1]{\renewcommand{\examname}{#1}}
\newcommand{\examname}{Exam}
% Enumeratable list
\newcounter{probs}
\setcounter{probs}{1}
\newenvironment{problems}{%
\begin{list}{\arabic{probs}.}{%
\setlength{\topsep}{\onelineskip}
\setlength{\partopsep}{0pt}
\setlength{\parsep}{.5em}
\setlength{\itemsep}{.25em}
\setlength{\leftmargin}{0pt}
\setlength{\itemindent}{0pt}
\usecounter{probs}
}
}{\end{list}}
% Itemized list
\newenvironment{items}{%
\begin{list}{\textbullet}{%
\setlength{\topsep}{\onelineskip}
\setlength{\partopsep}{0pt}
\setlength{\parsep}{\parskip}
\setlength{\itemsep}{\parskip}
\setlength{\leftmargin}{0pt}
\setlength{\itemindent}{0pt}
}
}{\end{list}}
\newcommand{\also}{{\color{BrickRed} // }}
\setlength{\marginparsep}{20pt}
\newcommand{\worth}[1]{\sidepar{\color{BrickRed}\textsf{{\scriptsize\vspace{-3.25em}\flushleft (#1)}}}}
\newcommand{\summary}[1]{
\vspace{.1\baselineskip}
\noindent
\hangpara{.25in}{0}{\footnotesize #1}
}
\newcommand{\toread}[1]{
\vspace{.2\baselineskip}
\noindent
\emph{Readings}: {#1}
}
\newcounter{meeting}
\setcounter{meeting}{1}
\newcommand{\session}{\paragraph{\color{BrickRed}\scriptsize Session \themeeting \stepcounter{meeting}}}
\newcommand{\stamp}[1]{\renewcommand{\timestamp}{#1}}
\newif\if@screen\@screentrue
\newif\if@print\@printtrue
\DeclareOption{screen}{\@screentrue \@printfalse}
\DeclareOption{print}{\@screenfalse \@printtrue}
\ExecuteOptions{screen}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}
\ProcessOptions\relax
\if@screen
\hypersetup{breaklinks=true,
colorlinks=true,
linkcolor=BrickRed,
urlcolor=BrickRed,
citecolor=BlueViolet,
plainpages=false,
pdfpagelabels,
bookmarksnumbered,
backref=page}
\else\relax
\fi
\if@print
\hypersetup{breaklinks=true,
colorlinks=false,
linkbordercolor={.8 .1 0},
urlbordercolor={.8 .1 0},
citebordercolor={0 .5 .5},
plainpages=false,
pdfpagelabels,
bookmarksnumbered
}
\else\relax
\fi
\endinput