Skip to content

CLI Reference

Version

automath, version 0.5.9

Help

Usage: automath [OPTIONS] COMMAND [ARGS]...

  Automathics exercise generator.

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  check   Validate automath expressions.
  fonts   Manage the server-side store of uploaded custom fonts.
  render  Render objects from automathlib.
  show    Show information about automathics resources.

automath render

Usage: automath render [OPTIONS] COMMAND [ARGS]...

  Render objects from automathlib.

Options:
  --help  Show this message and exit.

Commands:
  atmxs      Render SOURCE as a snapshot (.atmxs file).
  html       Render SOURCE as a standalone HTML page.
  svg        Parse an atmxg EXPRESSION and render it as a standalone SVG.
  templates  Output the mail-merge template JSON for an .atmxs file.
  wrappers   Output the mail-merge wrapper JSON (no source needed).

Note To enable autocompletion for the automath command in the bash shell, see installation

automath render html

Usage: automath render html [OPTIONS] SOURCE...

  Render SOURCE as a standalone HTML page.

  SOURCE is one of:

  - an embedded sheet, referenced as LEVEL/FILE::SCRIPT_NAME
  - a standalone script file, referenced as PATH[.yaml|.atmx]::SCRIPT_NAME
  - a snapshot (.atmxs) file (its path, no '::')

  By default the page is laid out statically (questions and answers shown,
  print button only) — the same result as ``render atmxs`` followed by
  ``render html`` on the produced snapshot, whatever the source kind. With
  --interactive the page is the live document instead (input fields and answer
  checking); this needs a script source, since an .atmxs snapshot carries only
  display strings, not the answer-validation data.

      automath render html 6e/cm1_blanche::multiplications     automath render
      html --interactive 6e/cm1_blanche::multiplications     automath render
      html ./my_script::multiplications     automath render html
      worksheet.atmxs

  With --answers: render answers-only HTML from one or more snapshot (.atmxs)
  files, combined into a single page (one printed page per section):

      automath render html --answers a.atmxs b.atmxs

  By default the HTML is printed to stdout (a single source). Use -o FILE to
  write it to a file, or -w to write the HTML next to each .atmxs source (-w
  accepts several .atmxs files; when a source has a valid ``rotate`` entry, -w
  writes ``<stem>0.html`` and ``<stem>1.html``):

      automath render html -w a.atmxs b.atmxs

Options:
  --locale TEXT                   overrides the display locale defined in the
                                  settings
  --sl-locale TEXT                overrides the school-level locale (content
                                  path); defaults to --locale when omitted
  --answers                       render answers-only HTML from one or more
                                  .atmxs files (combined into a single page)
  --interactive                   render the live, interactive page (input
                                  fields + answer checking) instead of the
                                  default static layout; requires a script
                                  source — an .atmxs snapshot has no
                                  validation data and is rejected
  -o, --output FILE               write the HTML to FILE instead of stdout
  -w, --write                     write the HTML next to each .atmxs source
                                  (accepts several .atmxs files)
  --fonts TEXT                    custom fonts for this render: a YAML/JSON
                                  file (or inline JSON) mirroring the fonts:
                                  config block; overrides it
  --font-mode [embedded|served|local]
                                  how fonts are delivered in the HTML:
                                  embedded (base64 data URI, self-contained),
                                  served (a static URL; needs
                                  fonts.served_base_url) or local (referenced
                                  by name, must be installed). Default:
                                  embedded.
  --help                          Show this message and exit.

automath render atmxs

Usage: automath render atmxs [OPTIONS] SOURCE

  Render SOURCE as a snapshot (.atmxs file).

  SOURCE is a script source — either an embedded sheet
  (LEVEL/FILE::SCRIPT_NAME) or a standalone script file
  (PATH[.yaml|.atmx]::SCRIPT_NAME).

  With --font-mode the chosen delivery mode is stamped into the snapshot as a
  ``font_mode`` entry, so a later ``render html`` on it reuses that mode
  unless overridden by its own --font-mode. Without the option no entry is
  written and the config default applies at render time.

      automath render atmxs 6e/cm1_blanche::multiplications     automath
      render atmxs --rotate 6e/cm1_blanche::multiplications     automath
      render atmxs --font-mode local ./my_script::multiplications

