On Wednesday 20 August 2008, xiaopeng hu wrote: > I use Ctrol to switch my input method between chinese and english. > When I input $, coming in math mode,I need to automatically switch to > english input method (push "Ctrl" key). > > First, I simulate a keystrike "t"+, I will get a chinese character > (not equal "t ")if my input method is chinese. Now I need Emacs > automatically simulate a "Ctrl" key to switch to english input method. > All of these is just after when I input $. > > How to implement the function? > > Thanks I have attached a minor mode that changes the input encoding when entering and exiting math-mode or after a backslash. Copy it to a directory that is in the emacs load path (such as /usr/share/emacs/site-lisp/) and add: (autoload 'latex-i18n-mode "latex-i18n" t) (add-hook 'LaTeX-mode-hook 'latex-i18n-mode) to ~/.emacs. Hope this helps.