Math & Sciencewrap text in flalign

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

wrap text in flalign

Post by jonathan webley »

This equation is part of a set of aligned equations:

Code: Select all

\documentclass[a4paper]{article}
\usepackage{amsmath}
\begin{document}
\begin{flalign*}
& \text{Solution:} & 6\left(3x + \frac{1}{2} \right) &= 6\left(\dfrac{x}{2} + \dfrac{1}{3}\right) + 6\left(\dfrac{x}{2} + \dfrac{1}{3}\right) + 6\left(\dfrac{x}{2} + \dfrac{1}{3}\right) && \text{Multiply both sides by 6 to clear the fractions} \\
\end{flalign*}
\end{document}
The text at the end of the line flows off the page. However, because of the fractions, the equation is over two lines. So can I get the text "Multiply..." to have a line break, something like:

Code: Select all

Solution: 6                      Multiply...
          2                      ...the fractions

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

jonathan webley
Posts: 11
Joined: Sun May 03, 2009 8:28 am

wrap text in flalign

Post by jonathan webley »

I finally worked this out - I can use a parbox:

Code: Select all

& \textbf{Solution:} & 6\left(3x + \HALF \right) &= 6\left(\dfrac{x}{2} + \dfrac{1}{3}\right) && \parbox[m]{1.5in}{\textit{Multiply both sides by } 6 \textit{ to clear the fractions}} \\
Post Reply