Dear all,
as you all know, editing tables in LaTeX can be quite tedious.
Luckily in AUCTeX we got a couple of nice features, auto insertion of
the appropriate &s and a good indentation function in tabular-like
environments, but there is still much room for improvements.[1]
What I often want is to have the table aligned. Emacs has the great
`align-current' function, by I get tired to manually call it every now
and then, and so I often don't run it all. In addition, I have
`auto-fill-mode' on, but in order to have the table aligned
auto-filling doesn't really make sense. So, why don't hack
auto-filling in order to run `align-current'? Then I came up with
this simple solution:
(defun mg/LaTeX-auto-fill-function ()
(if (member (LaTeX-current-environment) '("tabular"))
(align-current)
(do-auto-fill)))
(add-hook 'LaTeX-mode-hook
(lambda ()
(setq auto-fill-function 'mg/LaTeX-auto-fill-function)))
So, if current environment is tabular, auto-fill-function, triggered
by SPC, RET, and so on, calls `align-current', otherwise the usual
filling function is used (replace `do-auto-fill' wit your favorite
one).
In addition, in order to have tables really visually aligned (useful
for rectangular selection) you should also truncate lines and make
sup/subscript as large as normal characters, unless you already do so.
For this, take a look at
(defun toggle-LaTeX-rectangular-edit-ready-mode ()
(interactive)
(if (equal truncate-lines nil)
(progn
(set-face-attribute
'font-latex-subscript-face nil
:height 1.0)
(set-face-attribute
'font-latex-superscript-face nil
:height 1.0)
(setq truncate-lines t)
(message "LaTeX-rectangular-edit-ready-mode has been switched on"))
(progn
(set-face-attribute
'font-latex-subscript-face nil
:height 0.8)
(set-face-attribute
'font-latex-superscript-face nil
:height 0.8)
(setq truncate-lines nil)
(message "LaTeX-rectangular-edit-ready-mode has been switched off"))))
Source: http://emacs.stackexchange.com/a/17207/620
I want to make it clear I'm not going to include in AUCTeX any of this
features, they're just some hints for you, but they can be highly
inefficient, so use them at your own risk ;-)
Happy TeXing,
Mosè
Note
[1] Suggestions welcome.
_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex