This is a test file for writing mathematical formulas in #NostrMarkup

Silberengel

27. Oktober 2026October 27, 2026 · 2 Min. Lesezeit2 min read

4

This is a test file for writing mathematical formulas in #NostrMarkup

This document demonstrates rendering formulas in TeX/LaTeX notation. It is intended for clients that render TeX with KaTeX/MathJax-style delimiters.

If you want the entire document to be treated as math, put it in a dedicated math/code block. In general, it is better to keep prose as prose and only mark formulas as math.

The general rule is:

TeX Examples#

Inline equation: $E=mc^2$

Same equation in display mode: $$E=mc^2$$

Something more complex, inline: $\sqrt{x^2+1}$ and $\sqrt[3]{27}$

Something complex, in display mode: $$P \left( A=2 \,\middle|\, \dfrac{A^2}{B}>4 \right)$$

Another example: $$\prod_{i=1}^{n} x_i - 1$$

Function example:#

$$
f(x)=
\begin{cases}
\frac{1}{d_{ij}} & \quad \text{when } d_{ij} \leq 160 \\
0 & \quad \text{otherwise}
\end{cases}
$$

And a matrix:

$$
M =
\begin{bmatrix}
\frac{5}{6} & \frac{1}{6} & 0 \\[0.3em]
\frac{5}{6} & 0 & \frac{1}{6} \\[0.3em]
0 & \frac{5}{6} & \frac{1}{6}
\end{bmatrix}
$$

Greek letters are a snap: $\Psi$, $\psi$, $\Phi$, $\phi$.

Equations within text are easy — a well-known Maxwell thermodynamic relation is $\left.\frac{\partial T}{\partial P}\right|{s} = \left.\frac{\partial v}{\partial s}\right|{P}$.

Using the quadratic formula, the roots of $x^2-6x+4=0$ are:

$$x = \frac{6 \pm \sqrt{36-16}}{2}$$

$$x = \frac{6 \pm \sqrt{20}}{2}$$

$$x \approx 0.8 \text{ or } 5.2$$

to 1 decimal place: $$x \approx 0.8 \text{ or } 5.2$$.

Advanced alignment and matrices:#

A $3 \times 3$ matrix:

$$\begin{pmatrix}1&2&3\4&5&6\7&8&9\end{pmatrix}$$

and a $2 \times 1$ vector:

$$\begin{pmatrix}1\0\end{pmatrix}$$

Determinant example:#

$$\begin{vmatrix}a&b\c&d\end{vmatrix}=ad-bc$$

A general $m \times n$ matrix:

$$\begin{pmatrix} a_{11} & \cdots & a_{1n}\ \vdots & \ddots & \vdots\ a_{m1} & \cdots & a_{mn} \end{pmatrix}$$

Mixed Examples#

LaTeX inline: $\frac{1}{2}$

LaTeX display: $$\sum_{i=1}^n x_i$$

LaTeX matrix: $$\begin{pmatrix} a & b \ c & d \end{pmatrix}$$

Edge Cases#

Empty math: $$

Just delimiters: $ $

Dollar signs in text: The price is $10.50

Currency: $19.99

Shell command: echo "Price: $100"

JavaScript template: ``const price = `$${amount}```

CSS with dollar signs: color: $primary-color

This document demonstrates that LaTeX is processed correctly with standard math delimiters.

#latex#nostrmarkup#test#tex

Written by

Comments4

Ingwie Phoenix (aka. birb)

I can see the article in Ditto. But what is NostrMarkup now?
Open in a Nostr client

SilberengelAuthor

The common mark syntax subset we had all agreed to use, along with Nostr addresses, wikilinks, etc.
Open in a Nostr client

SilberengelAuthor

It renders TeX well and AsciiMath sorta-well. But _only_ if added to `inline code`. And no full LaTeX, with typesetting. Just the MathJax set. The typsetting is done in #NostrMarkup or #nup (a simpler, Nostr-y version of GitHub Markdown) or Asciidoc.
Open in a Nostr client

Contents

6 sections

  1. TeX Examples
  2. Function example:
  3. Advanced alignment and matrices:
  4. Determinant example:
  5. Mixed Examples
  6. Edge Cases