I input latex file with chinese.
Everytime  I come into math mode,  I must push shift to switch chinese to english. but when come out of math mode, I must push shift to switch english to chinese.

It is not convenient.

I want to write an extension or modify cdlatex (it is for latex input) ,so that when I come in math mode It switches automatically.

For example: when I input $$ ant the cursor is between them, it automatically switch to english.

I use scim in gentoo. so when I open input method with "ctrl spc", it only need "shift" to swich between chinese and english.

Or I need to use shift so frequently so that now the key "shift" is not sensitive.

thanks