2

I was trying to plot an interferometer in latex using pst-optexp package. Everything works fine the beamsplitter is in the wrong orientation and need to be fliped 90 degree. However, the command\beamsplitter[bsstyle=plate, compname=BS,label = 0.8 -45](A)(BS)(PD){BS} does not work. Does anyone know how to rotate the beamsplitter in that package?

The code I used is

\documentclass[margin=36pt]{standalone}
\usepackage{pst-optexp}
\usepackage{amsmath}

\begin{document}

\begin{pspicture}[showgrid](6,6)
\pnodes(0,3){S}(1,3){LS}(2,3){A}(3,3){BS}(5,3){M1}(3,5){M2}(3,1){PD}
\optbox[abspos = 0.5, optboxsize=1 0.5, labeloffset = 0](S)(LS){Laser}
\lens[compname=L0, lensradius=0.5 0.5, lensheight = 0.5, abspos = 0.2, n=2,thicklens = false](LS)(A){obj}
\pinhole[compname = PH, labeloffset = -0.7](LS)(A){Pinhole}
\lens[compname=L1, abspos = 1, n=2, thicklens = false](LS)(A){Lens1}

\psset{mirrortype=extended, mirrordepth=0.2}
\beamsplitter[bsstyle=plate, compname=BS,label = 0.8 -45](A)(BS)(PD){BS}
\optbox[abspos = 1.75, optboxsize=0.5 0.5, label = 0.7 180](BS)(M1){Sample}
\mirror[compname=M1,labeloffset = 1](BS)(M1)(BS){Test Arm}
\mirror[compname=M2, mirrortype=piezo](BS)(M2)(BS){Ref Arm}
\lens[compname=L2, label = 1 180](BS)(PD){Lens2}
\optdetector[compname=Det, dettype=round, label = 0.5 90,abspos = 2.5](BS)(PD){Camera}
\addtopsstyle{Beam}{beamwidth=0.2, fillstyle=solid, linecolor = red, fillcolor=red, opacity = 0.2}
\drawwidebeam(LS){L0}{L1}{BS}{M1}{BS}{M2}{BS}{L2}{Det}
\end{pspicture}
\end{document}

The resulting picture is the orientation of beam splitter is wrong. The example given in pst-optexp manual is wrong in the same way.

  • After fixing beamsplitter orientation problem, how to draw raypath for two branches. I used \drawwidebeam(LS){L0}{L1}{BS}{M1}{BS}{L2}{Det} \drawwidebeam(LS){L0}{L1}{BS}{M2}{BS}{L2}{Det} and it only draws one branch. @Christoph – polkolp May 3 '18 at 14:50
1

The three nodes of a \beamsplitter are the source, center of the beamsplitter and the target of the reflected beam. The reflective interface is rotated accordingly.

So if the beam should come from A, is reflected at BS and then goes to M2, your beamsplitter should be

\beamsplitter[bsstyle=plate, compname=BS](A)(BS)(M2){BS}

The full example, with the two \drawwidebeam calls is:

\documentclass[margin=36pt]{standalone}
\usepackage{pst-optexp}
\usepackage{amsmath}

\begin{document}

\begin{pspicture}(6,6)
\pnodes(0,3){S}(1,3){LS}(2,3){A}(3,3){BS}(5,3){M1}(3,5){M2}(3,1){PD}
\optbox[abspos = 0.5, optboxsize=1 0.5, labeloffset = 0](S)(LS){Laser}
\lens[compname=L0, lensradius=0.5 0.5, lensheight = 0.5, abspos = 0.2, n=2,thicklens = false](LS)(A){obj}
\pinhole[compname = PH, labeloffset = -0.7](LS)(A){Pinhole}
\lens[compname=L1, abspos = 1, n=2, thicklens = false](LS)(A){Lens1}

\psset{mirrortype=extended, mirrordepth=0.2}
\beamsplitter[bsstyle=plate, compname=BS,label = 0.8 -45](A)(BS)(M2){BS}
\optbox[abspos = 1.75, optboxsize=0.5 0.5, label = 0.7 180](BS)(M1){Sample}
\mirror[compname=M1,labeloffset = 1](BS)(M1)(BS){Test Arm}
\mirror[compname=M2, mirrortype=piezo](BS)(M2)(BS){Ref Arm}
\lens[compname=L2, label = 1 180](BS)(PD){Lens2}
\optdetector[compname=Det, dettype=round, label = 0.5 90,abspos = 2.5](BS)(PD){Camera}
\addtopsstyle{Beam}{beamwidth=0.2, fillstyle=solid, linecolor = red, fillcolor=red, opacity = 0.2}

\drawwidebeam(LS){L0}{L1}{BS}{M1}{BS}{L2}{Det}
\drawwidebeam(LS){L0}{L1}{BS}{M2}{BS}{L2}{Det}
\end{pspicture}
\end{document}

enter image description here

  • Hi Christoph Thank you for the answer. One minor follow up question: after fixing beamsplitter orientation, I try to redraw the ray path using \drawwidebeam(LS){L0}{L1}{BS}{M1}{BS}{L2}{Det} \drawwidebeam(LS){L0}{L1}{BS}{M2}{BS}{L2}{Det} and it only draws one branch. Do you know why? – polkolp May 2 '18 at 20:39
  • Works fine for me. I updated the answer with the full modified example, including both \drawwidebeam calls that you want. – Christoph May 3 '18 at 19:00
  • @Christoph Doesn't work for me. I see only one branch running that code on Overleaf. – Rodrigo Oct 4 at 17:33
  • @Rodrigo I also couldn't get it to work properly on Overleaf: With LaTeX as compiler, it basically works, but without transparency, because -dNOSAFER is not passed during conversion (see also tex.stackexchange.com/a/491028/33933). And pdfLaTeX with auto-pst-pdf seems not to be supported at Overleaf, see also their statement at overleaf.com/learn/latex/… – Christoph Oct 5 at 9:54
  • @Christoph I guess I'll stick to tikz when using Overleaf. – Rodrigo Oct 7 at 0:39

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.