jperon / lyluatex

Alternative à lilypond-book pour lualatex
MIT License
58 stars 12 forks source link

lilypond 2.23.x and lyluatex (fragments not inserted) #287

Closed notacontranota closed 2 years ago

notacontranota commented 2 years ago

With lilypond 2.23.5 & 2.23.6 lyluatex doesn't insert the music fragment. With lilypond 2.22, all Ok.

GNU/Linux Kubuntu 21.10 Texlive 2021 (20220214, not kubuntu repositories)

jperon commented 2 years ago

It seems to come from the fact lilypond 2.23 doesn't generate both pdf and eps in one compilation (for multi-system output). So it'll be necessary to convert intermediate eps to pdf. I'm going to do that ASAP.

jperon commented 2 years ago

@notacontranota May you please test with latest commit on master ? I think it fixed this issue.

fedelibre commented 2 years ago

I'm trying to build a document with LilyPond 2.23.80 and the latest lyluatex release and I get this error:

(/tmp/tex2pdf.-e25a259986005e58/input.toc) [3] [4] [1] [2]
(lyluatex)  Compiling score tmp-ly/841dc758b474d99c78eb9e55320c1db9 with LilyPond executable 'lilypond'.
...are/texlive/texmf-
dist/scripts/lyluatex/lyluatex-lib.lua:159: bad argument #1 to 'rawget' (table 
expected, got nil).
\ly@compilescore ...directlua {ly.score:process()}

l.168 \end{lilypond}

 4646 words of node memory still in use:
   18 hlist, 2 vlist, 5 rule, 1 mark, 48 disc, 3 local_par, 4 dir, 77 glue, 22 
kern, 14 penalty, 365 glyph, 48 attribute, 70 glue_spec, 26 attribute_list, 2 t
emp, 2 write, 1 user_defined, 3 pdf_dest, 1 pdf_colorstack nodes
   avail lists: 2:84,3:42,4:13,5:299,6:10,7:6004,8:3,9:117,10:10,11:651
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on input.log.

Error producing PDF.
!  ==> Fatal error occurred, no output PDF file produced!

I'll try to remember how to use the git master version...

fedelibre commented 2 years ago

Ok, quick and dirty:

$ sudo cp /usr/share/texlive/texmf-dist/scripts/lyluatex/lyluatex.lua /usr/share/texlive/texmf-dist/scripts/lyluatex/lyluatex.lua.backup
$ sudo cp ~/src/lyluatex/lyluatex.lua /usr/share/texlive/texmf-dist/scripts/lyluatex/lyluatex.lua

but it complains:

(/usr/share/texlive/texmf-dist/tex/generic/iftex/ifxetex.sty))/usr/share/texliv
e/texmf-dist/scripts/lyluatex/lyluatex.lua:12: module 'luaoptions-lib.lua' not 
found:
    no field package.preload['luaoptions-lib.lua']
    [kpse lua searcher] file not found: 'luaoptions-lib.lua'
    [kpse C searcher] file not found: 'luaoptions-lib.lua'
    no file '/usr/local/lib/lua/5.3/luaoptions-lib.so'
    no file '/usr/local/lib/lua/5.3/loadall.so'
    no file './luaoptions-lib.so'
stack traceback:
    [C]: in function 'require'
    /usr/share/texlive/texmf-dist/scripts/lyluatex/lyluatex.lua:12: in main chunk
    [C]: in function 'require'
    [\directlua]:1: in main chunk.
l.140 }

@jperon Please remind us how to use the git master version of lyluatex.

fedelibre commented 2 years ago

I've now found this issue.

The next LilyPond stable (2.24) will be released within the end of the year, so it's important to release luaoptions asap.

fedelibre commented 2 years ago

Here's what I did to install luaoptions manually:

$ git clone git@github.com:lualatex-tools/luaoptions.git ~/src/luaoptions
$ mkdir -p ~/texmf/scripts/luaoptions
$ mkdir -p ~/texmf/tex/luatex/luaoptions
$ cp src/luaoptions/luaoptions*.lua ~/texmf/scripts/luaoptions/
$ cp src/luaoptions/luaoptions.sty ~/texmf/tex/luatex/luaoptions/
$ tree ~/texmf
/var/home/fede/texmf
├── scripts
│   └── luaoptions
│       ├── luaoptions-lib.lua
│       └── luaoptions.lua
└── tex
    └── luatex
        └── luaoptions
            └── luaoptions.sty

Now I get a different error when I build my book:

(/usr/share/texlive/texmf-dist/tex/generic/iftex/ifxetex.sty))/usr/share/texliv
e/texmf-dist/scripts/lyluatex/lyluatex.lua:13: attempt to index a nil value (gl
obal 'lua_options')
stack traceback:
    /usr/share/texlive/texmf-dist/scripts/lyluatex/lyluatex.lua:13: in main chunk
    [C]: in function 'require'
    [\directlua]:1: in main chunk.
