如何使用 pst-optexp 包中的光纤/电线连接我的 \optdetector 和 \optbox?

如何使用 pst-optexp 包中的光纤/电线连接我的 \optdetector 和 \optbox?

我今天一直在研究 pst-optexp 包,并进一步了解它。到目前为止,我已经成功解决了使用它时遇到的所有问题。

最终的绘图的一部分目前我无法修复,每次绘图的另一部分要么消失,要么绘制不正确。我想使用电线或光纤将 APD \optdetector 与接收器 \optbox 连接起来。

我正在使用 Overleaf 和常规 LaTeX 编译器,因为我注意到 XeLaTeX 和 LuaLaTeX 都无法使用这些包。

我注意到的是,每次它开始给出错误时都会出现这样的信息:“段落第 xx-xx 行中的 \hbox 过满(xxxpt 太宽)”,其中这些是文档的最后几行。

如果有帮助的话,这是我的绘图: 当前设置

最后,我的代码:

\documentclass[11pt]{article}
\usepackage{pst-all}
\usepackage{pst-optexp}
\usepackage{xkeyval}
\usepackage{nicefrac}
\begin{document}

\psset{unit=1}
\begin{pspicture}[showgrid](13,9)
\pnode(6,2.5){BoxUp}

% Beam coordinates
\pnode(2,5){GreenEnd}
\pnode(6,1.5){GreenStart}
\pnode(GreenEnd){RedStart}
\pnode(11,2){RedEnd}

% Mirror coordinates
\pnodes(5,5){Ldc}(6,5){Mdc}(6,4){Bdc}
\pnodes(8,5){Lfm}(9,5){Mfm}(9,4){Bfm}
\pnodes(9,4){Um1}(9,2){Mm1}(10,2){Rm1}

% Lens coordinates
\pnodes(4,5){LPos}(2,5){LFoc}

%Laser Diode
\optbox[position=start, compname=box](3,-1)(3,-1){Laser Diode}

% Fiber
\optfiber[fiberloopradius=0.2,
linecolor=green,label=0.3,compname=ssmf](3,-1)(5,-1){SSMF}

% Draw laser box
\optbox[position=start, labeloffset=0, labelref=relative, compname=LO](GreenStart)(BoxUp){Laser}

% Draw ND filter
\optfilter[fiber=none,allowbeaminside=false,compname=nd,
labelref=relative,labeloffset=-1](6,2.5)(6,3.5){ND-Filter}

% Draw CMOS Camera
\optbox[position=end, labeloffset=0](RedEnd)(11,2){CMOS}

% Attempt 1 for receiver
\optbox[position=end, labeloffset=0,compname=apdrec](9.6,8)(9.6,8){Receiver}

% Draw semitransparent mirror
\mirror[mirrortype=semitrans,compname=dc](Ldc)(Mdc)(Bdc){DC}

% Draw the focusing objective
\lens[abspos=0,lensradius=2,lenswidth=1.5,
lensheight=0.75,compname=lens1](LPos)(LFoc){x40 Focusing objective}
\addtopsstyle{Beam}{opacity=0.1}

% Draw the green laser beam
\drawwidebeam[beamwidth=0.4,opacity=0.4,
fillstyle=solid,fillcolor=green](GreenStart){nd}{dc}{lens1}(GreenEnd)

% Draw the flip mirror
\mirror[labelangle=45,compname=fm](Lfm)(Mfm)(Bfm){Flip Mirror}

% Edge Filter
\optfilter[filtertype=bandstop,compname=ef,labelref=relative](9,4)(9,3){Edge Filter}

% Mirror to CMOS
\mirror[labelangle=45,compname=m1](Um1)(Mm1)(Rm1)

% Draw the red laser beam
\drawwidebeam[beamwidth=0.2,opacity=0.6,fillstyle=solid, fillcolor=red,linestyle=none](RedStart){dc}{fm}{ef}{m1}(RedEnd)

% Draw the NV-Centers
\crystal[crystalheight=2, crystalwidth=1,labelangle=0,labeloffset=-1.3](2,5)(1,5){NV-Centers}

% Connect ssmf and laser output
\drawfiber[linecolor=green,fiberstyle=angle,linearc=0.5]{ssmf}{LO}

% Draw ramp generator
\elecsynthesizer[synthshape=rectangle,synthsize=2 1,
synthtype=sawtooth,compname=rg,labelref=relative](6,8)(5,8){Ramp Generator}

% Draw MW-source
\optbarcomp[fiber,compname=mw](5,8)(3,8){MW-Generator}

% Connect Rampgenerator with MW-source
\drawfiber[linecolor=black]{rg}{mw}

% Connect MW-source with MW-antenna
\drawfiber[linecolor=black,fiberstyle=angle,linearc=0.5]{mw}(0.5,4,5)

% Extra node
\pnodes(10.8,5){ap}(11.2,5){apa}(12,5){apb}(12,8){apc}(11,8){apd}

% Draw APD-receiver connection (stubborn version)
%\drawfiber[linecolor=black]{apdrec}(apa)(apb)(apc)(apd)

% Draw APD
\optdetector[position=start,fiber,compname=apd,
labelangle=180](11.2,5)(11.2,5){APD}

%\optbox[position=end, labeloffset=0,compname=apdrec](9.6,8)(9.6,8){Receiver}

