2

I'm doing my (high school) math homework using LaTeX. As you might expect, I primarily use nested lists and multiline "Solve for x"-type equations.
The align environment and its other non-ed ending brethren do not allow vertical alignment of the list label with the first line of the equation (as you would get using \item \(\begin{aligned}[t]..., say).

MWE

\documentclass{article}

\usepackage{amsmath}

\begin{document}

Here is a list containing two unimaginative equations:

\begin{enumerate}
    \item 
        \begin{align*}
            x^2 - 2x - 8 &= x^2 - 4x + 2x - 8\\
            &= (x-4)(x+2)
        \end{align*}

    \item
        \(\begin{aligned}[t]
            x^2 - 2x - 8 &= x^2 - 4x + 2x - 8\\
            &= (x-4)(x+2)
        \end{aligned}\)
\end{enumerate}

\end{document}

enter image description here

Using the aligned environment (a) gives an uncentered equation and (b) deprives me of equation numbering privileges (though I would still like to know how to centre these; using \centering doesn't work, neither does inserting two \hfills on either side of \(...\)).

An align or IEEEeqnarray environment that allows space for the list label would be ideal. I do not like the solution of aligning the equation numbers on the left, as some list items would contain text as well.

3
  • What about \item\hfil\(\begin{aligned}[t] x^2...?
    – leandriis
    Jul 22, 2020 at 13:28
  • Using left aligned equation numbers instead of the itemize numbers as shown in tex.stackexchange.com/a/46648/134144 could also be interesting.
    – leandriis
    Jul 22, 2020 at 13:29
  • @leandriis I rarely use equation referencing while solving questions, so I can now improve the look of about 90% of my homework. Thank you for that!
    – Soyuz42
    Jul 22, 2020 at 14:17

1 Answer 1

3

Here are two solutions, including one for numbered equations:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

Here is a list containing two unimaginative equations:

\begin{enumerate}
    \item \leavevmode\vspace*{-\dimexpr\abovedisplayskip + \baselineskip}\begin{align}
            x^2 - 2x - 8 &= x^2 - 4x + 2x - 8\\
            &= (x-4)(x+2)
        \end{align}

    \item \makebox[\linewidth]{\(\begin{aligned}[t]
            x^2 - 2x - 8 &= x^2 - 4x + 2x - 8\\
            &= (x-4)(x+2)
        \end{aligned}\)}

\end{enumerate}

\end{document} 

enter image description here

1
  • Exactly what I wanted. Thank you!
    – Soyuz42
    Jul 22, 2020 at 14:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .