starlight_help/src/content/docs/latex.mdx
import {TabItem, Tabs} from "@astrojs/starlight/components";
import FlattenedSteps from "../../components/FlattenedSteps.astro"; import ZulipTip from "../../components/ZulipTip.astro"; import LatexExamples from "../include/_LatexExamples.mdx"; import LatexIntro from "../include/_LatexIntro.mdx"; import StartComposing from "../include/_StartComposing.mdx";
import MathIcon from "~icons/zulip-icon/math";
<LatexIntro />Zulip's compose box has a smart math (LaTeX) (<MathIcon />) button, which inserts contextually appropriate LaTeX formatting:
```math) formatting.$$)
formatting.```math) formatting. 1. *(optional)* Select the text you want to format.
1. Click the **math (LaTeX)** (<MathIcon />) icon at the bottom of
the compose box to insert LaTeX formatting.
</FlattenedSteps>
<ZulipTip>
You can also use the **math (LaTeX)** (<MathIcon />) icon to remove
existing LaTeX formatting from the selected text.
</ZulipTip>
1. To use inline LaTeX, use double dollar signs (`$$`) around the text:
```
$$O(n^2)$$
```
To use displayed LaTeX, use triple backticks and the word math
(` ```math `) followed by some text and triple backticks at the end:
````
```math
\int_a^b f(t)\, dt = F(b) - F(a)
```
````
</FlattenedSteps>
Zulip supports quoting, forwarding, or copying math expressions, and pasting them into the compose box.
<ZulipTip> If you select part of a math expression to copy, Zulip will automatically expand your selection to copy the full expression. </ZulipTip>You can copy LaTeX from many third-party sites that use KaTeX, and paste it into Zulip.
<ZulipTip> If copy-pasting math from a website isn't working, consider contacting the website's administrators with the information below, as it may be an easy fix. </ZulipTip>This feature is powered by KaTeX's MathML annotations, which embed the original LaTeX source in the HTML for a math expression. For it to work, the website needs to:
htmlAndMathml output
mode.