I donβt have enough karma or anything else to comment, but I wanted to improve the HD style a bit.
Here is the original:
(loop for n from (string-to-char "A") to (string-to-char "Z") for c = (char-to-string n) do (insert (concat "\\newcommand{\\c" c "}{\\mathcal " c "}\n")))
First, Emacs Lisp has a read syntax for characters. Instead of (string-to-char "X") you can simply write ?X Then you can use the printf format style instead of char-to-string and concat to get the final result:
(loop for n from ?A to ?Z do (insert (format "\\newcommand{\\c%s}{\\mathcal %s}\n" nn)))
Now it is concise enough to enter text without thought into the M-: prompt.
I will also point out that TeX also has macros, if it is really TeX.
Edit: Another style tip for Joe Casadonte; (incf foo) much easier to type than (setq foo (+ foo 1)) .
source share