ボックスを2つに分割

ボックスを2つに分割

2 つの小さな図形を含む図形を作成する必要があります。2 つに分割されたボックスで、それぞれの側に構文ツリーを配置します。以下の 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}

このコードは 2 つの別々のボックスを作成しますが、これは私が望んでいることではありません。

答え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

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}

分割ボックス内の木

関連情報