\subFigure{}를 사용하여 여러 숲 나무 배열

\subFigure{}를 사용하여 여러 숲 나무 배열

나는 나무를 2 x 2로 배열하고 싶습니다. 하지만 대신 다음과 같은 결과를 얻습니다.

여기에 이미지 설명을 입력하세요

내가 도대체 ​​뭘 잘못하고있는 겁니까? 내 오류를 찾을 수 없습니다.

\documentclass[a4paper,11pt]{article}
\usepackage{tikz}
\usepackage{subfigure}
\usepackage{array}

\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{forest}
\begin{document}
\begin{figure}[htbp]
\begin{tabular}{C{.48\textwidth}C{.48\textwidth}}
\subfigure [Subfigure 1] {
\resizebox{0.4\textwidth}{!}{%
\begin{forest}
for tree={delay={where content={}{content={\phantom{00}}}{}},s sep+=5mm,l+=5mm}
[,circle,fill=black,inner sep=1mm
  [,circle,fill=red,inner sep=0.5mm
        [,circle,draw,red,inner sep=0.25mm,edge={red}
        [,circle,draw,red,inner sep=0.25mm,edge={red}]
     ]
     [,circle,draw,red,inner sep=0.5mm
        [,circle,draw,red,inner sep=0.25mm,edge={red}]
     ] 
  ]
  [,circle,fill=blue,inner sep=0.5mm
     [,circle,draw,blue,inner sep=0.25mm,edge={blue}
     ] 
  ]
  [,circle,fill=green,inner sep=0.5mm]
  [,circle,fill=orange,inner sep=0.5mm
  ]
]
\end{forest}
}}&
\subfigure [Subfigure 2] {
    \resizebox{0.4\textwidth}{!}{%
\begin{forest}
for tree={delay={where content={}{content={\phantom{00}}}{}},s sep+=5mm,l+=5mm}
[,circle,fill=black,inner sep=1mm
  [,circle,fill=red,inner sep=0.5mm
     [,circle,draw,red,inner sep=0.25mm,edge={red}]
     [,circle,draw,red,inner sep=0.5mm 
     ] 
  ]
  [,circle,fill=blue,inner sep=0.5mm
     [,circle,draw,blue,inner sep=0.25mm,edge={blue}
        [,circle,draw,blue,inner sep=0.25mm,edge={blue}]
     ]
     [,circle,draw,blue,inner sep=0.25mm,edge={blue}
     ] 
  ]
  [,circle,fill=green,inner sep=0.5mm  
  ]
  [,circle,fill=orange,inner sep=0.5mm
  ]
]
\end{forest}
}}\
\subfigure [Subfigure 3]{
    \resizebox{0.4\textwidth}{!}{%
\begin{forest}
for tree={delay={where content={}{content={\phantom{00}}}{}},s sep+=5mm,l+=5mm}
[,circle,fill=black,inner sep=1mm
  [,circle,fill=red,inner sep=0.5mm]
  [,circle,fill=blue,inner sep=0.5mm]
  [,circle,fill=green,inner sep=0.5mm
        [,circle,draw,green,inner sep=0.25mm,edge={green}]
  ]
  [,circle,fill=orange,inner sep=0.5mm
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}]
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}
            [,circle,draw,orange,inner sep=0.25mm,edge={orange}]    
        ] 
  ]
]
\end{forest}
}}
\subfigure [Subfigure 4] {
    \resizebox{0.4\textwidth}{!}{%
\begin{forest}
for tree={delay={where content={}{content={\phantom{00}}}{}},s sep+=5mm,l+=5mm}
[,circle,fill=black,inner sep=1mm
  [,circle,fill=red,inner sep=0.5mm]
  [,circle,fill=blue,inner sep=0.5mm]
  [,circle,fill=green,inner sep=0.5mm
        [,circle,draw,green,inner sep=0.25mm,edge={green}]
        [,circle,draw,green,inner sep=0.25mm,edge={green}]
  ]
  [,circle,fill=orange,inner sep=0.5mm
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}]
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}]
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}
            [,circle,draw,orange,inner sep=0.25mm,edge={orange}]
        ] 
        ] 
  ]
]
\end{forest}
}}
\end{tabular}
\end{figure}
\end{document}

