# Vertical and horizontal spacing in a two-line equation

I wrote the following:

$$\begin{array}{lcl} w_{\frac{mn}{m+1}-\rho} & = & m(\dfrac{n-2}{1+\varepsilon_1})(m^{-\frac{mn}{m+1}+\rho}){{n-2} \choose {\frac{mn}{m+1}-\rho}} ^{-1} \prod_{i=1}^{\frac{mn}{m+1}-\rho} (1+ \varepsilon_i)\\ & = & (1+o(1))n \cdot m^{-\frac{mn}{m+1}+\rho-1}{{n-2} \choose {\frac{mn}{m+1}-\rho}} ^{-1} \prod_{i=1}^{\frac{mn}{m+1}-\rho} (1+ \varepsilon_i)\\ \end{array}$$


The output is as attached.

1. How can I make the binomial part look "taller" or nicer?

2. How can I make the spacing between lines are more as it looks very messy and cramp?

3. How can I make the writings on top and bottom of the \prod sign instead of beside it?

4. Anyhow can make it nicer?

Thank you.

• By my count, the term \frac{mn}{m+1}-\rho occurs 7 times in the two lines. Are you open to setting, say, M=\frac{mn}{m+1}-\rho and then using M wherever applicable? For sure, the equations will look a lot simpler... – Mico Aug 4 '15 at 13:29

Package amsmath provides lots of macros and environments for mathematical typesetting. Environment align can be used instead of an additional array for aligning (with \nonumber one of the equation numbers can be suppressed if necessary). Alternatively, environment aligned can be used inside equation. With the proper environments, the math is set in \displaystyle, generating a larger binomial expression and the limits above and below the \prod symbol.

Macro \binom makes it easier to set the binomial expression. Also I have applied a small spacing correction for the superscript after the closing parentheses.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
w_{\frac{mn}{m+1}-\rho}
& =
m(\dfrac{n-2}{1+\varepsilon_1})(m^{-\frac{mn}{m+1}+\rho})
\binom{n-2}{\frac{mn}{m+1}-\rho}^{\!-1}
\prod_{i=1}^{\frac{mn}{m+1}-\rho} (1+\varepsilon_i)\\
& =
(1+o(1))n \cdot m^{-\frac{mn}{m+1}+\rho-1}
\binom{n-2}{\frac{mn}{m+1}-\rho}^{\!-1}
\prod_{i=1}^{\frac{mn}{m+1}-\rho} (1+\varepsilon_i)
\end{align}
\end{document}


I would like to suggest you make the following changes:

• Instead of an array environment, use an align environment. Increase the vertical separation between the rows a bit.

• Don't use the {{... \choose ...}} "Plain-TeX" syntax. Instead, use the amsmath macro \binom{...}{...}.

• Reduce the space between the binomial term and the following {-1} exponent, and widen the space between the {-1} exponent and the following product symbol.

• Use \smashoperator directives to snug up the (1+ \varepsilon_i) terms to the product symbols.

• To emphasize that some "items" are in sub- or superscript positions, insert a \mathstrut in the corresponding super- and subscript positions. The result will be that it's more obvious what's sub- and superscript material. This affects the subscript to w and the superscripts to m.

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{align}
w_{\frac{mn}{m+1}-\rho}^{\mathstrut}
&= m\biggl(\frac{n-2}{1+\varepsilon_1}\biggr)
m_{\mathstrut}^{-\frac{mn}{m+1}+\rho}
\binom{n-2}{\frac{mn}{m+1}-\rho} ^{\!-1} \,
\smashoperator[r]{\prod_{i=1}^{\frac{mn}{m+1}-\rho}} (1+ \varepsilon_i)
\notag\\[2ex]  % only one equation number for the entire expression
&= \bigl(1+o(1)\bigr)n \cdot
m_{\mathstrut}^{-\frac{mn}{m+1}+\rho-1}
\binom{n-2}{\frac{mn}{m+1}-\rho} ^{\!-1} \,
\smashoperator[r]{\prod_{i=1}^{\frac{mn}{m+1}-\rho}} (1+ \varepsilon_i)
\end{align}
\end{document}


Addendum: By my count, the unwieldy-looking term \frac{mn}{m+1}-\rho occurs seven [7!] times in this two-row expression. You may want to define, say, M=\frac{mn}{m+1}-\rho and then generate the following, (IMNSHO) much more pleasant looking formula: \documentclass{article} \usepackage{amsmath} % for "align" environment and "\binom" macro \begin{document} SetM=\frac{mn}{m+1}-\rho\$. Then
\begin{align}
w_{M}^{}
&= m \frac{n-2}{1+\varepsilon_1}
m^{-M}
\binom{n-2}{M} ^{\!\!-1}
\prod_{i=1}^{M} (1+ \varepsilon_i)
\notag\\  % only one equation number for the entire expression
&= \bigl(1+o(1)\bigr)n m^{-M+1}
\binom{n-2}{M} ^{\!\!-1}
\prod_{i=1}^{M} (1+ \varepsilon_i)
\end{align}
\end{document}


