The auctex font keybindings are particularly tricky to sort out, because the command you are after uses the interactive function with the "c" code letter. As a consequence, C-c C-f
calls the function TeX-font
, and the next letter you type is collected as an argument to be passed to this function. So C-c C-f
is bound to a function, but acts like a prefix. See the linked manual page for a full explanation.
This means the usual suggestions offered as comments won't be enough to get what you want. The key piece of code you need to invoke is TeX-font
. Getting the correct arguments required digging into the source code. I use the following functions in my .emacs:
(defun TeX-typewriter()
(interactive)
(TeX-font nil ?\C-t))
(defun TeX-bold()
(interactive)
(TeX-font nil ?\C-b))
(defun TeX-emphasis()
(interactive)
(TeX-font nil ?\C-e))
(defun TeX-smallcaps()
(interactive)
(TeX-font nil ?\C-c))
With those functions defined, I then apply the keybindings in the LaTeX-mode-hook:
(defun my-LaTeX-hook ()
(local-set-key "\C-ci" 'TeX-italics)
(local-set-key "\C-cb" 'TeX-bold)
(local-set-key "\C-ct" 'TeX-typewriter)
(local-set-key "\C-ce" 'TeX-emphasis)
(local-set-key "\C-cs" 'TeX-smallcaps))
(add-hook 'LaTeX-mode-hook 'my-LaTeX-hook)
This binds TeX-bold to C-c b
, but you could use whatever you like here (such as C-b
as you asked for).