I have an equation and wanted to align in right side of the page as it is cutting into the margin. So I used an flalign environment but it still is not working great. How can it be solved?

enter image description here

     M_{HR}^{\mathcal{G}}= \frac{a^2 \left(-a \left(4 a^2+5\right) z_h^2+8 \left(a^2+5\right) z_h-60 z_h \left(a z_h-2\right)
        \left(\coth ^{-1}\left(2 a z_h+1\right)-\log (4)\right)+30 a\right)}{360 \pi  G_4 \left(a z_h \left(a
        z_h-2\right)+2 \log \left(a z_h+1\right)\right)} \nonumber \\
      + \frac{4 a \left(-2 a^2+15 \log \left(a z_h\right)+5+60 \log (2)\right) \log \left(a z_h+1\right)+60 a
        \text{Li}_2\left(-a z_h\right)-30 a \log ^2\left(a z_h+1\right)}{360 \pi  G_4 \left(a z_h \left(a
        z_h-2\right)+2 \log \left(a z_h+1\right)\right)} \nonumber \\ 
  +\frac{ (q_M^2+a \mu_e^2) \left(2 \left(a^2 z_h^2-2 a z_h-3\right) \log \left(a z_h+1\right)+a z_h \left(6-a
        z_h\right)+2 \log ^2\left(a z_h+1\right)\right)}{48 a \pi  G_4 \left(a z_h \left(a z_h-2\right)+2 \log
        \left(a z_h+1\right)\right)}.
  • I've taken the liberty of adding some instructions to make your code minimally compilable and posting a screenshot. Feel free to revert.
    – Mico
    Aug 26, 2023 at 10:56
  • One possibility would be to combine this into one fraction, and then say $M_{HR}$ has a numerator ... and a denominator $720a\pi...$. And then distribute enough in the numerator that you can have line breaks at nice points. But I've not played enough with the expression to know how viable this would be, so I'll leave it as a comment.
    – Teepeemm
    Aug 26, 2023 at 16:08

1 Answer 1


Before doing anything else, I'd delete all 25 pairs of \left/\right sizing directives, as they (a) don't do anything useful, (b) create a lot of code clutter, and (c) actually make it difficult to find possible line breaks.

  • An inspection of the OP's screenshot shows that all three numerator terms are too long to fit in a single row. In general, line-breaking is done best right before an additive term; this suggests creating extra line breaks before -60z_h, +60 a LI, and +a z_h, respectively. Adding these (or similarly placed) line breaks will lead to the final form of the equation having 6 rows overall.

  • The denominator terms in rows 1 and 2 are identical and are very similar to the denominator term in row 3.

Implementing these observations with the help of an aligned environment leads to the following result:

enter image description here

\documentclass{article} % or some other suitable document class
\usepackage{amsmath}   % for 'aligned' environment


Put $Q\equiv48\pi G_4 [a z_h (a z_h-2)+2 \log(a z_h+1)]$. Then
&= (7.5Q)^{-1} \bigl\{ 
   a^2 \bigl[-a (4 a^2+5) z_h^2+8 (a^2+5) z_h \\
&\qquad -60 z_h (a z_h-2)(\coth ^{-1}(2 a z_h+1)-\log4)+30 a\bigr] \\
&\qquad +4 a (-2 a^2 +15 \log(a z_h)+5+60 \log2) \log(a z_h+1) \\
&\qquad +60 a\mathrm{Li}_2 (-a z_h)-30 a \log^2(a z_h+1) \bigr\} \\
&\quad +(aQ)^{-1}\bigl\{ (q_M^2+a \mu_e^2) \bigl[2 (a^2 z_h^2-2 a z_h-3) \log(a z_h+1) \\
&\qquad +a z_h (6-a z_h)+2 \log^2(a z_h+1)\bigr]\bigr\}\,.

  • 1
    Since there's enough room at the right for the next-to-last line, I'd be inclined to insert \qquad before the plus so that it doesn't visually line up with the equals sign. Aug 26, 2023 at 14:42
  • @barbarabeeton - Great suggestion -- I've gladly implemented it.
    – Mico
    Aug 26, 2023 at 15:59

You must log in to answer this question.

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