\drawwire{apd}(12,6.5){apdrec}

% Optional beam to APD
\drawwidebeam[beamwidth=0.2,opacity=0.6,fillstyle=vlines,
fillcolor=red,linestyle=none]{fm}{apd}

\end{pspicture}

\end{document}

答案1

运行您的示例以lualatex直接获取 pdf 输出我得到:

\DocumentMetadata{}
\documentclass[11pt]{article}
\usepackage{pst-optexp}
\usepackage{nicefrac}
\begin{document}
    
\begin{pspicture}[showgrid=false](0,-2)(13,9)
    \pnode(6,2.5){BoxUp}
    % Beam coordinates
    \pnode(2,5){GreenEnd}
    \pnode(6,1.5){GreenStart}
    \pnode(GreenEnd){RedStart}
    \pnode(11,2){RedEnd}
    % Mirror coordinates
    \pnodes(5,5){Ldc}(6,5){Mdc}(6,4){Bdc}
    \pnodes(8,5){Lfm}(9,5){Mfm}(9,4){Bfm}
    \pnodes(9,4){Um1}(9,2){Mm1}(10,2){Rm1}
    % Lens coordinates
    \pnodes(4,5){LPos}(2,5){LFoc}
    %Laser Diode
    \optbox[position=start, compname=box](3,-1)(3,-1){Laser Diode}
    % Fiber
    \optfiber[fiberloopradius=0.2,
    linecolor=green,label=0.3,compname=ssmf](3,-1)(5,-1){SSMF}
    % Draw laser box
    \optbox[position=start, labeloffset=0, labelref=relative, compname=LO](GreenStart)(BoxUp){Laser}
    
    % Draw ND filter
    \optfilter[fiber=none,allowbeaminside=false,compname=nd,
    labelref=relative,labeloffset=-1](6,2.5)(6,3.5){ND-Filter}
    % Draw CMOS Camera
    \optbox[position=end, labeloffset=0](RedEnd)(11,2){CMOS}
    % Attempt 1 for receiver
    \optbox[position=end, labeloffset=0,compname=apdrec](9.6,8)(9.6,8){Receiver}
    % Draw semitransparent mirror
    \mirror[mirrortype=semitrans,compname=dc](Ldc)(Mdc)(Bdc){DC}
    % Draw the focusing objective
    \lens[abspos=0,lensradius=2,lenswidth=1.5,
    lensheight=0.75,compname=lens1](LPos)(LFoc){x40 Focusing objective}
    \addtopsstyle{Beam}{opacity=0.1}
    % Draw the green laser beam
    \drawwidebeam[beamwidth=0.4,opacity=0.4,
    fillstyle=solid,fillcolor=green](GreenStart){nd}{dc}{lens1}(GreenEnd)
    % Draw the flip mirror
    \mirror[labelangle=45,compname=fm](Lfm)(Mfm)(Bfm){Flip Mirror}
    % Edge Filter
    \optfilter[filtertype=bandstop,compname=ef,labelref=relative](9,4)(9,3){Edge Filter}
    % Mirror to CMOS
    \mirror[labelangle=45,compname=m1](Um1)(Mm1)(Rm1)
    % Draw the red laser beam
    \drawwidebeam[beamwidth=0.2,opacity=0.6,fillstyle=solid, fillcolor=red, 
             linestyle=none](RedStart){dc}{fm}{ef}{m1}(RedEnd)
    % Draw the NV-Centers
    \crystal[crystalheight=2, crystalwidth=1,labelangle=0,labeloffset=-1.3](2,5)(1,5){NV-Centers}
    % Connect ssmf and laser output
    \drawfiber[linecolor=green,fiberstyle=angle,linearc=0.5]{ssmf}{LO}
    % Draw ramp generator
    \elecsynthesizer[synthshape=rectangle,synthsize=2 1, synthtype=sawtooth, 
            compname=rg,labelref=relative](6,8)(5,8){Ramp Generator}
    % Draw MW-source
    \optbarcomp[fiber,compname=mw](5,8)(3,8){MW-Generator}
    % Connect Rampgenerator with MW-source
    \drawfiber[linecolor=black]{rg}{mw}
    % Connect MW-source with MW-antenna
    \drawfiber[linecolor=black,fiberstyle=angle,linearc=0.5]{mw}(0.5,4,5)
    % Extra node
    \pnodes(10.8,5){ap}(11.2,5){apa}(12,5){apb}(12,8){apc}(11,8){apd}
    % Draw APD-receiver connection (stubborn version)
    %\drawfiber[linecolor=black]{apdrec}(apa)(apb)(apc)(apd)
    % Draw APD
    \optdetector[position=start,fiber,compname=apd,labelangle=180](11.2,5)(11.2,5){APD}
    %\optbox[position=end, labeloffset=0,compname=apdrec](9.6,8)(9.6,8){Receiver}
    \drawwire{apd}(12,6.5){apdrec}  
    % Optional beam to APD
    \drawwidebeam[beamwidth=0.2,opacity=0.6,fillstyle=vlines,fillcolor=red,linestyle=none]{fm}{apd}
\end{pspicture}
    
\end{document}

在此处输入图片描述

顺序latex->dvips->ps2pdf 有问题

错误:/undefinedresult in --atan--

这需要进一步调查\optdetector。相同的坐标对我来说看起来不对……

相关内容