7

I am new to Tikz and drawing things with LaTex, so I have a question. This is the code for my tikz drawing

\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
    \node[state] (q_0) {$0$};
    \node[state] (q_1) [right=of q_0] {$1$};
    \node[state] (q_2) [right=of q_1] {$2$};
    \node[rectangle] (q_dots) [right=of q_2] {$\cdots$}; 
    \node[state] (q_3) [right=of q_dots] {{\footnotesize $j-1$}};    
    \node[state] (q_4) [right=of q_3] {$j$};
    \node        (q_5) [right=of q_4] {$\cdots$};

    \path[->]
    (q_0) edge [bend left] node {$\lambda_0$} (q_1)
    (q_1) edge [bend left] node {$\mu_1$} (q_0)
    (q_1) edge [bend left] node {$\lambda_1$} (q_2)
    (q_2) edge [bend left] node {$\mu_2$} (q_1)
    (q_2) edge [bend left] node {$\lambda_2$} (q_dots)
    (q_dots) edge [bend left] node {$\mu_3$} (q_2)
    (q_dots) edge [bend left] node {$\lambda_{j-2}$} (q_3)
    (q_3) edge [bend left] node {$\mu_{j-1}$} (q_dots) 
    (q_3) edge [bend left] node {$\lambda_{j-1}$} (q_4)
    (q_4) edge [bend left] node {$\mu_j$} (q_3)
    (q_4) edge [bend left] node {$\lambda_{j}$} (q_5)
    (q_5) edge [bend left] node {$\mu_{j+1}$} (q_4) ;
\end{tikzpicture}

enter image description here

The result I am getting is fine, besides the fact that the text after the "..." is not in the middle of the arrows.

Apart from that I want to create another "invisible" state in the end of my drawing, and instead of the "..." to have a node that is not showing up, so that my arrows look like this while they are pointing to nowhere.

Thank you very much in advance for your help! :)

1 Answer 1

8

If you replace

\node[rectangle] (q_dots) [right=of q_2] {$\cdots$}; 

with

\node[state, draw=none] (q_dots) [right=of q_2] {$\cdots$};

it works.

However, I'm not sure about your second point. You want the last dots to be actually an invisible node?

4
  • Yes, I want the arrows to point that way towards nothing (empty space).
    – Maggie
    Jan 9, 2016 at 15:42
  • 1
    \node (q_5) [right=of q_4] {\phantom{$\cdots$}}; Jan 9, 2016 at 15:43
  • 1
    @Maggie Sorry I was not here. The best way is like Maarten said, using \phantom{}, which basically makes the text invisible but still "writes" it, so that it takes the same space. If you left the node empty, this could make the scheme inconsistent depending on whether you set the nodes size or not.
    – Alenanno
    Jan 9, 2016 at 15:49
  • 1
    Thank you very very much for both your answers, they solved my problem and I learnt new things! :)
    – Maggie
    Jan 9, 2016 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .