you can create a node at each end of the lines and then connect these nodes. by adjusting the minimum size of node you can improve aesthetics.
(sorry for my google english)
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri,calc,shadows}
\begin{document}
\begin{tikzpicture}[
parent/.style={%
rounded corners,
thick,
draw=red!75,
fill=red!20,
thick,
inner ysep=2pt,
inner xsep=2pt,
minimum width = 4cm,
minimum height = 1.5cm,
align=center
},
child/.style={%
rounded corners,
thick,
draw=blue!90,
fill=blue!35,
thick,
inner ysep=2pt,
inner xsep=2pt,
minimum width = 4cm,
minimum height = 1.5cm,
align=center
},
grandchild/.style={%
rounded corners,
thick,
draw=green!90,
fill=green!35,
thick,
inner ysep=2pt,
inner xsep=2pt,
minimum width = 4cm,
minimum height = 1.5cm,
align=center
},
line/.style={%
semithick,
->,
shorten >=1pt,
>=stealth'
},
call/.style={%
blue,
semithick,
->,
shorten >=1pt,
>=stealth'
},
return/.style={%
red,
semithick,
->,
shorten >=1pt,
>=stealth'
}]
\node[child] (child) {Child};
\node[parent] at (-6,3) (parent 1) {Node 1\\I have manually\\connected this one};
\node[parent] at (0,3) (parent 2) {Node 2\\I have manually\\connected this one};
\node[parent] at (6,3) (parent 3) {Node 3\\I have manually\\connected this one};
\node[parent] at (-6,-3) (grandchild 1) {Node 4\\I have manually\\connected this one};
\node[parent] at (0,-3) (grandchild 2) {Node 5\\I have NOT manually\\connacted this one};
\node[parent] at (6,-3) (grandchild 3) {Node 6\\I have NOT manually\\connacted this one};
%draw three lines from each parent to each child
\draw [line] (parent 1.south east)node[above left](p1){} -- (child.north west)node[below right](c1){};
\draw [line] (parent 2.south)node[above](p2){} -- (child.north)node[below](c2){};
\draw [line] (parent 3.south west)node[above right](p3){} -- (child.north east) node[below left](c3){};
%draw three lines from each parent to each child
\draw [line] (grandchild 1.north east)node[below left,minimum size=2em](p4){} -- (child.south west)node[above right,minimum size=2em](c4){};
\draw [line] (grandchild 2.north)node[below,minimum size=2em](p5){} -- (child.south)node[above,minimum size=2em](c5){};
\draw [line] (grandchild 3.north west)node[below right](p6){} -- (child.south east)node[above left](c6){};
\foreach \nn in{1,2,3,4,5,6}{
\draw [call] (p\nn) to [bend right=15] (c\nn);
\draw [return] (c\nn) to [bend right=15] (p\nn);
}
\end{tikzpicture}
\end{document}!
![the result](https://i.stack.imgur.com/5OMCq.png)
There is a not so complicated answer using the packages graphicx
and xypic
. Before explaining I will straight away give my solution. It is the following:
\usepackage{graphicx}
\usepackage{xypic}
\usepackage{amsmath}
\begin{align*}
\xymatrix@R=10pt{
cRing \ar[r] & Sch \\
A \ar@{}[u]|{\rotatebox{90}{$\in$}} \ar@{|->}[r]
& Spec(A) \ar@{}[u]|{\rotatebox{90}{$\in$}}
}
\end{align*}
NOTE that diagram should of course be enclosed in \begin{document}
and \end{document}
. Of course it is not important that align*
is used, any display-style math envisonment will do. The package amsmath
is also just included to make align*
available, since it is my favorite.
Now for the explanation. I will assume that you already know a little about the xypic
. This package is really easy to use on a basic level. Here it has been used in a little more advanced way. The option @R=10pt
between \xymatrix
and the following {
is an option the specifies the 'row spacing', and in this case we want it to be small so that the picture does not look silly. The top arrow is a standart arrow in xypic
drawn with \ar[r]
but the lower arrow has the extra symbols @{|->}
which just specifies that we want this arrow to have that special look. In genneral it you want to rotate a symbol in LaTeX the graphicx
package includes the command \rotatebox
which allows for rotating element, e.g. the symbol \in
. These symbols are placed like arrows with the command
\ar@{}[u]|{\rotatebox{90}{$\in$}}
Now \rotatebox{90}{$\in$}
is jost a 90 degrees rotation of the symbol \in
. The symbols @{}
specifies that we want an 'empty' arrow, i.e. an arrow with no lines, and the symbols |{\rotatebox{90}{$\in$}}
specify that we want \rotatebox{90}{$\in$}
places as a lable on top of the given arrow.
Best Answer
It's really easy with
tikz-cd
: