1

Recently there was a fix to the problem related to transparency issue on pstricks+ Mactex 2021, which is actually related to Ghostscript ver> 9.53. It modifies /usr/local/texlive/2021/texmf-dist/dvipdfmx using some line on dvipdfmx-unsafe.cfg

The fix as suggested by Herbert Schulz in: PStricks doesn't compile anymore since MacTeX 2021 upgrade on Mac M1

worked for me few weeks ago, and still works for latexTRmk.

But XeLatexTRmk engines (in TexShop) does not give the intended result.

I have the following simple code

%%%%%%%%%%%%%%%%% fix PSTricks' transparency setup %%%%%%%%%%%%%%%%%
\begin{filecontents}[overwrite,noheader]{pst-fixtransparency.pro}
  /.setfillconstantalpha.bak /.setfillconstantalpha load def
  /.setstrokeconstantalpha.bak /.setstrokeconstantalpha load def
  /.setalphaisshape.bak /.setalphaisshape load def
\end{filecontents}
\begin{filecontents}[overwrite,noheader]{pst-fixtransparency.sty}
  \AtBeginDvi{
  \special{header=pst-fixtransparency.pro}
  \special{!
    /.setfillconstantalpha /.setfillconstantalpha.bak load def
    /.setstrokeconstantalpha /.setstrokeconstantalpha.bak load def
    /.setalphaisshape /.setalphaisshape.bak load def
    /.setopacityalpha {
      dup .setfillconstantalpha .setstrokeconstantalpha} def
    /.setshapealpha {
      dup .setfillconstantalpha .setstrokeconstantalpha
      true .setalphaisshape} def
  }
}
\end{filecontents}
\RequirePackage{pst-fixtransparency}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{extarticle}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}
\usepackage{pst-solides3d,pst-3dplot}
\usepackage{mathspec}
\setmainfont{Times New Roman}
%\setmathsfont(Digits,Latin,Greek)
   % [Numbers={Lining,Proportional}]{Times New Roman}
\definecolor{ath}{RGB}{247,246,233}
\begin{document}
\pagecolor{ath}

We will plot the surface
$$
\mathbf{r}(u, v)=\langle(2+\sin v) \cos u,(2+\sin v) \sin u, u+\cos v\rangle
$$
\begin{center}
\psset{unit=0.5}
\begin{pspicture}*(-5,-4)(6,14)
        \psset{viewpoint=15 10 15, Decran=20}
        
        \defFunction[algebraic]{hega}(u,v){(2+sin(v))*cos(u)} {(2+sin(v))*sin(u)} {u+cos(v)}
        \psSolid[object=surfaceparametree , base=0  12.6 0 8, color1=Red!50,
        color2=Green!20, inouthue=(color1) (color2), function=hega, linewidth=0.3\pslinewidth, ngrid=40 0.3]
        \axesIIID[linewidth=0.5pt , arrowsize=5pt, arrowinset=0, labelsep=10pt](3,2,9)(6,5,13)
        \psPoint(1,3,6.3){I}
        \uput[r](I){$u$ konstan}

        \psline[linearc=4, linewidth=0.5pt]{->}(4,4)(3,5)(2.8,6.46)
        \psline[linearc=4, linewidth=0.5pt]{->}(4,4)(3,5)(2.28,5.4)

        \psPoint(0,0,8.8){L}
        \uput[l](L){$v$ konstan}

        \psline[linearc=0.4, linewidth=0.5pt]{->}(-2,7.1)(-2,4.6)
        \psline[linearc=0.4, linewidth=0.5pt]{->}(-2,7.1)(-1.2,4.2)
    \end{pspicture}
\end{center}
\end{document}

The screenshot of the result using XeLatexTRmk is

enter image description here

While the intended result using LaTexTRmk, commenting the XeLatex specific lines like mathspec etc; will give:

enter image description here

So I tried copy-paste my code to overleaf.com and using XeLatex there (the menu indicates that TexLive 2021 is in use), and the result is fine as above (of course, I also uploaded all the Times fonts).

Using TexMaker and XeLatex engine in TexShop would produce the same result as following:

enter image description here

While using TexMaker and opted to view the PS file (instead of PDF), will invoke generating pdf files on Preview.App and the result is inconsistence (at some point it achieved fine result, otherwise error filename.ps cannot be converted to pdf)

Using command-line

xelatex -output-driver="xdvipdfmx -i dvipdfmx-unsafe.cfg -q -E" -no-pdf filename.tex

also not working.

I have also checked that all my packages are up to date.

This problem appears on all documents using pstricks, the picture produced is sometimes correct, but it always changes the background to white (no transparency)

Picture produced using tikz is fine.

Is there any fix for this? I'm guessing this only effects OS X users.

Thank You.

2
  • 1
    Welcome to TeX.SE.
    – Mico
    Feb 22, 2022 at 6:07
  • It is not a good idea to use pst-solides3d and pst-3dplot. They are far different and can interact in a negative way ...
    – user187802
    Feb 22, 2022 at 11:13

1 Answer 1

1

It is easier to run it with lualatex, which, of course, needs some time for the calculation, but it doesn't use GhostScript and creates directly the pdf:

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{}
\documentclass{extarticle}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}
\usepackage{pst-solides3d,pst-3dplot}
\usepackage{unicode-math}
\setmainfont{Times New Roman}
\definecolor{ath}{RGB}{247,246,233}
\begin{document}
\pagecolor{ath}

We will plot the surface
\[
\mathbf{r}(u, v)=\langle(2+\sin v) \cos u,(2+\sin v) \sin u, u+\cos v\rangle
\]
\begin{center}
\psset{unit=0.5}
\begin{pspicture}*(-5,-4)(6,14)
        \psset{viewpoint=15 10 15, Decran=20}
        
        \defFunction[algebraic]{hega}(u,v){(2+sin(v))*cos(u)} {(2+sin(v))*sin(u)} {u+cos(v)}
        \psSolid[object=surfaceparametree , base=0  12.6 0 8, color1=Red!50,
        color2=Green!20, inouthue=(color1) (color2), function=hega, linewidth=0.3\pslinewidth, 
        ngrid=40 0.3]
        \axesIIID[linewidth=0.5pt , arrowsize=5pt, arrowinset=0, labelsep=10pt](3,2,9)(6,5,13)
        \psPoint(1,3,6.3){I}
        \uput[r](I){$u$ konstan}

        \psline[linearc=4, linewidth=0.5pt]{->}(4,4)(3,5)(2.8,6.46)
        \psline[linearc=4, linewidth=0.5pt]{->}(4,4)(3,5)(2.28,5.4)

        \psPoint(0,0,8.8){L}
        \uput[l](L){$v$ konstan}

        \psline[linearc=0.4, linewidth=0.5pt]{->}(-2,7.1)(-2,4.6)
        \psline[linearc=0.4, linewidth=0.5pt]{->}(-2,7.1)(-1.2,4.2)
    \end{pspicture}
\end{center}
\end{document}

enter image description here

1
  • well, this works! I think I'm going to migrate to lualatex for a while. Thanks
    – Ajat
    Feb 22, 2022 at 13:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .