Skip to content

Solutions

examst provides three levels of solution/answer-space functionality:

  • solution — Invisible when hidden, shows framed solution when visible.
  • answer — Fixed-height region: fill pattern when hidden, solution when visible.
  • answer-space — Always-visible blank space (not tied to show/hide).

Renders nothing when show-answers is false. When true, renders the solution inside a styled frame.

ParameterTypeDefaultDescription
titlecontent or noneglobal settingContent prepended to the solution
emphasisfunction or noneFunction applied to solution body
framestr, dict, function, or none"boxed", "shaded", "none", or custom
#examst-set(show-answers: true)

#question(points: 5)[
  Why is the sky blue?
  #solution[
    Rayleigh scattering of sunlight by atmospheric molecules.
  ]
]

#examst-reset()

Renders a fixed-height answer region. Layout is stable between modes — the space on the page is consistent whether or not answers are shown.

ParameterTypeDefaultDescription
heightlengthglobal solution-heightHeight of the answer region
fillstr or function"lines"Fill pattern: "lines", "grid", "none", or custom
framestr, dict, or functionFraming style
titlecontent or noneContent prepended when shown
emphasisfunction or noneApplied to solution body
sol-heightnone, auto, or lengthnoneHeight of solution frame when shown
#question(points: 10)[
  Explain the water cycle.
  #answer[
    Evaporation, condensation, precipitation, collection.
  ]
]
#question(points: 10)[
  Draw a diagram of a cell.
  #answer(
    fill: fill-grid.with(spacing: 0.4in),
    frame: (stroke: 0.5pt),
    height: 2in,
  )[
    A labeled diagram of an animal cell.
  ]
]

Renders an always-visible answer space. Not tied to the show-answers toggle — renders unconditionally. Useful for scratch work areas.

ParameterTypeDefaultDescription
heightlengthglobal solution-heightHeight of the space
fillstr or functionFill pattern
framestr, dict, or function"none"Framing style
#answer-space()
#answer-space(fill: fill-grid.with(spacing: 0.45in), height: 1in)
#answer-space(fill: "none", frame: "boxed")

These functions can be used directly or passed as the fill argument:

#fill-lines(height, spacing: 0.33in, stroke: 0.5pt)

Fills vertical space with ruled horizontal lines.

#fill-grid(height, spacing: 5mm, stroke: 0.5pt)

Fills vertical space with a grid of squares. Cell size is adjusted so columns divide the available width evenly.