auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] amsmath, amsthm automatially insert thm, lemma etc


From: Uwe Brauer
Subject: Re: [AUCTeX-devel] amsmath, amsthm automatially insert thm, lemma etc
Date: Wed, 21 Oct 2015 10:50:49 +0300
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/25.0.50 (gnu/linux)

>>> "Arash" == Arash Esbati <address@hidden> writes:

   > Hi Uwe,
   > Uwe Brauer <address@hidden> writes:

   >> I played around a bit the thing I miss most is the automatic insertion
   >> of labels, but that might be a job of reftex?!

   > Thanks, does it mean that everything else worked fine?  If yes, I would
   > make a proper submission and update the style.

As I said right now I have to finish some work and depend heavily on the
possibility to insert theorems, lemma in the most comfortable fashion. I
will show my solution below.

   > Reg. automatic label insertion, yes, you have to tell RefTeX about your
   > new environment and update `reftex-label-alist'.  Note that `?e' is for
   > equations, choose another `key-type' acc. to your needs.

   > \documentclass{article}

[...]

Now wait, all what you said below is true and I am aware of it. But this
is not automatically insertion of labels.

Take my solution:

,----
| (defun LaTeX-thm-insert (environment) ;Version:1.20
|   (if (y-or-n-p
|          (format "Do you want a title "))
|     (let ((title (read-input "(optional) Title: ")))
|     (LaTeX-insert-environment "thm" (concat "[" title "]"))
|     (and (LaTeX-label environment)
|        (newline-and-indent)))
|     (LaTeX-insert-environment "thm")
|     (and (LaTeX-label environment)
|        (newline-and-indent))))
`----

This function of course is in

,----
| (defun my-LaTeX-TeX-add-symbols ()
|      (LaTeX-add-environments
|        '("newequation" LaTeX-env-label)
|        '("appendices" LaTeX-env-label)
|        '("subappendices" LaTeX-env-label)
|        '("thm" LaTeX-thm-insert)))
| (add-hook 'LaTeX-mode-hook 'my-LaTeX-TeX-add-symbols)
`----

So as you can see a label is added automatically. Couldn't you provide
that functionality?




reply via email to

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