Sarmate.net Sarmate.net
Home Features Pricing Documentation Contact
Log in Sign up
Scientific web 7 min

Presentation blocks — frames and figures

Two main tools to structure your course without overusing the chapter/section hierarchy: the generic <mp-box> case (4 variants) and the <mp-figure> block for numbered figures with captions.

<mp-box> — generic frame

Equivalent to tcolorbox in LaTeX. Four visual variants are available via the style attribute. An optional <mp-title> as first child becomes a colored banner at the top.

VariantUse
accentAccent-colored highlight (default). Good for a central claim, a «to remember» box.
greySoft neutral background. For a contextual note.
infoLeft border in accent color. Blockquote-like, clean and unobtrusive.
subtleDashed border. Very light — good for a side remark or short anecdote.

Variant accent (default)

HTML
<mp-box style="accent">
  <mp-title>To remember</mp-title>
  The derivative measures the rate of change of a function.</mp-box>
Output To remember The derivative measures the rate of change of a function.

Variant info

HTML
<mp-box style="info">
  <mp-title>Tip</mp-title>
  Use $\dfrac$ in inline formulas for better readability.</mp-box>
Output Tip Use $\dfrac$ in inline formulas for better readability.

Variants grey and subtle

HTML
<mp-box style="grey">
  This definition dates back to the 17th century (Newton, Leibniz).</mp-box>

<mp-box style="subtle">
  Anecdote: Newton developed his calculus during the 1665 plague, in isolation.</mp-box>
Output This definition dates back to the 17th century (Newton, Leibniz). Anecdote: Newton developed his calculus during the 1665 plague, in isolation.
Alternative attribute names If the style attribute conflicts with inline CSS, use style-name="info" or data-style="info" instead. The three forms are equivalent.

<mp-figure> + <mp-caption> — figures

A figure groups an image (or an SVG, JSXGraph box…) with an optional caption. When an <mp-caption> is present, mathpad automatically inserts «Figure N — » before the caption and includes it in the automatic list of figures.

HTML
<mp-figure id="fig-parabola">
  <img src="parabole.png" alt="Parabola">
  <mp-caption>Graph of $f(x) = x^2$.</mp-caption>
</mp-figure>
Images from the converter When you convert a .tex with tikz/pstricks/pgfplots figures, the LaTeX→mathpad converter automatically generates one PNG per figure and places it in the same folder as the HTML document (names like cours_tikz_001.png). Nothing else to do.
AttributeValuesDescription
idfreeHTML anchor — required to reference the figure later via <mp-ref target="...">
numberingnoneDisables auto-numbering and inclusion in the list of figures

Reference a figure

Once the figure has an id, use <mp-ref target="..."> to reference it:

HTML
We observe in <mp-ref target="fig-parabola"></mp-ref> a convex curve…

Related tags (reminder)

Three other tags contribute to visual presentation but are documented elsewhere:

Ready to try mathpad?

Create your first interactive scientific HTML document in the online editor, or import your existing LaTeX course in one click.