Skip to content

Instantly share code, notes, and snippets.

@danieldriver
Created August 19, 2014 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danieldriver/90a73c4d3c72dd837e39 to your computer and use it in GitHub Desktop.
Save danieldriver/90a73c4d3c72dd837e39 to your computer and use it in GitHub Desktop.
LaTeX: Standard Reading Quiz
% -*- program: xelatex -*-
% Dr Driver's standard reading quiz
% =================================
\documentclass[%
% answers,
addpoints]{exam}
% Quiz metadata
\newcommand\course{BSTH 314: Psalms}
\newcommand\qznumber{5}
\newcommand\qzdate{6 October 2014}
% Header
\pagestyle{head}
\firstpageheader{% left
\liningnums{\course\ --- Reading Quiz \qznumber} \\
Dr. Daniel R. Driver, \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\ points}.
}
\runningheader{}{}{}
% - add \thepage to double-sided quizzes
% \pagestyle{headandfoot}
% \footer{}{\thepage}{}
% Typography and layout
\usepackage{fontspec,realscripts}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Scala OT}
\setsansfont{Scala Sans Pro}
\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 Answer each of the following questions in one or two complete sentences.}
\end{center}
% Quiz questions
\begin{questions}
\question[2]
tk
\begin{solution}[\stretch{1}]
tk
\end{solution}
\question[2]
tk
\begin{solution}[\stretch{1}]
tk
\end{solution}
\question[2]
tk
\begin{solution}[\stretch{1}]
tk
\end{solution}
\question[2]
tk
\begin{solution}[\stretch{1}]
tk
\end{solution}
\question[2]
tk
\begin{solution}[\stretch{1}]
tk
\end{solution}
\bonusquestion[2]
tk
\begin{solution}[\stretch{1}]
tk
\end{solution}
\newpage
\end{questions}
\end{document}
@danieldriver
Copy link
Author

Note that XeTeX will be unhappy if you don't have Scala / Scala Sans on your system. TK is journalistic shorthand for "to come" and a rare combination of letters that works well with find+replace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment