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.

In the second example I am trying to work the the library intersection. It works fine as long as I don't use the calc library.

The first example shows my intention. I am using ($2*(w1')$) which produces the expected result:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections,calc}


\begin{document}
\begin{tikzpicture}[x=3cm,y=3cm]
\coordinate (O) at (0,0);
\coordinate (F') at (-0.8,-0.1);
\coordinate (F'') at (0.8,0);
\draw[thick](O) ++(F') ++ (F'');
\draw[gray,name path=circle around F'] (F') circle (1.2);
\draw[gray,name path=circle around F''] (F'') circle (1.2);
\draw[name intersections={of=circle around F' and circle around F'',by={w1,w1'}}]   (intersection-1) node[dot,draw]{}
-- (intersection-2)node[dot,draw]{};
\draw[red,thick] (w1) -- (w1');
\draw[blue,thick] (w1) -- ($2*(w1')$);
\end{tikzpicture}
\end{document}

In the picture you can see that the blue line is expanded.

In the second (not minimal) example it fails:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections,calc}


\begin{document}
\tikzset{dot/.style={circle,minimum size=3pt,inner sep=0pt,outer sep=0pt,thick,fill,}}
\begin{tikzpicture}[x=3cm,y=3cm]
\coordinate (B) at (-1,0);\node[dot] at (B) {};\node[left] at (B) {$B$};
\coordinate (D) at (0,1);\node[dot] at (D) {};\node[anchor=south east] at (D) {$D$};
\coordinate (F) at (0,-.25);\node[dot] at (F) {};\node[anchor=west] at (F) {$F$};

\draw[thick,name path=line FB] (F) -- (B);
\draw[thick,name path=line FD] (F) -- (D);
\draw[gray,name path=circle around F] (F) circle (0.8);

\path[name intersections={of=circle around F and line FB,by=F'}];
\path[name intersections={of=circle around F and line FD,by=F''}];

\draw[gray,name path=circle around F'] (F') circle (0.6);
\draw[gray,name path=circle around F''] (F'') circle (0.6);
\draw[name intersections={of=circle around F' and circle around F'',by={w1,w1'}}] 
   (w1) node[dot]{}
-- (w1')node[dot]{};
\draw[red] (w1') -- ($2*(w1)$);
\end{tikzpicture}
\end{document}

The red line misses the intersection. I don't know why.

What is the problem?

share|improve this question
1  
I can get the result with \draw[red] (w1') -- ($(w1')!2!(w1)$);. So probably calc library is assuming something different for the omitted coordinate in ($coord1!2!coord2$) type of input. –  percusse Mar 2 '12 at 16:50
    
@percusse: Thanks for your comment. This input method I didn't try. –  Marco Daniel Mar 2 '12 at 16:56
2  
If TikZ is deep magic, the calc library is the deeper magic from beyond the dawn of time. –  Loop Space Mar 2 '12 at 16:57
    
@AndrewStacey: Sounds really obscure ;-). Thanks for your answer. –  Marco Daniel Mar 2 '12 at 17:02
    
Incidentally, I didn't know that this sort of syntax was allowed in TikZ calc so I've learnt something too. Good question. –  Loop Space Mar 2 '12 at 17:04

1 Answer 1

up vote 6 down vote accepted

The coordinate ($2*(w1)$) means "take the coordinate represented by (w1) and double it". Traditionally, we scale vectors from the origin. If you draw blobs at the origin, (w1) and ($2*(w1)$) then you will see that they line up on a straight line.

What you want is "take the vector from (w1') to (w1), double it, and anchor it back at (w1') again". You can do this with ($(w1') + 2*(w1) - 2*(w1')$) (parentheses seem to confuse it a little) or ($(w1')!2!(w1)$).

share|improve this answer
    
Experimenting shows that when I try to use parentheses then it thinks they are specifying coordinates so can't be used for mathematical grouping. –  Loop Space Mar 2 '12 at 17:00
1  
For grouping you can use {} An example is shown in the manual ;-) –  Marco Daniel Mar 2 '12 at 17:03
    
$(w1') + 2*{(w1') - (w1)}$ makes my machine hang. Where's the example? –  Loop Space Mar 2 '12 at 17:05
    
I meant this example \fill [black] (${3*(4-3)}*(1,0.5)$) circle (2pt); page 120. –  Marco Daniel Mar 2 '12 at 17:10

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.