-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabled 'z' to force-justify the last line of a score. #459
Conversation
Just to be sure; did you check that the (vertical) space after the score is the same with this change? I don't think it changed, but it's something that is rarely tested and not obvious (sometimes the change in spacing is very small). |
There is a difference in the vertical space, about the height of one character. I'll see if I can fix it. |
I'm stumped. I don't know what is generating that extra space. Any hints? |
There's a code in gregoriotex.lua that removes empty lines, there is maybe something it doesn't manage to remove here... |
The line that both adds the extra space and enables the justification is I took a look at the Lua code, and for the case without the I don't claim to understand the underlying TeX structure, so I don't feel confident messing with this function. |
Debugging this is not easy, but I think you'll learn a lot... What I'd probably do is inspect the number of lines in the |
That's the thing... The number of lines is correct (after the empty line is removed) and the last non-empty line contains, apparently, the content of the last line. Are you saying I should look to remove something from within the last line? |
Would you have a minimal example showing the problem? |
fix-43.gabc
fix-43.tex
|
A clue:
Another one:
|
BTW, setting |
So it looks like there's an extra glue at the end. I'll look into this more closely tonight. |
I think TeX adds |
The glue subtype appears to be |
baselineskip might be a LaTeX wrapper around lineskip yes |
The extra glue is actually before the empty line that we remove. I tried removing this glue when the empty line is removed, but this only shrinks the vertical size very slightly, and certainly not a character's height. |
The line prior to the glue before the empty line looks like the last line produced with no |
Setting |
That said, even with |
Strange, in my tests setting baselineskip to 0 did work... I'm trying with
What's your test? |
I actually set |
if you reset it in endgregorioscore, you must do it after |
I'm resetting it right before |
Be sure to have a bunch of text (multiple lines) after the score to make sure that it appears right. You can use |
Yes, I am testing with Lorem Ipsum text (though not |
An interesting observation: If the last line is incidentally justified by TeX (when the notes just happen to line up that way, even without the |
I think I've gotten to the bottom of the cause, but I don't know how to fix it correctly. In both the (below has been edited) If I remove the penalty in Thoughts on a solution? |
After thinking about this for a while, I'm thinking the best thing to do would be to put a |
That would make things consistent indeed... I'll try to inspect that later today. |
Here is another approach: use
before your score, and use #461 |
That might remove the need for the final z, with a TeX-only solution... It might be better, what do you think? |
I don't know what's best to document it or make it more accessible to users, maybe setting |
I certainly do like the TeX approach better, but as this was proposed by @rpspringuel in #43, I'd like his opinion as well. So if I understand the complete fix, I should merge in #461, get rid of the C code here that allows the I don't think it makes much sense to use a user-defined value here. I think you either want ragged or justified. However, I can be easily convinced otherwise. Is there a reason for a user-defined value for How about |
Ok, let's wait for @rpspringuel 's answer, but otherwise you're right about what to do yes. User defined value might be useful, for instance if you don't want a blank of more than x cm at the end of your score, etc. But |
While I may have been the author of the Issue here, it arose out of a discussion on the user list where Joei wanted to have the last line justified like the first. Personally, I've no problem with an entirely TeX solution as it makes the gabc file more versatile. As for the possibility of a user defined value for |
ok then, let's do that |
I made the changes specified here. Please review. Note: most tests pass. @eroux's fix has tightened up the score, so some of the PDF tests fail in an acceptable manner. |
looks ok to me! |
Enabled 'z' to force-justify the last line of a score.
I see not problems either, but haven't done any real testing myself. |
Fixes #43.
In implementing this, I found a bug in the way elements are "cut", which I think I've fixed. The tests pass, except for one which ended with a 'Z', and whose result is acceptable.
This is ready for review.