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/texmf-dist/tex | |
parent | c6ba83a91ec48c7986e2445f0795b1c006927d4c (diff) |
lyluatex (7dec17)
git-svn-id: svn://tug.org/texlive/trunk@46005 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/lyluatex/lyluatex.sty | 26 |
1 files changed, 21 insertions, 5 deletions
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}% |