zauguin / luapstricks

8 stars 0 forks source link

pdfmark problem #75

Closed hvoss49 closed 2 years ago

hvoss49 commented 2 years ago
[...]
mf-dist/tex/lualatex/luapstricks/luapstricks.lua:736: Unknown name "pdfmark"
stack traceback:
    [C]: in function 'error'
    ...live/texmf-dist/tex/lualatex/luapstricks/luapstricks.lua:3911: in function 
<...live/texmf-dist/tex/lualatex/luapstricks/luapstricks.lua:3891>
    [C]: in function 'vf.node'
    ...live/texmf-dist/tex/lualatex/luapstricks/luapstricks.lua:3884: in function 
<...live/texmf-dist/tex/lualatex/luapstricks/luapstricks.lua:3875>.
<argument> ...not:N \tex_shipout:D \box_use:N \l_shipout_box 
                                                  \__shipout_drop_firstpage_...

l.8 \end{document}

I suppose that we should check the existing of lualatex and using another command??

The important line in pst-geometrictools

[ /ca .25 /SetTransparency pdfmark % set transparency

the example:

\documentclass{article}
\usepackage{pstricks,pst-geometrictools}
\begin{document}

\begin{pspicture}(-4.0,-4)(14.7,4.5)
\psRuler{0}(10.96,4)(10.96,-3)
\end{pspicture}
\end{document}
zauguin commented 2 years ago

The odd thing is that pst-geometrictools already uses another command, it just adds pdfmark on top. E.g.

                             setrgbcolor
                             [ /ca .5 /SetTransparency  pdfmark %    set  transparency
                              0.5 .setopacityalpha sysfill

I'm wondering what that's supposed to be for. Maybe Distiller compatibility? Anyway I think just omitting the pdfmark block in LuaTeX should work.

hvoss49 commented 2 years ago

it works, but the output is different. Here is the complete example. COmpare xelatex (or ps2pdf) with lualatex:

\documentclass{article}
\usepackage[gfsneohellenic]{fontsetup}
\usepackage{xcolor,color}
\usepackage{pstricks,pst-geometrictools,pstricks-add,pst-node}
\definecolor{BrickRed}{rgb}{.702,0.1333,0.1333}
\definecolor{SeaGreen}{rgb}{.1804,.5451,.34117647}
\begin{document}

\begin{pspicture}(-4.0,-4)(14.7,4.5)
\psline[linewidth=1pt](-1,0)(5,0)
\psline[linewidth=0.6pt](4,-.2)(4,.2)\psline[linewidth=0.6pt](0,-.2)(0,.2)
\rput(3.7,.3){$A$}\rput(0.4,.3){$A'$}
\rput(2.6,-3.4){$M$}\rput(2.6,3.4){$N$}\rput(2.3,.3){$O$}\psdot[dotsize=3pt](2,0)
\pnode(4,0){A}\pnode(0,0){B}\pnode(2,-1.5){M}\pnode(2.61,3.76){N1}\pnode(1.41,3.76){N2}
\pscircle[linewidth=1pt](2,0){2}
\psarc[linewidth=1pt,linecolor=BrickRed](4,0){4}{110}{250}
\psscalebox{-1 1}{\psCompass[PoCScale=0.8]{2}(A)(N1)}
\psarc[linewidth=1pt,linecolor=blue](0,0){4}{-70}{70}
\psCompass[PoCScale=0.8,PoCFillCol=blue]{2}(B)(N2)
%
\psset{origin={9,0}}
\psline[linewidth=1pt](-1,0)(5,0)
\psline[linewidth=0.6pt](4,-.2)(4,.2)\psline[linewidth=0.6pt](0,-.2)(0,.2)
\rput(12.7,.3){$A$}\rput(9.4,.3){$A'$}
\rput(11.6,-3.4){$M$}\rput(11.6,3.4){$N$}\rput(11.3,.3){$O$}
\pnode(4,0){A}\pnode(0,0){B}\pnode(2,-1.5){M}\pnode(2.61,3.76){N1}\pnode(1.41,3.76){N2}
\pscircle[linewidth=1pt](2,0){2}
\psarc[linewidth=1pt,linecolor=BrickRed](4,0){4}{110}{250}
\psarc[linewidth=1pt,linecolor=blue](0,0){4}{-70}{70}
\psRuler{0}(10.96,4)(10.96,-3)
\psline[linewidth=1pt,linecolor=green](2,-4)(2,4)
\psPencil[pencilColA=green,PenLength=3]{-120}(11,4)
%
\end{pspicture}

\end{document}

It looks like a problem with the rotation, too

hvoss49 commented 2 years ago

It is another bug in \psCompass some non local variables. I'll investigate

hvoss49 commented 2 years ago

fixed, there were two gsave without grestore

Bildschirmfoto 2021-11-13 um 19 28 04

.

zauguin commented 2 years ago

Great! That gets me thinking though: While IMO gasave without grestore is a bug and should get fixed, it shouldn't be very hard to emulate save/restore behavior here and just invoke grestore as often as necessary at the end of normal specials. (Probably printing some warnings in the process) That might reduce similar compatibility issues a bit. Not sure if this could break anything (it shouldn't since restore does something similar too...).

hvoss49 commented 2 years ago

At least a warning message: "Unbalanced gsave/grestore found"

zauguin commented 2 years ago

The latest commit does something like that: It warns if gsave and grestore are unbalanced and tries to insert grestores as necessary if there were more gsaves. I thought about making the "excessive grestore" condition a error instead of a warning, but I'll wait first to see if this breaks anything.

hvoss49 commented 2 years ago

This works fine!