我想知道如何将分数分子\to
和\xrightarrow
分母的箭头与\xrightarrow
其他等式的箭头对齐?谢谢。
\begin{align*}
\frac{ e \to_\lambda e'}
{
\alpha, [R \blacktriangleright e \blacktriangleleft]_a \parallel \mu
\xrightarrow[]{[\text{fun}:a]}
\alpha, [R \blacktriangleright e' \blacktriangleleft]_a \parallel \mu
}
\\
\alpha, [R \blacktriangleright \texttt{new}(b) \blacktriangleleft]_a \parallel \mu
& \xrightarrow[]{[\text{new}:a,a']}
\alpha, [R \blacktriangleright a' \blacktriangleleft]_a, [\texttt{ready}(b)]_{a'} \parallel \mu
\\
\alpha, [R \blacktriangleright \texttt{send}(a',v) \blacktriangleleft]_a \parallel \mu
& \xrightarrow[]{[\text{snd}:a]}
\alpha, [R \blacktriangleright \texttt{nil} \blacktriangleleft]_a \parallel \mu \uplus \{ \langle a' \Leftarrow v \rangle \}
\\
\alpha, [R \blacktriangleright \texttt{ready}(b) \blacktriangleleft]_a \parallel \{ \langle a \Leftarrow v \rangle \uplus \mu
& \xrightarrow[]{[\text{rcv}:a,v]}
\alpha, [b(v)]_a \parallel \mu
\end{align*}
答案1
我相信您使用分数只是为了得到分隔线。
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array}
\usepackage{booktabs}
\newcommand{\qt}[1]{\blacktriangleright #1 \blacktriangleleft}
\begin{document}
\begin{equation*}
\setlength{\arraycolsep}{0pt}
\begin{array}{ r >{{}}c<{{}} l }
e & \to_\lambda & e' \\
\midrule
\alpha, [R \qt{e}]_a \parallel \mu
& \xrightarrow[]{[\text{fun}:a]} &
\alpha, [R \qt{e'}]_a \parallel \mu
\\\addlinespace
\alpha, [R \qt{\texttt{new}(b)}]_a \parallel \mu
& \xrightarrow[]{[\text{new}:a,a']} &
\alpha, [R \qt{a'}]_a, [\texttt{ready}(b)]_{a'} \parallel \mu
\\\addlinespace
\alpha, [R \qt{\texttt{send}(a',v)}]_a \parallel \mu
& \xrightarrow[]{[\text{snd}:a]} &
\alpha, [R \qt{\texttt{nil}}]_a \parallel \mu \uplus \{ \langle a' \Leftarrow v \rangle \}
\\\addlinespace
\alpha, [R \qt{\texttt{ready}(b)}]_a \parallel \{ \langle a \Leftarrow v \rangle \} \uplus \mu
& \xrightarrow[]{[\text{rcv}:a,v]} &
\alpha, [b(v)]_a \parallel \mu
\end{array}
\end{equation*}
\end{document}
如果你想均衡所有箭头:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array}
\usepackage{booktabs}
\newcommand{\qt}[1]{\blacktriangleright #1 \blacktriangleleft}
\newlength{\arlength}
\begin{document}
\begin{equation*}
\settowidth{\arlength}{$\scriptstyle[\text{new}:a,a']$}
% define a local helper command
\newcommand{\Arrow}[1]{\xrightarrow{\makebox[\arlength]{$\scriptstyle#1$}}}
\setlength{\arraycolsep}{0pt}
\begin{array}{ r >{{}}c<{{}} l }
e & \multicolumn{1}{>{$}c<{$}}{\;\rightarrowfill$_\lambda$\;} & e' \\
\midrule
\alpha, [R \qt{e}]_a \parallel \mu
& \Arrow{[\text{fun}:a]} &
\alpha, [R \qt{e'}]_a \parallel \mu
\\\addlinespace
\alpha, [R \qt{\texttt{new}(b)}]_a \parallel \mu
& \Arrow{[\text{new}:a,a']} &
\alpha, [R \qt{a'}]_a, [\texttt{ready}(b)]_{a'} \parallel \mu
\\\addlinespace
\alpha, [R \qt{\texttt{send}(a',v)}]_a \parallel \mu
& \Arrow{[\text{snd}:a]} &
\alpha, [R \qt{\texttt{nil}}]_a \parallel \mu \uplus \{ \langle a' \Leftarrow v \rangle \}
\\\addlinespace
\alpha, [R \qt{\texttt{ready}(b)}]_a \parallel \{ \langle a \Leftarrow v \rangle \} \uplus \mu
& \Arrow{[\text{rcv}:a,v]} &
\alpha, [b(v)]_a \parallel \mu
\end{array}
\end{equation*}
\end{document}
您可以通过修剪来模拟前两行中的分数\cmidrule
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array}
\usepackage{booktabs}
\newcommand{\qt}[1]{\blacktriangleright #1 \blacktriangleleft}
\newlength{\arlength}
\begin{document}
\begin{equation*}
\settowidth{\arlength}{$\scriptstyle[\text{new}:a,a']$}
\newcommand{\Arrow}[1]{\xrightarrow{\makebox[\arlength]{$\scriptstyle#1$}}}
\setlength{\arraycolsep}{0pt}
\begin{array}{ r >{{}}c<{{}} l }
e & \multicolumn{1}{>{$}c<{$}}{\;\rightarrowfill$_\lambda$\;} & e'
\\
\cmidrule[\fontdimen8\textfont3](l{8.7em}r{6.5em}){1-3}
\alpha, [R \qt{e}]_a \parallel \mu
& \Arrow{[\text{fun}:a]} &
\alpha, [R \qt{e'}]_a \parallel \mu
\\\addlinespace
\alpha, [R \qt{\texttt{new}(b)}]_a \parallel \mu
& \Arrow{[\text{new}:a,a']} &
\alpha, [R \qt{a'}]_a, [\texttt{ready}(b)]_{a'} \parallel \mu
\\\addlinespace
\alpha, [R \qt{\texttt{send}(a',v)}]_a \parallel \mu
& \Arrow{[\text{snd}:a]} &
\alpha, [R \qt{\texttt{nil}}]_a \parallel \mu \uplus \{ \langle a' \Leftarrow v \rangle \}
\\\addlinespace
\alpha, [R \qt{\texttt{ready}(b)}]_a \parallel \{ \langle a \Leftarrow v \rangle \} \uplus \mu
& \Arrow{[\text{rcv}:a,v]} &
\alpha, [b(v)]_a \parallel \mu
\end{array}
\end{equation*}
\end{document}
修剪量已通过目测计算;可以进行更精确的测量。