mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 11:18:39 +00:00
Document macros in options object
This commit is contained in:
@@ -48,11 +48,17 @@ You can provide an object of options as the last argument to `katex.render` and
|
|||||||
- `displayMode`: `boolean`. If `true` the math will be rendered in display mode, which will put the math in display style (so `\int` and `\sum` are large, for example), and will center the math on the page on its own line. If `false` the math will be rendered in inline mode. (default: `false`)
|
- `displayMode`: `boolean`. If `true` the math will be rendered in display mode, which will put the math in display style (so `\int` and `\sum` are large, for example), and will center the math on the page on its own line. If `false` the math will be rendered in inline mode. (default: `false`)
|
||||||
- `throwOnError`: `boolean`. If `true`, KaTeX will throw a `ParseError` when it encounters an unsupported command. If `false`, KaTeX will render the unsupported command as text in the color given by `errorColor`. (default: `true`)
|
- `throwOnError`: `boolean`. If `true`, KaTeX will throw a `ParseError` when it encounters an unsupported command. If `false`, KaTeX will render the unsupported command as text in the color given by `errorColor`. (default: `true`)
|
||||||
- `errorColor`: `string`. A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option determines the color which unsupported commands are rendered in. (default: `#cc0000`)
|
- `errorColor`: `string`. A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option determines the color which unsupported commands are rendered in. (default: `#cc0000`)
|
||||||
|
- `macros`: Object with `\name` (written `"\\name"` in JavaScript) style properties mapping to Strings that describe the expansion of the macro.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, { displayMode: true });
|
katex.render("c = \\pm\\sqrt{a^2 + b^2}\\in\\RR", element, {
|
||||||
|
displayMode: true,
|
||||||
|
macros: {
|
||||||
|
"\\RR": "\\mathbb{R}"
|
||||||
|
}
|
||||||
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Automatic rendering of math on a page
|
#### Automatic rendering of math on a page
|
||||||
|
Reference in New Issue
Block a user