sillsdev / ptx2pdf

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

PTXprint doesn't indicate in the text if it couldn't place Pictures #57

Closed davidc86 closed 4 years ago

davidc86 commented 4 years ago

In another "issue" I mentioned if two pictures are on the same verse, PTXprint won't place the second picture (and sometimes neither of them). But there are other times when placing pictures fails. I'm not quite sure why.

For example, in the BAK book, we have this: \c 1 \m \fig Nuske Ktem ne heitlulswo kyoat Yunus imorifke|alt="The world long ago when Jonah was living" src="Yunus PETA.tif" size="col"\fig \pc \xt Yun. 4:11\xt \m \fig Hulasokwe Seike|src="LB00250B.TIF" size="col"\fig \pc \xt Luk. 4:11\xt \m \fig Nus o hnu ti lasmyer Palestinake|alt="The cities and towns in the land of Palestina" src="Holy Land BW-Selaru.tif" size="col"\fig \pc \xt Kis. 8:40\xt \m \fig Saulus yor Barnabas wait laklakut mamunake ne|alt="Paul and Barnabas' journey 1" src="Paul1-BW_Selaru.tif" size="col"\fig \pc \xt Kis. 13–14\xt \m \fig Paulus wasi laklakut a kla-ruake ne|alt="Paul's journey 2" src="Paul2-BW_Selaru.tif" size="col"\fig \pc \xt Kis. 15–18\xt \m \fig Paulus wasi laklakut a kla-teluke ne|alt="Paul's journey 3" src="Paul3-BW_Selaru.tif" size="col"\fig \pc \xt Kis. 19–21\xt \m \fig Paulus wasi laklakutke bai nus lan Romake|alt="Paul's journey to Rome" src="Paul4-BW_Selaru.tif" size="col"\fig \pc \xt Kis. 27–28\xt \m \fig Nus o hnu a Paulus yor lianare rabrita Brit Eraske tiare|alt="Map of Italy to Middle East" src="Petal_Lokasi_Paulus_5T_BW_Selaru.tif" size="col"\fig \pc \xt 1Tes. 3:1-2\xt \b

From this file PTXprint won't generate any picture list from this. I've tried several tweaks to this (like deleting the \m marker and combining the fig into the following \pc field, thinking maybe there was no "content" on which to place the picture. But nope. That didn't work either. I even created my own PicList, and PTXprint either ignored it or just couldn't figure out where to put the picture, so it pitched it.

It would be helpful if PTXprint fails to place a picture, if it would mark the location with Failed to Insert Picture

I wonder if in the case of BAK, is it because there are no verses? -- If so, that limitation needs tweaking, because we need to be able to insert pictures in Non-Scripture books as well (Front matter, Back matter, glossary, etc.) All of these kinds of books need community checking too, so they should not be excluded from PTXprint's ability to properly format them.

mhosken commented 4 years ago

You are certainly pushing the edges of ptxprint. I don't think we really envisaged its use for a picture book, where you have more pictures than text.

I've added some code that may or may not flag problematic pages. It'll be in the next release.

Yes. A piclist isn't going to work without verses, although you can reference bk 1.0. But even then they are all bunched at the start of end of the verse (can't remember which) and not spread out with text in between. The ptx macros are not designed to handle more than one picture per verse. This seems a reasonable constraint.

davidc86 commented 4 years ago

So, I noticed that if I check the box “use the \fig field as is” rather than use the Pic List option, the maps show in the back of the book. But then we can’t tweak the picture placement so nicely as we can with the Pic List.

Too bad we can’t “use the Pic List” if there is one, and use the \fig as is if that book doesn’t have one.

David

PS Yes, the constraint will do, especially if it is documented, and if a work around is given, like use JAS 3:12 for the first one and JAS 3:13 for the second picture (and keep the reference text in the caption both pointing to 3:12). Or, we could create a single image file with the two pictures side-by-side, and link to that image. That’d be “cleaner”.

From: mhosken notifications@github.com Sent: Friday, 15 May, 2020 11:42 PM To: sillsdev/ptx2pdf ptx2pdf@noreply.github.com Cc: davidc86 dcoward@live.com; Author author@noreply.github.com Subject: Re: [sillsdev/ptx2pdf] PTXprint doesn't indicate in the text if it couldn't place Pictures (#57)

You are certainly pushing the edges of ptxprint. I don't think we really envisaged its use for a picture book, where you have more pictures than text.

I've added some code that may or may not flag problematic pages. It'll be in the next release.

Yes. A piclist isn't going to work without verses, although you can reference bk 1.0. But even then they are all bunched at the start of end of the verse (can't remember which) and not spread out with text in between. The ptx macros are not designed to handle more than one picture per verse. This seems a reasonable constraint.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsillsdev%2Fptx2pdf%2Fissues%2F57%23issuecomment-629582491&data=02%7C01%7C%7Cb9eba79182524839733208d7f94b0753%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637251972940625734&sdata=%2BxXZYaYgvnI7Z%2F4rskGElM6F0FX1bNwjWm5227NkwBk%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPSV2BWDBXS5V35Q5V3E5ZLRRYDOZANCNFSM4NBWGFQA&data=02%7C01%7C%7Cb9eba79182524839733208d7f94b0753%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637251972940625734&sdata=N5X%2BOgGFk99uLbG4dAE%2F4gt48TpwuegBHbPDV0w05FI%3D&reserved=0.

mhosken commented 4 years ago

There are two constraints playing out here.

  1. The TeX macros can only associate one piclist line with one verse and if there is more than one, then the rest of the piclist file will be ignored because the piclist is now out of sync with the ptx macros processing of verses and chapters.
  2. TeX can't handle more than one insert (which is what a picture is) on one line. It will silently drop all but either the first or last (I can't remember which off the top of my head). This is probably what is causing much of your problems. So even if you put one figure on Jhn 11:35 (Jesus wept) and another on Jhn 11:36, one of them could well be lost.

An additional comment on your example, the piclist file is only processed at the end of each verse. So no \v means no piclist processing.

markpenny commented 4 years ago

@davidc86 I'm picking up on your comment:

Too bad we can’t “use the Pic List” if there is one, and use the \fig as is if that book doesn’t have one.

I think we should be able to do that. We should be able to use the inline \fig ... \fig* for any books that don't have a PicList built and/or books that don't have Bk Ch.vs references. That seems to be a reasonable request and I think I know how to implement it.

markpenny commented 4 years ago

OK, we now allow all the inline \fig .... \fig markup to remain for the following books (even if PicLists are being used for the Biblical books): ['FRT', 'INT', 'GLO', 'TDX', 'NDX', 'CNC', 'OTH', 'BAK', 'XXA', 'XXB', 'XXC', 'XXD', 'XXE', 'XXF', 'XXG'] So the current way of working assumes that if you DON'T have a PicList (or if it is empty) for a Biblical book (GEN...REV) then you don't want any* illustrations to show up - even though there may be \figs marked in the text. If this is an acceptable option, we'll leave it as it is, otherwise we could change the UI to specify exclusivity (only PicLists, only inline, etc.) but I'm hoping that what we have now covers the bases adequately. Will be available in 0.6.3 later tonight.