2

I tried to draw a figure such that the laser beam is transmitted and reflected from a beam splitter. However, following the description on the internet, I ran into two problems, 1) The cubic beam splitter (labeled as a PBS) is rotated 2) The transmitted laser (from PBS to CCD2) doesn't show.

I'd very much appreciate if someone can help me. Thanks

Here's my code (I compiled it with XeLaTeX):

\documentclass[a4paper,landscape]{article}
\usepackage{pst-optexp}
\usepackage{pstricks}

\begin{document}
\begin{pspicture}[showgrid](20, 10)
  \pnodes(5.75, 5){GM}(7, 5){D1}(7, 8){D2}(11, 8){pbs3}
  \pnodes(11, 9.5){m1}(18, 9.5){CCD1}(19.5, 8){CCD2}
  \optbox[compname=GM, position=start, optboxsize=2.5 2.5, innerlabel](GM)(D1){GM}
  \beamsplitter[bsstyle=plate, compname=D1](GM)(D1)(D2){Dichroic}
  \beamsplitter[bsstyle=plate, compname=D2](D1)(D2)(pbs3){Dichroic}
  \beamsplitter[compname=pbs3](D2)(pbs3)(m1){PBS}
  \mirror[compname=m1, mirrorwidth=1.5](pbs3)(m1)(CCD1)
  \optbox[compname=CCD1, position=end, optboxwidth=0.5](m1)(CCD1){CCD1}
  \optbox[compname=CCD2, position=end, optboxwidth=0.5](pbs3)(CCD2){CCD2}


  \addtopsstyle{Beam}{fillstyle=solid, fillcolor=green, opacity=0.2}
  \drawwidebeam[beamwidth=0.5]{GM}{D1}{D2}{pbs3}{m1}{CCD1}
  \drawwidebeam[beamwidth=0.5]{GM}{D1}{D2}{pbs3}{CCD2}

\end{pspicture}
\end{document}

Here's the result enter image description here

Here's the list of packages I use

 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
pst-optexp.sty    2014/11/26 v5.2 Optical experimental setups with PSTricks
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
pstricks.sty    2018/01/06 v0.67 LaTeX wrapper for 'PSTricks' (RN,HV)
   iftex.sty    2013/04/04 v0.2 Provides if(tex) conditional for PDFTeX, XeTeX,
 and LuaTeX
shellesc.sty    2016/06/07 v0.02a unified shell escape interface for LaTeX
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
   xetex.def    2017/06/24 v5.0h Graphics/color driver for xetex
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
 xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
pstricks.tex    2018/01/06 v2.82 'PSTricks' (tvz,hv)
  pst-fp.tex    2018/01/06 v2.82 'PST-fp' (hv)
pst-xkey.sty    2005/11/25 v1.6 package wrapper for pst-xkey.tex (HA)
pst-node.sty    2010/04/22 package wrapper for pst-node.tex
pst-node.tex    2017/12/30 1.41 `pst-node' (tvz,hv)
pst-plot.sty    2011/04/13 package wrapper for pst-plot.tex (hv)
 multido.sty    2004/05/17 package wrapper for PSTricks `multido.tex', (HV/RN)
 multido.tex    2010/05/14 v1.42 'multido' (tvz,hv)
pst-plot.tex    2018/03/28 1.90 'pst-plot' (tvz,hv)
pst-eucl.sty    2014/05/17 package wrapper for PSTricks pst-eucl.tex
pst-tools.sty    2012/01/01 package wrapper for pst-tools.tex (hv)
pst-tools.tex    2018/03/28 v1.90 'PST-tools' (hv)
pst-eucl.tex    2017/04/18 v1.56 'PST-eucl' (dr,hv)
pst-intersect.sty    2014/03/16 v0.4 package wrapper for pst-intersect.tex
pst-func.sty    2017/08/17 package wrapper for pst-func.tex (hv)
pst-math.sty    2014/07/30 package wrapper for PSTricks pst-math.tex
pstricks-add.sty    2018/02/03 v. 0.15 package wrapper for pstricks-add.tex (hv
)
  pst-3d.sty    2009/07/28 package wrapper for pst-3d.tex (hv)
  pst-3d.tex    2017/04/18 v1.56 'PST-3d' (hv)
pstricks-add.tex    2017/04/18 v1.56 'PSTricks-add' (hv)
  xparse.sty    2018/02/21 L3 Experimental document command parser
   expl3.sty    2018/03/05 L3 programming layer (loader) 
expl3-code.tex    2018/03/05 L3 programming layer 
l3xdvipdfmx.def    
pst-func.tex    2018/04/08 v0.89 'PST-func' (hv)
pst-intersect.tex
 environ.sty    2014/05/04 v0.3 A new way to define environments
trimspaces.sty    2009/09/17 v1.1 Trim spaces around a token list
pst-optexp.pro
  • Welcome to TeX - LaTeX! When I compile your code I see neither of the two problems you mention. You should make sure you tex installation is up-to-date. – Andrew Swann May 15 '19 at 18:44
  • @AndrewSwann Thanks for the response. I did try to run it on Overleaf and the same thing occurs (I assume Overleaf is up-to-date?). I didn't see anyone complaining about this previously, is it still possible that my tex is out of date? My Tex was installed in early 2018. – Allen Chiu May 15 '19 at 18:50
  • Which installation you get when you run on overleaf depends on a number of factors. I tested your code with a texlive 2019 installation, this was released a couple of weeks ago. You can add \listfiles to the top of your document and the log file will then show the version numbers/dates of your packages in the .log file. You can paste that output into your question. – Andrew Swann May 15 '19 at 18:59
  • @AndrewSwann Here's the list. I'm also downloading a updated version of MacTex at the same time. – Allen Chiu May 15 '19 at 19:06
5

pst-optexp cannot be run with xelatex. Run it with latex->dvips->ps2pdf -dNOSAFER (the latest GhostScript version doesn't support transparency without the NoSafer option):

\documentclass[a4paper,landscape]{article}
\usepackage{pstricks}
\usepackage{pst-optexp}    
\begin{document}

\begin{pspicture}[showgrid](3,3)(20, 10)
    \pnodes(5.75, 5){GM}(7, 5){D1}(7, 8){D2}(11, 8){pbs3}
    \pnodes(11, 9.5){m1}(18, 9.5){CCD1}(19.5, 8){CCD2}
    \optbox[compname=GM, position=start, optboxsize=2.5 2.5, innerlabel](GM)(D1){GM}
    \beamsplitter[bsstyle=plate, compname=D1](GM)(D1)(D2){Dichroic}
    \beamsplitter[bsstyle=plate, compname=D2](D1)(D2)(pbs3){Dichroic}
    \beamsplitter[compname=pbs3](D2)(pbs3)(m1){PBS}
    \mirror[compname=m1, mirrorwidth=1.5](pbs3)(m1)(CCD1)
    \optbox[compname=CCD1, position=end, optboxwidth=0.5](m1)(CCD1){CCD1}
    \optbox[compname=CCD2, position=end, optboxwidth=0.5](pbs3)(CCD2){CCD2}

    \addtopsstyle{Beam}{fillstyle=solid, fillcolor=green, opacity=0.2}
    \drawwidebeam[beamwidth=0.5]{GM}{D1}{D2}{pbs3}{m1}{CCD1}
    \drawwidebeam[beamwidth=0.5]{GM}{D1}{D2}{pbs3}{CCD2}    
\end{pspicture}
\end{document}

enter image description here

or run it with pdflatex --shell-escape <file> with using

 \usepackage[pspdf={-dAutoRotatePages=/None -dNOSAFER}]{auto-pst-pdf}  
  • This works. Thanks! – Allen Chiu May 15 '19 at 19:21

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.