lilypond-book 환경의 \include 변수가 확장되지 않습니다.

lilypond-book 환경의 \include 변수가 확장되지 않습니다.

나는 TeX 내에서 lilypond를 사용하여 몇 가지 음악 연습을 조판하고 있습니다. 일반 코드는 잘 동작하는 것 같은데, 재사용되는 코드가 많아 변수를 설정해 보았습니다. 변수가 선택되었지만 확장되지 않은 것 같습니다.

MWE:

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = LilyPond-Book
% !LILYPOND tex = xelatex
\documentclass{memoir}
\begin{document}
\begin{lilypond}
{
  \include "lilypond-variables.ly"
  \time 2/4
  \grace { g''32 } g'4  \Ggrace a'4  \Ggrace b'4  \Ggrace c''4
  \Ggrace d''4 \Ggrace e''4 \Ggrace f''4         g''4
          a''2         g''4         f''4 \Ggrace e''4
  \Ggrace d''4 \Ggrace c''4 \Ggrace b'4  \Ggrace a'4
  \Ggrace g'4
  \bar "||"
}
\end{lilypond}
\end{document}

포함된 파일 lilypond-variables.ly:

Ggrace = { \grace { g''32 } }

산출:

여기에 이미지 설명을 입력하세요

보시다시피 '하드 코딩된' g 그레이스 노트는 괜찮지만 \Ggrace단순히 제작해야 할 노트는 나타나지 않습니다.

나는 \include(Lilypond 문서에 지정된 따옴표를 사용하여) 및 \input(위의 따옴표와 중괄호)를 시도했으며 그 전에 TeX 코드 내에서 표준 s를 시도했지만 \newcommand결과는 동일했습니다.

나에게는 수많은 그레이스 노트 조합이 있기 때문에 이것은 상당히 큰 문제입니다. 나는 원래 그것들을 모두 하드 코딩했고, 앞으로의 코딩을 덜 고통스럽고 오류가 발생하기 쉽게 만들 것이라고 생각했습니다.

macOS Sierra 10.12.5(16F73) 및 TL 2016을 사용합니다.

답변1

\include가 중괄호 밖으로 이동 되면 코드는 다음과 같이 제대로 작동합니다.

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = LilyPond-Book
% !LILYPOND tex = xelatex
\documentclass{memoir}
\begin{document}
\begin{lilypond}
\include "lilypond-variables.ly"
{
  \time 2/4
  \grace { g''32 } g'4  \Ggrace a'4  \Ggrace b'4  \Ggrace c''4
  \Ggrace d''4 \Ggrace e''4 \Ggrace f''4         g''4
          a''2         g''4         f''4 \Ggrace e''4
  \Ggrace d''4 \Ggrace c''4 \Ggrace b'4  \Ggrace a'4
  \Ggrace g'4
  \bar "||"
}
\end{lilypond}
\end{document}

산출:

여기에 이미지 설명을 입력하세요

따라서 @egreg가 제안한 것처럼 실제로 Lilypond 문제였습니다(해결책을 지적한 Lilypond 목록의 동료에게 감사드립니다).

관련 정보