auctex-devel
[Top][All Lists]
Advanced

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

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


From: Damien Cassou
Subject: [AUCTeX-devel] [PATCH] New function to align tables
Date: Thu, 25 Aug 2011 17:57:04 +0200

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


reply via email to

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