jperon / lyluatex

Alternative à lilypond-book pour lualatex
MIT License
56 stars 11 forks source link

Failing to auto-compile #282

Open fiat96 opened 3 years ago

fiat96 commented 3 years ago

Hello! I am using TeXLive 2020 and Lilypond 2.20.0-1 on Windows 10.

I've been trying hard to get lyluatex to work properly, and I've run up against one last problem. Any music in my .tex file has to be manually complied once or twice to show up in the pdf.

Here's an MWE:

\documentclass{report}
\usepackage{lyluatex}

\begin{document}

Here's some music: \lilypond{a b c}

\end{document}

Compiling this brings up this error:

This is LuaHBTeX, Version 1.12.0 (TeX Live 2020/W32TeX) 
 system commands enabled.
(./abc.tex
LaTeX2e <2020-02-02> patch level 5
 L3 programming layer <2020-06-18>
(c:/texlive/2020/texmf-dist/tex/latex/base/report.cls
Document Class: report 2019/12/20 v1.4l Standard LaTeX document class
(c:/texlive/2020/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2020/texmf-dist/tex/luatex/lyluatex/lyluatex.sty
(c:/texlive/2020/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(c:/texlive/2020/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))
(c:/texlive/2020/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(c:/texlive/2020/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(c:/texlive/2020/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(c:/texlive/2020/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(c:/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty)
(c:/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(c:/texlive/2020/texmf-dist/tex/latex/graphics-def/luatex.def)))
(c:/texlive/2020/texmf-dist/tex/latex/minibox/minibox.sty
(c:/texlive/2020/texmf-dist/tex/latex/l3kernel/expl3.sty
(c:/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)))
(c:/texlive/2020/texmf-dist/tex/latex/environ/environ.sty
(c:/texlive/2020/texmf-dist/tex/latex/trimspaces/trimspaces.sty))
(c:/texlive/2020/texmf-dist/tex/latex/currfile/currfile.sty
(c:/texlive/2020/texmf-dist/tex/latex/kvoptions/kvoptions.sty
(c:/texlive/2020/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(c:/texlive/2020/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty))
(c:/texlive/2020/texmf-dist/tex/latex/filehook/filehook.sty))
(c:/texlive/2020/texmf-dist/tex/latex/pdfpages/pdfpages.sty
(c:/texlive/2020/texmf-dist/tex/latex/base/ifthen.sty)
(c:/texlive/2020/texmf-dist/tex/latex/tools/calc.sty)
(c:/texlive/2020/texmf-dist/tex/latex/eso-pic/eso-pic.sty
(c:/texlive/2020/texmf-dist/tex/generic/atbegshi/atbegshi.sty
(c:/texlive/2020/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(c:/texlive/2020/texmf-dist/tex/generic/iftex/iftex.sty))
(c:/texlive/2020/texmf-dist/tex/latex/xcolor/xcolor.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics-cfg/color.cfg)))
(c:/texlive/2020/texmf-dist/tex/latex/pdfpages/ppluatex.def))
(c:/texlive/2020/texmf-dist/tex/latex/varwidth/varwidth.sty)
(c:/texlive/2020/texmf-dist/tex/latex/metalogo/metalogo.sty
(c:/texlive/2020/texmf-dist/tex/generic/iftex/ifxetex.sty)))
No file abc.aux.
(c:/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd)
(c:/texlive/2020/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (c:/texlive/2020/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
(c:/texlive/2020/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(c:/texlive/2020/texmf-dist/tex/latex/pdflscape/pdflscape.sty
(c:/texlive/2020/texmf-dist/tex/latex/graphics/lscape.sty))
(lyluatex)  Compiling score tmp-ly/e7131d1ccea7db24b4bb2261f5f50848 with LilyPond executable 'lilypond'.
The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.

Module lyluatex Warning: The score doesn't contain any music:
(lyluatex)               this will probably cause bad output. on input line 6
c:/texlive/2020/texmf-dist/tex/latex/base/ltluatex.lua:109: 
Module lyluatex Error: 
(lyluatex)             LilyPond failed to compile the score.
(lyluatex)             Please check the log file
(lyluatex)             and the generated LilyPond code in
(lyluatex)             tmp-ly/e7131d1ccea7db24b4bb2261f5f50848.log
(lyluatex)             tmp-ly/e7131d1ccea7db24b4bb2261f5f50848.ly
(lyluatex)             
(lyluatex)             As the input code has been automatically wrapped
(lyluatex)             with a music expression, you may try repeating
(lyluatex)             with the `nofragment` option.
(lyluatex)             on input line 6

stack traceback:
    [C]: in function 'error'
    c:/texlive/2020/texmf-dist/tex/latex/base/ltluatex.lua:109: in function <c:/te
xlive/2020/texmf-dist/tex/latex/base/ltluatex.lua:108>
    (...tail calls...)
    c:/texlive/2020/texmf-dist/scripts/lyluatex/lyluatex.lua:555: in method 'check
_compilation'
    c:/texlive/2020/texmf-dist/scripts/lyluatex/lyluatex.lua:1180: in method 'writ
e_latex'
    c:/texlive/2020/texmf-dist/scripts/lyluatex/lyluatex.lua:1109: in method 'proc
ess'
    [\directlua]:1: in main chunk.
\ly@compilescore ...directlua {ly.score:process()}

l.6 Here's some music: \lilypond{a b c}

? 

I notice it looks for and fails to find a .aux file. The .ly file produced in /temp-ly is perfectly fine, but the .log file is empty.

If I compile the .ly file in /temp-ly, it produces a pdf file that is exactly correct. Compiling the .tex file a second time produces a good pdf, but with the following warning:

Module lyluatex Warning: gs couldn't be launched; there could be rounding error
s. on input line 6

Larger files seem to get stuck while compiling the temporary .ly file. If I manually compile it while the second tex compilation is trying to compile it, the correct pdf is immediately produced. The gs launch warning above still occurs.

For the record, this is occurring whether I use TeXworks, TeXstudio, or command line; and whether I use \lilypond, \begin{lilypond} ... \end{lilypond}, or \lilypondfile.

Adding [force-compilation] when calling lyluatex does not help.

Any assistance is greatly appreciated. Thanks!

uliska commented 3 years ago

Please share the generated tmp-ly/e7131d1ccea7db24b4bb2261f5f50848.ly file as the messages indicate that LilyPond tried to compile that and failed.

However, the other hint is that "The filename, directory name, or volume label syntax is incorrect." This may mean that our code to let LilyPond find the file to compile may be incorrect and fails to work properly on Windows. Could you please also show a command line that lets LilyPond correctly compile the temp file?

fiat96 commented 3 years ago

Okay, here's the tmp-ly/e7131d1ccea7db24b4bb2261f5f50848.ly file:

%%File header
\version "2.18.2"

\include "lilypond-book-preamble.ly"

#(define inside-lyluatex #t)
#(set-global-staff-size 11.111111111111)

\header {
    copyright = ""
    tagline = ##f
}
\paper{
    system-count = 0

    two-sided = ##f
    line-width = 345.0\pt
    indent = 0\pt

}
\layout{

}

%%Follows original score
{a b c}

And this temp file compiles fine with just lilypond tmp-ly\e7131d1ccea7db24b4bb2261f5f50848 in the command line running in the Documents folder.

fiat96 commented 3 years ago

I don't know if this may help pin down the problem, or just muddy the waters...

I tried to compile the file on an older computer which is running TeXLive 2016 and Lilypond 2.19.3 on Windows 7. I realize that's changing all the variables at once...

The interesting thing, though, is that the file would not compile in the command line, but it did compile just fine in TeXworks. The command line also produced a different type of error:

C:\Users\HAN\Documents\lyluatex>lualatex --shell-escape untitled1
This is LuaTeX, Version 0.95.0 (TeX Live 2016/W32TeX)
 system commands enabled.
(./untitled1.tex
LaTeX2e <2017/01/01> patch level 3
(using write cache: C:/Users/HAN/.texlive2016/texmf-var/luatex-cache/generic)(u
sing read cache: C:/texlive/2016/texmf-var/luatex-cache/generic C:/Users/HAN/.t
exlive2016/texmf-var/luatex-cache/generic)
luaotfload | main : initialization completed in 0.420 seconds
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(c:/texlive/2016/texmf-dist/tex/latex/base/report.cls
Document Class: report 2014/09/29 v1.4h Standard LaTeX document class
(c:/texlive/2016/texmf-dist/tex/latex/base/size10.clo(load luc: C:/texlive/2016
/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc)(save: C:/Users
/HAN/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.lu
a)(save: C:/Users/HAN/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/lmr
oman10-regular.luc))) (./lyluatex.sty
(c:/texlive/2016/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(c:/texlive/2016/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))
(c:/texlive/2016/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(c:/texlive/2016/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(c:/texlive/2016/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(c:/texlive/2016/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(c:/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
(c:/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
(c:/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty)
(c:/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(c:/texlive/2016/texmf-dist/tex/latex/graphics-def/luatex.def
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(c:/texlive/2016/texmf-dist/tex/latex/minibox/minibox.sty
(c:/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3.sty
(c:/texlive/2016/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(c:/texlive/2016/texmf-dist/tex/latex/l3kernel/l3pdfmode.def)))
(c:/texlive/2016/texmf-dist/tex/latex/environ/environ.sty
(c:/texlive/2016/texmf-dist/tex/latex/trimspaces/trimspaces.sty))
(c:/texlive/2016/texmf-dist/tex/latex/currfile/currfile.sty
(c:/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty))))
(c:/texlive/2016/texmf-dist/tex/latex/filehook/filehook.sty))
(c:/texlive/2016/texmf-dist/tex/latex/pdfpages/pdfpages.sty
(c:/texlive/2016/texmf-dist/tex/latex/base/ifthen.sty)
(c:/texlive/2016/texmf-dist/tex/latex/tools/calc.sty)
(c:/texlive/2016/texmf-dist/tex/latex/eso-pic/eso-pic.sty
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/atbegshi.sty
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/ifpdf.sty))
(c:/texlive/2016/texmf-dist/tex/latex/xcolor/xcolor.sty
(c:/texlive/2016/texmf-dist/tex/latex/graphics-cfg/color.cfg)))
(c:/texlive/2016/texmf-dist/tex/latex/pdfpages/ppluatex.def))
(c:/texlive/2016/texmf-dist/tex/latex/varwidth/varwidth.sty)
(c:/texlive/2016/texmf-dist/tex/latex/metalogo/metalogo.sty
(c:/texlive/2016/texmf-dist/tex/generic/ifxetex/ifxetex.sty))) (./untitled1.aux
) (c:/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (c:/texlive/2016/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(c:/texlive/2016/texmf-dist/tex/latex/oberdiek/grfext.sty
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty)
(c:/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(c:/texlive/2016/texmf-dist/tex/latex/oberdiek/pdflscape.sty
(c:/texlive/2016/texmf-dist/tex/latex/graphics/lscape.sty))(load luc: C:/Users/
HAN/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/lmsans10-regular.luc)
(load luc: C:/Users/HAN/.texlive2016/texmf-var/luatex-cache/generic/fonts/otl/l
mmono10-regular.luc)
(lyluatex)      Compiling score tmp-ly/3a54e52c1308def53f896daa1fbe3bba with Lil
yPond executable 'lilypond-windows'.
./lyluatex.lua:117: bad argument #2 to 'gsub' (string/funct
ion/table expected)
stack traceback:
        [C]: in function 'gsub'
        ./lyluatex.lua:117: in function 'extract_includepaths'
        ./lyluatex.lua:810: in function 'lilypond_cmd'
        ./lyluatex.lua:1126: in function 'run_lilypond'
        ./lyluatex.lua:1090: in function 'process'
        [\directlua]:1: in main chunk.
\ly@compilescore ...directlua {ly.score:process()}

l.6 Here's some music: \lilypond{a b c}

?
[1{c:/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./untitled1.aux))
 415 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 8 glue, 7 attribute, 44 glue_spec, 7 attribute_lis
t, 1 write nodes
   avail lists: 2:50,3:5,4:6,5:17,6:22,7:42,8:1,9:31,11:1
<c:/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf>
Output written on untitled1.pdf (1 page, 3564 bytes).
Transcript written on untitled1.log.

The temp-ly folder is empty after this compilation attempt. Also, the command line can compile the tex file once the temp .ly file has been created and compiled by TeXworks.