1

Consider the code:

\documentclass{book}
\textheight 8.5in \textwidth 5.75in 
\usepackage{xcolor}
%\usepackage{transparent}


\definecolor{darkpurple}{RGB}{48, 25, 52}

\usepackage{tikz}
\usetikzlibrary{fadings, calc}
\tikzfading[name=dim fade, inner color=transparent!40, outer color=transparent!100]
\tikzfading[name=bright fade, right color=transparent!100, left color=transparent!100, middle color=transparent!0]
\tikzfading[name=long bright fade, right color=transparent!100, left color=transparent!0]

\newcommand{\glowstar}[3][.5]{\fill[white,path fading=dim fade](#2)circle[radius=#1*.6];
    \foreach \t in {0,60,120}{
    \fill[rotate around={\t:(#2)}, white,path fading=bright fade]($(#2)-(.9*#1,0)$)--($(#2)-(0,.05*#1)$)--($(#2)+(.9*#1,0)$)--($(#2)+(0,.02*#1)$)--cycle;
    \fill[rotate around={\t:(#2)}, white,path fading=long bright fade]($(#2)-(.5*#1,0)$)--($(#2)-(0,.04*#1)$)--($(#2)+(.5*#1,0)$)--($(#2)+(0,.04*#1)$)--cycle;
    }
    \foreach \l [count=\n from 0] in {#3}{
        \fill[rotate around={\n*90:(#2)}, white,path fading=bright fade]($(#2)-(\l*#1,0)$)--($(#2)-(.4,.06*#1)$)--($(#2)+(.4,.06*#1)$)--cycle;
     }        
    \fill[white] (#2)circle[radius=#1*.13];
    }

\begin{document}
\thispagestyle{empty}
\begin{center}
\begin{tikzpicture}
\fill[darkpurple] rectangle (8,6);
\glowstar[1.8]{4,3}{1,1,1,1}% length of left,bottom,right,top
\end{tikzpicture}
\end{center}
\end{document}

which produces what I want:

enter image description here

However, I want to use this for a document which requires the transparent package and compiles with pdflatex.

But, when I run the above code with \usepackage{transparent}, the following is produced:

enter image description here

QUESTION: How may I produce the first output while invoking the transparent package and compiling with pdflatex?

Thank you.

8
  • I can not reproduce your problem. I get the first picture independent of wether the \usepackage{transparent} is commented or not. What version of LaTeX are you using? When did you last update your packages? Aug 29, 2022 at 22:53
  • I have purchased a recent version from TUG; however, I have run into problems with installing it. Though it seems to have installed properly, there are still recent packages that should be there and I cannot access them. For some reason, the computer always seems to revert to the older edition of Tex Live. I wish I could figure out what I am doing wrong. But thank you for your answer---it works fine on my end. Aug 30, 2022 at 0:46
  • I can not help. I am using MacTeX. There should be plenty information on google and this site on how to install and update TeX Live. Are you sure you have purchased a version of LaTeX(and not some malware) - I did not know it was possible. Maybe you mean, that you donated? Aug 30, 2022 at 1:03
  • @hpekristiansen I am sure. I contacted TUG directly and spoke to someone in Oregon, U.S. When the package arrived it was from TUG. If I may, let me ask you this---when you update MacTex, do you have to delete your old version, or are you able to install over the old one? And if so, how does your computer know which version to access? Many thanks. Aug 30, 2022 at 1:13
  • @hpekristiansen Maybe it was a donation, but I was quoted and charged a cost of either $10 or $20 (U.S.) Aug 30, 2022 at 1:15

1 Answer 1

2

My guess is that you are using an old version of transparent. You can see in the manual history section that the pgf(TikZ) compatibility was added in 2018:

[2018/11/18 v1.3] • Added code for pgf compatibility, see https://github.com/ho-tex/transparent/issues/1

The link gives this patch by u-fischer:

\documentclass{article}
\usepackage{tikz}
\usepackage{transparent}

\makeatletter
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pgfutil@addpdfresource@extgs\endcsname\relax
\else
  \AtBeginDocument{%
    % \pgf@sys@addpdfresource@extgs@plain{%
    \pgfutil@addpdfresource@extgs{%
      \TRP@list
    }%
  }%
  \let\TRP@addresource\relax
\fi
\makeatother

\begin{document}
Hello \texttransparent{.3}{World}
\begin{tikzpicture}
\filldraw[opacity=.5] (0,0) rectangle (1,1);
\end{tikzpicture}
\makeatletter
\end{document}

I have no way of testing this, and it should also not be needed. -upgrade and update your LaTeX installtion.

1
  • Thank you for providing this answer; it is most helpful. Aug 30, 2022 at 0:42

You must log in to answer this question.

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