17

Consider this simple example:

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

\begin{tikzpicture}[scale=1.5]
    % Draw axes
    \draw [<->,thick] (0,2.2) node (yaxis) [above] {$t$}
        |- (2.2,0) node (xaxis) [right] {$s$};
    % Draw triangle's legs
    \draw (0.5,0.5) coordinate (a)  -- +(1.3,0) coordinate (b);
    \draw (b) -- +(0,1.5) coordinate (c);

    \draw (a) .. controls +(10:1) and +(265:1) .. (c)
    node[sloped,above,pos=0.5] {$t=g(s)$};

    % Draw vertices and labels
    \fill[red] (a) circle (1pt);
    \draw (a) node[left] {$a$};
    \fill[red] (b) circle (1pt);
    \draw (b) node[right] {$b$};
    \fill[red] (c) circle (1pt);
    \draw (c) node[right] {$c$};
\end{tikzpicture}
\end{document}

I want to position a fourth point d relative to one of the other points. I want it to be a standalone coordinate, such that later in the code I could refer to it. For example, have \draw (d) -- (0,0); or something similar.

Thanks!

Janosh
  • 4,042
Dror
  • 22,613
  • 2
    A little late perhaps, but for the benefit of people only coming across this now, definitely check out the TikZ library positioning (see e.g. here). – Janosh Sep 29 '17 at 09:21
  • @Casimir thank you so much for this link! Exactly what I needed!! – Yair Daon Oct 08 '17 at 21:43

1 Answers1

27

This can be done using the following ways:

\usetikzlibrary{calc}
% ...

\coordinate (d) at ($ (c) + (1,3) $);

or

\path (c) ++(1,3) coordinate (d);

The latter one might add a invisible path to your picture, which should not be an issue most of the time.

Martin Scharrer
  • 262,582