sillsdev / ptx2pdf

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

Cut outs not working consistently #784

Open davidc86 opened 1 year ago

davidc86 commented 1 year ago

I set up a configuration with a cut-out picture and it looks great, and I save the PDF. Then the next day I tweak the front matter PDF and rebuilt the whole book, and boom the cut-out pictures is all messed up and I can't get it back.

Here is yesterdays PDF:

image

Here is todays PDF (without changing anything in any of the tabs):

image

Any clue as to: 1) Why it changed from one day to the next without me doing anything but rebuilding the PDF (I changed the attached Front Matter PDF is all I did, but that didn't change any settings in the configuration.) 2) How can I get it back. Now it ignores most of my setting tweaks for this picture. The original picture format above was set to 50% outside with a +3 line setting. That is the same setting of the second PDF, and in order to get it to even sit on the page I have to reduce it down to 25% but even then the line offset is being ignored.

NOTE: this is the same configuration as uploaded in #782

davidg-sil commented 1 year ago

I don't think the top image looks like the harp was set at 50% column width unless it had a lot of white 'padding' on its sides compared to the harp in the lower one.

A guess: the python code in PTXprint has or had the ability to alter the aspect ratio of images. I seem to remember this was once useful. It may be that you've turned the 'feature' off, or it might have been removed. In a historic project (I did say this was a guess!) there might be old versions of figures around with an altered aspect ratio, which it doesn't refresh to save on time. Changing some 'seemingly unrelated' picture setting might then refresh the picture. Or maybe you have high resolution and low resolution images with different aspect ratios.

In any case, you ought to be able to see if you have 'padded' images in your Figures directory (or elsewhere) with your favourite picture viewer. Figures padded to make them some invisible aspect ratio are a probably a bad thing unless you're using the old printdraft code. You ought to try to ensure that any 'duplicate' low resolution and high resolution images correspond well to one another (preferably without white space padding).

Alternative guess. There's a \SpaceBeside setting as a parameter for esb styling, x-spacebeside for figures or the \def\DefaultSpaceBeside{10pt} which puts a gap between figures and sidebars in cutouts and the main text. Maybe you accidentally changed/lost that?

davidc86 commented 1 year ago

There is no padding left or right. The "cut out" feature tends to be wonky (a technical term) in that the Details settings tab seems to always forget the "Horizontal Position" setting. Therefore, so long as nothing else on that tab is changed, the picture will remain consistently rendered, but if any other setting is changed, and the user doesn't notice that the tab has "forgotten" the Horizontal Position setting, then the picture is thrown out of place. It can take a few retries to get the picture back into place.

Added to that, the Number of Lines feature is not always effective in positioning the picture above or below the verse line. Usually reprinting the PDF a few times will finally get the picture to move properly, but this is very confusing to users. (Makes them think their settings are wrong, when actually they are correct.)

Finally, in one case I needed to move a cut out picture up 14 lines, but apparently ten lines is the limit for negative movement. Is there a reason it is limited to -10.0? Often quotations, poetry, prayers, songs, etc. will have short lines which wrap frequently when next to a cut out, so a single verse might have over 15 lines, so while 10 might seems a reasonable number in most cases, it can be inadequate for these kinds of verses.

davidg-sil commented 1 year ago

In general, it's much better to place the 'anchor' for the figure earlier, rather than use a negative number. TeX mostly deals with things as it reads them, it doesn't go backwards and redo what has already been laid out, and the image is put on the page by when the anchor is read (with an up/down offset). For poetry you can add a paragraph count after the most recent verse. e.g. 'PSA 119:1=3' would be anchored to the start of paragraph 3.

markpenny commented 1 year ago

@davidc86 and @davidg-sil Is it OK to finally close this issue? Or is the conversation ongoing? I have added a "Documentation" label as there are some important bits of information in the posts above. I hope this can be harvested one day in the future.