sillsdev / ptx2pdf

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

Fig positioning: Negative value for Lines field doesn't work #645

Open KimB2017 opened 2 years ago

KimB2017 commented 2 years ago

The Number of Lines setting doesn't work very well with a negative number, especially if you want to intrude on a preceding paragraph. In the first screenshot below the \fig was attached to \ref GEN 22:15-19. The text has v 19 starting a new paragraph. The final word of v 19 is hidden behind the picture (filenames reflect Module specs). The archive I've attached reflects this Module and PTXprint configuration.

When I tweaked the \ref statements to \ref GEN 22:15-18 \fig....\fig* \ref GEN 22:19 the text is now all visible. But I would have liked to increase the picture size since it represents the story climax, and flow more lines of text down beside it, and force "Berseba" to its own line so the text block right edge follows the picture's edge better. Setting a negative #Lines figure does weird, unhelpful things. (Same behavior in ptxprint 2.1.12-Linux as in 2.1.13-Windows.)

Also, on p.3 of the PDF I wanted to raise the first pic to the top of the text (with a neg. value in #Lines but the pic jumps around, can't get it there. In general I'm having more success when I want to LOWER a pic's position on a page vs. RAISE it. I'm sure this is tricky under the hood!

Explanation--you might have a suggestion, perhaps? This module is designed to make quick formatting of the passage translated during an initial Translator Training Course, which might include 8-10 language teams. It needs to be done at the last minute after the teams have undergone a mock Consultant Check of their work. The texts do not all have the same paragraph markup, which makes it difficult when the positioning flakes out across paragraph boundaries. :) Anything we can do to simplify fitting the text to the pics would be helpful to the advisors/course staff responsible for printing the take-home books. So it would be ideal if no one had to tweak the Module \ref statements to make pics fit. However, I realize that this may be impossible....

Any thoughts? Thanks!

fig attached v19 fig attached to v18 TTCBks22-BookWPicsTPIPTXprintArchive_02April.zip

davidg-sil commented 2 years ago

Sorry, what you're seeing is (roughly speaking) fully expected behaviour. The picture is added to the output stream at the anchor point, and any text already set is thus 'fair game' for overwriting. The markdown documentation does make the point that negative spacing is for intruding into whitespace, though perhaps the tool tip does not. I guess I can understand how you can get away with negative cutout positioning if you are in the same paragraph but I was a bit surpprised learning that it works at all. At the moment we do not have anchoring to a page, and I am not very sure how to identify the paragrapgh that starts the page. (a necessary step for putting in the cutout).

To obtain the result that you want, I would suggest that you do something like this (hopoefully it works):

  1. you use a piclist, thus avoiding the need to alter the module definition..
  2. Assuming there is no verse number on the first line... Identify the second or third word on the first line (avoid the first, for stability)
  3. Using the changes.txt, put something like:
    At GEN 1:1 "(tumbuna pikinini)" > "\1 \\zfiga  pg3\\*

    to put a figure anchor into the USFM. I don't know if you'd need to use the module reference (e.g. XXA) or source book, sorry.

  4. Anchor the figure to "XXA pg3"(assuming your module is XXA)
mhosken commented 2 years ago

I would recommend for your workshop that positioning relative to the page rather than the paragraph will be much more reliable and is amply sufficient for a post workshop print. I.e. make pictures full width. Or go to 2 column layout. But keep it simple for reliability when under the workshop gun.

mhosken commented 2 years ago

There is always an XKCD cartoon for every occasion: https://xkcd.com/1425/

KimB2017 commented 2 years ago

Thanks for the suggestion, we have used Print to PDF in the past. Unfortunately, using full-width pics doubles the book lengths, and 2-column A5 presents more problems in a rushed setting because many of the languages here have loooong words.

The fig positioning actually works very well as long as we know the rules. Much better than the standard method at Ukarumpa Training Centre: a .doc with pictures attached to pages (which don't always stick as specified either), and notes on each page: "Paste Gen 1:1-3 here", etc. Not to mention that Paratext verse formatting doesn't transfer nicely so you have to either leave strange digits inline with the text or format each verse# in Word/LO, or paste each verse text individually between pre-placed verse numbers. You and I can do that formatting easily but the average "advisor" who is tasked with formatting the books has a hard time.

If "cutout" doesn't work for someone, at least with ptxprint we can decrease the image sizes to take up less space than the old PT method! And add title/credits, etc easily.

Thanks for your help, and the comic is great!

Kim Blewett Language Technology Consultant (LSS) SIL Papua New Guinea

On 4/6/22 2:51 PM, mhosken wrote:

I would recommend for your workshop that positioning relative to the page rather than the paragraph will be much more reliable and is amply sufficient for a post workshop print. I.e. make pictures full width. Or go to 2 column layout. But keep it simple for reliability when under the workshop gun.

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