sillsdev / ptx2pdf

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

v2.2.8 Front Matter missing images #640

Closed davidc86 closed 2 years ago

davidc86 commented 2 years ago

When I added FRT to the Multiple Books list, PTXprint told me to edit the FRT on the Peripherals page. So I go to the Peripherals page and check the Front Matter check box, I view the Front Matter and verify it looks correct. I click PRINT and everything comes out, except the Front Matter is missing the images.

The images are listed in the Picture tab: image

And PTXprint finds them all in the app, but when it is printed to PDF, I get this:

image

(It would also be nice if it were easy to suppress page numbers in FRT and INT stuff. And then automatically pick up page number on the First book's Intro page. Maybe it is easy, I'm just not seeing it yet.)

mnjames commented 2 years ago

As is often the case, I know how to get this to work but don't know if it is the "correct" way of doing things.

Unlike regular Paratext books, the FRT matter which you create inside of ptxPrint doesn't (?) pull figures directly from the PT figures folder. As a result, you have to put actual paths in your spec. For example, in the front matter add:

\fig |src="c://My Paratext 8 Projects/XXX/figures/Selaru kain Tanimbar cover.png" size="span*0.5" alt="desc" pgpos="h"\fig*

Be careful, because having spaces in paths can sometimes make the syntax more complicated. I don't know in ptxPrint if it's necessary to do things like put \ before the spaces or not. Personally I put the figures in the front matter in the /local/ptxprint/Config_Name folder, and then write something like

\fig |src="./Selaru kain Tanimbar cover.png" size="span*0.5" alt="desc" pgpos="h"\fig*

