jperon / lyluatex

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

Large left padding with inline inserts #315

Open dedocc opened 1 year ago

dedocc commented 1 year ago

I'm currently using upstream lyluatex with TeXLive 2022 on Fedora. The \lilypond command produces large horizontal padding on the left of inline inserts. This isn't the case when using the lilypond environment, which also has issues on its own (as already pointed out in #276)

I have compiled an example (had to rename the source test.tex file as a txt because github wouldn't let me upload it otherwise):

test.txt test.pdf test.log

royabradley commented 11 months ago

I am having the same issue. I recently submitted a question about this on tex.stackechange.com.

reckel-jm commented 9 months ago

Same problem here

reckel-jm commented 9 months ago

I am able to fix the issue for the second+ line of an insertet file by using: \newcommand{\betweenLilyPondSystem}[1]{\newline\hspace{-10em}} However, the same command for \newcommand{\preLilyPondExample} does not work. So the first line remains aligned in that way.

reckel-jm commented 9 months ago

After a brief investigation into the matter, I found out that the problem is most likely in connection with the calculation of the left side protrusion in function bbox_calc around line 215 of lyluatex.la:

function bbox_calc(x_1, x_2, y_1, y_2, line_width)
    local bb = {
        ['protrusion'] = -lib.convert_unit(("%fbp"):format(x_1)),
        ['r_protrusion'] = lib.convert_unit(("%fbp"):format(x_2)) - line_width,
        ['width'] = lib.convert_unit(("%fbp"):format(x_2))
    }

I can only assume that maybe the underlying luaoptions-lib.lua lib function convert_unit has changed working, leading to a wrong protrusion error.

As a quick fix, it helped me to change line 310 of lyluatex.la to (in fact setting any protrusion to 0):

local h_offset = indent_offset
lukas-vlcek commented 5 months ago

Also having the issue.

Moreover, I would welcome more examples, for instance I am trying to output something like \markup { \doubleflat 7 } (see markup examples here) and I am not sure how to do it. Right now I am using workaround \flatflat7 which does not require \lilypond environment at all but that does not allow me to include symbols like \markup { \multi-measure-rest-by-number #12 } etc...