3

I compile a large equation in display mode with a label and this is what I get: enter image description here

Is there any way to increase the spacing of the equation and the (45)?

Here is the code (sorry for including all packages, I am not sure which has an influence on my problem):

\documentclass[british,english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin9]{luainputenc}
\usepackage{color}
\usepackage{babel}
\usepackage{mathtools}
\usepackage{amsbsy}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{esint}
\doublespacing
\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]
 {hyperref}

\makeatletter

\usepackage{amsmath}
\usepackage[section]{placeins}
\usepackage{algorithm,algpseudocode}

\makeatother

\begin{document}


\begin{eqnarray}

\text{min}\left(1,\frac{\pi(x_{n+1})}{\pi(x_{n})}\prod_{i=0}^{L-1}\frac{P\Big((x_{n}^{i+1})^{*},(x_{n}^{i})^{*}\Big)}{P\Big(x_{n}^{i},x_{n}^{i+1}\Big)}\right) & = & \text{min}\left(1,e^{-   \beta\Delta\widetilde{H}}\right),\nonumber \\
 & = & \text{min}\left(1,e^{-\beta\sum_{i=0}^{L-1}\Delta\widetilde{H}_{i}}\right),\nonumber \\
 & = & \text{min}\left(1,e^{-\beta\left(\Delta U_{n}+\sum_{i=0}^{L-1}\Delta K_{BAB,i}\right)}\right),\label{eq:MH_effective_energy}

\end{eqnarray}

\end{document}
2
  • 4
    First of never use eqnarray as the image shows it uses way too much space around the = plus it happily overwrites the eqn number if it gets too close to it. Use align from amsmath instead.
    – daleif
    Sep 26, 2022 at 12:38
  • 2
    Secondly never use \text{min}. The \text command does not do what you think it does. \min is already a build in math function.
    – daleif
    Sep 26, 2022 at 12:39

3 Answers 3

5

You should never use eqnarray.

Better equation and split, in this case.

\documentclass[british]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage{babel}
\usepackage{mathtools}
%\usepackage{amsbsy}
%\usepackage{amstext}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{esint}
\usepackage[section]{placeins}
\usepackage{algorithm,algpseudocode}

\usepackage[
  %unicode=true,
  pdfusetitle,
  bookmarks=true,
  bookmarksnumbered=false,
  bookmarksopen=false,
  breaklinks=false,
  pdfborder={0 0 1},
  backref=false,
  colorlinks=false,
]{hyperref}

\doublespacing

\begin{document}

\begin{equation}
\label{eq:MH_effective_energy}
\begin{split}
\min\biggl(
  1,
  \frac{\pi(x_{n+1})}{\pi(x_{n})}
  \prod_{i=0}^{L-1}
    \frac{P\bigl((x_{n}^{i+1})^{*},(x_{n}^{i})^{*}\bigr)}
    {P\bigl(x_{n}^{i},x_{n}^{i+1}\bigr)}
\biggr)
&= \min(1,e^{-\beta\Delta\tilde{H}}), \\[-1ex]
&= \min\bigl(1,e^{-\beta\sum_{i=0}^{L-1}\Delta\tilde{H}_{i}}\bigr), \\
&= \min\bigl(1,e^{-\beta(\Delta U_{n}+\sum_{i=0}^{L-1}\Delta K_{BAB,i})}\bigr),
\end{split}
\end{equation}

\end{document}

I removed the overuse of \left and \right, changing also \Big into more suitable \bigl and \bigr pairs.

enter image description here

If you call \usepackage[tbtags]{mathtools}, you get

enter image description here

Instead of the manually guessed \\[-1ex] you might smash the bottom of the big left-hand side:

\documentclass[british]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage{babel}
\usepackage[tbtags]{mathtools}
\usepackage{amsbsy}
%\usepackage{amstext}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{esint}
\usepackage[section]{placeins}
\usepackage{algorithm,algpseudocode}

\usepackage[
  %unicode=true,
  pdfusetitle,
  bookmarks=true,
  bookmarksnumbered=false,
  bookmarksopen=false,
  breaklinks=false,
  pdfborder={0 0 1},
  backref=false,
  colorlinks=false,
]{hyperref}

\doublespacing

\begin{document}

