
Mir scheint, als übersehe ich etwas ziemlich Grundlegendes zur Funktionsweise von Tikz ... Ich kann wirklich nicht herausfinden, wo mein fehlendes Semikolon ist!
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}
Antwort1
]
Nach den Optionen von steht ein „unecht“tikzpicture
(was nicht viel Schaden anrichtet, aber nicht da sein sollte).Es gibt mehr öffnende als schließende Klammern.
Die
\node
s innerhalb des Baums sollten nurnode
s (ohne Backslash) sein, für die keine abschließenden Semikolons erforderlich sind.
.
\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}