4

I have encountered a problem

Package pgf Error: No shape named is known

but, I do not know what's wrong with it and how to fix it? Can anybody help me?

My code is as follows:

\documentclass{minimal}
\usepackage{tikz}
\usepackage{verbatim}
\usepackage{CJKutf8}
\usetikzlibrary{shapes}
\usepackage{amsmath}
\usepackage{xspace}
\newcommand{\A}{\ensuremath{\mathcal{A}}\xspace}
\newcommand{\B}{\ensuremath{\mathcal{B}}\xspace}
\newcommand\pa[1]{\ensuremath{\left(#1\right)}}
\begin{document}
\begin{CJK}{UTF8}{gbsn}
\begin{tikzpicture}[
grow=right,
level 1/.style={sibling distance=.5cm,level distance=5.2cm},
level 2/.style={sibling distance=3.5cm, level distance=3.7cm},
edge from parent/.style={very thick,draw=blue!40!black!60,
    shorten >=5pt, shorten <=5pt},
edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)},
kant/.style={text width=2cm, text centered, sloped},
every node/.style={text ragged, inner sep=2mm},
punkt/.style={rectangle, rounded corners, shade, top color=white,
bottom color=blue!50!black!20, draw=blue!40!black!60, very
thick }
]

\node[punkt, text width=4.5em] {未知相关\\估计信息}
%Lower part lv1
child {
    node[punkt, text width=4em]
       {完全未知}                 
%----------------------------------------------
             child {
        node [punkt,rectangle split, rectangle split,
        rectangle split parts=2] {
            \textbf{非随机意义下:}
            \nodepart{second}
            相关估计信息未知但有界                            }
        edge from parent
            node[below, kant,  pos=.6] {}
    }
    child {
        node [punkt, rectangle split, rectangle split parts=2]{
            \textbf{随机意义下:}
            \nodepart{second}
            互协方差信息未知但有界
        }
        edge from parent
            node[kant, above] {}}
        edge from parent{
            node[kant, below] {}}
    }

%Upper part, lv1

child {
    node[punkt, text width=4em] {部分未知}
    %child 1
    child {
        node [punkt,rectangle split, rectangle split,
        rectangle split parts=2] {
            \textbf{非随机意义下:}
            \nodepart{second}
            相关估计信息未知但有界                            }  
        edge from parent
            node[below, kant,  pos=.6] {}
    }
    %child 2
    child {
        node [punkt, rectangle split, rectangle split parts=2]{
            \textbf{随机意义下:}
            \nodepart{second}
            互协方差信息未知但有界
        }
        edge from parent
            node[kant, above] {}}
        edge from parent{
            node[kant, above] {}}
}

\end{tikzpicture}
\end{CJK}
\end{document}
3
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Why is this question tagged workflow?
    – cfr
    Commented Jan 25, 2015 at 15:38
  • Thanks for your efforts, my graph is a workflow chart, I thought tagging as workflow is okay, however, it seems tagging trees is more appropriate.
    – wayne
    Commented Jan 26, 2015 at 0:38
  • workflow in this context means the order in which you produce a document, for example, rather than the subject matter of the document. At least, that's what I've always assumed judging by how other people seem to use it e.g. how can I produce 2 PDFs from a .tex template and spreadsheet data or something.
    – cfr
    Commented Jan 26, 2015 at 3:42

1 Answer 1

5

A tree abhors a vacuum. You cannot leave blank lines like that in the middle of the tree.

Also, you need a semicolon to finish the path, and you need to change the sibling distance to prevent the upper and lower branches from overlapping each other.

I've also removed packages not needed in your MWE (but obviously you will want them in your document) and changed the class. minimal is not suitable for use in examples. standalone or article are recommended alternatives.

\documentclass[tikz,border=5pt]{standalone}
\usepackage{CJKutf8}
\usetikzlibrary{shapes}
\begin{document}
\begin{CJK}{UTF8}{gbsn}
\begin{tikzpicture}
  [
    grow=right,
    level 1/.style={sibling distance=5.5cm,level distance=5.2cm},
    level 2/.style={sibling distance=3.5cm, level distance=3.7cm},
    edge from parent/.style={very thick,draw=blue!40!black!60, shorten >=5pt, shorten <=5pt},
    edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)},
    kant/.style={text width=2cm, text centered, sloped},
    every node/.style={text ragged, inner sep=2mm},
    punkt/.style={rectangle, rounded corners, shade, top color=white, bottom color=blue!50!black!20, draw=blue!40!black!60, very thick }
  ]

  \node[punkt, text width=4.5em] {未知相关\\估计信息}
  %Lower part lv1
  child {
    node[punkt, text width=4em]
    {完全未知}
    %----------------------------------------------
    child {
      node [punkt,rectangle split, rectangle split, rectangle split parts=2] {
        \textbf{非随机意义下:}
        \nodepart{second}
        相关估计信息未知但有界}
      edge from parent
      node[below, kant,  pos=.6] {}
    }
    child {
      node [punkt, rectangle split, rectangle split parts=2]{
        \textbf{随机意义下:}
        \nodepart{second}
        互协方差信息未知但有界
      }
      edge from parent
      node[kant, above] {}}
    edge from parent{
      node[kant, below] {}}
  }
  %Upper part, lv1
  child {
    node[punkt, text width=4em] {部分未知}
    %child 1
    child {
      node [punkt,rectangle split, rectangle split,
      rectangle split parts=2] {
        \textbf{非随机意义下:}
        \nodepart{second}
        相关估计信息未知但有界}
      edge from parent
      node[below, kant,  pos=.6] {}
    }
    %child 2
    child {
      node [punkt, rectangle split, rectangle split parts=2]{
        \textbf{随机意义下:}
        \nodepart{second}
        互协方差信息未知但有界
      }
      edge from parent
      node[kant, above] {}}
    edge from parent{
      node[kant, above] {}}
  }
  ;

\end{tikzpicture}
\end{CJK}
\end{document}

tree

3
  • Why in your case, the package amsmath is removable, in my case, [overleaf.com/2150355kngjsq#/5482169/]. this package can not be removed, it will occur the error: "Undefined control sequence. \tikz@child@node@text ...le split parts=1]{ \text {�������������������������... l.52 ;" I do not know why it happened?
    – wayne
    Commented Jan 26, 2015 at 12:44
  • @WangyanLi \text{} does not occur in your MWE so amsmath can be dropped. Your document appears to use \text{}, so amsmath is required.
    – cfr
    Commented Jan 26, 2015 at 23:47
  • Yes, you're right, when I dropped the \text{} and amsmath, everything is fine now, thank you again.
    – wayne
    Commented Jan 27, 2015 at 0:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .