16

How to make the first line of aligned equations sit in the same baseline as the bullet and make the equation left justified?

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{itemize}
    \item $3!=3\times2\times1=6$
    \item $\tfrac{5!}{3!}=\tfrac{5\times4\times3!}{3!}=5\times4=20$
    \item \begin{align*}
                    \frac{n!}{(n-2)!}   &=\frac{n\times(n-1)\times(n-2)!}{(n-2)!}\\
                                                        &=n\times(n-1)\\
                                                        &=n^2-n
                \end{align*}
\end{itemize}
\end{document}
Moriambar
  • 11,466

1 Answers1

18

the aligned environment works just fine, with the [t] option to get the bullet on the first line:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{itemize}
    \item $3!=3\times2\times1=6$
    \item $\tfrac{5!}{3!}=\tfrac{5\times4\times3!}{3!}=5\times4=20$    
    \item $\!\begin{aligned}[t]
                    \frac{n!}{(n-2)!}   &=\frac{n\times(n-1)\times(n-2)!}{(n-2)!}\\
                                                        &=n\times(n-1)\\
                                                        &=n^2-n
                \end{aligned}$
\end{itemize}

\end{document}

output of example code

edit: added a negative thin space \! just before the aligned block to counteract the thin space \, built into the beginning of aligned. for some background, see the question Why is there a \, space at the beginning of the “aligned” environment?.

David Carlisle
  • 757,742
  • I think you need to insert \! between $ and \begin{aligned} to remove the unnecessary white space. – kiss my armpit Apr 14 '13 at 17:47
  • @Ohmyghost: Thanks for the good question. I just had a minor related question. Suppose in addition to what you desire in the problem, one also would like to make sure the equal signs appearing first in each bullet point are vertically aligned, how can we go about this please? (in other words inter-bullet alignment, so to speak) – Abhimanyu Arora Sep 21 '14 at 13:59
  • @AbhimanyuArora: I don't understand. Sorry. Please show me the sample by your handwriting. – kiss my armpit Sep 21 '14 at 14:07
  • 1
    @AbhimanyuArora -- you could use \widthof on the pre-equal-sign parts of the first two as described in this answer. you'd have to flush those parts to the right in the box with \hfil, otherwise they'd be centered in the box. – barbara beeton Sep 21 '14 at 14:31
  • That's elegant, barbara!. @Ohmyghost, just the vertical alignment of = signs of equations in two different bullet points above. Thanks both. – Abhimanyu Arora Sep 21 '14 at 15:35
  • very helpful dear Barbara. Thx – Mikasa Jan 20 '24 at 08:07