Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 14 down vote accepted

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.

share|improve this answer
    
I can confirm that both approached solved my issue. Thanks! –  Dror Apr 13 '11 at 8:53
2  
Note that in the first case one can also subtract, in the other option one has to add a negative number, for example (c) ++(-1,3). –  Dror Apr 13 '11 at 9:21
    
@Dror: Yes, the ++ is a fixed syntax, there is no --, so you have to use negative numbers. –  Martin Scharrer Apr 13 '11 at 9:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.