Math & Scienceflalign

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
jonathan webley
Posts: 11
Joined: Sun May 03, 2009 8:28 am

flalign

Post by jonathan webley »

I have a couple of equations, with text that I want to align. However flalign works like a table with columns, with no overlap between columns.

I would like my output to look like, which fits easily on an A4 page:

Code: Select all

lots of text from left margin  x = 1 lots of text to right margin
                         34x + y = 5x + y
This is what I have tried:

Code: Select all

\documentclass{amsart}
\begin{document}
\begin{flalign*}
& \text{lots of text from left margin} & x &= 1  & \text{lots of text to right margin} \\
&& u + 2v + w + 34x + y + 4z &= 3u + v + 2w + 5x + y + 3z \\
\end{flalign*}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

flalign

Post by Stefan Kottwitz »

Hi Jonathan,

that's intended ... but you can try overlapping with workarounds by \rlap and \llap for instance:

Code: Select all

\begin{flalign*}
& \rlap{lots of text from left margin\ } & x &= 1  &
    \llap{\ lots of text to right margin} \\
&& u + 2v + w + 34x + y + 4z &= 3u + v + 2w + 5x + y + 3z \\
\end{flalign*}
Stefan
LaTeX.org admin
yiorgosb
Posts: 30
Joined: Mon Aug 02, 2010 11:56 pm

Re: flalign

Post by yiorgosb »

I've tried the above suggested solution and worked like a charm!

However, when the text (that inside rlap{} )is two long it overlaps
the result is really a mesh. Both equation and number are overlapped by text. How could I force the text to break (preferred automatically or manually otherwise)
yiorgosb
Posts: 30
Joined: Mon Aug 02, 2010 11:56 pm

flalign

Post by yiorgosb »

Stefan_K wrote:Hi Jonathan,

that's intended ... but you can try overlapping with workarounds by \rlap and \llap for instance:

Code: Select all

\begin{flalign*}
& \rlap{lots of text from left margin\ } & x &= 1  &
    \llap{\ lots of text to right margin} \\
&& u + 2v + w + 34x + y + 4z &= 3u + v + 2w + 5x + y + 3z \\
\end{flalign*}
Stefan
When the above code is used with {flalign} instead of {flalign*} the text inside \llap overlaps with the equation number. I found a fix that I would like to share.
Simply put a \: (or bigger space like \quad at the end of \llap
Then the above code would be

Code: Select all

\begin{flalign}
& \rlap{lots of text from left margin\ } & x &= 1  &
    \llap{\ lots of text to right margin} \: \\
&& u + 2v + w + 34x + y + 4z &= 3u + v + 2w + 5x + y + 3z \\
\end{flalign}
Post Reply