auctex-devel
[Top][All Lists]
Advanced

[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: Fri, 14 Feb 2014 16:31:54 +0100

Hi Carlos,

2014-02-14 15:34 GMT+01:00 Carlos <address@hidden>:
>>Yes, but without a \documentclass you can't have a document environment,
>>so this is a special case.
>
> How did I know, that that was going to be the sort of answer to justify
> it?  Hehehe, But yes, you are right Tassilo.
>
> I could argue that no one
> would dare to compile an acceptable LaTeX document, unless usepackage is
> invoked,  and I probably would be right in that respect, and, in
> retrospect, that fact, would treat usepackage, no less special than
> documentclass, thus its inclusion in latex.el, as an environment, is
> somehow warranted.
> But the problem with this conclusion and why I'm wrong, is that the inference
> was deduced from documentclass, and its special status, does not make it
> less wrong either, for it is not an environment in the first place, and,
> as you probably know, this could be verified, by removing the entire
>
>   (defun LaTeX-env-document (&optional ignore)
>   "Create new LaTeX document.
>   The compatibility argument IGNORE is ignored."
>   (TeX-insert-macro "documentclass")
>   (LaTeX-newline)
>   (LaTeX-newline)
>   (LaTeX-newline)
>   (end-of-line 0)
>   (LaTeX-insert-environment "document")
>   (run-hooks 'LaTeX-document-style-hook)
>   (setq LaTeX-document-style-hook nil))
>
> in latex.el, and see for yourself, that it has no effect, in inserting the
> rest of the environments.

Actually, the current implementation of `LaTeX-env-document' isn't the
above one, but this:
http://git.savannah.gnu.org/cgit/auctex.git/tree/latex.el?id=107f0bf59572344b84bbb9fbdf29c3205f04b2af#n772
which inserts a `document' environment and, only if there is no
`\documentclass' before the point, adds also that macro.  So, the
environment inserted is `document' (as the name of the function
suggests), which is a real environment, and a `\documentclass' macro
is inserted, if needed, as a plus.

Previously you suggested to define a `LaTeX-env-usepackage' function
to insert a fictitious `usepackage' environment and this is completely
different from the `LaTeX-env-document' case because a `usepackage'
environment doesn't exist.

You're right when you say that an acceptable LaTeX document probably
requires one or more `\usepackage's, but the difference between
`\documentclass' and `\usepackage' is that for a *minimal* document
the former is required, the latter is not.  So it's "more important",
in a sense, to be sure there is the `\documentclass' than the
`\usepackage's.

You might want to insert the `\usepackage's after the `\documentclass'
inside the `LaTeX-env-document' and I might agree, but that would
require some care and work.  Is this what you want?  I can try to
write down a patch for this.

Bye,
Mosè



reply via email to

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