BoostIO / BoostNote-Legacy

This repository is outdated and new Boost Note app is available! We've launched a new Boost Note app which supports real-time collaborative writing. https://github.com/BoostIO/BoostNote-App
Other
17.07k stars 1.47k forks source link

About KaTeX 's Error #3569

Closed Orange-Jun closed 4 years ago

Orange-Jun commented 4 years ago

Some errors when writing mathematical formulas using KaTeX

For example:

  1. $\S$
  2. $$ y = x^2 \; \mbox{(二次函数)} $$
  3. 
    \left\\{
    \begin{aligned}
    2x + y &= 1 \\\\
    2x + 2y &= 2
    \end{aligned}
    \right.
    \end{equation} 
  4. ......

These errors are just a few

Error message

KaTeX parse error: Undefined control sequence: \S at position 1: \̲S̲ KaTeX parse error: Undefined control sequence: \mbox at position 12: y = x^2 \; \̲m̲b̲o̲x̲{(二次函数)} KaTeX parse error: No such environment: equation at position 7: \begin{̲e̲q̲u̲a̲t̲i̲o̲n̲}̲ \left\{ \begi…

Environment

Thanks

Can you help me understand the cause of this problem? If you can solve it, thank you very much! 谢谢!

Flexo013 commented 4 years ago

Thanks for creating this issue! Here are solutions to your problems:

  1. KaTeX does not support \S in math mode, so you need to escape it like this: \text{\S}
  2. You are in a math environment so use y = x^2 \text{;(二次函数)}
  3. There is a typo in your snippet, so an error is expected. Remove one backslash after \left, and also don't end the equation environment yourself, the $$ already does that for you:
    \left\{
    \begin{aligned}
    2x + y &= 1 \\\\
    2x + 2y &= 2
    \end{aligned}
    \right.