3

Here is a quick question regarding the position of align environment.

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

%%%  lots of text here.

\begin{align*}
& \mathcal{A}(Q \rightarrow Q^{*},P) = min(1, \dfrac{p(Q^{*};P)}{p(Q;P)}\dfrac{q(Q | Q^{*})}{q(Q^{*} | Q)}) \\
& = min(1, exp(\alpha \cdot (\Delta(Q^{*},P) - \Delta(Q;P)))\cdot \dfrac{q(Q | Q^{*})}{q(Q^{*} | Q)})
\end{align*}

\end{document}

I am using the above align environment to define a formula. However, the problem is that I just cannot fix the position of this formula. Indeed it floats to the top of the text and affects the readability a lot. Could any one shed some lights on how to fix this environment? Thanks.

  • 4
    You need to provide a complete self contain example. Your example above does not even compile. You can also add some text that shows the problem. – Nasser May 12 at 8:18
  • 2
    What do you mean exactly with fixing the position? Maths environments never float. Maybe, it should appear naturally at the bottom of the page, but there's not enough room left for both rows, and you didn't add the \allowdisplaybreaks directive in your preamble, so it goes to the top of the next page? – Bernard May 12 at 8:55
  • 1
    Please clarify what you mean by "it floats to the top of the tex". E.g., does it get placed at the top of the next page? – Mico May 12 at 8:55
  • 1
    A problem might be a blank line before \begin{align*}, which should never be used. – egreg May 12 at 10:29
6

I'm not sure what you mean by "[the align environment] floats to the top of the text". For sure, display math environments in LaTeX do not "float", where the "float" is a LaTeX-specific term. (In LaTeX, the two main "floating" environments are figure and table.) If you wish to allow a page break inside an align environment, simply issue the instruction \allowdisplaybreaks (in the preamble, after loading the amsmath package.

Since you care about the readability of your paper, you should also try to improve the look of the equation, say by (a) using upright lettering for "min" and "exp", (b) using \mid instead of | to denote conditioning, (c) using large parentheses where appropriate, and (d) alternating between round parentheses and square brackets. Also, it seems more natural to align the two rows on the = symbol than typesetting them flush-left.

enter image description here

\documentclass{article}
\usepackage{xcolor,amsmath,amssymb}
\begin{document}

%%%  lots of text here.

\noindent\textcolor{red}{before}
\begin{align*}
& \mathcal{A}(Q \rightarrow Q^{*},P) = min(1, \dfrac{p(Q^{*};P)}{p(Q;P)}\dfrac{q(Q | Q^{*})}{q(Q^{*} | Q)}) \\
& = min(1, exp(\alpha \cdot (\Delta(Q^{*},P) - \Delta(Q;P)))\cdot \dfrac{q(Q | Q^{*})}{q(Q^{*} | Q)})
\end{align*}

\noindent\textcolor{red}{after}
\begin{align*}
\mathcal{A}(Q \rightarrow Q^{*},P) 
&= \min\biggl(1, \frac{p(Q^{*};P)}{p(Q;P)}\frac{q(Q \mid Q^{*})}{q(Q^{*} \mid Q)}\biggr) \\
&= \min\biggl(1, \exp\bigl(\alpha \cdot [\Delta(Q^{*},P) - \Delta(Q;P)]\bigr)\times 
\frac{q(Q \mid Q^{*})}{q(Q^{*} \mid Q)}\biggr)
\end{align*}

\end{document}

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.