[pstricks] Rotate Text on PS side

Herbert Voss Herbert.Voss at fu-berlin.de
Fri Aug 17 13:22:33 CEST 2007


Christoph Bersch wrote:
> is it possible to redefine InitNC locally in the testput commands?
> I tried something like
>
> File 'mypstheader.pro' contains the new InitNC:
>   
use \pst at def instead

Herbert

\documentclass{article}
\usepackage{pst-node}

\makeatletter
\def\testput(#1)(#2)#3{%
  \begingroup
   \pst at def{InitNC}<
   /b ED /a ED % second and first node
   /NodeSepTypeB ED /NodeSepTypeA ED
   /NodeSepB ED /NodeSepA ED
   /OffsetB ED /OffsetA ED
   tx at NodeDict a known tx at NodeDict b known and dup {
     /NodeA a load def /NodeB b load def
     NodeA GetCenter NodeB GetCenter % xA yA xB yB
     4 copy pop exch pop lt % xA xB
       { /yB ED /xB ED /yA ED /xA ED }
       { /yA ED /xA ED /yB ED /xB ED } ifelse
      } if >
   \ncline{#1}{#2}
   \ncput[nrot=:U]{#3}%
  \endgroup}
\makeatother

\begin{document}
\begin{pspicture}[showgrid=true](5,4)
    \pnode(0,0){A}
    \pnode(2,4){B}
    \pnode(5,0){C}
    \pnode(3,4){D}
    \testput(A)(B){Normal}
    \testput(C)(D){Flipped}
\end{pspicture}

\begin{pspicture}[showgrid=true](5,4)
    \pnode(0,0){A}
    \pnode(2,4){B}
    \pnode(5,0){C}
    \pnode(3,4){D}
    \ncline{A}{B}\ncput[nrot=:U]{Normal}
    \ncline{C}{D}\ncput[nrot=:U]{Flipped}
\end{pspicture}

\end{document}




More information about the PSTricks mailing list