2

I'm making a building to explain the asymmetric encryption scheme to my students. I'm using pst-sigsys to designe the Block Diagram, and pstricks-add to draw the key :

Result

I had problems designing the key, but I already received answers (see my question).

The thing is, I have now interferences between pst-sigsys RoundCorners options, and the actual drawing of the key.

I want the keys to be above the frames (not like in the picture). But, in the code, if I put them after the frames (see MWE), the RoundCorners option modifies the key. M. Voß already brought a partial solution, but it didn't entierly work, so that's why I posted a new question.

Here's the MWE that causes this to happen :

\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}

Running that makes the key different than the actual drawing. I looked in the psy-sigsys doc, and I reset all the options included in the RoundCorners : linearc=0, framearc=0, framesep=0 but apparently it isn't enough...

  • I don't see any problems as I compile to this output. Perhaps you need to update your distribution? – Werner Sep 24 '15 at 6:57
2

Hold the \psset{RoundCorners,...} local with \bgroup ... \egroup or {...} or \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}

enter image description here

  • Thanks ! I thought I'll be a bigger deal... Shame on me :) – EisenHeim Sep 24 '15 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.