[pdftex] 1px is not 1bp which seems to contradict the pdftex manual

jfbu jfbu at free.fr
Tue Mar 28 00:00:25 CEST 2023


Thanks for inquiry.

About:

> 
> I welcome counterexamples, but I see no practical use for it. And there
> don't seem to be any real-world documents in the TeX universe using it.  -k
> 

The Python Sphinx documentation generator (https://www.sphinx-doc.org <https://www.sphinx-doc.org/>)
uses it. Most users target HTML/CSS hence often use "px" unit for
image inclusion.  From the sources of the user projects, Sphinx
produces output in HTML/CSS
or also other formats including PDF via LaTeX.  Hence availability of px unit
in pdfTeX and luaTeX allows to interpret the user input directly.

Arbitrarily \pdfpxdimen=0.75bp is issued by default to obtain circa 96px to 1in.

As Sphinx user may use also xelatex or platex, Sphinx LaTeX writer
actually does not use "px"
in output markup but a custom \dimen register.  On pdfTeX it is let to \pdfpxdimen
on luaTeX it is let to \pxdimen on other engines it is allocated as new \dimen.

Then user input "xyz.abcd px" becomes "xyz.abcd \sphinxpxdimen" in LaTeX mark-up.

On pdfTeX/LuaTeX, this is totally equivalent to using "px" unit, 
due to the Knuth rules for parsing dimensional inputs.
(and the way the engines themselves interpret "px" as being
associated with an N/65536 ratio factor)

So, if the feature was to be dropped from engines, Sphinx would be robust
against such change (it uses \ifdefined to check, not an engine check).

Sorry for verbose, but I felt I had to explain that real-world documents
do use it... but it is "expendable" indeed.

Best,

Jean-François


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/pdftex/attachments/20230328/5c0e776a/attachment.html>


More information about the pdftex mailing list.