# TeX Mode : making backward-word behaviour take into account Backslashes (\)

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")))


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")))