1

The multline environment seems to be behaving very oddly for me in that the spacing between different lines of an equation seems to be off. For example, for the following line of latex code,

\begin{multline*}
        p(x) = 3x^6 + 14x^5y + 590x^4y^2 + 19x^3y^3\\ 
        - 12x^2y^4 - 12xy^5 + 2y^6 - a^3b^3
\end{multline*}

I'm getting the following result enter image description here

What I should be getting is

enter image description here

(which was taken from here).

I don't understand why I'm getting these results. Can someone please explain why? (Note that I've set the margin of my pages to 1 inches on all sides using the geometry package.)

UPDATE (1/1/2021) : Thanks to Mico, it seems that the issue is indeed caused by the custom setting of the page margins. I guess the question is now: is there anyway to fix the output for the multline environment when the margins of the pages are custom set (such as when the margins are set to 1 inch on all sides)?

7
  • Welcome to TeX.SE.
    – Mico
    Commented Dec 31, 2020 at 18:21
  • 1
    Thanks! Glad to be here
    – Tan2525
    Commented Dec 31, 2020 at 18:24
  • Just out of curiosity: The sixth order polynomial equation easily fits on a single line. What are you trying to achieve by splitting it across two lines?
    – Mico
    Commented Dec 31, 2020 at 18:26
  • Good observation. The equation I'm using here is actually just for reference. The actual equation I'm using is longer.
    – Tan2525
    Commented Dec 31, 2020 at 18:28
  • The difference between the outputs of your code and the one in the Overlaef tutorial surely lies mainly in the value of the margin parameter: You set margin=1in, whereas the Overleaf tutorial uses something closer to margin=2.5in. Put differently, the \textwidth parameter in the overleaf example is 3" smaller than in your code.
    – Mico
    Commented Dec 31, 2020 at 18:31

1 Answer 1

2

Using mathtools and its \multlined definition, you can obtain:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\[                  % <---
\begin{multlined}   % <---
        p(x) = 3x^6 + 14x^5y + 590x^4y^2 + 19x^3y^3\\
        - 12x^2y^4 - 12xy^5 + 2y^6 - a^3b^3
\end{multlined}
\]
\end{document}

enter image description here

3
  • It might be worth mentioning that the width of the environment maybe set as the second optional argument of multlined.
    – Bernard
    Commented Dec 31, 2020 at 18:55
  • Thanks @Zarko. This completely solves my problem. It's the first time I'm coming across the multlined environment. It seems the usage is identical to the multline environment except that must be used inside another math environment.
    – Tan2525
    Commented Dec 31, 2020 at 18:57
  • Noted with thanks @Bernard.
    – Tan2525
    Commented Dec 31, 2020 at 18:58

You must log in to answer this question.

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