Lars Madsen <[email protected]> writes:

Hi Lars,

> On another note, I was hit by this
>
> \begin{enumerate}[a)]
>
> I have a macro that cleans up envs and sets \begin/end parts on lines
> of their own, attempting to leave any arguments alone.
>
> I my macro (with point at [) I'm attempting to jump to the matching ],
> but using (forward-sexp) this fails on
>
> [a)]
>
> leaving me at ) and I end up with
>
> \begin{enumerate}[a)
> ]
>
> Any advise on the proper method to go to a matching end?

The problem is that ( and ) have parenthesis syntax in AUCTeX buffers,
i.e., they are assumed to come in pairs.  That's usually a sensible
assumption but fails in your concrete scenario.

What you could do is to change ('s and )'s syntax class to punctuation
instead of paren by doing

    (modify-syntax-entry ?\( ".")
    (modify-syntax-entry ?\) ".")

in the LaTeX mode hook.  Of course, that has the drawback that now
forward-sexp won't jump over properly (parenthesized sentences like this
one).

A really correct approach would scan for such occurences of paralist's
enumerate/compactenum/etc with such special label definitions and add a
'syntax-table property to the ) and ( characters which uses standard
LaTeX syntax table with the entries for ?\( and ?\) changed like above.

However, that doesn't seem to be that easy.  This for example is a valid
enumerate environment:

    \begin{enumerate}[{A}-(i)))){]}][10]
    \item foo
    \item bar
    \end{enumerate}

Basically, you have to take care that ] may also be contained in the
label spec if it's contained in a {} group, and there's also another
optional argument defining the maximum label width.

Bye,
Tassilo

_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to