Math & ScienceMaths and enumerate

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
jonathan webley
Posts: 11
Joined: Sun May 03, 2009 8:28 am

Maths and enumerate

Post by jonathan webley »

I'm trying to format a very long enumerated list (over a 100 items). Some of the items are several lines of only text but others are just maths. However, if I use a maths environment such as flalign, vertical space is inserted and the maths does not start on the same line as the item number.

The same thing happens if I use a table.

Is there a way of formatting the list so that the maths starts on the same line as the item number?

Code: Select all

\documentclass{article}
\usepackage{amsmath, amssymb}
\begin{document}
\begin{enumerate}
	\item inline maths: $a=b$
	\item  \begin{flalign*}
         & \text{Since} & 2y &= 4x & \\
         &              &  y &= x \\
         \end{flalign*}
\end{enumerate}

\begin{tabular}{r l}
1. & inline maths: $a=b$ \\
2. & {\begin{flalign*}
        & \text{Since} & 2y &= 4x & \\
        &              &  y &= x \\
      \end{flalign*}}
\end{tabular}
\end{document}

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Maths and enumerate

Post by localghost »

You have to operate in in-line math mode. But the flalign* environment is a displayed one. Some modifications will do the trick.

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  \begin{enumerate}
    \item inline maths: $a=b$
     \item $\begin{aligned}
              & \text{Since} & 2y &= 4x & \\
              &              &  y &= x
            \end{aligned}$
  \end{enumerate}

  \begin{tabular}{rl}
    1. & inline maths: $a=b$ \\
    2. & $\begin{aligned}
            & \text{Since} & 2y &= 4x & \\
            &              &  y &= x
          \end{aligned}$
  \end{tabular}
\end{document}

Best regards and welcome to the board
Thorsten
jonathan webley
Posts: 11
Joined: Sun May 03, 2009 8:28 am

Re: Maths and enumerate

Post by jonathan webley »

That's a good solution, thanks. However, the item number is centered vertically with regard to the item content. Is is possible so that the top line of the item content is aligned with the item number?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Maths and enumerate

Post by Stefan Kottwitz »

Hi Jonathan,
jonathan webley wrote:Is is possible so that the top line of the item content is aligned with the item number?
yes, just use the optional parameter t:

Code: Select all

\begin{aligned}[t] ...
Stefan
LaTeX.org admin
jonathan webley
Posts: 11
Joined: Sun May 03, 2009 8:28 am

Re: Maths and enumerate

Post by jonathan webley »

Thanks! That works really well and gives the great looking output we expect from LaTeX.
Post Reply