Forum Bugs

Margin-alt yields inconsistent margins for spanned attachments in multi-column PDF


I'm looking for some advice on using margin-alt.

I am creating two-column PDFs which contain a variety of spanned (two-column) and unspanned (one-column) images. I have been using a float-placement of "snap" and a float-policy of "in-order."

Importantly, in order for this float policy to correctly order all images, I have found that all images need to use the same float-reference value. As such, all my images have a float-reference value of "column."

I have been exploring the use of margin-alt to remove unnecessary margins when images end up at the top or bottom of the page. While this has largely worked, I have run into some unexpected behavior when applying margin-alt to spanned images.

In short, it seems that because the images are floated with respect to only one column (due to the float-reference value), margin-alt is only applied to that column. This means that the other column will retain the extra margin, leading to an awkward and uneven appearance.

In the attached files, the image has been floated to the top of the left column but spans across the entire page. The top and bottom margins are originally 20pt, and the margin-alt value is 0. Thus, the top margin becomes 0, and the bottom margin remains 20pt. However, this is only strictly true for the left column. The right side of the image retains its 20pt top margin. Since it cannot appear above the image, the margin gets shifted to the bottom. The right side of the image then appears with an effective 20pt + 20pt = 40pt bottom margin instead of merely 20pt.

I am able to fix this issue by making the float-reference value for the image "page" instead of "column." However, as stated above, this is not an option for me. The float-reference value must remain "column" to ensure that all images are correctly ordered.

Is this a bug? Do you have any suggestions for achieving my desired behavior?
  1. margin-alt-issue.html4.1 kB
  2. margin-alt-issue.pdf147.8 kB
Thanks for testing this, and for reporting back. I believe you have exposed a shortcoming in our implementation. It seems that settings on 'margin-alt' only has effect on the left column. I attach a one-file test with an attempt to describe the desired rendering.
  1. margin-alt-issue.html4.3 kB
  2. margin-alt-issue.pdf31.7 kB

Edited by howcome

Hey, thank you for the quick response! I'll make sure to provide single-file tests in the future.

For this issue specifically, it sounds like I may be out of luck when it comes to using margin-alt?