PPTX
Equations and Symbols
Add mathematical equations and special symbols to slides
You can include mathematical equations and special symbols in your presentations.
Equations in Text Runs
Use Unicode characters and baseline for superscript/subscript:
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "21.2cm",
"height": "7.9cm",
"textBody": {
"children": [
{
"children": [
{ "text": "E = mc", "size": 28 },
{ "text": "2", "size": 20, "baseline": 30000 }
]
},
{
"children": [
{ "text": "H", "size": 28 },
{ "text": "2", "size": 20, "baseline": -25000 },
{ "text": "O", "size": 28 }
]
}
]
}
}
}
]
}
]
}
import { generatePresentation } from "@office-open/pptx";
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "21.2cm",
height: "7.9cm",
textBody: {
children: [
{
children: [
{ text: "E = mc", size: 28 },
{ text: "2", size: 20, baseline: 30000 },
],
},
{
children: [
{ text: "H", size: 28 },
{ text: "2", size: 20, baseline: -25000 },
{ text: "O", size: 28 },
],
},
],
},
},
},
],
},
],
});
Superscript and Subscript
Use the baseline property (in 1000ths of a percent):
{ text: "x", size: 24 }
{ text: "2", size: 16, baseline: 30000 } // x² (superscript)
{ text: "n", size: 16, baseline: -25000 } // Subscript
Common Math Symbols (Unicode)
{ text: "π", size: 24 } // pi
{ text: "Σ", size: 24 } // Sigma (sum)
{ text: "∫", size: 24 } // Integral
{ text: "√", size: 24 } // Square root
{ text: "±", size: 24 } // Plus-minus
{ text: "≠", size: 24 } // Not equal
{ text: "≤", size: 24 } // Less than or equal
{ text: "≥", size: 24 } // Greater than or equal
{ text: "→", size: 24 } // Right arrow
{ text: "×", size: 24 } // Multiplication
{ text: "÷", size: 24 } // Division
{ text: "∞", size: 24 } // Infinity
Complex Equation Layout
Build multi-line equations using multiple paragraphs:
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "21.2cm",
"height": "9.3cm",
"textBody": {
"children": [
{
"properties": { "alignment": "CENTER" },
"children": [{ "text": "Quadratic Formula", "size": 18, "bold": true }]
},
{
"properties": { "alignment": "CENTER" },
"children": [
{ "text": "x = (-b ± √(b", "size": 24 },
{ "text": "2", "size": 16, "baseline": 30000 },
{ "text": " - 4ac)) / 2a", "size": 24 }
]
}
]
}
}
}
]
}
]
}
import { generatePresentation } from "@office-open/pptx";
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "21.2cm",
height: "9.3cm",
textBody: {
children: [
{
properties: { alignment: "CENTER" },
children: [{ text: "Quadratic Formula", size: 18, bold: true }],
},
{
properties: { alignment: "CENTER" },
children: [
{ text: "x = (-b ± √(b", size: 24 },
{ text: "2", size: 16, baseline: 30000 },
{ text: " - 4ac)) / 2a", size: 24 },
],
},
],
},
},
},
],
},
],
});
Tips
- Use
baseline: 30000for superscript andbaseline: -25000for subscript. - Unicode math symbols render correctly in most presentation viewers.
- For complex mathematical expressions, consider using an image of the equation rendered from LaTeX.