Testing KaTeX Math Rendering
Let’s test if our KaTeX setup is working properly with some mathematical expressions.
Inline Math
Here’s some inline math: E = mc^2 and the quadratic formula x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.
Display Math
The Gaussian integral: \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
Matrix multiplication: \begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix}
Physics Equations
The Schrödinger equation: i\hbar\frac{\partial}{\partial t}\Psi = \hat{H}\Psi
Maxwell’s equations in differential form: \nabla \cdot \mathbf{E} = \frac{\rho}{\epsilon_0} \nabla \times \mathbf{B} - \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t} = \mu_0\mathbf{J}
Complex Examples
The Euler’s identity: e^{i\pi} + 1 = 0
A sum: \sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}
An integral with limits: \int_0^1 x^2 dx = \frac{1}{3}
Testing Sidenotes Implementation
This is a demonstration of proper sidenotes and margin notes implementation, inspired by Gwern.net.
Making use of margins
The margins of the page can be utilized for supplementary information. This allows the main content to flow uninterrupted while providing context or additional details where needed.This is a standard sidenote that appears in the right margin of the document. Sidenotes are numbered sequentially throughout the document. ↩
Margin notes†Unlike sidenotes, margin notes are unnumbered and always appear in the left margin. Margin notes are best used for summarizing adjacent paragraphs or providing small ‘section headers’. are different from sidenotes. Because it’s usually best to keep paragraphs to reasonable widths, documents with sidenotes often have large margins, and these margins can be utilized.
Code Blocks with Syntax Highlighting
Python code should be properly highlighted:
def fibonacci(n):
"""Return the nth Fibonacci number."""
if n <= 0:
return 0
elif n == 1:
return 1
else:
return fibonacci(n-1) + fibonacci(n-2)
# Calculate the first 10 Fibonacci numbers
for i in range(10):
print(f"fibonacci({i}) = {fibonacci(i)}")
Multiple sidenotes in sequence
This paragraph has multiple sidenotes in sequence.[This is the first sidenote in the sequence.][This is the second sidenote in a row.] They should be distributed between the left and right columns based on your implementation.This is the third sidenote, which should appear on the right again if you’re alternating sides. ↩
Block quotes
“If the individual lived five hundred or one thousand years, this clash (between his interests and those of society) might not exist or at least might be considerably reduced. He then might live and harvest with joy what he sowed in sorrow; the suffering of one historical period which will bear fruit in the next one could bear fruit for him too.”
Formatting in sidenotes
It’s important to test that sidenotes can contain rich text formatting.This sidenote contains italic text, bold text, a link to example.com, and inline code
. All of these elements should be preserved in the sidenote. ↩
Math expressions
Inline math E = mc^2 and display math:
f(x) = \int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d\xi
Lists with sidenotes
- First item in an unordered list
- Second item with a sidenoteSidenotes can be attached to list items too. ↩
- Third item
- First item in an ordered list
- Second item
- Third item with a margin note†Margin notes work with ordered lists as well.
Tables
Column 1 | Column 2 | Column 3 |
---|---|---|
Cell 1,1 | Cell 1,2 | Cell 1,3 |
Cell 2,1 | Cell 2,2 | Cell 2,3 |
Cell 3,1 | Cell 3,2 | Cell 3,3 |
Regular footnotes vs. sidenotes
This is a regular footnoteThis is a regular footnote that should appear at the bottom of the page if not transformed by your sidenotes system. ↩ which should appear at the bottom of the page rather than in the margin.
Footnotes
- This is a standard sidenote that appears in the right margin of the document. Sidenotes are numbered sequentially throughout the document. ↩
- This is the third sidenote, which should appear on the right again if you’re alternating sides. ↩
- This sidenote contains italic text, bold text, a link to example.com, and
inline code
. All of these elements should be preserved in the sidenote. ↩ - Sidenotes can be attached to list items too. ↩
- This is a regular footnote that should appear at the bottom of the page if not transformed by your sidenotes system. ↩