How about this? You actually do not use the functions provided by array, so I'd suggest you use align* from the amsmath package.

I use \\[<dimension>] to add some space to a line break, e.g. \\[5pt].

Use \binom{a}{b} instead of a choose b.

And use \left( ... \right) to have parentheses adapt automatically.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
w_{\frac{mn}{m+1}-\rho} & = m\left(\frac{n-2}{1+\varepsilon_1}\right)\left(m^{-\frac{mn}{m+1}+\rho}\right)\binom{n-2}{\frac{mn}{m+1}-\rho}^{-1} \prod_{i=1}^{\frac{mn}{m+1}-\rho} (1+ \varepsilon_i)\\[\medskipamount]
&= (1+o(1))n \cdot m^{-\frac{mn}{m+1}+\rho-1}\binom{n-2}{\frac{mn}{m+1}-\rho}^{-1} \prod_{i=1}^{\frac{mn}{m+1}-\rho} (1+ \varepsilon_i)
\end{align*}

\end{document}


Or like this:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$$\begin{split} w_{\frac{mn}{m+1}-\rho} & = m\left(\dfrac{n-2}{1+\varepsilon_1}\right) m^{-\frac{mn}{m+1}+\rho} {{n-2}\choose{\frac{mn}{m+1}-\rho}}^{-1} \prod_{i=1}^{\frac{mn}{m+1}-\rho} (1 + \varepsilon_i) \\ & = (1+o(1))n m^{-\frac{mn}{m+1}+\rho-1} {{n-2}\choose{\frac{mn}{m+1}-\rho}}^{-1} \prod_{i=1}^{\frac{mn}{m+1}-\rho} (1 + \varepsilon_i) \end{split}$$
\end{document}


Math environment split preserve choose in display style. Or alternatively, as asked in the comment:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
XXXX
\begin{align}
w_{\frac{mn}{m+1}-\rho} & =
m\left(\dfrac{n-2}{1+\varepsilon_1}\right)
m^{-\frac{mn}{m+1}+\rho}
\binom{n-2}{\frac{mn}{m+1}-\rho}^{-1}
\prod_{i=1}^{\frac{mn}{m+1}-\rho} (1 + \varepsilon_i)
\notag  \\
& =
(1+o(1))n m^{-\frac{mn}{m+1}+\rho-1}{{n-2}
\choose{\frac{mn}{m+1}-\rho}}^{-1}
\prod_{i=1}^{\frac{mn}{m+1}-\rho} (1 + \varepsilon_i)
\end{align}
\end{document}


which gives:

• Hi, Zarko. What if I want the equation sign (1) on the last line instead of the middle? – Sara Aug 4 '15 at 10:03
• Then instead begin{equation}\begin{split} use just \begin{align}, ended with end{align}, the same as show Heiko aOberdiek and end first line width \notag \. – Zarko Aug 4 '15 at 10:08

As the \binomor dbinom commands from amsmath have a fixed size which may not be enough (this is the case here if the fraction inside \binom is set in displaystyle), I use the DeclarePairedDelimiterX command, from mathtools to define a \Binom command, with a star version that adds a pair of implicit \left … \right around the parentheses. You also may fine-tune their size with an optional argument (\big, \Big, \bigg,\Bigg).

Furthermore, we can use, inside the binomial, a \dfrac command or an \mfrac command (these are medium-sized fraction, ~80% of \displaystyle) from the nccmath package. Also, I neutralised the width of the upper bound of the indices and agjusted the whole formula with some math kerning (for your information, the unit length for maths is mu=1/18 em; \,=3mu). Finally, I thought it would be better to have only one number for both lines, but that is easy to change.

\documentclass{article}

\usepackage{mathtools}
\usepackage{nccmath}

\DeclarePairedDelimiterX\Binom[2](){\mkern-1mu\begin{matrix}#1\\#2\end{matrix}\mkern-1mu}%{\genfrac{}{}{0pt}{}{#1}{#2}}

\begin{document}

\label{myeq} \begin{aligned} w_{\frac{mn}{m+1}-\rho} & = m\cdot\dfrac{n-2}{1+\varepsilon_1}\cdot m^{-\frac{mn}{m+1}+\rho} \Binom*{n-2}{\mfrac{mn}{m+1}-\rho}^{\mkern-6mu-1}\mkern12mu \prod_{i=1}^{\mathclap{\frac{mn}{m+1}-\rho}} (1+\varepsilon_i)\\[1ex] & = \bigl (1+o(1)\bigr)n \cdot m^{-\frac{mn}{m+1}+\rho-1} \Binom*{n-2}{\cfrac{mn}{m+1}-\rho}^{\mkern-9mu -1}\mkern12mu \prod_{i=1}^{\mathclap{\frac{mn}{m+1}-\rho}} (1+\varepsilon_i) \end{aligned}

\end{document}


• Very clear now. :-) – Mico Aug 4 '15 at 13:26