Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve pt/px ratio accuracy #2466

Open
xworld21 opened this issue Dec 31, 2024 · 0 comments
Open

improve pt/px ratio accuracy #2466

xworld21 opened this issue Dec 31, 2024 · 0 comments

Comments

@xworld21
Copy link
Contributor

The current internal DPI for LaTeXML is 100, but that seems arbitrary. I suggest to change it to 96 like CSS, or even better to 96.36, because:

  • the CSS dots-per-inch is always 96, where in fact dot = 1px
  • in CSS, 72pt = 1inch (= 96px)
  • in TeX, 72.27pt = 1inch, and LaTeXML pretends that CSS points are actually TeX points

Thus, to make pixels and points match their TeX meaning even when exported to HTML, the internal dpi value should be 72.27*96/72 = 96.36.

Using the correct DPI value will improve the accuracy of alignment in TikZ and of image sizing, mostly.

At the end of the day, the glitches I see come from LaTeXML using both pxValue and ptValue in the output. I am not sure if there is a general rule for choosing between the two, or if it just happened organically. Everything would work naturally if all logical sizes were consistently exported as (TeX) points, with postprocessing taking care of translating to pixel when required (e.g. for images width/height attributes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants