[pstricks] ncangle variant is needed

Herbert Voss LaTeX at zedat.fu-berlin.de
Sun Jun 24 00:17:38 CEST 2007


Boris Veytsman wrote:
> HV> Date: Sat, 23 Jun 2007 22:47:21 +0200
> HV> From: Herbert Voss <LaTeX at zedat.fu-berlin.de>
>
>
> HV> where is the problem, simply saing
>
> HV>   \psset{angleB=90,angleA=-90,armA=1cm}
>
> Unfortunately, this will not work either because node A also might
> have unknown radius (I have many different pairs, and want all
> horizontal arms to be aligned).
>   

\documentclass[a4paper]{article}
\usepackage{pst-node}

\makeatletter
\def\ncAngles{\pst at object{ncAngles}}
\def\ncAngles at i{\check at arrow{\ncAngles at ii}}
\def\ncAngles at ii#1#2{%
  \nc at object{Open}{#1}{#2}{1.5}{\ncAngles at iii \tx at NCAngles}}
%
\def\ncAngles at iii{%
  tx at Dict begin \psline at iii pop end
  /AngleA \psk at angleA def
  /AngleB \psk at angleB def
  /ArmA \psk at armA GetEdgeA yA yA1 sub dup mul xA xA1 sub dup mul add
sqrt sub def
  /ArmB \psk at armB def
  /ArmTypeA \psk at armtypeA def
  /ArmTypeB \psk at armtypeB def }
\makeatother

\begin{document}
Let me give an example.  In this picture:

\begin{pspicture}(5,4)
  \cnode(2.5,3.5){0.2}{A}
  \cnode(0.5,1){0.2}{B1}
  \cnode(1.5,1){0.4}{B2}
  \cnode(2.6,1){0.6}{B3}
  \cnode(4,1){0.8}{B4}
  \psset{angleB=90,angleA=-90,armA=1cm}
  \ncAngles{A}{B1}
  \ncAngles{A}{B2}
  \ncAngles{A}{B3}
  \ncAngles{A}{B4}
\end{pspicture}
%
\begin{pspicture}(5,4)
  \cnode(2.5,3.5){0.4}{A}
  \cnode(0.5,1){0.2}{B1}
  \cnode(1.5,1){0.4}{B2}
  \cnode(2.6,1){0.6}{B3}
  \cnode(4,1){0.8}{B4}
  \psset{angleB=90,angleA=-90,armA=1cm}
  \ncAngles{A}{B1}
  \ncAngles{A}{B2}
  \ncAngles{A}{B3}
  \ncAngles{A}{B4}
\end{pspicture}
%
\begin{pspicture}(5,4)
  \cnode(2.5,3.5){0.8}{A}
  \cnode(0.5,1){0.2}{B1}
  \cnode(1.5,1){0.4}{B2}
  \cnode(2.6,1){0.6}{B3}
  \cnode(4,1){0.8}{B4}
  \psset{angleB=90,angleA=-90,armA=1cm}
  \ncAngles{A}{B1}
  \ncAngles{A}{B2}
  \ncAngles{A}{B3}
  \ncAngles{A}{B4}
\end{pspicture}


\end{document}


Herbert








More information about the PSTricks mailing list