auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] adding function to LaTeX-math-list


From: Michael Massmann
Subject: Re: [AUCTeX] adding function to LaTeX-math-list
Date: Tue, 11 Jan 2011 22:11:05 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11

Dear Ivan,

many thanks for your kind response. Your solution works perfectly. I had
indeed tried to modify the existing LaTeX-math-cal function but didn't
realise that the (intercative) statement was necessary and I must have
deleted it in the process of simplifying that function a little (it
contains a further if statement, if I remember correctly).

Can you recommend a consise Elisp tutorial that explains all of its main
features, without going into as much detail as the manual? That would be
handy in the future, I think.

Thanks again for your help!

Regards,
Michael




On 11/01/11 13:32, Ivan Andrus wrote:
> On Jan 6, 2011, at 1:21 PM, Massmann, M. (Michael) wrote:
> 
>> Dear all,
> 
> I'm sorry noone has gotten back to you yet (unless they did so
> off list).
> 
>> I’m new to Emacs: I hope my question is not too stupid.
> 
> Welcome.
> 
>> I’m trying to augment my LaTeX-math-list by a keybinding to insert
>> \mathsf{}, akin to the \mathcal{} provided by Auctex by default. 
> 
> Actually I'm pretty sure that it provides \mathsf{} as well.  See
> for example LaTeX-font-list, but perhaps you wanted something
> else.  Ah, now I see that ` c x inserts \mathcal{x}.
> 
>> I have added
>>  
>> (?\M-s LaTeX-math-sf)
>>  
>> to LaTeX-math-list and then defined
>>  
>> (defun LaTeX-math-sf (char)
>>   "Insert a {\\mathscr CHAR}."
>>   (insert "\\mathsf{" (char-to-string char) "}")
>> )
>>  
>> Yet when I execute the keybinding I get an error message saying:
>> “Wrong type argument: commandp, LaTeX-math-sf”
> 
> In Emacs, a command is a special type of function which can be
> called by the used.  It has to have an "interactive"
> specification so that Emacs knows how to get the argument when
> called from a keybinding.  So something like
> 
> (defun LaTeX-math-sf (char)
>   "Insert a {\\mathscr CHAR}."
>   (interactive "*c")
>   (insert "\\mathsf{" (char-to-string char) "}"))
> 
> should work.  In fact, if I were you, I would just copy
> `LaTeX-math-cal' and change the \mathcal to \mathsf.  That way
> you know it's going to work the same for both.
> 
>> I’d be most grateful if someone could indicate what I’m doing wrong.
>> Any hint is most welcome. Thanks!
> 
> I hope that helps.
> 
> -Ivan



reply via email to

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