[pstricks] labelsep and rotated 'put'

Herbert Voss LaTeX at zedat.fu-berlin.de
Sun Oct 16 16:38:46 CEST 2005


Poul Riis wrote:
> How can I in an elegant way add a line from the node to the label as at
> node A in the example below? - And add this facility to my new command
> '\nodewidthrotatedtext'?



> \documentclass{article}
> \usepackage{pst-node}
> \usepackage{pst-plot}
> \pagestyle{empty}
> %\nodewithrotatedtext{x}{y}{labelsep}{rotangle}{text}
> \newcommand{\nodewithrotatedtext}[5]{%
> \cnode*(!#1 #2){2pt}{P}%
> \nput[rot=#4,labelsep=#3]{#4}{P}{\psframebox{#5}}%

do not use the same none name for all points

Herbert


\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-node}
\usepackage{pst-plot}
\pagestyle{empty}
%\nodewithrotatedtext{x}{y}{labelsep}{rotangle}{text}
\makeatletter
\newdimen\distance
\newcommand{\nodewithrotatedtext}[5]{%
   \cnode*(!#1 #2){2pt}{P#1}%
   \nput[rot=#4,labelsep=#3]{#4}{P#1}{\psframebox{#5}}%
   \pssetlength\distance{#3}
   \def\@distance{\pst at number\distance }
   \pnode(!
     #4 cos \@distance \pst at number\psxunit div mul #1 add
     #4 sin \@distance \pst at number\psyunit div mul #2 add ){Label}%
   \ncline[nodesep=0,arrows=<-,arrowscale=2,nodesepB=-2pt]{P#1}{Label}%
}
\makeatother
\begin{document}

\psset{xunit=0.2mm,yunit=1cm}
\begin{pspicture}(-5,-5)(400,5)
\psaxes[Dx=50,linewidth=1pt,ticksize=-3pt 0]{->}(0,0)(-5,-0.5)(400,5)
\SpecialCoor%
\nodewithrotatedtext{0}{0}{1cm}{60}{Rotated text at A}
\nodewithrotatedtext{200}{0}{1cm}{-60}{Rotated text at B}
\nodewithrotatedtext{300}{0}{25mm}{30}{Rotated text at C}
\end{pspicture}

\end{document}




More information about the PSTricks mailing list