Forum Feature requests

Selector for floated elements

frederik
Hi everyone,

I’m encountering a challenge with paragraph indentation in my PDF documents. Specifically, I have paragraphs that should be indented only if they do not follow a block element (like a figure).

When a figure is floated to the top of the page, the indent is incorrectly applied to the paragraph following the figure because the figure + p selector still removes the indent. If I could somehow know that an element is floated, I'd be able to re-apply the indent. I am not sure whether this is a bug or actually a feature request.

I attached a simple reproduction.

Kindly
Frederik
  1. test.html1.6 kB
    HTML
  2. test.pdf29.3 kB
    PDF
mikeday
Are all figures floated, or only some? If there is a class or other attribute indicating which figures are floated, then the selector could check for that.
frederik
Thanks, Mike. That’s right. We do know which figures are floated (all or some). This would still leave the paragraphs that follow the floated figure indented, but at least it gets the indent back to the ones without a figure in front.

We also use float-modifier: unless-fit, so we do not always know in advance.

Ideally, I would like to know if an element follows a floated element (floated + p). I have also thought about a second pass, but, of course, would like to avoid that if possible.
mikeday
Right, a floated image might still precede its paragraph if it naturally falls at the top of a page, and using unless-fit introduces another case that is hard to tell. I think this does require a second pass.