sillsdev / ptx2pdf

XeTeX based macro package for typesetting USFM formatted (Paratext output) scripture files
23 stars 8 forks source link

When using RANGE, Picture links are ignored for any range of verses not starting with 0 #894

Closed davidc86 closed 11 months ago

davidc86 commented 1 year ago

We need to print the range:

LUK 1:26-38 MAT 1:18-24 LUK 2:0-20 MAT 2:0-12

All four ranges have pictures (\fig) fields.

But the picture ONLY show up in the last two ranges, and ONLY then, if I set the verse range to "0-" rather than "1-".

Setting the range to "0-" is unintuitive, and only works for ranges that actually begin with v1.

If the starting verse is anything other than "0", then the pictures in that range are ignored completely.

This issue is a SHOW-STOPPER for us. We are trying to format the Christmas story with illustrations, but the pictures referenced in the Luk 1 range and the Matt 1 range don't show in the output. (FYI, the pictures do display inside PTXprint, so it isn't that PTXprint doesn't see them.)

mhosken commented 1 year ago

A first guess is that there is no \c in the expanded module and so the macros are not pulling in the right anchors for the figs. I wonder if we need a \zsetref{LUK}{1}{26} at the start of each expanded scripture block. @David Gardner @.***>

davidg-sil commented 1 year ago

OK. I'll implement that on the TeX side of things, probably before sunset today, if someone can do the python. Somewhat related bugs: #895, #866, #812

davidg-sil commented 1 year ago

I've decided that a milestone format was more USFM-like:

\zsetref|book="LUK" chapter="1" verse="1" \*

book being what ought to be in the \h line. All fields are optional. Not setting something means that it stays what it was before. Setting it to blank probably leads to undefined behaviour.

davidg-sil commented 1 year ago

Note that this should probably also get applied to scripture modules.

Those who want to check the TeX side of things is working / (or use it!), without waiting for the python code to make it automagic, can grab latest commit and do something along the lines of :

"(\\v 1 In the beginning)" > '\\zsetref|chapter=1\\*\n\1'
mhosken commented 1 year ago

I like this approach. I'm wondering if we need to also include id="bkid" so that the figures, etc. know which book they should be comparing against?

markpenny commented 1 year ago

@davidc86 I've just pushed 2.3.37 out for you - let us know if this fixes the issue.

davidc86 commented 1 year ago

Well, I installed 2.3.37 and ran the process without changing anything, and I got this:

image

And then this:

