auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] [PATCH] New function to align tables


From: Ivan Andrus
Subject: Re: [AUCTeX-devel] [PATCH] New function to align tables
Date: Tue, 30 Aug 2011 11:53:27 +0200

How does this differ from running `fill-paragraph' in the tabular environment?  It should be set up by `LaTeX-indent-environment-list' to run `align' (unless I set that up in my .emacs, but I don't think so).

-Ivan

On Aug 25, 2011, at 5:57 PM, Damien Cassou wrote:

Hi,

I've just created a function that align the '&' in a Latex table. This makes them much easier to read and change.

(defun LaTeX-align-table ()
 (interactive)
 (save-excursion
   (LaTeX-mark-environment)
   (align-regexp (region-beginning) (region-end) "\\(\\s-*\\)&" 1 1 t)))

Calling this function within the following environment:

address@hidden@{}}
 \toprule
 & Foo & Something different & Bar \\
 \midrule
 Yeah & 69  & 60  & 402  \\  
 Another yeah & 742 & 848 (x 3.2) & 3820 \\  
 \bottomrule
\end{tabular}

Results in the following:

address@hidden@{}}
 \toprule
              & Foo & Something different & Bar \\
 \midrule
 Yeah         & 69  & 60                  & 402  \\  
 Another yeah & 742 & 848 (x 3.2)         & 3820 \\  
 \bottomrule
\end{tabular}

What do you think?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry

_______________________________________________
auctex-devel mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/auctex-devel


reply via email to

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