Text Formattinghoriz alignment in enumerate

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
jaybz
Posts: 90
Joined: Sun Jul 11, 2010 6:02 pm

horiz alignment in enumerate

Post by jaybz »

Is there any other way besides what I've done here to get the "(a)" to line up horizontally with the "(b)" and "(c)"? You'll notice it's slightly shifted to the left if you change the itemindent value to 0.

Code: Select all

\documentclass{article}
\usepackage{mathtools}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[itemindent=-0.3mm,labelsep=5mm]
  \item
  \begin{enumerate}
    \item Nested item 1
    \item Nested item 2
    \item Nested item 2
  \end{enumerate}
\end{enumerate}
\end{document}
Last edited by jaybz on Sat May 07, 2011 9:07 pm, 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.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

horiz alignment in enumerate

Post by Stefan Kottwitz »

That's because of the different width of the letters. Default there's right alignment, you can change it to left align:

Code: Select all

\begin{enumerate}[align=left]
Stefan
LaTeX.org admin
jaybz
Posts: 90
Joined: Sun Jul 11, 2010 6:02 pm

horiz alignment in enumerate

Post by jaybz »

That just seams to push the "1." to the right and not effect the "(a)"
I'm Ok with just using the negative value. But I just noticed something. Is there a way to justify the text so it's the same length on each of the first lines? So:
"This is the first item in this list here on this page"
AND
"Now we have the second item in the list here on"
are the same width.

Code: Select all

    \documentclass{article}
    \usepackage{mathtools}
    \usepackage{enumitem}
    \begin{document}
    \begin{enumerate}[align=left]
      \item
      \begin{enumerate}
        \item This is the first item in this list here on this page\\
  it continues to the next line.
        \item Now we have the second item in the list here on\\
this page, this also continues to the next line.\\
      \end{enumerate}
    \end{enumerate}
    \end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

horiz alignment in enumerate

Post by Stefan Kottwitz »

jaybz wrote:That just seams to push the "1." to the right and not effect the "(a)"
Use it as argument for the environment where the labels should be aligned, which means the inner with (a) instead of the outer.

Stefan
LaTeX.org admin
jaybz
Posts: 90
Joined: Sun Jul 11, 2010 6:02 pm

Re: horiz alignment in enumerate

Post by jaybz »

Sorry I don't understand what you mean,
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

horiz alignment in enumerate

Post by Stefan Kottwitz »

It's meant this way:

Code: Select all

\documentclass{article}
\usepackage{mathtools}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[labelsep=5mm]
  \item
  \begin{enumerate}[align=left]
    \item Nested item 1
    \item Nested item 2
    \item Nested item 2
  \end{enumerate}
\end{enumerate}
\end{document}
LaTeX.org admin
jaybz
Posts: 90
Joined: Sun Jul 11, 2010 6:02 pm

Re: horiz alignment in enumerate

Post by jaybz »

Ok thank you, and is there a way to justify the text?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: horiz alignment in enumerate

Post by Stefan Kottwitz »

You could use \parbox or a minipage for that text.

Stefan
LaTeX.org admin
jaybz
Posts: 90
Joined: Sun Jul 11, 2010 6:02 pm

Re: horiz alignment in enumerate

Post by jaybz »

Thank you.
Post Reply