Hello Dirck, > Forgive me for being naive, but I am having real problems integrating Lilypond > with LaTeX.
Don’t worry, we forgive you.
> I am not an experienced LaTeX user. I have worked through some tutorials (at
> learnlatex.org) and am able to do basic formatting, import images, etc, but
> thats about all.
>
> I thought it was possible to embed a lilypond file, or run Lilypond in LaTex.
Embedding Lilypond in LaTeX is not possible. What is possible is embedding
lilypond in LuaLaTeX
using the LuaLaTeX package `lyluatex`.
But what is possible is to use the `lilypond-book` preprocessor: This one takes
a TeX file with
embedded lilypond code, creates graphics for the lilypond scores and creates a
final tex file that
includes these graphics.
This tex-file can then be rendered by pdflatex. You can also pass the cli
option --pdf to lilypond-
book to produce the systems as pdf graphics rather than ps for use with pdftex.
I think texshop even has already an engine for this, you just need to copy
~/Library/TeXShop/Engines/Inactive/LilyPond-Book.engine
to
~/Library/TeXShop/Engines/LilyPond-Book.engine
and should then be able to select LilyPond-Book as engine and use the magic
comment
% !TEX program = LilyPond-Book
to have texshop automatically use this for a file.
> Does anyone know of a GOOD TUTORIAL, including ALL the obvious instructions,
> for
> making a book with Lilypond / LaTeX?
>
> I'm hoping to find something like:
>
> *
> Open TeXShop and type "\documentclass{book}"
> *
> Save your Lilypond piece in "...this directory with this prefix..."
> *
> in TeXShop, type the following lines of command:
> *
> \ whatever command
> *
> \ another command
> *
> \ etc commands
> *
> drag your lilypond file here (or type in the name and path of the file here:
> ".....") *
> click "Typeset"
Most tutorials for lilypond-book do not assume you are using texshop, but the
aforementioned
steps should integrate lilypond-book into texshop.
Then you only need to start your file using
% !TEX program = LilyPond-Book
and then follow the normal LaTeX/Lilypond-Book workflow and render the file
using texshop.
See here for a tutorial:
https://lilypond.org/doc/v2.26/Documentation/usage/lilypond_002dbook.html[1]
So assuming you are already familiar with LaTeX you write a normal LaTeX
document, but
anywhere inside of `\begin{document} ` and `\end{document}` you can do
\lilypond{ ... lilypond code ... }
for short lilypond snippets
\begin{lilypond}
... lilypond code ...
\end{lilypond}
for long snippets,
\lilypondfile{filepath.ly}
to include a lilypond file
or
\musicxmlfile{filepath.musicxml}
to include the result of `musicxml2ly`.
So here is a small example file (with magic comment for TeXShop):
% !TEX program = LilyPond-Book
\documentclass{book}
\title{My LilyPond Book}
\author{Valentina Petzel}
\begin{document}
\maketitle
\chapter{The entering of short snippets}
This chapter contains short LilyPond snippets such
as this \lilypond { { c'4 d' e' } } and such.
\chapter{The entering of long snippets}
This chapter contains longer LilyPond snippets such
as this:
\begin{lilypond}
theMusic = \relative c'' \repeat unfold 4 { c4 d c b a b d2 }
\score {
<<
\new Staff \theMusic
\new Staff \theMusic
\new Staff \theMusic
\new Staff \theMusic
>>
}
signature.asc
Description: This is a digitally signed message part.
