auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-devel] C-j for tabular environments


From: Philipp Müller
Subject: [AUCTeX-devel] C-j for tabular environments
Date: Sun, 03 Jun 2012 13:38:56 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

I added some lines to latex.el to acchieve automatic insertion of
separator lines within tabular environments similar to automatic
insertion of \item within description or itemize environments.

The diff is below (sorry, I'm no expert in creating diffs/patches, so I
used Emacs' diff-backup).

diff -c /usr/local/share/emacs/site-lisp/auctex/latex.el\~
/usr/local/share/emacs/site-lisp/auctex/latex.el

*** /usr/local/share/emacs/site-lisp/auctex/latex.el~   2012-03-21
00:25:06.143391917 +0100
--- /usr/local/share/emacs/site-lisp/auctex/latex.el    2012-06-03
13:29:25.224582648 +0200
***************
*** 1133,1138 ****
--- 1133,1150 ----
    "Insert a new bibitem."
    (TeX-insert-macro "bibitem"))

+ (defun LaTeX-item-tabular ()
+   (interactive)
+   (save-excursion
+     (re-search-backward
+      "\\\\\\(begin\\|end\\) *{ *tabular *} *{\\([^%]*\\)}" nil t)
+     (message (match-string 2))
+   )
+   (let ((tableformat
+        (replace-regexp-in-string "{.*?}\\||\\|@\\| " "" (match-string 2))))
+     (message tableformat)
+     (insert (replace-regexp-in-string "." "& " tableformat) "\\\\")))
+
  ;;; Parser

  (defvar LaTeX-auto-minimal-regexp-list
***************
*** 5054,5060 ****

    (make-local-variable 'LaTeX-item-list)
    (setq LaTeX-item-list '(("description" . LaTeX-item-argument)
!                         ("thebibliography" . LaTeX-item-bib)))

    (setq TeX-complete-list
        (append '(("\\\\cite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"
--- 5066,5073 ----

    (make-local-variable 'LaTeX-item-list)
    (setq LaTeX-item-list '(("description" . LaTeX-item-argument)
!                         ("thebibliography" . LaTeX-item-bib)
!                         ("tabular" . LaTeX-item-tabular)))

    (setq TeX-complete-list
        (append '(("\\\\cite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"

Diff finished.  Sun Jun  3 13:32:45 2012



reply via email to

[Prev in Thread] Current Thread [Next in Thread]