! Error del paquete tikz: abandonar este camino. ¿Olvidaste un punto y coma?

! Error del paquete tikz: abandonar este camino. ¿Olvidaste un punto y coma?

Parece que me estoy perdiendo algo bastante fundamental sobre cómo funciona tikz... ¡Realmente no puedo entender dónde está el punto y coma que me falta!

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}

Respuesta1

  • Hay un mensaje falso ]después de las opciones de tikzpicture(que no hace mucho daño, pero no debería estar ahí).

  • Hay más llaves de apertura que de cierre.

  • La \nodes dentro del árbol debe ser solo nodes (sin barra invertida), que no requiere punto y coma final.

.

\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}

ingrese la descripción de la imagen aquí

información relacionada