e

exercism

@preview

Organise exercises and defer their solutions.

v1.1.0
MIT

Package Information

Last Updated
Minimum Typst Version
0.15.0
Authors
mkorje
Categories
modelscriptingbook

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/exercism:1.1.0

2. Import in your Typst file

Add this to your .typ file:

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

Version History

1.1.00.15.0
de0acfae4e4a...
1.0.00.13.1
4df2942f9cac...

exercism

A Typst package to organise exercises and defer their solutions.

Example usage

See the manual for more details.

#import "@preview/exercism:1.1.0"

#show ref: exercism.show-ref

#let exercise = exercism.new(
  "exercise",
  supplement: [Exercise],
)

#exercise[Fermat's Last Theorem][
  Prove that $x^n + y^n = z^n$, where $n >= 3$, has no non-trivial solutions $x, y, z in ZZ$.
][
  The truly marvelous proof of this is unable to be contained within this small document.
] <fermat>

See @fermat.

#context exercism.questions("exercise", (
  body,
  supplement,
  number,
  title,
  _,
) => {
  let title = if title != none [(#title)] else []
  block[
    *#supplement #number.* #title
    #body
  ]
})

#exercise[
  Do you love Typst?
][
  Yes!
]

#context exercism.solutions("exercise", (body, _, number, _, _) => {
  block[
    *Exercise #number.*
    #body
  ]
})

Rendered output of the example Typst code

Similar packages

There are a couple similar packages on Typst Universe that might be of interest: stash, exercise-bank, and answerly.