From 0c5d9d55cf46cbe516b6d7c60fe1f46f603b1b3e Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Fri, 13 Jan 2017 12:05:51 +0100 Subject: [PATCH 1/3] Document macros in options object --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f8caa8..21b84b7 100644 --- a/README.md +++ b/README.md @@ -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`) - `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`) +- `macros`: Object with `\name` (written `"\\name"` in JavaScript) style properties mapping to Strings that describe the expansion of the macro. For example: ```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 From a0cd343d85a92d2160e76dc1f1cfb9e3367527e3 Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Fri, 13 Jan 2017 19:59:36 +0100 Subject: [PATCH 2/3] Improve description of macros Separate type, meaning and format to clarify the paragraph. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 21b84b7..629a2a7 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ 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`) - `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`) -- `macros`: Object with `\name` (written `"\\name"` in JavaScript) style properties mapping to Strings that describe the expansion of the macro. +- `macros`: `object`. A collection of custom macros. Each macro is a property with a name like `\name` (written `"\\name"` in JavaScript) which maps to a String that describes the expansion of the macro. For example: From 59c4e008db7b86102b218dd5d6585141f19e50fa Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Sun, 22 Jan 2017 22:39:57 +0100 Subject: [PATCH 3/3] Fix case of string in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 629a2a7..fba715b 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ 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`) - `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`) -- `macros`: `object`. A collection of custom macros. Each macro is a property with a name like `\name` (written `"\\name"` in JavaScript) which maps to a String that describes the expansion of the macro. +- `macros`: `object`. A collection of custom macros. Each macro is a property with a name like `\name` (written `"\\name"` in JavaScript) which maps to a string that describes the expansion of the macro. For example: