Configuration¶
Automathics uses a configuration file for automath.
The default configuration is embedded in the package and can be overridden by
placing a file in one of the following locations (in increasing priority order):
/etc/automathics/automath.yaml(system-wide)~/.config/automathics/automath.yaml(user-level)
Default automath.yaml¶
debug: False
locale: fr_FR
fonts:
mode: embedded # default font-delivery mode for produced HTML:
# embedded (base64 data URI, self-contained), served
# (a static URL; needs served_base_url) or local
# (referenced by name, must be installed). Overridden
# by a font_mode entry in an .atmxs, itself overridden
# by the --font-mode CLI option.
text_name: Ubuntu
text_path: # custom text font file (ttf/otf/woff2); empty = bundled
text_bold_path: # optional bold variant; empty = browser faux-bold
math_name: Automathics
math_path: # custom math font file; empty = bundled
uploaded_dir: # where user-uploaded (private) fonts are stored; empty =
# a fonts/ folder next to the runtime database
max_upload_bytes_total: 262144000 # cap on the uploads dir total size (250 MB;
# POST /fonts is unauthenticated, so uploads are bounded:
# over the cap, least-recently-used fonts are evicted —
# clients re-upload on demand. 0/empty = unlimited.
# Watch usage with `automath fonts list`.
served_base_url: # base URL used by --font-mode served for the @font-face
# src. MUST be absolute (e.g.
# https://your.host/static/fonts/): produced pages are
# often opened from blob:/file:, where a relative URL
# would not resolve. The operator hosts the .woff2 files
# there (nginx static). Trailing slash included; empty
# disables serving (a warning is printed if used anyway).
size: 18.0
math_chars: xyzabcdefghijk
narrow_space_fallback_ratio: 0.498
rendering:
color: "#222222"
slide_number: "#ADADAD"
grid:
# How a grid document prints (its PDF); the screen rendering is left
# alone. Any CSS length is accepted.
# Margins of the printed sheet: one value for all four sides, or
# "vertical horizontal".
page_margin: "0.75cm"
# Size of the question text on paper. The figures drawn inside a wording
# are sized in em, so they follow it.
font_size: "1rem"
# Narrowest the answer column may get - the writing space of a page of
# short numeric answers. A page whose answers are long words gets a wider
# one, from the answers themselves.
answer_col_min: "11rem"
slideshow:
# On-screen base text size for slideshow wordings/answers (any CSS length).
# Per-question override: text_scale (a multiplier of this value).
font_size: "4vw"
# Vertical anchor of the content block (its top edge), as a CSS length.
# Per-question override: raise (lifts the block up by that many %).
content_top: "20%"
# Spacing between wrapped / \n-separated wording lines (CSS line-height).
# Per-question override: line_height.
line_height: 1.3
# Default for pic{}: when true the HTML is self-contained (SVG inlined,
# raster images embedded as base64 data URIs); when false images are
# referenced by their relative file name (the file must ship next to the
# HTML). Per-pic override: include=true|false.
include_pictures: false
fractions:
bar_thickness_ratio: 0.085
bar_pad_v_ratio: 0.12
bar_pad_h_ratio: 0.10
sup:
size_ratio: 0.65
raise_ratio: 0.02
angle:
hat_height_ratio: 0.32
hat_clearance_ratio: 0.06
hat_stroke_ratio: 0.07
ang_stroke_ratio: 0.09
ang_right_margin: 0.84
ang_width: 1.02
ang_gap_ratio: 0.12
tables:
cell_pad_h_ratio: 0.15
cell_pad_v_ratio: 0.15
border_thickness: 1
arrow_gap_ratio: 0.50
arrow_extent_ratio: 1.4
bubble_pad_ratio: 0.1
bubble_auto_resize: 0.7
bubble_thickness: 1.2
arrowhead_size: 6.0
bar_models:
total_width_ratio: 14.0
height_ratio: 1.6
border_thickness: 1
cell_pad_h_ratio: 0.15
cell_pad_v_ratio: 0.15
brace_gap_ratio: 0.25
brace_height_ratio: 0.35
brace_thickness: 1.2
brace_label_gap_ratio: 0.15
# Softness of the corner curls (foot endpoints) and the central cusp.
# 0 = vertical tangents (sharpest); 1 ≈ 45° tangents (softest).
brace_foot_softness: 0.5
brace_cusp_softness: 0.5
# Thickness of the inner sub-grid lines (`split=R×C` option), relative
# to the outer border_thickness. 1.0 = same; <1.0 = lighter ruling.
split_thickness_ratio: 1.0
# Height of a tape (brace_top_style=tape / brace_bot_style=tape),
# relative to the main bar height. 1.0 = same height as the main bar.
tape_height_ratio: 1.0
tape_gap_ratio: 0.0
barchart:
bar_width_ratio: 1.6 # default bar width (× font size)
bar_spacing_ratio: 1.2 # minimum gap between bars (× font size)
max_bar_width_ratio: 3.0 # maximum bar width (× font size)
chart_height_ratio: 9.0 # height of the plotting area (× font size)
bar_color: "#1F5C99" # default inner colour of the bars
axis_thickness: 1.2 # axis stroke width (px)
grid_thickness: 1.0 # grid line stroke width (px)
grid_opacity: 0.6 # default opacity of x_grid / y_grid lines
grid_secondary_opacity: 0.3 # opacity of y_grid lines at unlabelled grads
tick_len_ratio: 0.3 # length of a minor Y tick mark (× font size)
major_tick_len_ratio: 0.55 # length of a labelled Y tick mark (× font size)
tick_spacing_ratio: 0.0 # min spacing between graduations (× font size; 0=off)
label_gap_ratio: 0.25 # gap between axis and labels (× font size)
target_ticks: 5 # targeted number of Y graduations (nice step)
axis:
length_ratio: 15.0 # nominal length of the axis, first to last
# graduation (× font size); what a figure of
# the usual number of graduations takes. It is
# held between the two spacings below, so an
# axis of few graduations comes out shorter
# and one of many comes out longer
thickness: 1.2 # stroke width of the line and graduations (px)
tick_len_ratio: 0.34 # length of a sub-graduation (× font size)
major_tick_len_ratio: 0.62 # length of a written graduation (× font size)
tick_spacing_ratio: 0.6 # closest two consecutive graduations may come
# (× font size); the axis is lengthened rather
# than let them, since an axis is read by
# counting its graduations and a comb is not
# counted (0 = no floor)
max_tick_spacing_ratio: 1.6 # widest they may be spread (× font size); the
# axis is shortened rather than let five
# graduations take the width of twenty
# (0 = no ceiling)
label_gap_ratio: 0.22 # gap between a graduation and its value
# (× font size)
# Size of what is written along an axis (the values of the graduations,
# the names of the points), relative to the text around it — the same
# convention as a polygon's labels.
label_scale: 0.8
point_mark_ratio: 0.42 # size of the cross marking a point
# (× font size)
point_mark_thickness: 1.4 # stroke width of that cross (px)
name_gap_ratio: 0.18 # gap between a point and its name
# (× font size)
arrowhead_ratio: 0.42 # length of the arrowhead (× font size)
end_gap_ratio: 0.9 # blank between the last graduation and the
# arrow tip (× font size)
grids:
cell_size_ratio: 0.8 # side of one cell (× font size)
thickness: 1.0 # stroke width of the ruling (px)
fill_color: "lightgray" # default colour of the coloured cells
# Colour the "complement" strategy paints back over the filled grid:
# it stands for the empty cells, so it must match what the figure sits
# on — white, unless a page says otherwise.
background_color: "white"
polygons:
unit_size_ratio: 1.0 # size of one construction unit (× font size)
thickness: 1.2 # stroke width of the sides (px)
label_gap_ratio: 0.15 # gap between a side and its label (× font size)
# Size of what is written next to a figure (side labels, vertex names,
# centre content), relative to the text around it: the dimensions of a
# figure are written smaller than the wording that carries it.
label_scale: 0.75
vertex_name_gap_ratio: 0.25 # gap between a vertex and its name (× font size)
right_angle_size_ratio: 0.38 # side of the right-angle coding (× font size)
diagonal_dash: "4 3" # dash pattern of a dashed diagonal
side_mark_size_ratio: 0.30 # length of an equal-sides tick (× font size)
side_mark_gap_ratio: 0.11 # spacing between the ticks of a double or
# triple mark, along the side (× font size)
# Construction sizes (in units, i.e. in em of the surrounding text), per
# layout, with the band their width/height ratio is kept within. A grid
# shares its height between a dozen questions, so its figures stay small
# and lie flatter than elsewhere; a slide holds a single one.
build:
grid:
w: [3.0, 4.5]
h: [1.05, 1.25]
ratio: [2.0, 4.0]
page:
w: [9.0, 12.0]
h: [5.0, 7.0]
ratio: [1.3, 2.3]
slide:
w: [4.8, 6.4]
h: [2.8, 4.0]
ratio: [1.3, 2.3]
# How much room a polygon built from its sides may take, per layout.
# Unlike `build` above — which draws a rectangle's two dimensions
# independently, the figure saying nothing about its labels — such a
# polygon is scaled by a single factor: stretching it along one axis would
# undo the equal sides it is labelled with. So these are plain maximum
# extents, and the figure keeps whatever proportions its sides gave it.
# A grid affords more height here than it does to a rectangle: a hexagon
# carrying six labels cannot be made to lie flat.
fit:
grid:
w: 4.6
h: 2.6
page:
w: 11.0
h: 7.0
slide:
w: 6.4
h: 4.2
# A figure carrying a length on every side needs more room than the same
# figure carrying two: the labels sit at the middles of the sides and keep
# their size whatever the drawing does, so on a small polygon they meet.
# A fitted figure is therefore allowed to grow past its band, by steps,
# until nothing written beside it lands on anything else — and no further
# than `max` times the band, past which the crowding is the question's
# fault and not the layout's.
fit_growth:
max: 2.8
step: 0.1
numrange:
threshold: 10000
db:
reset_ratio: 0.66
tracking_max_entries: 100
sources:
generative_cache_size: 20
logging:
log_dir: /var/log/automath
log_level: INFO
max_bytes: 1 # MB
backup_count: 9
log_to_console: True