Options:
  --locale TEXT                   overrides the display locale defined in the
                                  settings
  --sl-locale TEXT                overrides the school-level locale (content
                                  path); defaults to --locale when omitted
  --rotate                        add a random rotate entry
  -o, --output FILE               write the atmxs to FILE instead of stdout
  --font-mode [embedded|served|local]
                                  how fonts are delivered in the HTML:
                                  embedded (base64 data URI, self-contained),
                                  served (a static URL; needs
                                  fonts.served_base_url) or local (referenced
                                  by name, must be installed). Default:
                                  embedded.
  --help                          Show this message and exit.

automath render svg

Usage: automath render svg [OPTIONS] EXPRESSION...

  Parse an atmxg EXPRESSION and render it as a standalone SVG.

  EXPRESSION is either an atmxg string (default) or one or more .atmxg files.
  File mode is triggered automatically when every argument names an existing
  file. Automathics Graphics Language is the subset of Automathics Markup
  Language that will be rendered graphically as SVG.

  Quote EXPRESSION to preserve spaces, or pass it as multiple arguments (they
  will be joined with a single space):

  automath render svg "1/4 + 3/8 = ?" automath render svg 1/4 + 3/8 = ?
  automath render svg "{x + 1}/4"

  File mode renders each file's expression. A single file without --output-
  dir/--write prints the SVG to stdout. With two or more files, --output-dir
  DIR or --write is required, and stems are printed to stdout as each SVG is
  produced. Per-file locale is derived from the filename suffix (e.g.
  ``foo_fr3.atmxg`` → ``fr``), falling back to --locale otherwise:

  automath render svg pics/frac1.atmxg automath render svg -o out/
  pics/*.atmxg automath render svg --write pics/frac1.atmxg pics/frac2.atmxg

Options:
  --locale TEXT               overrides the locale defined in the settings;
                              used as fallback when a file has no _<locale>
                              suffix  [default: fr_FR]
  -o, --output-dir DIRECTORY  write each <name>.svg into DIR (file mode)
  -w, --write                 write each <name>.svg next to its input file
                              (file mode)
  --fonts TEXT                custom fonts for this render: a YAML/JSON file
                              (or inline JSON) mirroring the fonts: config
                              block; overrides it
  --help                      Show this message and exit.

automath render wrappers

Usage: automath render wrappers [OPTIONS]

  Output the mail-merge wrapper JSON (no source needed).

  The JSON holds the HTML wrapper parts (head, section openers, foot) used to
  assemble mail-merged worksheets. The head embeds the font CSS, so --fonts
  must match the one passed to ``render templates`` for the assembled page to
  use the same fonts.

      automath render wrappers

Options:
  --locale TEXT                   overrides the display locale defined in the
                                  settings
  -o, --output FILE               write the JSON to FILE instead of stdout
  --fonts TEXT                    custom fonts for this render: a YAML/JSON
                                  file (or inline JSON) mirroring the fonts:
                                  config block; overrides it
  --font-mode [embedded|served|local]
                                  how fonts are delivered in the HTML:
                                  embedded (base64 data URI, self-contained),
                                  served (a static URL; needs
                                  fonts.served_base_url) or local (referenced
                                  by name, must be installed). Default:
                                  embedded.
  --help                          Show this message and exit.

automath render templates

Usage: automath render templates [OPTIONS] ATMXS_FILE

  Output the mail-merge template JSON for an .atmxs file.

  ATMXS_FILE is a single .atmxs file. The result is the JSON template (one or
  more templates bundled together) consumed by the mail-merge flow. The
  templates bake math expressions into SVG using the active fonts, so pass the
  same --fonts as ``render wrappers``.

      automath render templates worksheet.atmxs     automath render templates
      worksheet.atmxs -o tmpl.json

Options:
  --locale TEXT      overrides the display locale defined in the settings
  -o, --output FILE  write the JSON to FILE instead of stdout
  --fonts TEXT       custom fonts for this render: a YAML/JSON file (or inline
                     JSON) mirroring the fonts: config block; overrides it
  --help             Show this message and exit.

automath show

Usage: automath show [OPTIONS] COMMAND [ARGS]...

  Show information about automathics resources.

Options:
  --help  Show this message and exit.

Commands:
  automathon_path  Show the path of the automathon dist inside the...
  config           Displays the loaded configuration and highlights the...
  grade-levels     List available school-level folders for a locale as a...
  questions        List the registered question identifiers (one per...
  scripts          List available script references.

automath check

Usage: automath check [OPTIONS] COMMAND [ARGS]...

  Validate automath expressions.

Options:
  --help  Show this message and exit.

Commands:
  qblock  Validate a whole ``questions:`` block (a YAML literal).
  qspec   Validate a question-spec line.

Note See Validating specs for the qspec and qblock subcommands and their batch modes.