weirongxu / coc-markdown-preview-enhanced

Markdown Preview Enhanced for coc.nvim
Other
90 stars 1 forks source link

[Error]: LaTeX-incompatible input and strict mode is set to 'warn': Unicode text character "键" used in math mode [unicodeTextInMathMode] #15

Closed hexh250786313 closed 2 years ago

hexh250786313 commented 2 years ago

Description

Coc.nvim throws error when the markdown file exists string $键$ in hosting coc-markdown-preview-enhanced. It seems be relative to LaTeX's keyword. Error messages like this:

[coc.nvim]: LaTeX-incompatible input and strict mode is set to 'warn': Unicode text character "键" used in math mode [unicodeTextInMathMode]

Actually my words are $mod 键和 $sup 键 and $键$ is the shortest string to reproduce.

Reproduce

  1. Edit a markdown file and input $键$
  2. Call :CocCommand markdown-preview-enhanced.openPreview

CocInfo

## versions

vim version: NVIM v0.8.0-dev
node version: v16.10.0
coc.nvim version: 0.0.81-2522eee5 2022-06-14 19:03:29 +0800
coc.nvim directory: /home/hexh/.local/share/nvim/site/pack/packer/start/coc.nvim
term: tmux
platform: linux

## Log of coc.nvim

2022-07-05T17:21:18.394 INFO (pid:221353) [@hexuhua/coc-git] - Looking for git in: git
2022-07-05T17:21:18.484 INFO (pid:221353) [services] - registered service "eslint"
2022-07-05T17:21:18.485 INFO (pid:221353) [services] - ESLint state change: stopped => starting
2022-07-05T17:21:19.113 INFO (pid:221353) [plugin] - coc.nvim initialized with node: v16.10.0 after 897ms
2022-07-05T17:21:19.179 INFO (pid:221353) [core-watchman] - watchman watching project: /home/hexh/desktop
2022-07-05T17:21:19.251 INFO (pid:221353) [services] - ESLint state change: starting => running
2022-07-05T17:21:19.258 INFO (pid:221353) [services] - service eslint started
2022-07-05T17:21:20.463 INFO (pid:221353) [attach] - Request action: commandList [
  'markdown-preview-enhanced.openPreview',
  'CocCommand markdown-preview-enhanced.openPreview',
  48
]
2022-07-05T17:21:21.282 INFO (pid:221353) [attach] - receive notification: runCommand [ 'markdown-preview-enhanced.openPreview' ]
2022-07-05T17:21:26.468 INFO (pid:221353) [attach] - receive notification: showInfo []
hexh250786313 commented 2 years ago

@weirongxu I found coc throws error when not only use word but any chinese word or Emoji between two $. Like $😈 小恶魔$. It means that it just can not translate some unicode characters between $.

weirongxu commented 2 years ago

Change your katex configuration via: :CocCommand markdown-preview-enhanced.openKaTeXConfig

katex_config.js

module.exports = {
  strict: false,
  ...
}
hexh250786313 commented 2 years ago

@weirongxu THX!

hexh250786313 commented 2 years ago

By the way, anyone can use \$your words\$ to show the $ symbol when you have a format like $your words$. By default, the plugin would trans the words between $ to latex format which makes $ symbol hidden.