bug-lilypond
[Top][All Lists]
Advanced

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

errors in lilypond-book Ver 2.7.21 /ChangeLog/1.4315/


From: Bernard Hurley
Subject: errors in lilypond-book Ver 2.7.21 /ChangeLog/1.4315/
Date: Fri, 02 Dec 2005 08:10:43 +0000

In line 1357:
        if (re.search (r"\\begin *{document}", str)
should read:
        if (re.search (r"\\begin\s*{document}", str)

In line 1359:
                str = re.sub (r"\\begin{document}",
should read
                str = re.sub (r"\\begin\s*{document}",

In line 1533:
                re.search (r"\\begin *{document}", c.replacement_text())):
should read
                re.search (r"\\begin\s*{document}", c.replacement_text())):

I would seriously question the wisdom of searching for {graphic[sx] in
"modify_preamble" before doing the replacement in because:

1. It attempts to solve a non-existent problem. It appears you are under
the impression that LaTeX will fail if you try to load a package twice.
This is simply not true. In code like:
        \usepackage{graphics}
        \usepackage{graphics}
the second "\usepackage" is simply ignored by LaTeX. This is standard
LaTeX behaviour to prevent recursive loads. Since "graphicx" loads
"graphics", this does not present a problem either.

2. Even if this were a problem, it would be very difficult to write code
to solve it. There are (at least) three ways of loading a package in
LaTeX:
        a. using "\usepackage" in the preamble, which incidentally
        could look like:
                \usepackage{onepackage,graphics,twopackage}
        b. using \RequirePackage in a .sty file (How are you going to
        check for this?)
        c. as a parameter to \documentclass

3. The code as written is potentially dangerous:
        a. It could cause "graphics" not to be loaded when the user
        wants it. -- You cannot be sure apriori that "graphics" could
        not have some other meaning as a parameter.
        b. It could cause "graphics" to be loaded when the user does
        _not_ want it. -- This could happen, for instance, if the user
        had written a custom graphics package that is inconsistent with
        "graphics"

A better solution is:

1. Scrap the search for "graphic[sx]"

2. Give the user the option _not_ to have "\usepackage{graphics}"
generated. The qickest - though perhaps not the best - to do this is to
have a command-line option.

If you agree with this I will submit a patch for it.

-- 
Bernard Hurley <address@hidden>




reply via email to

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