我想更改 pst-optexp 中可用的过滤器的外观:
每个过滤器框中有三个波形。我希望带斜线的波形为红色,其他波形保持黑色。我该怎么做?
代码:
\documentclass[margin=0]{standalone}
\usepackage{pst-optexp}
\begin{document}
\begin{pspicture}(7,3)
\psset[optexp]{fiber=none,usefiberstyle}
\newpsstyle{Fiber}{linecolor=red,linewidth=2\pslinewidth}
\newpsstyle{Beam}{linestyle=none,fillstyle=solid,fillcolor=red,opacity=1}
\pnodes(2,2){Laser}(3,2){BS}(4,2){LP}(5,2){HP}(6,2){BP}
\optbox[optboxsize=2 1,innerlabel,position=start](Laser)(Laser){LASER}
\optfilter[filtertype=bandstop,filtersize=0.5,labeloffset=0.5,labelangle=-180](BS)(BS){BS}
\optfilter[filtertype=lowpass,filtersize=0.5,labeloffset=0.5,labelangle=-180](LP)(LP){LP}
\optfilter[filtertype=highpass,filtersize=0.5,labeloffset=0.5,labelangle=-180](HP)(HP){HP}
\optfilter[filtertype=bandpass,filtersize=0.5,labeloffset=0.5,labelangle=-180](BP)(BP){BP}
\drawwidebeam[beamwidth=0.1] {1-5}
\end{pspicture}
\end{document}
编辑:我尝试将 linecolor=red 添加到过滤器中,但整个框都变成红色。我只需要斜线波浪为红色。预期结果:
答案1
我添加了一行并修改了第二行。 两者都在下面的源代码中进行了标记。
\documentclass[margin=0]{standalone}
\usepackage{pst-optexp}
\begin{document}
\begin{pspicture}(7,3)
\psset[optexp]{fiber=none,usefiberstyle}
\newpsstyle{FilterStyle}{linecolor=red}% <<< Define FilterStyle
\newpsstyle{Fiber}{linecolor=black,linewidth=1\pslinewidth}% <<< Set linecolor to black
\newpsstyle{Beam}{linestyle=none,fillstyle=solid,fillcolor=red,opacity=1}
\pnodes(2,2){Laser}(3,2){BS}(4,2){LP}(5,2){HP}(6,2){BP}
\optbox[optboxsize=2 1,innerlabel,position=start](Laser)(Laser){LASER}
\optfilter[filtertype=bandstop,filtersize=0.5,labeloffset=0.5,labelangle=-180](BS)(BS){BS}
\optfilter[filtertype=lowpass,filtersize=0.5,labeloffset=0.5,labelangle=-180](LP)(LP){LP}
\optfilter[filtertype=highpass,filtersize=0.5,labeloffset=0.5,labelangle=-180](HP)(HP){HP}
\optfilter[filtertype=bandpass,filtersize=0.5,labeloffset=0.5,labelangle=-180](BP)(BP){BP}
\drawwidebeam[beamwidth=0.1] {1-5}
\end{pspicture}
\end{document}