执行此示例时出现错误
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw (0,0) node[below] {$O$};
\draw (0,0) -- (2,0) node[right] {$A$};
\draw (0,0) -- (2,2) node[right] {$B$};
\draw (1,0) arc (0:45:1);
\draw (22:1.3) node { $ \dfrac{\pi}{4} $ }
\end{tikzpicture}
\end{center}
\end{document}
答案1
错误说\dfrac
未定义。你需要\usepackage{amsmath}
这个。然后你需要\draw
用分号结束该语句,所以:
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath} % <-- added
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw (0,0) node[below] {$O$};
\draw (0,0) -- (2,0) node[right] {$A$};
\draw (0,0) -- (2,2) node[right] {$B$};
\draw (1,0) arc (0:45:1);
\draw (22:1.3) node { $ \dfrac{\pi}{4} $ }; % <-- added semicolon
\end{tikzpicture}
\end{center}
\end{document}