texlive[46005] Master/texmf-dist: lyluatex (7dec17)

commits+karl at tug.org commits+karl at tug.org
Thu Dec 7 00:56:38 CET 2017


Revision: 46005
          http://tug.org/svn/texlive?view=revision&revision=46005
Author:   karl
Date:     2017-12-07 00:56:38 +0100 (Thu, 07 Dec 2017)
Log Message:
-----------
lyluatex (7dec17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf
    trunk/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex
    trunk/Master/texmf-dist/scripts/lyluatex/lyluatex.lua
    trunk/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty

Modified: trunk/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex	2017-12-06 23:56:22 UTC (rev 46004)
+++ trunk/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex	2017-12-06 23:56:38 UTC (rev 46005)
@@ -1,3 +1,6 @@
+\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
+\PassOptionsToPackage{hyphens}{url}
+%
 \documentclass[]{article}
 \usepackage{lmodern}
 \usepackage{amssymb,amsmath}
@@ -6,12 +9,9 @@
 \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
   \usepackage[T1]{fontenc}
   \usepackage[utf8]{inputenc}
+  \usepackage{textcomp} % provides euro and other symbols
 \else % if luatex or xelatex
-  \ifxetex
-    \usepackage{mathspec}
-  \else
-    \usepackage{fontspec}
-  \fi
+  \usepackage{unicode-math}
   \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
 \fi
 % use upquote if available, for straight quotes in verbatim environments
@@ -21,12 +21,6 @@
 \usepackage[]{microtype}
 \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
 }{}
-\PassOptionsToPackage{hyphens}{url} % url is loaded by hyperref
-\usepackage[unicode=true]{hyperref}
-\hypersetup{
-            pdfborder={0 0 0},
-            breaklinks=true}
-\urlstyle{same}  % don't use monospace font for urls
 \IfFileExists{parskip.sty}{%
 \usepackage{parskip}
 }{% else
@@ -33,6 +27,11 @@
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
 }
+\usepackage{hyperref}
+\hypersetup{
+            pdfborder={0 0 0},
+            breaklinks=true}
+\urlstyle{same}  % don't use monospace font for urls
 \setlength{\emergencystretch}{3em}  % prevent overfull lines
 \providecommand{\tightlist}{%
   \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
@@ -57,9 +56,11 @@
 
 \begin{document}
 
-\section{Lyluatex}\label{lyluatex}
+\hypertarget{lyluatex}{%
+\section{Lyluatex}\label{lyluatex}}
 
-\subsection{Usage}\label{usage}
+\hypertarget{usage}{%
+\subsection{Usage}\label{usage}}
 
 In the preable of your document, include the package \texttt{lyluatex}:
 
@@ -130,8 +131,9 @@
 \texttt{\textbackslash{}score} blocks. Such code must be included with
 the \texttt{ly} environment or as a separate file.
 
+\hypertarget{migration-from-lilypond-book}{%
 \subsection{\texorpdfstring{Migration from
-\texttt{lilypond-book}}{Migration from lilypond-book}}\label{migration-from-lilypond-book}
+\texttt{lilypond-book}}{Migration from lilypond-book}}\label{migration-from-lilypond-book}}
 
 In order to facilitate the migration from \texttt{lilypond-book},
 \texttt{lyluatex} defines the command

Modified: trunk/Master/texmf-dist/scripts/lyluatex/lyluatex.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/lyluatex/lyluatex.lua	2017-12-06 23:56:22 UTC (rev 46004)
+++ trunk/Master/texmf-dist/scripts/lyluatex/lyluatex.lua	2017-12-06 23:56:38 UTC (rev 46005)
@@ -2,9 +2,9 @@
     name               = "lyluatex",
     version            = '0',
     greinternalversion = internalversion,
-    date               = "2017/11/27",
+    date               = "2017/12/05",
     description        = "Module lyluatex.",
-    author             = "The Gregorio Project (see CONTRIBUTORS.md)",
+    author             = "The Gregorio Project  − Jacques Peron <cataclop at hotmail.com>",
     copyright          = "2008-2017 - The Gregorio Project",
     license            = "MIT",
 })
@@ -42,17 +42,20 @@
 
 function direct_ly(ly, largeur, facteur)
     N = N + 1
+    largeur = {['n'] = largeur:match('%d+'), ['u'] = largeur:match('%a+')}
     facteur = calcul_facteur(facteur)
     ly = ly:gsub('\\par ', '\n'):gsub('\\([^%s]*) %-([^%s])', '\\%1-%2')
-    local sortie = TMP..'/'..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur, '%.', '-')
+    local sortie =
+    TMP..'/'..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur.n..largeur.u, '%.', '-')
     if not lfs.isfile(sortie..'-systems.tex') then
-        compiler_ly(entete_lilypond(facteur, largeur - 10)..'\n'..ly, sortie, true)
+        compiler_ly(entete_lilypond(facteur, largeur)..'\n'..ly, sortie, true)
     end