Mailto: ptxprint_support@sil.org PTXprint [2.3.37] - Error! Failed to create: KEI_PublikasiKei-Natal_LUK-MAT_ptxp.pdf (no adjustment list "../../../shared/ptxprint/PublikasiKei-Natal/AdjLists/43LUK KEI-PublikasiKei-Natal1.SFM.adj" found) (no picture list "tmpPicLists/43LUKKEI-PublikasiKei-Natal1.SFM.piclist" found) (./43LUKKEI-PublikasiKei-Natal1.SFM First chapter for LUK INPUTFILE: "./tmpPics/cn01617.jpg" -> "./tmpPics/cn01617.jpg" [3] INPUTFILE: "./tmpPics/cn01621.jpg" -> "./tmpPics/cn01621.jpg") [4] [5] ptxfile 41MATKEI-PublikasiKei-Natal1.SFM monoglot (no adjustment list "../../../shared/ptxprint/PublikasiKei-Natal/AdjLists/41MAT KEI-PublikasiKei-Natal1.SFM.adj" found) (no picture list "tmpPicLists/41MATKEI-PublikasiKei-Natal1.SFM.piclist" found) (./41MATKEI-PublikasiKei-Natal1.SFM First chapter for MAT INPUTFILE: "./tmpPics/cn01629.jpg" -> "./tmpPics/cn01629.jpg" [6] converted picture placement "tc" to "t" in single-column layout INPUTFILE: "./tmpPics/cn01635.jpg" -> "./tmpPics/cn01635.jpg" INPUTFILE: "./tmpPics/cn01632.jpg" -> "./tmpPics/cn01632.jpg") [7] [8] [9] \openout0 = `KEI_PublikasiKei-Natal_LUK-MAT_ptxp.delayed'. (c:/My Paratext 9 Projects/KEI/local/ptxprint/PublikasiKei-Natal/KEI_PublikasiK ei-Natal_LUK-MAT_ptxp.parlocs) ** Only 5 pictures were used out of 10 defined. Piclist may have errors or perh aps contain references for other books. Unused references: MAT 1.21, LUK 1.29, FRT .0, FRT .1, FRT .2, (c:/My Paratext 9 Projects/KEI/local/ptxprint/PublikasiKei-Natal/KEI_PublikasiK ei-Natal_LUK-MAT_ptxp.notepages) (c:/My Paratext 9 Projects/KEI/local/ptxprint/PublikasiKei-Natal/KEI_PublikasiK ei-Natal_LUK-MAT_ptxp.picpages) )

Oops! Something unexpected happened causing this error. If you are unable to solve this issue yourself, use the 'Create Archive...' button on the Help page to create a .zip file and send it to ptxprint_support@sil.org for further assistance. Please include a description of the problem, and if known, tell us which setting was changed since it last worked.References to check in MAT: 1.21, 1.29,File(s) to check: cn01617.jpg", cn01617.jpg", cn01621.jpg", cn01621.jpg", cn01629.jpg", cn01629.jpg", cn01635.jpg", cn01635.jpg", cn01632.jpg", cn01632.jpg" PTXprint Version 2.3.37

davidc86 commented 1 year ago

But another question I have: Why use milestones? We are requesting a RANGE from a normal Paratext book. This is not a special book with truncated fields. So, we are asking for Luke 1:26-38. But This Luke book does have (unchecked) text vv1-25 and vv39-.

So why use milestones? In the old CC days we'd use STORE() functions to trap the \h, \mt1, \mt2, and \c values, and also would catch and continually refresh the \s1 and \r and \sr values as it reads through the chapter looking for the first specified verse in the Range. All of these "reference/milestone" values would be stored and ready to export with the specified verse text. This would include the \fig values too.

So I'm a bit puzzled by the need to add new milestones for just applications. (Granted a milestone might be needed for truncated books, where the user has not created a "normal" Bible book first. But should this be encouraged, because it seems creating something other than a normal Bible book as the source for output is probably a less than ideal strategy anyway.)

Maybe I'm missing something here.

markpenny commented 1 year ago

@davidc86 Sorry, that wasn't tested well enough (or at all as an .exe) - this will have to wait until DG or MH get back to work out why the TeamCity built .exe is failing. Presumably @mhosken , we have to adjust the .spec file to handle the new layout which BdV changed recently.

Meanwhile, I have removed 2.3.37 (and 2.3.35) from the downloads option.

Please return to version 2.3.36 and wait until you hear from us again that it is working.

markpenny commented 1 year ago

@davidc86 I discovered that if you completely uninstall PTXprint first, and then re-install 2.3.37 it does actually work - so try that while we figure out how to make the installer smarter than it currently is.

davidg-sil commented 1 year ago

So I'm a bit puzzled by the need to add new milestones for just applications.

The situation that the milestone is supposed to solve is: a) there are entries in the adjust list or figures in a piclist, or there are other trigger-file things, like an external list of cross-references b) AND a subsection is being printed where the user has avoided including the chapter number.

The point of the milestone is to supply the chapter number to TeX (or other automatic processing system) so that the items listed in (a) can work correctly. Probably ONLY the chapter number is actually needed, but I've made it a bit more general, in case there's some use-case that a user might want to 'manually' inform TeX about the position, and to do so without displaying a chapter number (etc), or indeed anything else.

Storing of section titles, etc. is something that should happen, and it not happening at verse 1 is certainly a bug. But THIS issue (figs not getting pulled in) is a symptom of TeX not knowing where it is if there's no chapter number, and the milestone fixes.

davidg-sil commented 1 year ago

I wholeheartedly agree, by the way, that a portion from Gen 11:27-25:11 would naturally start with the \h \mt1 etc from the start of the book, and \c 11 from the start of the chapter, but whether it ought to include \ms and \mr from earlier if there's not one at verse 27 is a little less clear-cut to me.

davidc86 commented 1 year ago

I'm not sure about \ms or \mr but I'm referring to the references \sr (section range) and \r (cross-reference) often found underneath a section heading:

\c 2 \s Kelahiran Yesus \sr 2:1-7 \r (Mat. 1:18-25) \p \v 1 Pada waktu...

But wherever the specified RANGE begins, if the previous "metadata" USFMs like these, were picked up automatically, wouldn't you have the milestones already? (In CC we'd just store that information as we read through the file, and we'd clear it each time we hit a new \s marker (so old \sr and \r are cleared too, in case the new section doesn't specify them). Wouldn't this strategy eliminate the need to add milestones in the original Paratext scripture text? (I ask, because I don't have editing rights to add milestones. And the needed information is already in there anyway.)

davidc86 commented 1 year ago

Ha! Well I did what you said and reinstalled PTXprint and v2.3.37 works great! No need for me to add milestones. (So maybe those milestones are the same thing as what I was talking about, something you can generate?) And the pictures show up in the correct sections. And I don't have to specify "0" to get it to work from the beginning of a chapter either. Thank you!!