auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Insertion of braces in math mode for certain macros


From: Tassilo Horn
Subject: Re: [AUCTeX] Insertion of braces in math mode for certain macros
Date: Mon, 05 Nov 2012 20:41:30 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

Lionel Henry <address@hidden> writes:

Hi Lionel,

> Is there a way to specify a list of macros that should always be
> inserted with braces, even in math mode?

Yes.  Something like this should work:

  (add-hook 'LaTeX-mode-hook
            (lambda ()
              (TeX-add-symbols '("text" t))))

The single t means there's one mandatory argument for which {} should be
inserted and point placed in between.  See the description of t in:

,----[ C-h f TeX-parse-macro RET ]
| TeX-parse-macro is a compiled Lisp function in `tex.el'.
| 
| (TeX-parse-macro SYMBOL ARGS)
| 
| How to parse TeX macros which takes one or more arguments.
| 
| First argument SYMBOL is the name of the macro.
| 
| If called with no additional arguments, insert macro with point
| inside braces.  Otherwise, each argument of this function should
| match an argument to the TeX macro.  What is done depend on the
| type of ARGS:
| 
|   string: Use the string as a prompt to prompt for the argument.
| 
|   number: Insert that many braces, leave point inside the first.
| 
|   nil: Insert empty braces.
| 
|   t: Insert empty braces, leave point between the braces.
| 
|   other symbols: Call the symbol as a function.  You can define
|   your own hook, or use one of the predefined argument hooks.  If
|   you add new hooks, you can assume that point is placed directly
|   after the previous argument, or after the macro name if this is
|   the first argument.  Please leave point located after the
|   argument you are inserting.  If you want point to be located
|   somewhere else after all hooks have been processed, set the value
|   of `exit-mark'.  It will point nowhere, until the argument hook
|   set it.  By convention, these hooks all start with `TeX-arg-'.
| 
|   list: If the car is a string, insert it as a prompt and the next
|   element as initial input.  Otherwise, call the car of the list
|   with the remaining elements as arguments.
| 
|   vector: Optional argument.  If it has more than one element,
|   parse it as a list, otherwise parse the only element as above.
|   Use square brackets instead of curly braces, and is not inserted
|   on empty user input.
`----

Bye,
Tassilo




reply via email to

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