Here is my MWE:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{intersections}
\begin{document}
\begin{figure}
\begin{tikzpicture}[scale=3]
\draw[name path={circle}] (0,0) circle(1cm);
\draw[name path={h1}] (-2,0) -- (2,0);
\draw[name path={h2}] (-2,0.8) -- (2,0.8);
\fill[name intersections={of=circle and h2}]
(intersection-1) circle(0.5pt)
(intersection-2) circle(0.5pt);
\fill[red] (0,0) circle(1pt);
\draw[ultra thick] (intersection-1)--(intersection-2);
\end{tikzpicture}
\end{figure}
\end{document}
Simply, I am trying to mark the intersection points between a circle and a line, and draw a thick line between those points.
The above code works properly. But when I change the names of the intersection from (intersection-1)
and (intersection-2)
to something like i1
and i2
, I get the error:
! Package pgf Error: No shape named i1 is known.
! Package pgf Error: No shape named i2 is known.
Must the names of the intersections begin with the word intersection
?