Mathpix / mathpix-markdown-it

Markdown rendering + Latex extras (equations, tables, ...), with conversion features, for the scientific community
MIT License
542 stars 45 forks source link

Error applying strikethrough text using mathpix-markdown-it in web browsers. #353

Closed lixumin-zai closed 3 weeks ago

lixumin-zai commented 3 weeks ago

origin text: \underline{$\textcolor{red}{\sout{(-1,-\dfrac{\sqrt{3}}{3})\cup(\dfrac{\sqrt{3}}{3},1)}}$}

render in vscode: image

but there is an error when using the script "https://cdn.jsdelivr.net/npm/mathpix-markdown-it@2.0.4/es5/bundle.js" to render it : [TexConvert] ERROR=> { "message": "TeX error: Undefined control sequence \sout", "latex": "\textcolor{red}{\sout{(-1,-\dfrac{\sqrt{3}}{3})\cup(\dfrac{\sqrt{3}}{3},1)}}" }

how to fix it 😭

lixumin-zai commented 3 weeks ago

Please help the adorable little turtle

OlgaRedozubova commented 3 weeks ago

@lixumin-zai \sout is a text-mode command which is why MathJax does not implement it https://github.com/mathjax/MathJax/issues/819#issuecomment-42939918

You can use the enclose extension and do \enclose{horizontalstrike}{...} to strike-through an expression with a horizontal line.

\underline{$\textcolor{red}{\enclose{horizontalstrike}{(-1,-\dfrac{\sqrt{3}}{3})\cup(\dfrac{\sqrt{3}}{3},1)}}$}
Screenshot 2024-11-04 at 14 39 32
lixumin-zai commented 3 weeks ago

The little turtle is very grateful to you.