1

In TeX Mode, backward-word (M-b) stops when it encounters a backslash character (\).

For example, when the cursor point is after a \begin and I type M-b, the cursor point ends up between the \ (backslash character) and the b character, while I would like to have it before the backslash.

So to obtain this behaviour I tried the following, but it does not seems to be working. Any idea why?

(add-hook 'tex-mode-hook #'(lambda () (modify-syntax-entry ?\ "w")))
1

I finally found the answer, it was just me forgetting that \ is an escape character. The following works fine:

(add-hook 'tex-mode-hook #'(lambda () (modify-syntax-entry ?\\ "w")))

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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