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

Inline formatting — colors, highlight, text size

These mathpad tags inline within a paragraph style a word or expression — text color, highlighter, underline, precise spacing, local size. For styled blocks (definition, theorem, colored box), see the following pages.

<mp-color> — text color

Colors a fragment of text with any CSS color. Handy for a key term to memorize or an instruction to highlight.

AttributeValuesDescription
valueAny CSS colore.g. red, #dc2626, rgb(220,38,38), hsl(0,80%,50%)
HTML
The discriminant <mp-color value="#dc2626">must be positive</mp-color> for two real roots.
Output
The discriminant must be positive for two real roots.
Editor button In the online editor: Format → Colors offers 7 preset colors + a «Custom…» button that opens a full color picker with history of recently used colors.

<mp-highlight> — highlighter

Adds a colored background (felt-pen effect) behind a word. Ideal for a key term to learn or a rule to remember.

AttributeValuesDescription
valueCSS color (preferably light)e.g. #fef3c7 (yellow), #d1fae5 (green), #fce7f3 (pink)
HTML
A <mp-highlight value="#fef3c7">prime number</mp-highlight> is divisible only by 1 and itself.
Output
A prime number is divisible only by 1 and itself.

<mp-underline> — safe underline

Underlines in the theme accent color — 2 px thick, 3 px offset for comfortable reading. Avoids the HTML <u> tag which gets confused with a hyperlink.

HTML
We therefore assume <mp-underline>x positive</mp-underline>.
Output
We therefore assume x positive.

<mp-center> — centered block

Horizontally centers its content — an isolated formula, a figure, a key sentence.

HTML
<mp-center>
  <strong>Remember this formula!</strong>
</mp-center>

<mp-spacer> — inline non-breaking space

Inserts a calibrated horizontal gap — handy to align answers or leave a blank to fill in.

AttributeValuesDescription
nInteger (default 1)Number of spaces to insert
HTML
Answer:<mp-spacer n="5"></mp-spacer>$x = 3$

Text size

mathpad has no dedicated tag — we use <span style="font-size:Nem"> directly, which has the advantage of being very explicit (the user can easily change the size).

In the online editor: Format → Size offers 5 pre-calibrated levels:

HTML
<span style="font-size:1.3em">Important:</span> check the sign before computing.
Output
Important: check the sign before computing.

Combine the tags

These tags can be nested — for instance a highlight inside a color inside a large size:

HTML
<span style="font-size:1.3em">
  <mp-highlight value="#fef3c7">
    <mp-color value="#92400e">Golden rule:</mp-color>
  </mp-highlight> always reason in both directions.
</span>
Output
Golden rule: always reason in both directions.

Ready to try mathpad?

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