Dear Michael,
The lilypond-book command is basically a pre-processor which allows you
to embed lilypond inside (as one of the document types it supports) a
LaTeX document. It essentially takes "commands" it recognizes, such as
"\lilypondfile", processes the specified file, creating a bunch of
intermediate files and rewriting the tex file to include the
intermediate files. Any commands it doesn't recognize are passed
verbatim to LaTeX. This means that you can include gregorio scores in
the file passed to lilypond-book and they will be processed by LaTeX, or
in the case of gregorio, lualatex. Here's how it works. (Also note
that I'm typing all of this "off the cuff" so there may be a mistake and
some commands may differ depending on distribution and version, but it's
just here to give you an idea).
Lets say you have lilypond code in a file call mylilypondscore.ly and
you have a gabc chant in mygabcscore.gabc. Create a file including
both. Let's call it mycombinedscore.lytex:
% Preamble stuff goes here...
\lilypondfile[noindent]{mylilypondscore.ly}
% Stuff between scores goes here...
\includescore{mygabcscore.gabc}
% Stuff after scores goes here...
Next, run gregorio on the gabc file to make a tex file:
gregorio mygabcscore.gabc
# this produces mygabcscore.tex
Then, run lilypond-book on the lytex file to produce tex and pdf files:
lilypond-book --pdf --latex=lualatex mycombinedscore.lytex
# this produces mycombinedscore.tex and mycombinedscore.pdf
Sometimes, because of the way TeX works, you will have to rerun TeX (or
in our case lualatex) a few times before getting the final result. TeX
will tell you when this is necessary, though it may be a pain to read
through all the output to find the message. The previous command will
produce a mycombinedscore.tex file which you can use for the additional
runs:
lualatex mycombinedscore.tex
Now as far as all this stuff goes, a Makefile can automate everything.
Create a file called Makefile:
# This line tells make what it should make by default
default: mycombinedscore.pdf
# These lines tell make how to make mycombinedscore.pdf, which is
# dependent upon mycombinedscore.tex and mygabcscore.tex
# Note: this should really be a script which reads the TeX output
# and reruns lualatex until it doesn't need to be run any more,
# but this exercise is left to the reader
mycombinedscore.pdf: mycombinedscore.tex mygabcscore.tex
<tab>lualatex mycombinedscore.tex
# These lines tell make how to make mycombinedscore.tex, which is
# dependent upon mycombinedscore.lytex, mygabcscore.tex, and
# mylilypondscore.ly
mycombinedscore.tex: mycombinedscore.lytex mygabcscore.tex
mylilypondscore.ly
<tab>lilypond-book --pdf --latex=lualatex mycombinedscore.lytex
# These lines tell make how to make mygabcscore.tex, which is
# dependent upon mygabcscore.gabc
mygabcscore.tex: mygabcscore.gabc
<tab>gregorio mygabcscore.gabc
Now, to do everything, provided all the source files are there, you just
run
make
The advantage is that if you make a change in a file, say
mylilypondscore.ly, then running
make
again will only run the necessary steps, -- in this case, lilypond-book
and lualatex -- to produce the pdf file.
Make is a powerful tool, and you can even give it general rules like how
to make a tex file from any given gabc file, but I am no expert in Make,
so I suggest you look at the man page and/or one of the books written on
Make.
Regards,
Henry
On Sunday, 24 November 2013 at 08:43:00 am -0500, Michael Shirk wrote:
> I would be interested in any small example of how to integrate
> Lilypond as well (I've used lilypond - but only either through the
> OpenOffice extension, creating a clip to be integrated into a
> document, or else using Lilypond to create the entire document.)
> Being able to integrate into Tex isn't something I've had time to
> figure out.
>
> Although I'm sure there's a better way, I similarly tend to you a
> Python script to mark up my text files I create, expanding a few
> reduced characters into gregorio commands, references, drop caps, etc.
>
> I'd also love to learn more about using a makefile. I've never been
> on the creating end of one yet - and it seems very handy.
>
> -Michael
>
(older messages deleted for brevity)
_______________________________________________
Gregorio-users mailing list
[email protected]
https://mail.gna.org/listinfo/gregorio-users