如何使用 lyLuaTeX?

如何使用 lyLuaTeX?

我正在尝试使用 lyLuaTeX,但它不起作用。我读过文档但我不明白如何让它工作。

我在 Windows 10 上使用TeX Live(第一条评论)。以下是我正在尝试编译的内容。

\documentclass{article}
\usepackage[program=C:/Program Files (x86)/LilyPond/usr/bin/lilypond.exe]{lyluatex}

\begin{document}

Help.

\lilypond{ c' d' e'}

\end{document}

我已--shell-escape在 TeXworks 上添加了 LuaLaTeX 偏好设置文件名上方,然后我按下使用 LuaLaTeX 进行编译。但是,我收到以下错误。

Module lyluatex Error: LilyPond could not be started.
(lyluatex)             Please check that LuaLaTeX is started with the
(lyluatex)             --shell-escape option, and that 'program'
(lyluatex)             points to a valid LilyPond executable.
(lyluatex)             on input line 8

stack traceback:
    [C]: in function 'error'
    ...iles/texlive/2020/texmf-dist/tex/latex/base/ltluatex.lua:109: in function <
...iles/texlive/2020/texmf-dist/tex/latex/base/ltluatex.lua:108>
    (...tail calls...)
    ...es/texlive/2020/texmf-dist/scripts/lyluatex/lyluatex.lua:1081: in method 'p
rocess'
    [\directlua]:1: in main chunk.
\ly@compilescore ...directlua {ly.score:process()}

l.8 \lilypond{ c' d' e'}

? 

感谢您的时间。

答案1

我在 Windows 10 和 LilyPond 2.22.2 上遇到了同样的问题。我通过将 LilyPond 移动到没有空格的路径来解决这个问题。

这个MWE对我有用:

\documentclass[a4paper]{article}
\usepackage[program=/bin/lilypond/usr/bin/lilypond.exe]{lyluatex}
\begin{document}

\lilypondfile[staffsize=17]{/score.ly}

\end{document}

答案2

由于这个问题没有答案,有人可能会偶然发现这个问题,所以我回答了一个非常类似的问题音乐.sx。将音乐集成到 LaTeX 中的最佳策略是分别制作音乐片段和文本文档,然后使用 graphicx 将片段集成为 pdf。

相关内容