forked from smuos/quizzes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quiz.xelatex.template
97 lines (86 loc) · 2.37 KB
/
quiz.xelatex.template
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
% A pandoc template adapted from Dr Driver's standard reading quiz
% https://gist.github.com/danieldriver/90a73c4d3c72dd837e39
% =================================
\documentclass[letterpaper,
$if(answerkey)$
answers,
$endif$
addpoints]{exam}
% For table width scaling
\usepackage{graphicx}
% Quiz metadata
\newcommand\course{$course$}
\newcommand\qznumber{$qznumber$}
\newcommand\qzdate{$qzdate$}
% Header
\pagestyle{head}
\firstpageheader{% left
\liningnums{\course\ --- $qztitle$ Quiz \qznumber} \\
\qzdate
}{% center - blank
}{% right
\ifprintanswers \textbf{Answer Key}
\else Full name:\enspace\makebox[2in]{\hrulefill} \fi \\
This quiz is worth a total of \textbf{\numpoints\ hypothetical points}.
}
\runningheader{}{}{}
% - add \thepage to double-sided quizzes
% \pagestyle{headandfoot}
% \footer{}{\thepage}{}
% Typography and layout
\usepackage{fontspec,realscripts}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Adobe Garamond Pro}
%\setsansfont{Helvetica}
\frenchspacing
% - print solutions in sans serif
\unframedsolutions
\SolutionEmphasis{\sffamily}
\renewcommand{\solutiontitle}{}
% - box points & center in the right margin w/ custom setup@point@toks
\boxedpoints
\pointsinrightmargin
\marginbonuspointname{\textsc{up}}
\makeatletter% rewrite setup@point@toks assuming right margins
\def\clap#1{\hbox to 0pt{\hss#1\hss}}% define \clap as per https://www.tug.org/TUGboat/tb22-4/tb72perlS.pdf
\def\setup@point@toks{%
\point@toks={%
\rlap{\hskip-\@totalleftmargin
\hskip\textwidth
\hskip\@rightmargin
\hskip-\rightpointsmargin
\clap{\padded@point@block}% change \llap to \clap
}%
\global \point@toks={}%
}%
}% end setup@point@toks
\setlength{\rightpointsmargin}{.5in}% assuming the default 1" margins
\makeatother
% - adjust the top and bottom margins
%\extraheadheight{.25in}
\extrafootheight{-.5in}
\setlength{\marginparwidth}{1.5in}
% NB: remember to use \newpage after the last question
% Custom local commands
\newcommand\Lord{\textsc{Lord}}
\begin{document}
% Quiz instructions
\begin{center}
\parbox{5.5in}{\centering\itshape $instructions$}
\end{center}
% Quiz questions
\begin{questions}
$for(question)$
\question[$question.points$]
$question.text$
\begin{solution}[\stretch{1}]
$if(question.answer)$
$question.answer$
$else$
tk
$endif$
\end{solution}
$endfor$
\newpage
\end{questions}
\end{document}