Skip to content

Commit

Permalink
Le facteur n'est plus un compteur, mais une commande
Browse files Browse the repository at this point in the history
Ceci permet d'utiliser un nombre décimal ou un calcul plutôt qu'un entier.
  • Loading branch information
jperon committed May 20, 2015
1 parent 9c5dcb2 commit fe54c55
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lyluatex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function inclure_ly(entree, largeur, facteur)
nom = splitext(entree, 'ly')
entree = nom..'.ly'
if not lfs.isfile(entree) then err("Le fichier %s n'existe pas.", entree) end
sortie = TMP..'/' ..nom..'-'..facteur..'-'..string.gsub(largeur, '%.', '-')..'.ly'
sortie = TMP..'/' ..string.gsub(nom..'-'..facteur..'-'..largeur, '%.', '-')..'.ly'
sortie = splitext(sortie, 'ly')
if not lfs.isfile(sortie..'-systems.tex')
or lfs.attributes(sortie..'-systems.tex').modification < lfs.attributes(entree).modification
Expand Down
18 changes: 10 additions & 8 deletions lyluatex.sty
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
{\catcode`p=12 \catcode`t=12 \gdef\un#1pt{#1}}
\newcommand*{\largeur}{\expandafter\un\the\linewidth}
% Taille des partitions
\newcounter{staffsize}\setcounter{staffsize}{17}
\newcounter{localstaffsize}\setcounter{staffsize}{17}
%\newcounter{staffsize}\setcounter{staffsize}{17}
%\newcounter{localstaffsize}\setcounter{staffsize}{17}
\def\staffsize{17}
\let\localstaffsize\staffsize


% Commandes principales
% Inclusion d'un fichier ly
\newkeycommand*\includely[staffsize=\arabic{staffsize}][autres][1]{%
\newkeycommand*\includely[staffsize=\staffsize][autres][1]{%
\directlua{%
inclure_ly(
"\luatexluaescapestring{#1}",
Expand All @@ -34,21 +36,21 @@
direct_ly(
"\luatexluaescapestring{\unexpanded\expandafter{\BODY}}",
\luatexluaescapestring{\largeur},
\luatexluaescapestring{\arabic{localstaffsize}}
\luatexluaescapestring{\localstaffsize}
)%
}%
}

% Commande et environnement avec paramètres
\newkeycommand{\lily}[staffsize=\arabic{staffsize}][autres][1]{%
\setcounter{localstaffsize}{\commandkey{staffsize}}%
\newkeycommand{\lily}[staffsize=\staffsize][autres][1]{%
\def\localstaffsize{\commandkey{staffsize}}%
\begin{compilerly}%
#1
\end{compilerly}%
}

\newkeyenvironment{ly}[staffsize=\arabic{staffsize}][autres]{%
\setcounter{localstaffsize}{\commandkey{staffsize}}%
\newkeyenvironment{ly}[staffsize=\staffsize][autres]{%
\def\localstaffsize{\commandkey{staffsize}}%
\compilerly%
}{
\endcompilerly%
Expand Down
2 changes: 1 addition & 1 deletion test.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\title{}
\author{}

\setcounter{staffsize}{20}
\def\staffsize{20.5}

\begin{document}

Expand Down

0 comments on commit fe54c55

Please sign in to comment.