josephwright / luatex85

This package provides emulation of pdfTeX primitives for LuaTeX v0.85+
3 stars 0 forks source link

luatex85 \pdfglyphtounicode with dvilualatex bug #4

Open lstonys opened 7 months ago

lstonys commented 7 months ago

\pdfglyphtounicode from \usepackage{luatex85} raises error with dvilualatex engine. This command used in newtxmath, newpxmath, and some other packages. If it can't work in DVI mode then could be defined as gobbled in luatex85.

MWE:

\documentclass{article}
\usepackage{luatex85}
%\usepackage[varvw]{newtxmath}
\makeatletter
\ifx\pdfglyphtounicode\@undefined \else 
\pdfgentounicode=1
\pdfglyphtounicode{nPerp}{2AEB 2215}% .. .. 
\fi
\makeatother
\begin{document}
foo
\end{document}

ERROR:

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.9 \pdfglyphtounicode
                    {nPerp}{2AEB 2215}% .. ..
? 
davidcarlisle commented 7 months ago

the command does not work in dvi mode so it is not clear that lautex85 should do anything here. Also can you clarify your newtxmath comment, I get no error from

\documentclass{article}
%\usepackage{luatex85}
\usepackage[varvw]{newtxmath}
\makeatletter
\ifx\pdfglyphtounicode\@undefined \else 
\pdfgentounicode=1
\pdfglyphtounicode{nPerp}{2AEB 2215}% .. .. 
\fi
\makeatother
\begin{document}
foo
\end{document}
josephwright commented 7 months ago

Also can you clarify your newtxmath comment, I get no error from

If you load luatex85 and run in DVI mode with LuaTeX then you get an error as \pdfglyphtounicode is defined.

davidcarlisle commented 7 months ago

yes so I see. I suppse pdfglyphtounicode could be defined to gobble if outputmode is not pdf at the point the package is loaded but it's not clear that is really the expected result

davidcarlisle commented 7 months ago

or perhaps better, just not define it in that case, so then newtxmath's existing guard would work

lstonys commented 7 months ago

it is not only in newtxmath. A few more packages in texlive uses these commands too. I would vote fore the gobbling in DVI mode :)

josephwright commented 7 months ago

A few more packages in texlive uses these commands too.

Well yes but really to work properly with LuaTeX they should be using the interfaces it provide, or (I suspect) bailing out as the font setup is inappropriate. My concern is that you are asking to support per-0.85 interfaces in LuaTeX for ever, rather than pushing the package authors to consider their engine coverage properly. luatex85 was only ever meant as a stop-gap around the release of LuaTeX v.0.85 several years ago.

davidcarlisle commented 7 months ago

@josephwright I agree that we should not support packages using luatex85 but newtxmath isn't really doing that: it has

\ifx\pdfglyphtounicode\@undefined
do nothing
\else
assume it works
\fi

It is not using this package to define the command, it's just that if the user loads this package it breaks. I am wary of defining it to gobble and silently doing the wrong thing, but if we didn't define it at all in cases where it doesn't work existing package guards as above would work.

Alternatively as @u-fischer suggested elsewhere possibly some lua could be inserted at the format level so that the command did work in dvi mode.

lstonys commented 7 months ago

problem is that it works in latex (have no idea what it does with it) and luatex so others will expect that it will "work" in dvilualatex as well.