jperon / lyluatex

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

LilyPond raw-pdf does not give hoffset #283

Open chestertonMM opened 3 years ago

chestertonMM commented 3 years ago

On page 46 of the documentation to lyluatex version 1.0f, one can find a way to use the raw-pdf functionality of lyluatex. The problem with that is, that I cannot find a way to apply the correct negative horizontal offset to the included graphics, so that they would correctly protrude into the left margin. This seems to be an issue in the documentation as well, where instrument name begins in the text area and not in the left margin, as would be correct. I add my own mwe where I first used the same code as in the documentation using the raw-pdf option and after that I included the score with the usual lilypond environment.

\documentclass{minimal}
\usepackage{lyluatex}
\usepackage{pgffor}
\usepackage{lipsum}

\begin{document}

  \newcommand\myforlily[2][]{%
\lily[insert=systems,raw-pdf,#1]{#2}
\lyscore{hoffset}\\%
\foreach \n in {1,...,\lyscore{nsystems}}%
    {\noindent\hspace*{\lyscore{hoffset}}\includegraphics{\lyscore{\n}}%
    \ifthenelse{\equal{\n}{3}}{\par Third system\par}{\\}
    }%
}

\lipsum[1]

\myforlily[staffsize=24]{
\score { \new Staff { \set Staff.instrumentName = "Vl." \repeat unfold 4 { c'1 \break } } } }

\lipsum[2]

\begin{lilypond}[staffsize=24]

\score { \new Staff { \set Staff.instrumentName = "Vl." \repeat unfold 4 { c'1 \break } } }

\end{lilypond}

\lipsum[3]

\end{document}

Namenlos-1.pdf See also the attached pdf-file.

I assume that the \hspace*{\lscore{hoffset}} should do the thing, but \lyscore{hoffset} just returns 0pt.

Thank you for your kind help.