! パッケージ tikz エラー: このパスを諦めます。セミコロンを忘れましたか?

! パッケージ tikz エラー: このパスを諦めます。セミコロンを忘れましたか?

tikz の動作についてかなり基本的なことが抜けているようです... 抜けているセミコロンがどこにあるのか本当にわかりません!

MWE:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[sibling distance=10em,
  every node/.style = {draw=none, fill=none}]]
  \node {What are the types of \code{a} and \code{b}?}
  child { \node {\code{int} and \code{int}}
    child { \node{Execute procedure \code{int\_add}. }; }; }
  child { \node {\code{float} and \code{float}}
    child { \node{Execute procedure \code{float\_add}.}; }; }
  child { \node {\code{float} and \code{int}}
    child { \node{Execute procedure \code{float\_plus\_int}.}; }; }
  child { \node {\code{int} and \code{float}}
    child { \node{Execute procedure \code{int\_plus\_float}.}; }; }
  child { \node {\code{string} and \code{string}}
    child { \node{Execute procedure \code{string\_concatenate}.}; }; }
  child { \node {Any other combination}
    child { \node{Raise \code{TypeError}.}; }; };
\end{tikzpicture}
\end{document}

答え1

  • ]オプションの後に誤った がありますtikzpicture(これは大きな害はありませんが、存在すべきではありません)。

  • 開き括弧の数が閉じ括弧の数より多くなっています。

  • \nodeツリー内の s は s (バックスラッシュなし) のみである必要があり、node終了セミコロンは必要ありません。

\documentclass{standalone}
\usepackage{tikz}
\newcommand\code[1]{\texttt{#1}}
\begin{document}
\begin{tikzpicture}[sibling distance=10em,
  every node/.style = {draw=none, fill=none}]]
  \node {What are the types of \code{a} and \code{b}?}
  child { node {\code{int} and \code{int}}
          child { node{Execute procedure \code{int\_add}. }
                }
          }
  child { node {\code{float} and \code{float}}
          child { node{Execute procedure \code{float\_add}.}
                }
        }
  child { node {\code{float} and \code{int}}
          child { node{Execute procedure \code{float\_plus\_int}.}
                }
        }
  child { node {\code{int} and \code{float}}
          child { node{Execute procedure \code{int\_plus\_float}.}
                }
        }
  child { node {\code{string} and \code{string}}
          child { node{Execute procedure \code{string\_concatenate}.}
                }
        }
  child { node {Any other combination}
          child { node{Raise \code{TypeError}.}
                }
        };
\end{tikzpicture}
\end{document}

ここに画像の説明を入力してください

関連情報