In Aquamacs, I would like to create a keyboard shortcut for the following command:

{\Hiero } 

for a text I want to select or type. I googled and I have not been able to find a working answer


Add the following code to your init file.

(eval-after-load "latex"
  '(setq TeX-font-list
      '((?\C-h "{\\Hiero " "}")))))

In this way you can insert {\Hiero } at point or wrap it around the selected text with C-C h (but you can change the key binding in the code).

The previous code exploits AUCTeX font management, here is a different solution making only use of standard Emacs Lisp.

(eval-after-load "latex"
  '(define-key LaTeX-mode-map
     (kbd "C-C h")
     (lambda (&optional beg end)
       (interactive "r")
       (if (TeX-active-mark)
           (goto-char end)
           (insert "}"))
           (goto-char beg)
           (insert "{\\Hiero ")))
     (insert "{\\Hiero ")
       (insert "}"))))))
  • it works perfectly. Where did you find the documentation about it? I thought of hacking the normal AucTeX commands like typewriter, but I did not know where they were anyway.@giordano – Roberto Gozzoli Jun 5 '15 at 3:32
  • @RobertoGozzoli I added another solution, using AUCTeX font management. The original code uses standard Emacs Lisp, you can start taking a look at gnu.org/software/emacs/manual/eintr.html – giordano Jun 5 '15 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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