Equation
- Equations allow you to express complex mathematical concepts in both inline and block formats.
- Key features:
- LaTeX syntax support
- Inline and block equation formats
- Inline equation example: (Einstein's famous equation)
- Block equation examples:
The quadratic formula for solving .
The fundamental theorem of calculus.
- Try these actions:
- Click on any equation to edit it. Press Escape to close the menu without editing it.
- You can navigate through the equation by using the arrow keys
- Use the slash command (/equation) to insert a new equation
- Use the slash command (/inline equation) for inline equations
Advanced usage: Combine equations with other elements like tables or code blocks for comprehensive scientific documentation. For example:
The Schrödinger equation, , is fundamental in quantum mechanics.
Experiment with different equation types and formatting to create rich, mathematical content in your documents.
1
100%
Files
'use client';
import * as React from 'react';
import { Plate, usePlateEditor } from 'platejs/react';
import { EditorKit } from '@/components/editor/editor-kit';
import { Editor, EditorContainer } from '@/components/ui/editor';
import { DEMO_VALUES } from './values/demo-values';
export default function Demo({ id }: { id: string }) {
const editor = usePlateEditor({
plugins: EditorKit,
value: DEMO_VALUES[id],
});
return (
<Plate editor={editor}>
<EditorContainer variant="demo">
<Editor />
</EditorContainer>
</Plate>
);
}
LaTeX equations with inline and block formats.
equation-demo


Features
- LaTeX syntax support for complex mathematical expressions
- Both inline and block equation formats
- Real-time rendering of equations using KaTeX
- Easy editing and navigation within equations
Kit Usage
Installation
The fastest way to add equation functionality is with the MathKit, which includes pre-configured EquationPlugin and InlineEquationPlugin with Plate UI components.
'use client';
import { EquationPlugin, InlineEquationPlugin } from '@platejs/math/react';
import {
EquationElement,
InlineEquationElement,
} from '@/components/ui/equation-node';
export const MathKit = [
InlineEquationPlugin.withComponent(InlineEquationElement),
EquationPlugin.withComponent(EquationElement),
];
EquationElement: Renders block equation elements.InlineEquationElement: Renders inline equation elements.
Add Kit
Add the kit to your plugins:
import { createPlateEditor } from 'platejs/react';
import { MathKit } from '@/components/editor/plugins/math-kit';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
...MathKit,
],
});Manual Usage
Installation
pnpm add @platejs/math
Add Plugins
Include the equation plugins in your Plate plugins array when creating the editor.
import { EquationPlugin, InlineEquationPlugin } from '@platejs/math/react';
import { createPlateEditor } from 'platejs/react';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
EquationPlugin,
InlineEquationPlugin,
],
});Configure Plugins
Configure the plugins with custom components to render equation elements.
import { EquationPlugin, InlineEquationPlugin } from '@platejs/math/react';
import { createPlateEditor } from 'platejs/react';
import { EquationElement, InlineEquationElement } from '@/components/ui/equation-node';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
EquationPlugin.withComponent(EquationElement),
InlineEquationPlugin.withComponent(InlineEquationElement),
],
});withComponent: AssignsEquationElementto render block equations andInlineEquationElementto render inline equations.
Add Toolbar Button
You can add EquationToolbarButton to your Toolbar to insert equations.
Plate Plus
Plugins
EquationPlugin
Plugin for block equation elements.
InlineEquationPlugin
Plugin for inline equation elements.
Transforms
tf.insert.equation
tf.insert.inlineEquation
Inserts an inline equation.
Types
TEquationElement
interface TEquationElement extends TElement {
texExpression: string;
}
