-
Notifications
You must be signed in to change notification settings - Fork 2
/
packet.cls
150 lines (126 loc) · 4.1 KB
/
packet.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
% packet.cls
% Typesets quizbowl packets
%
% 2013-03-22
% Ophir Lifshitz
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{packet}[2013/03/22 Typesets quizbowl packets]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax
\LoadClass{article}
% LAYOUT
\RequirePackage{hyperref}
\RequirePackage{xcolor}
%\RequirePackage{showframe}
%\renewcommand\ShowFrameLinethickness{0.3pt}
%\renewcommand\ShowFrameColor{\color{gray!60}}
% PRONUNCIATION GUIDES
\newcommand{\prongray}[1]{{\color{gray!75}{#1}}}
%% transform uppercase to small caps
%% https://tex.stackexchange.com/questions/39831/uppercase-smallcaps-with-latex-not-xelatex
\makeatletter
\newif\ifsc@active
\newif\ifnf@active
\def\upsc#1{{\sc@activefalse\nf@activetrue\@upsc#1\@nil}}
\def\@upsc#1{\ifx#1\@nil\else\@@upsc{#1}\expandafter\@upsc\fi}
\def\@@upsc#1{%
\ifnum\uccode`#1=`#1\relax
\ifsc@active\else\sc@activetrue\nf@activefalse\scshape\fi
\expandafter\@firstoftwo
\else
\ifsc@active\sc@activefalse\fi
\ifnf@active\else\nf@activetrue\normalfont\fi
\expandafter\@secondoftwo
\fi
{\lowercase{#1}}%
{#1}}
\makeatother
%% margin note
\newcommand{\marginfont}{\footnotesize}
\newcommand{\pronsymbol}{\prongray{°}}
\newcommand{\pronnote}[1]{\marginpar{\marginfont{#1}}\pronsymbol}
\newcommand{\pronmargin}[2]{\pronnote{#2}#1}
\newcommand{\pronmargingeom}{left=0.75in,right=1.5in,marginparsep=0.2in,marginparwidth=0.8in}
%% parentheses
\newcommand{\prontheses}[2]{#1 \prongray{[#2]}}
\newcommand{\pronthesesgeom}{hmargin=0.75in}
%% ruby
\RequirePackage[latin]{ruby}
\renewcommand{\rubysize}{0.75}
\renewcommand{\rubysep}{-0.75ex}
\newcommand{\pronruby}[2]{\ruby{#1}{\prongray{\normalfont{#2}}}}
\newcommand{\pronrubygeom}{hmargin=0.75in}
%% set pronunciation guide style
\let\pronstyle\prontheses
\newcommand{\pron}[2]{\pronstyle{#1}{\upsc{#2}}}
\let\geom\pronthesesgeom
\RequirePackage[\geom,vmargin=0.75in]{geometry}
% TYPOGRAPHY
\RequirePackage[normalem]{ulem}
\RequirePackage{newunicodechar}
\newunicodechar{ }{~}
\newunicodechar{ɶ}{\textsc{œ}}
\RequirePackage[log-declarations=false]{xparse}
\RequirePackage{realscripts}
\RequirePackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\newcommand{\myfont}{Lyon Text}
\setmainfont[BoldFont={* Semibold},Numbers={Lining},Ligatures={Common}]{\myfont}
\newcommand{\mymonofont}{TheSansMono}
\setmonofont{\mymonofont}
\newcommand{\powersym}{(*)}% *⁕⁎⋆
\iffontchar\font`☞
\newcommand{\manicule}{☞}
\else
% \RequirePackage{bbding}
% \newcommand{\manicule}{\HandRight}
\newcommand{\manicule}{{\fontsize{14pt}{14pt}\fontspec{Brill}☞}}
\fi
% SEMANTICS
\newenvironment{tossups}{\subsection*{Tossups}\setcounter{question}0}{}
\newenvironment{bonuses}{\subsection*{Bonuses}\setcounter{question}0}{}
\newcounter{question}
\def\claim#1{\par\noindent\hspace{-10mm}\makebox[10mm][r]{#1\enskip}\ignorespaces}
\def\endclaim{\par\medskip}
\newenvironment{lb}{\claim}{\endclaim}
\newenvironment{question}{\begin{lb}{\refstepcounter{question}\arabic{question}.\hyperdef{tossup}{\arabic{question}}{}}}{\end{lb}}
\newcommand{\power}[1]{{\textbf{#1}}}
\newcommand{\req}[1]{{\textbf{\uline{#1}}}}
\newcommand{\answer}[1]{{\textsc{answer}: #1}}
\newcommand{\partvalue}[1]{{[#1]}}
% STRINGS
\newcommand{\tournamentname}{}
\newcommand{\tournamentyear}{}
\newcommand{\subtitle}{}
\newcommand{\packetname}{}
\newcommand{\authors}{}
\newcommand{\packet}{Packet}
\newif\iffirstpacket\firstpacketfalse
\newif\ifnolastpacket\nolastpacketfalse
\newcommand{\lastpacketname}{}
\newcommand{\lastpacketone}{}
\newcommand{\lastpackettwenty}{}
% LEADING, WIDOWS
\linespread{1.3}
\widowpenalties 1 10000
\raggedbottom
% HEADER
\newif\ifstandalonepacket\standalonepackettrue
\renewcommand{\maketitle}{\noindent
\tournamentname{} \tournamentyear{}%
\ifstandalonepacket\else
: \subtitle{}%
\\
\textbf{%{\packet{}} {\packetnumber{}} --- {
\packetname}\\
\authors{}
\medskip
\begin{lb}{\manicule}
Please verify that the last packet was \textit{\lastpacketname}%
\iffirstpacket\else
\ifnolastpacket\else, which began with a tossup on \lastpacketone{} and ended with one on \lastpackettwenty{}%
\fi\fi.
\end{lb}
\fi
}