Changes

Jump to navigation Jump to search
2,423 bytes added ,  15:10, 20 April 2006
Added Johan's natural tables elisp
== Help with delimters and math mode ==
 
These customizations are mostly for faster insertion of special characters (and math mode).
 
<pre>
;;; Useful AUCTeX setup for ConTeXt (for your .emacs)
"\\\\\\(begin\\|section\\|chapter\\|documentstyle\\|documentclass\\)\\b")
("TEX" plain-tex-mode ".")))
</pre>
 
== Help with natural tables ==
 
These customizations, by Johan Sandblom, make entering natural tables easy.
 
<pre>
(defun context-insert-nattab (rows columns)
;; Johan Sandblom 2006-01-28
"Insert a TABLE skeleton"
(interactive "nNumber of rows: \nnNumber of columns: \n")
(newline)
(insert "\\bTABLE\n\\setupTABLE\[\]\n")
;; First a TABLE header
(insert "\\bTABLEhead\n\\bTR\\bTH \\eTH\n")
(let ((column 1))
(while (&lt; column (- columns 1))
(insert " \\bTH \\eTH\n")
(setq column (1+ column))))
(insert " \\bTH \\eTH\\eTR\n\\eTABLEhead\n\\bTABLEbody\n")
;; The rows and columns
(let ((row 1))
(while (&lt;= row rows)
(insert "\\bTR\\bTD \\eTD\n")
;; The let expression makes sure that each loop starts at the
;; right place
(let ((column 1))
(while (&lt; column (- columns 1))
(insert " \\bTD \\eTD\n")
(setq column (1+ column)))
(insert " \\bTD \\eTD\\eTR\n")
(setq row (1+ row))))
(insert "\\eTABLEbody\n\\eTABLE\n")))
 
(defun context-insert-nattab-row (columns)
"Insert a row in a TABLE"
(interactive "nNumber of columns: \n")
(newline)
(insert "\\bTR\\bTD \\eTD\n")
(let ((column 1))
(while (&lt; column (- columns 1))
(insert " \\bTD \\eTD\n")
(setq column (1+ column)))
(insert " \\bTD \\eTD\\eTR\n")))
 
(defun context-insert-nattab-column (&optional arg)
"Insert a column in a TABLE"
(interactive "P")
(insert "\\bTD \\eTD")
(indent-for-tab-command)
(newline)
(backward-char 5))
 
(defun context-insert-FLOW-cells (n)
;; Johan Sandblom 2006-01-28
"Insert a FLOWchart cell"
(interactive "nNumber of cells: \n")
(newline)
(let ((x 1))
(while (&lt;= x n)
(insert "\\startFLOWcell\n")
(insert " \\name {}\n")
(insert " \\location {}\n")
(insert " \\shape {action}\n")
(insert " \\text {}\n")
(insert " \\connection[rl]{}\n")
(insert "\\stopFLOWcell\n")
(setq x (1+ x)))))
 
(add-hook 'ConTeXt-mode-hook
'(lambda ()
(define-key (current-local-map) "\C-cnF" 'context-insert-FLOW-cells)
(local-set-key "\C-cnr" 'context-insert-nattab-row)
(local-set-key "\C-cnc" 'context-insert-nattab-column)
(local-set-key "\C-cnn" 'context-insert-nattab)))
</pre>
127

edits

Navigation menu