I am a fairly new user of Emacs, which I could be my offline installation of LaTeX instead of using Overleaf. I wanted the same keyboard layout that I use on that site, which is the same as my Mac keyboard. I can't use backslash \ for writing \begin... and use the {}, so it is quite hard to write LaTeX inside Emacs. All I have installed is default emacs, AUCTex and evil. I haven't configured anything despite that. I've tried to search all over Google and finding answers, inserting them into my config, but nothing really works?

I normally use SHIFT+OPTION7 to do a backslash and SHIFT+OPTION+8 or SHIFT+OPTION+9 to do { and }.

Thanks in advance.

2 Answers 2


I had the same issue and this set of config lines in my .emacs fixed it

(setq mac-option-key-is-meta nil)
(setq mac-command-key-is-meta t)
(setq mac-command-modifier 'meta)
(setq mac-option-modifier nil)

I'm not a lisp expert and I don't remember wher I found those in the first place :-) I have a Norwegian keyboard layout.


You may need to improve this question before it can be answered. For one thing, if you normally use Command-Shift-7 to type a backslash, and that isn’t working inside Emacs, what does Emacs do instead? Also, if you type C-h k Command-Shift-7, what does Emacs say that this key combination does?

Generally keyboard layouts are handled by the operating system, and Emacs doesn’t need to get involved.

  • I tried to do a backslash, it first tells there is no dynamic expression for 'produced. When I try do to the C-h k SHIFT+OPTION+7 it tells me its reserved for M-/ for something called dabbrev-expand ARG. Commented Apr 13, 2022 at 15:05
  • A comment maybe, but certainly not an answer (particularly given the well-stated objection in your first sentence).
    – NickD
    Commented Apr 13, 2022 at 15:58
  • ok, so Emacs understood SHIFT-OPTION-7 as M-/, which is interesting. I suppose that SHIFT-7 gives a forward slash and the option key is supposed to make it give a backslash? You might try typing `C-u C-` to switch input methods, and choosing the Danish one.
    – db48x
    Commented Apr 13, 2022 at 22:34
  • Nick, you are of course correct. The same thought occurred to me right after I had submitted it.
    – db48x
    Commented Apr 13, 2022 at 22:34
  • @db48x Shift+7 actually does a '-' so no forward slash. Shift+command+7 gives a forward slash. I tried to do (add-hook 'text-mode-hook (lambda () (set-input-method "danish-prefix"))) as well, but it is still the same. Commented Apr 14, 2022 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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