抱歉,这看起来可能有点菜鸟,但显然我无法将 Lilypond 分数集成到我的 LaTeX 文档中(好吧,ABC 分数也不能,但这是另一个问题)。
我有这个MWE:
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\begin{lilypond}[quote,fragment,staffsize=26]
c' d' e' f' g'2 g'2
\end{lilypond}
\end{document}
当我运行时pdflatex
,我得到:
ERROR: LaTeX Error: Environment lilypond undefined.
--- TeX said ---
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.35 \begin{lilypond}
[quote,fragment,staffsize=26]
--- HELP ---
LaTeX has encountered a \begin command for a nonexistent environment.
You probably misspelled the environment name.
我究竟做错了什么?
我使用的是 Arch Linux,并且安装了以下软件包:
[alessandro@commodoroII MMDC]$ pacman -Qe | grep texlive
texlive-bibtexextra 2022.63023-1
texlive-core 2022.63035-1
texlive-fontsextra 2022.62977-1
texlive-formatsextra 2022.62529-1
texlive-games 2022.62102-1
texlive-humanities 2022.62929-1
texlive-latexextra 2022.63034-1
texlive-music 2022.62533-1
texlive-pictures 2022.62992-1
texlive-pstricks 2022.62977-1
texlive-publishers 2022.63013-1
texlive-science 2022.62977-1
谢谢!
答案1
以下是如何使用lyluatex:以下是内容document.tex
:
\documentclass[a4paper]{article}
% Lyluatex needs LuaLaTeX, so fonspec here instead of inputenc and fontenc.
% You may put a font package here ("libertine" or "ebgaramond" for example)
% instead of "fontspec", as they depend on it.
\usepackage{fontspec}
% "pass-fonts" ensures coherent fonts (for lyrics) between the document and the scores.
\usepackage[pass-fonts]{lyluatex}
\begin{document}
\begin{lilypond}
c' d' e' f' g'2 g'2
\end{lilypond}
\end{document}
然后使用以下命令进行编译lualatex
:
lualatex --shell-escape document
shell-escape
是允许生成lilypond
进程所必需的。否则,您可以添加lilypond
命令shell-restricted
,但这超出了本小指南的范围。
在装有 MiKTeX 的 Windows 上,使用 LilyPond <= 2.22 直到这个错误找人来修。