#!/bin/tcsh # Updated on 2006/10/17 - Thanks to Marc Schonbrun! # ########################## # HOW TO USE THIS FILE: # ########################## # # 0) Set the variable LILYPONDFOLDER below to the absolute path # of the folder containing the Lilypond application. # For example, if you have put the Lilypond app in a folder # called Music inside the Applications folder, the path # is /Applications/Music and the line below must read # # set LILYPONDFOLDER = /Applications/Music # # If Lilypond is installed in the Applications folder, # then just skip this step. # set LILYPONDFOLDER = /Applications/Lilypond/#current set path = ($path $LILYPONDFOLDER/LilyPond.app/Contents/Resources/bin/) # # 1) Rename this file by dropping the .txt suffix # and put it into your Library/TeXShop/Engines folder. # # 2) Run the Terminal application (which you find in the Utilities folder) # and, in the Terminal window, type: # # cd ~/Library/TeXShop/Engines # # then, press the Enter key and type: # # chmod +x Lilypond-LaTeX.engine # # and press Enter again. The above command makes this script executable. # # 3) Switch to TeXShop, open a LaTeX file with Lilypond code, # choose the Lilypond-LaTeX engine and typeset! # ####### # HINT ####### # # Write: # # %!TEX TS-program = Lilypond-LaTeX # # at the very beginning of your document: this will let TeXShop # automatically switch to the right engine! # ####### # NOTE about including pictures with \includegraphics: ####### # # you may want to include the following in the preamble of your # source file: # # \usepackage{graphicx} # \graphicspath{{../}} # # since the generated LaTeX file is put into a subdirectory # of the current directory. # # In general, if your directory structure is as follows # # MyLilyPondDocs/ # MyLilyPondDocs/lilybook.lytex # MyLilyPondDocs/MyPictures/ # MyLilyPondDocs/MyPictures/pic1.eps # ... # MyLilyPondDocs/MyPictures/picn.eps # # the preamble of lilybook.lytex should contain: # # \graphicspath{{../MyPictures/}} # # The trailing slash "/" is required! # # Create directory to put all temporary stuff mkdir -p "$1:r"-out/ cd "$1:r"-out rm "$1:r".tex cd ../ if ({ lilypond-book -I "$1:r"-out --output="$1:r"-out --pdf "$1" }) then cd "$1:r"-out if ({ xelatex --output-driver="xdvipdfmx -qq -E" "$1" }) then mv "$1:r".pdf .. endif endif #cp "$1:r".pdf ../ #open "$1:r".pdf