2

Consider the code

\documentclass[a5paper,12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}
\usepackage{pstricks,psvectorian}
\usepackage{color}
\usepackage{scalefnt}

% % % Compiled with Xelatex

\begin{document} \thispagestyle{empty}

\begin{pspicture}(-5,-5)(5,12)% \renewcommand*{\psvectorianDefaultColor}{blue}%

\psframefillcolor=blue,fillstyle=solid(5,12) %Used with colored frame \psframelinecolor=blue(5,12)% draws frame in black. %top and bottom center

\large

\rput(0,3){\textbf{\scalebox{0.92}{\textcolor{white}{HOW TO MAKE THE STARS GLOW?}}}}

\rput(0,9.25){\color{white}{\huge{\textbf{}}}} \rput(0.03,9.25){\color{white}{\huge{\textbf{}}}} \rput(-2.25,5.75){\color{white}{\huge{\textbf{}}}} \rput(-2.25,5.75){\color{white}{\huge{\textbf{}}}} \rput(3.25,7){\color{white}{\huge{\textbf{}}}} \rput(3.25,7){\color{white}{\huge{\textbf{}}}} \end{pspicture}% \end{document}

which produces

enter image description here

I have used doubly-imprinted asterisks to produce the stars. (Might there be a better way?)

QUESTION: How may I produce a ``glow'' effect around the stars?

Thank you.

DDS
  • 8,816
  • 4
  • 9
  • 36

1 Answers1

6

Here is an idea using tikz and fadings. The command \glowstar[<size>]{x,y} called inside a tikzpicture will make a glowing star at the given coordinates.

enter image description here

\documentclass{article}

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

\newcommand{\glowstar}[2][.5]{\fillwhite,path fading=dim fadecircle[radius=#1*.4]; \foreach \t in {0,60,120}{ \fillrotate around={\t:(#2)}, white,path fading=bright fade--cycle; \fillrotate around={\t:(#2)}, white,path fading=bright fade--cycle;} \fill[white] (#2)circle[radius=#1*.075]; }

\begin{document}

\begin{tikzpicture} \fill[blue] rectangle (4,2); \glowstar[.5]{2,1} \glowstar[.2]{1,1.5} \glowstar[.3]{3,.5} \end{tikzpicture}

\end{document}

Sandy G
  • 42,558
  • Thank you. This is quite nice! – DDS May 11 '22 at 21:28
  • Is there a way to generate these stars when compiling with xelatex? When I incorporate your code in conjunction with my pspicture code, and compile it with xelatex (as I must do) in the actual document---the "glow" disappears. Thanks again. – DDS May 12 '22 at 13:45
  • @mlchristians: I'm not an expert with pstricks, so I don't know if it supports some version of fadings, but you can use TikZ with XeLaTeX. Can you switch the rest of the diagram to TikZ? – Sandy G May 12 '22 at 21:16
  • Thank you for your response. Unfortunately, I must compile the document in question with xelatex. – DDS May 13 '22 at 19:40
  • @mlchristians: It's no problem using TikZ with XeLaTeX. Is there a reason you can't use TikZ for your star diagram? – Sandy G May 13 '22 at 19:44
  • Yes, because it does not produce the glowing effect that results when I compile your code with lualatex. I expect that the same glowing effect would result with pdflatex as well. If you compile your code with Xelatex, are you able to produce the same output you posted? If so, then the problem would most definitely be on my end, I would say. – DDS May 13 '22 at 20:17
  • Yes. XeLaTeX and LuaLaTeX both produce the correct output. Are you using an old installation of PGF? See this question. – Sandy G May 13 '22 at 20:35
  • Many thanks for taking the time to check and for providing the helpful link. Now I know the problem is on my end. – DDS May 13 '22 at 21:13
  • This isn't my area of expertise. If you can't figure it out you should post another question. There are definitely experts on this site who can help. – Sandy G May 13 '22 at 21:15