# [Tex/LaTex] TikZ: How to set a node on an exact position on a line

nodespositioningtikz-pgf

to set a node on a line the usual way should be something like this:

\begin{tikzpicture}
% place nodes
\node[draw] at (0, 0)   (a) {A};
\node[draw] at (5, 0)   (b) {B};

\node[draw] at (0, -2)  (c)     {C};
\node[draw] at (5, -2)  (d)     {D};

% draw edges
\draw[] (a) -- (b)  node[near start, above] {$x(kT)$};
\draw[] (c) -- (d)  node[near start, above] {$y(kT)$};
\end{tikzpicture}


But here i find it a little bit annoying, that the position of the node depends on the length of the line (what i try to illustrate in the above example). What i want is, that the nodes are exactly on the same position. To achieve this i have to write this:

\begin{tikzpicture}
% place nodes
\node[draw] at (0, -4)  (a2)    {A};
\node[draw] at (3, -4)  (b2)    {B};

\node[draw] at (0, -6)  (c2)    {C};
\node[draw] at (5, -6)  (d2)    {D};

% draw edges
\draw[] (a2.east)   -- (b2) node[at start, above right] {$x(kT)$};
\draw[] (c2.east)   -- (d2) node[at start, above right] {$y(kT)$};
\end{tikzpicture}


So my question is, is there a more intuitive way to do such things (something like the near start/at start node option)?

Maybe this is too simplistic or not automatic enough for what you're really seeking, but I think based on the question text and comments that a simple xshift=<shift-dimension> will do. You can (optionally) wrap it into a style (here, near start abs) so the distance can be adjusted globally if needed.

\documentclass[tikz]{standalone}
\tikzset{near start abs/.style={xshift=1cm}}

\begin{document}
\begin{tikzpicture}
% place nodes
\node[draw] at (0, 0)   (a) {A};
\node[draw] at (3, 0)   (b) {B};

\node[draw] at (0, -2)  (c)     {C};
\node[draw] at (5, -2)  (d)     {D};

% draw edges
\draw[] (a) node[above,xshift=1cm] {$x(kT)$} -- (b);
\draw[] (c) node[above,xshift=1cm] {$y(kT)$} -- (d);
\draw (0,-3) node[above,near start abs] {Test} -- ++(7,0);
\end{tikzpicture}
\end{document} 