Setting up Emacs
A common issue with emacs and $\LaTeX$, at least when used with an OSX, is that the program has trouble finding the path to the $\TeX$ distribution. You'll have to tell emacs where all the $\TeX$ files are, by adding
(setq exec-path (append exec-path '("/Library/TeX/texbin")))
to the emacs' initiation file (typically at ~/.emacs).
Other issues that emacs has with the OSX is the default control (c) and meta (M) keys. While the standard keyboard has the control key in its bottom-left part (which makes it easy to press with the side of the hand while the fingers are in the letter keys), the Mac keyboard has the control key next to its bottom-left part, where the function key (fn) is. Something similar happens with the meta key, which in the Mac keyboard is replaced by the command key, but which emacs doesn't recognize as meta.
Thankfully, emacs allows a redefinition of the keys simply by adding a string in its initiation file:
- To set the left option key (alt in the Mac keyboard) as meta:
(setq mac-option-key-is-meta t)
- To set the command key as meta:
(setq mac-command-modifier 'meta)
- To disable the right option key (I think I needed this to be able to use the subscripts, brackets and the tilde with $\LaTeX$):
(setq mac-right-option-modifier nil)
- To set the function key (fn) as control:
(setq ns-function-modifier 'control)
The easiest way to count the words from a region is:
- Select a region.
- Press M-=.
- See the count of lines, words, and characters, in the mode-line.
Spell check the text
To install the dictionary:
(require 'flymake) (setq ispell-program-name "aspell") (setq ispell-dictionary "english")
To activate the spell checker in all the text modes:
(add-hook 'text-mode-hook 'flyspell-mode) (add-hook 'text-mode-hook 'flyspell-buffer)
To spell check the whole buffer:
Wrapping words in long sentences
To avoid lines with long lines of text add:
(add-hook 'text-mode-hook 'turn-on-auto-fill)
and, with the cursor in the paragraph that you want to wrap, use M-q.
To active the line number mode on every mode add:
Turn off the alarms
Every time you do an illegal movement with the keyboard (such as striking a key that emacs doesn't recognize) or with the mouse (such as some of the gestures that the Apple mouse has incorporated), emacs rings an alarm bell. To prevent this add:
(setq ring-bell-function 'ignore)