我今天使用並了解了有關 pst-optexp 套件的更多資訊。到目前為止,我已經成功解決了使用它時遇到的所有問題。
但是最終的繪圖的一部分是我目前無法修復的,每次繪圖的另一部分要么消失,要么繪製不正確。我想使用電線或光纖將我的 APD \optDetector 與我的接收器 \optbox 連接。
我正在使用 Overleaf 和常規 LaTeX 編譯器,因為我注意到 XeLaTeX 和 LuaLaTeX 都無法使用這些套件。
我注意到的是,每次它都會開始給出錯誤:“第 xx-xx 行段落中的 overfull \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
。相同的座標在我看來是錯誤的...