답변1

코드에서 이중 백슬래시 \\와 두 번째가 &누락되었습니다. (아래 코드에 표시된 위치를 참조하세요.)

여기에 이미지 설명을 입력하세요

\documentclass[a4paper,11pt]{article}
\usepackage{tikz}
\usepackage{subfigure}
\usepackage{array}

\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{forest}
\begin{document}
\begin{figure}[htbp]
\begin{tabular}{C{.48\textwidth}C{.48\textwidth}}
\subfigure [Subfigure 1] {
\resizebox{0.4\textwidth}{!}{%
\begin{forest}
for tree={delay={where content={}{content={\phantom{00}}}{}},s sep+=5mm,l+=5mm}
[,circle,fill=black,inner sep=1mm
  [,circle,fill=red,inner sep=0.5mm
        [,circle,draw,red,inner sep=0.25mm,edge={red}
        [,circle,draw,red,inner sep=0.25mm,edge={red}]
     ]
     [,circle,draw,red,inner sep=0.5mm
        [,circle,draw,red,inner sep=0.25mm,edge={red}]
     ] 
  ]
  [,circle,fill=blue,inner sep=0.5mm
     [,circle,draw,blue,inner sep=0.25mm,edge={blue}
     ] 
  ]
  [,circle,fill=green,inner sep=0.5mm]
  [,circle,fill=orange,inner sep=0.5mm
  ]
]
\end{forest}
}}&
\subfigure [Subfigure 2] {
    \resizebox{0.4\textwidth}{!}{%
\begin{forest}
for tree={delay={where content={}{content={\phantom{00}}}{}},s sep+=5mm,l+=5mm}
[,circle,fill=black,inner sep=1mm
  [,circle,fill=red,inner sep=0.5mm
     [,circle,draw,red,inner sep=0.25mm,edge={red}]
     [,circle,draw,red,inner sep=0.5mm 
     ] 
  ]
  [,circle,fill=blue,inner sep=0.5mm
     [,circle,draw,blue,inner sep=0.25mm,edge={blue}
        [,circle,draw,blue,inner sep=0.25mm,edge={blue}]
     ]
     [,circle,draw,blue,inner sep=0.25mm,edge={blue}
     ] 
  ]
  [,circle,fill=green,inner sep=0.5mm  
  ]
  [,circle,fill=orange,inner sep=0.5mm
  ]
]
\end{forest}
}}\\ % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE HERE HERE
\subfigure [Subfigure 3]{
    \resizebox{0.4\textwidth}{!}{%
\begin{forest}
for tree={delay={where content={}{content={\phantom{00}}}{}},s sep+=5mm,l+=5mm}
[,circle,fill=black,inner sep=1mm
  [,circle,fill=red,inner sep=0.5mm]
  [,circle,fill=blue,inner sep=0.5mm]
  [,circle,fill=green,inner sep=0.5mm
        [,circle,draw,green,inner sep=0.25mm,edge={green}]
  ]
  [,circle,fill=orange,inner sep=0.5mm
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}]
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}
            [,circle,draw,orange,inner sep=0.25mm,edge={orange}]    
        ] 
  ]
]
\end{forest}
}}& % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE HERE HERE
\subfigure [Subfigure 4] {
    \resizebox{0.4\textwidth}{!}{%
\begin{forest}
for tree={delay={where content={}{content={\phantom{00}}}{}},s sep+=5mm,l+=5mm}
[,circle,fill=black,inner sep=1mm
  [,circle,fill=red,inner sep=0.5mm]
  [,circle,fill=blue,inner sep=0.5mm]
  [,circle,fill=green,inner sep=0.5mm
        [,circle,draw,green,inner sep=0.25mm,edge={green}]
        [,circle,draw,green,inner sep=0.25mm,edge={green}]
  ]
  [,circle,fill=orange,inner sep=0.5mm
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}]
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}]
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}
        [,circle,draw,orange,inner sep=0.25mm,edge={orange}
            [,circle,draw,orange,inner sep=0.25mm,edge={orange}]
        ] 
        ] 
  ]
]
\end{forest}
}}
\end{tabular}
\end{figure}
\end{document}

관련 정보