乳胶数学表达式中的新行

New line in latex mathematical expression

我正在用 Latex 绘制图表,其中每个节点都有一组逻辑表达式。我想用换行符分隔节点中的每个公式。这是我的尝试:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\begin{document}
    \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2cm,
                        thick,main node/.style={draw,minimum size=8mm}]
    
      \node[main node] (a) {$ \diamond(p \wedge \urcorner p) $};
      \node[main node] (b) [below right = of a] {$ \diamond(p \wedge \urcorner p)\ast $
       \ $\circ \diamond(p \wedge \urcorner p) $};

    
      \path[every node/.style={font=\sffamily\small}]
        (a) edge node [right] {} (b)
    \end{tikzpicture}
\end{document}

我想要在节点 b 中的 * 和圆圈之间换行

  • \urcorner默认没有定义,你要么需要一个提供它的包,要么定义宏

  • 在最后一条路径后缺少 ;

  • 对于节点中的换行符,节点需要有一个宽度,例如text width=...


\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\usepackage{stix}
\begin{document}
    \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2cm,
                        thick,main node/.style={draw,minimum size=8mm}]
    
      \node[main node] (a) {$ \diamond(p \wedge \urcorner p) $};
      \node[main node, text width=1.5cm] (b) [below right = of a] {$ \diamond(p \wedge \urcorner p)\ast $
       \ $\circ \diamond(p \wedge \urcorner p) $};

    
      \path[every node/.style={font=\sffamily\small}]
        (a) edge node [right] {} (b);
    \end{tikzpicture}
\end{document}