Text Formattinglabel alignment in list environment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ditrans
Posts: 9
Joined: Fri Dec 11, 2009 7:17 pm

label alignment in list environment

Post by ditrans »

Is there any way to change the alignment of the label in a list environment? (I would like the label to be left aligned.)
Or does that only work with the enumitem package?

Thanks,
DT

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

label alignment in list environment

Post by localghost »

Clarify if you want to modify one of the predefined lists or if you want to create a new list environment. In the first case using the enumitem package is the easiest solution.


Best regards
Thorsten¹
ditrans
Posts: 9
Joined: Fri Dec 11, 2009 7:17 pm

Re: label alignment in list environment

Post by ditrans »

I don't want to modify enumerate or itemize, I want to create a custom environment (with left aligned roman numerals), if possible, using list.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

label alignment in list environment

Post by localghost »

There's no need for the declaration of a new list environment. Just customize the existing enumerate environment as shown below.

Code: Select all

\documentclass[11pt,a4paper,english]{amsbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{enumitem}
\usepackage{blindtext}

\begin{document}
  \blindtext
  \begin{enumerate}[label={\roman*)},leftmargin=*]
    \item One
    \item Two
    \item Three
    \item Four
    \item Five
    \item Six
    \item Seven
    \item Eight
    \item Nine
    \item Ten
  \end{enumerate}
  \blindtext
\end{document}
ditrans
Posts: 9
Joined: Fri Dec 11, 2009 7:17 pm

label alignment in list environment

Post by ditrans »

Thanks for you answer, Thorsten!
This is what it looks like with your code (the numbers are right aligned):
status.png
status.png (10.83 KiB) Viewed 11008 times
But what I am actually trying to achieve (maybe I wasn't clear enough) is this (the numbers are left aligned):
target.png
target.png (9.55 KiB) Viewed 11008 times
I've had a look at the enumitem documentation, and the option needed for left aligned labels is actually align=left.
Does anyone know if there is any way to do this without the enumitem package?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

label alignment in list environment

Post by localghost »

ditrans wrote:[...] Does anyone know if there is any way to do this without the enumitem package?
Where is the problem with using that package? Even the UK TeX FAQ make this suggestion. If you want to do that by hand, be proactive and get familiar with the parameters of list environments like itemize. At the moment I have not the time to guide you.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

label alignment in list environment

Post by frabjous »

The tiniest tweak to the code given above should do it. Just add align=left to the options.

(Oh, I see, you've seen that already.)

Why do you want to do this without enumitem, exactly?
ditrans
Posts: 9
Joined: Fri Dec 11, 2009 7:17 pm

Re: label alignment in list environment

Post by ditrans »

There is no problem with the enumitem package, it's just that over the years I have already created quite a few customized itemize/enumerate environments using the list environment and to keep things uniform I would have liked to just create the new environment in the same way. If that's not possible or no one knows how to do it, I'll just use enumitem.

I am sort of familiar with what is possible with regards to customising itemize and enumerate. There's not a whole lot you can do (as far as I know). That's why I have used list. But even there I haven't found anything that would change the alignment of the labels.
So if anyone happens to have any ideas I would be grateful. (A tip on where I would be able to look it up would be enough.)
Post Reply