lilypond-user
[Top][All Lists]

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

 From: Bernard Hurley Subject: Re: Extracting header fields for use by e.g. LaTeX? Date: Sun, 27 Nov 2005 22:22:41 +0000

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"

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

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.

--