diff options
author | Karl Berry <karl@freefriends.org> | 2017-12-06 23:56:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-12-06 23:56:38 +0000 |
commit | da0eaf985023f5c7085d52ea43031045a585f63d (patch) | |
tree | 127fcac73d9bd6b20e4d0e2cae6c1504d8d5b217 /Master | |
parent | c6ba83a91ec48c7986e2445f0795b1c006927d4c (diff) |
lyluatex (7dec17)
git-svn-id: svn://tug.org/texlive/trunk@46005 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf | bin | 147008 -> 147110 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/lyluatex/lyluatex.tex | 30 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/lyluatex/lyluatex.lua | 33 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty | 26 |
4 files changed, 54 insertions, 35 deletions
diff --git a/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf b/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf Binary files differindex 234671c93ca..4aec47a4d69 100644 --- a/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf +++ b/Master/texmf-dist/doc/support/lyluatex/lyluatex.pdf diff --git a/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex b/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex index d3617d0cfe5..c9a53bb017f 100644 --- a/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex +++ b/Master/texmf-dist/doc/support/lyluatex/lyluatex.tex @@ -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,18 +21,17 @@ \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 \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 @@ 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. +\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 diff --git a/Master/texmf-dist/scripts/lyluatex/lyluatex.lua b/Master/texmf-dist/scripts/lyluatex/lyluatex.lua index 599eb7b8bb3..bf9b29579d4 100755 --- a/Master/texmf-dist/scripts/lyluatex/lyluatex.lua +++ b/Master/texmf-dist/scripts/lyluatex/lyluatex.lua @@ -2,9 +2,9 @@ local err, warn, info, log = luatexbase.provides_module({ 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@hotmail.com>", copyright = "2008-2017 - The Gregorio Project", license = "MIT", }) @@ -42,17 +42,20 @@ end 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 @@ function inclure_ly(entree, currfiledir, largeur, facteur, pleinepage) 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 @@ function inclure_ly(entree, currfiledir, largeur, facteur, pleinepage) 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 @@ function entete_lilypond(facteur, largeur) %%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 @@ function calcul_facteur(facteur) 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 diff --git a/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty b/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty index 526bceb2088..5b7eff0fb37 100644 --- a/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty +++ b/Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty @@ -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@program'} +\def\defaultwidth{default} +\catcode`-=11 +\ifx\lyluatex@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@line-width')} +\let\largeur\lyluatex@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,15 +61,16 @@ \directlua{% direct_ly( "\luatexluaescapestring{\unexpanded\expandafter{\BODY}}", - \luatexluaescapestring{\largeur}, + '\localwidth', \luatexluaescapestring{\localstaffsize} )% }% } % 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}% |