jperon / lyluatex

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

Hash sign "illegal" in LilyPond #237

Closed uliska closed 5 years ago

uliska commented 5 years ago
\begin{lilypond}
#(ly:message "Hey")
\end{lilypond}

fails with

! You can't use `macro parameter character #' in vertical mode.
<recently read> ##

l.7 #
   (ly:message "Hey")
?

Obviously the # is interpreted as LaTeX (like we had it with e.g. \repeat) if the LilyPond snippet starts with it (if you place some regular LilyPond code before that it works like expected).

While this concrete example doesn't make sense it is perfectly reasonable to have snippets that only include one call to a music function which then produces the actual score, e.g. something like

\begin{lilypond}
#(example '(path to example))
\end{lilypond}
uliska commented 5 years ago

Note that \lilypond{#(example '(path to example))} correctly passes the code to the LilyPond file.

jperon commented 5 years ago

Are you sure you're using last version from the repo ? On my computer, this mwe compiles as expected :

\documentclass{scrartcl}
\usepackage[debug]{lyluatex}

\begin{document}

\begin{lilypond}
#(ly:message "Hey")
\end{lilypond}

\end{document}
uliska commented 5 years ago

Yes, I am using the latest pulled master. However, Probably the issue arised from having placed the code in a more complex context, and probably I was once more tricked by some residues in auxiliary files (I find this a pretty annoying "feature" in LaTeX).

Starting over with a fresh MWE and then with the content placed in an empty file with my project's documentclass I see that it does work properly. Sorry for the noise.