
두 개의 작은 도형으로 도형을 만들어야 합니다. 나는 그것이 양쪽에 구문 트리가 있는 두 개로 분할된 상자가 되기를 원합니다. 아래 MWE는 내가 시도하고 있는 것과 실패한 것을 보여줍니다.
\documentclass{article}
\usepackage{tikz-qtree}
\usepackage{ textcomp }
\newcommand\TR[1]{\textlangle#1\textrangle}
\begin{document}
\begin{figure}[ht]
\fbox{
\begin{minipage}[b]{0.5\linewidth}
\centering
\begin{tikzpicture}
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [ .NP [ .vP[DE] { } [ .v' v\\dai [ .VP { } [ .V' V\\\TR{dai} yanjing ] ] ] ] NP\\nanhai ]
\end{tikzpicture}
\caption{default}
\label{fig:figure1}
\end{minipage}
}
\hspace{0.5cm}
\fbox{
\begin{minipage}[b]{0.5\linewidth}
\centering
\begin{tikzpicture}
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [ .NP [ .vP[DE] { } [ .v' v\\dai [ .VP { } [ .V' V\\\TR{dai} yanjing ] ] ] ] NP\\nanhai ]
\end{tikzpicture}
\caption{default}
\label{fig:figure2}
\end{minipage}
}
\end{figure}
\end{document}
이 코드는 내가 원하는 것이 아닌 두 개의 별도 상자를 생성합니다.
답변1
분할된 상자와 같은 줄이 있는 테이블 형식 환경을 사용할 수 있습니다.
\documentclass{article}
\usepackage{tikz-qtree}
\usepackage{ textcomp}
\usepackage{array}
\newcommand\TR[1]{\textlangle#1\textrangle}
\begin{document}
\begin{figure}[ht]
\begin{tabular}{|*2{>{\centering\arraybackslash}p{0.5\linewidth}|}}
\hline
\begin{tikzpicture}
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [ .NP [ .vP[DE] { } [ .v' v\\dai [ .VP { } [ .V' V\\\TR{dai} yanjing ] ] ] ] NP\\nanhai ]
\end{tikzpicture}
& \begin{tikzpicture}
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [ .NP [ .vP[DE] { } [ .v' v\\dai [ .VP { } [ .V' V\\\TR{dai} yanjing ] ] ] ] NP\\nanhai ]
\end{tikzpicture}\\\hline
\end{tabular}
\end{figure}
\end{document}
각 나무에 대한 캡션이 필요한 경우 다음을 사용할 수 있습니다.subcaption
패키지.
또는 TikZ와 함께 분할된 직사각형 노드를 사용할 수 있습니다.
답변2
테두리가 겹치도록 두 상자 사이에 배치하는 공간을 수정할 수 있습니다. 기본적으로 규칙의 너비는 입니다 .4pt
. 그래서 당신은 얻을 것입니다 :
\documentclass{article}
\usepackage{tikz-qtree}
\usepackage{ textcomp }
\newcommand\TR[1]{\textlangle#1\textrangle}
\begin{document}
\begin{figure}[ht]
\fbox{
\begin{minipage}[b]{0.5\linewidth}
\centering
\begin{tikzpicture}
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [ .NP [ .vP[DE] { } [ .v' v\\dai [ .VP { } [ .V' V\\\TR{dai} yanjing ] ] ] ] NP\\nanhai ]
\end{tikzpicture}
\caption{default}
\label{fig:figure1}
\end{minipage}
}%
\hspace{-.4pt}%
\fbox{
\begin{minipage}[b]{0.5\linewidth}
\centering
\begin{tikzpicture}
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [ .NP [ .vP[DE] { } [ .v' v\\dai [ .VP { } [ .V' V\\\TR{dai} yanjing ] ] ] ] NP\\nanhai ]
\end{tikzpicture}
\caption{default}
\label{fig:figure2}
\end{minipage}
}
\end{figure}
\end{document}