Take the 2-minute tour ×

I want to define a new key combination in my .emacs such that it will directly run the latex command, unlike C-c C-c Ret which gives me different options every time (like view). I am using xdvik for post processing and I don't need to run the view command each time I compile. Focusing on xdvik rereads the file, so there is no point.

Another problem: is there a way to remove the icon labels, which have been introduced in emacs 24? It is the main reason I am asking the previous question, since I have to go into some sub-menus to click the latex commands because the labels take unnecessary space on the window.

Thanks in advance

share|improve this question
IIRC, (toolbar-mode nil) will kill the icons. –  Sean Allred Oct 18 '13 at 17:50
add comment

1 Answer

You can customize the toolbar with M-x customize-variable tool-bar-style. Pick "images" from the value list and you'll lose all the text labels.

The actual code run by the Latex button is a combination of two functions. You can run it with the following code:

(defun my-run-latex ()

Put that in your .emacs, and call it directly with M-x my-run-latex, or bind it to a convenient key:

(defun my-LaTeX-hook ()
 (local-set-key (kbd "C-c C-a") 'my-run-latex))

(add-hook 'LaTeX-mode-hook 'my-LaTeX-hook)

Using local-set-key and running it as part of a mode hook means the new key-combo is only available when you're working on a latex file. When you use a global binding, the key is occupied for all modes, and you don't really need that.

share|improve this answer
Wow, great. It worked. Thanks! added: '(tool-bar-style (quote image)) to my custom-set-variables, and bound the following keys: (global-set-key (kbd "C-c C-a") 'my-run-latex) –  Onur Jul 24 '12 at 20:54
Great. Using local-set-key is slightly better than global-set-key. –  Tyler Jul 24 '12 at 21:01
(add-hook 'LaTeX-mode-hook (function (lambda () (local-set-key (kbd "C-c C-a") 'my-run-latex) ))) –  Onur Jul 24 '12 at 22:04
@AlfredM. Thanks, corrected! –  Tyler Oct 18 '13 at 15:45
add comment

Your Answer


