mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-08 12:38:39 +00:00
Unicode characters in math render in text mode (#2040)
* Unicode characters in math render in text mode Improve #2031 by rendering all supported Unicode text characters (via supportedCodepoints) in text mode, mimicking wrapping them in `\text`, thereby using metrics of letter M as usual. * Add tests * Improve documentation * Implement review comments
This commit is contained in:
committed by
Kevin Barabash
parent
3b80e0123b
commit
3b6ed48f5b
@@ -180,9 +180,14 @@ Direct Input: $∂ ∇ ℑ Ⅎ ℵ ℶ ℷ ℸ ⅁ ℏ ð$
|
||||
|
||||
**Unicode**
|
||||
|
||||
The letters listed above will render in any KaTeX rendering mode.
|
||||
The letters listed above will render properly in any KaTeX rendering mode.
|
||||
|
||||
If the KaTeX rendering mode is set to `strict: false` or `strict:"warn"` (default), then KaTeX will accept all Unicode letters. The letters not listed above will be rendered from system fonts, not KaTeX-supplied fonts, so their typography may clash. They may also cause small vertical alignment issues. KaTeX has detailed metrics for glyphs in Latin, Greek, and Cyrillic, but other glyphs are treated as if they are each as tall as the letter M.
|
||||
In addition, Brahmic, Georgian, Chinese, Japanese, and Korean glyphs are always accepted in text mode. However, these glyphs will be rendered from system fonts (not KaTeX-supplied fonts) so their typography may clash.
|
||||
You can provide rules for CSS classes `.latin-fallback`, `.cyrillic-fallback`, `.brahmic-fallback`, `.georgian-fallback`, `.cjk-fallback`, and `.hangul-fallback` to provide fallback fonts for these languages.
|
||||
Use of these glyphs may cause small vertical alignment issues: KaTeX has detailed metrics for listed symbols and most Latin, Greek, and Cyrillic letters, but other accepted glyphs are treated as if they are each as tall as the letter M in the current KaTeX font.
|
||||
|
||||
If the KaTeX rendering mode is set to `strict: false` or `strict: "warn"` (default), then KaTeX will accept all Unicode letters in both text and math mode.
|
||||
All unrecognized characters will be treated as if they appeared in text mode, and are subject to the same issues of using system fonts and possibly using incorrect vertical alignment.
|
||||
|
||||
For Persian composite characters, a user-supplied [plug-in](https://github.com/HosseinAgha/persian-katex-plugin) is under development.
|
||||
|
||||
|
Reference in New Issue
Block a user