[Tex/LaTex] Why yshift doesn’t work in this TikZ example

tikz-pgf

Any idea why yshift doesn't work in the following TikZ example?

\documentclass{minimal}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
  \coordinate (A) at (0,0);
  \coordinate (B) at (2.5,0);
  \draw (A) -- (B);
  \draw[yshift=2cm] (A) -- (B);
\end{tikzpicture}

\end{document}

Best Answer

It would work with coordinates or if you place the yshift inside the parentheses next to the name A and B:

\documentclass{minimal}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
  \coordinate (A) at (0,0);
  \coordinate (B) at (2.5,0);
  \draw (A) -- (B);
  \draw ([yshift=2cm]A) -- ([yshift=2cm]B);
\end{tikzpicture}

\end{document}

Output:

alt text