slidev-latex
Render mathematical formulas with LaTeX/KaTeX in Slidev. Use this skill for equations, mathematical notation, and scientific content.
What this skill does
# LaTeX/KaTeX in Slidev
This skill covers rendering mathematical formulas and scientific notation in Slidev using KaTeX, a fast LaTeX math rendering library.
## When to Use This Skill
- Writing mathematical equations
- Scientific presentations
- Technical documentation
- Academic content
- Physics, chemistry, or engineering formulas
## Basic Syntax
### Inline Math
Surround with single `$`:
```markdown
The quadratic formula is $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$ where $a \neq 0$.
```
### Block Math
Surround with double `$$`:
```markdown
$$
E = mc^2
$$
```
Or with line breaks:
```markdown
$$
\begin{aligned}
f(x) &= x^2 + 2x + 1 \\
&= (x + 1)^2
\end{aligned}
$$
```
## Common Mathematical Notations
### Fractions
```markdown
Simple: $\frac{a}{b}$
Nested: $\frac{1}{\frac{a}{b} + c}$
Display: $$\frac{x^2 + y^2}{z}$$
```
### Exponents and Subscripts
```markdown
Exponent: $x^2$, $e^{i\pi}$
Subscript: $x_1$, $a_{ij}$
Combined: $x_1^2$, $a_{ij}^{n+1}$
```
### Square Roots
```markdown
Simple: $\sqrt{x}$
N-th root: $\sqrt[n]{x}$
Complex: $\sqrt{x^2 + y^2}$
```
### Greek Letters
```markdown
Lowercase: $\alpha$, $\beta$, $\gamma$, $\delta$, $\epsilon$, $\theta$, $\lambda$, $\mu$, $\pi$, $\sigma$, $\omega$
Uppercase: $\Gamma$, $\Delta$, $\Theta$, $\Lambda$, $\Pi$, $\Sigma$, $\Omega$
```
### Operators
```markdown
Sum: $\sum_{i=1}^{n} x_i$
Product: $\prod_{i=1}^{n} x_i$
Integral: $\int_{a}^{b} f(x) \, dx$
Double integral: $\iint_D f(x,y) \, dA$
Limit: $\lim_{x \to \infty} f(x)$
```
## Equations and Formulas
### Famous Equations
```markdown
$$
\text{Euler's Identity: } e^{i\pi} + 1 = 0
$$
$$
\text{Pythagorean: } a^2 + b^2 = c^2
$$
$$
\text{Einstein: } E = mc^2
$$
$$
\text{Schrödinger: } i\hbar\frac{\partial}{\partial t}\Psi = \hat{H}\Psi
$$
```
### Systems of Equations
```markdown
$$
\begin{cases}
x + y = 10 \\
2x - y = 5
\end{cases}
$$
```
### Aligned Equations
```markdown
$$
\begin{aligned}
(x + y)^2 &= x^2 + 2xy + y^2 \\
(x - y)^2 &= x^2 - 2xy + y^2 \\
(x + y)(x - y) &= x^2 - y^2
\end{aligned}
$$
```
### Matrices
```markdown
$$
A = \begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
$$
$$
B = \begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}
$$
$$
\det(A) = \begin{vmatrix}
a & b \\
c & d
\end{vmatrix} = ad - bc
$$
```
## Mathematical Symbols
### Comparison
```markdown
$<$, $>$, $\leq$, $\geq$, $\neq$, $\approx$, $\equiv$, $\sim$
```
### Logic
```markdown
$\forall$ (for all), $\exists$ (exists), $\neg$ (not)
$\land$ (and), $\lor$ (or), $\Rightarrow$ (implies)
```
### Sets
```markdown
$\in$ (in), $\notin$ (not in), $\subset$, $\subseteq$
$\cup$ (union), $\cap$ (intersection)
$\emptyset$ (empty set), $\mathbb{R}$ (reals), $\mathbb{N}$ (naturals)
```
### Calculus
```markdown
$\frac{dy}{dx}$, $\frac{\partial f}{\partial x}$
$\nabla f$, $\nabla \cdot F$, $\nabla \times F$
```
### Arrows
```markdown
$\rightarrow$, $\leftarrow$, $\leftrightarrow$
$\Rightarrow$, $\Leftarrow$, $\Leftrightarrow$
$\mapsto$, $\to$
```
## Advanced Features
### Line Highlighting in Math
````markdown
$$ {1|3|all}
\begin{aligned}
f(x) &= x^2 \\ // Click 1
f'(x) &= 2x \\ // Click 1
f''(x) &= 2 // Click 2
\end{aligned}
$$
````
### Custom Colors
```markdown
$$
{\color{red} x^2} + {\color{blue} y^2} = {\color{green} z^2}
$$
```
### Boxed Formulas
```markdown
$$
\boxed{E = mc^2}
$$
```
### Text in Math
```markdown
$$
f(x) = \begin{cases}
x & \text{if } x \geq 0 \\
-x & \text{otherwise}
\end{cases}
$$
```
## Chemistry Formulas
Enable mhchem extension in `vite.config.ts`:
```typescript
import 'katex/contrib/mhchem'
export default {}
```
Then use:
```markdown
$$\ce{H2O}$$
$$\ce{2H2 + O2 -> 2H2O}$$
$$\ce{CO2 + C -> 2CO}$$
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
```
## Physics Formulas
### Mechanics
```markdown
$$
F = ma \quad \text{(Newton's Second Law)}
$$
$$
W = \int_a^b \vec{F} \cdot d\vec{s}
$$
$$
KE = \frac{1}{2}mv^2
$$
```
### Electromagnetism
```markdown
$$
\vec{F} = q(\vec{E} + \vec{v} \times \vec{B})
$$
$$
\nabla \cdot \vec{E} = \frac{\rho}{\epsilon_0}
$$
```
### Quantum Mechanics
```markdown
$$
\hat{p} = -i\hbar\frac{\partial}{\partial x}
$$
$$
\Delta x \cdot \Delta p \geq \frac{\hbar}{2}
$$
```
## Statistics
```markdown
$$
\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i
$$
$$
\sigma^2 = \frac{1}{n}\sum_{i=1}^{n}(x_i - \bar{x})^2
$$
$$
P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}
$$
```
## Machine Learning
```markdown
$$
J(\theta) = -\frac{1}{m}\sum_{i=1}^{m}[y^{(i)}\log(h_\theta(x^{(i)})) + (1-y^{(i)})\log(1-h_\theta(x^{(i)}))]
$$
$$
\text{softmax}(z_i) = \frac{e^{z_i}}{\sum_{j=1}^{K} e^{z_j}}
$$
$$
\nabla_\theta J(\theta) = \frac{1}{m} X^T (h_\theta(X) - y)
$$
```
## Best Practices
### 1. Keep Formulas Readable
❌ **Too dense**
```markdown
$\frac{\frac{a}{b}+\frac{c}{d}}{\frac{e}{f}-\frac{g}{h}}$
```
✓ **Broken into steps**
```markdown
Let $x = \frac{a}{b} + \frac{c}{d}$ and $y = \frac{e}{f} - \frac{g}{h}$
Then the result is $\frac{x}{y}$
```
### 2. Use Display Mode for Complex Formulas
❌ **Complex inline**
```markdown
The integral $\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$ is fundamental.
```
✓ **Display mode**
```markdown
The Gaussian integral:
$$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$
```
### 3. Add Context
```markdown
**Theorem**: For any triangle with sides $a$, $b$, $c$:
$$a^2 + b^2 = c^2$$
*where $c$ is the hypotenuse.*
```
### 4. Use Aligned for Multi-Step
```markdown
$$
\begin{aligned}
\text{Given: } & x + y = 5 \\
\text{And: } & x - y = 1 \\
\text{Adding: } & 2x = 6 \\
\text{Therefore: } & x = 3, y = 2
\end{aligned}
$$
```
## Common Mistakes
❌ **Missing escape for special characters**
```markdown
$50%$ (error!)
```
✓ **Escaped correctly**
```markdown
$50\%$
```
❌ **Missing braces for multi-character**
```markdown
$x^10$ (shows x¹0)
```
✓ **With braces**
```markdown
$x^{10}$
```
## Output Format
When creating math content:
```markdown
# [Topic Title]
[Brief explanation of the concept]
**Definition/Formula:**
$$
[Main formula in display mode]
$$
**Where:**
- $[variable]$ = [meaning]
- $[variable]$ = [meaning]
**Example:**
[Step-by-step solution]
$$
\begin{aligned}
\text{Step 1: } & [equation] \\
\text{Step 2: } & [equation] \\
\text{Result: } & [final answer]
\end{aligned}
$$
```
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.