From 903b459ca42f6689fa960bc3bc1d38b16b57dbed Mon Sep 17 00:00:00 2001 From: Ron Kok Date: Sat, 1 Aug 2020 14:53:55 -0700 Subject: [PATCH] Update \color documentation (#2370) * Update \color documentation * Update options.md * Add version numbers. * Remove MathJaX version number. --- docs/options.md | 2 +- docs/supported.md | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/options.md b/docs/options.md index 3677e12a..b3d9e694 100644 --- a/docs/options.md +++ b/docs/options.md @@ -15,7 +15,7 @@ You can provide an object of options as the last argument to [`katex.render` and - `errorColor`: `string`. A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option determines the color that unsupported commands and invalid LaTeX are rendered in when `throwOnError` is set to `false`. (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, or a function that accepts an instance of `MacroExpander` as first argument and returns the expansion as a string. `MacroExpander` is an internal API and subject to non-backwards compatible changes. See [`src/macros.js`](https://github.com/KaTeX/KaTeX/blob/master/src/macros.js) for its usage. Single-character keys can also be included in which case the character will be redefined as the given macro (similar to TeX active characters). *This object will be modified* if the LaTeX code defines its own macros via `\gdef`, which enables consecutive calls to KaTeX to share state. - `minRuleThickness`: `number`. Specifies a minimum thickness, in ems, for fraction lines, `\sqrt` top lines, `{array}` vertical lines, `\hline`, `\hdashline`, `\underline`, `\overline`, and the borders of `\fbox`, `\boxed`, and `\fcolorbox`. The usual value for these items is `0.04`, so for `minRuleThickness` to be effective it should probably take a value slightly above `0.04`, say `0.05` or `0.06`. Negative values will be ignored. -- `colorIsTextColor`: `boolean`. If `true`, `\color` will work like LaTeX's `\textcolor`, and take two arguments (e.g., `\color{blue}{hello}`), which restores the old behavior of KaTeX (pre-0.8.0). If `false` (the default), `\color` will work like LaTeX's `\color`, and take one argument (e.g., `\color{blue}hello`). In both cases, `\textcolor` works as in LaTeX (e.g., `\textcolor{blue}{hello}`). +- `colorIsTextColor`: `boolean`. In early versions of both KaTeX (<0.8.0) and MathJax, the `\color` function expected the content to be a function argument, as in `\color{blue}{hello}`. In current KaTeX, `\color` is a switch, as in `\color{blue} hello`. This matches LaTeX behavior. If you want the old `\color` behavior, set option `colorIsTextColor` to true. - `maxSize`: `number`. All user-specified sizes, e.g. in `\rule{500em}{500em}`, will be capped to `maxSize` ems. If set to `Infinity` (the default), users can make elements and spaces arbitrarily large. - `maxExpand`: `number`. Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to `Infinity`, the macro expander will try to fully expand as in LaTeX. (default: 1000) - `strict`: `boolean` or `string` or `function` (default: `"warn"`). If `false` or `"ignore`", allow features that make writing LaTeX convenient but are not actually supported by (Xe)LaTeX (similar to MathJax). If `true` or `"error"` (LaTeX faithfulness mode), throw an error for any such transgressions. If `"warn"` (the default), warn about such behavior via `console.warn`. Provide a custom function `handler(errorCode, errorMsg, token)` to customize behavior depending on the type of transgression (summarized by the string code `errorCode` and detailed in `errorMsg`); this function can also return `"ignore"`, `"error"`, or `"warn"` to use a built-in behavior. A list of such features and their `errorCode`s: diff --git a/docs/supported.md b/docs/supported.md index 75c7d8d4..66992bcd 100644 --- a/docs/supported.md +++ b/docs/supported.md @@ -541,8 +541,7 @@ Extensible arrows all can take an optional argument in the same manner
as `\x $\color{blue} F=ma$ `\color{blue} F=ma` -Note that KaTeX `\color` acts like a switch. This aligns with LaTeX and differs from MathJax. -Other KaTeX color functions expect the content to be a function argument: +Note that `\color` acts like a switch. Other color functions expect the content to be a function argument: $\textcolor{blue}{F=ma}$ `\textcolor{blue}{F=ma}`
$\textcolor{#228B22}{F=ma}$ `\textcolor{#228B22}{F=ma}`