1

I read that eqnarray shouldn't be used anymore and also I sometimes get results from it not being beautiful;

I try to replace it - however if I habe an equation over several lines, eqnarray looks beautiful:

 \begin{eqnarray*}
 \mathbb{P}\bigg( \big \vert \hat{\tau}_{jk}-\tau_{jk} \big \vert \geq  \epsilon \bigg) &=& \mathbb{P}\bigg( T \cdot \big \vert \hat{\tau}_{jk}-\tau_{jk} \big \vert \geq  T \epsilon \bigg) =\mathbb{P}\bigg( \big \vert f(X_1, \ldots, X_T)-\mathbb{E}f(X_1, \ldots,X_T) \big \vert \geq T \cdot \epsilon \bigg) \\
 &\leq& 2\exp\left( \frac{2\epsilon^2}{Tc^2\big(1+2\sum_{k=1}^T\phi(k)\big)}\right)
 \end{eqnarray*}

I get the beautiful result, that the = and the $<=$ are first underneath each other but also that there is a space before the = sign and some space after it; Same with the <=: There is some space before and after it which looks beautiful;

How can I get that with the amsmath package? I tried align but failed to make it look like that

  • 2
    You should let go of your hold on "the space around = and <=", as that is one of the reasons eqnarray should be avoided (spacing is not consistent). – Werner Jun 29 '17 at 16:16
  • Why is spacing not consistent? – J.Doe Jun 29 '17 at 16:17
  • Compare the spacing around = for the marked symbols in your equation. The first one has far more whitespace around it than the second, yet that should be the same since it uses the same relational operator; improper use of \bigg doesn't help either - you should use left and right pairs at least (\biggl ... \biggr). – Werner Jun 29 '17 at 16:23
  • I know those commands but I actually used them by purpose because I considered it to be more beautiful - may I pass the question to other people reading this? Is it really inconsistent and therefore bad if the brackets are by purpose a little larger? – J.Doe Jun 29 '17 at 16:29
  • 2
    If you want to use align rather than eqnarray, then the default spacing will not suit your beauty requirements, unless you specifically add arbitrary spacing to match what you're after. Personal preference and beauty is subjective, and we tend to provide objective typographical advice that promotes consistency. – Werner Jun 29 '17 at 16:34
2

I would have no doubt if asked to choose between the eqnarray and the align version (compare with the final single line equation).

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{eqnarray*}
\mathbb{P}\bigg( \big \vert \hat{\tau}_{jk}-\tau_{jk} \big \vert \geq  \epsilon \bigg) &=& \mathbb{P}\bigg( T \cdot \big \vert \hat{\tau}_{jk}-\tau_{jk} \big \vert \geq  T \epsilon \bigg) =\mathbb{P}\bigg( \big \vert f(X_1, \ldots, X_T)-\mathbb{E}f(X_1, \ldots,X_T) \big \vert \geq T \cdot \epsilon \bigg) \\
 &\leq& 2\exp\left( \frac{2\epsilon^2}{Tc^2\big(1+2\sum_{k=1}^T\phi(k)\big)}\right)
\end{eqnarray*}

\begin{align*}
\mathbb{P}(\lvert \hat{\tau}_{jk}-\tau_{jk}\rvert \geq  \epsilon) 
  &=    \mathbb{P}(T\lvert\hat{\tau}_{jk}-\tau_{jk}\rvert \geq  T \epsilon ) \vphantom{\Bigg|} \\
  &=    \mathbb{P}(\lvert f(X_1, \dots, X_T)-\mathbb{E}f(X_1, \dots,X_T)\rvert \geq T\epsilon) \\
  &\leq 2\exp\biggl(\frac{2\epsilon^2}{Tc^2\bigl(1+2\sum_{k=1}^T\phi(k)\bigr)}\biggr)
\end{align*}

\begin{equation*}
\mathbb{P}(\lvert \hat{\tau}_{jk}-\tau_{jk}\rvert \geq  \epsilon) 
=\mathbb{P}(T\lvert\hat{\tau}_{jk}-\tau_{jk}\rvert \geq  T \epsilon)
\end{equation*}

\end{document}

enter image description here

Can you get the (ugly) big spaces? Yes, of course.

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{alignat*}{2}
\mathbb{P}(\lvert \hat{\tau}_{jk}-\tau_{jk}\rvert \geq  \epsilon)
  &\quad=\quad
  && \mathbb{P}(T\lvert\hat{\tau}_{jk}-\tau_{jk}\rvert \geq  T \epsilon ) \vphantom{\Bigg|} \\
  &\quad=\quad
  && \mathbb{P}(\lvert f(X_1, \dots, X_T)-\mathbb{E}f(X_1, \dots,X_T)\rvert \geq T\epsilon) \\
  &\quad\leq\quad
  && 2\exp\biggl(\frac{2\epsilon^2}{Tc^2\bigl(1+2\sum_{k=1}^T\phi(k)\bigr)}\biggr)
\end{alignat*}

\begin{equation*}
\mathbb{P}(\lvert \hat{\tau}_{jk}-\tau_{jk}\rvert \geq  \epsilon)
=\mathbb{P}(T\lvert\hat{\tau}_{jk}-\tau_{jk}\rvert \geq  T \epsilon)
\end{equation*}

\end{document}

Compare again.

enter image description here

  • An illuminating example! – Bernard Jun 29 '17 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.