From 68269883bdbfd89d17c6e696df91405a5f799cb5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 27 Nov 2017 22:37:58 +0000 Subject: lyluatex (27nov17) git-svn-id: svn://tug.org/texlive/trunk@45926 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/support/lyluatex/README.md | 12 +++++++++-- .../texmf-dist/doc/support/lyluatex/lyluatex.pdf | Bin 123820 -> 147008 bytes .../texmf-dist/doc/support/lyluatex/lyluatex.tex | 16 +++++++++++++-- Master/texmf-dist/scripts/lyluatex/lyluatex.lua | 22 ++++++++++++++------- Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty | 6 ++++-- 5 files changed, 43 insertions(+), 13 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/support/lyluatex/README.md b/Master/texmf-dist/doc/support/lyluatex/README.md index d69f9e3f7f8..d331ae9a6c2 100644 --- a/Master/texmf-dist/doc/support/lyluatex/README.md +++ b/Master/texmf-dist/doc/support/lyluatex/README.md @@ -14,7 +14,7 @@ The `program` option permits the definition of an alternative path to Thereafter, you can include a lilypond file with the command: - \includely[staffsize=17]{CHEMIN/VERS/LA/PARTITION} + \includely[staffsize=17]{PATH/TO/THE/FILE} The argument `staffsize`, which is optional, changes the size of the score. You can change the size for all the subsequent scores in a document by placing the @@ -36,12 +36,20 @@ On systems with low RAM, when working on big documents, you could encounter `-draftmode`, then compile again without this option. You can also input music directly into your docoment with the `ly` environment. -This is only recommended for very short snippets. For example: +This is only recommended for relatively short snippets. For example: \begin{ly} \relative c' { c d e f g a b c } \end{ly} +Finally, for truly short snippets, there is also the `\lily` command. Example: + + \lily[staffsize=12]{c' d' g'} + +**Nota bene:** The `\lily` command *does not* support blocks of LilyPond code +with explicit `\score` blocks. Such code must be included with the `ly` +environment or as a separate file. + ## Migration from `lilypond-book` diff --git a/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf b/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf index 7a91f2751ec..234671c93ca 100644 Binary files a/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf and b/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf differ diff --git a/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex b/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex index 46d975cdb4c..d3617d0cfe5 100644 --- a/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex +++ b/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex @@ -77,7 +77,7 @@ path to \texttt{lilypond}, for example: Thereafter, you can include a lilypond file with the command: \begin{verbatim} -\includely[staffsize=17]{CHEMIN/VERS/LA/PARTITION} +\includely[staffsize=17]{PATH/TO/THE/FILE} \end{verbatim} The argument \texttt{staffsize}, which is optional, changes the size of @@ -109,7 +109,7 @@ case, first compile with option \texttt{-draftmode}, then compile again without this option. You can also input music directly into your docoment with the -\texttt{ly} environment. This is only recommended for very short +\texttt{ly} environment. This is only recommended for relatively short snippets. For example: \begin{verbatim} @@ -118,6 +118,18 @@ snippets. For example: \end{ly} \end{verbatim} +Finally, for truly short snippets, there is also the +\texttt{\textbackslash{}lily} command. Example: + +\begin{verbatim} +\lily[staffsize=12]{c' d' g'} +\end{verbatim} + +\textbf{Nota bene:} The \texttt{\textbackslash{}lily} command \emph{does +not} support blocks of LilyPond code with explicit +\texttt{\textbackslash{}score} blocks. Such code must be included with +the \texttt{ly} environment or as a separate file. + \subsection{\texorpdfstring{Migration from \texttt{lilypond-book}}{Migration from lilypond-book}}\label{migration-from-lilypond-book} diff --git a/Master/texmf-dist/scripts/lyluatex/lyluatex.lua b/Master/texmf-dist/scripts/lyluatex/lyluatex.lua index e9f333fc4f4..599eb7b8bb3 100755 --- a/Master/texmf-dist/scripts/lyluatex/lyluatex.lua +++ b/Master/texmf-dist/scripts/lyluatex/lyluatex.lua @@ -2,7 +2,7 @@ local err, warn, info, log = luatexbase.provides_module({ name = "lyluatex", version = '0', greinternalversion = internalversion, - date = "2017/11/19", + date = "2017/11/27", description = "Module lyluatex.", author = "The Gregorio Project (see CONTRIBUTORS.md)", copyright = "2008-2017 - The Gregorio Project", @@ -46,13 +46,13 @@ function direct_ly(ly, largeur, facteur) ly = ly:gsub('\\par ', '\n'):gsub('\\([^%s]*) %-([^%s])', '\\%1-%2') 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) + compiler_ly(entete_lilypond(facteur, largeur - 10)..'\n'..ly, sortie, true) end retour_tex(sortie) end -function inclure_ly(entree, currfiledir, largeur, facteur) +function inclure_ly(entree, currfiledir, largeur, facteur, pleinepage) facteur = calcul_facteur(facteur) nom = splitext(entree, 'ly') entree = currfiledir..nom..'.ly' @@ -61,21 +61,29 @@ function inclure_ly(entree, currfiledir, largeur, facteur) local i = io.open(entree, 'r') ly = i:read('*a') i:close() - local sortie = TMP..'/' ..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur, '%.', '-') + local sortie = TMP..'/' ..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur..'-', '%.', '-') + if pleinepage then sortie = sortie..'-pleinepage' end if not lfs.isfile(sortie..'-systems.tex') then - compiler_ly(entete_lilypond(facteur, largeur - 10)..'\n'..ly, sortie, dirname(entree)) + if pleinepage then + compiler_ly(ly, sortie, false, dirname(entree)) + i = io.open(sortie..'-systems.tex', 'w') + i:write('\\includepdf[pages=-]{'..sortie..'}') + i:close() + else + compiler_ly(entete_lilypond(facteur, largeur - 10)..'\n'..ly, sortie, true, dirname(entree)) + end end retour_tex(sortie) end -function compiler_ly(ly, sortie, include) +function compiler_ly(ly, sortie, eps, include) mkdirs(dirname(sortie)) local commande = LILYPOND.." ".. "-dno-point-and-click ".. - "-dbackend=eps ".. "-djob-count=2 ".. "-ddelete-intermediate-files " + if eps then commande = commande.."-dbackend=eps " end if include then commande = commande.."-I '"..lfs.currentdir().."/"..include.."' " end commande = commande.."-o "..sortie.." -" local p = io.popen(commande, 'w') diff --git a/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty b/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty index f3cc35dbf22..526bceb2088 100644 --- a/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty +++ b/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty @@ -8,6 +8,7 @@ \RequirePackage{keycommand} \RequirePackage{environ} \RequirePackage{currfile} +\RequirePackage{pdfpages} % Options \DeclareStringOption[lilypond]{program}[lilypond] \ProcessKeyvalOptions* @@ -28,13 +29,14 @@ % Commandes principales % Inclusion d'un fichier ly -\newkeycommand*\includely[staffsize=\staffsize][autres][1]{% +\newkeycommand*\includely[staffsize=\staffsize,fullpage=false][autres][1]{% \directlua{% inclure_ly( "\luatexluaescapestring{#1}", "\luatexluaescapestring{\currfiledir}", \luatexluaescapestring{\largeur}, - \luatexluaescapestring{\commandkey{staffsize}} + \luatexluaescapestring{\commandkey{staffsize}}, + \commandkey{fullpage} )% }% } -- cgit v1.2.3