5

Any ideia of how I can expand the \xrightarrow so that they all have the same size? (for aesthetics)

\documentclass{article}

\usepackage{amsmath}   % \text nas equacoes
\usepackage{mathrsfs}

\begin{document}

Network reaction model:

\def\Ph{\text{P}_\text{h}}

\[\begin{array}{llrrrcrrr}
\mathscr{R}_1: & & x_i & + & v_j & \xrightarrow{\frac{1}{l^4}p_0\Ph(i,j)} & (n_x+1)x_i & + & v_j \\
\mathscr{R}_2: & & x_i & + & v_j & \xrightarrow{\frac{1}{l^4}p_v} & y_i & + & yv_{0,j} \\
\mathscr{R}_3: & & & & yv_{5,i} & \xrightarrow{b_v} & 5v_i & - & y_j \\
\mathscr{R}_4: & & & & yv_{t<5,i} & \xrightarrow{b_v} & yv_{t+1,i} & & \\
\mathscr{R}_5: & & y_i & + & z_j & \xrightarrow{\frac{1}{l^4}k_0\Ph(i,j)} & z_j & - & yv_{t,k} \\
\mathscr{R}_6: & & y_i & + & z_j & \xrightarrow{\frac{1}{l^4}p_0'\Ph(i,j)} & n_yz_j & & \\
\mathscr{R}_7: & & & & v_i & \xrightarrow{(dv_0+(1-dv_0))\text{cd4Hill}(i)} & 0 & & \\
\mathscr{R}_8: & & & & z_i & \xrightarrow{dy_0(1-\text{cd4Hill}(i)} & 0 & & \\
\mathscr{R}_9: & & & & 0 & \xrightarrow{lx_0dx_0} & x_i & & \\
\mathscr{R}_{10}: & & & & 0 & \xrightarrow{ly_0dy_0} & z_i & & \\
\end{array}\]

\end{document}

output

The arrows should expand to fill up the space:

desired

PS: I am using array, but I am open to suggestions!

1
  • Use one of the phantom commands.
    – JPi
    Apr 4, 2015 at 22:50

2 Answers 2

3

You can use a box with width of the widest entry.

\documentclass{article}

\usepackage{amsmath}   % \text nas equacoes
\usepackage{mathrsfs}
\usepackage{calc}
\newlength{\mylen}
\settowidth{\mylen}{$(dv_0+(1-dv_0))\text{cd4Hill}(i)$}
\newcommand{\mb}[1]{\makebox[\mylen]{$#1$}}

\begin{document}

Network reaction model:

\def\Ph{\text{P}_\text{h}}

\[\begin{array}{llrrrcrrr}
\mathscr{R}_1: & & x_i & + & v_j & \xrightarrow{\mb{\frac{1}{l^4}p_0\Ph(i,j)}} & (n_x+1)x_i & + & v_j \\
\mathscr{R}_2: & & x_i & + & v_j & \xrightarrow{\mb{\frac{1}{l^4}p_v}} & y_i & + & yv_{0,j} \\
\mathscr{R}_3: & & & & yv_{5,i} & \xrightarrow{\mb{b_v}} & 5v_i & - & y_j \\
\mathscr{R}_4: & & & & yv_{t<5,i} & \xrightarrow{\mb{b_v}} & yv_{t+1,i} & & \\
\mathscr{R}_5: & & y_i & + & z_j & \xrightarrow{\mb{\frac{1}{l^4}k_0\Ph(i,j)}} & z_j & - & yv_{t,k} \\
\mathscr{R}_6: & & y_i & + & z_j & \xrightarrow{\mb{\frac{1}{l^4}p_0'\Ph(i,j)}} & n_yz_j & & \\
\mathscr{R}_7: & & & & v_i & \xrightarrow{\mb{(dv_0+(1-dv_0))\text{cd4Hill}(i)}} & 0 & & \\
\mathscr{R}_8: & & & & z_i & \xrightarrow{\mb{dy_0(1-\text{cd4Hill}(i)}} & 0 & & \\
\mathscr{R}_9: & & & & 0 & \xrightarrow{\mb{lx_0dx_0}} & x_i & & \\
\mathscr{R}_{10}: & & & & 0 & \xrightarrow{\mb{ly_0dy_0}} & z_i & & \\
\end{array}\]

\end{document}

enter image description here

3

A bit of a hack, but for a one off table it can work; the width of 1.5cm for each of the two columns has been found by trial and error.

The trick is to define two commands: a filling stem and a filling arrow with a given width; between these a zero width box containing the raised label. I removed the \frac{1}{l^4}, preferring the slashed form (the denominator becomes unreadable, otherwise).

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathrsfs}

\newcommand\Ph{\mathrm{P}_{\mathrm{h}}}

\makeatletter
\newcommand{\msfill}[1]{%
  \smash{-}%
  \mkern-7mu
  \cleaders\hbox{$\m@th\mkern-2mu \smash{-}\mkern-2mu$}\hskip#1
  \mkern-7mu
  \smash{-}
}

\newcommand{\mrfill}[1]{%
  \smash{-}%
  \mkern-7mu
  \cleaders\hbox{$\m@th\mkern-2mu \smash{-}\mkern-2mu$}\hskip#1
  \mkern-7mu
  \mathord\rightarrow
}

\newcommand{\frightarrow}[1]{%
  \msfill{1.5cm} &
  \makebox[0pt]{\raisebox{1.5ex}{$\scriptstyle#1$}}
  & \mrfill{1.5cm}%
}


\begin{document}

Network reaction model:


\[
\begin{array}{l@{}lrrrc@{\hspace{-3pt}}c@{\hspace{-3pt}}crrr}
\mathscr{R}_1&: & x_i & + & v_j & \frightarrow{p_0\Ph(i,j)/l^4} & (n_x+1)x_i & + & v_j \\
\mathscr{R}_2&: & x_i & + & v_j & \frightarrow{p_v/l^4} & y_i & + & yv_{0,j} \\
\mathscr{R}_3&: & & & yv_{5,i} & \frightarrow{b_v} & 5v_i & - & y_j \\
\mathscr{R}_4&: & & & yv_{t<5,i} & \frightarrow{b_v} & yv_{t+1,i} & & \\
\mathscr{R}_5&: & y_i & + & z_j & \frightarrow{k_0\Ph(i,j)/l^4} & z_j & - & yv_{t,k} \\
\mathscr{R}_6&: & y_i & + & z_j & \frightarrow{p_0'\Ph(i,j)/l^4} & n_yz_j & & \\
\mathscr{R}_7&: & & & v_i & \frightarrow{(dv_0+(1-dv_0))\mathrm{cd4Hill}(i)} & 0 & & \\
\mathscr{R}_8&: & & & z_i & \frightarrow{dy_0(1-\mathrm{cd4Hill}(i)} & 0 & & \\
\mathscr{R}_9&: & & & 0 & \frightarrow{lx_0dx_0} & x_i & & \\
\mathscr{R}_{10}&: & & & 0 & \frightarrow{ly_0dy_0} & z_i & & \\
\end{array}\]

\end{document}

enter image description here

1
  • Very much appreciate you taking the trouble. I have used your use of l@{} for array and \scriptstyle#1 for the arrow superscript ... I really appreciated it!, but I used something more similar to the other answer, so I will have to give him the credit ... :/ Apr 5, 2015 at 21:53

You must log in to answer this question.

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