3

I was wondering how to align the arrows \to and \xrightarrow in the numerator and denominator of the fraction with the arrows \xrightarrow of the other equations? Thanks.

\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*}

enter image description here

8
  • Welcome to TeX.SE. Your question isn't entirely clear, I'm afraid. For instance, what should the \to in the numerator of the fraction be aligend with? Second, the four ` \xrightarrow` directives end up producing four different arrow lengths; how should these arrows of different lengths be aligned with regard to one another?
    – Mico
    Oct 17, 2021 at 12:59
  • Question updated. Thank you
    – Ben
    Oct 17, 2021 at 13:13
  • 1
    So you want that the arrows have the same length?
    – egreg
    Oct 17, 2021 at 13:31
  • @egreg No, he wants the arrows in the upper expression (in the fractional expression) to coincide with the arrows in the lower expression. (As I understand) Oct 17, 2021 at 13:54
  • 1
    Is it really a fraction, or are you just trying to provide a horizontal line? The latter can be got with \hline. Oct 17, 2021 at 14:11

1 Answer 1

3

I believe you used the fraction just to get a divider line.

\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}

enter image description here

If you want to equalize all arrows:

\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}

enter image description here

You can emulate a fraction in the first two rows by trimming a \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}

enter image description here

The amount of trimming has been computed by eye; it could be possible to measure it more precisely.

2
  • Thanks. It is a fraction
    – Ben
    Oct 17, 2021 at 21:09
  • @Ben I added a version that might suit you.
    – egreg
    Oct 17, 2021 at 21:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .