Equations
This processor supports MathML equations.
How to Change the Font of MathML Equations
Suppose that you need to change the font of MathML equations from the documentation, and also
add some padding. The MathML fragments are wrapped in elements that have the class
equation-d/equation-block or equation-d/equation-inline,
so you can match them with:
*[class ~="equation-d/equation-block"],
*[class ~="equation-d/equation-inline"]{
font-family:"courier new";
font-size:1.5em;
padding:1em;
}
Note:
An equation can be rendered using multiple classes of fonts (e.g. the serif,
sans serif, monospace, fraktur, and doublestruck classes.
Depending on each of the equation symbols, a class is selected for it. The font specified in
the CSS rule (as in the preceding example), applies only to the serif class. However,
if a symbol codepoint is not covered by the currently selected class fonts, it falls back to
the font specified in the CSS.
Attention:
Some of the fonts may not be supported. In that case, a default
serif font is used.
How to Assign Different Numbering to Figures and Equations
By default, both <fig> and
<equation-figure> elements are numbered as figures. To use a
different type of numbering for equations, use the following rules in your customization CSS:
*[class ~= "equation-d/equation-figure"]:has(*[class ~= "topic/title"]) {
counter-increment: equationcount;
}
*[class ~= "topic/fig"] .fig--title-label {
content: "Figure";
}
*[class ~= "equation-d/equation-figure"] .fig--title-label {
content: "Equation";
}
/* Shallow and Deep Numbering. */
*[class ~= "topic/fig"] .fig--title-label:after {
content: " " counter(figcount) ". ";
}
*[class ~= "equation-d/equation-figure"] .fig--title-label:after {
content: " " counter(equationcount) ". ";
}
/* Deep Chapter Scope and Deep Chapter Scope No Page Reset Numbering. */
*[class ~= "map/map"][numbering ^= 'deep-chapter-scope'] *[class ~= "topic/fig"] > figcaption > .fig--title-label:after {
content: " " counter(chapter) "-" counter(figcount) " ";
}
*[class ~= "map/map"][numbering ^= 'deep-chapter-scope'] *[class ~= "equation-d/equation-figure"] > figcaption > .fig--title-label:after {
content: " " counter(chapter) "-" counter(equationcount) " ";
}
If there are links to these figures/equations, the following rules must also be added:
/* Shallow and Deep Numbering. */
*[class ~= "topic/xref"][href][type = "equation-figure"] {
content: "Equation " target-counter(attr(href), equationcount);
}
*[class ~= "topic/xref"][href][type = "fig"] {
content: "Figure " target-counter(attr(href), figcount);
}
/* Deep Chapter Scope and Deep Chapter Scope No Page Reset Numbering. */
*[class ~= "map/map"][numbering ^= 'deep-chapter-scope'] *[class ~= "topic/xref"][href][type = "equation-figure"] {
content: "Equation " target-counter(attr(href), chapter) "-" target-counter(attr(href), equationcount);
}
*[class ~= "map/map"][numbering ^= 'deep-chapter-scope'] *[class ~= "topic/xref"][href][type = "fig"] {
content: "Figure " target-counter(attr(href), chapter) "-" target-counter(attr(href), figcount);
}