1

Okay, I have been fiddling with this for too long, hence I decided to ask for help. Here's the problem, I am working with a two-column layout and I have some lengthy equations which I would like to display gracefully. This is what I want:

|<some eq> = <first part of a lengthy eq>       |
|     <very lengthy second part of a lengthy eq>|
|<another eq> = <first part of a lengthy eq>    |
|     <very lengthy second part of a lengthy eq>|

The vertical bars denote the margins. So, an equation's first part left aligned and the second part right aligned. And while we're at it, I am also curious how to obtain a variant which aligns the '=' symbol:

|<some eq>    = <first part of a lengthy eq>    |
|     <very lengthy second part of a lengthy eq>|
|<another eq> = <first part of a lengthy eq>    |
|     <very lengthy second part of a lengthy eq>|

I fiddled around with most AMS math environments and also with mathtools' multlined environment. My last attempt was with flalign, but then the second part exceeds the margin as follows

|<some eq> = <first part of a lengthy eq>       |
|                                        <very lengthy second part of a lengthy eq>

Help is appreciated, for a hopefully not too hackish solution.

Less important follow-up question: how acquire the above with one vertically-centered equation number, and how to acquire it with equation numbers for both equations?

Update. In response to the request for a minimal working example. Well, at the moment I do not have it working, not in a simple manner nor in a complex manner. But not leave you empty handed, this is what I currently use:

\begin{align*}
&\begin{multlined}
    f_1 = -f_2 = a + a + a + a + a +\\
    b + b + b + b + b + b + b + b + b + b
\end{multlined}\\
&\begin{multlined}
    f_3 = f_4 = c + c + c + c + c +\\
    d + d + d + d + d + d + d + d + d + d
\end{multlined}
\end{align*}

The problem here is that the equations are centered. I want the first part of the multlined at the left margin and the second part of the multlined at the right margin.

1
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – ebosi
    Dec 2, 2016 at 12:03

3 Answers 3

0

Combine flalign* with \mathllap:

\documentclass[ a4paper, twocolumn]{article}%
\usepackage[showframe]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}

\lipsum[1]
\begin{flalign}
  f_1 &= -f_2 = a + a + a + a + a +\\
  & &\mathllap{ b + b + b + b + b + b + b + b+ b }+ b& \\
  f_3& = f_4 = c + c + c + c + c +\\
  & & & \mathllap{d + d + d + d + d + d + d + d + d + d}
\end{flalign}

\lipsum[2-6]

\end{document}​ 

enter image description here

3
  • Your answer is also fairly easily extended to the requested variant, so I picked your answer as solution. Two sidenotes: 1) I do not understand the '&' after the mathllap. 2) mathllap interferes with equation numbers, use \makebox[<width>][r]{<second part lengthy eq>} with sufficient <width> to display the equation number
    – Bart
    Dec 3, 2016 at 11:05
  • Your answer is fairly easily extended to the requested aligned variant. (Hmm, why can't I edit my comments?)
    – Bart
    Dec 3, 2016 at 11:30
  • @Bart: 1) It is to ensure the last alignment point in at the right margin of the column (due to the use of \mathllap, one & after is enough). 2) You're right. I hadn't tested with equation numbers. A simpler solution consists in writing the last character /symbol of the rightmost part of the equations outside of \mathllap in one of the lines. Please see my updated answer.
    – Bernard
    Dec 3, 2016 at 12:55
0

Edit: Like the first equation below?

enter image description here

\documentclass{article}
\usepackage{mathtools}

\usepackage{showframe}
\renewcommand*\ShowFrameColor{\color{red}}

\begin{document}
\begin{gather*}
\begin{multlined}[t][\linewidth]
    f_1 = -f_2 = a + a + a + a + a +\\
    b + b + b + b + b + b + b + b + b + b
\end{multlined}\\
\begin{multlined}[t][\linewidth]
    f_3 = f_4 = c + c + c + c + c +\\
    d + d + d + d + d + d + d + d + d + d
\end{multlined}
\end{gather*}
\end{document}
2
  • Thanks, it works for the non-aligned variant I asked for, although I had to replace \textwidth with \columnwidth (or more generally with \linewidth). I was unable to get your solution working for the aligned variant I requested.
    – Bart
    Dec 3, 2016 at 11:14
  • I transform my answer for two column article case. Equations are left and right aligned as you request :)
    – Zarko
    Dec 3, 2016 at 11:24
0

With some user intervention for setting a proper maximum width of the bottom lines:

\documentclass[twocolumn]{article}
\usepackage{amsmath,mathtools}

\usepackage{kantlipsum}

\makeatletter
\newcommand{\rightbox}[2]{%
  \ifmeasuring@
    \mathmakebox[#1][r]{{}#2}%
  \else
    \mathmakebox[\ifcase\expandafter 2\maxcolumn@widths\fi][r]{{}#2}%
  \fi
}
\makeatother

\begin{document}

\kant*[1]
\begin{align*}
\begin{split}
f_1 &= -f_2 = a + a + a + a + a \\
&\rightbox{.8\columnwidth}{+ b + b + b + b + b + b + b + b + b + b}
\end{split} \\
\begin{split}
f_3+f_0 &= f_4 = c + c + c + c + c \\
&\rightbox{.8\columnwidth}{+ d + d + d + d + d + d + d + d + d + d}
\end{split}
\end{align*}
and the same with numbers
\begin{align}
\begin{split}
f_1 &= -f_2 = a + a + a + a + a \\
&\rightbox{.7\columnwidth}{+ b + b + b + b + b + b + b + b + b + b}
\end{split} \\
\begin{split}
f_3+f_0 &= f_4 = c + c + c + c + c \\
&\rightbox{.7\columnwidth}{+ d + d + d + d + d + d + d + d + d + d}
\end{split}
\end{align}
\kant[3-8]

\end{document}

enter image description here

You must log in to answer this question.

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