6
$\begingroup$

the comma in Chinese is different from that in English. But they are too similar.

correct English comma

enter image description here

incorrect Chinese comma

enter image description here

As a non-English user, we have to switch the input quite often. If I type a Chinese comma in a large block of code by mistake, my god! sometimes it kill a lot of time to find what is wrong.

I previously write a suggestion to wolfram support to make Chinese comma stand out, so I can easily catch it. They claimed that they will consider it.

But it is already M11 now, things are even getting worse. The commas are more similar in the new font!

So I can not wait, is there a way to customize syntax highlighting to make a particular symbol colored, bigger, or whatever to make it stand out?

$\endgroup$
4
$\begingroup$

You may use the InputAutoReplacements option. It has been around since version 4 according to the documentation.

By changing the comma "," with the Chinese comma below then a notebook will be created that replaces the Chinese comma with the text "ChineseComma" whenever it is typed. Actually when the next character is typed after it is typed.

CreateDocument[{}, InputAutoReplacements -> {"," -> "\"ChineseComma\""}]

Note that if you change "\"ChineseComma\"" to the English comma, "," then it will replace inline for you. I think the following has the Chinese comma and does the inline replacement.

CreateDocument[{}, InputAutoReplacements -> {"," -> ","}]

You can also set this from the Format | Options Inspector. Then select Global Preferences for "Show option values". Next highlight "Editing Options" and update the InputAutoReplacements option setting in the option list. This will enable the replacement in all notebooks by default.

Note that the above will only replace on typing in the character. If you copy and paste in a Chinese comma it will not replace it.

Hope this helps.

$\endgroup$
  • $\begingroup$ Hi, Edmund. Thanks for answering. Are you using M11? I tried all your solution, but didn't work. and for the last method, I can't find "Show option values" $\endgroup$ – matheorem Aug 26 '16 at 6:06
  • $\begingroup$ @matheorem Does it work for you when you try it with comma as in the first statement. You have to press another key after you type the comma for it to do the replacement. I'm using version 11.0 as well. The first statement works for me. I could try the second as I don't know how to type a Chinese comma. However it should work the same. $\endgroup$ – Edmund Aug 26 '16 at 11:42
  • $\begingroup$ I know what is going on. ","->"," works, while ","->"," doesn't work. It seems that M11 has built in check of Chinese comma, look at this pasteboard.co/dkoesa41o.png If I type a Chinese comma, the system has a drop down, I don't what is this drop down designed for, well, it does "warn" me I type a wrong comma. And it also makes InputAutoReplacements disabled. Do you have any idea to overcome this? $\endgroup$ – matheorem Aug 26 '16 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.