Skip to content

Instantly share code, notes, and snippets.

@KevinGutowski
Created April 5, 2021 23:21
Show Gist options
  • Select an option

  • Save KevinGutowski/176789f5e2dd4d2b5f2927f4e592875e to your computer and use it in GitHub Desktop.

Select an option

Save KevinGutowski/176789f5e2dd4d2b5f2927f4e592875e to your computer and use it in GitHub Desktop.
Example MathML output from KaTeX
<!--
Integration as summation
GS LaTeX Code
$$$
\int_a^bf(x)dx = lim_{n\to\infty}\sum_{r=1}^nhf(a+rh)
$$$
$$$
\text{where} \quad h=\frac{b-a}{n}
$$$
-->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<msubsup>
<mo>∫</mo>
<mi>a</mi>
<mi>b</mi>
</msubsup>
<mi>f</mi>
<mo stretchy="false">(</mo>
<mi>x</mi>
<mo stretchy="false">)</mo>
<mi>d</mi>
<mi>x</mi>
<mo>=</mo>
<mi>l</mi>
<mi>i</mi>
<msub>
<mi>m</mi>
<mrow>
<mi>n</mi>
<mo>→</mo>
<mi mathvariant="normal">∞</mi>
</mrow>
</msub>
<munderover>
<mo>∑</mo>
<mrow>
<mi>r</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</munderover>
<mi>h</mi>
<mi>f</mi>
<mo stretchy="false">(</mo>
<mi>a</mi>
<mo>+</mo>
<mi>r</mi>
<mi>h</mi>
<mo stretchy="false">)</mo>
</mrow>
<annotation encoding="application/x-tex">\int_a^bf(x)dx = lim_{n\to\infty}\sum_{r=1}^nhf(a+rh)</annotation>
</semantics>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<mtext>where</mtext>
<mspace width="1em"></mspace>
<mi>h</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mi>b</mi>
<mo>−</mo>
<mi>a</mi>
</mrow>
<mi>n</mi>
</mfrac>
</mrow>
<annotation encoding="application/x-tex">\text{where} \quad h=\frac{b-a}{n}</annotation>
</semantics>
</math>
<!--
Matrix Multiplication
GS LaTeX Code
$$$
\begin{pmatrix}
2 & 3 & -2 \\
1 & -1 & -3
\end{pmatrix}
\begin{pmatrix}
x_1 \\
x_2 \\
x_3 \\
\end{pmatrix}
=
\begin{pmatrix}
7 \\
5 \\
\end{pmatrix}
$$$
-->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<mrow>
<mo fence="true">(</mo>
<mtable rowspacing="0.15999999999999992em" columnspacing="1em">
<mtr>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<mn>2</mn>
</mstyle>
</mtd>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<mn>3</mn>
</mstyle>
</mtd>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<mrow>
<mo>−</mo>
<mn>2</mn>
</mrow>
</mstyle>
</mtd>
</mtr>
<mtr>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<mn>1</mn>
</mstyle>
</mtd>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<mrow>
<mo>−</mo>
<mn>1</mn>
</mrow>
</mstyle>
</mtd>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<mrow>
<mo>−</mo>
<mn>3</mn>
</mrow>
</mstyle>
</mtd>
</mtr>
</mtable>
<mo fence="true">)</mo>
</mrow>
<mrow>
<mo fence="true">(</mo>
<mtable rowspacing="0.15999999999999992em" columnspacing="1em">
<mtr>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<msub>
<mi>x</mi>
<mn>1</mn>
</msub>
</mstyle>
</mtd>
</mtr>
<mtr>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<msub>
<mi>x</mi>
<mn>2</mn>
</msub>
</mstyle>
</mtd>
</mtr>
<mtr>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<msub>
<mi>x</mi>
<mn>3</mn>
</msub>
</mstyle>
</mtd>
</mtr>
</mtable>
<mo fence="true">)</mo>
</mrow>
<mo>=</mo>
<mrow>
<mo fence="true">(</mo>
<mtable rowspacing="0.15999999999999992em" columnspacing="1em">
<mtr>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<mn>7</mn>
</mstyle>
</mtd>
</mtr>
<mtr>
<mtd>
<mstyle scriptlevel="0" displaystyle="false">
<mn>5</mn>
</mstyle>
</mtd>
</mtr>
</mtable>
<mo fence="true">)</mo>
</mrow>
</mrow>
<annotation encoding="application/x-tex">\begin{pmatrix}
2 &amp; 3 &amp; -2 \\
1 &amp; -1 &amp; -3
\end{pmatrix}
\begin{pmatrix}
x_1 \\
x_2 \\
x_3 \\
\end{pmatrix}
=
\begin{pmatrix}
7 \\
5 \\
\end{pmatrix}</annotation>
</semantics>
</math>
<!--
Quadratic Equation
GS LaTeX Code
$$$x = \frac{-b\pm\sqrt{b^2-4ac}}{2a}$$$
-->
<math xmlns="http://www.w3.org/1998/Math/MathML">
<semantics>
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo>−</mo>
<mi>b</mi>
<mo>±</mo>
<msqrt>
<mrow>
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
<mo>−</mo>
<mn>4</mn>
<mi>a</mi>
<mi>c</mi>
</mrow>
</msqrt>
</mrow>
<mrow>
<mn>2</mn>
<mi>a</mi>
</mrow>
</mfrac>
</mrow>
<annotation encoding="application/x-tex">x = \frac{-b\pm\sqrt{b^2-4ac}}{2a}</annotation>
</semantics>
</math>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment