在SL树的两侧添加文本

问题描述

我需要创建一个this tree的树。我到目前为止编写的代码

\documentclass[11pt,a4paper]{article}

% Packages
\usepackage{amsmath,amssymb,amstext}
\usepackage[linguistics]{forest}

% Margins
\usepackage[a4paper,margin=2cm]{geometry}

% Renew Commands
\renewcommand{\land}{~\&~}
\renewcommand{\implies}{\supset}
\renewcommand{\iff}{\equiv}

% Document
\begin{document}
    \begin{forest}
        [$(E \implies \lnot (P \lor Q)) \land ((Q \land E) \lor (E \land P))$
            [$E \implies \lnot (P \lor Q)$ \\ $(Q \land E) \lor (E \land P)$
                [$E \land (Q \lor P)$
                    [$E$\\$Q \lor P$
                        [$\lnot (P \lor Q)$
                            [$\lnot P \land \lnot Q$
                                [$\lnot P$\\$\lnot Q$
                                    [$Q$
                                        [$\times$]
                                    ]
                                    [$P$
                                        [$\times$]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ]
    \end{forest}
\end{document}

到目前为止,哪个产生this tree。指定的是,我需要一个最左边的列,该列包含左对齐的编号,一个右边的列包含规则的左对齐的说明。如果您可以提供一种方法,将所有节点均等地隔开,以使左列和右列与节点对齐,那也将非常有帮助。谢谢!

解决方法

没关系,我通过使用tikz-picture而不是森林来解决它:

\begin{tikzpicture}[level/.style={sibling distance=100mm/#1},baseline,>=latex,every text node part/.style={align=center},font=\sffamily
                    ]
                    
    \node (1a){$(E \implies \lnot [P \lor Q]) \land ([Q \land E] \lor [E \land P])$}
        child {node {$E \implies \lnot (P \lor Q)$ \\ $(Q \land E) \lor (E \land P)$}
            child {node {$\lnot E$}
                child {node {$Q \land E$}
                    child {node {$Q$\\$E$}
                         child {node {$\times$}}}
                    }
                child {node {$E \land P$}
                    child {node {$E$\\$P$}
                        child {node {$\times$}}}
                    }
                }
            child {node {$\lnot (P \lor Q)$}
                child {node {$Q \land E$}
                    child {node {$Q$\\$E$}
                        child {node {$\lnot P$\\$\lnot Q$}
                            child {node {$\times$}}}
                        }
                    }
                child {node {$E \land P$}
                    child {node {$E$\\$P$}
                        child {node {$\lnot P$\\$\lnot Q$}
                            child {node {$\times$}}}
                        }
                    }
                }
            };
                    
    \node[left=3 of 1a] {1}edge from parent[draw=none]
        child {node {2\\3}edge from parent[draw=none]
            child {node {4}edge from parent[draw=none]
                child {node {5}edge from parent[draw=none]
                    child {node {6\\7}edge from parent[draw=none]
                        child {node {8\\9}edge from parent[draw=none]}
                    }
                }
            }
        };
                    
    \node[right=3 of 1a] {$\Phi$}edge from parent[draw=none]
        child {node {$1 \land$}edge from parent[draw=none]
            child {node {$2 \implies$}edge from parent[draw=none]
                child {node {$3 \lor$}edge from parent[draw=none]
                    child {node {$5 \land$}edge from parent[draw=none]
                        child {node {$4 \lnot \lor$}edge from parent[draw=none]}
                    }
                }
            }
        };
                
\end{tikzpicture}

哪个产生this。这是通过使第一棵树(主要的树向下生长),第二棵树(用于编号)和最后一棵树(用于所使用的规则)而起作用的。