我尝试画一个图形,使激光束从分束器中透射和反射。但是,按照互联网上的描述,我遇到了两个问题,1) 立方体分束器(标记为 PBS)旋转了 2) 透射激光(从 PBS 到 CCD2)没有显示。
如果有人能帮助我,我将不胜感激。谢谢
这是我的代码(我用 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}
以下是我使用的软件包列表
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
答案1
pst-optexp
无法使用 运行xelatex
。使用 运行它latex->dvips->ps2pdf -dNOSAFER
(最新 GhostScript 版本在没有 NoSafer 选项的情况下不支持透明度):
\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}
pdflatex --shell-escape <file>
或者使用以下命令运行它
\usepackage[pspdf={-dAutoRotatePages=/None -dNOSAFER}]{auto-pst-pdf}