Skip to content

About

Quarto extension: blank answer space after exercises in PDF output

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

answer-space

A Quarto extension that leaves blank space after each exercise in PDF output, so students can write their answers on a printed copy. HTML output is unchanged.

Installation

quarto add Morrison-Lab/answer-space

This installs the extension in _extensions/Morrison-Lab/answer-space/.

Usage

Add the filter, and set the space once in the document or project metadata:

filters:
  - Morrison-Lab/answer-space
answer-space: 2in

In PDF output, the filter then adds \vspace{2in} after every div whose id starts with exr-.

answer-space takes:

  • a TeX length, such as 2in, 5cm or 30mm;
  • page, to start a new page after each exercise;
  • true, for the default of 2in;
  • false, to add no space, for example in a solution profile.

A missing answer-space key means true. A value that is none of these stops the render with an error, rather than producing a PDF with no room to write.

One exercise

An answer-space attribute on an exercise overrides the default for it:

::: {#exr-write-proof answer-space="4in"}
Prove that ...
:::

The attribute takes the same values as the metadata key. answer-space="0" or "false" gives that exercise no space, and answer-space="page" a new page. answer-space: false in metadata overrides every attribute.

Between the parts of one exercise

The shortcode adds space at any point:

{{< answer-space 1in >}}

With no argument, it uses the metadata default. It adds nothing when the metadata says answer-space: false, and nothing outside PDF output.

How it works

The filter runs at the pre-ast stage, because Quarto turns exercise divs into its own theorem nodes before the default filter stage, where a filter would never see an exr- div.

See example.qmd for a demonstration. It names the filter as answer-space, because it uses this repository's own _extensions/answer-space/ copy; a document in another repository names it Morrison-Lab/answer-space.

About

Quarto extension: blank answer space after exercises in PDF output

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages