1

Consider the following example:

%%xelatex
\documentclass[pstricks,crop]{standalone}

\usepackage{pst-optic}
\usepackage{pstricks-add,pst-text}

\begin{document}


\begin{pspicture}(-8.5,-3)(8.5,3)
\rput(0,0){\lens[focus=3.333,OA=-10,AB=2,XO=2,xLeft=-8.5,xRight=8.5,rayColor=red]}
\end{pspicture}

\end{document}

Output

How can I change the arrow AB by an image like this: http://www.clipartden.com/_thumbspd/household/candle/candle_lit_blue.png and the arrow A'B' to a correspondingly scaled version of this image?

1

The image has no transparent colors. The reason why it may make sense to rewdraw the red lines.

\documentclass[pstricks,crop]{standalone}
\usepackage{pst-optic,pst-node,graphicx}

\begin{document}
\begin{pspicture}(-8.5,-3)(8.5,3)
\rput(0,0){%
  \lens[focus=3.333,OA=-10,AB=2,XO=2,xLeft=-8.5,xRight=8.5,rayColor=red]%
  \pcline[linestyle=none](A)(B)\ncput{\includegraphics[scale=0.2]{candle_lit_blue}}%
  \pcline[linestyle=none](A')(B')\ncput{\includegraphics[scale=0.1,angle=180]{candle_lit_blue}}}
\end{pspicture} 
\end{document}

enter image description here

  • Is there a way such that the image scales automatically if I change the parameters of \lens? – student Jul 11 '16 at 18:42
  • yes,that is possible, but not so easy. You can get the coordinates of A,B,A',B' with eg: \psGetNodeCenter{A} But that value is known on PS level but you need it on TeX level, the reason why you have to save it in a file. See also p. 30 of the pst-node documentation – user2478 Jul 11 '16 at 20:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.