[Top][All Lists]

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

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

From: Ivan Andrus
Subject: Re: [AUCTeX] adding function to LaTeX-math-list
Date: Tue, 11 Jan 2011 13:32:17 +0100

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.


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.


reply via email to

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