3
\documentclass[11pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,footexclude,BCOR12mm,DIV13]{scrbook}

\usepackage{subfigure}
\usepackage{pgfplots} 
\usepackage{tikz-qtree}
\usepackage{subcaption}

\begin{document}

\tikzset{every tree node/.style={minimum width=2em,draw,circle},
         blank/.style={draw=none},
         edge from parent/.style=
         {draw, edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}},
         level distance=1.5cm}
\begin{figure}
    \centering
    \begin{subfigure}{\textwidth}
        \centering
        \begin{tikzpicture}
        \Tree
        [.*     
            [.A ] 
            [.* 
              [.B ]
             [.C ]
                ]
        ]
        \end{tikzpicture}
    \end{subfigure}
    \begin{subfigure}{\textwidth}
        \centering
        \begin{tikzpicture}
        \Tree
        [.*     
          [.* 
                [.A ]
                [.B ]] 
            [.C ]
        ]
        \end{tikzpicture}
    \end{subfigure}
    \caption{Expression trees for tensor-chain-multiplication}
    \label{fig:myExprTree}
\end{figure}
\end{document}

This command does not accept line-width, or textwidth as an argument, and things like that. What is wrong here? I would like to have the labeled with a and b, but not even that works ...

Or better yet, if you have a faster and moree elgeant solution, here is my desired final product, but not just right: LatexTreeFig

8
  • Are you using the subfigure package? If so, there is no environment named subfigure, just a command. And it does not take a width as an argument. Commented May 9, 2019 at 7:11
  • Yes i am using that, how can i change it? Commented May 9, 2019 at 7:12
  • Please tell us (a) which document class you employ and (b) whether or not the page is typeset in one-column or two-column mode.
    – Mico
    Commented May 9, 2019 at 7:13
  • Please also clarify whether you employ the subfigure or the subcaption package. (The subfigure package is deprecated.)
    – Mico
    Commented May 9, 2019 at 7:14
  • subfigure and subcaption are included Commented May 9, 2019 at 7:16

1 Answer 1

5

Do not load subfigure and subcaption:

\documentclass[11pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,footexclude,BCOR12mm,DIV13]{scrbook}

\usepackage{pgfplots} 
\usepackage{tikz-qtree}
\usepackage{subcaption}

\begin{document}

    \tikzset{every tree node/.style={minimum width=2em,draw,circle},
        blank/.style={draw=none},
        edge from parent/.style=
        {draw, edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}},
        level distance=1.5cm}
    \begin{figure}[!htb]
        \centering
        \begin{subfigure}{\textwidth}
            \centering
            \begin{tikzpicture}
            \Tree
            [.*     
            [.A ] 
            [.* 
            [.B ]
            [.C ]
            ]
            ]
            \end{tikzpicture}
        \end{subfigure}
        \begin{subfigure}{\textwidth}
            \centering
            \begin{tikzpicture}
            \Tree
            [.*     
            [.* 
            [.A ]
            [.B ]] 
            [.C ]
            ]
            \end{tikzpicture}
        \end{subfigure}
        \caption{Expression trees for tensor-chain-multiplication}
        \label{fig:myExprTree}
    \end{figure}

    \begin{figure}[!htb]
    \centering
    \begin{subfigure}{0.49\textwidth}
        \centering
        \begin{tikzpicture}
        \Tree
        [.*     
        [.A ] 
        [.* 
        [.B ]
        [.C ]
        ]
        ]
        \end{tikzpicture}
    \end{subfigure}\hfill
    \begin{subfigure}{0.49\textwidth}
        \centering
        \begin{tikzpicture}
        \Tree
        [.*     
        [.* 
        [.A ]
        [.B ]] 
        [.C ]
        ]
        \end{tikzpicture}
    \end{subfigure}
    \caption{Expression trees for tensor-chain-multiplication}
    \label{fig:myExprTree}
\end{figure}
\end{document}

enter image description here

You must log in to answer this question.

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