How to construct a long equation that is split in LHS and RHS to occupy a narrow column?
This is based on mafp's answer, but doesn't use aligned
in the left. Note the \!
in front of \begin{aligned}
and the {}+
, which are needed for proper spacing!
\documentclass[twocolumn]{article}
\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{amsmath}
\begin{document}
\begin{enumerate}
\item The degree of (C) is 3.
\item The degree of (A) is 1.
\item%
$
\!\begin{aligned}[t]
-3x(x+1)-2x(x-1) \\
{}+4(x^2-3x-1) &= \!\begin{aligned}[t]
-3x^2-3x-2x^2+2x \\
{}+4x^2-12x-4
\end{aligned} \\
&= -x^2-13x-4
\end{aligned}
$
\end{enumerate}
\end{document}
The following is a variant of mafp's answer, in which the spacing of the aligned
environment relative to the enumeration label is fixed. This is somewhat more complicated than Hendrik's answer, but achieves the alignment on +
and -
operators which you seemed to want in your original example.
#1. Basic solution
If there is nothing particularly large on the first line of the equation, the following will suffice.
\documentclass[twocolumn]{article}
\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{amsmath}
\setlength\columnseprule{0.5pt}
\begin{document}
\begin{enumerate}
\item The degree of (C) is 3.
\item The degree of (A) is 1.
\item \strut\\[\dimexpr-\baselineskip-\lineskip]\strut
$\begin{aligned}[t]\!
\begin{aligned}[b]\!
-3x(x+1) &- 2x(x-1) \\
&+ 4(x^2-3x-1)
\end{aligned}
&=
\begin{aligned}[t]\!
-3x^2 &- 3x - 2x^2 + 2x \\
&+ 4x^2 - 12x - 4
\end{aligned} \\
&= -x^2 - 13x - 4
\end{aligned}$
\end{enumerate}
\end{document}
The magic line \strut\\[\dimexpr-\baselineskip-\lineskip]\strut
forces a line break in order to force the top line of the LHS to sit below the first line of the enumeration item; the \strut
commands (a technique suggested by David Carlisle for forcing the vertical spacing between the lines to be well-defined in just such a context) allow us to pull that first line back up to the level of the enumeration item by undoing the vertical space and the glue width.
#2. General solution
If you have any unusually tall elements in the first line of the math, such as
\left( \sum_\substack{a\\b} \right)
then the previous solution will not quite work: the top of the tallest element will be pulled to the top of the line of text of the enumeration item. You can get around that by \smash
ing it, but then it has a good chance of overlapping with the previous enumeration item.
In this case, a little bit of manual effort is required, but it should give a fully general solution. What need to do is make a copy of the tall math elements in a box so that TeX can measure its height, and then use that height both to make the appropriate accomodations for space in your enumeration environment, and to make the spacing corrections after the newline. Thanks to Andrew Swann for indicating the correct way to adjust the spacing using \dp\strutbox
(see towards the bottom of the comment thread there) in this case.
\documentclass[twocolumn]{article}
\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{amsmath}
\setlength\columnseprule{0.5pt}
\begin{document}
\begin{enumerate}
\item The degree of (C) is 3.
\item The degree of (A) is 1.
\savebox0{$\displaystyle
\left( \sum_{\substack{\text{very low} \\
\text{subscripts}}}
\text{math} \right)$}
\vspace{\dimexpr\ht0-\baselineskip}
\item \strut\\[\dimexpr-\ht0-\lineskip-\dp\strutbox]\strut
$\begin{aligned}[t]\!
\begin{aligned}[b]\!
-3x(x+1) & \left( \sum_{\substack{\text{very low} \\
\text{subscripts}}}
\text{math} \right) \\
&+ 4(x^2-3x-1)
\end{aligned}
&=
\begin{aligned}[t]\!
-3x^2 &- 3x - 2x^2 + 2x \\
&+ 4x^2 - 12x - 4
\end{aligned} \\
&= -x^2 - 13x - 4
\end{aligned}$
\end{enumerate}
\end{document}
These two versions do not completely resembles your drawing, but might be worthwhile.
\documentclass[twocolumn]{article}
\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{amsmath}
\begin{document}
\begin{enumerate}
\item The degree of (C) is 3.
\item The degree of (A) is 1.
\item%
$
\begin{aligned}[t]
\begin{aligned}[b]
-3x(x+1)-2x(x-1) \\
{}+4(x^2-3x-1)
\end{aligned}
&=
\begin{aligned}[t]
-3x^2-3x-2x^2+2x\\
{}+4x^2-12x-4
\end{aligned}\\
&= -x^2-13x-4
\end{aligned}
$
\item Some text
\begin{align*}
\begin{aligned}[b]
-3x(x+1)-2x(x-1) \\
{}+4(x^2-3x-1)
\end{aligned}
&=
\begin{aligned}[t]
-3x^2-3x-2x^2+2x\\
{}+4x^2-12x-4
\end{aligned}\\
&= -x^2-13x-4
\end{align*}
\end{enumerate}
\end{document}