latex2js macros
npm install @latex2js/macrosA comprehensive collection of LaTeX macro definitions for mathematical notation, providing shortcuts and enhancements for mathematical typesetting in LaTeX2JS.
``bash`
npm install @latex2js/macros
- Transform Pairs: Fourier, Z-transform, and Laplace transform notation
- Mathematical Symbols: Extended collection of mathematical operators and symbols
- Set Theory: Comprehensive set theory notation and operators
- Category Theory: Morphisms, functors, and categorical constructs
- Theorem Environments: Shortcuts for theorem, lemma, proposition, and proof environments
- Typography: Enhanced spacing and formatting for mathematical expressions
`typescript
import macros from '@latex2js/macros';
// The macros are provided as a template string
console.log(typeof macros); // 'string'
`
`typescript
import { LaTeX2HTML5 } from 'latex2js';
import macros from '@latex2js/macros';
// Initialize with macros
const parser = new LaTeX2HTML5();
parser.addMacros(macros);
`
`javascript
import macros from '@latex2js/macros';
// Configure MathJax with the macros
window.MathJax = {
tex: {
macros: macros
}
};
`
Perfect for signal processing and mathematical analysis:
`latex
% Fourier Transform
$$\mathscr{F}\{f(t)\} = F(\omega)$$
$$f(t) \FTpair F(\omega)$$
% Z-Transform
$$\mathscr{Z}\{x[n]\} = X(z)$$
$$x[n] \ZTpair X(z)$$
% Laplace Transform
$$\mathscr{L}\{f(t)\} = F(s)$$
$$f(t) \LTpair F(s)$$
`
Extended mathematical notation:
`latex`
% Enhanced operators
$$\E[X]$$ % Expectation
$$\Var(X)$$ % Variance
$$\Cov(X,Y)$$ % Covariance
$$\argmax_x f(x)$$ % Argument maximum
$$\argmin_x f(x)$$ % Argument minimum
Comprehensive set operations:
`latex`
% Set operations
$$A \intersection B$$ % Intersection
$$A \union B$$ % Union
$$A \setminus B$$ % Set difference
$$\powerset{A}$$ % Power set
$$A \symdiff B$$ % Symmetric difference
Advanced categorical constructs:
`latex`
% Category theory
$$\Hom(A, B)$$ % Hom-set
$$A \iso B$$ % Isomorphism
$$f \colon A \to B$$ % Morphism notation
$$\End(A)$$ % Endomorphisms
$$\Aut(A)$$ % Automorphisms
Shortcuts for mathematical writing:
`latex
\begin{thm}[Fundamental Theorem]
Every continuous function on a closed interval is uniformly continuous.
\end{thm}
\begin{lem}
This is a supporting lemma.
\end{lem}
\begin{prop}
This is a proposition.
\end{prop}
\begin{proof}
The proof follows from the definition.
\end{proof}
`
Improved spacing and formatting:
`latex`
% Enhanced spacing
$$a \,+\, b$$ % Thin spaces around operators
$$\int_a^b f(x) \dd x$$ % Proper differential notation
$$\vec{v} \cdot \vec{u}$$ % Vector notation
The package includes over 140 macro definitions covering:
- Analysis: Real and complex analysis notation
- Algebra: Group theory, ring theory, field theory
- Topology: Topological spaces and continuous maps
- Probability: Probability theory and statistics
- Logic: Logical operators and quantifiers
- Geometry: Geometric constructions and notation
- Computer Science: Algorithms and complexity theory
`jsx
import { LaTeX } from 'latex2react';
import macros from '@latex2js/macros';
function MathDocument() {
const content =
\\begin{thm}[Fourier Transform]
For any function $f \\in L^1(\\mathbb{R})$:
$$f(t) \\FTpair F(\\omega) = \\int_{-\\infty}^{\\infty} f(t) e^{-i\\omega t} \\dd t$$
\\end{thm}
;`
return
}
`vue
`
`html``