Help:Contributing/math: Difference between revisions
document MathJax $…$ inline/display math in page text (SimpleMathJax); keep the KaTeX snippet flow (via update-page on MediaWiki MCP Server) |
content policy: most math is in-page $…$ inline / $$…$$ blocks; Special:AddMath reserved for known/named formulas as standalone semantic blocks; no raw ''a''₀-style markup — Power_series as the worked example. AI-assisted (RonzzWikiCowriter). (via update-page on MediaWiki MCP Server) |
||
| Line 2: | Line 2: | ||
* '''Math in page text''' — LaTeX written directly in the wikitext, delimited with <syntaxhighlight lang="wikitext" inline>$…$</syntaxhighlight> (inline) or <syntaxhighlight lang="wikitext" inline>$$…$$</syntaxhighlight> (display); typeset in the browser by MathJax. | * '''Math in page text''' — LaTeX written directly in the wikitext, delimited with <syntaxhighlight lang="wikitext" inline>$…$</syntaxhighlight> (inline) or <syntaxhighlight lang="wikitext" inline>$$…$$</syntaxhighlight> (display); typeset in the browser by MathJax. | ||
* '''Math snippets''' — an expression stored as an [[Help:Contributing/entities|item]] with [[Special:AddMath]], whose embeds render with KaTeX. | * '''Math snippets''' — an expression stored as an [[Help:Contributing/entities|item]] with [[Special:AddMath]], whose embeds render with KaTeX. | ||
== Which one to use == | |||
Math content should '''usually exist as in-page blocks''': <syntaxhighlight lang="wikitext" inline>$…$</syntaxhighlight> for inline math, <syntaxhighlight lang="wikitext" inline>$$…$$</syntaxhighlight> for standalone blocks. Reserve [[Special:AddMath]] (semantic math snippets) for '''known formulas''' — the named, defining results worth citing and reusing — which should always exist as standalone semantic content blocks. | |||
* '''In-page math''' — inline variables and symbols in prose, mathematical demonstrations, worked steps, numerical examples and computations. A worked example is [[Power_series|Power series]]: its general form is a semantic block, while all the demonstrations and numeric examples are in-page <syntaxhighlight lang="wikitext" inline>$$…$$</syntaxhighlight> blocks. | |||
* '''Semantic snippets''' — the general/known formulas of a topic (e.g. the general form of a power series, a named series, a named equation). Create them with [[Special:AddMath]] and embed them on the page with <syntaxhighlight lang="wikitext" inline>{{#content:Q…}}</syntaxhighlight> so they render as standalone blocks. | |||
* '''Never write math as styled text''' — no raw <syntaxhighlight lang="wikitext" inline>''a''₀</syntaxhighlight>, <syntaxhighlight lang="wikitext" inline>''x''²</syntaxhighlight> or <syntaxhighlight lang="wikitext" inline><sup></syntaxhighlight>-subscript markup for mathematics. Use inline math instead: <syntaxhighlight lang="wikitext" inline>$a_0$</syntaxhighlight>, <syntaxhighlight lang="wikitext" inline>$x^2$</syntaxhighlight>. | |||
== Math in page text (MathJax) == | == Math in page text (MathJax) == | ||
| Line 47: | Line 55: | ||
<syntaxhighlight lang="wikitext">price=$5.00</syntaxhighlight> | <syntaxhighlight lang="wikitext">price=$5.00</syntaxhighlight> | ||
== Adding an expression == | == Math snippets (KaTeX, known formulas) == | ||
=== Adding an expression === | |||
Open [[Special:AddMath]] and fill the form: | Open [[Special:AddMath]] and fill the form: | ||
| Line 69: | Line 79: | ||
From the item page, click '''Copy embed code''' and paste the snippet on any page; the expression renders as KaTeX (the raw LaTeX source is shown if JavaScript is unavailable). | From the item page, click '''Copy embed code''' and paste the snippet on any page; the expression renders as KaTeX (the raw LaTeX source is shown if JavaScript is unavailable). | ||
== Editing an expression == | === Editing an expression === | ||
Open the expression's item page and click '''Edit content''' under the title — or go to [[Special:UpdateMath]] with the item's id (e.g. <syntaxhighlight lang="text" inline>Special:UpdateMath/Q100</syntaxhighlight>). The content field shows the stored LaTeX exactly as entered (delimiters stay stripped), and the '''Preview''' button renders it with KaTeX before you save. Fields you leave blank keep their existing values. | Open the expression's item page and click '''Edit content''' under the title — or go to [[Special:UpdateMath]] with the item's id (e.g. <syntaxhighlight lang="text" inline>Special:UpdateMath/Q100</syntaxhighlight>). The content field shows the stored LaTeX exactly as entered (delimiters stay stripped), and the '''Preview''' button renders it with KaTeX before you save. Fields you leave blank keep their existing values. | ||
| Line 75: | Line 85: | ||
== See also == | == See also == | ||
* [[Power_series|Power series]] — worked example of the convention (one semantic general form + in-page <syntaxhighlight lang="wikitext" inline>$…$</syntaxhighlight>/<syntaxhighlight lang="wikitext" inline>$$…$$</syntaxhighlight>) | |||
* [[Help:Contributing/quotation]] — adding quotations | * [[Help:Contributing/quotation]] — adding quotations | ||
* [[Help:Contributing/code]] — code blocks and syntax highlighting | * [[Help:Contributing/code]] — code blocks and syntax highlighting | ||
* [[Help:Contributing/diagrams]] — PlantUML, GraphViz, Mscgen and Mermaid diagrams | * [[Help:Contributing/diagrams]] — PlantUML, GraphViz, Mscgen and Mermaid diagrams | ||
* [[Help:Contributing]] — the hub | * [[Help:Contributing]] — the hub | ||
Latest revision as of 15:53, 4 September 2026
Mathematical expressions can be put on a page in two ways:
- Math in page text — LaTeX written directly in the wikitext, delimited with
$…$(inline) or$$…$$(display); typeset in the browser by MathJax. - Math snippets — an expression stored as an item with Special:AddMath, whose embeds render with KaTeX.
Which one to use
Math content should usually exist as in-page blocks: $…$ for inline math, $$…$$ for standalone blocks. Reserve Special:AddMath (semantic math snippets) for known formulas — the named, defining results worth citing and reusing — which should always exist as standalone semantic content blocks.
- In-page math — inline variables and symbols in prose, mathematical demonstrations, worked steps, numerical examples and computations. A worked example is Power series: its general form is a semantic block, while all the demonstrations and numeric examples are in-page
$$…$$blocks. - Semantic snippets — the general/known formulas of a topic (e.g. the general form of a power series, a named series, a named equation). Create them with Special:AddMath and embed them on the page with
{{#content:Q…}}so they render as standalone blocks. - Never write math as styled text — no raw
''a''₀,''x''²or<sup>-subscript markup for mathematics. Use inline math instead:$a_0$,$x^2$.
Math in page text (MathJax)
Write LaTeX directly in the page text between delimiters:
| Delimiter | What it does |
|---|---|
$…$ |
inline math inside a sentence |
$$…$$ |
display math on its own line, centred |
<math>…</math> |
inline math (tag form — works in templates) |
The famous identity is $e^{i\pi} + 1 = 0$.
Result: The famous identity is $e^{i\pi} + 1 = 0$.
For a formula on its own line, use double dollars:
$$\int_0^1 x^2 \, dx = \frac{1}{3}$$
Result:
$$\int_0^1 x^2 \, dx = \frac{1}{3}$$
Rendering happens in your browser (MathJax). The raw LaTeX source is shown when JavaScript is unavailable or while the page is still loading.
Literal dollar signs
MathJax treats a balanced $…$ pair in prose as math. A lone dollar (prices, amounts) is escaped as \$:
The licence fee is \$5 per copy.
Code stays literal
Code blocks and inline code (Help:Contributing/code) are never typeset — dollars inside them stay literal:
price=$5.00
Math snippets (KaTeX, known formulas)
Adding an expression
Open Special:AddMath and fill the form:
| Field | What it is |
|---|---|
| Label | A short description of the expression (e.g. E = mc² or "Newton's second law").
|
| Content | The LaTeX source. Enclosing delimiters ($…$, $$…$$, \(…\) or \[…\]) are stripped automatically on save — paste from Markdown or MediaWiki as-is.
|
| Describes | Optional: the concept the expression is about — search and pick the entity (several allowed, comma-separated). |
| Attributed to / Source / Date | Provenance, same as quotations. |
Click Preview to render the content with KaTeX before saving (the preview strips the delimiters exactly like the save step).
Saving creates the item and redirects to it.
From the item page, click Copy embed code and paste the snippet on any page; the expression renders as KaTeX (the raw LaTeX source is shown if JavaScript is unavailable).
Editing an expression
Open the expression's item page and click Edit content under the title — or go to Special:UpdateMath with the item's id (e.g. Special:UpdateMath/Q100). The content field shows the stored LaTeX exactly as entered (delimiters stay stripped), and the Preview button renders it with KaTeX before you save. Fields you leave blank keep their existing values.
See also
- Power series — worked example of the convention (one semantic general form + in-page
$…$/$$…$$) - Help:Contributing/quotation — adding quotations
- Help:Contributing/code — code blocks and syntax highlighting
- Help:Contributing/diagrams — PlantUML, GraphViz, Mscgen and Mermaid diagrams
- Help:Contributing — the hub