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.

I'm new to TikZ and have produced the following figure enter image description here

This is what I want except the fact the arrowed lines do not all join in the centre of the diamonds for some reason, why is this? and how can I make them all join up? The code I used is:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsthm, mathrsfs}
\newcommand{\scri}{\mathscr{I}}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings} 
\usetikzlibrary{calc}
\usepgflibrary{arrows}

\begin{document}

%Arrows in centre
\tikzset{->-/.style={decoration={
 markings,
 mark=at position #1 with {\arrow[scale=1]{>}}},postaction={decorate}}}


\begin{tikzpicture}[>=open triangle 90]
\node (I)    at ( 4,0) {};
\node (II)   at (-5,0) {};




\path % Four conners of the right diamond 
   (I) +(90:4)  coordinate[label=90:$i^+$]  (Itop)
       +(-90:4) coordinate[label=-90:$i^-$] (Ibot)
       +(180:4) coordinate (Ileft)
       +(0:4)   coordinate[label=0:$i^0$] (Iright)
       +(45: 2.825)   coordinate (Imidtr)
       +(225:2.825)   coordinate (Imidbl)
       +(135:2.825)   coordinate (Imidtl)
       +(-45:2.825)   coordinate (Imidbr)
       ;
   ;

\draw  (Ileft)  -- 
          node[midway, below, sloped] {$H^+$}
       (Itop)   -- 
          node[midway, above right]    {$\scri^+$}
         node[midway, below, sloped] {$\bar{v}=\infty$}
       (Iright) --
          node[midway, below right]    {$\scri^-$}
          node[midway, above, sloped] {$\bar{u}=-\infty$}
        (Ibot)   --
          node[midway, below, sloped]    {$H^-$}
       (Ileft)  -- cycle;

 %draw arrowed mode lines
\draw[->-=.5] (Imidbr) -- (I);
\draw[->-=.5] (I) -- (Imidtl);   
\draw[->-=.5] (I) -- (Imidtr);    

%REPEAT FOR THE DOWN MODES  
\path % Four conners of the other diamond 
   (II) +(90:4)  coordinate[label=90:$i^+$]  (IItop)
       +(-90:4) coordinate[label=-90:$i^-$] (IIbot)
       +(180:4) coordinate (IIleft)
       +(0:4)   coordinate[label=0:$i^0$] (IIright)
       +(45: 2.825)   coordinate (IImidtr)
        +(225:2.825)   coordinate (IImidbl)
       +(135:2.825)   coordinate (IImidtl)
       +(-45:2.825)   coordinate (IImidbr)
       ;
 % draw other diamond
\draw  (IIleft)  -- 
      node[midway, below, sloped] {$H^+$}
   (IItop)   -- 
      node[midway, above right]    {$\scri^+$}
      node[midway, below, sloped] {$\bar{v}=\infty$}
   (IIright) --
      node[midway, below right]    {$\scri^-$}
      node[midway, above, sloped] {$\bar{u}=-\infty$}
   (IIbot)   --
      node[midway, below, sloped]    {$H^-$}
   (IIleft)  -- cycle;

 %draw modes:
 \draw[->-=.5] (IImidbl) -- (II);
 \draw[->-=.5] (II) -- (IImidtl);   
 \draw[->-=.5] (II) -- (IImidtr);        


 \end{tikzpicture}
 \end{document}
share|improve this question
3  
This is not exactly a minimal example. If you have a node coordinate, such as II the line won't enter the node's shape. (Write (II.center) if you want the line to go to the centre of the shape.) Alternatively, you could turn your node into a coordinate. –  Marc van Dongen Feb 22 '13 at 10:55
6  
Or define (I) and (II) to be a coordinate instead of a node. –  percusse Feb 22 '13 at 10:56
    
@percuße I am not sure who was first with the coordinate:-) You probably beat me with a few (7?) seconds. –  Marc van Dongen Feb 22 '13 at 10:57
    
Slightly related: tex.stackexchange.com/q/91310/86, more related (possible duplicate?): tex.stackexchange.com/q/4057/86 –  Loop Space Feb 22 '13 at 11:00
    
@Marc van Dongen, sorry I should have stripped it down to be more minimal, but thanks that fixed it. –  fpghost Feb 22 '13 at 11:44
show 2 more comments

1 Answer

Changing the following nodes to coordinates fixes the problem....

\coordinate (I)    at ( 4,0) ;
\coordinate (II)   at (-5,0) ;

enter image description here

The reason for that is due to the fact that nodes have a default shapes with nonzero area with various anchors at the borders of the shape. As Ryan Reich mentions in his comment, the size depends on a few key values such as minimum width/height,inner sep,outer sep,line width etc. One can try to drive a node to be as small as possible but that is actually not a good idea since then it's underlying path drawing calculations would be forced to the TeX precision and possibly, though not always, it will not behave as a coordinate no matter what.

In contrast coordinates have only one anchor which is the center and it characterizes the coordinate. Also they don't have a shape or background path to be drawn when draw option is used. Since they are indeed coordinates, the lines join.

share|improve this answer
2  
You should add the explanation that it's because of the minimum size of a node (or its inner sep and outer sep) being nonzero. Coordinates are "point particles", by contrast. –  Ryan Reich May 10 '13 at 1:42
    
@RyanReich Agreed. It was a fast sweep of unanswered TikZ questions so maybe I did it a little too fast. I'll edit in a sec. –  percusse May 10 '13 at 8:17
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.