TransWikia.com

List label and equation on the same line

TeX - LaTeX Asked on November 23, 2021

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.

One Answer

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 leavevmodevspace*{-dimexprabovedisplayskip + 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

Answered by Bernard on November 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP