[Top][All Lists]

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

Re: [AUCTeX-devel] a LaTeX-env-usepackage environment

From: Carlos
Subject: Re: [AUCTeX-devel] a LaTeX-env-usepackage environment
Date: Mon, 10 Feb 2014 06:02:44 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hello Mosè 

>non-trivial documents require more than one package to be loaded and
>with different options (so can't be loaded with a single
>`\usepackage{pkg1,pkg2,pkg3,...}', think about `fontenc', `inputenc'
>and `babel'). 

Absolutely! And I agree with you. But no, that is not what I meant. To
 teh contrary. Maybe I did not make the intention clear enough, or you
 misunderstood Mosè. I thought you were going to compile and test it
 out, But either way, Let's go back to it. 

 If you add these lines 

 (defun LaTeX-env-usepackage (&optional ignore)
   "Insert new LaTeX package."
   (TeX-insert-macro "usepackage")
   (end-of-line 0)
   (setq LaTeX-document-style-hook nil)) 

in latex.el, to be exact, in the environment hooks, and of course, you
also must add 

           '("usepackage" LaTeX-env-usepackage) 

in LaTex-add-environments, then not only the usepackage would be bound
to the same keys, that is, C-c C-e, but each package would be
individually selected. Not only that, but you have the options readily 

For example, I just created a new document. Then C-c C-e takes me to
Environment type: (default document) which is followed by Document
class: (default article), which further invokes the Options for said
article. Then it applies the hooks, while at the same time, places
the pointer in between \begin{document} and \end{document}, which is
expected as well. 

The only thing you would have to do, is go back two lines, or to be
exact, one line above\begin{document}, which is expected too, since you
have to place \usepackage in the preamble of the document, and invoke
C-c C-e again.

The next C-c C-e brings Environment type (default itemize), since it
is the default as an environment, so by just selecting usepackage,
which in return, will give you the options for the packages, and  you'll have
the list. Either for the options of the package, and if you do not
specify an option, then each package will be, like I said, individually 

I don't know about a template Mosè, and perhaps it is a novel idea, but
this seems to me not only convenient, but it auto-completes. Which
needless to say, brings the whole list of TeX Live packages and the
packages' options along with it, in the other frame. 

I have found out more about the  packages available in TeX Live 
by having those lines in latex.el, than just by looking at the TDS. 

Please, try it out and let me know. 

I don't know what Tassilo thinks about it, but anyone else in the list
is more than welcomed to offer his/her opinion or feedback. 

Take care guys, have a good one

reply via email to

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