Continuing on the stubborn path - I made the bounding box measurement and baseline adjust code work (based on mannot鈥檚 bounding boxes
).
The nice part with it is that single-line text and equations can be made to line up. It works in tables with either top or bottom alignment.
(The custom baseline refer to that the numerator and denominator are marked as being on the baseline respectively.)
The major challenge is to avoid the layout convergence warning - any solution trying to insert vertical space seems to fall to that problem, but this method, using box(baseline: ...) with a computed baseline adjustment, seems to work.
Source code: baselinefix 路 main 路 bluss / typst-recipes 路 GitLab
Example PDF: baselinefix/main.pdf 路 main 路 bluss / typst-recipes 路 GitLab
I wrote up some current open questions - would be great to know what can be done about them. But it is as of now a reusable implementation.
Areas we would like to improve or mysteries we would like to have answers to:
- We place a hidden copy of the equation just to measure it. How to avoid doing this?
- The
dyparameter of the placed hidden copy actually matters for layout convergence, which is puzzling. Keeping dy very large solves this problem. Why does this happen? - A fixed
biasvalue inemneeds to be passed - can this be avoided?- Set value based on maximum height in the row did not converge (using state).
- Using
horizonalignment avoids it
- Currently works with all alignments
Get horizon alignment to work.topalignment: positivebiasbottomalignment: negativebiashorizonalignment: zerobias
Changes
- 22 June: first post
- 23 June: Simplified how baseline is measured, which solves convergence problems for horizon alignment.
