
我似乎遺漏了一些關於 tikz 工作原理的相當基本的東西......我真的不知道我丟失的分號在哪裡!
微量元素:
\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 應該只是snode
(不含反斜線),不需要以分號結尾。
。
\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}