Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

is there a way to tell the a node, where the arrow shall arrive?

At this example, the Arrow from Node B to A should arrive exactly in the middle of the "D" from "Dies". It should start on top-center of B's text.

Hope this is understandable.

\documentclass[11pt, halfparskip,toc=flat,numbers=noendperiod]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{ngerman} % deutsche Silbentrennung, Deutsche Ausdrücke

\usepackage[T1]{fontenc}
\usepackage{lmodern,textcomp}


\usepackage{pstricks-add}

\begin{document}
\begin{center}
\psset{xunit=1cm,yunit=1cm,runit=1cm}
\begin{pspicture}(10,5)
    %\psgrid(0,0)(0,0)(10,5)


    \rput[t](5, 5){
        \rnode{A}{
            \parbox[c]{3cm}{
                \centering
                Dies ist Node A
            }
        }
    }

    \rput[t](0, 2.5){
        \rnode{B}{
            \parbox[c]{3.5cm}{
                \centering
                Dies ist der Text\\
                zu Node B
            }
        }
    }

    \rput[t](10,2.5){
        \rnode{C}{
            \parbox[c]{3cm}{
                Mein Name ist C, Node C
            }
        }
    }

    \rput[t](5,0){
        \rnode{D}{
            \parbox[c]{3cm}{
                Ich bin Node D\\
                Ich stehe ganz unten
            }
        }
    }

    \psset{linewidth=.05cm}
    \psset{nodesep=0.1cm}
    \psset{arcangle=45}

    \ncarc{->}{B}{A}
    \ncarc{->}{A}{C}
    \ncarc{->}{C}{D}
    \ncarc{->}{D}{B}

\end{pspicture}

\end{center}

\end{document}
share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

There is a way. \nccurve for example allows to specify connection angles and offsets. If less precision were sufficient you could go with a one-liner; since you're looking for exact placement, you need some more code:

%calculate offset
\newlength\labellength
\newlength\dlength
\newlength\offset
\settowidth{\labellength}{Dies ist Node A}
\settowidth{\dlength}{D}    
\setlength{\offset}{\dimexpr-.5\labellength+.5\dlength\relax}

%draw curve
\nccurve[angleA=90,angleB=90,offsetB=\offset,ncurvA=.67,ncurvB=.67]{->}{B}{A}

The ncurv parameters, set to their defaults here, allow you to adjust the curve's shape. A and B, not to be confused with your node names, refer to the start and end node. For more details see the manual linked by @MarcoDaniel; several other options to connect two nodes are presented there as well.

enter image description here

share|improve this answer
add comment

With your current settings it can't be done. The node specifier \rnode has an optional argument to specify the refpoint but only once. The specifier is equal to \rput.

However the package pst-node offers an other way. You can use the new command \psDefBoxNodes{node name }{text } whereby the displayed refpoints will be defined:

The example is taken from the manual:

\documentclass[]{scrartcl}
\usepackage{pst-node}
\begin{document}

\psset{xunit=1cm,yunit=1cm,runit=1cm}
\begin{pspicture}(-1,-2)(10,6)
\psscalebox{15}{\psDefBoxNodes{Age}{\color{red!50}\sffamily \"Age}}%
\pspolygon[fillstyle=solid,
fillcolor=blue!30,opacity=0.3](Age:tl)(Age:tr)(Age:br)(Age:bl)%
\psline[linestyle=dashed](Age:Bl)(Age:Br)%
\psdots(Age:tl)(Age:tC)(Age:tr)(Age:Cl)(Age:C)(Age:Cr)%
(Age:Bl)(Age:BC)(Age:Br)(Age:bl)(Age:bC)(Age:br)%
\pcline[arrows=<->,linecolor=blue,arrowscale=1.25](Age:tC)(Age:Br)
\uput[180](Age:tl){tl}\uput[180](Age:Cl){Cl}\uput[180](Age:Bl){Bl}\uput[180](Age:bl){bl}
\uput[90](Age:tC){tC} \uput[0](Age:C){C}
\uput[0](Age:BC){BC} \uput[-90](Age:bC){bC}
\uput[0](Age:tr){tr} \uput[0](Age:Cr){Cr} \uput[0](Age:Br){Br} \uput[0](Age:br){br}
\end{pspicture}
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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