西安Linux用户组(Xi'an Linux User Group) - Example Site: http://xalug.com/docs/example/ - Table of Contents: http://xalug.com/docs/example/table-of-contents/ - With ToC: http://xalug.com/docs/example/table-of-contents/with-toc/ - Without ToC: http://xalug.com/docs/example/table-of-contents/without-toc/ - 3rd Level: http://xalug.com/docs/example/collapsed/3rd-level/ - 4th Level: http://xalug.com/docs/example/collapsed/3rd-level/4th-level/ - Asciinema: http://xalug.com/docs/shortcodes/asciinema/ - Buttons: http://xalug.com/docs/shortcodes/buttons/ - Columns: http://xalug.com/docs/shortcodes/columns/ - Details: http://xalug.com/docs/shortcodes/details/ - Badges: http://xalug.com/docs/shortcodes/experimental/badges/ - Cards: http://xalug.com/docs/shortcodes/experimental/cards/ - Images: http://xalug.com/docs/shortcodes/experimental/images/ - Hints: http://xalug.com/docs/shortcodes/hints/ - Mermaid: http://xalug.com/docs/shortcodes/mermaid/ - Steps: http://xalug.com/docs/shortcodes/steps/ - Tabs: http://xalug.com/docs/shortcodes/tabs/ - KaTeX: http://xalug.com/docs/shortcodes/katex/ # KaTeX KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/) {{% hint info %}} **Override KaTeX initialization config** To override the [initialization config](https://katex.org/docs/options.html) for KaTeX, create a `katex.json` file in your `assets` folder! {{% /hint %}} # Example {{< katex />}} ## Activation KaTeX is activated on the page by first use of the shortcode or render block. you can force activation with empty `{{}}` and use delimiters defined in configuration in `assets/katex.json`. ## Rendering as block {{% columns %}} ```latex {{}} f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi {{< /katex */>}} ``` ````latex ```katex f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi ``` ```` ````latex $$ f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi $$ ```` <---> {{< katex display=true >}} f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi {{< /katex >}} --- ```katex f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi ``` --- $$ f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi $$ {{% /columns %}} ## Rendering inline When KaTeX is active on the page it is possible to write inline expressions. | Code | Output | | -- | -- | | `{{}}\pi(x){{< /katex */>}}` | {{< katex >}}\pi(x){{< /katex >}} | | `\\( \pi(x) \\)` | \\( \pi(x) \\) | ## Configuration KaTeX configuration could be adjusted by editing `assets/katex.json` file. For example to enabled inline delimiters `$..$` put content below into the file. ```json { "delimiters": [ {"left": "$$", "right": "$$", "display": true}, {"left": "$", "right": "$", "display": false}, {"left": "\\(", "right": "\\)", "display": false}, {"left": "\\[", "right": "\\]", "display": true} ] } ```