sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.67k stars 98 forks source link

Full line width content in flushed/center envs shows extra vertical spaces #1757

Open Omikhleia opened 1 year ago

Omikhleia commented 1 year ago

SILE 0.14.8 (from the siletypesetter/sile:v0.14.8 docker image, to ensure my own build of current master wasn't causing the issue), but also reproduced with earlier versions (tested with siletypesetter/sile:v0.12.5)

Pretty minor issue, since there's a workaround anyway (see below), but I am not sure whether it's caused by some rounding issue or if there's something more tricky at play.

Scenario

The content in a "center", "raggedleft" or "raggedright" environment is exactly 100%lw. E.g. I observed it with a full-line table, but it would also be true with an image set at that width. In the MWE below I am just using rules to show the issue in a simple way.

\begin{document}
\neverindent
\nofolios
\use[module=packages.rules]
Justified 100\% content

\hrule[height=2pt, width=100%fw]\par
\hrule[height=2pt, width=100%fw]\par

Centered 100\% content = issue

\center{%
\hrule[height=2pt, width=100%fw]\par
\hrule[height=2pt, width=100%fw]\par
}

Centered 99.99999999999\% content

\center{%
\hrule[height=2pt, width=99.99999999999%fw]\par
\hrule[height=2pt, width=99.99999999999%fw]\par
}
\end{document}

image

Expected result

Observed result

A workaround is to set the width to a smaller value. I was drastic above with the 99.9999...., even a mere 99.9% is usually sufficient and remains hardly visible.

Omikhleia commented 1 year ago

And for the record, it turned out I had seen the issue already last month with an hrule too, though I implemented a quick workaround, late at night... and later forgot about it ;)

https://github.com/Omikhleia/resilient.sile/blob/ec36878d11903966708538212ea1a79f78bbad13/packages/resilient/epigraph/init.lua#L86-L89