bug-lilypond
[Top][All Lists]
Advanced

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

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 12:06:34 +0000

On Tue, 2005-11-29 at 11:18 +0100, Han-Wen Nienhuys wrote:
> 
> Strange. I thought that @ was always a letter in the preamble? Note that 
> we only put it in the preamble.
> 
Actually the situation is a bit more complex than I implied in my
previous post.

1] \usepackage can only be used _after_ \documentclass that is because
as well as wrapping the package load in a \makeatletter ..
\makeatother, \usepackage also uses the parameters  specified in
\documentclass. So \usepackage is actually _designed_ to be used in the
preable of a document. If you run LaTeX on:

--------- test1.tex ---------
\usepackage{graphicx}
\documentclass[english]{article}
\begin{document}
\end{document}
-------------------------

you get the error:

! LaTeX Error: \usepackage before \documentclass.

2] At the _very_ _beginning_ of a latex document (i.e. before
\documentclass) '@' _is_ a letter. However \documentclass also wraps its
class load in \makeatletter ..  \makeatother. So that _after_ this call
'@' is "other". If you want to use an internal LaTeX (e.g. address@hidden)
in the preamble, you have to wrap it. Note that the following is quite
legal LaTeX:

--------- test2.tex ---------
\RequirePackage{graphicx}
\documentclass[english]{article}
\begin{document}
\end{document}
-------------------------

and LaTeX will not object to it. It will load the "graphicx" package
correctly (because '@' is a letter here). However it and the "article"
class will have been loaded in the "wrong order" and the results might
not be what expect. To quote The LaTeX companion p913:

"It is technically possible to load a package before a class by using
\RequirePackage, but this should be avoided unless you know what you are
doing."

-- 
Bernard Hurley <address@hidden>




reply via email to

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