如何在 LaTeX 中构建这个动力学图?

如何在 LaTeX 中构建这个动力学图?

我有兴趣尝试对附图所示的图表进行编码。

在此处输入图片描述

到目前为止,我只能编写如下代码:

\begin{equation}

S_0 \overset{2\alpha}{\underset{\beta}{\leftrightarrows}} S_1 \overset{\alpha}{\underset{2\beta}{\leftrightarrows}} S_2,

\end{equation}

我如何获得垂直双箭头以便构建该图表?

谢谢。

答案1

初步近似

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}
S_{00}\arrow[r,shift left=2pt,"2\alpha"] \arrow[d,shift left=2pt,"\gamma"] 
& |[blue]| \arrow[l,shift left=2pt,"\beta"] \arrow[d,shift left=2pt,"\gamma"] 
S_{10} \arrow[r,shift left=2pt,"\alpha"]
& |[red]| \arrow[l,shift left=2pt,"2\beta"]  S_{20} \arrow[d,shift left=2pt,"\gamma"] \\
S_{01}\arrow[r,shift left=2pt,"\alpha"] \arrow[u,shift left=2pt,"\delta"] 
& |[blue]| \arrow[l,shift left=2pt,"\beta"]  S_{11} 
    \arrow[r,shift left=2pt,"\alpha"] \arrow[u,shift left=2pt,"\delta"]
& |[red]|  \arrow[l,shift left=2pt,"2\beta"]  S_{21} \arrow[u,shift left=2pt,"\delta"] \\
\end{tikzcd}\]
\end{document}

在此处输入图片描述

您可以使用样式来稍微简化一些事情。

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}[column sep=large,every arrow/.append style={shift left=2pt}]
S_{00}\arrow[r,"2\alpha"] \arrow[d,"\gamma"] 
& |[blue]| \arrow[l,"\beta"] \arrow[d,"\gamma"] 
S_{10} \arrow[r,"\alpha"]
& |[red]| \arrow[l,"2\beta"]  S_{20} \arrow[d,"\gamma"] \\
S_{01}\arrow[r,"\alpha"] \arrow[u,"\delta"] 
& |[blue]| \arrow[l,"\beta"]  S_{11} 
    \arrow[r,"\alpha"] \arrow[u,"\delta"]
& |[red]|  \arrow[l,"2\beta"]  S_{21} \arrow[u,"\delta"] \\
\end{tikzcd}\]
\end{document}

在此处输入图片描述

当然,手动添加列和行索引有点无聊,所以让我们让 TiZ 处理好这件事。

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}[column sep=large,every arrow/.append style={shift left=2pt},
    /tikz/cells={nodes={execute at begin node=S_{\the\numexpr\pgfmatrixcurrentcolumn-1\relax\the\numexpr\pgfmatrixcurrentrow-1\relax}}},
    /tikz/column 2/.style={blue},/tikz/column 3/.style={red}]
\arrow[r,"2\alpha"] \arrow[d,"\gamma"] 
& \arrow[l,"\beta"] \arrow[d,"\gamma"] 
 \arrow[r,"\alpha"]
& \arrow[l,"2\beta"]   \arrow[d,"\gamma"] \\
\arrow[r,"\alpha"] \arrow[u,"\delta"] 
& \arrow[l,"\beta"]   
    \arrow[r,"\alpha"] \arrow[u,"\delta"]
&  \arrow[l,"2\beta"]   \arrow[u,"\delta"] \\
\end{tikzcd}\]
\end{document}

在此处输入图片描述

答案2

您还可以使用环境构建这样的图表psmatrix

\documentclass{article}
 \usepackage{pst-node}
\usepackage{auto-pst-pdf}

\begin{document}

\[ \psset{arrows=->, arrowinset=0.1, linewidth=0.5pt, nodesep=3pt, labelsep=2pt,shortput=nab}%
 \everypsbox{\scriptstyle}
 \begin{psmatrix}[rowsep=1cm]
 %%%nodes
 S_{00} & {\color{blue}S_{10}} &{\color{red}S_{20}} \\
 S_{01} & {\color{blue}S_{11}} & {\color{red}S_{21}}
 %%% horizontal arrows
 \psset{offset =0.5ex, nodesep=2pt}
 \ncline{1,1}{1,2}^{2\alpha} \ncline{1,2}{1,3}^{\alpha}
 \ncline{1,2}{1,1}_{\beta} \ncline{1,3}{1,2}_{2\beta}
 \ncline{2,1}{2,2}^{\alpha} \ncline{2,2}{2,3}^{\alpha}
 \ncline{2,2}{2,1}_{\beta} \ncline{2,3}{2,2}_{2\beta}
 %%% vertical arrows
 \psset{offset=-0.5ex}
 \foreach \i in{1,2,3}{\ncline{1,\i}{2,\i}<{\gamma} \ncline{2,\i}{1,\i}>{\delta}}
 \end{psmatrix}
 \]

\end{document} 

在此处输入图片描述

答案3

xypic 包也擅长这种图表。

在此处输入图片描述

\documentclass[border=5mm]{standalone}
\usepackage[all]{xy}
\usepackage{xcolor}
\begin{document}
\xymatrix@C=1in@R=0.5in{
               S_{00} \ar @<-2pt> [d]_{\gamma} \ar @<2pt> [r]^{2\alpha} 
& \color{blue} S_{10} \ar @<-2pt> [d]_{\gamma} \ar @<2pt> [r]^{\alpha} \ar @<2pt> [l]^{\beta} 
& \color{red}  S_{20} \ar @<-2pt> [d]_{\gamma}                         \ar @<2pt> [l]^{2\beta} 
\\
               S_{01} \ar @<-2pt> [u]_{\delta} \ar @<2pt> [r]^{2\alpha} 
& \color{blue} S_{11} \ar @<-2pt> [u]_{\delta} \ar @<2pt> [r]^{\alpha} \ar @<2pt> [l]^{\beta} 
& \color{red}  S_{21} \ar @<-2pt> [u]_{\delta}                         \ar @<2pt> [l]^{2\beta} 
\\
}
\end{document}

笔记

  • 可选\xymatrix@C=1in列间距设置为 1 英寸...
  • ...并将@R=0.5in行距设置为 0.5 英寸
  • 细胞被分开&\\就像tabulararray
  • \ar每个箭头由带有三个修饰符的命令 绘制
    • @...影响箭头的确切位置,在这种情况下<dimen>箭头会向侧面移动。您也可以尝试@/_/@/^/使其稍微弯曲。
    • [..]确定箭头指向的位置,因此[d]意味着向下一个单元格,[r]向右一个单元格,依此类推。
    • ^{....}或者_{....}在箭头的左侧或右侧添加标签。
  • 空格通常是可选的,我在这里使用它们来使内容整齐地排列。

优秀的手册中解释了更多的控制:texdoc xy

相关内容