-    retour_tex(sortie)
+    retour_tex(sortie, facteur)
 end
 
 
 function inclure_ly(entree, currfiledir, largeur, facteur, pleinepage)
+    largeur = {['n'] = largeur:match('%d+'), ['u'] = largeur:match('%a+')}
     facteur = calcul_facteur(facteur)
     nom = splitext(entree, 'ly')
     entree = currfiledir..nom..'.ly'
@@ -61,7 +64,7 @@
     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.n..largeur.u..'-', '%.', '-')
     if pleinepage then sortie = sortie..'-pleinepage' end
     if not lfs.isfile(sortie..'-systems.tex') then
         if pleinepage then
@@ -70,10 +73,10 @@
             i:write('\\includepdf[pages=-]{'..sortie..'}')
             i:close()
         else
-            compiler_ly(entete_lilypond(facteur, largeur - 10)..'\n'..ly, sortie, true, dirname(entree))
+            compiler_ly(entete_lilypond(facteur, largeur)..'\n'..ly, sortie, true, dirname(entree))
         end
     end
-    retour_tex(sortie)
+    retour_tex(sortie, facteur)
 end
 
 
@@ -123,13 +126,13 @@
 %%Paramètres de la partition
 \paper{
     indent = 0\mm
-    line-width = %s\pt
+    line-width = %s\%s
 }
 
 %%Partition originale
 ]],
 facteur,
-largeur
+largeur.n, largeur.u
 )
 end
 
@@ -140,14 +143,12 @@
 end
 
 
-function retour_tex(sortie)
+function retour_tex(sortie, facteur)
     local i = io.open(sortie..'-systems.tex', 'r')
-    contenu = i:read("*all")
+    local contenu = i:read("*all")
     i:close()
-    texoutput, _ = string.gsub(
-        contenu,
-        [[includegraphics{]], [[includegraphics{]]..dirname(sortie)
-    )
+    local texoutput, nbre = contenu:gsub([[\includegraphics{]],
+        [[\includegraphics{]]..dirname(sortie))
     tex.print(([[\noindent]]..texoutput):explode('\n'))
 end
 

Modified: trunk/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty	2017-12-06 23:56:22 UTC (rev 46004)
+++ trunk/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty	2017-12-06 23:56:38 UTC (rev 46005)
@@ -11,30 +11,45 @@
 \RequirePackage{pdfpages}
 % Options
 \DeclareStringOption[lilypond]{program}[lilypond]
+\DeclareStringOption[default]{line-width}[lilypond]
+\newcommand{\pt}{pt}
+\newcommand{\mm}{mm}
+\newcommand{\cm}{cm}
 \ProcessKeyvalOptions*
 % Script lua
 \directlua{dofile(kpse.find_file("lyluatex.lua"))}
 \directlua{LILYPOND = '\lyluatex at program'}
 
+\def\defaultwidth{default}
+\catcode`-=11
+\ifx\lyluatex at line-width\defaultwidth
+\catcode`-=12
 % 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}
+\newcommand*{\largeur}{[[\directlua{tex.print(\expandafter\un\the\linewidth - 10)}pt]]}
+\else
+\catcode`-=11
+\directlua{print('test:','\lyluatex at line-width')}
+\let\largeur\lyluatex at line-width
+\catcode`-=12
+\fi
 % 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
+\let\localwidth\largeur
 
 
 % Commandes principales
 % Inclusion d'un fichier ly
-\newkeycommand*\includely[staffsize=\staffsize,fullpage=false][autres][1]{%
+\newkeycommand*\includely[fullpage=false,staffsize=\staffsize,line-width=\largeur][autres][1]{%
 \directlua{%
     inclure_ly(
         "\luatexluaescapestring{#1}",
         "\luatexluaescapestring{\currfiledir}",
-        \luatexluaescapestring{\largeur},
+        '\commandkey{line-width}',
         \luatexluaescapestring{\commandkey{staffsize}},
         \commandkey{fullpage}
     )%
@@ -46,7 +61,7 @@
 \directlua{%
     direct_ly(
         "\luatexluaescapestring{\unexpanded\expandafter{\BODY}}",
-        \luatexluaescapestring{\largeur},
+        '\localwidth',
         \luatexluaescapestring{\localstaffsize}
     )%
 }%
@@ -53,8 +68,9 @@
 }
 
 % Commande et environnement avec paramètres
-\newkeycommand{\lily}[staffsize=\staffsize][autres][1]{%
+\newkeycommand{\lily}[staffsize=\staffsize,line-width=\largeur][autres][1]{%
 \def\localstaffsize{\commandkey{staffsize}}%
+\def\localwidth{\commandkey{line-width}}%
 \begin{compilerly}%
 {#1}
 \end{compilerly}%



More information about the tex-live-commits mailing list