--- Begin Message ---
Subject: |
TeX-fold-item and environments with an '*' |
Date: |
Thu, 18 Aug 2016 20:29:31 -0400 |
Hi,
I'm not sure if this is a bug, or if I'm not using folding properly. I'm
trying to enable folding of math environments, using
TeX-fold-env-spec-list to set the replacement text to "[equation]". This
works fine for environments like "align" and "alignat". However, these
environments have variants "align*" and "alignat*". These aren't
properly detected by TeX-fold-item, and get replaced by the default
"[env]" instead.
The problem seems to be the following form from Tex-fold-item:
((eq type 'env)
(concat (regexp-quote TeX-esc)
"begin[ \t]*{"
"\\([A-Za-z]+\\)}"))
This only matches environments with names composed only of letters.
Replacing it with:
((eq type 'env)
(concat (regexp-quote TeX-esc)
"begin[ \t]*{"
"\\([A-Za-z*]+\\)}"))
resolves the issue: with this, alignat* and align* are properly matched
and replaced. I'm using the following value for 'TeX-fold-item':
'(("[comment]"
("comment"))
("[equation]"
("alignat*" "align*" "align" "alignat")))
My questions:
1. Is there a way to get environments that have * characters in their
name to work properly with 'TeX-fold-item'?
2. If not, would the modification of the form I suggest above be
acceptable, or will it break something else?
Best,
Tyler
--
plantarum.ca
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#24263: TeX-fold-item and environments with an '*' |
Date: |
Sun, 21 Aug 2016 17:46:36 +0200 |
Hi Tyler,
2016-08-19 2:29 GMT+02:00 Tyler Smith <address@hidden>:
> Hi,
>
> I'm not sure if this is a bug, or if I'm not using folding properly. I'm
> trying to enable folding of math environments, using
> TeX-fold-env-spec-list to set the replacement text to "[equation]". This
> works fine for environments like "align" and "alignat". However, these
> environments have variants "align*" and "alignat*". These aren't
> properly detected by TeX-fold-item, and get replaced by the default
> "[env]" instead.
Note that C-c C-c C-b (`TeX-fold-buffer') already folds the
environments in the way you expect (because it matches all
environments listed in `TeX-fold-env-spec-list'), I guess you refer to
C-c C-o C-e (`TeX-fold-env') or something similar.
> The problem seems to be the following form from Tex-fold-item:
>
> ((eq type 'env)
> (concat (regexp-quote TeX-esc)
> "begin[ \t]*{"
> "\\([A-Za-z]+\\)}"))
>
> This only matches environments with names composed only of letters.
> Replacing it with:
>
> ((eq type 'env)
> (concat (regexp-quote TeX-esc)
> "begin[ \t]*{"
> "\\([A-Za-z*]+\\)}"))
>
> resolves the issue: with this, alignat* and align* are properly matched
> and replaced. I'm using the following value for 'TeX-fold-item':
I guess you refer to `TeX-fold-env-spec-list' variable.
> '(("[comment]"
> ("comment"))
> ("[equation]"
> ("alignat*" "align*" "align" "alignat")))
>
> My questions:
>
> 1. Is there a way to get environments that have * characters in their
> name to work properly with 'TeX-fold-item'?
> 2. If not, would the modification of the form I suggest above be
> acceptable, or will it break something else?
I applied the fix you suggested, thanks.
Bye,
Mosè
--- End Message ---