1

What's wrong with the following code ?

\documentclass[border=10mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\def\arcA{(0,-4) arc (90:0:4)};
\def\arcB{(4,-4) arc (90:180:4)};
\draw\arcA;
\draw\arcB;
% the two arcs intersect at a single point
\path [name intersections={of=\arcB and \arcA, by={Int}}];
\draw (Int) circle (2pt);
\end{tikzpicture}
\end{document}

EDIT. For some reason the following works

\documentclass[border=10mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\draw [name path=arcA] (0,-4) arc (90:0:4) ;
\draw [name path=arcB] (4,-4) arc (90:180:4) ;
% \draw arcA : produces an error ...
% \draw arcB : produces an error ...
\path [name intersections={of=arcB and arcA, by={Int}}];
\draw (Int) circle (2pt) ;
\end{tikzpicture}
\end{document}

But this doesn't work :

\documentclass[border=10mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\path [name path=arcA] (0,-4) arc (90:0:4) ;
\path [name path=arcB] (4,-4) arc (90:180:4) ;
\draw (arcA) ;
\draw (arcB) ;
\path [name intersections={of=arcB and arcA, by={Int}}];
\draw (Int) circle (2pt) ;
\end{tikzpicture}
\end{document}
  • Is solution \documentclass[tikz, border=10mm]{standalone} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture} \draw[name path=A] (0,-4) arc (90: 0:4);%\arcA; \draw[name path=B] (4,-4) arc (90:180:4);%\arcB; % the two arcs intersect at a single point \draw [name intersections={of=A and B, by={Int}}] (Int) circle (2pt); \end{tikzpicture} \end{document} acceptable? – Zarko May 19 '17 at 0:54
  • Dear Zarko : I think we have a similar solution, but I only found mine by blindly permuting things ... Why is it that yours works ? In particular, why is it that using \draw instead of \path or \def works ? – Olivier Bégassat May 19 '17 at 0:59
  • see my answer below. \draw [name intersections={of=A and B, by={Int}}] (Int) circle (2pt); is just shorter version of code \path [name intersections={of=A and B, by={Int}}]; \draw (Int) circle (2pt);. The result is at both codes the same. – Zarko May 19 '17 at 1:04
2

You havew many issues in your code:

  • \def... can not be ended by semicolumn
  • you not defined path names
  • path names had not to be macros/commands

Try:

\documentclass[border=10mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\def\arcA{(0,-4) arc (90:0:4)}
\def\arcB{(4,-4) arc (90:180:4)}
\draw[name path=A] \arcA;
\draw[name path=B] \arcB;
\draw [name intersections={of=B and A, by={Int}}] 
      (Int) circle (2pt);
\end{tikzpicture}
\end{document}
\end{tikzpicture}
\end{document}

or usual way:

\documentclass[tikz, border=10mm]{standalone}
\usetikzlibrary{intersections}

\begin{document}
\begin{tikzpicture}
\draw[name path=A] (0,-4) arc (90:  0:4);%\arcA;
\draw[name path=B]  (4,-4) arc (90:180:4);%\arcB;
% the two arcs intersect at a single point
\draw [name intersections={of=A and B, by={Int}}]
      (Int) circle (2pt);
\end{tikzpicture}
\end{document}

Both examples gives the same result:

enter image description here

  • Great stuff! This does the trick : ) thanks ! – Olivier Bégassat May 19 '17 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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