As for page numbers, you can turn page numbers on and off using \dopagenums and \nopagenums respectively, You can reset page numbers using \resetpagenums 1, or use any number you want. You can start using roman numbers by typing \resetpagenums -1, or using any negative number. I think adding \dopagenums at the end of your INT book inside of PT will make ptxprint work correctly (I've only ever tested those commands in FRT). Inside of PT it may show up as an invalid marker, but I don't think that will affect things externally.

davidc86 commented 2 years ago

Thank you for that helpful info. I'll give it a try.

But since we don't want normal users to need to know hacks and tricks to successfully the software, I think FRT should use the same picture location as every other book (just like it behaves in the Picture tab). So, this current "./tmpPics/" behavior should be considered a mistake/bug.

(Thanks for the tips on \resetpagenum and \dopagenums and \nopagenums flags! I'll give those a try too. I'm hoping someday the UI might provide pagenum options so we don't need to hack the PT files or remember these flags. But Rome wasn't built in a day, and PTXprint already does way beyond what we expected!)

mhosken commented 2 years ago

Sorry haven't had time to test this. But here is what we want the answer to be.

In your FRT file, insert a \zfiga|p001* you can use any id you want. Then in the picture editor add an entry FRT p001. Ptxprint should tie it all together for you.

On Tue, 22 Mar 2022, 21:28 davidc86, @.***> wrote:

Thank you for that helpful info. I'll give it a try.

But since we don't want normal users to need to know hacks and tricks to successfully the software, I think FRT should use the same picture location as every other book (just like it behaves in the Picture tab). So, this current "./tmpPics/" behavior should be considered a mistake/bug.

(Thanks for the tips on \resetpagenum and \dopagenums and \nopagenums flags! I'll give those a try too. I'm hoping someday the UI might provide pagenum options so we don't need to hack the PT files or remember these flags. But Rome wasn't built in a day, and PTXprint already does way beyond what we expected!)

— Reply to this email directly, view it on GitHub https://github.com/sillsdev/ptx2pdf/issues/640#issuecomment-1075252703, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLMO3PQT465YQRQAHN7YILVBHKI7ANCNFSM5RI2ACLA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

davidc86 commented 2 years ago

I just got v2.1.10 and this caused some of the pictures in the BAK matter to appear (a problem I noticed after I submitted this issue), but the FRT matter still looks the same as shown above.

So whatever was tweaked in v2.1.10 helped a little bit, but the fundamental issue is still happening.

davidc86 commented 2 years ago

"In your FRT file, insert a \zfiga|p001* you can use any id you want. Then in the picture editor add an entry FRT p001. Ptxprint should tie it all together for you."

Question: is this in the Real FRT book that is kept by Paratext, or is this the PTXprint copy of the FRT book it keeps for itself?

And can someone explain to me why we just don't leverage the \fig picture mechanisms that are already in PT and USFM for this? Why are we introducing an undefined SF marker like \zfilgalp*** for front-and-back matter?

Doesn't this just add complexity to the learning curve? Since it requires the end-user to learn a unique coding system just to use PTXprint.

mnjames commented 2 years ago

I had been assuming that you were referring to the FRT material that is built into ptxprint, and I suspect Martin did to. If you're actually working with the FRT book in Paratext, then I would say things are different. My code for directly pointing to files likely won't work inside of PT (which tends to overwrite figure formatting with what it thinks it the right syntax). I suspect that Martin's \zfiga code is also intended for the ptxprint version of FRT, though I'm not positive about that.

In general I believe (and fully support the idea) that ptxprint will always include background tweaks and hacks which aren't available to the regular user. I don't think it's the goal for every function to be built into the GUI.

Having said that, I agree that printing the figures that occur in any PT book is pretty basic, and ought to be supported. So if you're trying to use the PT version of FRT and it's not printing figures, then I think that's a bug.

davidg-sil commented 2 years ago

Your analysis seems quite likely to me. What's happening is that:

  1. PTXprint reads the book from Paratext, strips out the images, and remembers the files used.
  2. According to user preferences it finds low or high resolution images under the Figures directory, possibly trims bits off and makes a copy under local. My guess is that as "the version of FRT that you make in ptxtprint" comes from another source, it misses the above 2 steps.

Another (related?) bug is that if your original images are not under the Figures directory but somewhere else entirely, then there's a high chance that you get no figures at all.

davidc86 commented 2 years ago

Yes. All this seems like a bug to the end user. The FRT is a book in Paratext, and can have \fig fields that show up in Paratext and in SAB, etc. The illustrations are kept with all the other illustrations in the project (so it is not an issue of pictures kept in different places). When I click on View/Edit the Front Matter on the Peripherals tab, I get this:

\id FRT - Selaru \rem KONSEP DASAR – BOB 25 Sept 2014 \rem Beta tambah info kover, judul, dll. David 7/Juli/2016 \rem updated David April 22, 2018 \rem updated again, David, May 11, 2019 \rem updated David, Mar 3, 2021 \pc \fig |Selaru kain Tanimbar cover.png|col||||\fig \pb \periph Back of Cover \periph Title page \b \b \b \mt1 Kitab Lanke \mt2 ti Tel Maslyarkwe \b \b \mt1 Alkitab \mt2 dalam bahasa Selaru \b \b \b \ipc Edisi Percobaan \ipc 2022 \im \pb \periph Verso Page \imt Kitab Lanke ti tel Maslyarkwe \ipc \fig |YPMD Logo (web).png|col||YPMD||\fig \ipc © 2022 Yayasan Pemberdayaan Masyarakat Desa-KKT \ipc dan \ipc \fig |WBT Logo (Custom).png|col||Wycliffe||\fig** \ipc © 2022 Wycliffe Bible Translators, Inc. \ipc ISBN belum** \ipc Bagian-bagian dari Perjanjian Lama dan Baru dalam bahasa Selaru \ipc di Kabupaten Kepulauan Tanimbar, Maluku, Indonesia \ipc Portions of the Old and New Testament in the Selaru language \ipc of Tanimbar, Maluku, Indonesia \b \ipc Gambar-gambar oleh Horace Knowles pada ayat \xt Mrk. 2:23; 12:15\xt; \xt Luk. 1:10\xt; \xt 4:17\xt; \xt 6:1; 20:24; 2Tim. 4:13\xt © The British & Foreign Bible Society, 1954, 1967, 1972, 1995. \ipc Gambar-gambar oleh Louise Bass pada ayat \xt Kej. 9:20\xt; \xt Mrk. 2:22; 10:25; 12:1; 13:2\xt; \xt Luk. 3:17; 5:20; 15:6; 20:9; 21:5; Kis. 7:44; 9:25; 12:5; Ef. 6:12; Yak. 3:2; 3:12\xt; © The British & Foreign Bible Society, 1994 \ipc Gambar-gambar oleh Horace Knowles pada ayat \xt Kej. 4:21\xt* yang direvisi oleh Louise Bass, © The British & Foreign Bible Society, 1994 \ipc Semua gambar yang lain hak cipta pada © David C. Cook, dan dipakai dengan izin pemegang hak cipta. \b \ipc Illustrations in verses Mrk. 2:23; 12:15; Luke 1:10; 4:17; 6:1; 20:24; 2Tim. 4:13 are by Horace Knowles, © The Bible Society, London, England, 1954, 1967, 1972, 1995. \ipc Illustrations in verses Gen. 9:20; Mrk. 2:22; 10:25; 12:1; 13:2; Luke 3:17; 5:20; 15:6; 20:9; 21:5; Acts 7:44; 9:25; 12:5; Eph. 6:12; James 3:2; 3:12 are by Louise Bass, © The British & Foreign Bible Society, 1994. \ipc Illustrations in verse Gen. 4:21 are by Horace Knowles and revised by Louise Bass, © The British & Foreign Bible Society, 1994. \ipc All other illustrations are copyrighted by © David C. Cook, and used with permission. \b \ipc Buku ini ditulis dalam bahasa Selaru [slu]. \ipc Untuk informasi atas bahasa ini, mari menuju ke situs: http://www.ethnologue.com/language/slu dan http://www.bahasaSelaru.org \b \ipc Buku ini disponsori oleh: \ipc Yayasan Pemberdayaan Masyarakat Desa \ipc Jln Ki Hajar Dewantoro \ipc Saumlaki, Kabupaten Kepulauan Tanimbar, Maluku 97664 \b \ipc Edisi Percobaan \ipc 2022 \pb \toc1 Tun a Klolanare \toc2 Tun a Klolanare \toc3 Klolanare \periph Preface \is1 TUN A KLOLANARE \ip Kitab neke klyosu ma ity ohe tel Maslyarw neke kyeluk a tel mabuske ma tal ma ttanuk Kitab Lan manosy Hulasokwe ne. \ip Tel Maslyarw neke hnuke hean a kresi enaru (12), ma irire aryaritke anakyai ribunke hean a kresi (10.000+) neke ral ma ratunak. Iry manal tel Maslyarw neke ramin ti hnu o nus ti Tnebar ne. Neke ti propinsi Malukuke. \ip Lemade tel Maslyarw neke tal ma tlosu brit a manosy a sra ne. Kitab neke tal tel Maslyarkwe ma ttanuk ma iry mamin a hnu Maslyarw nekre rhe o Kitab Lan ne kralake ktyanuk kolkyabei. \ip Heitlulswoke Kitab Lan neke rkesy a khyehyeike desikeo ral tel Ibranike ktyabal tel Yunanike dakun. Tel nekre tel a krela kyalamo ral ma ratunak sew kyaki nekre. Kitab neke kbuanke aramy mkyesy ei tel Maslyarkwe ma adoko ribun sir a rhe kbuanke ti tel Maslyarw ne dakun. \ip Aramy mlyosu ohe, nam aramy mikesy toha Kitab Lan neke anakyai dum a lenla mlay dakun, ode kolnye tun a khatunare dum a lenla mlay, desikemo mlyosu, ma ana aramy misosan ma eras ma ktyoha kamlainare ei lulkwe. \ip Aramy midakinke ohe, kolnye iry a Maslyarure rbaca kitab neke kralake, desikemo kyala ralatare ma rdakin Hulasokwe Tunanare, ode rtohak tun itanukare ma kyor sir ei mormyorif eraske. \ipr Lui Tel Maslyarkwe \pb \is1 PRAKATA \ip Buku ini adalah terjemahan bagian Alkitab dalam bahasa Selaru. \ip Bahasa Selaru adalah salah satu bahasa daerah, yang digunakan oleh 10.000 orang lebih, yang berasal dari dua belas kampung di Pulau Selaru, dan pulau-pulau lain di Kepulauan Tanimbar, Propinsi Maluku, Indonesia. \ip Alkitab ditulis pertama-tama dalam bahasa Ibrani dan bahasa Yunani. Pada saat itu bahasa ini hari-hari dipakai. Makna dari Alkitab kami tulis dalam Bahasa Selaru sehari-hari supaya semua orang Selaru bisa mengerti maknanya. \ip Kami tahu bahwa apa yang kami tulis dalam buku ini, mungkin belum sempurna, dan kalau ada beberapa tata bahasa yang belum lengkap, dan ejaan yang masih salah, maka tolong sampaikan kepada kami agar kami bisa memperbaiki kembali, supaya sesuai dengan yang sebenarnya. \ip Kami senang kalau semua orang Selaru membaca isi buku ini, dan mereka bisa mengerti, supaya membuat hati mereka suka dan percaya akan Firman Tuhan, serta membawa mereka ke jalan yang benar. \ipr Tim Bahasa Selaru \pb \is1 PREFACE \ip This book is a translation of portions of the Bible in the Selaru language. \ip The Selaru language is a local language spoken by over 10,000 people living in twelve villages located on the island of Selaru and on surrounding islands in the Tanimbar Archipelago, in the Maluku Province, Indonesia. \ip The Bible was originally written in Hebrew and Greek. These languages were at the time the common language of the people. We have translated the meaning from the Bible into everyday Selaru, so all Selaru people can understand its meaning. \ip We know that what we’ve written in this book might not yet be completely accurate, so if there are any errors in grammar or spelling, please let us know, so we can correct them. \ip Our pleasure will be that all the Selaru speakers who read the contents of this book can understand it, and their hearts will enjoy and believe in the Word of God, so that it guides them into a life that is good. \ipr The Selaru Language Team \b \pb

I've highlighted (with BOLD) the few places where the logos and the cover picture are referenced. These were not changed by PTXprint when I hit View/Edit Front Matter, so I assumed they were in a format that worked for PTXprint.

(I agree that some advanced features should be reserved for "hacking", but printing Front Matter doesn't feel like a hacking sort of thing. Rather it is pretty important that everyone can do it successfully.)

davidc86 commented 2 years ago

I am also a bit puzzled: the FRT illustrations are no longer showing up in the Pictures tab. How are we supposed to edit and resize etc. illustrations in the Front Matter if the illustrations in the Front Matter are not made available on the Pictures tab? (These pictures used to show up here, but now FRT is deleted from the actual internal PTXprint "book list" even though it still shows up in the UI's book list.

The UI list: image

The Title bar list: image

mhosken commented 2 years ago

We're making progress on this. We'll let you know when we think it is fixed. Currently we have some of the UI aspects fixed, now it's a matter of the TeX side of things.

davidg-sil commented 2 years ago

The TeX side of things seems to be working fine. The issue seems to be PTXprint pruning the piclist so that the FRT images are not included. It also seems that not all PTXprint-edited FRT sections actually include \id FRT at the top.

Work-around

  1. Manually insert \id FRT at the top of the ptxprint-edited FRT section if it's missing. Don't forget to hit save.
  2. Check the name of the file the PTXprint generates from the FRT editor. It's probably something like local/ptxprint/configName/ptxprint-configName-GEN_REVPROJECT_FRT.tex (using unix-style directory separators) where PROJECT is the paratext project, configName is the name of the ptxprint configuration (e.g. Default) and GEN_REV is the range of books you are printing.
  3. Copy the relevant piclist entries from shared/PROJECT-configName.piclist to local/ptxprint/configName/tmpPicLists/ptxprint-configName-GEN_REVPROJECT_FRT.tex.piclist If you've got the pattern-matching tool grep available and a command-line, this can be done with:
    grep FRT shared/PROJECT-configName.piclist > local/ptxprint/configName/tmpPicLists/ptxprint-configName-GEN_REVPROJECT_FRT.tex.piclist

    (you may need to make the tmpPicLists directory first).

  4. hit print.
  5. Repeat step 2 after any piclist-editing.
  6. When PTXprint starts working properly, delete the above file to avoid duplicate images!
davidg-sil commented 2 years ago

Ooops. You probably need to replace shared/ with shared/ptxprint/ in the paths above.

davidg-sil commented 2 years ago

Ouch. The tmpPicLists directory is emptied when the configuration is selected.

An alternative option, which might be better, is to manually replace / edit the \fig lines in the FRT editor. USFM-3 style (keyword="value") picture options are preferred, but USFM-2 style ones still work. e.g.:

\pc \fig Wycliffe |src="../../../Figures/WBT Logo (Custom).png" size="col" pgpos="h" scale="1.0" mirror=""  \fig*

Note that I've added a path to the figures. That prevents the code from looking in the tmpPics directory, which PTXprint empties each time you hit print.

The pgpos="h" means here. I.e. above the current line. "hl" would mean here, left. Full documentation is here

markpenny commented 2 years ago

Okay, a few things have been fixed and will be working better in 2.1.13 which is just about to be released. a) The FRT templates (Basic and Advanced) both have an \id FRT line now at the top of the file b) The pictures mentioned in FRT do get picked up c) If you include a\zfiga|sometag\* line in the FRT matter, it will link to the picture in the PicList d) Note that in the PicList the Anchor Ref needs to have FRT sometag (in the example below it is FRT 001) in order for the "connection" to be made

