PSTricks 选项之间的干扰

PSTricks 选项之间的干扰

我正在建造一栋建筑来解释非对称加密方案给我的学生。我用它pst-sigsys来设计框图,并pstricks-add画出关键部分:

结果

我在设计钥匙时遇到了问题,但我已经收到了答案(见我的问题)。

问题是,我现在有pst-sigsys 圆角选项以及键的实际绘制。

我想要的钥匙是多于框架(不像图片中那样)。但是,在代码中,如果我将它们放在框架后面(参见 MWE),该RoundCorners选项会修改密钥。M. Voß 已经提出了部分解决方案,但它并没有完全发挥作用,所以我发布了一个新问题。

以下是导致这种情况发生的 MWE:

\documentclass[pstricks, float]{standalone}
\usepackage[table, usenames, dvipsnames]{xcolor}
\usepackage{pstricks, pst-node, pst-circ, pst-plot, pst-3dplot, pst-solides3d, pst-sigsys, pstricks-add, pst-eucl}

%% DEFINITION OF THE KEY DRAWING
\makeatletter
\def\pstKey{\pst@object{pstKey}}
\def\pstKey@i{\@ifnextchar({\pstKey@ii{0}}\pstKey@ii}
\def\pstKey@ii#1(#2){%
  \addbefore@par{fillstyle=solid, linestyle=solid,linearc=0, framearc=0, framesep=0}%
  \begingroup
  \use@par
  \rput{#1}(#2){\psscalebox{\psk@psscale}{%
    \pscustom{
       \psarcn(-1.3, 0){0.8}{346}{25}     % Exterior disk
        \psline(1.5, 0.3380)(1.8, 0)(1.5, -0.3420)(1.3, -0.3420)
        (1.3, -0.3420)(1.15, -0.1920)(1.05, -0.3420)(0.95, -0.1920)(0.75, -0.4920)
        (0.65, -0.3420)(0.55, -0.4920)(0.45, -0.3420)(0.35, -0.4920)(0.15, -0.1920)
        (0.05, -0.3420)(-0.05, -0.1920)(-0.25, -0.4920)(-0.45, -0.1935)(-0.5238, -0.1935)
        \pscircle[linewidth=2pt](-1.5, 0){0.25}  % Hole
     }}}%
  \endgroup\ignorespaces
}
\makeatother
%% END OF DEFINITION


\begin{document}
\begin{pspicture}[labelangle=:U, showgrid=false](-4, -1.5)(10, 3)


    \pssignal(-3, 0.5){hbob}{\parbox[c]{1.5\psunit}{\centering \texttt{Hello Bob}}}
    \pssignal(3, 0.5){ciph}{\parbox[c]{2\psunit}{\centering \texttt{x0Ak3o\$2Rj}}}
    \pssignal(9, 0.5){hbob2}{\parbox[c]{1.5\psunit}{\centering \texttt{Hello Bob}}}

    %\psdot % Mark the origin of the axes

    \psset{style = RoundCorners, gratioWh=1.8,style=Arrow}%, arrowinset=0}
    \pssignal(-1.5, 2.3){key}{\parbox[c]{3\psunit}{\centering \textcolor{ForestGreen}{Public Key}}}
    \pssignal(4.5, -1){key}{\parbox[c]{3\psunit}{\centering \textcolor{WildStrawberry}{Private Key}}}
    \pssignal(0, 2.5){key1}{}
    \pssignal(6, 2.5){key2}{}       

    \psfblock[framesize=1.75 1.2](0, 0.5){rsa1}{\parbox[c]{2\psunit}{\centering RSA}}
    \psfblock[framesize=1.75 1.2](6, 0.5){rsa2}{\parbox[c]{2\psunit}{\centering RSA}}


    \nclist{ncline}{hbob, rsa1, ciph, rsa2, hbob2}



    \pstKey[psscale=0.5, fillcolor=ForestGreen]{-90}(0,1.6)
    \pstKey[psscale=-0.5, fillcolor=WildStrawberry]{-90}(6,-0.6)

