From 2771f1c76f3510bbb7398e661cd6927bbd7713d8 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Thu, 16 Jul 2020 14:31:51 +0200 Subject: [PATCH] update to new lyluatex version --- .gitignore | 3 +- .gitlab-ci.yml | 8 + Makefile | 152 ++-- bin/makebook | 655 ++++++++++++++++++ lib/lyluatex.lua | 186 ----- lib/lyluatex.sty | 69 -- src/scores/AllForMeGrog.ly | 37 - src/scores/BlackVelvetBand.ly | 45 -- src/scores/Buergerlied.ly | 43 -- src/scores/DrunkenSailor.ly | 44 -- src/scores/ImARoverSeldomSober.ly | 35 - src/scores/KerryRecruit.ly | 33 - src/scores/MuirsheenDurkin.ly | 45 -- src/scores/RisingOfTheMoon.ly | 33 - src/settings.tex | 8 +- src/singalongs.tex | 43 +- src/song.tex | 31 + src/songs.lua | 36 + src/songs.sty | 18 + src/songs/AllForMeGrog.ly | 57 ++ src/{lyrics => songs}/AllForMeGrog.tex | 0 src/{scores => songs}/AuldLangSyne.ly | 36 +- src/{lyrics => songs}/AuldLangSyne.tex | 0 src/songs/BlackVelvetBand.ly | 65 ++ src/{lyrics => songs}/BlackVelvetBand.tex | 0 src/songs/Buergerlied.ly | 64 ++ src/{lyrics => songs}/Buergerlied.tex | 0 src/songs/DrunkenSailor.ly | 64 ++ src/{lyrics => songs}/DrunkenSailor.tex | 4 +- src/{scores => songs}/FinnegansWake.ly | 36 +- src/{lyrics => songs}/FinnegansWake.tex | 0 src/{scores => songs}/FoggyDew.ly | 36 +- src/{lyrics => songs}/FoggyDew.tex | 0 src/songs/ImARoverSeldomSober.ly | 55 ++ src/{lyrics => songs}/ImARoverSeldomSober.tex | 0 src/{scores => songs}/IrishRover.ly | 36 +- src/{lyrics => songs}/IrishRover.tex | 0 src/{scores => songs}/JohnnyIHardlyKnewYe.ly | 36 +- src/{lyrics => songs}/JohnnyIHardlyKnewYe.tex | 0 src/songs/KerryRecruit.ly | 52 ++ src/{lyrics => songs}/KerryRecruit.tex | 0 src/{scores => songs}/MacPhersonsFarewell.ly | 36 +- src/{lyrics => songs}/MacPhersonsFarewell.tex | 0 src/{scores => songs}/MollyMalone.ly | 36 +- src/{lyrics => songs}/MollyMalone.tex | 0 src/songs/MuirsheenDurkin.ly | 65 ++ src/{lyrics => songs}/MuirsheenDurkin.tex | 0 src/{scores => songs}/NationOnceAgain.ly | 36 +- src/{lyrics => songs}/NationOnceAgain.tex | 0 src/{scores => songs}/PartingGlass.ly | 36 +- src/{lyrics => songs}/PartingGlass.tex | 0 src/songs/RisingOfTheMoon.ly | 53 ++ src/{lyrics => songs}/RisingOfTheMoon.tex | 0 src/{scores => songs}/SpancilHill.ly | 36 +- src/{lyrics => songs}/SpancilHill.tex | 0 src/{scores => songs}/StarOfTheCountyDown.ly | 36 +- src/{lyrics => songs}/StarOfTheCountyDown.tex | 0 src/{scores => songs}/WhiskeyInTheJar.ly | 36 +- src/{lyrics => songs}/WhiskeyInTheJar.tex | 0 src/{scores => songs}/WildRover.ly | 36 +- src/{lyrics => songs}/WildRover.tex | 0 src/title.tex | 4 +- 62 files changed, 1704 insertions(+), 771 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100755 bin/makebook delete mode 100644 lib/lyluatex.lua delete mode 100644 lib/lyluatex.sty delete mode 100644 src/scores/AllForMeGrog.ly delete mode 100644 src/scores/BlackVelvetBand.ly delete mode 100644 src/scores/Buergerlied.ly delete mode 100644 src/scores/DrunkenSailor.ly delete mode 100644 src/scores/ImARoverSeldomSober.ly delete mode 100644 src/scores/KerryRecruit.ly delete mode 100644 src/scores/MuirsheenDurkin.ly delete mode 100644 src/scores/RisingOfTheMoon.ly create mode 100644 src/song.tex create mode 100644 src/songs.lua create mode 100644 src/songs.sty create mode 100644 src/songs/AllForMeGrog.ly rename src/{lyrics => songs}/AllForMeGrog.tex (100%) rename src/{scores => songs}/AuldLangSyne.ly (51%) rename src/{lyrics => songs}/AuldLangSyne.tex (100%) create mode 100644 src/songs/BlackVelvetBand.ly rename src/{lyrics => songs}/BlackVelvetBand.tex (100%) create mode 100644 src/songs/Buergerlied.ly rename src/{lyrics => songs}/Buergerlied.tex (100%) create mode 100644 src/songs/DrunkenSailor.ly rename src/{lyrics => songs}/DrunkenSailor.tex (95%) rename src/{scores => songs}/FinnegansWake.ly (56%) rename src/{lyrics => songs}/FinnegansWake.tex (100%) rename src/{scores => songs}/FoggyDew.ly (50%) rename src/{lyrics => songs}/FoggyDew.tex (100%) create mode 100644 src/songs/ImARoverSeldomSober.ly rename src/{lyrics => songs}/ImARoverSeldomSober.tex (100%) rename src/{scores => songs}/IrishRover.ly (52%) rename src/{lyrics => songs}/IrishRover.tex (100%) rename src/{scores => songs}/JohnnyIHardlyKnewYe.ly (50%) rename src/{lyrics => songs}/JohnnyIHardlyKnewYe.tex (100%) create mode 100644 src/songs/KerryRecruit.ly rename src/{lyrics => songs}/KerryRecruit.tex (100%) rename src/{scores => songs}/MacPhersonsFarewell.ly (50%) rename src/{lyrics => songs}/MacPhersonsFarewell.tex (100%) rename src/{scores => songs}/MollyMalone.ly (52%) rename src/{lyrics => songs}/MollyMalone.tex (100%) create mode 100644 src/songs/MuirsheenDurkin.ly rename src/{lyrics => songs}/MuirsheenDurkin.tex (100%) rename src/{scores => songs}/NationOnceAgain.ly (57%) rename src/{lyrics => songs}/NationOnceAgain.tex (100%) rename src/{scores => songs}/PartingGlass.ly (51%) rename src/{lyrics => songs}/PartingGlass.tex (100%) create mode 100644 src/songs/RisingOfTheMoon.ly rename src/{lyrics => songs}/RisingOfTheMoon.tex (100%) rename src/{scores => songs}/SpancilHill.ly (55%) rename src/{lyrics => songs}/SpancilHill.tex (100%) rename src/{scores => songs}/StarOfTheCountyDown.ly (52%) rename src/{lyrics => songs}/StarOfTheCountyDown.tex (100%) rename src/{scores => songs}/WhiskeyInTheJar.ly (51%) rename src/{lyrics => songs}/WhiskeyInTheJar.tex (100%) rename src/{scores => songs}/WildRover.ly (51%) rename src/{lyrics => songs}/WildRover.tex (100%) diff --git a/.gitignore b/.gitignore index eef0234..05506b5 100755 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *~ out/ -pdf/ +build/ +tmp/ midi/ music/ .DS_Store diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..fcb276c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,8 @@ +build: + image: thallian/latex-builder + script: + - make + artifacts: + paths: + - build/* + expire_in: 1 week diff --git a/Makefile b/Makefile index 9d3125b..dac4332 100644 --- a/Makefile +++ b/Makefile @@ -1,101 +1,101 @@ -SHELL = /bin/sh +mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +WORKING_DIR := $(patsubst %/,%,$(dir $(mkfile_path))) +BOOKNAME=singalongs +SRC_DIR=src +BUILD_DIR=build +TMP_DIR=tmp +SONG_DIR=${SRC_DIR}/songs +BUILD_BOOK_DIR=${BUILD_DIR}/books +TMP_BOOK_DIR=${TMP_DIR}/books +BUILD_SONG_DIR=${BUILD_DIR}/songs +TMP_SONG_DIR=${TMP_DIR}/songs +BUILD_MIDI_DIR=${BUILD_DIR}/midi +TMP_MIDI_DIR=${TMP_DIR}/midi +BUILD_OPUS_DIR=${BUILD_DIR}/opus -# a list of all used commands (they have to be in your PATH) -LILYPOND = lilypond -LUALATEX = lualatex -MAKEINDEX = makeindex -TIMIDITY = timidity -OPUSENC = opusenc -PDF2PS = pdf2ps -PSBOOK = psbook -PSTOPS = pstops -PSNUP = psnup -PS2PDF = ps2pdf -SED = sed # do not use in-place editing for compatibility between different sed versions -RM = rm -MKDIR = mkdir -CD = cd -CP = cp +LY_FILES=$(wildcard ${SONG_DIR}/*.ly) +LY_PDFS=$(patsubst %.ly,${BUILD_SONG_DIR}/%.pdf,$(notdir ${LY_FILES})) +LY_TMP_PDFS=$(patsubst %.ly,${TMP_SONG_DIR}/%.pdf,$(notdir ${LY_FILES})) +LY_MIDIS=$(patsubst %.ly,${BUILD_MIDI_DIR}/%.midi,$(notdir ${LY_FILES})) +LY_TMP_MIDIS=$(patsubst %.ly,${TMP_MIDI_DIR}/%.midi,$(notdir ${LY_FILES})) +LY_OPUS=$(patsubst %.ly,${BUILD_OPUS_DIR}/%.opus,$(notdir ${LY_FILES})) -SRCDIR = src -OUTDIR = out -PDFDIR = pdf -MIDIDIR = midi -OPUSDIR = music -SCORESDIR = $(SRCDIR)/scores -LYRICSDIR = $(SRCDIR)/lyrics +.PHONY: book songs midi opus clean directories all +.DEFAULT_GOAL := all -OUTPUTFILE = $(OUTDIR)/singalongs.tex -TEXFILES = $(wildcard $(SRCDIR)/*.tex) -SCORES = $(wildcard $(SCORESDIR)/*.ly) -LYRICS = $(wildcard $(LYRICSDIR)/*.tex) -PDFS = $(patsubst %.ly,$(PDFDIR)/%.pdf,$(notdir $(SCORES))) -MIDIS = $(patsubst %.ly,$(MIDIDIR)/%.midi,$(notdir $(SCORES))) -OPUSFILES = $(patsubst %.ly,$(OPUSDIR)/%.opus,$(notdir $(SCORES))) +directories: ${BUILD_DIR} ${BUILD_BOOK_DIR} ${TMP_BOOK_DIR} ${BUILD_SONG_DIR} ${BUILD_MIDI_DIR} ${TMP_DIR} ${TMP_SONG_DIR} ${TMP_MIDI_DIR} ${BUILD_OPUS_DIR} -LILYPONDSUBST = $(foreach score,$(SCORES), \\\\chapter {$(shell grep title "$(score)" | awk -F '"|"' '{print $$2}')} \\\\includely[staffsize=18]{$(abspath $(score))} ~\\\\\\\\ ~\\\\\\\\ \\\\input{$(abspath $(LYRICSDIR)/$(notdir $(basename $(score)))).tex}) +${BUILD_DIR}: + mkdir -p ${BUILD_DIR} -BOOKPDF = $(PDFDIR)/book.pdf -BOOKLETPDF = $(PDFDIR)/booklet.pdf +${BUILD_BOOK_DIR}: + mkdir -p ${BUILD_BOOK_DIR} -MIDITEMPO = 120 +${BUILD_SONG_DIR}: + mkdir -p ${BUILD_SONG_DIR} -all: pdfs midis opus book booklet +${BUILD_MIDI_DIR}: + mkdir -p ${BUILD_MIDI_DIR} -pdfs: $(PDFS) +${TMP_DIR}: + mkdir -p ${TMP_DIR} -midis: pdfs $(MIDIS) +${TMP_BOOK_DIR}: + mkdir -p ${TMP_BOOK_DIR} -opus: midis $(OPUSFILES) +${TMP_SONG_DIR}: + mkdir -p ${TMP_SONG_DIR} -book: $(BOOKPDF) +${TMP_MIDI_DIR}: + mkdir -p ${TMP_MIDI_DIR} -booklet: $(BOOKLETPDF) +${BUILD_OPUS_DIR}: + mkdir -p ${BUILD_OPUS_DIR} -$(BOOKPDF): $(TEXFILES) $(SCORES) $(LYRICS) | $(PDFDIR) $(OUTDIR) - @$(CP) $(TEXFILES) $(OUTDIR)/ - @$(CP) -r lib/* $(OUTDIR)/ - @$(CP) -r $(SRCDIR)/images $(OUTDIR)/images +${TMP_SONG_DIR}/%.pdf: ${SONG_DIR}/%.ly ${SONG_DIR}/%.tex + cd ${SRC_DIR} && lualatex --jobname='$(notdir $(basename $@))' --output-directory=${WORKING_DIR}/${TMP_SONG_DIR} --shell-escape ${WORKING_DIR}/${SRC_DIR}/song.tex ${WORKING_DIR}/${SONG_DIR}/$(notdir $(basename $@)).ly ${WORKING_DIR}/${SONG_DIR}/$(notdir $(basename $@)).tex + rm -r ${SRC_DIR}/tmp-ly - @$(SED) "s;\musicbooklet;$(LILYPONDSUBST);g" $(SRCDIR)/singalongs.tex > $(OUTPUTFILE).00 - @$(SED) 's/REVISION/$(shell git log -1 --format="%h")/g' $(OUTPUTFILE).00 > $(OUTPUTFILE) +${BUILD_MIDI_DIR}/%.midi: ${TMP_MIDI_DIR}/%-1.midi + cp $< $@ - @$(CD) $(OUTDIR); \ - $(LUALATEX) -shell-escape singalongs.tex; \ - $(MAKEINDEX) singalongs.tex; \ - $(LUALATEX) -shell-escape singalongs.tex +${TMP_MIDI_DIR}/%-1.midi: ${SONG_DIR}/%.ly + lilypond --output=${TMP_MIDI_DIR} ${WORKING_DIR}/$< - @$(CP) $(OUTDIR)/singalongs.pdf $(PDFDIR)/$(@F) +${BUILD_OPUS_DIR}/%.opus: ${BUILD_MIDI_DIR}/%.midi + timidity $< -Ow -o - | opusenc - $@ -$(BOOKLETPDF): $(BOOKPDF) - $(PDF2PS) $(BOOKPDF) - | $(PSBOOK) | $(PSTOPS) -pa4 '1:0@1.0(-1.25cm,0cm)' | $(PSNUP) -2 | $(PS2PDF) - $(PDFDIR)/$(@F) +${TMP_BOOK_DIR}/%.pdf: ${SRC_DIR}/%.tex ${SRC_DIR}/images/title.png + latexmk -cd -lualatex -e '$$lualatex=q/lualatex %O -shell-escape %S/' -output-directory=${WORKING_DIR}/${TMP_BOOK_DIR} $< + rm -r ${SRC_DIR}/tmp-ly -$(PDFDIR)/%.pdf: $(SCORESDIR)/%.ly | $(PDFDIR) $(OUTDIR) - @$(SED) 's/%title/title/g' $< > $(OUTDIR)/$(notdir $<).00 - @$(SED) 's/\header {/\paper{indent=0\\mm} \\header { tagline=""/g' $(OUTDIR)/$(notdir $<).00 > $(OUTDIR)/$(notdir $<) - @$(LILYPOND) --output=$(PDFDIR)/$(basename $(@F)) $(OUTDIR)/$(notdir $<) +${TMP_BOOK_DIR}/%-folio.pdf: ${TMP_BOOK_DIR}/%.pdf + cd ${TMP_BOOK_DIR} && \ + ../../bin/makebook -v -t folio -i $(notdir $<) -o $(notdir $@) -$(MIDIDIR)/%.midi: $(SCORESDIR)/%.ly | $(MIDIDIR) $(OUTDIR) - @$(SED) 's/\layout { }/\midi{ \\tempo 4 = $(MIDITEMPO) }/g' $< > $(OUTDIR)/$(notdir $<).00 - @$(SED) 's/\header/\include "articulate.ly" \\header/g' $(OUTDIR)/$(notdir $<).00 > $(OUTDIR)/$(notdir $<).01 - @$(SED) 's/< $(OUTDIR)/$(notdir $<) - @$(LILYPOND) --output=$(MIDIDIR)/$(basename $(@F)) $(OUTDIR)/$(notdir $<) +#long edge binding +${TMP_BOOK_DIR}/%-quarto.pdf: ${TMP_BOOK_DIR}/%.pdf + cd ${TMP_BOOK_DIR} && \ + ../../bin/makebook -v -t quarto -i $(notdir $<) -o $(notdir $@) -$(OPUSDIR)/%.opus: $(MIDIDIR)/%.midi | $(OPUSDIR) - @$(TIMIDITY) $< -Ow -o - | $(OPUSENC) - $(OPUSDIR)/$(@F) +${TMP_BOOK_DIR}/%-sexto.pdf: ${TMP_BOOK_DIR}/%.pdf + cd ${TMP_BOOK_DIR} && \ + ../../bin/makebook -v -t sexto -i $(notdir $<) -o $(notdir $@) -$(PDFDIR): - @$(MKDIR) -p $(PDFDIR) +#short edge binding +${TMP_BOOK_DIR}/%-octavo.pdf: ${TMP_BOOK_DIR}/%.pdf + cd ${TMP_BOOK_DIR} && \ + ../../bin/makebook -v -t octavo -i $(notdir $<) -o $(notdir $@) -$(MIDIDIR): - @$(MKDIR) -p $(MIDIDIR) +${BUILD_DIR}/%.pdf: ${TMP_DIR}/%.pdf + cp $< $@ -$(OPUSDIR): - @$(MKDIR) -p $(OPUSDIR) +book: directories ${BUILD_BOOK_DIR}/${BOOKNAME}.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-folio.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-quarto.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-sexto.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-octavo.pdf ${LY_FILES} +songs: directories ${LY_PDFS} +midi: directories ${LY_MIDIS} +opus: directories ${LY_OPUS} +all: book songs midi opus -$(OUTDIR): - @$(MKDIR) -p $(OUTDIR) - -.PHONY: clean clean: - @$(RM) -rf $(PDFDIR) $(MIDIDIR) $(OPUSDIR) $(OUTDIR) + rm -rf ${BUILD_DIR} + rm -rf ${TMP_DIR} diff --git a/bin/makebook b/bin/makebook new file mode 100755 index 0000000..93913e0 --- /dev/null +++ b/bin/makebook @@ -0,0 +1,655 @@ +#!/bin/sh +# +AMDG This document was begun just before Christmas, +# 2010, and it is humbly dedicated to St. Wulfric, patron of +# bookbinders, and to the Immaculate Heart of Mary for their +# prayers, and to the Sacred Heart of Jesus for His mercy. +# +#**********************************************************# +# makebook # +# written by Donald P. Goodman III # +# Copyright (C) 2011 # +# # +# Impose pdf pages for binding # +#**********************************************************# +# +# This program is free software: you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more +# details. +# +# For a full copy of the GNU General Public License, see +# . +# +#**********************************************************# +# begin the code # +#**********************************************************# +# make script more portable and secure +PATH=/bin:/usr/bin:/usr/local/bin ; export PATH +umask 033 +# define our revision number variable for rcs +REVISION="2.1" +# define error codes +E_WRONG_ARGS=64 # too many or few args +E_BAD_SIG_TYPE=65 # invalid type of signature +E_BAD_UNIT=66 # unrecognized dimension unit used +E_BAD_FILENAME=67 # filename contains insecure chars, + # or doesn't exist +E_BAD_OPT=68 # bad command-line flag requested +E_NO_PROG=69 # missing a required program +# define usage variables +VERBOSE=0 # 0 if not verbose, 1 if -v +SIG_TYPE="folio" # type of section desired +PAGES_PER_SIG=4 # number of pages per signature +SECT_TYPE=1 # number of signatures per section +NUP="2x1" # default format of signatures +FRONT_FAVOR=0 # favor front for blanks; off by default +# define various variables to be zero by default +TGT_PAGE_WIDTH=0 +TGT_PAGE_HEIGHT=0 +HORIZ_DELTA=0 +VERT_DELTA=0 +HORIZ_OFFSET=0 +VERT_OFFSET=0 +SCALE=1 +# make sure user has the right programs installed, and die +# horribly if not +command -v od >/dev/null 2>&1 || + { echo >&2 "makebook: error: requires od, but it's not installed"; + exit $E_NO_PROG; + } +command -v pdflatex >/dev/null 2>&1 || + { echo >&2 "makebook: error: requires pdflatex, but it's not installed"; + exit $E_NO_PROG; + } +command -v pdfinfo >/dev/null 2>&1 || + { echo >&2 "makebook: error: requires pdfinfo, but it's not installed"; + exit $E_NO_PROG; + } +command -v pdftk >/dev/null 2>&1 || + { echo >&2 "makebook: error: requires pdftk, but it's not installed"; + exit $E_NO_PROG; + } +command -v dc >/dev/null 2>&1 || + { echo >&2 "makebook: error: requires dc, but it's not installed"; + exit $E_NO_PROG; + } +command -v bc >/dev/null 2>&1 || + { echo >&2 "makebook: error: requires bc, but it's not installed"; + exit $E_NO_PROG; + } + +# print the version information and exit successfully +versionfunc () +{ + echo "makebook v${REVISION}. Copyright (C) 2011, Donald P." + echo "Goodman III." + echo "This program comes with ABSOLUTELY NO WARRANTY." + echo "This is free software, and you are welcome to " + echo "redistribute it under certain conditions; see " + echo "the GNU GPL v3 for details." + exit 0 +} + +# print the online help and exit successfully +helpfunc () +{ +cat <&2 + exit $E_BAD_UNIT + fi + if [ `expr match "$1" '.*\(in\)'` ] + then + OPTARG=`echo "scale=0; ${1%in} * 72" | bc` + OPTARG=${OPTARG%.*} + elif [ `expr match "$1" '.*\(cm\)'` ] + then + OPTARG=`echo "scale=0; ${1%cm} * 28.3464567" | bc` + OPTARG=${OPTARG%.*} + elif [ `expr match "$1" '.*\(mm\)'` ] + then + OPTARG=`echo "scale=0; ${1%mm} * 2.83464567" | bc` + OPTARG=${OPTARG%.*} + elif [ `expr match "$1" '.*\(pt\)'` ] + then + OPTARG=`echo "scale=0; ${1%pt} / 1.00375" | bc` + OPTARG=${OPTARG%.*} + elif [ `expr match "$1" '.*\(pc\)'` ] + then + OPTARG=`echo "scale=0; (${1%pc} / 1.00375) * 12" | bc` + OPTARG=${OPTARG%.*} + elif [ `expr match "$1" '.*\(bp\)'` ] + then + OPTARG=${1%bp} + else + OPTARG=${1%.*} + fi +} +# define a for dealing with section types; convert () +# to words; e.g., "4to" to "quarto" +typearg () +{ + if [ "$1" = "4to" ] || [ "$1" = "quarto" ] + then + PAGES_PER_SIG=8 + NUP="2x2" + OPTARG="quarto" + elif [ "$1" = "2o" ] || [ "$1" = "folio" ] + then + PAGES_PER_SIG=4 + NUP="2x1" + OPTARG="folio" + elif [ "$1" = "8vo" ] || [ "$1" = "octavo" ] + then + PAGES_PER_SIG=16 + NUP="4x2" + OPTARG="octavo" + elif [ "$1" = "6to" ] || [ "$1" = "sexto" ] + then + PAGES_PER_SIG=12 + NUP="2x3" + OPTARG="sexto" + elif [ "$1" = "12mo" ] || [ "$1" = "duodecimo" ] + then + PAGES_PER_SIG=24 + NUP="4x3" + OPTARG="duodecimo" + else + echo "ERROR: signature type \"$1\" not recognized." >&2 + exit $E_BAD_SIG_TYPE + fi +} + +# clean up filename argument +filefunc () +{ + err_message="ERROR: bad characters in file name." + if [ `echo "$1" | grep '\?'` ] + then + echo "$err_message" >&2 + exit $E_BAD_FILENAME + elif [ `echo "$1" | grep '\*'` ] + then + echo "$err_message" >&2 + exit $E_BAD_FILENAME + elif [ `echo "$1" | grep '"'` ] + then + echo "$err_message" >&2 + exit $E_BAD_FILENAME + elif [ `echo "$1" | grep ';'` ] + then + echo "$err_message" >&2 + exit $E_BAD_FILENAME + elif [ `echo "$1" | grep '[\\]'` ] + then + echo "$err_message" >&2 + exit $E_BAD_FILENAME + elif [ `echo "$1" | grep ' '` ] + then + echo "$err_message" >&2 + exit $E_BAD_FILENAME + fi + OPTARG=`basename $1` +} + +# now identify and parse the options +while getopts "Vhvfn:t:H:w:d:D:m:M:s:i:o:" Option +do + case $Option in + V ) versionfunc;; + h ) helpfunc;; + v ) VERBOSE=1;; + f ) FRONT_FAVOR=1;; + n ) SECT_TYPE=$OPTARG;; + t ) typearg "$OPTARG"; SIG_TYPE=$OPTARG;; + H ) unitarg "$OPTARG"; TGT_PAGE_HEIGHT=$OPTARG;; + w ) unitarg "$OPTARG"; TGT_PAGE_WIDTH=$OPTARG;; + d ) unitarg "$OPTARG"; HORIZ_DELTA=$OPTARG;; + D ) unitarg "$OPTARG"; VERT_DELTA=$OPTARG;; + m ) unitarg "$OPTARG"; HORIZ_OFFSET=$OPTARG;; + M ) unitarg "$OPTARG"; VERT_OFFSET=$OPTARG;; + s ) SCALE=$OPTARG;; + i ) filefunc "$OPTARG"; FILE_NAME=$OPTARG;; + o ) filefunc "$OPTARG"; OUTFILE_NAME=$OPTARG;; + * ) echo "ERROR: unknown flag \ + \"$Option\"." >&2; exit $E_BAD_OPT;; + esac +done + +# make random file name to use for input +NEW_FILE_NAME="tmp_`od -An -N4 -t uL /dev/urandom | tr -d '\ '`.pdf" +# if input file specified, use file; if not, read stdin +if [ "$FILE_NAME" ] +then + cp "$FILE_NAME" "$NEW_FILE_NAME" +else + FILE_NAME="book.pdf" + cat /dev/stdin > "$NEW_FILE_NAME" +fi +# declare holder variable for pdftk +tmp_name="tmp_`od -An -N4 -t uL /dev/urandom | tr -d '\ '`.pdf" +# if output file specified, use that; if not, name it; if +# "-", use stdout +[ "$OUTFILE_NAME" ] || OUTFILE_NAME="sigs_$FILE_NAME" +if [ "$OUTFILE_NAME" = "stdout" ] +then + VERBOSE=0 +fi +# print our introduction message +if [ $VERBOSE -eq 1 ] +then + echo "makebook. Copyright (C) 2011, Donald P. Goodman III." + echo "This program comes with ABSOLUTELY NO WARRANTY." + echo "This is free software, and you are welcome to " + echo "redistribute it under certain conditions; see " + echo "the GNU GPL v3 for details." + echo "IMPOSING pdf pages onto \"$OUTFILE_NAME\"..." +fi + +# get some information about our source document +NUM_PAGES=`pdfinfo "$NEW_FILE_NAME" | awk '/Pages:/ {print $2}'`; +SRC_PAGE_WIDTH=`pdfinfo "$NEW_FILE_NAME" | awk '/Page\ size:/ {print $3}'`; +SRC_PAGE_HEIGHT=`pdfinfo "$NEW_FILE_NAME" | awk '/Page\ size:/ {print $5}'`; +# find the number of pages we'll have per signature +PAGES_PER_SIG=$(dc -e "$PAGES_PER_SIG $SECT_TYPE * p") +# determine if extra pages will be necessary +NUM_BLANKS=`expr $NUM_PAGES % $PAGES_PER_SIG` +if [ $NUM_BLANKS -ne 0 ] +then + NUM_BLANKS=`expr $PAGES_PER_SIG - $NUM_BLANKS` +fi +tmp=`expr $NUM_PAGES + $NUM_BLANKS` +NUM_SIGS=`expr $tmp / $PAGES_PER_SIG` + +# if extra pages are needed, generate blank page +if [ $NUM_BLANKS -gt 0 ] && [ ! -e "./blank.pdf" ] +then + echo "\documentclass{article}" > blank.tex + echo '\\thispagestyle{empty}' >> blank.tex + echo "\usepackage[paperwidth=${SRC_PAGE_WIDTH}bp,paperheight="${SRC_PAGE_HEIGHT}bp"]{geometry}" >> blank.tex + echo '\\begin{document}' >> blank.tex + echo "\quad \\\\end{document}" >> blank.tex + if [ $VERBOSE -eq 1 ] + then + echo "CREATING blank page to fill sections..."; + fi + pdflatex blank.tex > /dev/null 2&>1 +fi +# now insert blank pages as needed, preferring the back for +# odd numbers by default, front if stated +if [ $NUM_BLANKS -eq 1 ] +then + if [ $VERBOSE -eq 1 ] + then + echo "INSERTING one blank page..." + fi + if [ $FRONT_FAVOR -eq 0 ] + then + pdftk A="$NEW_FILE_NAME" B=blank.pdf cat A1-end \ + B1 output "$tmp_name" + else + pdftk A="$NEW_FILE_NAME" B=blank.pdf cat B1 \ + A1-end output "$tmp_name" + fi + mv "$tmp_name" "$NEW_FILE_NAME" +else +# tmp=`expr $NUM_BLANKS / 2` +# START_BLANKS=${tmp/.*} + START_BLANKS=`expr $NUM_BLANKS / 2` + END_BLANKS=`expr $NUM_BLANKS - $START_BLANKS` + if [ `expr $START_BLANKS % 2` -ne 0 ]; then : else + START_BLANKS=`expr $START_BLANKS - 1` + END_BLANKS=`expr $END_BLANKS + 1 ` + fi + if [ $FRONT_FAVOR -eq 1 ] + then + tmp=$START_BLANKS + START_BLANKS=$END_BLANKS + END_BLANKS=$tmp + if [ `expr $START_BLANKS % 2` -ne 0 ]; then : else + START_BLANKS=`expr $START_BLANKS - 1` + END_BLANKS=`expr $END_BLANKS + 1 ` + fi + fi + if [ $VERBOSE -eq 1 ] + then + echo "INSERTING $START_BLANKS blank pages at start..." + echo "INSERTING $END_BLANKS blank pages at end..."; + fi + i=0 + while [ $i -lt $START_BLANKS ] + do + pdftk A="$NEW_FILE_NAME" B=blank.pdf cat B1 A1-end output "$tmp_name" + mv "$tmp_name" "$NEW_FILE_NAME" + i=`expr $i + 1` + done + i=0 + while [ $i -lt $END_BLANKS ] + do + pdftk A="$NEW_FILE_NAME" B=blank.pdf cat A1-end B1 output "$tmp_name" + mv "$tmp_name" "$NEW_FILE_NAME" + i=`expr $i + 1` + done +fi +# begin the imposing, announcing if appropriate +tmp=`expr $NUM_PAGES + $NUM_BLANKS` +if [ $VERBOSE -eq 1 ] +then + echo "IMPOSING $NUM_PAGES pages ($tmp with blanks) on + $(dc -e "$NUM_SIGS $SECT_TYPE * p") signature(s) gathered in + sections of $SECT_TYPE signature(s) each..."; +fi +# arrange the pages for impression on signatures +i=1 +j=1 +if [ $VERBOSE -eq 1 ] +then + echo "REARRANGING pages..."; +fi +while [ $j -le $NUM_SIGS ] +do + if [ "$SIG_TYPE" = "quarto" ] + then + # determine size of target page + if [ $TGT_PAGE_HEIGHT -eq 0 ] + then + TGT_PAGE_HEIGHT=$(dc -e "$SRC_PAGE_HEIGHT 2 * p") + fi + if [ $TGT_PAGE_WIDTH -eq 0 ] + then + TGT_PAGE_WIDTH=$(dc -e "$SRC_PAGE_WIDTH 2 * p") + fi + # do the rearranging + k=$i; n=1; total=$(dc -e "$SECT_TYPE 8 * p"); m=$total + while [ $n -le $SECT_TYPE ] + do + pdftk "$NEW_FILE_NAME" cat `expr $k + $m - 1` $k \ + `expr $k + $m - 4`south `expr $k + 3`south \ + `expr $k + 1` `expr $k + $m - 2` `expr $k + 2`south \ + `expr $k + $m - 3`south output ${tmp_name%.pdf}_$n; + k=`expr $k + 4`; n=`expr $n + 1`; m=`expr $m - 8` + done + n=1 + while [ `expr $n + 0` -le $SECT_TYPE ] + do + if [ ! -e "$tmp_name" ] + then + pdftk A=${tmp_name%.pdf}_$n cat A1-end \ + output "$tmp_name" + else + pdftk A=$tmp_name B=${tmp_name%.pdf}_`expr $n` \ + cat A1-end B1-end output ${tmp_name}_tmp + mv ${tmp_name}_tmp "$tmp_name" + fi + n=`expr $n + 1` + done + if [ $VERBOSE -eq 1 ] + then + echo "REARRANGING section number $j..." + fi + j=`expr $j + 1`; + i=`expr $i + $total`; + elif [ "$SIG_TYPE" = "folio" ] + then + # determine size of target page + if [ 1 -eq "$(echo "${TGT_PAGE_HEIGHT} == 0" | bc)" ] + then + TGT_PAGE_HEIGHT=$(dc -e "$SRC_PAGE_HEIGHT 1 * p") + fi + if [ 1 -eq "$(echo "${TGT_PAGE_WIDTH} == 0" | bc)" ] + then + TGT_PAGE_WIDTH=$(dc -e "$SRC_PAGE_WIDTH 2 * p") + fi + # do the rearranging + k=$i; n=1; total=$(dc -e "$SECT_TYPE 4 * p"); m=$total + while [ $n -le $SECT_TYPE ] + do + pdftk "$NEW_FILE_NAME" cat `expr $k + $m - 1` \ + `expr $k` `expr $k + 1` `expr $k + $m - 2` \ + output ${tmp_name%.pdf}_$n; + k=`expr $k + 2`; n=`expr $n + 1`; m=`expr $m - 4` + done + n=1 + while [ `expr $n + 0` -le $SECT_TYPE ] + do + if [ ! -e "$tmp_name" ] + then + pdftk A=${tmp_name%.pdf}_$n cat A1-end \ + output "$tmp_name" + else + pdftk A="$tmp_name" B=${tmp_name%.pdf}_`expr $n` \ + cat A1-end B1-end output ${tmp_name}_tmp + mv ${tmp_name}_tmp "$tmp_name" + fi + n=`expr $n + 1` + done + if [ $VERBOSE -eq 1 ] + then + echo "REARRANGING section number $j..." + fi + j=`expr $j + 1`; + i=`expr $i + $total`; + elif [ "$SIG_TYPE" = "octavo" ] + then + # determine target page dimensions + if [ 1 -eq "$(echo "${TGT_PAGE_HEIGHT} == 0" | bc)" ] + then + TGT_PAGE_HEIGHT=$(dc -e "$SRC_PAGE_HEIGHT 2 * p") + fi + if [ 1 -eq "$(echo "${TGT_PAGE_WIDTH} == 0" | bc)" ] + then + TGT_PAGE_WIDTH=$(dc -e "$SRC_PAGE_WIDTH 4 * p") + fi + # do the rearranging + k=$i; n=1; total=$(dc -e "$SECT_TYPE 16 * p"); m=$total + while [ $n -le $SECT_TYPE ] + do + pdftk "$NEW_FILE_NAME" cat `expr $k + 3` \ + `expr $k + $m - 4` `expr $k + $m - 1` $k \ + `expr $k + 4`south `expr $k + $m - 5`south \ + `expr $k + $m - 8`south `expr $k + 7`south \ + `expr $k + 1` `expr $k + $m - 2` `expr $k + $m - 3` \ + `expr $k + 2` `expr $k + 6`south `expr $k + $m - 7`south \ + `expr $k + $m - 6`south `expr $k + 5`south \ + output ${tmp_name%.pdf}_$n; + k=`expr $k + 8`; n=`expr $n + 1`; m=`expr $m - 16` + done + n=1 + while [ `expr $n + 0` -le $SECT_TYPE ] + do + if [ ! -e "$tmp_name" ] + then + pdftk A=${tmp_name%.pdf}_$n cat A1-end \ + output "$tmp_name" + else + pdftk A="$tmp_name" B=${tmp_name%.pdf}_`expr $n` \ + cat A1-end B1-end output ${tmp_name}_tmp + mv ${tmp_name}_tmp "$tmp_name" + fi + n=`expr $n + 1` + done + if [ $VERBOSE -eq 1 ] + then + echo "REARRANGING section number $j..." + fi + j=`expr $j + 1`; + i=`expr $i + $total`; + elif [ "$SIG_TYPE" = "sexto" ] + then + # determine target page dimensions + if [ $TGT_PAGE_HEIGHT -eq 0 ] + then + TGT_PAGE_HEIGHT=$(dc -e "$SRC_PAGE_HEIGHT 3 * p") + fi + if [ $TGT_PAGE_WIDTH -eq 0 ] + then + TGT_PAGE_WIDTH=$(dc -e "$SRC_PAGE_WIDTH 2 * p") + fi + # do the rearranging + k=$i; n=1; total=$(dc -e "$SECT_TYPE 12 * p"); m=$total + while [ $n -le $SECT_TYPE ] + do + pdftk "$NEW_FILE_NAME" cat `expr $k + 5` \ + `expr $k + 6` `expr $k + $m - 1` $k \ + `expr $k + $m - 1 - 3`south `expr $k + 3`south \ + `expr $k + 7` `expr $k + 4` \ + `expr $k + 1` `expr $k + $m - 1 - 1` \ + `expr $k + 2`south `expr $k + $m - 1 - 2`south \ + output ${tmp_name%.pdf}_$n; + k=`expr $k + 6`; n=`expr $n + 1`; m=`expr $m - 12` + done + n=1 + while [ `expr $n + 0` -le $SECT_TYPE ] + do + if [ ! -e "$tmp_name" ] + then + pdftk A=${tmp_name%.pdf}_$n cat A1-end \ + output "$tmp_name" + else + pdftk A=$tmp_name B=${tmp_name%.pdf}_`expr $n` \ + cat A1-end B1-end output ${tmp_name}_tmp + mv ${tmp_name}_tmp "$tmp_name" + fi + n=`expr $n + 1` + done + if [ $VERBOSE -eq 1 ] + then + echo "REARRANGING section number $j..." + fi + j=`expr $j + 1`; + i=`expr $i + $total`; + elif [ "$SIG_TYPE" = "duodecimo" ] + then + # determine target page dimensions + if [ $TGT_PAGE_HEIGHT -eq 0 ] + then + TGT_PAGE_HEIGHT=$(dc -e "$SRC_PAGE_HEIGHT 3 * p") + fi + if [ $TGT_PAGE_WIDTH -eq 0 ] + then + TGT_PAGE_WIDTH=$(dc -e "$SRC_PAGE_WIDTH 4 * p") + fi + # do the rearranging + k=$i; n=1; total=$(dc -e "$SECT_TYPE 24 * p"); m=$total + while [ $n -le $SECT_TYPE ] + do + pdftk "$NEW_FILE_NAME" cat `expr $k + 8` \ + `expr $k + $m - 1 - 8` `expr $k + 12` \ + `expr $k + 11` `expr $k + 4` \ + `expr $k + $m - 1 - 3` `expr $k + $m - 1` \ + $k `expr $k + 4`south `expr $k + $m - 1 - 4`south \ + `expr $k + $m - 1 - 7`south `expr $k + 7`south \ + `expr $k + 10` `expr $k + 13` `expr $k + 14` \ + `expr $k + 9` `expr $k + 1` `expr $k + $m - 1 - 1` \ + `expr $k + $m - 1 - 2` `expr $k + 2` \ + `expr $k + 6`south `expr $k + $m - 1 - 6`south \ + `expr $k + $m - 1 - 5`south `expr $k + 5`south \ + output ${tmp_name%.pdf}_$n; + k=`expr $k + 12`; n=`expr $n + 1`; m=`expr $m - 24` + done + n=1 + while [ `expr $n + 0` -le $SECT_TYPE ] + do + if [ ! -e "$tmp_name" ] + then + pdftk A=${tmp_name%.pdf}_$n cat A1-end \ + output $tmp_name + else + pdftk A="$tmp_name" B=${tmp_name%.pdf}_`expr $n` \ + cat A1-end B1-end output ${tmp_name}_tmp + mv ${tmp_name}_tmp "$tmp_name" + fi + n=`expr $n + 1` + done + if [ $VERBOSE -eq 1 ] + then + echo "REARRANGING section number $j..." + fi + j=`expr $j + 1`; + i=`expr $i + $total`; + fi +done +mv "$tmp_name" "$NEW_FILE_NAME" +rm ${tmp_name%.pdf}* +echo "\documentclass{article} + \usepackage{pdfpages} + \usepackage[paperwidth=${TGT_PAGE_WIDTH}bp,paperheight=${TGT_PAGE_HEIGHT}bp]{geometry} + \pagestyle{empty}" > ${OUTFILE_NAME%.pdf}.tex +echo '\\begin{document}' >> ${OUTFILE_NAME%.pdf}.tex +echo "\includepdf[nup=$NUP,pages=-,turn=false,columnstrict, + noautoscale,delta=${HORIZ_DELTA}bp ${VERT_DELTA}bp, + offset=${HORIZ_OFFSET}bp ${VERT_OFFSET}bp,scale=${SCALE}] + {./"$NEW_FILE_NAME"}" >> ${OUTFILE_NAME%.pdf}.tex +echo "\\\\end{document}" >> ${OUTFILE_NAME%.pdf}.tex +if [ $VERBOSE -eq 1 ] +then + echo "IMPOSING sections..." +fi +pdflatex ${OUTFILE_NAME%.pdf}.tex > /dev/null 2>&1 +if [ $VERBOSE -eq 1 ] +then + echo "CLEANING up..." +fi +rm ${OUTFILE_NAME%.pdf}.tex ${OUTFILE_NAME%.pdf}.aux \ + ${OUTFILE_NAME%.pdf}.log "$NEW_FILE_NAME" +if [ -e "./blank.tex" ]; then + rm ./blank.tex +fi +if [ -e "./blank.aux" ]; then + rm ./blank.aux +fi +if [ -e "./blank.log" ]; then + rm ./blank.log +fi +if [ $VERBOSE -eq 1 ] +then + echo "`expr $NUM_PAGES + $NUM_BLANKS` pages imposed in + $(dc -e "$NUM_SIGS $SECT_TYPE * p") $SIG_TYPE signatures gathered + in sections of $SECT_TYPE signature(s) each and output to + ${OUTFILE_NAME%.pdf}.pdf." +fi +if [ "$OUTFILE_NAME" = "stdout" ] +then + cat ${OUTFILE_NAME}.pdf + rm ${OUTFILE_NAME}.pdf +fi +exit 0 diff --git a/lib/lyluatex.lua b/lib/lyluatex.lua deleted file mode 100644 index 195eb9d..0000000 --- a/lib/lyluatex.lua +++ /dev/null @@ -1,186 +0,0 @@ -local err, warn, info, log = luatexbase.provides_module({ - name = "lyluatex", - version = '0', - greinternalversion = internalversion, - date = "2015/07/14", - description = "Module lyluatex.", - author = "The Gregorio Project (see CONTRIBUTORS.md)", - copyright = "2008-2015 - The Gregorio Project", - license = "MIT", -}) - -local md5 = require 'md5' - - -LILYPOND = 'lilypond' -TMP = 'tmp_ly' -N = 0 - - -function ly_definir_programme(lilypond) - if lilypond then LILYPOND = lilypond end -end - - -function contenuIntegral(contenu) - local content ="" - for i, Line in ipairs(contenu:explode('\n')) do - if Line:find("^%s*[^%%]*\\include") then - local i = io.open(Line:gsub('%s*\\include%s*"(.*)"%s*$', "%1"), 'r') - if i then - content = content .. contenuIntegral(i:read('*a')) - else - content = content .. Line .. "\n" - end - else - content = content .. Line .. "\n" - end - end - return content -end - - -function direct_ly(ly, largeur, facteur) - N = N + 1 - facteur = calcul_facteur(facteur) - ly = ly:gsub('\\par ', '\n') - local sortie = TMP..'/'..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur, '%.', '-') - if not lfs.isfile(sortie..'-systems.tex') then - compiler_ly(entete_lilypond(facteur, largeur - 10)..'\n'..ly, sortie) - end - retour_tex(sortie) -end - - -function inclure_ly(entree, currfiledir, largeur, facteur) - facteur = calcul_facteur(facteur) - nom = splitext(entree, 'ly') - entree = currfiledir..nom..'.ly' - if not lfs.isfile(entree) then entree = kpse.find_file(nom..'.ly') end - if not lfs.isfile(entree) then err("Le fichier %s.ly n'existe pas.", nom) end - local i = io.open(entree, 'r') - ly = i:read('*a') - i:close() - local sortie = TMP..'/' ..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur, '%.', '-') - if not lfs.isfile(sortie..'-systems.tex') then - compiler_ly(entete_lilypond(facteur, largeur - 10)..'\n'..ly, sortie, dirname(entree)) - end - retour_tex(sortie) -end - - -function compiler_ly(ly, sortie, include) - mkdirs(dirname(sortie)) - local commande = LILYPOND.." ".. - "-dno-point-and-click ".. - "-dbackend=eps ".. - "-djob-count=2 ".. - "-ddelete-intermediate-files " - if include then commande = commande.."-I "..lfs.currentdir()..'/'..include.." " end - commande = commande.."-o "..sortie.." -" - local p = io.popen(commande, 'w') - p:write(ly) - p:close() -end - - -function entete_lilypond(facteur, largeur) - return string.format( -[[%%En-tête -\version "2.18.2" -#(define default-toplevel-book-handler - print-book-with-defaults-as-systems ) - -#(define toplevel-book-handler - (lambda ( . rest) - (set! output-empty-score-list #f) - (apply print-book-with-defaults rest))) - -#(define toplevel-music-handler - (lambda ( . rest) - (apply collect-music-for-book rest))) - -#(define toplevel-score-handler - (lambda ( . rest) - (apply collect-scores-for-book rest))) - -#(define toplevel-text-handler - (lambda ( . rest) - (apply collect-scores-for-book rest))) - - -#(set-global-staff-size %s) - - -%%Paramètres de la partition -\paper{ - indent = 0\mm - line-width = %s\pt -} - -%%Partition originale -]], -facteur, -largeur -) -end - - -function calcul_facteur(facteur) - if facteur == 0 then facteur = fontinfo(font.current()).size/39321.6 end - return facteur -end - - -function retour_tex(sortie) - local i = io.open(sortie..'-systems.tex', 'r') - contenu = i:read("*all") - i:close() - texoutput, _ = string.gsub( - contenu, - [[includegraphics{]], [[includegraphics{]]..dirname(sortie) - ) - tex.print(([[\noindent]]..texoutput):explode('\n')) -end - - -function dirname(str) - if str:match(".-/.-") then - local name = string.gsub(str, "(.*/)(.*)", "%1") - return name - else - return '' - end -end - - -function splitext(str, ext) - if str:match(".-%..-") then - local name = string.gsub(str, "(.*)(%." .. ext .. ")", "%1") - return name - else - return str - end -end - - -function mkdirs(str) - path = '.' - for dir in string.gmatch(str, '([^%/]+)') do - path = path .. '/' .. dir - lfs.mkdir(path) - end -end - - -local fontdata = fonts.hashes.identifiers -function fontinfo(id) - local f = fontdata[id] - if f then - return f - end - return font.fonts[id] -end - - -mkdirs(TMP) diff --git a/lib/lyluatex.sty b/lib/lyluatex.sty deleted file mode 100644 index 6725cba..0000000 --- a/lib/lyluatex.sty +++ /dev/null @@ -1,69 +0,0 @@ -\ProvidesPackage{lyluatex} - -% Dépendances -\RequirePackage{kvoptions} -\RequirePackage{graphicx} -\RequirePackage{keycommand} -\RequirePackage{environ} -\RequirePackage{currfile} -% Options -\DeclareStringOption[lilypond]{program}[lilypond] -\ProcessKeyvalOptions* -% Script lua -\directlua{dofile(kpse.find_file("lyluatex.lua"))} -\directlua{ly_definir_programme('\lyluatex@program')} - -% Une tricherie un peu sale pour récupérer la largeur de ligne -\let\bs\textbackslash -{\catcode`p=12 \catcode`t=12 \gdef\un#1pt{#1}} -\newcommand*{\largeur}{\expandafter\un\the\linewidth} -% Taille des partitions -% Si la valeur est 0, elle sera automatiquement calculée -% à partir de la taille de police. -\def\staffsize{0} -\let\localstaffsize\staffsize - - -% Commandes principales -% Inclusion d'un fichier ly -\newkeycommand*\includely[staffsize=\staffsize][autres][1]{% -\directlua{% - inclure_ly( - "\luatexluaescapestring{#1}", - "\luatexluaescapestring{\currfiledir}", - \luatexluaescapestring{\largeur}, - \luatexluaescapestring{\commandkey{staffsize}} - )% -}% -} - -% Inclusion d'un fragment intégré au document (environnement de base) -\NewEnviron{compilerly}{% -\directlua{% - direct_ly( - "\luatexluaescapestring{\unexpanded\expandafter{\BODY}}", - \luatexluaescapestring{\largeur}, - \luatexluaescapestring{\localstaffsize} - )% -}% -} - -% Commande et environnement avec paramètres -\newkeycommand{\lily}[staffsize=\staffsize][autres][1]{% -\def\localstaffsize{\commandkey{staffsize}}% -\begin{compilerly}% -#1 -\end{compilerly}% -} - -\newkeyenvironment{ly}[staffsize=\staffsize][autres]{% -\def\localstaffsize{\commandkey{staffsize}}% -\compilerly% -}{ -\endcompilerly% -} - -% Commandes pour la compatibilité avec lilypond-book -\let\lilypondfile\includely -\let\lilypond\ly -\let\endlilypond\endly diff --git a/src/scores/AllForMeGrog.ly b/src/scores/AllForMeGrog.ly deleted file mode 100644 index 79b5b0c..0000000 --- a/src/scores/AllForMeGrog.ly +++ /dev/null @@ -1,37 +0,0 @@ -\version "2.16.2" - -\header { - %title = "All for Me Grog" - composer = "Stephen Hatfield" -} - -global = { - \time 4/4 - \key g \major -} - -chordNames = \chordmode { - \global - s8 g1 c2 g1. d1 g1 c2 g1 d2 d2:7 g4. -} - -melody = \relative d' { - \global - \partial 8 d8 | - g4 b8. a16 g4. fis8 | - e fis g e d2 | - d'4 d8. d16 d4 c8 b | - b a4.( a4) b8 c | - d(e) d b g4 g8 fis | - e a g e d4 g8 a | - b d c b b a g fis | - a2 g4( g8) \bar "|." -} - -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } -} diff --git a/src/scores/BlackVelvetBand.ly b/src/scores/BlackVelvetBand.ly deleted file mode 100644 index 88a7684..0000000 --- a/src/scores/BlackVelvetBand.ly +++ /dev/null @@ -1,45 +0,0 @@ -\version "2.16.0" - -\header { - %title = "The Black Velvet Band" - composer = "Traditional" -} - -global = { - \time 3/4 - \key g \major -} - -chordNames = \chordmode { - \global - s4 d1.*3 a1.:7 d1*9/4 a d -} - -melody = \relative g'' { - \global - \partial 4 d4 | - d2 d4 | - b c4. d8 | - c4 b2( | - b) a4 | - g a b | - g fis e | - d2.( | - d4) d' c | - b2 b4 | - d, e fis | - g2( a4) | - b2 g4 | - a b c | - fis, g a | - g2.( | - g2) s4 \bar "|." -} - -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } -} diff --git a/src/scores/Buergerlied.ly b/src/scores/Buergerlied.ly deleted file mode 100644 index f7d97e4..0000000 --- a/src/scores/Buergerlied.ly +++ /dev/null @@ -1,43 +0,0 @@ -\version "2.16.0" - -\header { - %title = "Bürgerlied" - composer = "Adalbert Harnisch" -} - -global = { - \time 5/4 - \key g \major -} - -chordNames = \chordmode { - \global - s4 g1*3/4 e2:m g1*3/4 c2:7 a2:m d1*3/4:7 g1*3/4 c2:7 a2:m d1*3/4:7 g2 d4 g2 g d4 g2 -} - -melody = \relative d' { - \global - \partial 4 d8 d | - g4. g8 g a b b g a | - b4 d d8 c c b a g | - a b c b a4. r8 d c | - - \repeat volta 2 - { - b4 d e8 d c b a g | - a4 c d8 c b a g g | - } - \alternative - { - { g4 b a8 a g4 d'8 c } - { g4 b a8 a g4 s4 \bar "|." } - } -} - -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } -} diff --git a/src/scores/DrunkenSailor.ly b/src/scores/DrunkenSailor.ly deleted file mode 100644 index ee2a0c8..0000000 --- a/src/scores/DrunkenSailor.ly +++ /dev/null @@ -1,44 +0,0 @@ -\version "2.16.0" - -\header { - %title = "Drunken Sailor" - composer = "Traditional" -} - -global = { - \time 2/4 - \key d \major -} - -chordNames = \chordmode { - \global - a1:m g a:m g2 a:m a1:m g a:m g2 a:m -} - -melody = \relative b' { - \global - b8 b16 b b8 b16 b | - b8 e, g b | - a a16 a a8 a16 a | - a8 d, fis a | - b b16 b b8 b16 b | - b8 cis d e | - d b a fis | - e4 e \bar ":|:" - b' b | - b8 e, g b | - a4 a | - a8 d, fis a | - b4 b | - b8 cis d e | - d b a fis | - e4 e \bar ":|" -} - -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } -} diff --git a/src/scores/ImARoverSeldomSober.ly b/src/scores/ImARoverSeldomSober.ly deleted file mode 100644 index 7b67136..0000000 --- a/src/scores/ImARoverSeldomSober.ly +++ /dev/null @@ -1,35 +0,0 @@ -\version "2.16.0" - -\header { - %title = "I'm a Rover Seldom Sober" - composer = "Traditional" -} - -global = { - \time 4/4 - \key g \major -} - -chordNames = \chordmode { - \global - s4 g2 c g1*5/4 d1*3/4 g1*2 d4 g2 -} - -melody = \relative g' { - \global - \partial 4 g8. g16 | - g4 d8. d16 e8. e16 e4 | - d g8. g16 g4 b8. b16 | - b8. b16 a4 r8 d8 d8. c16 | - b4 d8. d16 a8. fis16 g4 d | - g8. a16 b4 b8. b16 a8. | - a16 g4 r4 \bar "|." -} - -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } -} diff --git a/src/scores/KerryRecruit.ly b/src/scores/KerryRecruit.ly deleted file mode 100644 index 2ee63bf..0000000 --- a/src/scores/KerryRecruit.ly +++ /dev/null @@ -1,33 +0,0 @@ -\version "2.16.0" - -\header { - %title = "The Kerry Recruit" - composer = "Traditional" -} - -global = { - \time 6/8 - \key g \major -} - -chordNames = \chordmode { - \global - s8 g1*6/8 d:7 d c1*3/8 g -} - -melody = \relative b' { - \global - \partial 8 b8 | - a8 g g g4 b8 | - b a a a4 d8 | - e d d b4 a8 | - a g g g4 \bar "|." -} - -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } -} diff --git a/src/scores/MuirsheenDurkin.ly b/src/scores/MuirsheenDurkin.ly deleted file mode 100644 index 391c70c..0000000 --- a/src/scores/MuirsheenDurkin.ly +++ /dev/null @@ -1,45 +0,0 @@ -\version "2.16.0" - -\header { - %title = "Muirsheen Durkin" - composer = "Traditional" -} - -global = { - \time 4/4 - \key d \major -} - -chordNames = \chordmode { - \global - s4 g1 d1*2 g d g d g d g1 -} - -melody = \relative d' { - \global - \partial 4 d8. e16 | - fis4 fis e d | - e a a b | - cis a g e | - e d2 d8. e16 | - fis4 fis e d | - e a2 b4 | - cis8 cis a4 b cis | - d2. a4 | - d d e d | - cis a a b | - cis a g e | - e d2 d8. e16 | - fis2 e4 d | - e a a b | - cis a g( e) | - d2. s4 \bar "|." -} - -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } -} diff --git a/src/scores/RisingOfTheMoon.ly b/src/scores/RisingOfTheMoon.ly deleted file mode 100644 index b15ba5e..0000000 --- a/src/scores/RisingOfTheMoon.ly +++ /dev/null @@ -1,33 +0,0 @@ -\version "2.16.0" - -\header { - %title = "The Rising of the Moon" - composer = "John Keegan Casey" -} - -global = { - \time 4/4 - \key g \major -} - -chordNames = \chordmode { - \global - s4 g1 d c2 g d g -} - -melody = \relative d' { - \global - \partial 4 g8 a | - b8. b16 b8 b b d4 b8 | - b a a b a4. d8 | - e8. c16 g'8 fis e d b g | - a8. a16 g8 fis g4 r4 \bar "|." -} - -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } -} diff --git a/src/settings.tex b/src/settings.tex index 8de82c6..2fc06d9 100644 --- a/src/settings.tex +++ b/src/settings.tex @@ -1,5 +1,3 @@ -\geometry{a4paper,left=20mm,right=20mm, top=3cm, bottom=3cm} - \setlength{\columnseprule}{0.2pt} \hypersetup @@ -16,9 +14,5 @@ pdfcreator={Sebastian Hugentobler}, % creator of the document pdfproducer={Sebastian Hugentobler}, % producer of the document pdfnewwindow=true, % links in new window - colorlinks=true, % false: boxed links; true: colored links - citecolor=black, - filecolor=black, - linkcolor=black, - urlcolor=black + colorlinks=false, % false: boxed links; true: colored links } diff --git a/src/singalongs.tex b/src/singalongs.tex index 21e0316..d240d89 100644 --- a/src/singalongs.tex +++ b/src/singalongs.tex @@ -1,22 +1,41 @@ % !Mode:: "TeX:UTF-8" -\documentclass[12pt, a4paper, openany]{scrbook} +\documentclass[11pt, openany, twoside]{scrbook} +\usepackage[utf8]{inputenc} \usepackage{fontspec} -\usepackage{lmodern} -\usepackage{graphicx} \usepackage{fancyhdr} -\usepackage{geometry} +\usepackage[a4paper]{geometry} +\usepackage{tgschola} +\usepackage{tocloft} \usepackage[unicode]{hyperref} \usepackage{multicol} +\usepackage{songs} \usepackage{lyluatex} +\usepackage{graphicx} + +\makeatletter + +\newcommand{\unchapter}[1]{% + \begingroup + \let\@makechapterhead\@gobble % make \@makechapterhead do nothing + \chapter{#1} + \endgroup +} + +\makeatother + +\directlua { + local f = assert(io.popen('git rev-parse --short HEAD', 'r')) + local s = assert(f:read('*a')) + f:close() + + tex.sprint("\string\\newcommand {\string\\revision}{" .. s .. "}") +} -\newcommand {\revision}{ REVISION } \input{settings.tex} \input{headfoot.tex} \begin{document} - \widowpenalties 1 10000 - \raggedbottom \pagenumbering{roman} \input{title.tex} @@ -39,10 +58,16 @@ \tableofcontents - \clearpage + \newpage \pagenumbering{arabic} - \musicbooklet + \lysetoption{staffsize}{22} + \lysetoption{quote}{true} + \lysetoption{indent}{false} + \lysetoption{insert}{inline} + \lysetoption{pass-fonts}{true} + + \songs \end{document} diff --git a/src/song.tex b/src/song.tex new file mode 100644 index 0000000..6e15eb6 --- /dev/null +++ b/src/song.tex @@ -0,0 +1,31 @@ +% !Mode:: "TeX:UTF-8" + +\documentclass[11pt, openany, oneside]{scrbook} + +\usepackage{fontspec} +\usepackage[a4paper]{geometry} +\usepackage{lmodern} +\usepackage{tgschola} +\usepackage[unicode]{hyperref} +\usepackage{multicol} +\usepackage{lyluatex} + +\begin{document} + + \pagenumbering{gobble} + + \lysetoption{staffsize}{22} + \lysetoption{quote}{true} + \lysetoption{indent}{false} + \lysetoption{insert}{inline} + \lysetoption{pass-fonts}{true} + + \directlua{ + tex.sprint("\string\\lilypondfile{" .. arg[5] .. "}") + } + ~\\ + \directlua{ + tex.sprint("\string\\input{" .. arg[6] .. "}") + } + +\end{document} diff --git a/src/songs.lua b/src/songs.lua new file mode 100644 index 0000000..8f4f560 --- /dev/null +++ b/src/songs.lua @@ -0,0 +1,36 @@ +require "lfs" + +local open = io.open + +local function read_file(path) + local file = open(path, "rb") -- r read mode and b binary mode + if not file then return nil end + local content = file:read "*a" -- *a or *all reads the whole file + file:close() + return content +end + +function string.ends(String,End) + return End=='' or string.sub(String,-string.len(End))==End +end + +function find_songs(dir) + local files = {} + for file in lfs.dir(dir) do + table.insert(files, file) + end + table.sort(files) + + for i = 1, #files do + local file = files[i] + if string.ends(file, ".ly") then + local ly_content = read_file(dir .. '/' .. file) + local ly_title = string.match(ly_content, 'title = "(.-)"') + tex.sprint('\\unchapter{' .. ly_title .. '}') + tex.sprint('\\lilypondfile{' .. dir .. '/' .. file .. '}') + tex.sprint('~\\\\') + tex.sprint('~\\\\') + tex.sprint('\\input{' .. dir .. '/' .. file:gsub("%.ly", ".tex") .. '}') + end + end +end diff --git a/src/songs.sty b/src/songs.sty new file mode 100644 index 0000000..ddc9816 --- /dev/null +++ b/src/songs.sty @@ -0,0 +1,18 @@ +\ProvidesPackage{songs} + +\RequirePackage{luatexbase} +\RequirePackage{luaotfload} +\RequirePackage{kvoptions} +\RequirePackage{keycommand} +\RequirePackage{currfile} +\directlua{dofile(kpse.find_file("songs.lua"))} + +\def\songpath{"./songs"} + +% Commandes principales +% Inclusion d'un fichier ly +\newkeycommand*\songs[songpath=\songpath]{% +\directlua{% + find_songs(\songpath)% +}% +} diff --git a/src/songs/AllForMeGrog.ly b/src/songs/AllForMeGrog.ly new file mode 100644 index 0000000..af21683 --- /dev/null +++ b/src/songs/AllForMeGrog.ly @@ -0,0 +1,57 @@ +\version "2.18.2" +\include "articulate.ly" + +\header { + title = "All for Me Grog" + composer = "Stephen Hatfield" +} + +global = { + \time 4/4 + \key g \major +} + +chordNames = \chordmode { + \global + s8 g1 c2 g1. d1 g1 c2 g1 d2 d2:7 g4. +} + +melody = \relative d' { + \global + \partial 8 d8 | + g4 b8. a16 g4. fis8 | + e fis g e d2 | + d'4 d8. d16 d4 c8 b | + b a4.( a4) b8 c | + d(e) d b g4 g8 fis | + e a g e d4 g8 a | + b d c b b a g fis | + a2 g4( g8) \bar "|." +} + +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } +} diff --git a/src/lyrics/AllForMeGrog.tex b/src/songs/AllForMeGrog.tex similarity index 100% rename from src/lyrics/AllForMeGrog.tex rename to src/songs/AllForMeGrog.tex diff --git a/src/scores/AuldLangSyne.ly b/src/songs/AuldLangSyne.ly similarity index 51% rename from src/scores/AuldLangSyne.ly rename to src/songs/AuldLangSyne.ly index 344e373..bde5a50 100644 --- a/src/scores/AuldLangSyne.ly +++ b/src/songs/AuldLangSyne.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "Auld Lang Syne" + title = "Auld Lang Syne" composer = "Robert Burns" } @@ -36,10 +37,29 @@ melody = \relative a' { d2. s4 \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } } + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } +} \ No newline at end of file diff --git a/src/lyrics/AuldLangSyne.tex b/src/songs/AuldLangSyne.tex similarity index 100% rename from src/lyrics/AuldLangSyne.tex rename to src/songs/AuldLangSyne.tex diff --git a/src/songs/BlackVelvetBand.ly b/src/songs/BlackVelvetBand.ly new file mode 100644 index 0000000..e4f2d8a --- /dev/null +++ b/src/songs/BlackVelvetBand.ly @@ -0,0 +1,65 @@ +\version "2.18.2" +\include "articulate.ly" + +\header { + title = "The Black Velvet Band" + composer = "Traditional" +} + +global = { + \time 3/4 + \key g \major +} + +chordNames = \chordmode { + \global + s4 d1.*3 a1.:7 d1*9/4 a d +} + +melody = \relative g'' { + \global + \partial 4 d4 | + d2 d4 | + b c4. d8 | + c4 b2( | + b) a4 | + g a b | + g fis e | + d2.( | + d4) d' c | + b2 b4 | + d, e fis | + g2( a4) | + b2 g4 | + a b c | + fis, g a | + g2.( | + g2) s4 \bar "|." +} + +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } +} \ No newline at end of file diff --git a/src/lyrics/BlackVelvetBand.tex b/src/songs/BlackVelvetBand.tex similarity index 100% rename from src/lyrics/BlackVelvetBand.tex rename to src/songs/BlackVelvetBand.tex diff --git a/src/songs/Buergerlied.ly b/src/songs/Buergerlied.ly new file mode 100644 index 0000000..7c23f99 --- /dev/null +++ b/src/songs/Buergerlied.ly @@ -0,0 +1,64 @@ +\version "2.18.2" +\include "articulate.ly" + +\header { + title = "Bürgerlied" + composer = "Adalbert Harnisch" +} + +global = { + \time 5/4 + \key g \major +} + +chordNames = \chordmode { + \global + s4 g1*3/4 e2:m g1*3/4 c2:7 a2:m d1*3/4:7 g1*3/4 c2:7 a2:m d1*3/4:7 g2 d4 g2 g d4 g2 +} + +melody = \relative d' { + \global + \partial 4 d8 d | + g4. g8 g a b b g a | + b4 d d8 c c b a g | + a b c b a4. r8 d c | + + \repeat volta 2 + { + b4 d e8 d c b a g | + a4 c d8 c b a g g | + } + \alternative + { + { g4 b a8 a g4 d'8 c } + { g4 b a8 a g4 s4 \bar "|." } + } +} + + +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } +} diff --git a/src/lyrics/Buergerlied.tex b/src/songs/Buergerlied.tex similarity index 100% rename from src/lyrics/Buergerlied.tex rename to src/songs/Buergerlied.tex diff --git a/src/songs/DrunkenSailor.ly b/src/songs/DrunkenSailor.ly new file mode 100644 index 0000000..01551ca --- /dev/null +++ b/src/songs/DrunkenSailor.ly @@ -0,0 +1,64 @@ +\version "2.18.2" +\include "articulate.ly" + +\header { + title = "Drunken Sailor" + composer = "Traditional" +} + +global = { + \time 2/4 + \key d \major +} + +chordNames = \chordmode { + \global + a1:m g a:m g2 a:m a1:m g a:m g2 a:m +} + +melody = \relative b' { + \global + b8 b16 b b8 b16 b | + b8 e, g b | + a a16 a a8 a16 a | + a8 d, fis a | + b b16 b b8 b16 b | + b8 cis d e | + d b a fis | + e4 e \bar ":|:" + b' b | + b8 e, g b | + a4 a | + a8 d, fis a | + b4 b | + b8 cis d e | + d b a fis | + e4 e \bar ":|" +} + +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } +} diff --git a/src/lyrics/DrunkenSailor.tex b/src/songs/DrunkenSailor.tex similarity index 95% rename from src/lyrics/DrunkenSailor.tex rename to src/songs/DrunkenSailor.tex index 208c580..9d3290b 100644 --- a/src/lyrics/DrunkenSailor.tex +++ b/src/songs/DrunkenSailor.tex @@ -47,11 +47,11 @@ Put him in the bed with the captain's daughter. \\ Way-hey up she rises \\ Way-hey up she rises \\ Way-hey up she rises \\ -Earl-eye in the morning! \\ +Early in the morning! \\ ~\\ That's what we do with a drunken sailor \\ That's what we do with a drunken sailor \\ That's what we do with a drunken sailor \\ -Earl-eye in the morning! \\ +Early in the morning! \\ \end{center} \end{multicols*} diff --git a/src/scores/FinnegansWake.ly b/src/songs/FinnegansWake.ly similarity index 56% rename from src/scores/FinnegansWake.ly rename to src/songs/FinnegansWake.ly index 70985c7..10bdb95 100644 --- a/src/scores/FinnegansWake.ly +++ b/src/songs/FinnegansWake.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "Tim Finnegan's Wake" + title = "Finnegan's Wake" composer = "Traditional" } @@ -44,10 +45,29 @@ melody = \relative a' { e16 e fis8 g \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/FinnegansWake.tex b/src/songs/FinnegansWake.tex similarity index 100% rename from src/lyrics/FinnegansWake.tex rename to src/songs/FinnegansWake.tex diff --git a/src/scores/FoggyDew.ly b/src/songs/FoggyDew.ly similarity index 50% rename from src/scores/FoggyDew.ly rename to src/songs/FoggyDew.ly index 61bf5fa..d8368f0 100644 --- a/src/scores/FoggyDew.ly +++ b/src/songs/FoggyDew.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "The Foggy Dew" + title = "The Foggy Dew" composer = "Charles O’Neill" } @@ -44,10 +45,29 @@ melody = \relative g' { e2 \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/FoggyDew.tex b/src/songs/FoggyDew.tex similarity index 100% rename from src/lyrics/FoggyDew.tex rename to src/songs/FoggyDew.tex diff --git a/src/songs/ImARoverSeldomSober.ly b/src/songs/ImARoverSeldomSober.ly new file mode 100644 index 0000000..ade67c8 --- /dev/null +++ b/src/songs/ImARoverSeldomSober.ly @@ -0,0 +1,55 @@ +\version "2.18.2" +\include "articulate.ly" + +\header { + title = "I'm a Rover Seldom Sober" + composer = "Traditional" +} + +global = { + \time 4/4 + \key g \major +} + +chordNames = \chordmode { + \global + s4 g2 c g1*5/4 d1*3/4 g1*2 d4 g2 +} + +melody = \relative g' { + \global + \partial 4 g8. g16 | + g4 d8. d16 e8. e16 e4 | + d g8. g16 g4 b8. b16 | + b8. b16 a4 r8 d8 d8. c16 | + b4 d8. d16 a8. fis16 g4 d | + g8. a16 b4 b8. b16 a8. | + a16 g4 r4 \bar "|." +} + +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } +} diff --git a/src/lyrics/ImARoverSeldomSober.tex b/src/songs/ImARoverSeldomSober.tex similarity index 100% rename from src/lyrics/ImARoverSeldomSober.tex rename to src/songs/ImARoverSeldomSober.tex diff --git a/src/scores/IrishRover.ly b/src/songs/IrishRover.ly similarity index 52% rename from src/scores/IrishRover.ly rename to src/songs/IrishRover.ly index 97d864a..66cc60d 100644 --- a/src/scores/IrishRover.ly +++ b/src/songs/IrishRover.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "The Irish Rover" + title = "The Irish Rover" composer = "Traditional" } @@ -40,10 +41,29 @@ melody = \relative d'' { g2. s4 \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/IrishRover.tex b/src/songs/IrishRover.tex similarity index 100% rename from src/lyrics/IrishRover.tex rename to src/songs/IrishRover.tex diff --git a/src/scores/JohnnyIHardlyKnewYe.ly b/src/songs/JohnnyIHardlyKnewYe.ly similarity index 50% rename from src/scores/JohnnyIHardlyKnewYe.ly rename to src/songs/JohnnyIHardlyKnewYe.ly index a2fae1f..7455c81 100644 --- a/src/scores/JohnnyIHardlyKnewYe.ly +++ b/src/songs/JohnnyIHardlyKnewYe.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "Johnny I hardly Knew Ye" + title = "Johnny I hardly Knew Ye" composer = "Traditional" } @@ -36,10 +37,29 @@ melody = \relative c' { a4.( a4) r8 \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/JohnnyIHardlyKnewYe.tex b/src/songs/JohnnyIHardlyKnewYe.tex similarity index 100% rename from src/lyrics/JohnnyIHardlyKnewYe.tex rename to src/songs/JohnnyIHardlyKnewYe.tex diff --git a/src/songs/KerryRecruit.ly b/src/songs/KerryRecruit.ly new file mode 100644 index 0000000..4f772e9 --- /dev/null +++ b/src/songs/KerryRecruit.ly @@ -0,0 +1,52 @@ +\version "2.18.2" +\include "articulate.ly" + +\header { + title = "The Kerry Recruit" + composer = "Traditional" +} + +global = { + \time 6/8 + \key g \major +} + +chordNames = \chordmode { + \global + s8 g1*6/8 d:7 d c1*3/8 g +} + +melody = \relative b' { + \global + \partial 8 b8 | + a8 g g g4 b8 | + b a a a4 d8 | + e d d b4 a8 | + a g g g4 \bar "|." +} +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } +} diff --git a/src/lyrics/KerryRecruit.tex b/src/songs/KerryRecruit.tex similarity index 100% rename from src/lyrics/KerryRecruit.tex rename to src/songs/KerryRecruit.tex diff --git a/src/scores/MacPhersonsFarewell.ly b/src/songs/MacPhersonsFarewell.ly similarity index 50% rename from src/scores/MacPhersonsFarewell.ly rename to src/songs/MacPhersonsFarewell.ly index 1ca94b4..3e4f80e 100644 --- a/src/scores/MacPhersonsFarewell.ly +++ b/src/songs/MacPhersonsFarewell.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "MacPherson's Farewell" + title = "MacPherson's Farewell" composer = "Robert Burns" } @@ -36,10 +37,29 @@ melody = \relative g' { g2. s4 \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/MacPhersonsFarewell.tex b/src/songs/MacPhersonsFarewell.tex similarity index 100% rename from src/lyrics/MacPhersonsFarewell.tex rename to src/songs/MacPhersonsFarewell.tex diff --git a/src/scores/MollyMalone.ly b/src/songs/MollyMalone.ly similarity index 52% rename from src/scores/MollyMalone.ly rename to src/songs/MollyMalone.ly index d206e42..9772e5b 100644 --- a/src/scores/MollyMalone.ly +++ b/src/songs/MollyMalone.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "Molly Malone" + title = "Molly Malone" composer = "Traditional" } @@ -42,10 +43,29 @@ melody = \relative g' { } } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/MollyMalone.tex b/src/songs/MollyMalone.tex similarity index 100% rename from src/lyrics/MollyMalone.tex rename to src/songs/MollyMalone.tex diff --git a/src/songs/MuirsheenDurkin.ly b/src/songs/MuirsheenDurkin.ly new file mode 100644 index 0000000..2f533af --- /dev/null +++ b/src/songs/MuirsheenDurkin.ly @@ -0,0 +1,65 @@ +\version "2.18.2" +\include "articulate.ly" + +\header { + title = "Muirsheen Durkin" + composer = "Traditional" +} + +global = { + \time 4/4 + \key d \major +} + +chordNames = \chordmode { + \global + s4 g1 d1*2 g d g d g d g1 +} + +melody = \relative d' { + \global + \partial 4 d8. e16 | + fis4 fis e d | + e a a b | + cis a g e | + e d2 d8. e16 | + fis4 fis e d | + e a2 b4 | + cis8 cis a4 b cis | + d2. a4 | + d d e d | + cis a a b | + cis a g e | + e d2 d8. e16 | + fis2 e4 d | + e a a b | + cis a g( e) | + d2. s4 \bar "|." +} + +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } +} diff --git a/src/lyrics/MuirsheenDurkin.tex b/src/songs/MuirsheenDurkin.tex similarity index 100% rename from src/lyrics/MuirsheenDurkin.tex rename to src/songs/MuirsheenDurkin.tex diff --git a/src/scores/NationOnceAgain.ly b/src/songs/NationOnceAgain.ly similarity index 57% rename from src/scores/NationOnceAgain.ly rename to src/songs/NationOnceAgain.ly index 1d8687a..74f9db7 100644 --- a/src/scores/NationOnceAgain.ly +++ b/src/songs/NationOnceAgain.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "A Nation Once Again" + title = "A Nation Once Again" composer = "Thomas Osborne Davis" } @@ -44,10 +45,29 @@ melody = \relative a' { d2. s4 \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/NationOnceAgain.tex b/src/songs/NationOnceAgain.tex similarity index 100% rename from src/lyrics/NationOnceAgain.tex rename to src/songs/NationOnceAgain.tex diff --git a/src/scores/PartingGlass.ly b/src/songs/PartingGlass.ly similarity index 51% rename from src/scores/PartingGlass.ly rename to src/songs/PartingGlass.ly index 60fc375..e529b70 100644 --- a/src/scores/PartingGlass.ly +++ b/src/songs/PartingGlass.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "The Parting Glass" + title = "The Parting Glass" composer = "Traditional" } @@ -36,10 +37,29 @@ melody = \relative b' { g4 e e s \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/PartingGlass.tex b/src/songs/PartingGlass.tex similarity index 100% rename from src/lyrics/PartingGlass.tex rename to src/songs/PartingGlass.tex diff --git a/src/songs/RisingOfTheMoon.ly b/src/songs/RisingOfTheMoon.ly new file mode 100644 index 0000000..2ffa843 --- /dev/null +++ b/src/songs/RisingOfTheMoon.ly @@ -0,0 +1,53 @@ +\version "2.18.2" +\include "articulate.ly" + +\header { + title = "The Rising of the Moon" + composer = "John Keegan Casey" +} + +global = { + \time 4/4 + \key g \major +} + +chordNames = \chordmode { + \global + s4 g1 d c2 g d g +} + +melody = \relative d' { + \global + \partial 4 g8 a | + b8. b16 b8 b b d4 b8 | + b a a b a4. d8 | + e8. c16 g'8 fis e d b g | + a8. a16 g8 fis g4 r4 \bar "|." +} + +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } +} diff --git a/src/lyrics/RisingOfTheMoon.tex b/src/songs/RisingOfTheMoon.tex similarity index 100% rename from src/lyrics/RisingOfTheMoon.tex rename to src/songs/RisingOfTheMoon.tex diff --git a/src/scores/SpancilHill.ly b/src/songs/SpancilHill.ly similarity index 55% rename from src/scores/SpancilHill.ly rename to src/songs/SpancilHill.ly index e14cc9b..89dbcba 100644 --- a/src/scores/SpancilHill.ly +++ b/src/songs/SpancilHill.ly @@ -1,7 +1,8 @@ -\version "2.16.2" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "Spancil Hill" + title = "Spancil Hill" composer = "Michael Considine" } @@ -65,10 +66,29 @@ melody = \relative e'' { a2) s4 \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/SpancilHill.tex b/src/songs/SpancilHill.tex similarity index 100% rename from src/lyrics/SpancilHill.tex rename to src/songs/SpancilHill.tex diff --git a/src/scores/StarOfTheCountyDown.ly b/src/songs/StarOfTheCountyDown.ly similarity index 52% rename from src/scores/StarOfTheCountyDown.ly rename to src/songs/StarOfTheCountyDown.ly index 4a5868c..cf0e388 100644 --- a/src/scores/StarOfTheCountyDown.ly +++ b/src/songs/StarOfTheCountyDown.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "The Star of the County Down" + title = "The Star of the County Down" composer = "Cathal Mac Garvey" } @@ -40,10 +41,29 @@ melody = \relative c' { } } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/StarOfTheCountyDown.tex b/src/songs/StarOfTheCountyDown.tex similarity index 100% rename from src/lyrics/StarOfTheCountyDown.tex rename to src/songs/StarOfTheCountyDown.tex diff --git a/src/scores/WhiskeyInTheJar.ly b/src/songs/WhiskeyInTheJar.ly similarity index 51% rename from src/scores/WhiskeyInTheJar.ly rename to src/songs/WhiskeyInTheJar.ly index 890ae6a..9cb8feb 100644 --- a/src/scores/WhiskeyInTheJar.ly +++ b/src/songs/WhiskeyInTheJar.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "Whiskey in the Jar" + title = "Whiskey in the Jar" composer = "Traditional" } @@ -45,10 +46,29 @@ melody = \relative fis' { d2. s4 \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/WhiskeyInTheJar.tex b/src/songs/WhiskeyInTheJar.tex similarity index 100% rename from src/lyrics/WhiskeyInTheJar.tex rename to src/songs/WhiskeyInTheJar.tex diff --git a/src/scores/WildRover.ly b/src/songs/WildRover.ly similarity index 51% rename from src/scores/WildRover.ly rename to src/songs/WildRover.ly index c945843..db97420 100644 --- a/src/scores/WildRover.ly +++ b/src/songs/WildRover.ly @@ -1,7 +1,8 @@ -\version "2.16.0" +\version "2.18.2" +\include "articulate.ly" \header { - %title = "The Wild Rover" + title = "The Wild Rover" composer = "Traditional" } @@ -41,10 +42,29 @@ melody = \relative g' { g2. \bar "|." } -\score { - << - \new ChordNames \chordNames - \new Staff { \melody } - >> - \layout { } +\book { + \score { + << + \new ChordNames \chordNames + \new Staff { \melody } + >> + \layout {} + } +} + +\book { + \score { + \unfoldRepeats \articulate + << + \new Voice = "chords" { + \chordNames + } + \new Voice = "melody" { + \melody + } + >> + \midi { + \tempo 4 = 130 + } + } } diff --git a/src/lyrics/WildRover.tex b/src/songs/WildRover.tex similarity index 100% rename from src/lyrics/WildRover.tex rename to src/songs/WildRover.tex diff --git a/src/title.tex b/src/title.tex index aa888d3..67c9855 100644 --- a/src/title.tex +++ b/src/title.tex @@ -10,12 +10,12 @@ \begin{minipage}{0.5\textwidth} \begin{flushleft} \large \emph{Project Website:} \\ - \href{https://code.vanwa.ch/sing-alongs}{code.vanwa.ch/sing-alongs} \\ + \href{https://code.vanwa.ch/sebastian/sing-alongs}{code.vanwa.ch/sebastian/sing-alongs} \\ \end{flushleft} \end{minipage} \begin{minipage}{0.4\textwidth} \begin{flushright} \large - \emph{Git Revision:} \\ + \emph{Revision:} \\ \texttt{\revision} \\ \end{flushright} \end{minipage}