Here are some screenshots to make it easier to understand: image

image

image

davidc86 commented 2 years ago

Hmm. Well, not for me it isn't fixed yet.

The development focus so far has been on the PTXprint's FRT copy of the FRT "book".

But what we were expecting is that a normal Paratext FRT book with \fig fields should work without using special fields and anchors. (We don't have to modify Matthew to get \fig to work there, so why do extra scripture books act differently?)

Another bit of confusion for us is the disappearance of the FRT option from the list of books for a configuration.

And also, the odd terminology "Local Front Matter":

image

There is no tooltip for this so, I just have to guess. I wondered if the two confusing issues were related, but I just checked, and they are not. (I thought that maybe UNchecking Local Front Matter would allow for FRT to be selected in the configuration book list. It doesn't.)

NOTE: I can manually add FRT into the list of books to include, and it is retained in the list, but is not included in the printout.

If I click on the Peripherals tab, "Local Front Matter" is still NOT checked (even though I manually included FRT in the book list). And if I check View + Edit tab, the "Front Matter" shows what appears to be my FRT file. But it isn't; It is a copy! I figured this out by selecting View/Edit and I noticed the file name was FRTlocal.sfm. (I suggest the file name be displayed somehow in the PTXprint window, maybe in the "Book in Focus" box: FRTLocal.)

So, this is confusing behavior: 1) I can't select the FRT book anymore, with no explanation from PTXprint as to why.

2) I can manually enter FRT as a book to include, but it is ignored. But it is also not deleted from the list! So, one is left to think it is okay to add, but something is broken.

