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

Sign and variation tables

The web equivalent of tkz-tab (LaTeX). With <mp-vartable> you declare the columns and rows, mathpad draws the arrows cleanly, vertically aligns the symbols, automatically inserts separator bars and «forbidden» double-bars. Native scaling, mobile adaptation via the scale attribute.

Anatomy of a table

A <mp-vartable> contains:

Column count The column count is derived from the abscissa row. All other rows must have the same number of <mp-cell>. If they don't match, alignment breaks — a common pitfall when adding a column without updating all rows.

Sign table

Example: sign of $f'(x) = 2x - 4$.

HTML
<mp-vartable>
  <mp-vartable-abscissa>
    <mp-cell>$x$</mp-cell>
    <mp-cell>$-\infty$</mp-cell>
    <mp-cell></mp-cell>
    <mp-cell>$2$</mp-cell>
    <mp-cell></mp-cell>
    <mp-cell>$+\infty$</mp-cell>
  </mp-vartable-abscissa>
  <mp-vartable-sign>
    <mp-cell>$f'(x)$</mp-cell>
    <mp-cell></mp-cell>
    <mp-cell>$-$</mp-cell>
    <mp-cell>0</mp-cell>
    <mp-cell>$+$</mp-cell>
    <mp-cell></mp-cell>
  </mp-vartable-sign>
</mp-vartable>
Output $x$$-\infty$$2$$+\infty$ $f'(x)$$-$0$+$

Variation table

The three rows top, middle, bottom work together: middle states the arrow direction, top and bottom position the values at the corners the arrow reaches.

HTML
<mp-vartable>
  <mp-vartable-abscissa>
    <mp-cell>$x$</mp-cell>
    <mp-cell>$-\infty$</mp-cell>
    <mp-cell></mp-cell>
    <mp-cell>$2$</mp-cell>
    <mp-cell></mp-cell>
    <mp-cell>$+\infty$</mp-cell>
  </mp-vartable-abscissa>
  <mp-vartable-top>
    <mp-cell>$f(x)$</mp-cell>
    <mp-cell>$+\infty$</mp-cell>
    <mp-cell></mp-cell>
    <mp-cell></mp-cell>
    <mp-cell></mp-cell>
    <mp-cell>$+\infty$</mp-cell>
  </mp-vartable-top>
  <mp-vartable-middle>
    <mp-cell></mp-cell>
    <mp-cell></mp-cell>
    <mp-cell>decreasing</mp-cell>
    <mp-cell></mp-cell>
    <mp-cell>increasing</mp-cell>
    <mp-cell></mp-cell>
  </mp-vartable-middle>
  <mp-vartable-bottom>
    <mp-cell></mp-cell>
    <mp-cell></mp-cell>
    <mp-cell></mp-cell>
    <mp-cell>$-1$</mp-cell>
    <mp-cell></mp-cell>
    <mp-cell></mp-cell>
  </mp-vartable-bottom>
</mp-vartable>
Output $x$$-\infty$$2$$+\infty$ $f(x)$$+\infty$$+\infty$ decreasingincreasing $-1$

Combination: derivative + variation

Classic for a complete function study: one sign row for $f'(x)$, then top/middle/bottom for $f$.

Output (code shorter via the editor — see WYSIWYG tip below) $x$$-\infty$$2$$+\infty$ $f'(x)$$-$0$+$ $f(x)$$+\infty$$+\infty$ decreasingincreasing $-1$

Special markers

In cells of a mp-vartable-sign or middle, some keywords tell mathpad to draw a special shape:

ValueMeaningUsed in
+ or $+$plus signsign
- or $-$minus signsign
0vertical separator bar + zerosign
bar0variant: vertical bar + zero alongside (double-root column)sign
barvertical bar alone (e.g. forbidden value)sign
$0$styled zero WITHOUT separator barsign
forbiddendouble vertical bar (forbidden zone)sign, middle
increasingincreasing arrowmiddle
decreasingdecreasing arrowmiddle
forbidden use case For the function $f(x) = \dfrac{1}{x-2}$: at $x = 2$ forbidden value, hence <mp-cell>forbidden</mp-cell> in the middle row, separating the left and right asymptotes.

scale attribute

Tables sometimes overflow available space. The scale attribute shrinks or enlarges the table without loss of detail (text, padding and arrows scale proportionally).

ValueEffect
number (0.2 → 3)Direct factor. 0.75 mobile-friendly, 1.25 for projector.
compactPreset = 0.75
normalPreset = 1 (default)
largePreset = 1.25
Global scale Instead of scaling each <mp-vartable> individually, set vartable-scale="0.75" on <mp-course> — applies to all tables in the document, overridable per table.
Visual editor in the toolbar Typing a full table by hand is tedious. In the mathpad editor, open the menu Structures → Variation table: pick from 10 templates (sign table, variation table, table with forbidden value…) that the editor inserts directly into your course — you then only have to tweak the $x$ values and function values.

Ready to try mathpad?

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