Math & ScienceAlignment in lists

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
jaybz
Posts: 90
Joined: Sun Jul 11, 2010 6:02 pm

Alignment in lists

Post by jaybz »

In the code below how can I get rid of the "The first item", move the 1 next to the "(a)" then align the numbers "1, 3, 5, 10, 15, 20" to the right in the code below?

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage[top=.5in, bottom=1in, left=0.2in, right=0.2in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
%\usepackage{varwidth}
\begin{document}
\begin{enumerate}
  \item The first item  
  \begin{enumerate} 
    \item We have $\displaystyle s_2 = s_1 + 2 = 3$ and $\displaystyle s_3 = s_2 + 3 = 6$, Continuing, we get \\
  \hspace{30pt} 1, 3, 6, 10, 15, 21
    \item next item \ldots
    \item next item \ldots
    \item next item \ldots
  \end{enumerate}
  
  \item next item \ldots
  \item next item \ldots
\end{enumerate}
\end{document}

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Alignment in lists

Post by frabjous »

I'm not sure if this is what you want or not:

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage[top=.5in, bottom=1in, left=0.2in, right=0.2in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{enumerate}
  \item 
  \begin{enumerate}
    \item We have $s_2 = s_1 + 2 = 3$ and $s_3 = s_2 + 3 = 6$, Continuing, we get 

  \hfill 1, 3, 6, 10, 15, 21
    \item next item \ldots
    \item next item \ldots
    \item next item \ldots
  \end{enumerate}
 
  \item next item \ldots
  \item next item \ldots
\end{enumerate}
\end{document}

list.png
list.png (7.29 KiB) Viewed 2397 times
jaybz
Posts: 90
Joined: Sun Jul 11, 2010 6:02 pm

Re: Alignment in lists

Post by jaybz »

Very close I wanted the "1" in "21" to be aligned with the "t" in "get"
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Alignment in lists

Post by frabjous »

Here's a very ugly kludge which uses \pbox from the pbox package. I hope someone else knows of a better/cleaner method.

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage[top=.5in, bottom=1in, left=0.2in, right=0.2in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pbox}
\begin{document}
\begin{enumerate}
  \item
  \begin{enumerate}
    \item \pbox[t]{\textwidth}{ We have $s_2 = s_1 + 2 = 3$ and $s_3 = s_2 + 3 = 6$, Continuing, we get\\
    \phantom{.}\hfill 1, 3, 6, 10, 15, 21\\[-1\baselineskip]}
    \item next item \ldots
    \item next item \ldots
    \item next item \ldots
  \end{enumerate}

  \item next item \ldots
  \item next item \ldots
\end{enumerate}
\end{document}
Post Reply