ho-tex / pdftexcmds

pdftexcmds package for LaTeX
LaTeX Project Public License v1.3c
1 stars 0 forks source link

Error with \pdf@elapsedtime (LuaTeX) : math.floor or related is required #4

Closed FOCCOF closed 4 years ago

FOCCOF commented 4 years ago

Problem : \pdf@elapsedtime defined for LuaTeX (in pdftexcmds.lua) says at the end :+1:

tex.write(string.format("%d", val))

while it should probably say :+1:

tex.write(string.format("%d", math.floor(val)))

Because `val' is not an integer but a float, which has to be truncated before printing.

------- MINIMAL EXAMPLE FOR lualatex ----------------------------------- \documentclass {minimal} \usepackage {pdftexcmds}

\begin{document}\makeatletter

\showthe\pdf@elapsedtime

\end{document}

-------------- ERROR -------------------------------------------------------------------- \showthe\pdf@elapsedtime

\pdf@elapsedtime ->\numexpr \pdftexcmds@directlua {oberdiek.pdftexcmds.elapsedtime()}\relax {\directlua} C:/texmf/scripts/pdftexcmds/pdftexcmds.lua:291: bad argument #2 to 'format' (number has no integer representation) stack traceback: [C]: in function 'string.format' C:/texmf/scripts/pdftexcmds/pdftexcmds.lua:291: in field 'elapsedtime' [\directlua]:1: in main chunk. \pdf@elapsedtime ...diek.pdftexcmds.elapsedtime()} \relax

davidcarlisle commented 4 years ago

Thanks for the report, the test file was Ok as recently as texlive 2018. I assume this is Lua 5.3 introducing the integer type that has broken it, we'll fix.

u-fischer commented 4 years ago

@davidcarlisle I added the math.floor and will upload to ctan.

josephwright commented 4 years ago

Funny, we already had this in l3luatex!

u-fischer commented 4 years ago

fix has been sent to ctan.