l.140 }

 423 words of node memory still in use:
   3 hlist, 1 rule, 1 dir, 3 kern, 1 glyph, 5 attribute, 53 glue_spec, 5 attrib
ute_list, 1 if_stack, 1 write, 1 pdf_colorstack nodes
   avail lists: 2:15,3:2,7:2,9:2
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on input.log.

Error producing PDF.
!  ==> Fatal error occurred, no output PDF file produced!
jperon commented 2 years ago

/usr/share/texliv e/texmf-dist/scripts/lyluatex/lyluatex.lua:13: attempt to index a nil value (gl obal 'lua_options') indicates that lualatex doesn’t find lyluatex.lua in its TEXINPUTS path.

When I use last lyluatex version, I generally put the whole luaoptions subfolder in the project directory, and add it to TEXINPUTS environment variable:

TEXINPUTS="lib:" lualatex --shell-escape DOCUMENT
fedelibre commented 2 years ago

I'm using a pandoc command (I'm writing the document in Markdown). I tried your suggestion, but it didn't work. Maybe it doesn't work with pandoc?

I may consider switching the text input from Markdown to LaTeX if it helps with debugging. I'll have to find some spare time and think about it.

jperon commented 2 years ago

After a quick test, it effectively doesn’t seem working with pandoc. I could suggest the following workaround (that works for me):

export TEXINPUTS="luaoptions:"
pandoc --standalone -i DOC.md -o DOC.tex
lualatex --shell-escape DOC
fedelibre commented 2 years ago

I did a quick test and didn't work. I must find some spare time at day time to do a proper testing. It might take a lot...

fedelibre commented 2 years ago

I tried a minimal example:

\documentclass{article}

\usepackage[]{lyluatex}

\begin{document}

\lily{
\fixed c'{c d e f}
\addlyrics{c d e f}
}

\end{document}

and it doesn't work:

$ echo $TEXINPUTS
luaoptions:
$ ls luaoptions/
LICENSE   README.md  luaoptions-lib.lua  luaoptions.md
Makefile  latexmkrc  luaoptions.lua      luaoptions.sty
$ lualatex --shell-escape test.tex
[...]
[\directlua]:1: attempt to index a nil value (global 'ly')
stack traceback:
    [\directlua]:1: in main chunk.
\ly@currentfonts ..., \sffamilyid , \ttfamilyid )}
                                                  \endgroup 
l.10 }

? 
[\directlua]:1: attempt to index a nil value (global 'ly')
stack traceback:
    [\directlua]:1: in main chunk.
\ly@compilescore ...directlua {ly.score:process()}

l.10 }

? 
(./test.aux))
 426 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 6 attribute, 49 glue_spec
, 6 attribute_list, 2 write, 1 pdf_colorstack nodes
   avail lists: 2:10,3:1,4:1,5:4,7:1,9:1

warning  (pdf backend): no pages of output.
Transcript written on test.log.
jperon commented 2 years ago

That’s weird, that time it seems it doesn’t find lyluatex.lua… May you try that way, please:

export TEXINPUTS="PATH/TO/LYLUATEX/FOLDER//:"
lualatex -shell-escape DOCUMENT_NAME

Please note the double slash at the end of lyluatex folder.

fedelibre commented 2 years ago

I tried but didn't help. Why should I need TEXINPUTS if kpsewhich can find lyluatex and luaoptions files without any problem?

I think I'd better install the native TexLive 2022 in my home so I can use the latest updates without having to do any tweak in ~/texmf.

jperon commented 2 years ago

I think I'd better install the native TexLive 2022 in my home so I can use the latest updates without having to do any tweak in ~/texmf.

Without any doubt !

fedelibre commented 2 years ago

It works perfect with TeXlive 2022!

BTW, I installed texlive-medium and checked-also the music packages and graphic packages collections. I think lyluatex was already installed, while I had to install luaoptions. Then in order to compile my book I had to also install:

tlmgr install minibox currfile catchfile

I wonder if this is Ok or lyluatex is missing these three dependencies (I know nothing about Latex packaging).

fedelibre commented 2 years ago

@notacontranota May you please test with latest commit on master ? I think it fixed this issue.

I think commit 06a7c270ec2251d4ad6bcda016879689dd4e6484 fixed this issue.

notacontranota commented 2 years ago

@notacontranota May you please test with latest commit on master ? I think it fixed this issue.

I think commit 06a7c270ec2251d4ad6bcda016879689dd4e6484 fixed this issue.

@jperon thanks!

jperon commented 2 years ago

You’re welcome !

jperon commented 2 years ago

@fedelibre I keep note about missing dependencies; I’ll ask for a modification in next upload to CTAN, after merging #298.