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": {
"paragraphs": [
{
"children": [
{ "text": "E = mc", "size": 28 },
{ "text": "2", "size": 20, "baseline": 30 }
]
},
{
"children": [
{ "text": "H", "size": 28 },
{ "text": "2", "size": 20, "baseline": -25 },
{ "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: {
paragraphs: [
{
children: [
{ text: "E = mc", size: 28 },
{ text: "2", size: 20, baseline: 30 },
],
},
{
children: [
{ text: "H", size: 28 },
{ text: "2", size: 20, baseline: -25 },
{ text: "O", size: 28 },
],
},
],
},
},
},
],
},
],
});
#Superscript and Subscript
Use the baseline property as an integer percent (positive = superscript, negative = subscript):
[
{ "text": "x", "size": 24 },
{ "text": "2", "size": 16, "baseline": 30 },
{ "text": "n", "size": 16, "baseline": -25 }
]
Positive baseline values raise the text (superscript, e.g. x²); negative values lower it (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": {
"paragraphs": [
{
"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": 30 },
{ "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: {
paragraphs: [
{
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: 30 },
{ text: " - 4ac)) / 2a", size: 24 },
],
},
],
},
},
},
],
},
],
});
#Tips
- Use
baseline: 30for superscript andbaseline: -25for subscript. - Unicode math symbols render correctly in most presentation viewers.
- For complex mathematical expressions, consider using an image of the equation rendered from LaTeX.