-
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
Formatting Error in TeXShop after Line Break with Clef Change #1285
Comments
This one seems egregious enough to be in 5.0. The symptoms seem to indicate a problem in TeX or Lua. |
I need a hint. I inspected the calls to |
@signumaltum How much of that gabc file is actually needed to reproduce the error? I'd like to inspect the gtex generated when the error occurs, but there's too much here to wade through. I'd also like to determine just how consistent the upward shift is and having a simpler file would make playing with the variations easier. My preliminary thoughts are that the error has to be in something that is used to calculate the position of the notes, but not the staff lines (since they remain in the correct position). This says to me to look at registers which are involved in calculating note positions, but not staff positions. Furthermore, I notice that everything goes back to normal on the very next line. Therefore, I would look at which temporary distance registers are being used in the clef change and which are being used in the line breaking code. If there's overlap in these two then it may be that we're seeing an interaction where said register is being modified by both algorithms at the same time, and both are expecting it to be theirs and theirs alone during its use. In that case I would try switching one of them to use a different register. Along those later lines, it might be useful to consider implementing one of two options:
Both of these would require some pretty extensive changes throughout the code, so maybe we put them off into their own issue. There are, for instance, 271 occurances of |
@rpspringuel I have a trimmed-down subset of that gabc which shows the problem. I'll push it to a branch of the test repository. |
@rpspringuel See henryso/gregorio-test@5289206. If you uncomment the |
I'm not having any luck debugging this problem. I'm going to have to raise the surrender flag, at least for now. |
I completely forgot about this. I'll see if I can't make time for it when I finish the fonts. |
Okay, I have to take a break from this for now, but after doing some playing I've figured out the following: Because all the notes in the sequence are being affected, the problem must be in the calculation of Adding some debug messages to the log, I get the following information about this value: 1st pass:
2nd pass:
As you can see, the second pass throws in two extra calculations of |
Okay, turns out that the |
No time to do additional work now, but I had a new thought which I want to make sure I don't forget: Instead of it being |
I've looked at the To do some further study, I manually compiled the gabc file and used the Does anyone recall why we don't want to call |
I was not part of the inception of that code. Maybe @eroux will know. |
Okay, I don't know why yet, but I can say that |
Since `\hskip` is not discretionary friendly, we normally use `\gre@hskip`, which we can redefine when inside a discretionary. However, in examining the this issue (gregorio-project#1285) I found a few places where a normal `\hskip` was still being used. This commit converts all of them to `\gre@hskip`.
Okay, so the culprit appears to be Since the line break occurs inside the discretionary, we have to adjust the line heights before entering the discretionary. Now, |
It it conceptually possible to get the low and high heights on the following line through Lua. How would you need the values? I suppose the Lua call could generate a macro call with the values you need. |
What I need is basically the output of Based on that I might envision the following procedure:
Step 2 & 3 is, I think, where the Lua function call would come into play. Indeed, the function would probably look like |
OK, I'll create a Lua function that will call |
The issue I'm running into is handling the per-line spaces and counts. It'll take a bit more time. |
Part of the implementation for gregorio-project#1285.
I implemented the function. I tried to apply it in Before setting the local left box:
After setting the local left box:
However, this has some strange effects because |
Did it at least work in the case which started this whole thing? I'm working on something else right now, but when I finish that I'll come back to this. |
It's hard to tell. It seems (visually, at least) to have applied the second line heights to the first line, so I can't really tell if it's helping in that case. |
When I attempt to use this function I'm getting an error: |
I did not run into that problem. From where are you calling the function? |
I added the function call to |
I put the additions closer to the Interestingly, the error occurs only when I try to call |
Can you put your test in the fix-1285 branch in the test repository? |
I'm working with the test that you put in the repository. |
Ugh. I was hoping it was some other test. I definitely don't get that error with that test. It occurs to me now, though, that I am using the fix-1285 branch as in my repository, and not the one with your proposed changes (trace, etc.). I'll see if I can prep a repository with that stuff in it to see if there's a difference. |
I cloned your repository, fetched fix-1285 into it and merged fix-1285 with trace. I still don't get that capacity error. I'll keep trying stuff, but I'm at a loss here. |
I did a |
I tried working with just your branch (and nothing from any of mine), but still get the error. The only thing I can think of right now is that the end of line call of |
What really doesn't make sense is that you are getting a capacity error and I am not, with the same test, which then does not indicate infinite recursion. I am not skilled enough with TeX-fu that I can try to adjust how my setup works to try to reduce its capacity somehow. |
The input file capacity can be adjusted by adding the following line to
The number indicates the file limit. You can check the value with You can check for the location of |
Ok, I am now able to reproduce this problem. I'll try a few things out over here as well. Thanks for the tips. |
I tried upping the limit on my system again and found that I have an inbuilt limit of 600 and that this still isn't big enough to get rid of the error. |
Ok, I changed the Lua function to not call |
A quick test and I see what you mean about it breaking other tests. However, it also doesn't seem to work completely for the test case. The lines and notes are aligned right for the second and subsequent lines, but the divisio minima and the custos at the end of the first line are now pushed high. It also looks like the ledger lines on the third line are high and the lyrics are overlapping with the bottom notes. All the broken tests make me think that we're not calling |
|
I took a look at those macros. |
I think you may be right, but can't think of an alternative at the moment. I'm going to have to brainstorm that one for a bit. |
Okay, in order to help figure this out, I'm going to try and lay out the issues:
Have I missed anything? Assuming I haven't, and our attempt to update change the distances inside |
I just tried it, and it appears that working inside |
I tried it as well and concur that is works. However, in running tests, I discovered that I am not saving enough dimensions in |
The fix-1285 branch is updated. |
…fix-1285 * commit '182b6b92d09f381591eec71ee677b69219fcf93c': Implemented function to set adjust line height for next line. Part of the implementation for gregorio-project#1285.
…fix-1285 * commit 'bd659443c79417477eb094f4440b2dc5518e9bae': Set up the left box using next line heights in \GreDiscretionary. Fixes gregorio-project#1285.
I've confirmed the changes and created the PR. |
* commit 'e787240dd290ba5dd7541eccb2c5e6b6afd8e297': Small font difference Test result for new test Added a test for gregorio-project/gregorio#1285.
* develop: Documentation Set up the left box using next line heights in \GreDiscretionary. Fixes gregorio-project#1285. Documentation correction Fixed infinite recursion. Implemented function to set adjust line height for next line. Part of the implementation for gregorio-project#1285. Oops. Forgot to stage a change. Swap some \hskip to \gre@hskip More redundant function calls More redundant function calls Move file version declaration Remove useless debug messages Removing redundant function calls
* develop: Prevented delete of old fonts. Small font difference Test result for new test Minor font differences Modify tests to exercise trace messages. Added a test for gregorio-project/gregorio#1285.
I am encountering an error in using Gregorio (4.2.0) with TeXShop for Mac. Certain Gregorio files will corrupt if the file is Typeset twice or more. Specifically, an individual line will display with the pitches and clefs shifted up or down one to three steps. I have included a picture below of the corrupted line (the remainder of the piece displays normally). The display error is limited to only one line of the piece. The problem only seems to occur in files with multiple clef changes (a necessity for several pieces I’m typesetting). Based on some troubleshooting, it seems that the bug may be caused when a clef change with a breath mark (, ; :) occurs at the natural break of the line, e.g. (z0,c3). In this case, if I use the code (z0c3) after the word "angelo," there is no error. Notice the line with the text “qui volare voluit.”
Typeset once (correct):
Same file, Typeset twice (corrupted):
Here is the entire GABC:
%%
(c4) O(ev) glo(fv)ri(dv)o(c)sis(dv)si(de)mi,(ev) (,)* lux(gv) vi(gh)vens,(hg) an(fe~)ge(de)li,(ev) (,) qui(ed/c/dc) in(dde~)fra(ev) di(ev)vi(eh)ni(jvIHG)ta(hg)tem(fvED/ev) di(ev)vi(ede)nos(gc/dc/dwe) o(hg/hwjHG)cu(ghGFE)los(evDC/dwe) (e+f3) cum(gfg) mi(iv)sti(hg)ca(gv) ob(cgFE)scu(fv)ri(evDCBcv)ta(dbc)te(cv) om(jilJIji~)nis(hg) cre(cb)a(ef)tu(evDCB)re(cv) as(cv)pi(cv/fgf)ci(fvEC)tis(ebc) in(hv) ar(ji)den(ji)ti(hvGF)bus(gv) de(klwm)si(mvLK)de(lvJI)ri(jvIHGF)is,(gv) (,) un(hvGFfg~)de(ge) num(hvFE/fvEDC)quam(dbc) po(ghwi)tes(ivHGF)tis(gv) sa(iji)ci(hg)a(fg)ri:(gv) (z0;c4) O(egfjHG) quam(hvFE) glo(ijwk/lvKJI)ri(jvHG)o(hg)sa(fvEDev) (a+f3) gau(ceDC/dc~)di(bc)a(cv) il(C1D1fv/hvGF/gf~)la(e) ve(ghwi)stra(hvGF/gv) (z0c4) ha(ehgjHG/hvFED)bet(ev) for(ijwkJI/jvHGhg~)ma,(fvEDev) (,) {que}(dec) in(E1F1gv) vo(hg)bis(fvEDC) est(ded) in(dh)tac(ixkvJI/jvIHG)ta(hv) ab(ivGF) om(gf)ni(ed) pra(fg/hd)vo(fcd) o(hgj)pe(jvIHG)re,(hv) (,) quod(hkj/kwmKJ/kvIHG/hv) pri(hghGF/gv)mum(fvEDC/dv) or(fvEC/efwgFEDCB/cdcd)tum(fvEDC) est(ded) in(ixhg/hhwj) ve(jvIHG)stro(hv) so(kj/kkwmKJIH)ci(gfg)o,(hv) (,) per(ixhd/hv/ivGF)di(gf)to(ed/cd/ed) an(hghGF/gf~)ge(ed)lo,(fvEDC/dv) (z0:c3) qui(ghwiHG) vo(gfgFE/ffwg//lk/jjwlIH)la(if/efc)re(dvCBA/bv) (z0c4) vo(dvCA/cd)lu(fvEDC)it(dv) sup(hvGF/gf)ra(ed) in(fvED/ed~)tus(cd) la(dvC0A0//B1C1/dc)tens(ded) pin(hvGF/gvFD)na(hg/hi)cu(ikj/mvKJ)lum(ixkvIHGF) de(hd/fvEDC)i.(dv) (:) Un(adc/d@f/@fe~)de(c) ip(e/fwgFED/fvEDC)se(ded) tor(dh)tu(jm/LKJ)o(kjk)sus(ivHG/hv) di(dc)mer(fgf)sus(evDC) est(dv) in(dvC0A0//B1C1dv) ru(fv)i(evDC)nam;(ded) (;) sed(dh) ip(kj)si(ixivHG)us(hv) in(hv)stru(kmLKJ)men(kj~)ta(ixih) ca(df/gvFED)sus(fcd) con(dh)si(hvGF)li(hv)an(kvJI/jV/@ji~)do(hgh) fac(hkj/kwmKJ)tu(ixkvIHG)re(hv) di(ixdh/ivGF)gi(gf)ti(ed/cd/ed) de(cd)i(dv) in(fvED)sti(fgwhg)tu(hg)it.(fvED/ev) (::)
The text was updated successfully, but these errors were encountered: