Text FormattingAlignment problem

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Alignment problem

Post by coachbennett1981 »

Good morning, I have come across a problem. Another teacher gave the following code to me:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath,amssymb,amsfonts}
\begin{document}
\[
	\begin{aligned}
-5 + 3x + 2(5x - 3)&\\ \text{Distribute the $2$ to the $5x$ and the $3$}
&= -5 + 3x + 2(5x) - 2(3)\\ \text{Multiply $2(5x)$ and $-2(3)$}
&= -5 + 3x + 10x - 6\\ \text{Combine like terms}
&= -11 + 13x\\
&= 13x - 11\\
\end{aligned}
\]

\end{document}
I am trying to put the text of the right side of the equations and have the equations be aligned at the equals sign and the text be to the right and evenly spaced and also lined up. Is there a nice way to do this?

Thanks

Nick
Last edited by coachbennett1981 on Fri Feb 11, 2011 7:06 pm, edited 1 time in total.

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

Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Re: Alignment problem

Post by Montag »

Hi Nick,
you should drop the aligned-environment and the "\[", use the align*-evironment instead and put one ampersand before the equal sign and one ampersand before \text{Distribute the $...

Does that work for you?
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Re: Alignment problem

Post by coachbennett1981 »

Works well.. Thanks man.. I appreciate it
Post Reply