\begin{equation}
\label{eq:MH_effective_energy}
\begin{split}
\smash[b]{\min\biggl(
  1,
  \frac{\pi(x_{n+1})}{\pi(x_{n})}
  \prod_{i=0}^{L-1}
    \frac{P\bigl((x_{n}^{i+1})^{*},(x_{n}^{i})^{*}\bigr)}
    {P\bigl(x_{n}^{i},x_{n}^{i+1}\bigr)}
\biggr)}
&= \min(1,e^{-\beta\Delta\tilde{H}}), \\
&= \min\bigl(1,e^{-\beta\sum_{i=0}^{L-1}\Delta\tilde{H}_{i}}\bigr), \\
&= \min\bigl(1,e^{-\beta(\Delta U_{n}+\sum_{i=0}^{L-1}\Delta K_{BAB,i})}\bigr),
\end{split}
\end{equation}

\end{document}

enter image description here

Points to note.

  1. If you want UK English hyphenation rules you should not pass the english option (that's for US English).

  2. \text{min} is wrong, use the predefined \min command.

  3. There is no need for \makeatletter and \makeatother.

  4. hyperref should be loaded last.

  5. Why latin9? Ensure your documents are saved as UTF-8.

  6. If you use lualatex, then don't load fontenc.

  7. amsbsy and amstext are automatically loaded by amsmath, which in turn is loaded by mathtools.

0

Removing the space after \begin{eqnarray} and before \end{eqnarray} may help.

\begin{eqnarray}
\text{min}\left(1,\frac{\pi(x_{n+1})}{\pi(x_{n})}\prod_{i=0}^{L-1}\frac{P\Big((x_{n}^{i+1})^{*},(x_{n}^{i})^{*}\Big)}{P\Big(x_{n}^{i},x_{n}^{i+1}\Big)}\right) & = & \text{min}\left(1,e^{-   \beta\Delta\widetilde{H}}\right),\nonumber \\
 & = & \text{min}\left(1,e^{-\beta\sum_{i=0}^{L-1}\Delta\widetilde{H}_{i}}\right),\nonumber \\
 & = & \text{min}\left(1,e^{-\beta\left(\Delta U_{n}+\sum_{i=0}^{L-1}\Delta K_{BAB,i}\right)}\right),\label{eq:MH_effective_energy}
\end{eqnarray}
0

Since you load mathtools, you'd better use its multlined environment:

    \documentclass[british,english]{scrartcl}
    \usepackage[T1]{fontenc}
    \usepackage[latin9]{luainputenc}
    \usepackage{color}
    \usepackage{babel}
    \usepackage{mathtools}
    \usepackage{amsbsy}
    \usepackage{amstext}
    \usepackage{amssymb}
    \usepackage{graphicx}
    \usepackage{setspace}
    \usepackage{esint}
    \doublespacing
    \usepackage[unicode=true,pdfusetitle,
     bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
     breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=false]
     {hyperref}

    \makeatletter
    \usepackage[section]{placeins}
    \usepackage{algorithm,algpseudocode}

    \makeatother

    \begin{document}

    \begin{equation}
    \begin{multlined}
    \min \left(1,\frac{\pi(x_{n+1})}{\pi(x_{n})}\prod_{i=0}^{L-1}\frac{P\Big((x_{n}^{i+1})^{*},(x_{n}^{i})^{*}\Big)}{P\Big(x_{n}^{i},x_{n}^{i+1}\Big)}\right) = \min \left(1,e^{- \beta\Delta\widetilde{H}}\right), \\
     = \min \left(1,e^{-\beta\sum_{i=0}^{L-1}\Delta\widetilde{H}_{i}}\right)
     = \min \left(1,e^{-\beta\left(\Delta U_{n}+\sum_{i=0}^{L-1}\Delta K_{BAB,i}\right)}\right),\label{eq:MH_effective_energy}
     \end{multlined}
    \end{equation}

    \end{document} 

enter image description here

2
  • 2
    Since the mathtools package, it's not necessary to load amsmath. Also, `hyperref should be loaded last. Sep 26, 2022 at 14:59
  • @barbarabeeton: I'lm sorry, I forgot to check this point when I used the O.P.'s post code. I've fixed it now.
    – Bernard
    Sep 26, 2022 at 15:05

You must log in to answer this question.

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