\end{pspicture}

\end{document}

运行后,关键点与实际绘图不同。我查看了文档,并重置了:psy-sigsys中包含的所有选项,但显然这还不够……RoundCornerslinearc=0, framearc=0, framesep=0

答案1

使用或或按住\psset{RoundCorners,...}本地:\bgroup ... \egroup{...}\begingroup ... \endgroup

\documentclass[pstricks, float]{standalone}
\usepackage[table, dvipsnames]{xcolor}
\usepackage{pst-node, pst-circ, pst-plot, pst-3dplot, pst-solides3d, pst-sigsys,
    pst-eucl,pstricks-add}

%% DEFINITION OF THE KEY DRAWING
\makeatletter
\def\pstKey{\pst@object{pstKey}}
\def\pstKey@i{\@ifnextchar({\pstKey@ii{0}}\pstKey@ii}
\def\pstKey@ii#1(#2){%
  \begingroup
  \addbefore@par{fillstyle=solid,linestyle=solid,linearc=0}%
  \use@par
  \rput{#1}(#2){\psscalebox{\psk@psscale}{%
    \pscustom{
       \psarcn(-1.3, 0){0.8}{346}{25}     % Exterior disk
        \psline(1.5, 0.3380)(1.8, 0)(1.5, -0.3420)(1.3, -0.3420)
        (1.3, -0.3420)(1.15, -0.1920)(1.05, -0.3420)(0.95, -0.1920)(0.75, -0.4920)
        (0.65, -0.3420)(0.55, -0.4920)(0.45, -0.3420)(0.35, -0.4920)(0.15, -0.1920)
        (0.05, -0.3420)(-0.05, -0.1920)(-0.25, -0.4920)(-0.45, -0.1935)(-0.5238, -0.1935)
        \pscircle[linewidth=2pt](-1.5, 0){0.25}  % Hole
     }}}%
  \endgroup\ignorespaces
}
\makeatother
%% END OF DEFINITION


\begin{document}
\begin{pspicture}[labelangle=:U, showgrid=false](-4, -2)(10, 3)
    \pssignal(-3, 0.5){hbob}{\parbox[c]{1.5\psunit}{\centering \texttt{Hello Bob}}}
    \pssignal(3, 0.5){ciph}{\parbox[c]{2\psunit}{\centering \texttt{x0Ak3o\$2Rj}}}
    \pssignal(9, 0.5){hbob2}{\parbox[c]{1.5\psunit}{\centering \texttt{Hello Bob}}}

    %\psdot % Mark the origin of the axes
    \bgroup
    \psset{style = RoundCorners, gratioWh=1.8,style=Arrow}%, arrowinset=0}
    \pssignal(-1.5, 2.3){key}{\parbox[c]{3\psunit}{\centering \textcolor{ForestGreen}{Public Key}}}
    \pssignal(4.5, -1){key}{\parbox[c]{3\psunit}{\centering \textcolor{WildStrawberry}{Private Key}}}
    \pssignal(0, 2.5){key1}{}
    \pssignal(6, 2.5){key2}{}       

    \psfblock[framesize=1.75 1.2](0, 0.5){rsa1}{\parbox[c]{2\psunit}{\centering RSA}}
    \psfblock[framesize=1.75 1.2](6, 0.5){rsa2}{\parbox[c]{2\psunit}{\centering RSA}}

    \nclist{ncline}{hbob, rsa1, ciph, rsa2, hbob2}
    \egroup
    \pstKey[psscale=0.5, fillcolor=ForestGreen]{-90}(0,1.6)
    \pstKey[psscale=-0.5, fillcolor=WildStrawberry]{-90}(6,-0.6)
\end{pspicture}

\end{document}

在此处输入图片描述

相关内容