Writing Technical Essays with LaTeX

tutorials
latex tutorial

This essay demonstrates how to write technical content with full LaTeX math support.

Inline Mathematics

Write inline math with single dollar signs: f(x)=n=0f(n)(a)n!(xa)nf(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n.

Greek letters work naturally: α,β,γ,δ,ϵ,θ,λ,μ,σ,ϕ,ψ,ω\alpha, \beta, \gamma, \delta, \epsilon, \theta, \lambda, \mu, \sigma, \phi, \psi, \omega.

Display Equations

Use double dollar signs for display mode:

F{f(t)}=f(t)e2πiξtdt\mathcal{F}\{f(t)\} = \int_{-\infty}^{\infty} f(t) e^{-2\pi i \xi t} \, dt

Numbered Equations

For important equations you want to reference:

2ϕ=2ϕx2+2ϕy2+2ϕz2=0(1)\nabla^2 \phi = \frac{\partial^2 \phi}{\partial x^2} + \frac{\partial^2 \phi}{\partial y^2} + \frac{\partial^2 \phi}{\partial z^2} = 0 \tag{1}

Laplace’s equation (1) appears throughout physics.

Aligned Equations

For multi-line derivations:

ddxln(x)=limh0ln(x+h)ln(x)h=limh01hln(x+hx)=limh01hln(1+hx)=1x\begin{aligned} \frac{d}{dx} \ln(x) &= \lim_{h \to 0} \frac{\ln(x+h) - \ln(x)}{h} \\ &= \lim_{h \to 0} \frac{1}{h} \ln\left(\frac{x+h}{x}\right) \\ &= \lim_{h \to 0} \frac{1}{h} \ln\left(1 + \frac{h}{x}\right) \\ &= \frac{1}{x} \end{aligned}

Matrices and Linear Algebra

det(AλI)=det(a11λa12a1na21a22λa2nan1an2annλ)=0\det(A - \lambda I) = \det \begin{pmatrix} a_{11} - \lambda & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} - \lambda & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nn} - \lambda \end{pmatrix} = 0

Theorems and Proofs

Theorem (Fundamental Theorem of Calculus). Let ff be continuous on [a,b][a,b] and let FF be any antiderivative of ff. Then:

abf(x)dx=F(b)F(a)\int_a^b f(x) \, dx = F(b) - F(a)

Proof. Let G(x)=axf(t)dtG(x) = \int_a^x f(t) \, dt. By the first part of the FTC, G(x)=f(x)G'(x) = f(x). Since FF is also an antiderivative, F(x)=G(x)+CF(x) = G(x) + C for some constant. Then F(b)F(a)=G(b)G(a)=abf(t)dt0F(b) - F(a) = G(b) - G(a) = \int_a^b f(t) \, dt - 0. ∎

Physics Examples

Maxwell’s equations in differential form:

E=ρε0(Gauss’s law)B=0(No magnetic monopoles)×E=Bt(Faraday’s law)×B=μ0J+μ0ε0Et(Ampeˋre-Maxwell)\begin{aligned} \nabla \cdot \mathbf{E} &= \frac{\rho}{\varepsilon_0} & \text{(Gauss's law)} \\ \nabla \cdot \mathbf{B} &= 0 & \text{(No magnetic monopoles)} \\ \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} & \text{(Faraday's law)} \\ \nabla \times \mathbf{B} &= \mu_0 \mathbf{J} + \mu_0 \varepsilon_0 \frac{\partial \mathbf{E}}{\partial t} & \text{(Ampère-Maxwell)} \end{aligned}

Machine Learning

The cross-entropy loss for classification:

L(θ)=1Ni=1Nc=1Cyi,clog(y^i,c)\mathcal{L}(\theta) = -\frac{1}{N} \sum_{i=1}^{N} \sum_{c=1}^{C} y_{i,c} \log(\hat{y}_{i,c})

Backpropagation gradient:

Lwjk(l)=Lak(l)ak(l)zk(l)zk(l)wjk(l)=δk(l)aj(l1)\frac{\partial \mathcal{L}}{\partial w_{jk}^{(l)}} = \frac{\partial \mathcal{L}}{\partial a_k^{(l)}} \cdot \frac{\partial a_k^{(l)}}{\partial z_k^{(l)}} \cdot \frac{\partial z_k^{(l)}}{\partial w_{jk}^{(l)}} = \delta_k^{(l)} \cdot a_j^{(l-1)}

Using Images from the Same Folder

Place images in the essay folder and reference them:

![My figure](./figure.png)

For Pure LaTeX Documents

If you prefer writing entire documents in LaTeX, you can:

  1. Write your essay as a .tex file
  2. Use pandoc to convert: pandoc essay.tex -o essay.html --mathjax
  3. Or use the LatexDocument component in MDX

The site supports .mdx files with full JSX capabilities if you need more interactivity.