下面的代码有什么问题?
\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}
编辑。由于某种原因,以下工作
\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}
但是这个没有工作 :
\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}
答案1
您的代码中存在许多问题:
\def...
不能以分号结尾- 您没有定义路径名
- 路径名不能是宏/命令
尝试:
\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}
或通常的方式:
\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}
两个例子都得出相同的结果: