Universe

Create project in app

Full Documentation | Playground

A Typst package for writing exams, quizzes, and homework with automatically numbered questions, answer boxes, points accounting, smart cross-references, and solutions that can be toggled on and off. This package follows the spirit of the exam class for LaTeX.

A quiz with empty answer boxes and multiple-choice bubbles The same quiz compiled with solutions shown

examples/quiz.typ, compiled without and with solutions.

Full documentation is available at the Examy website or downloadable as a PDF. See the examples/ folder for sample documents.

Quick start

A basic document looks like this:

#import "@preview/examy:1.1.0": *

#show: exam.with(show-solutions: false)

// A fill-in block (Name / Student ID) at the top of the page
#{
  set text(font: "DejaVu Sans Mono")
  name-block()
}

#question(points: 2)[
  State the definition of a _continuous function_.
  #answer-box(height: 1fr)[
    #solution[A function $f$ is continuous at $a$ if
      $lim_(x -> a) f(x) = f(a)$.]
  ]
]
#question(points: 3)[
  Give an example of a continuous function that is not
  differentiable.
  #answer-box(height: 2fr)[
    #solution[$f(x) = abs(x)$, at $x = 0$.]
  ]
]

A quick-start template is available by choosing examy under Start from template in the Typst web app or on the command line by running

typst init @preview/examy

Features

  • Questions, parts, and subparts, numbered automatically.
  • Points: points listed on a per-question basis as well as points tables and points per page displays.
  • Answer boxes providing a student with space to write. These can have a fixed size or can use available space via fractional units (e.g. height: 1fr).
  • Solutions: written solutions can be globally toggled as visible/invisible to make answer-key and blank versions of a test.
  • Rubrics: annotate questions and solutions with grading rubrics (positive or negative points), exportable as JSON.
  • Multiple choice with round or square bubbles, optionally enumerated.
  • Smart cross-references: a @name reference to a question will show a minimal string that uniquely identifies the question/part/subpart.
  • Cover pages: basic commands for creating name/exam info areas.
  • Exam metadata: rubrics and where each question is on the page, as JSON or attached to the PDF for grading tools.

Multiple-choice questions with empty round and square bubbles, one per line, in columns, inline, and in a table The same questions with the correct bubbles filled in and checked in blue

Basic API Reference

All names below are exported by #import "@preview/examy:1.1.0": *. See the full reference for all arguments.

Export
#answer-box[..] A box for students to write answers in.
#choice[..] A round or square bubble (used for multiple-choice questions) followed by the choice it labels.
#choices[..] An enumerate environment for multiple-choice answers. Every list item gets turned into a #choice, with a round/square bubble as its list marker.
config Global configuration of package options. Give options to the exam, e.g. #show: exam.with(show-solutions: true), or set them with #show: e.set_(config, show-solutions: true).
e A re-export of elembic, used mainly for e.set_.
#exam[..] Lays out an exam. Start one with #show: exam (or #show: exam.with(..), with config options).
#maketitle(..) The exam title block (in the spirit of LaTeX’s \maketitle). Exam information is read from the global config.
#name-block(..) A block of fill-in rows for a student to write their name.
#points-table(..), #num-points(..), #num-questions() A scoring table, and the exam’s points and number of questions as numbers, which need context (e.g. #context num-points()).
#question[..], #part[..], #subpart[..] Declare a question, part, or subpart — numbered 1., (a), or i. respectively.
#rubric[..], #rubric-list() Grading rubric items for a question, part, or subpart, drawn on the graders’ copy, and every rubric of the exam as a list.
#solution[..] Declare a solution to a question, part, or subpart; this is only rendered if the config option to show solutions is enabled.

License

MIT