包 pgfkeys 错误:我不知道密钥‘/tikz/name 交集’

包 pgfkeys 错误:我不知道密钥‘/tikz/name 交集’

我正在按照 tiKz 和 PGF 手册 v3.0.0 中的教程使用以下 LaTeX 命令:

\begin{tikzpicture}[scale=3][>=latex']
    \clip (-0.1,-0.2) rectangle (1.1,1.51);
    \draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
    \draw[->] (-1.5,0) -- (1.5,0);
    \draw[->] (0,-1.5) -- (0,1.5);
    \draw (0,0) circle [radius=1cm];
    \filldraw[fill=green!20,draw=green!50!black] (0,0) -- (3mm,0mm)
    arc [start angle=0, end angle=30, radius=3mm] -- cycle;
    \draw[red,very thick] (30:1cm) -- +(0,-0.5);
    \draw[blue,very thick] (30:1cm) ++(0,-0.5) -- (0,0);
    \path [name path=upward line] (1,0) -- (1,1);
    \path [name path=sloped line] (0,0) -- (30:1.5cm);
    \draw [name intersection={of=upward line and sloped line, by=x}]
    [very thick,orange] (1,0) -- (x);
\end{tikzpicture}

我已经包含了\usetikzlibrary{intersections}但仍然收到以下错误:

 ! Package pgfkeys Error: I do not know the key '/tikz/name intersection' and Iam going to ignore it. Perhaps you misspelled it. See the pgfkeys package documentation for explanation.Type H <return> for immediate help.... ...on={of=upward line and sloped line, by=x}]

我在 Windows 7 64 位计算机上使用 TeXMaker v4.1.1,有什么建议吗?

答案1

name intersections={...}一个s,而您错过了最后一个s。在添加sHarish Kumar 的评论要求后\usetikzlibrary{intersections},您将获得以下内容。

在此处输入图片描述

代码

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}

\begin{tikzpicture}[scale=3][>=latex']
    \clip (-0.1,-0.2) rectangle (1.1,1.51);
    \draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
    \draw[->] (-1.5,0) -- (1.5,0);
    \draw[->] (0,-1.5) -- (0,1.5);
    \draw (0,0) circle [radius=1cm];
    \filldraw[fill=green!20,draw=green!50!black] (0,0) -- (3mm,0mm)
    arc [start angle=0, end angle=30, radius=3mm] -- cycle;
    \draw[red,very thick] (30:1cm) -- +(0,-0.5);
    \draw[blue,very thick] (30:1cm) ++(0,-0.5) -- (0,0);
    \path [name path=upward line] (1,0) -- (1,1);
    \path [name path=sloped line] (0,0) -- (30:1.5cm);
    \draw [name intersections={of=upward line and sloped line, by=x}]   % <-- Here
    [very thick,orange] (1,0) -- (x);
\end{tikzpicture}

\end{document}

相关内容