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.
quarto add Morrison-Lab/answer-spaceThis installs the extension in _extensions/Morrison-Lab/answer-space/.
Add the filter, and set the space once in the document or project metadata:
filters:
- Morrison-Lab/answer-space
answer-space: 2inIn 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,5cmor30mm; page, to start a new page after each exercise;true, for the default of2in;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.
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.
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.
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.