[Top][All Lists]

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

Re: [AUCTeX-devel] extended reftex-search-document

From: Tassilo Horn
Subject: Re: [AUCTeX-devel] extended reftex-search-document
Date: Fri, 28 Nov 2014 12:05:00 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Lars Madsen <address@hidden> 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

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:

    \item foo
    \item bar

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.


reply via email to

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