4

In a simple drawing like this (I use automata library):

\begin{tikzpicture}[shorten >=1pt,node
  distance=2cm,auto,initial text=]
  \tikzstyle{every state}=[draw=blue!50,very thick,fill=blue!20]
  \node[state] (a) {};
  \node[coordinate] (b) [right of=a] {};
  \node[state] (c) [right of=b] {};
  \draw[-] (a) edge node {a} (b);
  \draw[->] (b) edge (c);
\end{tikzpicture}

I get a tip in node b even though I do not specify it there. I create an additional node (here: b) to have a segmented line, and I don't want any tips there. How can I get rid of that tip? Interestingly, if I put a star at the end of - as an option for \draw, I get both a filled circle and an arrow tip at b, but if I keep - option, and prepend a star to ->, I get two filled circles at b.

I don't know how to mark a comment as a good answer, but the right (and the simplest) answer was among comments. I replaced \draw[-] (a) edge with \path (a) edge[-] and draw[->] (b) edge with \path (b) edge[->]. I also had to remove the global option shorten >=1pt which gave me still small gaps in lines. What I wanted to achieve was several lines going horizontally, and then converging at various angles (with an arrow tip at the end) at a single state. Thanks for all the comments and answers.

3

To remove the tip at node b, first remove the coordinate option in that command. This will leave a short segment of space. Then use calc for calculaion of a new coordinate to fill the space by line.

enter image description here

Code: method 1

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{automata,arrows,calc}

\begin{document}
\begin{tikzpicture}[shorten >=0pt, node distance=2cm,auto]
  \tikzstyle{every state}=[draw=blue!50,very thick,fill=blue!20]
  \node[state] (a) {};
  % method 1: remove the coordinate definition
  \node [] (b) [right of=a] {};           
  \node[state] (c) [right of=b] {};
  \draw (a) edge node{a} ($(b)+(0.2,0)$); % an extra line is drawn to fill the blank
  \draw[->] (b) edge (c);
\end{tikzpicture}
\end{document}

Edit (2014/01/23): Method 2

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{automata,arrows}

\begin{document}
\begin{tikzpicture}[shorten >=1pt, node distance=2cm,auto]
  \tikzstyle{every state}=[draw=blue!50,very thick,fill=blue!20]
  \node[state] (a) {};
  % method 2: remove the coordinate definition and set outer sep=-4pt.
  \node[outer sep=-4pt] (b) [right of=a] {}; 
  \node[state] (c) [right of=b] {};
  \draw (a) edge node{a} (b);     % method 2: no extended draw.
  \draw[->] (b) edge (c);
\end{tikzpicture}
\end{document}
|improve this answer|||||
1

As far as I understand, you are expecting two-parts arrow:

\documentclass{article} 

\usepackage{tikz}
\usetikzlibrary{automata}

\begin{document}

\begin{tikzpicture}[shorten >=1pt,node
  distance=2cm,auto,initial text=]
  \tikzstyle{every state}=[draw=blue!50,very thick,fill=blue!20]
  \node[state] (a) {};
  \node[coordinate] (b) [right of=a] {};
  \node[state] (c) [right of=b] {};
 \draw (a) [->] edge node {a}(b);
  \draw [->] (b) --  (c);
\end{tikzpicture}


\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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