答案1
练习(如何绘制虚线和使用空单元格):
\documentclass[margin=3mm]{standalone}
\usepackage{tikz-cd}
\usepackage{amsmath}
\begin{document}
\begin{tikzcd}[nodes in empty cells]
X_1 \ar[r, "A"] \ar[dd, "B"']
& X_2 \ar[r, "A"] \ar[dd, "B"']
& X_3 \ar[r, "A"] \ar[dd, "B"']
& \dots \ar[r, "A"]
& X_{T-1} \ar[dd, "B"'] \\
\arrow[rrrr, dashed, -,
start anchor={[shift={(-3ex,2ex)}]north west},
end anchor ={[shift={( 3ex,2ex)}]north east}]
& & & & \\
& & & \dotsm &
\end{tikzcd}
\end{document}
完整再现所呈现的图像:
\documentclass[margin=3mm]{standalone}
\usepackage{tikz-cd}
\usepackage{amsmath}
\begin{document}
\begin{tikzcd}[nodes in empty cells]
\text{Markov process:}
& X_0 \ar[r, "A"] \ar[dd, "B"']
& X_1 \ar[r, "A"] \ar[dd, "B"']
& X_2 \ar[r, "A"] \ar[dd, "B"']
& \dots \ar[r, "A"]
& X_{T-1} \ar[dd, "B"'] \\
& \arrow[rrrr, dashed, -,
start anchor={[shift={(-3ex,2ex)}]north west},
end anchor ={[shift={( 3ex,2ex)}]north east}]
& & & & & \\
\text{Observations:}
& \mathcal{O}_0
& \mathcal{O}_1
& \mathcal{O}_2
& \dotsm
& \mathcal{O}_{T-1} \\
\end{tikzcd}
\end{document}
答案2
使用正常的matrix of math nodes
。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{amsmath}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of math nodes,column sep=2em,row sep=4em] (m) {
\text{Markov process}: &
X_0 & X_1 & X_2 & \cdots & X_{T-1}\\
\text{Observations}: &
\mathcal{O}_0 & \mathcal{O}_1 & \mathcal{O}_2 & \cdots & \mathcal{O}_{T-1}\\
};
\foreach \X in {2,3,4,5}
{\draw[-latex] (m-1-\X) -- (m-1-\the\numexpr\X+1) node[midway,above]{$A$};
\ifnum\X=5
\draw[-latex] (m-1-6) -- (m-2-6) node[pos=0.6,left]{$B$};
\else
\draw[-latex] (m-1-\X) -- (m-2-\X) node[pos=0.6,left]{$B$};
\fi}
\draw[dashed] ([yshift=1ex]m.east) -- ([yshift=1ex]m.east-|m-1-1.east);
\end{tikzpicture}
\end{document}