You can use a xshift
for the node and use the proper anchor:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\coordinate (C) at (0,0);
\coordinate (CENTER) at (10,0);
\draw[style={shorten >=-1cm}, dashed] (C) -- (CENTER) node[xshift=1cm,anchor=west,inner sep=0pt] {NAME};
\end{tikzpicture}
\end{document}
![enter image description here](https://i.stack.imgur.com/plyv8.png)
Every tikz node has 360 anchor points using the notation nodename.angle
, being angle
an integer between 0 and 360. Those anchors are placed at the intersection between the node shape and a radius with the given angle. You can use those anchors to set the starting point of the arcs, and also for the labels with $1$
.
UPDATE: Also, a small improvement about the dot you place "manually". It is more convenient giving the coordinates of that point in polar coordinates with respect node A
. The point is located at 9mm at north of A.north
, so you can specify its coordinates as (A.north) +(90:9.1mm)
. The 9.1mm
part is still manually estimated, but making the coordinates relative saves you from recalculate them if you move the A
node.
Quoting only the relevant part:
\path (A) [loop above] edge (A);
\path (A) edge (B)
(B) edge (C)
(A.20) edge [bend left=30] (B)
(A.22) node[above] {$1$}
(A.50) edge [bend left=45] (C)
(A.52) node[above] {$1$};
\fill[black] (A.north) +(90:9.1mm) circle (2pt);
Produces:
![Result](https://i.stack.imgur.com/DBUqz.png)
Second update
The proper way of adding the token in the edge is to use a markings
decoration. The syntax is a bit utgly because the decoration has to be added in a postaction
, but using the example provided below you can easily add tokens to any edge in your graph.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{arrows,automata,decorations.markings}
\tikzset{ % Use this style and postaction={decorate} to put a token in an edge
put token/.style={
decoration={markings, mark=at position 0.5 with {\fill[red] circle(2pt); }},
},
}
\begin{tikzpicture}[node distance=3.0cm,thick]
\tikzset{
every state/.append style={fill=white,draw=black,text=black,minimum size=45pt},
every edge/.append style={->,>=stealth',shorten >=1pt}
}
\node[state] (A) {$A$};
\node[state] (B) [right of=A] {$B$};
\node[state] (C) [right of=B] {$C$};
\path (A) edge[loop above, put token, postaction={decorate}] (A);
\path (A) edge (B)
(B) edge (C)
(A.20) edge [bend left=30] (B)
(A.22) node[above] {$1$}
(A.50) edge [bend left=45] (C)
(A.52) node[above] {$1$};
\end{tikzpicture}
\end{document}
![Result](https://i.stack.imgur.com/5mwpX.png)
Best Answer
You can use the increased functionality of
right
(and similars) provided by thepositioning
library (see Section 16.5.3 Advanced Placement Options of thepgf
manual):You need to correct the placement of the labels; as they are right now the text overlaps.