Hi all,

the display math command \[...\] is equal to an "equation*"
environment (at least when amsmath is loaded), but indentation is
treated differently.  The attached patch makes AUCTeX indent inside
\[...\] as in a normal environment.  Comments welcome.

Bye,
Mosè
diff --git a/latex.el b/latex.el
index fc5ebdb..c232c24 100644
--- a/latex.el
+++ b/latex.el
@@ -2948,7 +2948,7 @@ indentation level in columns."
   :group 'LaTeX-indentation
   :type 'regexp)
 
-(defcustom LaTeX-end-regexp "end\\b"
+(defcustom LaTeX-end-regexp "end\\b\\|\\]"
   "*Regexp matching macros considered ends."
   :group 'LaTeX-indentation
   :type 'regexp)
@@ -3141,6 +3141,10 @@ outer indentation in case of a commented line.  The symbols
 	     ;; End brace in the start of the line.
 	     (- (LaTeX-indent-calculate-last force-type)
 		TeX-brace-indent-level))
+	    ((and (texmathp)
+		  ;; Display math \[...\], treat as a generic environment.
+		  (equal "\\[" (car texmathp-why)))
+	     LaTeX-indent-level)
 	    (t (LaTeX-indent-calculate-last force-type))))))
 
 (defun LaTeX-indent-level-count ()
_______________________________________________
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to