Tikz 中的堆栈逻辑符号

Tikz 中的堆栈逻辑符号

我想在 tikz 中重现如下图表(取自 Sider 的哲学逻辑,第 189 页):

在此处输入图片描述

具体来说,我无法弄清楚如何堆叠符号,就像它们在这张图片中一样(在某些运算符上方有 1 和 0,星号在上面或下面)。我尝试使用和进行堆叠,\mathop\overset都没有产生我需要的结果。这是我当前的代码:

$$\mathop{\Diamond}_{*}^{1} \Box P \rightarrow \Box \Diamond P$$ % kind of squished together and doesn't work in tikz node environment

$$\overset{1}{\Diamond} \Box P \rightarrow \Box \Diamond P$$ \\% works in tikz node but squished together and no option to put something underneath


\begin{center}
\begin{tikzpicture}[>=stealth',shorten >=2pt,shorten <=2pt]

\node[rectangle,draw,minimum height=2cm] (1) [label=left:$a$] {$\Diamond  P \rightarrow \Box \Diamond P$};
\node[rectangle,draw,minimum height=2cm]  (2) [label=left:$b$, below left=of 1] {$\Box P$};
\node[rectangle,draw,minimum height=2cm] (3) [label=left:$c$, below right=of 1] {$\Diamond P$};

\path[->] (1) edge (2);
\path[->] (1) edge (3);

\end{tikzpicture}
\end{center}

答案1

可以使用 来获得堆叠array

\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,arrows,positioning}

\newenvironment{LfPmatrix}
 {$\renewcommand{\arraystretch}{1.2}%
  \setlength{\arraycolsep}{0pt}%
  \begin{array}{*{7}{c}}}
 {\end{array}$}

\begin{document}

\begin{tikzpicture}[>=stealth',shorten >=2pt,shorten <=2pt]

\node[rectangle,draw,minimum height=1.5cm] (1) [label=left:r\strut] 
  {\begin{LfPmatrix}
    \mathtt{1}&&&\mathtt{0}&\mathtt{0}\\
    \Diamond&\Box&P&\to&\Box&\Diamond&P\\
    {*}&&&&{*}
   \end{LfPmatrix}};
\node[rectangle,draw,minimum height=1.5cm] (2) [label=left:a\strut, below left=of 1]
  {\begin{LfPmatrix}
    {*} \\
    \mathtt{1} \\
    \Box&P
   \end{LfPmatrix}};
\node[rectangle,draw,minimum height=1.5cm] (3) [label=left:b\strut, below right=of 1] 
  {\begin{LfPmatrix}
    {*} \\
    \mathtt{0} \\
    \Diamond P
   \end{LfPmatrix}};

\path[->] (1) edge (2);
\path[->] (1) edge (3);

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容