[Top][All Lists]

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

Re: [AUCTeX-devel] Questions about latex.el

From: Tassilo Horn
Subject: Re: [AUCTeX-devel] Questions about latex.el
Date: Wed, 31 Jul 2013 09:32:41 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Ben A. <address@hidden> writes:

Hi Ben,

> I have been trying to read and modify latex.el and have a few
> questions:
> 1. I wanted to add support for the align and align* environments and had
>    some questions about how to do that.

AUCTeX already has support for those.  As soon as you use the amsmath
packade (`C-c RET usepackage RET amsmath RET'), `C-c C-e' also completes

>    a. What is the difference between LaTeX-environment-list and
>    LaTeX-indent-environment-list?  Also, I could not find where
>    LaTeX-environment-list is defined.

LaTeX-environment-list is a variable defined by AUCTeX's auto parser.
That parser ensures that, e.g., also custom environments you've defined
using \newenvironment are picked up by AUCTeX.

>    b. The definition of LaTeX-add-environments doesn't make sense to me.
>    While the name is suggestive, what is this function actually doing?

It adds a given environment to the list of known environments.  E.g.,

  (LaTeX-add-environments "foo")

will add a new foo environment, so that C-c C-e lets you complete foo.
When the environment has special options and arguments, an argument
function may be provided, too.  You can find tons of examples in the
AUCTeX style files.  For example, amsmath.el does this:

--8<---------------cut here---------------start------------->8---
     '("align"      LaTeX-env-label)
     ;; ...
--8<---------------cut here---------------end--------------->8---

That adds the align environment and tells that also a \label should be
inserted.  align* is only added as plain environment with no additional
arguments or contents.

>    c. LaTeX-common-initialization calls LaTeX-add-environments with
>    hardcoded arguments.  Why are these arguments hardcoded?

It adds the environments that are available with any LaTeX document,
e.g., the document environment.

>    Could they be set outside this function with defvar or defcustom?

I don't know exactly what you mean.  Sure, you could have a
defvar/defcustom that lists the environments to be added by default, and
`LaTeX-common-initialization' would then add them.  But I don't see the

> 2. I added my custom keybindings to LaTeX-math-list at runtime.
>    However, the changes are not refreshed when calling LaTeX-math-mode
>    and only were reflected after restarting emacs.  

Indeed, I've just fixed this in Git.  Now when you customize that
variable, the effects are applied automatically.  When you want to use
setq in your ~/.emacs instead, you should call `LaTeX-math-initialize'

>    b. Also, there is nothing in the manual about LaTeX-math-list.  This
>    seems like something that many users would like to add their custom
>    bindings to.

There is:

,----[ (info "(auctex)Mathematics") ]
|  -- User Option: LaTeX-math-list
|      A list containing user-defined keys and commands to be used in
|      LaTeX Math mode.  Each entry should be a list of two to four
|      elements.
|      First, the key to be used after 'LaTeX-math-abbrev-prefix' for
|      macro insertion.  If it is nil, the symbol has no associated
|      keystroke (it is available in the menu, though).
|      Second, a string representing the name of the macro (without a
|      leading backslash.)
|      Third, a string representing the name of a submenu the command
|      should be added to.  Use a list of strings in case of nested menus.
|      Fourth, the position of a Unicode character to be displayed in the
|      menu alongside the macro name.  This is an integer value.

> 3. I have been wanting to use a modifier key in place of
>    LaTeX-math-abbrev-prefix so I can produce greek letters by holding
>    down a modifier key rather than pressing LaTeX-math-abbrev-prefix
>    then a letter.  What changes are needed to make this possible?

I think you can't.  Of course you can just do

  (define-key LaTeX-mode-map (kbd "M-a") 'LaTeX-math-alpha)

for the symbols you frequently use.


reply via email to

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