2

I have a problem that I could not solve with the help of google.

a) How do I have to adjust the .emacs file in order to use the Windows-Key (Super-Key) for shortcuts. I am working on a Linux system and the system does not use this key.

b) How do I create my own shortcuts using this key – I am sure that I have to do that in the .emacs file also but I haven’t found out exactly how to do it. The reason why I want to do all this is, that I a recently switched from TeXstudio to Autctex and I want to use (at least till I am getting used to the Emacs/Auctex World) as many of my old shortcuts (For: begin{quote}, section, italics, footnote etc.

So I want:

Win + i = Italics

Win + b = Bold

Win + Z = Quote

Win + F12 = begin{itemize}

Win + 1 = section

etc. etc.

If I should move the questions elsewhere I would be glad to do it…

5

Here is an example of what you want to accomplish:

(with-eval-after-load "latex"
  (define-key LaTeX-mode-map (kbd "s-z")
    (lambda ()
      (interactive)
      (LaTeX-insert-environment "quote")))
  (define-key LaTeX-mode-map (kbd "s-<f12>")
    (lambda ()
      (interactive)
      (LaTeX-insert-environment "itemize"))))

But please note that if you want to unleash the power of AUCTeX, you shouldn't try to mimic the shortcuts of other editors but exploit the default key-bindings. Thus, for example, you can insert the all font-related commands with C-c C-f C-X, where X is a different letter for each different font command (E for \emph, b for \textbf, etc... issue C-c C-f C-h for the complete list). This is much more powerful than what you may expect because it's context-sensitive, it lets you insert the appropriate macro depending on whether you're in plain-TeX or LaTeX mode and on whether you're inside or outside an equation, always with the same key-bindings.

In the same way, C-c C-s lets you insert a new sectioning command, there is no need to specify a different key-binding for it.

Any environment can be inserted with C-c C-e, which provides sensible default choices.

Any macro can be inserted with C-c C-m (or C-c RET), with a powerful autocompletion mechanism for the most common commands (more than 200 packages are supported).

  • Good answer, but I do find the C-c C-f C-X bindings really tedious. My professional writing includes lots of italicized words, so binding C-c i is a big improvement over the default key chain. – Tyler Nov 15 '16 at 18:32
  • Thank you very much! I am about to learn these commands but I only use Latex for "normal" Texts (no math etc.). One last thing: the two examples you gave are for environments. But how is the code when it comes to the change of fonts (to italics etc) and how when it comes to section? Or is section an environment? – PeterStrawson Nov 15 '16 at 22:02
  • To change an already present font command: C-u C-c C-f C-X. To change an already present environment: C-u C-c C-e. In these cases, you usually need to prefix the key-binding with C-u. – giordano Nov 16 '16 at 0:52

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.