1

I am trying to place an image (in this case, a red square) at the center of a radial glow (generated as a tikzpicture) all within a pspicture environment.

Consider the code

\documentclass{book}
\usepackage{pstricks}

% Code can be compiled with Pdflatex or Xelatex
\usepackage{tikz} 
\usetikzlibrary{fadings}
\definecolor{darkamber}{RGB}{213,54,0}
\definecolor{sunriseyellow}{RGB}{255,219,0}
\definecolor{topaz}{RGB}{255,200,124}

\begin{document}
\thispagestyle{empty}

\tikzfading[name=fade out, inner color=transparent!0,
outer color=transparent!100]
\tikzset{
  star/.style={darkamber, fill=white, path fading=fade out}
}

\begin{pspicture}[showgrid=true](0,0)(6,6)
%\begin{pspicture}(-1,-3)(10,11)
\psframe*[linecolor=darkamber](0,0)(6,6)
\begin{tikzpicture}
  \draw[darkamber, shading=mradial, inner color=topaz, 
  middle color=darkamber!60!sunriseyellow, outer color=darkamber]
 (0, 0) rectangle (6, 6);
\clip (0, 0) rectangle (6, 6);
\end{tikzpicture}
\rput(3,3){\pspolygon*[linecolor=red](2,2)(4,2)(4,4)(2,4)}
\end{pspicture}
\end{document}

which produces

enter image description here

I do not know why the red square appears outside the specified dimensions of the pspicture, as I have place the \rput command prior to ending the pspicture.

Perhaps my approach to centering the red square at the point (3,3) within the pspicture is incorrect.

I would appreciate it if someone would suggest how to center the red square within the radial glow in the pspicture. Thank you.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.