bug-lilypond
[Top][All Lists]

## Re: lilypond-book should generate \usepackage instead of \RequirePackage

 From: Bernard Hurley Subject: Re: lilypond-book should generate \usepackage instead of \RequirePackage - ver 2.7.20 /ChangeLog/1.4304/ Date: Tue, 29 Nov 2005 11:27:36 +0000

```On Tue, 2005-11-29 at 11:10 +0100, Mats Bengtsson wrote:
>
> Bernard Hurley wrote:
>
> >This is for ChangeLog/1.4304/ but with my patch applied to get
> >lilypond-book actually to generate LaTeX
> >
> >lilypond-book should not generate \RequirePackage{graphics} but
> >\usepackage{graphics}. The former version is for use in Class files,
> >where '@' has the status of a letter. \usepackage{graphics} is
> >equivalent to:
> >     \makeatletter\RequirePackage{graphics}\makeatother
> >and so loads the package in the right environment if used in the
> >preamble of a document file.
> >
> I was the one who initially proposed to use \RequirePackage instead of
> \usepackage, since I had got the impression that the latter wouldn't work
> if the package was already loaded earlier, but I stay corrected and will
> submit a corresponding patch to CVS.

LaTeX issues at most warning (depending on how it is set up) if you try
to load a package twice and ignores the second attempt this applies
whether \RequirePackage _or_ \usepackage is used. The effect of this is
that if the call has parameters, then it is the parameters of the first
load that are used.

>
> > It seems that:
> >     \includegraphics{filename}
> >still works, but some of the other facilities of the graphics package
> >may be broken. this too may break in future versions of the graphics
> >package.
> >
> >
> I'm not sure what you mean here. One issue was if we should use
> \usepackage{graphics} or \usepackage{graphicx}, but from Sect. 4.7
> of `texdoc grfguide`, I learnt that we should use the graphics package.

What I meant was that you should only rely on the documented interface
to a LaTeX package - \usepackage in a preamble and \RequirePackage in a
class file. Even if the code works when a package is loaded incorretly
it is no guarantee that it will not break if the package changes
internally. The graphics package is so old that it is unlikely to
happen, but you never know! The best package to use is "graphics" as it
is the more minimal of the two. "graphicx" is an extension of (and
actually loads) "graphics". If the user wants it, he/she can safely say
so in the preamble. A later \usepackage{graphics} will simply be
ignored.

--