lilypond-user
[Top][All Lists]
Advanced

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

Re: Extracting header fields for use by e.g. LaTeX?


From: Michael Haynie
Subject: Re: Extracting header fields for use by e.g. LaTeX?
Date: Sun, 27 Nov 2005 18:38:43 -0500

That looks like a nice hook.

I suppose I'd also have to tell lilypond to not generate the header for each song somehow, since I'm going to be handling that myself.

The change to \preLilypondExample can be made backward compatible by defining a variable that preLilypondExample can rely on -- it's a bit of a hack, though. Using a parameter might be worth a little breakage, since there will not likely be a huge number of places to edit.

One thing, though: using 2.6.4 (on Mac OS X, at least), lilypond-book seems to insist on parsing the --process arguments, and so complains that -b isn't a valid option. If a patch is possible against 2.6, that should also be corrected.

I'll be delighted to test the patch.

On Nov 27, 2005, at 5:22 PM, Bernard Hurley wrote:

On Sun, 2005-11-27 at 13:13 -0500, Michael Haynie wrote:
Yes, that's exactly what I was thinking about doing.

So: Which scheme functions do I need to replace to accomplish that?
Are the suggested hooks are documented/supported hooks?


I don't think scheme is going to help. I thnk the solution is to modify
lilypond-book slightly.

However if you take the files

--- test.lytex ---
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\lilypondfile{test.ly}
\end{document}
------------------

and
---- test.ly -------
\version "2.7.18"

\header {
    title="The test title"
    composer="Bernard Hurley"
}

{a b c}
--------------------

and run:
lilypond-book --psfonts --process="lilypond -b eps -H title " test.lytex

you get a file called something like:

lily-1915112629.title

which contains the text of the header "title" - you can do the same with
any other header.

in addition to the generated test.tex

Now the file test.tex contains the code:

-------------test.tex------------
........
\ifx\preLilyPondExample \undefined
  \relax
\else
  \preLilyPondExample
\fi
\def\lilypondbook{}%
\input lily-1915112629-systems.tex
.......
--------------------------------

Now
\input lily-1915112629-systems.tex
Notice:
1] The files lily-1915112629-systems.tex and lily-1915112629.title both
start with "lily-1915112629" so this prefix must be available to
lilypond-book when it generates this code.
2] notice the macro call \preLilyPondExample (it only takes effect if
the macro is defined). If lilypond-book were modified so that it
generated the parameter {lily-1915112629}. Then it would be possible for
you to define the macro so that it read the file with the header.

Actually this modification looks quite easy. The real problem is whether
this would break any existing lytex code. (It can't be upgraded with
convert-ly because that just upgrades lily files). Another solution
would be to have two user-definable macros in the same place, which
seems a bit silly.

I'll have a think about it and then submit a patch.

--
Bernard Hurley <address@hidden>






reply via email to

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