Skip to content

Creating an HTML document

The automath render html command renders an embedded document as HTML, printed to standard output.

automath render html SOURCE > output.html

SOURCE identifies what to render — see Script references for its full form.

By default the page is static: questions and answers are laid out for printing, with no input fields. This is the same result whether SOURCE is a script (LEVEL/FILE::SCRIPT_NAME, PATH::SCRIPT_NAME) or a snapshot (.atmxs) — a script is simply frozen to a snapshot first.

Pass --interactive to render the live page instead (input fields and answer checking). This requires a script source: a .atmxs snapshot stores only display strings, not the answer-validation data, so --interactive on a snapshot is rejected.

automath render html --interactive SOURCE > output.html

The steps button of the answer key

On the live page, an answer whose question type knows how to detail its calculation carries a small button next to it, in the Answers section. Pressing it opens the whole calculation in a modal — the distribution of an expand_simple, the two products of a multi_expand, the intermediate expression of an order_of_2ops.

The button is there precisely because mental calculation asks for a bare result: the sheet keeps showing one, and the reasoning stays one click away instead of taking up room on the page. It never prints, and it is only drawn where there is something more to show — a question already asked with steps=1 (see Question types) shows its steps in the answer itself, and gets no button.

The width of the answer box

The answer box is not a fixed slot: its width is read off the longest answer of the page, expressed in ch — the width of a digit in the font actually rendering — so it holds whatever that font does. Past a dozen characters the typed text is scaled down, which is what keeps a long answer from crowding the wording out.

Every question of a page gets the same width, so the rule between wording and answers stays a straight line, and a page whose answers are short numbers looks exactly as it always did. An answer in words (digitplace_name: hundreds of thousands) or a polynomial (expand_simple: 24x² − 36x) stays readable in full as it is typed, and so does the answer key.

On a narrow screen the box never takes more than 45 % of the row, and below 768 px it drops under the wording.

How the sheet prints

The page is written to be printed, and three settings of automath.yaml say how — they apply to the PDF only, the screen rendering is left alone:

rendering:
  grid:
    page_margin: "0.75cm"    # margins of the printed sheet
    font_size: "1rem"        # size of the question text on paper
    answer_col_min: "11rem"  # narrowest the answer column may get

page_margin takes one value for all four sides, or "vertical horizontal"; any CSS length is accepted for the three of them.

font_size sizes the question text alone — the title keeps its own size, and the figures drawn inside a wording are sized in em, so they follow the text without any further setting.

answer_col_min is the floor of the answer column described above: it is what a page of short numeric answers gives the pupil to write in. A page whose answers are long gets a wider column, from the answers themselves, and this setting does not cap it.

How an answer is checked

Most question types simply list what they accept, and the typed answer is compared against that list — ignoring spaces, case and accents, so Dixièmes, DIXIEMES and dixiemes all pass, and a result shown as 1 000 matches a typed 1000.

A few answers cannot be listed: every decimal fraction equal to 13/10 is a right answer to 1,3 as a decimal fraction, and there is no end to them. Such a type declares a rule instead, which the page applies to what was typed — frac_decimal, when it asks for a decimal fraction, brings the answer back to its shortest writing and compares that. Where a type declares one, the rule decides on its own: the listed answer is then only the reference one, the shortest way of writing it, and it is what the answer key shows and what the box is sized on.

To list all available embedded documents:

automath show scripts --all
Available embedded documents
fr_FR: 5e/cm1_blanche::S01a
       5e/cm1_blanche::S01b
       5e/cm1_blanche::S01c
       5e/cm1_blanche::S01d
       5e/cm1_blanche::S02a
       5e/cm1_blanche::S02b
       5e/cm1_blanche::addi_subtr
       5e/cm1_blanche::euclidean_division
       5e/cm1_blanche::exam
       5e/cm1_blanche::multiplications
       5e/cm1_blanche::operations_vocabulary
       5e/cm2_jaune::S01a
       5e/cm2_jaune::S01b
       5e/cm2_jaune::S01c
       5e/cm2_jaune::S01d
       5e/cm2_jaune::S02a
       5e/cm2_jaune::S02b
       5e/cm2_jaune::S02c
       5e/cm2_jaune::S02d
       5e/cm2_jaune::S03a
       5e/cm2_jaune::S03b
       5e/cm2_jaune::digitplaces
       5e/cm2_jaune::exam
       5e/cm2_jaune::fractions
       5e/cm2_jaune::multiplications
       5e/cm2_jaune::operations_vocabulary
       5e/cm2_jaune::order_of_ops
       5e/cm2_jaune::units_conversions
       6e/cm1_blanche::W01a
       6e/cm1_blanche::W01b
       6e/cm1_blanche::W01c
       6e/cm1_blanche::W01d
       6e/cm1_blanche::W02a
       6e/cm1_blanche::W02b
       6e/cm1_blanche::exam
       6e/cm1_blanche::multiplications
       6e/cm1_blanche::multiplications_hole
       6e/cm1_blanche::multiplications_reversed
       6e/cm2_jaune::addi_subtr
       6e/cm2_jaune::multiplications
       6e/cm2_jaune::positional_notation
       6e/cm4_verte::divisions
       6e/cm5_bleue::divisions
       6e/cm7_rouge::multiply_by_one_and_a_half
       6e/cm8_noire::multiply_by_one_or_two_and_a_half