# Remove vertical space before and after align with enumerate / make multicols align to the top

MWE:

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{enumitem}
\usepackage{multicol}
\setlength{\columnsep}{1cm}
\setlength{\columnseprule}{1pt}
\allowdisplaybreaks

\begin{document}

\begin{multicols*}{2}

\begin{enumerate}[label=(\alph*)]
\item \begin{align*}
2x+6&=12x-8\\
2x-12x&=-8-6\\
-10x&=-14\\
x&=\dfrac{-14}{-10}\\
&=1\dfrac{2}{5}
\end{align*}
\item \begin{align*}
4x-5&=6(7)\\
&=42\\
4x&=42+5\\
&=47\\
x&=\dfrac{47}{4}\\
&=11\dfrac{3}{4}
\end{align*}
\item \begin{align*}
5(6x-2)&=3(9x+1)\\
30x-10&=27x+3\\
30x-27x&=3+10\\
3x&=13\\
x&=\dfrac{13}{3}\\
&=4\dfrac{1}{3}
\end{align*}
\item \begin{align*}
\dfrac{3(-2x+5)-4(8x+1)}{12}&=7\\
\dfrac{-6x+15-32x-4}{12}&=7\\
\dfrac{-38x+11}{12}&=7
\end{align*}\\
\begin{align*}
-38x+11&=12(7)\\
&=84\\
-38x&=84-11\\
&=73\\
x&=\dfrac{73}{-38}\\
&=-1\dfrac{35}{38}
\end{align*}
\item \begin{align*}
3&=7(x+5)\\
3&=7x+35\\
-7x&=35-3\\
&=32\\
x&=\dfrac{32}{-7}\\
&=-4\dfrac{4}{7}
\end{align*}
\item \begin{align*}
4(5x+6)&=6(3x-2)\\
20x+24&=18x-12\\
20x-18x&=-12-24\\
2x&=-36\\
x&=\dfrac{-36}{2}\\
&=-18
\end{align*}
\end{enumerate}

\end{multicols*}

\end{document}


I am trying to create a solutions page, and would like to remove the vertical space such that (a) is on the same line as the first equation, and there is no vertical space after the last equation, before (b).

Also, the second column shows that LaTex is filling up the entire column with my equations but I would like it to be aligned to the top.

How might I achieve both of these?

Thank you.

• if you don't require the multi-line equations to be centered, this question offers a solution: How to split and align equations when they are inside an enumerate environment? Apr 5, 2015 at 12:58
• Thanks. However aligned didn't work for me, because the equations ran past the page alignment as allowdisplaybreaks doesn't work for them. Hence I was recommended to use align instead. Apr 5, 2015 at 13:00

In this code I define a solutions environment, based on enumerate, but with the \item command patched with the help of the etoolbox package. I also changed some of the computation results, expressed in theinteger part fractionary part style with smaller fractions, either in the form, say, \tfrac{3}{4} or in the form \sfrac{3}{4} from the xfrac package:

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{enumitem}
\usepackage{multicol}
\setlength{\columnsep}{1cm}
\setlength{\columnseprule}{1pt}
\allowdisplaybreaks
\usepackage{xfrac}
\usepackage{etoolbox}
\newlist{solutions}{enumerate}{1}
\setlist[solutions]{label =(\alph*)}
\AtBeginEnvironment{solutions}{%\pretocmd{\item}{\renewcommand{\abovedisplayskip}{0pt}}{}{}
\apptocmd{\item}{\mbox{}\vspace*{\dimexpr-\baselineskip-\abovedisplayskip\relax}}{}{}}
%{\apptocmd{\item}{\leavevmode\vspace*{\dimexpr-\baselineskip-\abovedisplayskip\relax}}{}{}}
\raggedbottom
\begin{document}

\begin{multicols*}{2}

\begin{solutions}
\item \begin{align*}
2x+6&=12x-8\\
2x-12x&=-8-6\\
-10x&=-14\\
x&=\dfrac{-14}{-10}\\
&=1\mkern1mu\tfrac{2}{5}
\end{align*}
%
\item \begin{align*}
4x-5&=6(7)\\
&=42\\
4x&=42+5\\
&=47\\
x&=\dfrac{47}{4}\\
&=11\mkern1mu\tfrac{3}{4}
\end{align*}
%
\item \begin{align*}
5(6x-2)&=3(9x+1)\\
30x-10&=27x+3\\
30x-27x&=3+10\\
3x&=13\\
x&=\dfrac{13}{3}\\
&=4\mkern1mu\tfrac{1}{3}
\end{align*}
%
\item
\begin{align*}
\dfrac{3(-2x+5)-4(8x+1)}{12} & =7 \\
\dfrac{-6x+15-32x-4}{12} & =7 \\
\dfrac{-38x+11}{12} & =7 \\
\end{align*}\vskip-9ex
\begin{align*}
-38x+11 & =12(7) =84 \\
-38x & =84-11 \\
& =73 \\
x & =\dfrac{73}{-38} \\
& =-1\sfrac{35}{38}
\end{align*}
%
\item \begin{align*}
3&=7(x+5)\\
3&=7x+35\\
-7x&=35-3\\
&=32\\
x&=\dfrac{32}{-7}\\
&=-4\sfrac{4}{7}
\end{align*}
%
\item \begin{align*}
4(5x+6)&=6(3x-2)\\
20x+24&=18x-12\\
20x-18x&=-12-24\\
2x&=-36\\
x&=\dfrac{-36}{2}\\
&=-18
\end{align*}
\end{solutions}
\end{multicols*}

\end{document}


• Thank you. Anyway to get rid of the space as you can see in part d? I needed to use 2 align environments otherwise the equation will run over the middle line. I'm okay with taking away the vertical space at the end of each part of necessary. Apr 5, 2015 at 11:25
• You just have to add a \vskip-9ex (experimental). All other solutions I tried (such as nesting two aligned environments in a gather*, modified badly the vertical spacing). I also propose smaller fractions for some of your final results, but this led me to modify the bottom margin in order to really have two columns. Please see my updated answer. Apr 5, 2015 at 12:34