3) No tooltip for "Local Front Matter" (so we aren't sure what this means: "local" to whom? to PTXprint? my computer? to Paratext?)

4) Turning ON Local Front Matter and hitting the Edit button, does not refresh the "FRTlocal.sfm" file from the original/actual FRT file in Paratext (which is a good thing for people who have already edited their FRTLocal copy). But this is confusing for people who have modified their original FRT file in Paratext and can't figure out why those changes are not reflected in the "Front Matter" content.

a) One would think the "Refresh" button would work, but it just throws away any edits made in the current PTXprint window and reloads the saved copy of FRTLocal.sfm -- it does not reload the actual FRT book.

b) The Generate button might do the trick, but now that FRT is not (easy) to get listed in the list of books to print, one is scared to even push this button, as it sounds like it will mess up all the other books in the configuration. This is spooky enough that I'm leaving it untouched.

5) After turning ON Local Front Matter and confirming it is basically the same as my FRT book, hitting print still does not include the pictures listed in \fig field.

6) Looking at the Pictures tab, I don't see the FRT pictures listed:

image

The ONLY WAY to see the FRT pictures is to turn off the "Only Show Active Books" option:

image

But this is somewhat inconvenient (as now it displays a huge list of pictures) and counterintuitive (since I've selected "Local Front Matter" to print, yet no pictures from the Front Matter file are listed if I only show "Active Books"). So, either we need for FRT or FRTLocal options to be available in the "book list", or we need the "Active Books" to include FRTLocal as an "Active Book", if show Local Front Matter is selected.

All that to say, I'm back to wondering what the reasoning is behind not being able to just print whatever is in the original FRT file, as is. I can see the advantage of providing a nice way to tweak that FRT file specifically for PTXprint's use, but I'm puzzled why FRT is disallowed altogether, and the \fig fields won't work.

Maybe the simple solution is for PTXprint to automatically substitute the needed hack fields (\zfiga!001) it needs for the \fig fields in any of the selected peripheral (non-scripture) files. So whenever we "View" these peripheral files, those needed hack substitute fields have already been done.

markpenny commented 2 years ago

We've obviously still got some things to fix, but when we made the decision NOT to support using Paratext's FRT directly (for a variety of good reasons that @mhosken may recall), we did put some help into the Multi-book chooser dialog:

image

We should probably strip FRT from the text box, or at least pop up a message if a user types it in explaining why it is treated differently from all the other books.

image

markpenny commented 2 years ago

Here's my first attempt at a tooltip: (what else needs to be said in there?)

image

davidc86 commented 2 years ago

Nice Tooltip! That would be very helpful.

davidc86 commented 2 years ago

Helpful answers. Thanks.

I admit it! I missed the small but helpful “Why is FRT not listed?” Guess you can only do so much Mark! The user has to actually use their eyes at some point. I wonder if a dead or discolored FRT button in its expected place would be helpful. Clicking on it would pop up that same explanation (and not select it). Just a thought. But also a hassle to implement.

BTW, PTXprint does strip out the FRT from the typed list after the user exits and reopens PTXprint. So it is a UI glitch. The configuration file process discards it.

Ah, so the Generate button is where to go. This is what I expected. The problem for me was the Tooltip said it changed all the files (like Pictlist files, etc.) and I didn't want to do that. But if the SCOPE of the Generate button is fixed to what is showing in the window at the time the user pushes the button, well then that is much safer. So if I'm looking at the Front Matter, then the Generate only does something with the Front Matter and nothing else. Same with the other tabs. If this is already true, then maybe the Tooltip could be reworded a bit to add this "scope" detail.

So, as it was, I didn't click it because I didn't want to mess up stuff I'd already got going well.

The comment on copying the FRT file is good and clear, but the mention of using \zvar|variables* does need a link or something, as no normal user will know what that is all about. (And apparently it has nothing to do with the "Variables and Values" box on the Peripherals pane. WAIT! It does! Wow, okay, I'd added a few \zvar|variables* into the FRTlocal file, but they didn't appear here, so I figured they were not related/connected. Maybe this list should populate with new variables whenever the user refreshes the Front Matter file? WOAH! the refresh button under Variables didn't do anything. But I have stuff like \zfiga|000* in the FRTLocal file. I would have thought that was included in the \zvar|variables* concept. So clearly I'm not tracking on this bit.)

The tooltip that pops up inside the Generate dialog that explains what will happen with the third option is very good! Thanks. Very clear.