Skip to content

Instantly share code, notes, and snippets.

@FedericoTartarini
Created June 19, 2022 15:02
Show Gist options
  • Save FedericoTartarini/2a702efb0003061a37777d7d7ea50a66 to your computer and use it in GitHub Desktop.
Save FedericoTartarini/2a702efb0003061a37777d7d7ea50a66 to your computer and use it in GitHub Desktop.
Create an exam with LaTeX using the exam class
\documentclass[addpoints]{exam}
\usepackage{hyperref}
\usepackage{graphicx}
\pagestyle{headandfoot}
\runningheadrule
\firstpageheader{\includegraphics[width=2cm]{LaTeX_logo.png}}
{First Exam}
{June 19, 2022}
\runningheader{Math 115}
{First Exam, Page \thepage\ of \numpages}
{July 10, 2022}
\firstpagefooter{Left}{Center}{}
\runningfooter{All left}{}{Points earned: \makebox[1in]{\hrulefill}
out of a possible \pointsonpage{\thepage} points}
% \pointsinmargin
% \pointsinrightmargin
% \bracketedpoints
% \pointpoints{Punto}{Punti}
% \marksnotpoints
% \printanswers
% \setlength\linefillheight{.15in}
% \qformat{Question \thequestion \dotfill \thepoints}
% change page borders
% \extrawidth{2cm}
% \extraheadheight{1cm}
\newcommand{\tf}[1][{}]{%
\fillin[#1][0.25in]%
}
\begin{document}
\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
Answer the questions in the spaces provided on the
question sheets. If you run out of room for an answer,
continue on the back of the page.}}}
\end{center}
\vspace{0.25cm}
\makebox[\textwidth]{Name and section:\enspace\hrulefill}
\vspace{0.5cm}
\makebox[\textwidth]{Instructor’s name:\enspace\hrulefill}
\begin{center}
This exam has \numquestions\ questions, for a total of \numpoints\
points and \numbonuspoints\ bonus points.
\end{center}
\begin{questions}
\question[1] Simple question with points?
\vspace{1cm}
\question[3\half] In no more than one paragraph, explain why the earth is round.
% \makeemptybox{1in}
\begin{solutionbox}{1in}
The solution
\end{solutionbox}
\question[10] Who discovered America?
\fillwithlines{0.75in}
\bonusquestion[1] On what day of the week did he do it?
\fillwithdottedlines{0.25in}
\bonusquestion[2] What color shirt was he wearing?
\fillwithgrid{1in}
\question What if there were no air?
\begin{parts}
\part[5] Describe the effect on the balloon industry.
\part[5] Describe the effect on the aircraft industry.
\begin{subparts}
\subpart This is a subpart.
\subpart
This is a periscope.
\subpart
This is a pair of diving planes.
\subpart
\begin{subsubparts}
\subsubpart This is a subsubpart.
\subsubpart
The lower surface of a diving plane?
\end{subsubparts}
\end{subparts}
\end{parts}
\droptotalpoints
\newpage
\question
\begin{parts}
\part[10]
Define the universe. Give three examples.
\begin{solution}
The solution
\end{solution}
\part[10]
If the universe were to end, how would you know?
\end{parts}
\droptotalpoints
\vspace{\stretch{2}}
\question[10] Example 1.
\vspace{\stretch{2}}
\question[10] Example 2.
\vspace{\stretch{1}}
\question[10] Example 3.
\vspace{\stretch{1}}
\newpage
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{choices}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates
\end{choices}
\question
One of these things is not like the others; one of these things is not.
\begin{oneparchoices}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates
\end{oneparchoices}
\answerline
\question
What was the color of George Washington’s white horse?
\answerline[white]
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{checkboxes}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates
\end{checkboxes}
\question[20]
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{oneparcheckboxes}
\choice John
\choice Paul
\choice George
\choice Ringo
\CorrectChoice Socrates
\end{oneparcheckboxes}
\question My name is \fillin[Federico][4cm] Tartarini.
\question \tf[T] this statement is correct
% \begin{center}
% \gradetable
% \end{center}
% \begin{center}
% \gradetable[h][pages]
% \end{center}
% \multirowgradetable{3}[questions]
% \combinedgradetable
\begin{center}
\hqword{Domanda Nr.:}
\hpgword{Pagina Nr.:}
\hpword{Punti:}
\htword{\textbf{Somma}}
\hsword{Punteggio:}
\cellwidth{2.2em}
\gradetable[h][pages]
\end{center}
\end{questions}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment