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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Bernard Hurley-3
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 <[hidden email]>


_______________________________________________
bug-lilypond mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

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

Han-Wen Nienhuys
Bernard Hurley wrote:

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


please do.


--
  Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen


_______________________________________________
bug-lilypond mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

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

Mats Bengtsson-6
I agree with what Bernard proposed, just make sure that the
\usepackage{graphics} is included just before \begin{document}
(so it comes after any other user supplied \usepackage).

   /Mats

Han-Wen Nienhuys wrote:

> Bernard Hurley wrote:
>
>>
>> If you agree with this I will submit a patch for it.
>>
>
>
> please do.
>
>

--
=============================================
        Mats Bengtsson
        Signal Processing
        Signals, Sensors and Systems
        Royal Institute of Technology
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463
        Fax:   (+46) 8 790 7260
        Email: [hidden email]
        WWW: http://www.s3.kth.se/~mabe
=============================================



_______________________________________________
bug-lilypond mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-lilypond