TikZ: position of node with shorten-option

I have the following Code

\draw[style={shorten >=-1cm}, dashed] (C) -- (CENTER) node {NAME};


Is there a simple way to position {NAME} at the end of the "shortened" line? If I use the code above, it is placed at (CENTER).

Sebastian

Edit: I have no permission to answer my own question, so I write a short edit:

I think I found a solution that is feasible for my problem:

    \tikzset{%
($(\tikztostart)$)--($(\tikztotarget)!-#1!(\tikztostart)$)%
\tikztonodes}}
}

\draw[dashed, add=1cm] (C) to (CENTER) node[right] {NAME};

-
Thanks Your solution is a variant of my code \tikzset{add/.style args={#1 and #2}{to path={($(\tikztostart)!-#1!(\tikztotarget)$)--($(\tikztotarget)!-#2!(\tikztostar‌​t)$)\tikztonodes}}} and I discover with your example that I can use 1cm or 2cm. I think you can use the original style with 0 and 1cm ( I always use percent 0.1 or 1.2 etc. )if you want to increase the line for only one side. But the solution of Gonzalo and me are correct. – Alain Matthes Apr 23 '12 at 23:06

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}


-
Thank you for your answer, but I a arbitrary oriented lines, so simply adding a value to the x-component does not help. I've added my general solution to my initial post. – Sebastian Apr 23 '12 at 22:13

I'm not sure that your question is very precise. You write "shortened" line because you use the option shorten? in fact you increase the line with shorten >=-1cm

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture} [dot/.style={draw,circle,minimum size=3pt,
inner sep=0pt,outer sep=0pt,thick,fill}}]
\coordinate[dot] (C) at (0,0);
\coordinate[dot] (CENTER) at (10,0);
\draw[style={shorten >=-1cm}, dashed] (C) -- (CENTER) ;
\end{tikzpicture}
\end{document}


gives

logically the simplest way

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\coordinate (C) at (0,0);
\node (CENTER) at (10,0) {NAME};
\draw[dashed] (C) -- (CENTER) ;
\end{tikzpicture}
\end{document}


But perhaps you really want to work against the effect of \draw[shorten >=-1cm, you can get a fine result with :

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[dot/.style={draw,circle,minimum size=3pt,
inner sep=0pt,outer sep=0pt,thick,fill}}]
\coordinate[dot] (C) at (0,0);
\coordinate[dot] (CENTER) at (10,0);
\draw[style={shorten >=-1cm}, dashed] (C) -- (CENTER) node[right=1cm] {NAME};
\end{tikzpicture}
\end{document}


This is one method to place a node relatively to another on. First when you write rightthe new node is placed with 'anchor=west then if you decided to increase the line with 1 cm, you you need to move the new node to 1 cm to the right of CENTER.

-
Thank you for your answer. You are right, my question was not precise enough. As I mentioned in my comment above, I have arbitrary lines and simply adding a value to the x-axis does not work. I edited my question and show a solution that works for me. – Sebastian Apr 23 '12 at 22:16
I see your solution and I work like this in tkz-euclide. Here you can work with arbitrary lines, you need to only to use the same value for shorten and right But I agree I prefer add`:) – Alain Matthes Apr 23 '12 at 23:13