Supported Math Commands
Mathpix can generate any of the following LaTeX commands:
\# | \$ | \% | \& |
\Delta | \Gamma | \Im | \Lambda |
\Leftarrow | \Leftrightarrow | \Longleftarrow | \Longleftrightarrow |
\Longrightarrow | \Omega | \Phi | \Pi |
\Psi | \Re | \Rightarrow | \S |
\Sigma | \Theta | \Upsilon | \Vdash |
\Xi | \\ | \aleph | \alpha |
\angle | \approx | \asymp | \atop |
\backslash | \because | \begin | \beta |
\beth | \bigcap | \bigcirc | \bigcup |
\bigodot | \bigoplus | \bigotimes | \biguplus |
\bigvee | \bigwedge | \boldsymbol | \bot |
\bowtie | \breve | \bullet | \cap |
\cdot | \cdots | \check | \chi |
\circ | \circlearrowleft | \circlearrowright | \circledast |
\cline | \complement | \cong | \coprod |
\cup | \curlyvee | \curlywedge | \curvearrowleft |
\curvearrowright | \dagger | \dashv | \dddot |
\ddot | \ddots | \delta | \diamond |
\div | \dot | \doteq | \dots |
\downarrow | \ell | \emptyset | \end |
\epsilon | \equiv | \eta | \exists |
\fallingdotseq | \forall | \frac | \frown |
\gamma | \geq | \geqq | \geqslant |
\gg | \ggg | \gtrless | \gtrsim |
\hat | \hbar | \hline | \hookleftarrow |
\hookrightarrow | \imath | \in | \infty |
\int | \iota | \jmath | \kappa |
\lambda | \langle | \lceil | \ldots |
\leadsto | \leftarrow | \leftleftarrows | \leftrightarrow |
\leftrightarrows | \leftrightharpoons | \leq | \leqq |
\leqslant | \lessdot | \lessgtr | \lesssim |
\lfloor | \ll | \llbracket | \llcorner |
\lll | \longleftarrow | \longleftrightarrow | \longmapsto |
\longrightarrow | \lrcorner | \ltimes | \mapsto |
\mathbb | \mathbf | \mathcal | \mathfrak |
\mathrm | \mathscr | \mho | \models |
\mp | \mu | \multicolumn | \multimap |
\multirow | \nVdash | \nabla | \nearrow |
\neg | \neq | \newline | \nexists |
\ni | \nmid | \not | \notin |
\nprec | \npreceq | \nsim | \nsubseteq |
\nsucc | \nsucceq | \nsupseteq | \nu |
\nvdash | \nwarrow | \odot | \oiiint |
\oiint | \oint | \omega | \ominus |
\operatorname | \oplus | \oslash | \otimes |
\overbrace | \overleftarrow | \overleftrightarrow | \overline |
\parallel | \partial | \perp | \phi |
\pi | \pitchfork | \pm | \prec |
\preccurlyeq | \preceq | \precsim | \prime |
\prod | \propto | \psi | \qquad |
\quad | \rangle | \rceil | \rfloor |
\rho | \rightarrow | \rightleftarrows | \rightleftharpoons |
\rightrightarrows | \rightsquigarrow | \risingdotseq | \rrbracket |
\rtimes | \searrow | \sigma | \sim |
\simeq | \smile | \sqcap | \sqcup |
\sqrt | \sqsubset | \sqsubseteq | \sqsupset |
\sqsupseteq | \square | \stackrel | \star |
\subset | \subseteq | \subsetneq | \succ |
\succcurlyeq | \succeq | \succsim | \sum |
\supset | \supseteq | \supseteqq | \supsetneq |
\supsetneqq | \swarrow | \tau | \textrm |
\therefore | \theta | \tilde | \times |
\top | \triangle | \triangleleft | \triangleq |
\triangleright | \underbrace | \underline | \underset |
\unlhd | \unrhd | \uparrow | \uplus |
\vDash | \varepsilon | \varliminf | \varlimsup |
\varnothing | \varphi | \varpi | \varrho |
\varsigma | \varsubsetneqq | \vartheta | \vdash |
\vdots | \vec | \vee | \wedge |
\widehat | \widetilde | \wp | \xi |
\zeta | \{ | | | \} |
Custom Mathpix macros
These commands are not standard LaTeX. The v3/text endpoint may return them in latex_styled and text fields. If you render these fields yourself, you will need to define the macros in your LaTeX preamble (see definitions below). When using the Mathpix document conversion pipeline, the definitions are injected into the preamble automatically.
| Command | Renders as | Description |
|---|---|---|
\longdiv | Long division notation. See example below. | |
\Perp | Double perpendicular | |
\Varangle | Angle symbol (uppercase variant) | |
\varangle | Angle symbol (lowercase variant) | |
\AA | Ångström symbol in math mode | |
\longrightleftharpoons | Bidirectional harpoon for chemical equilibria |
See LaTeX macro definitions
\newcommand\longdiv[1]{\overline{\smash{)}#1}}
\def\Perp{\perp\!\!\!\perp}
\newcommand\Varangle{\mathop{{<\!\!\!\!\!\text{\small)}}\:}\nolimits}
\newcommand\varangle{\mathop{\sphericalangle}}
\def\AA{\mathring{\mathrm{A}}}
\def\longrightharpoon{\relbar\joinrel\rightharpoonup}
\def\longrightharpoonup{\relbar\joinrel\rightharpoonup}
\def\longleftharpoondown{\leftharpoondown\joinrel\relbar}
\def\longrightleftharpoons{
\mathop{
\vcenter{
\hbox{
\ooalign{
\raise1pt\hbox{$\longrightharpoonup\joinrel$}\crcr
\lower1pt\hbox{$\longleftharpoondown\joinrel$}
}
}
}
}
}
\newcommand{\rates}[2]{\displaystyle
\mathrel{\longrightleftharpoons^{#1\mathstrut}_{#2}}}
Long division
Mathpix uses \longdiv to represent long division. The syntax works like \sqrt: the divisor sits outside and the dividend goes inside the braces.
\longdiv is a custom Mathpix macro — standard LaTeX has no long division symbol. See the macro definitions above to include in your LaTeX documents.
Example input image

Request
- cURL
- Python
- JavaScript / TypeScript
- Go
- Java
curl -X POST https://api.mathpix.com/v3/text \
-H 'app_id: APP_ID' \
-H 'app_key: APP_KEY' \
-H 'Content-Type: application/json' \
--data '{"src": "https://raw.githubusercontent.com/Mathpix/api-examples/master/images/long_division.jpg"}'
import requests
r = requests.post("https://api.mathpix.com/v3/text",
json={
"src": "https://raw.githubusercontent.com/Mathpix/api-examples/master/images/long_division.jpg"
},
headers={
"app_id": "APP_ID",
"app_key": "APP_KEY",
"Content-type": "application/json"
}
)
print(r.json())
const response = await fetch("https://api.mathpix.com/v3/text", {
method: "POST",
headers: {
app_id: "APP_ID",
app_key: "APP_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
src: "https://raw.githubusercontent.com/Mathpix/api-examples/master/images/long_division.jpg",
}),
});
const result = await response.json();
console.log(result);
body := bytes.NewBufferString(`{
"src": "https://raw.githubusercontent.com/Mathpix/api-examples/master/images/long_division.jpg"
}`)
req, _ := http.NewRequest("POST", "https://api.mathpix.com/v3/text", body)
req.Header.Set("app_id", "APP_ID")
req.Header.Set("app_key", "APP_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
HttpClient client = HttpClient.newHttpClient();
String body = """
{
"src": "https://raw.githubusercontent.com/Mathpix/api-examples/master/images/long_division.jpg"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.mathpix.com/v3/text"))
.header("app_id", "APP_ID")
.header("app_key", "APP_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
{
"request_id": "4ed529ef-79a9-4032-b414-5a02ee990568",
"version": "SuperNet-109p4",
"is_printed": true,
"is_handwritten": false,
"confidence": 1,
"confidence_rate": 1,
"latex_styled": "8 \\longdiv { 7 2 0 0 }",
"text": "\\( 8 \\longdiv { 7 2 0 0 } \\)"
}
The latex_styled field contains 8 \longdiv { 7 2 0 0 }, which reads as "7200 divided by 8".