[Top][All Lists]

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

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

From: Mosè Giordano
Subject: Re: [AUCTeX-devel] a LaTeX-env-usepackage environment
Date: Sun, 9 Feb 2014 14:40:05 +0100

Hi Carlos,

2014-02-09 12:48 GMT+01:00 Carlos <address@hidden>:
>>Sorry, I can't get what you mean by «document as an environment should
>>not be changed to class».
> Hello Mosè.
> My question is, is it feasible to have usepackage bound to `C-c
> C-e`?
> Normally, the default is documentclass, followed by
> begindocument, since usepackage is optional. If a package needs to be
> loaded, then by inserting usepackage should be the next step to follow.
> Something in these lines
> (defun LaTeX-env-usepackage (&optional ignore)
>   "Insert new LaTeX package."
>   (TeX-insert-macro "usepackage")
>   (LaTeX-newline)
>   (LaTeX-newline)
>   (end-of-line 0)
>   (setq LaTeX-document-style-hook nil))
> and of course,  '("usepackage" LaTeX-env-usepackage) in the list of 
> environments.
> What do you think Mosè? Tassilo?
> Take care guys, have a good one.

Thank you for the explanation.  I don't think it's a good idea to add
a `(TeX-insert-macro "usepackage")' in that case, because most
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').  AUCTeX cannot foresee when should stop inserting a new
`usepackage' and prompting for a new package until an empty input is
reached isn't feasible with the current implementation of

In my opinion, the way to go in this case is to use a template.  Some
months ago I sent to the list a patch adding built-in support for
template (ie, without relying on external tools like autotype
skeletons), but I got no reply:


reply via email to

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