@c -*- coding: utf-8; mode: texinfo; -*-
@c This file is part of web/download.itexi and
@c learning/tutorial.itely

@c This is about "compiling" a lilypond file
@c (Learning 1 Tutorial), **not** compiling the
@c source code.

@macro lilypadOSX
@warning{These instructions assume that you are using the LilyPond
application.  If you are using any of the programs described in
@rweb{Easier editing}, please consult the documentation for
those programs if you have any problems.}


@subsubheading Step 1. Create your @file{.ly} file

Double click the @command{LilyPond.app}, an example file will open.

@sourceimage{Learning_Macos_welcome,,,}

From the menus along the top left of your screen, select
@w{@code{File > Save}}.

@sourceimage{Learning_Macos_Save_menu,,,}

Choose a name for your file, for example @file{test.ly}.

@sourceimage{Learning_Macos_Save_file_with_name,,,}


@subsubheading Step 2. Compile (with LilyPad)

From the same menus, select
@w{@code{Compile > Typeset}}.

@sourceimage{Learning_Macos_Typeset_menu,,,}

A new window will open showing a progress log of the compilation
of the file you have just saved.

@sourceimage{Learning_Macos_Compiling_log,,,}


@subsubheading Step 3. View output

Once the compilation has finished, a PDF file will be created with
the same name as the original file and will be automatically
opened in the default PDF viewer and displayed on your screen.

@sourceimage{Learning_Macos_pdf_output,,,}


@subsubheading Other commands

To create new files for LilyPond, begin by selecting
@w{@code{File > New}}

@sourceimage{Learning_Macos_New_menu,,,}

or @w{@code{File > Open}} to open and edit existing files you have
saved previously.

@sourceimage{Learning_Macos_Open_menu,,,}

You must save any new edits you make to your file before you
@w{@code{Compile > Typeset}} and if the PDF file is not displayed
check the window with the progress log for any errors.

If you are not using the default Preview PDF viewer that comes
with the Mac Operating system and you have the PDF file generated
from a previous compilation open, then any further compilations
may fail to generate an update PDF until you close the original.



@end macro


@macro lilypadWindows
@warning{These instructions assume that you are using the built-in
LilyPad editor.  If you are using any of the programs described in
@rweb{Easier editing}, please consult the documentation for
those programs if you have any problems compiling a file.}


@subsubheading Step 1. Create your @file{.ly} file

Double-click the LilyPond icon on your desktop and an example file will open.

@sourceimage{LilyPad,,,}

From the menus that appear along the top of the example file,
select @w{@code{File > Save as}}.  Do not use the @w{@code{File > Save}}
for the example file as this will not work until you have given it a
valid LilyPond file name.

@sourceimage{FileSave,,,}

Choose a name for your file, for example @file{test.ly}.

@sourceimage{SaveAs,,,}


@subsubheading Step 2. Compile

To turn your LilyPond file into a music score, you need to compile it. This
can be done a number of ways -- using drag and drop, with right-click,
double-clicking or using the command line (a DOS box).  We'll look at the
first three to start with.

1. Drag-and-drop the file directly onto the LilyPond icon on the desktop.

@sourceimage{DragDrop,,,}

Not much will seem to happen, but after a short while, you should
see two new files on your desktop -- @file{test.log} and
@file{test.pdf}.

2. Right-click on the file and from the pop-up context menu and
choose @w{@code{Generate PDF}}.

@sourceimage{GenPDF,,,}

3. Or simply double-click the @file{test.ly}.


@subsubheading Step 3. View output

@file{test.pdf} contains the engraved @file{test.ly}
file. Double-click it and it should open in your PDF viewer:

@sourceimage{PDFRead,,,}


@subsubheading Other commands

To create a new file, begin by selecting @w{@code{File > New}} from
within any previously created file or @w{@code{File > Open}} to open and
edit any files you have saved before.  You can also edit a file by
right-clicking it and selecting @w{@code{Edit source}}.

@sourceimage{EditFile,,,}

You must save any edits you make before you try to compile your
file.  If the PDF file is not created or the output is not what you
expected, check the log file that will have been created during the
compilation attempt for any errors.

@sourceimage{BadLog,,,}

This log file is overwritten each time you compile your LilyPond file.

If you are viewing your file in a PDF viewer, then you must close the PDF
if you wish to try a new compilation as it may fail to create the new PDF
while it is still being viewed.

@sourceimage{BadLog2,,,}

@end macro


@c not lilypad at all, but I ran out of names.  :(
@macro lilypadCommandLine
@warning{These instructions assume that you are familiar with
command-line programs.  If you are using any of the programs
described in @rweb{Easier editing}, please consult the
documentation for those programs if you have any problems
compiling a file.}


@subsubheading Step 1. Create your @file{.ly} file

Create a text file called @file{test.ly} and enter:

@c double \\ required because this is inside a macro!
@example
\\version "@w{@versionStable{}}"
@{
@ @ c' e' g' e'
@}
@end example


@subsubheading Step 2. Compile (with command-line)

To process @file{test.ly}, type the following at the command prompt:

@example
lilypond test.ly
@end example

@noindent
You will see something resembling:

@example
GNU LilyPond @w{@versionStable{}}
Processing `test.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...
Solving 1 page-breaking chunks...[1: 1 pages]
Drawing systems...
Layout output to `test.ps'...
Converting to `./test.pdf'...
Success: compilation successfully completed
@end example

@subsubheading Step 3. View output

You may view or print the resulting @file{test.pdf}.

@end macro


