-
Notifications
You must be signed in to change notification settings - Fork 0
/
syllabus.cls
482 lines (388 loc) · 14.5 KB
/
syllabus.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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
% A class for producing syllabi.
% Alejandro Pérez Carballo <[email protected]>
%
% ----------------------------------------------------
% Requirements
% ----------------------------------------------------
%
% xelatex
% memoir.cls
% memhfixc.sty
% fontspec.sty
% etoolbox.sty
% xunicode.sty
% advdate.sty, datetime.sty, seqsplit.sty, amsmath.sty, amsthm.sty,
% xspace.sty, xcolor.sty, linguex.sty, textcase.sty, xstring.sty
%
% ----------------------------------------------------------------------------
% Optional
% ----------------------------------------------------------------------------
%
% Fonts: Adobe Minion Pro, Adobe Myriad Pro, and Pragmata Pro.
% biblatex.sty
% ----------------------------------------------------------------------------
% It should be possible to use with bibtex only.
% Some of the custom bibliography settings may need to be commented out.
% ----------------------------------------------------------------------------
\ProvidesClass{syllabus}
\LoadClass[11pt,article]{memoir}
%Load standard packages, fontspec, etc.
\usepackage{fontspec}
\usepackage{etoolbox}
\usepackage{advdate}
\usepackage{datetime}
% \usepackage{datenumber}
\usepackage{amsmath,amsthm}
\usepackage{xunicode}
\usepackage{xspace}
% \usepackage{lineno}
\usepackage{seqsplit}
\usepackage[dvipsnames]{xcolor}
% \usepackage{colornames}
\usepackage{linguex}
\usepackage{hyperref}
\urlstyle{rm}
\usepackage{memhfixc}
\usepackage{textcase}
\usepackage{xstring}
% \settypeblocksize{*}{28pc}{1.62}
% \setlrmargins{*}{*}{1}
% \setlrmargins{*}{*}{2.5}
% \setulmargins{*}{*}{1}
% \setmarginnotes{2pc}{12pc}{\baselineskip}
% \checkandfixthelayout
\let\oldmarginpar\marginpar
\renewcommand\marginpar[1]{\-\oldmarginpar[\raggedleft\scriptsize\itshape #1]%
{\raggedright\scriptsize\itshape #1}}
\setmarginnotes{2pc}{7pc}{\baselineskip}
%% Bibliography options
\usepackage[style=authortitle-comp,sorting=nyt,firstinits,natbib,url=false,doi=false,isbn=false,backend=bibtex]{biblatex}
\renewcommand{\nameyeardelim}{ }
\renewcommand*\bibnamedash{\rule[0.5ex]{23pt}{0.3pt} }
%Clear day, month, and language fields.
\AtEveryBibitem{
\clearfield{day}
\clearfield{month}
\clearfield{endday}
\clearfield{endmonth}
\clearlist{language}
}
%Make references font smaller.
\renewcommand{\bibfont}{\normalfont\small}
\newcommand{\smallcaps}[1]{\textsc{\MakeLowercase{#1}}}
% Remove comma between author and year in citations.
\renewcommand{\nameyeardelim}{ }
% Redefine dash for recurring author to make it longer than an em dash.
\renewcommand*\bibnamedash{\rule[0.5ex]{23pt}{0.3pt} }
% Turn titles into hyperlinks using data from the url field and removes quotation mark around titles in article, incollection, inproceedings, and unpublished. Also, treat thesis title as book title.
% NOTE: To put the quotation marks back on, simply wrap the argument in DeclareFieldFormat within \mkbibquote.
\newbibmacro{string+url}[1]{%
\iffieldundef{url}{#1}{\href{\thefield{url}}{#1}}}
\DeclareFieldFormat{title}{\usebibmacro{string+url}{\mkbibemph{#1}}}
\DeclareFieldFormat[thesis]{title}{\usebibmacro{string+url}{\mkbibemph{#1}}}
\DeclareFieldFormat[article,incollection,inproceedings,unpublished]{title}{\usebibmacro{string+url}{#1}}
% Suppress "In:" for article citations.
\renewbibmacro{in:}{%
\ifentrytype{article}{}{%
\printtext{\bibstring{in}\intitlepunct}}}
%Removes parentheses around year in the bibliography.
\def\act@on@bibmacro#1#2{%
\expandafter#1\csname abx@macro@\detokenize{#2}\endcsname
}
\def\patchbibmacro{\act@on@bibmacro\patchcmd}
\def\pretobibmacro{\act@on@bibmacro\pretocmd}
\def\apptobibmacro{\act@on@bibmacro\apptocmd}
\def\showbibmacro{\act@on@bibmacro\show}
\patchbibmacro{date+extrayear}{%
\printtext[parens]%
}{%
\addperiod\space%
\printtext%
}{}{}
% Turn name+year in citations into hyperlinks (rather than just the year)
\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%
}%
}%
%% A bit more flexibility to avoid overfull boxes
\tolerance=200
\setlength{\emergencystretch}{2em}
\DefineBibliographyStrings{english}{%
references = {Bibliography},% replace "references" with "bibliography"
}
% -------------------------------------------------------------------------
% Typography: Specify your fonts of choice here.
% -------------------------------------------------------------------------
%
%(fold)
\setmainfont[Mapping=tex-text]{Minion Pro}
\setromanfont[Mapping=tex-text,Numbers=OldStyle,Ligatures={Common},SmallCapsFeatures = {LetterSpace=4.0}]{Minion Pro}
\setsansfont[Mapping=tex-text,Scale=MatchLowercase]{Myriad Pro}
\setmonofont[Mapping=tex-text,Scale=MatchLowercase]{PragmataPro}
% \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}{-.75in}
% \renewcommand{\refdash}{}
\makechapterstyle{default}{
\renewcommand\thesection{\arabic{section}}
\setsecheadstyle{\normalsize\scshape\MakeLowercase}
\setsubsecheadstyle{\small\bfseries\sffamily}
\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}
\setcounter{secnumdepth}{-1}
\newcommand{\marginbox}[1]{%
\parbox[t][0pt]{3em}{\bfseries\raggedright\mbox{} \textsf{##1}}}
\newcommand{\marginhead}[1]{%
{\llap{\marginbox{##1}\kern0.5em}}}
\setparaindent{0em}
\setbeforeparaskip{0.5em}
\setafterparaskip{0em}
\setparaheadstyle{\marginhead}
%\setparahook{\setsecnumformat{\csname \cmd1 \endcsname\ }}
% reduce skip after section heading
\setaftersecskip{1.5ex}
% reduce skip around subsection heading
\setaftersubsubsecskip{1.5ex}
\setbeforesubsecskip{3ex}
% set name of bibliography to 'bibliography'
% Title flush left
\pretitle{\vskip 3.25em\flushleft\Large\scshape\MakeLowercase}
\posttitle{\par\vspace{0.75em}}
\preauthor{\flushleft\small \lineskip 1em}
\postauthor{\par\vspace{0em}}
\predate{\vskip 1.75em\flushleft\scriptsize}
\postdate{\par\vskip 1em}
% 'abstract' bigger skip from title
\renewcommand{\abstractname}{\normalfont\scriptsize}
\renewcommand{\abstracttextfont}{\normalfont\scriptsize}
%\abstractrunin
}
%(end)
%(fold)
\makechapterstyle{nodates}{
\renewcommand\thesection{\arabic{section}}
\setsecheadstyle{\large\scshape\MakeLowercase}
\setsubsecheadstyle{\normalsize\bfseries\sffamily}
\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}
\setcounter{secnumdepth}{-1}
\newcommand{\marginbox}[1]{%
\parbox[t][0pt]{4em}{\bfseries\raggedright\mbox{} \textsf{##1}}}
\newcommand{\marginhead}[1]{%
{\llap{\marginbox{##1}\kern0.5em}}}
\setparaindent{0em}
\setbeforeparaskip{0em}
\setafterparaskip{0em}
\setparaheadstyle{\marginhead}
%\setparahook{\setsecnumformat{\csname \cmd1 \endcsname\ }}
% reduce skip after section heading
\setaftersecskip{1.7ex}
% set name of bibliography to 'bibliography'
\renewcommand{\bibname}{\mdseries\Large\scshape\MakeLowercase Bibliography}
% Title flush left
\pretitle{\vskip 5em\flushleft\Large \bfseries}
\posttitle{\par\vspace{0.5em}}
\preauthor{\flushleft\small \lineskip 1em}
\postauthor{\par\vspace{0em}}
\predate{\vskip 0.75em\flushleft\scriptsize}
\postdate{\par\vskip 1.5em}
% '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}{}
\makeevenhead{default}{\scshape\thepage}{}{}
\makeoddhead{default}{}{}{\scshape\thepage}
\makeevenfoot{default}{}{}{\vspace*{-0.5in}{\scriptsize\textsf{\color{Gray} \courseshort \ // \puBa \ -- Last updated: \shorttoday}}}
\makeoddfoot{default}{\vspace*{-0.5in}{\scriptsize\textsf{\color{Gray} \courseshort \ // \puBa \ -- Last updated: \shorttoday}}}{}{}
%%(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}
\newcommand{\frstdy}{}
\newcommand{\firstday}[1]{\renewcommand{\frstdy}{#1}}
% Use for specifying the first day of class.
\renewcommand{\dateseparator}{.}
\AtBeginDocument{
\SaveDate[\hoy]
\SetDate[\frstdy]
}
\newcommand{\shorttoday}{\StrBetween[1,2]{\hoy}{/}{/}.\StrBefore{\hoy}{/}.\StrBehind[2]{\hoy}{/}}
\dmyyyydate
\newcommand{\timestamp}{\shorttoday; \xxivtime}
% ---------------------------------------------------------------------
% Personal information. Redefine accordingly.
% ---------------------------------------------------------------------
\newcommand{\myoffice}{Bartlett 363}
\newcommand{\myhomepage}{\href{http://perezcarballo.org}{perezcarballo.org}}
\newcommand{\coursename}{Course name}
\newcommand{\courseshort}{}
\newcommand{\courseroom}{Room}
\newcommand{\courseweb}{course website}
\newcommand{\myaff}{}
\newcommand{\coursemeetswhen}{}
\newcommand{\coursemeetswhere}{}
\newcommand{\myem}{[email protected]}
\date{{\scriptsize\href{mailto:\myem}{\textsf\myem}}\\[.01em] {\scriptsize{\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{\where}[1]{\renewcommand{\coursemeetswhere}{#1}}
\newcommand{\when}[1]{\renewcommand{\coursemeetswhen}{#1}}
\newcommand{\room}[1]{\renewcommand{\courseroom}{#1}}
\newcommand{\term}[1]{%
\gdef\puBa{#1}
\renewcommand{\maketitlehooka}{%
\par\noindent{\scriptsize\textsf\puBa \ {\color{BrickRed} //} \textsf{\coursemeetswhen,{} \coursemeetswhere}} \\[-.3\baselineskip] \textsf{\color{Gray}\scriptsize\textsf Last updated: \shorttoday}}}
\newcommand{\puBa}{}
\newcommand{\headernote}[1]{%
\gdef\puB{#1}
\renewcommand{\maketitlehooka}{%
\par\noindent{\scriptsize\textsf\puB}}}
\newcommand{\puB}{}
\newcommand{\meetings}{Meetings: \smallcaps{\coursemeetswhen}, \coursemeetswhere}
\newcommand{\coursewebsite}{Course website: \textsf\courseweb}
\newcommand{\summary}[1]{
\vspace{.1\baselineskip}
\noindent
\hangpara{.25in}{0}{\footnotesize #1}
}
\newcommand{\toread}[1]{
\vspace{.2\baselineskip}
\noindent
{\small #1}
}
\newcounter{meeting}
\setcounter{meeting}{0}
\newcounter{week}
\setcounter{week}{0}
\newbool{tues}
\setbool{tues}{true}
\newcommand{\saveddate}{}
\newcommand{\sessionalt}{\paragraph{\color{BrickRed}\scriptsize\noindent Session \themeeting} \stepcounter{meeting}}
\newcommand{\week}{\paragraph{\color{BrickRed}\scriptsize\noindent Week \theweek} \stepcounter{week}}
% \newcommand{\noclass}{
% \ifbool{tues}{\addtocounter{datenumber}{2} \setbool{tues}{false}}{\addtocounter{datenumber}{5}\setbool{tues}{true}} \setdatebynumber{\thedatenumber}}
% {\paragraph{\color{BrickRed}\scriptsize Session \themeeting \stepcounter{meeting}}}
\newcommand{\stamp}[1]{\renewcommand{\timestamp}{#1}}
\newif\if@screen\@screentrue
\newif\if@print\@printtrue
\newif\if@once\@oncetrue
\newif\if@twice\@twicetrue
\DeclareOption{once}{\@oncetrue \@twicefalse}
\DeclareOption{twice}{\@oncefalse \@twicetrue}
\ExecuteOptions{twice}
\DeclareOption{screen}{\@screentrue \@printfalse}
\DeclareOption{print}{\@screenfalse \@printtrue}
\ExecuteOptions{screen}
\DeclareOption*{
\PackageWarning{syllabus}{Unknown option ‘\CurrentOption’}%
}
\ProcessOptions\relax
% ------------------------------------------------------------------------
% Screen option: use colored links.
% Print option: do not use colored links. Best suited for printing in b&w.
% ------------------------------------------------------------------------
\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
% ------------------------------------------------------------------------
% Twice option: For courses meeting twice a week.
% Once option: For courses meeting once a week.
% ------------------------------------------------------------------------
\if@twice
\newcommand{\session}[1]{\paragraph{\color{BrickRed}\scriptsize\twodigits\month.\twodigits\day} {#1}
\ifbool{tues}{\AdvanceDate[2] \setbool{tues}{false}}{\AdvanceDate[5]\setbool{tues}{true}}}
\else\relax
\fi
\if@once
\newcommand{\session}[1]{\paragraph{\color{BrickRed}\scriptsize\twodigits\month.\twodigits\day} {#1}
\AdvanceDate[7]}
\else\relax
\fi
\endinput