不常见的逻辑树类型

不常见的逻辑树类型

我正在尝试重现这样的树:

在此处输入图片描述

我知道它是用 Latex 创建的,但由于我是初学者,我真的不知道从哪里开始。是否可以在 TkiZ 中创建类似的东西?

答案1

可以使用以下方法生成此类图表TikZ;下面,使用 的选项matrix of math nodes

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}

\newcommand\mynot{\mathord{\sim}}

\begin{document}

\begin{tikzpicture}
\matrix[
  matrix of math nodes,
  row sep=-\pgflinewidth,
  column sep=-\pgflinewidth,
  nodes={
    text width=5em,
    inner xsep=7pt,
    text depth=0.75ex,
    text height=2ex
  },
  nodes in empty cells,
  column 1/.style={align=left},
  column 2/.style={align=right},
  column 3/.style={align=left},
  column 4/.style={align=right},
] (mat)
{
& 1 & 0 & \\
& \alpha\to\beta & & \\
& \mynot\beta\to\mynot\gamma & & \\
& \gamma & & \\
& & \alpha & \\
& |[align=left]|\mynot\beta & |[align=right]|\mynot\gamma & C1 \\
& \text{NO} & & N1  \\
\alpha & \beta & & C1 \\
};

% some additional labels
\node[label={right:$\gamma$},anchor=south,yshift=3pt] at (mat-7-3.south east) {};
\node[label={below:$X$},anchor=north,yshift=8pt] at (mat-7-3.south east) {};
\node[label={left:$\beta$},anchor=south,yshift=3pt] at (mat-7-1.south east) {};

% tiny lines at the bottom
\foreach \Colu in {1,3}
{
\draw 
  ([xshift=-4pt]mat-8-\Colu.south west) --
  ([xshift=4pt]mat-8-\Colu.south west)
;
\draw 
  ([xshift=-4pt,yshift=-2pt]mat-8-\Colu.south west) --
  ([xshift=4pt,yshift=-2pt]mat-8-\Colu.south west)
;
}

% thick lines inside the matrix
\begin{scope}[ultra thick]
\draw
  (mat-2-2.north west) --
  (mat-2-3.north east)
;
\draw 
  (mat-1-2.north east) --
  (mat-6-2.north east) --
  (mat-6-1.north east) --
  (mat-7-1.south east) --
  (mat-7-1.south west) --
  (mat-8-1.south west)
  ;
\draw 
  (mat-7-1.south east) --
  (mat-7-3.south west) --
  (mat-8-3.south west)
  ;
\draw 
  (mat-6-2.north east) --
  (mat-6-3.north east) --
  (mat-7-3.south east)
  ;
\end{scope}
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容