Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

electric pair mode and latex

45 views
Skip to first unread message

Laurent Hoeltgen

unread,
Jun 20, 2012, 1:41:00 AM6/20/12
to help-gn...@gnu.org
Hi,

electric pair mode automatically closes parentheses like (,[,{,... Can I
customize this such that when I edit a latex document it also closes
expressions like \left( with \right)?

Regards,
Laurent

Jeremiah Dodds

unread,
Jun 20, 2012, 1:50:39 AM6/20/12
to Laurent Hoeltgen, help-gn...@gnu.org
Yup, see 'electric-pair-pairs'

Laurent Hoeltgen

unread,
Jun 20, 2012, 3:23:38 AM6/20/12
to Jeremiah Dodds, help-gn...@gnu.org
Hi,

if I try to change this option (through the customize interface) by
adding \left( and \right) to the list, emacs complains with the
following message:

Saving electric-pair-pairs: This field should contain a single character.

Regards,
Laurent

Jeremiah Dodds

unread,
Jun 20, 2012, 8:41:57 AM6/20/12
to Laurent Hoeltgen, help-gn...@gnu.org
Sorry for the disinfo, I didn't actually attempt to customize it, only
saw that it was customizable, and assumed that it would allow arbitrary,
as opposed to single-character-only pair definitions.

Perhaps you can get something working with skeleton-mode
(http://www.emacswiki.org/emacs/SkeletonPair) ?

Andreas Röhler

unread,
Jun 20, 2012, 9:58:46 AM6/20/12
to help-gnu-emacs@gnu.org List
Am 20.06.2012 07:41, schrieb Laurent Hoeltgen:
> Hi,
>
> electric pair mode automatically closes parentheses like (,[,{,... Can I
> customize this such that when I edit a latex document it also closes
> expressions like \left( with \right)?
>
> Regards,
> Laurent
>
>

noted, as it's not so far away

https://blueprints.launchpad.net/s-x-emacs-werkstatt/+spec/electric

Stefan Monnier

unread,
Jun 20, 2012, 12:15:48 PM6/20/12
to
> electric pair mode automatically closes parentheses like (,[,{,... Can I
> customize this such that when I edit a latex document it also closes
> expressions like \left( with \right)?

I don't think you can right now. But patches to enable such things
would be welcome,


Stefan

Laurent Hoeltgen

unread,
Jun 20, 2012, 11:16:32 PM6/20/12
to Jeremiah Dodds, help-gn...@gnu.org
On 06/20/2012 02:41 PM, Jeremiah Dodds wrote:
> Laurent Hoeltgen <hoel...@gmail.com> writes:
>
>> On 06/20/2012 07:50 AM, Jeremiah Dodds wrote:
>>> Laurent Hoeltgen <hoel...@gmail.com> writes:
>>>
>>>> Hi,
>>>>
>>>> electric pair mode automatically closes parentheses like (,[,{,... Can I
>>>> customize this such that when I edit a latex document it also closes
>>>> expressions like \left( with \right)?
>>>>
>>>> Regards,
>>>> Laurent
>>>
>>> Yup, see 'electric-pair-pairs'
>>>
>>
>> Hi,
>>
>> if I try to change this option (through the customize interface) by
>> adding \left( and \right) to the list, emacs complains with the
>> following message:
>>
>> Saving electric-pair-pairs: This field should contain a single character.
>>
>> Regards,
>> Laurent
>
> Sorry for the disinfo, I didn't actually attempt to customize it, only
> saw that it was customizable, and assumed that it would allow arbitrary,
> as opposed to single-character-only pair definitions.
>
> Perhaps you can get something working with skeleton-mode
> (http://www.emacswiki.org/emacs/SkeletonPair) ?
>

Hi,

after a bit of googling I actually found this:

http://inthearmchair.wordpress.com/2008/11/01/automatically-inserting-matching-parentheses-for-latex-in-emacs/

which does exactly what I want.

Regards,
Laurent


0 new messages