Good day. I have problem on creating a node and its name. Here is the code number 1 and 2.

\documentclass[a4paper, 12pt]{article}
% Preamble

% Packages used for input and output display.

% package used for images and colors.

% Page layout.
% Package used for diagram.
% beginning document.

% Steps 1. 
% 1. create  a node.
% 2. 
  \node{root}             % code 1.
     child{node{Arrows}}  % This command works.
  \node[root]{Data}   %  code 2. does not work



In the above code 1 works while code 2 does not work.

1 Answer 1


Your code as is doesn't work simply because you forgotten to end the first \node instruction with a semicolon.

But even adding that missing semicolon your second node doesn't work because you haven't defined a style named root. You have \node[root]{Data};. Here root is a style for the node, because it's in square brackets, while Data is the content of the node, in curly braces.

\usepackage{tikz} % loads xcolor and graphicx
\begin{tikzpicture}[root/.style={}] % defined empty root style
  \node{groot}             % code 1.
     child{node{Arrows}};  % <-- added semicolon
  \node[root]{Data};    % note this is placed in the same place as the first node of the tree, because you didn't specify the position of any of them

  • Thank you very much Torbjørn . Aug 3 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.