zauguin / luapstricks

8 stars 0 forks source link

\pstVerb #26

Closed hvoss49 closed 3 years ago

hvoss49 commented 3 years ago

No color in the output and no error:

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{}
\documentclass[border=5mm]{standalone}
\usepackage{pstricks}
\newcount\WL \unitlength.75pt
\def\WaveToPS#1{%
  \definecolor{tmp}{wave}{#1}\extractcolorspec{tmp}\tmp
  \expandafter\convertcolorspec\tmp{rgb}\tmp \expandafter\WaveToPSi\tmp,}
\def\WaveToPSi#1,#2,#3,{\pstVerb{/Red {#1} def /Green {#2} def /Blue {#3} def}}
\pstVerb{/Corr {dup 0 gt {Gamma exp} if } def }
\definecolor[ps]{lambda}{rgb}{Red Corr Green Corr Blue Corr}
\begin{document}
\begin{picture}(510,70)(310,-10)\sffamily\tiny
  \linethickness{1.25\unitlength}\WL=360
  \pstVerb{/Gamma .8 def}\multiput(320,0)(1,0){456}{%
    \WaveToPS{\the\WL}{\color{lambda}\line(0,1){50}}\global\advance\WL1}%
  \linethickness{0.25\unitlength}\WL=360
  \multiput(320,0)(20,0){23}{%
    \picture(0,0)
      \line(0,-1){5}\multiput(5,0)(5,0){3}{\line(0,-1){2.5}}%
      \put(0,-10){\makebox(0,0){\the\WL}}\global\advance\WL20
    \endpicture}%
\end{picture}
\end{document}
Bildschirmfoto 2021-08-30 um 21 39 58

expected:

Bildschirmfoto 2021-08-30 um 21 36 47
zauguin commented 3 years ago

This is complicated, especially since the color is applied with \color, so it is never seen by the PostScript code but only handled inteernally by LaTeX (which in this case generates invalid PDF code). Any fix would involve patching the color backend, but since the classical color backends might relativly soon switch to a l3color based system and the handling of PS colors there isn't decided yet, it's not a good time to mess with that.

pablgonz commented 3 years ago

@zauguin This affects #25?

hvoss49 commented 3 years ago

rewritten in PS code