GNU bug report logs - #26010
Indenting in tabulars and \&

Previous Next

Package: auctex;

Reported by: Arash Esbati <arash <at> gnu.org>

Date: Tue, 7 Mar 2017 13:26:01 UTC

Severity: normal

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Arash Esbati <arash <at> gnu.org>
Cc: 26010 <at> debbugs.gnu.org
Subject: bug#26010: Indenting in tabulars and \&
Date: Wed, 08 Mar 2017 02:49:41 +0900
Hi Arash,

> I'm not aware of any way to fix this *only* by tweaking the regexp here:

>     (re-search-backward "\\\\\\\\\\|&" beg-pos t)

> Any idea?

> Otherwise, I suggest the following change in `LaTeX-indent-tabular':
>     (cond (...
> 	  (t
> 	   (+ 2
>               (let ((any-col (save-excursion
>                                (when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t)
>                                  (current-column)))))
>                 (if (and any-col (string= "&" (substring (match-string-no-properties 0) -1)))
>                     (1+ any-col)
> 		  beg-col)))))))
> Comments welcome.

I think the form `(string= ...)' can be replaced with
`(= ?& (char-before (match-end 0)))'.

And here is another solution keeping the regexp untouched:
    (cond (...
	   (t
	    (+ 2
	       (let ((any-col (save-excursion
				(when (and
				       (re-search-backward "\\\\\\\\\\|&" beg-pos t)
				       (= ?& (char-after))
				       (not (TeX-escaped-p)))
				  (current-column)))))
		 (or any-col
		   beg-col))))))))

Using `TeX-escaped-p' might be overkilling since we allow loose usages of
(looking-at "\\\\\\\\") and (re-search-backward "\\\\\\\\... ) in this
function.

Bye,
Ikumi Keita




This bug report was last modified 8 years and 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.