Math & ScienceEquation Alignment with Enumerated Items

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
SwaGGeReR
Posts: 1
Joined: Sat Feb 04, 2012 3:22 am

Equation Alignment with Enumerated Items

Post by SwaGGeReR »

Pictured in the attachment is an example of the issue I am encountering. I would like the equations to align with the items. For example:

(a) P(C U S) = ....
(b) P(A U B) = ...

instead of:

(a)

................P(C U S) = ...

Here's a snippet of the code:

Code: Select all

\item[14.]
\begin{enumerate}
\item
\begin{align*}
P(C \cap S) &= P(C) + P(S) - P(C \cup S) \\
&= .55 + .45 - .70 \\
&= .30 \\
&= 30\%
\end{align*}
Attachments
enumerated-aligned-equations.png
enumerated-aligned-equations.png (22.15 KiB) Viewed 2017 times
Last edited by localghost on Sat Feb 04, 2012 10:09 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Equation Alignment with Enumerated Items

Post by localghost »

SwaGGeReR wrote:[…] Here's a snippet of the code: […]
A proper minimal example would have been better.

Since you are already using the amsmath package, you can just switch from the align* environment (displayed math mode) to the aligned environment (in-line math mode) to get the desired output. The enumitem package helps to customize the lists.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}   % loads »amsmath«
\usepackage{enumitem}

\begin{document}
  \begin{enumerate}[start=14]
    \item
      \begin{enumerate}[label=(\alph*)]
        \item
          \(
            \begin{aligned}[t]
              P(C \cap S) &= P(C) + P(S) - P(C \cup S) \\
                          &= .55 + .45 - .70 \\
                          &= .30 \\
                          &= 30\%
            \end{aligned}
          \)
        \item
          \(
            \begin{aligned}[t]
              P((C \cup S)') &= 1-P(C \cup S) \\
                             &=1-.70 \\
                             &=.30 \\
                             &=30\%
            \end{aligned}
          \)
      \end{enumerate}
  \end{enumerate}
\end{document}
For details please refer to the package manuals.


Best regards and welcome to the board
Thorsten
Post Reply