lyluatex 并非所有 lilypond 代码都可以单独获取

lyluatex 并非所有 lilypond 代码都可以单独获取

我确信这是一个非常有限和简单的 MWE,我可能无法完美地报告实际问题,但我会尝试一下。

我观察到,lilypondlyluatex 或 lilypond-book 读取的环境能够使用该\include命令导入不同文件中的模块化内容。我的问题是它似乎不适用于所有序列。例如

\score {
    <<
    \unfoldRepeats{\tune}       
    >>
}

无法在单独的文件中获取源代码,但正如 MWE 所示,命令本身在包含在 lilypond 环境块中时直接工作就很好了。有趣的是,我没想到必须使用=inbetween\include和文件名,因为如果我直接编译它们,lilypond 文件中不会使用它,但在 latex 中似乎需要它。

\documentclass[letter,fontsize=12pt]{article}

\usepackage{import}
\usepackage{graphics}
\usepackage{grffile}

\usepackage{luatexbase}
\usepackage[program=lilypond]{lyluatex}

\begin{document}

Both files explicitly written out. No include statement in lilypond to process.

\begin{lilypond}

% file 1: test.ly
    global = {
        \key b \minor
        \time 9/8
    }
    tune = \absolute {
        \global
        % Music follows here.
        \relative c' { c8 d e f g a b c c }
        \bar ":|."
    }
% file 2: Settings.ly
    \score {
        <<
        \unfoldRepeats{\tune}       
        >>
    }
\end{lilypond}

Music imported from lilypond file with explicitly printing

\begin{lilypond}
    %\version "2.18.2"
    \include = "test1.ly"
    tune = \transpose c d {\first}
    \score {
        <<
        \unfoldRepeats{\first}      
        >>
    }
\end{lilypond}


Music imported from multiple lilypond file with explicitly printing (to prove the files aren't overwriting each other in memory)

\begin{lilypond}
    %\version "2.18.2"
    \include = "test1.ly"
    \include = "test2.ly"
    first = \transpose c d {\first}
    second = \transpose c b {\second}
    \score {
        <<
        \unfoldRepeats{\first\second}       
        >>
    }
\end{lilypond}

%These options don't work

%\begin{lilypond}
%% file 1: test.ly
%   global = {
%       \key b \minor
%       \time 9/8
%   }
%   tune = \absolute {
%       \global
%       % Music follows here.
%       \relative c' { c8 d e f g a b c c }
%       \bar ":|."
%   }
%   tune = \transpose c d {\tune}
%   \include = "CreateScore.ly"
%\end{lilypond}

%\begin{lilypond}
%   \version "2.18.2"
%   \include = "test.ly"
%   tune = \transpose c d {\tune}
%   \include = "CreateScore.ly"
%\end{lilypond}


\end{document}

我的第一个假设是这是变量和命令之间的差异,但无法证明这一点,因为我也可以处理未保存在变量中的注释。

我尝试了几十种排列,试图将问题简化为我认为的根本问题,但正如我所说的,我可能将其简化得太过分,以至于无法使实际问题显现出来。

我已经尝试了绝对路径,并且正如您从 MWE 中看到的那样,我已经隔离了模块化或外部化时失败的块的“类型”。

我正在使用如下所示的 bat 文件从 miktex 进行编译,该文件应该可以在运行 miktex 的任何 Windows 架构上运行:

Del "*.pdf"

:CheckOS
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (GOTO 32BIT) ELSE (GOTO 64BIT)

:64BIT
ECHO 64-bit compiling
SET MikTexPath=C:\Program Files\MiKTeX 2.9\miktex\bin\x64\
GOTO END

:32BIT
ECHO 32-bit compiling
SET MikTexPath=C:\Program Files\MiKTeX 2.9\miktex\bin\
GOTO END

:END

SET TeXCompilier=lualatex.exe

FOR %%A IN (*.lytex) DO (
"%MikTexPath%%TeXCompilier%" -shell-escape "%%~nxA"
)

如果我取消注释当前已注释掉的 MWE 的第一个块,就会出现以下错误。

This is LuaTeX, Version 1.07.0 (MiKTeX 2.9.6650 64-bit)
 system commands enabled.
(./test.lytex
LaTeX2e <2017-04-15>
(using cache: C:/Users/EngBIRD/AppData/Local/MiKTeX/2.9/luatex-cache/generic)
luaotfload | main : initialization completed in 0.609 seconds
Babel <3.18> and hyphenation patterns for 1 language(s) loaded.
("C:/Program Files/MiKTeX 2.9/tex/latex/base/article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:/Program Files/MiKTeX 2.9/tex/latex/base/size10.clo"(load luc: C:/Users/Ste
phen/AppData/Local/MiKTeX/2.9/luatex-cache/generic/fonts/otl/lmroman10-regular.
luc))) ("C:/Program Files/MiKTeX 2.9/tex/latex/import/import.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics/graphics.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics/trig.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics-cfg/graphics.cfg")
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics-def/luatex.def"))
("C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/grffile.sty"
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ifpdf.sty")
("C:/Program Files/MiKTeX 2.9/tex/generic/ifxetex/ifxetex.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/kvoptions.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics/keyval.sty")
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty")
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/kvsetkeys.sty"
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/infwarerr.sty")
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/etexcmds.sty"
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/ifluatex.sty"))))
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/pdftexcmds.sty"))
("C:/Program Files/MiKTeX 2.9/tex/luatex/luatexbase/luatexbase.sty"
("C:/Program Files/MiKTeX 2.9/tex/luatex/ctablestack/ctablestack.sty"))
("C:/Program Files/MiKTeX 2.9/tex/lualatex/lyluatex/lyluatex.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/xkeyval/xkeyval.sty"
("C:/Program Files/MiKTeX 2.9/tex/generic/xkeyval/xkeyval.tex"
("C:/Program Files/MiKTeX 2.9/tex/generic/xkeyval/xkvutils.tex")))
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics/graphicx.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/minibox/minibox.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/l3kernel/expl3.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/l3kernel/expl3-code.tex")
("C:/Program Files/MiKTeX 2.9/tex/latex/l3kernel/l3pdfmode.def")))
("C:/Program Files/MiKTeX 2.9/tex/latex/environ/environ.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/trimspaces/trimspaces.sty"))
("C:/Program Files/MiKTeX 2.9/tex/latex/currfile/currfile.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/filehook/filehook.sty"))
("C:/Program Files/MiKTeX 2.9/tex/latex/pdfpages/pdfpages.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/base/ifthen.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/tools/calc.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/eso-pic/eso-pic.sty"
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/atbegshi.sty")
("C:/Program Files/MiKTeX 2.9/tex/latex/xcolor/xcolor.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics-cfg/color.cfg")))
("C:/Program Files/MiKTeX 2.9/tex/latex/pdfpages/ppluatex.def"))
("C:/Program Files/MiKTeX 2.9/tex/latex/metalogo/metalogo.sty"))

LaTeX Warning: Unused global option(s):
    [letter,fontsize=12pt].

(./test.aux) ("C:/Program Files/MiKTeX 2.9/tex/context/base/supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
) ("C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/epstopdf-base.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/grfext.sty"
("C:/Program Files/MiKTeX 2.9/tex/generic/oberdiek/kvdefinekeys.sty")))
("C:/Program Files/MiKTeX 2.9/tex/latex/oberdiek/pdflscape.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/graphics/lscape.sty"))(load luc: C:/Users/EngBIRD/AppData/Local/MiKTeX/2.9/luatex-cache/generic/fonts/otl/lmsans10-reg
ular.luc)(load luc: C:/Users/EngBIRD/AppData/Local/MiKTeX/2.9/luatex-cache/generic/fonts/otl/lmmono10-regular.luc)
Module lyluatex Warning: Found something incompatible with `fragment`
(lyluatex)               (or `relative`). Setting them to false.
(lyluatex)               on input line 33
Module lyluatex Warning: Found something incompatible with `fragment`
(lyluatex)               (or `relative`). Setting them to false.
(lyluatex)               on input line 46
Module lyluatex Warning: Found something incompatible with `fragment`
(lyluatex)               (or `relative`). Setting them to false.
(lyluatex)               on input line 62

(lyluatex)      Compiling score tmp-ly/026dbc682ca7ab76ec54eb50caff61b9 with LilyPond executable 'lilypond'.
-:30:2: error: unrecognized string, not in text script or \lyricmode
{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:9: error: syntax error, unexpected '='
{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:39: error: unrecognized string, not in text script or \lyricmode
{global = { \key b \minor \time 9/8 }
tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:44: error: syntax error, unexpected '='
{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:58: error: unknown escaped string: `\global'
{global = { \key b \minor \time 9/8 } tune = \absolute {\global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:58: error: unrecognized string, not in text script or \lyricmode
{global = { \key b \minor \time 9/8 } tune = \absolute {\global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:115: error: unrecognized string, not in text script or \lyricmode
{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." }

tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:120: error: syntax error, unexpected '='
{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:138: error: unknown escaped string: `\tune'
{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:138: error: unrecognized string, not in text script or \lyricmode
{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:155: error: invalid character: `='
{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
-:30:155: error: syntax error, unexpected $undefined
{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = CreateScore.ly"}
C:/Home/Personal/Dropbox/CurrentMWE/CreateScore.ly:4:16: error: unknown escaped string: `\tune'
\unfoldRepeats{\tune}
C:/Home/Personal/Dropbox/CurrentMWE/CreateScore.ly:4:16: error: unrecognized string, not in text script or \lyricmode 
\unfoldRepeats{\tune}
-:30:1: error: errors found, ignoring music expression

{global = { \key b \minor \time 9/8 } tune = \absolute { \global \relative c' {c8 d e f g a b c c } \bar ":|." } tune = \transpose c d {\tune } \include = "CreateScore.ly"}
fatal error: failed files: "-"
C:/Program Files/MiKTeX 2.9/tex/latex/base/ltluatex.lua:109:
Module lyluatex Error:
(lyluatex)             LilyPond failed to compile the score.
(lyluatex)             If you need more information
(lyluatex)             than the above message,
(lyluatex)             please retry with option debug=true.
(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 80

stack traceback:
        [C]: in function 'error'
        C:/Program Files/MiKTeX 2.9/tex/latex/base/ltluatex.lua:109: in function
 <C:/Program Files/MiKTeX 2.9/tex/latex/base/ltluatex.lua:108>
        (...tail calls...)
        ...gram Files/MiKTeX 2.9/tex/lualatex/lyluatex/lyluatex.lua:633: in function '
check_compilation'
        ...gram Files/MiKTeX 2.9/tex/lualatex/lyluatex/lyluatex.lua:1171: in function
'write_latex'
        ...gram Files/MiKTeX 2.9/tex/lualatex/lyluatex/lyluatex.lua:1105: in function
'process'
        [\directlua]:1: in main chunk.
\ly@compilescore ...directlua {ly.score:process()}

l.80 \end{lilypond}
?

相关内容