pdf/Tikz 未定義の制御シーケンス

pdf/Tikz 未定義の制御シーケンス

私は2つのコマンドを使ってTikZで絵を描いています\draw
最初のコマンドは動作しますが、2番目のLaTeXでは

! Undefined control sequence. l.44 \draw (0,2) -- (-.5,2);

それを修正するにはどうすればいいでしょうか...
序文に感謝

編集: MWE

\begin{figure}[htbp]
\centering
\begin{tikz}
    % First the house
    \draw [thick,color=gray] (0,0) -- (0,2) -- (1,3) -- (2,2) -- (2,0) -- cycle (0,2) -- (2,2);
    % This command doesnt work...
    \draw (0,1) -- (-.5,1);
\end{tikz}
\end{figure}

答え1

これを試してください。うまくいくはずです。

\begin{tikzpicture}
% First the house
\draw [thick,color=gray] (0,0) -- (0,2) -- (1,3) -- (2,2) -- (2,0) -- cycle (0,2) -- (2,2);
% This command DOES work!
\draw (0,1) -- (-.5,1);
\end{tikzpicture}

関連情報