1
\documentclass[letterpaper]{article}
\usepackage{enumitem, showframe, lipsum}

\setlength{\parindent}{0pt}

\begin{document}

\begin{enumerate}[leftmargin=*, labelindent=0pt, label=\bfseries label \arabic*.]
\item \lipsum[66]
\item \lipsum[75]
\end{enumerate}

\begin{enumerate}[leftmargin=*, labelindent=0pt]
\item[\bfseries label] blah blah
\item[\bfseries long label] blah
\item[\bfseries long long label] \lipsum[75]
\end{enumerate}

\end{document}

I'm hoping to align labels from a list to the left boundary, and labelindent=0pt produces exactly what I want.

But it doesn't work for customized labels:

enter image description here

How can I have a list like this without exceeding left boundary of the document :

        label 0: XXXXXXXXXXXXXXXXXXXXXXXXXX
                 XXXXXXXXXXXXX
     label long: XXXXXXXXXXXXXXXXXXXXXXXXXX
                 XXXXXXXXXXXXX
label long long: XXXXXXXXXXXXXXXXXXXXXXXXXX
                 XXXXXXXXXXXXX

I think I can achieve so by measuring the length of longest label name and play with leftmargin and labelindent but I wonder is there a smarter way to do so?

0

1 Answer 1

1

(I rewrote this answer completely after the OP clarified his/her formatting objective.)

Since no enumeration occurs in the second list-like environment, don't use enumerate; instead, use a description environment, with the options leftmargin=* (an option you're already using), align=right, and widest=\textbf{long long label}.

enter image description here

Observe that, in a description environment, the optional arguments of \item are typeset in bold by default.

\documentclass[letterpaper]{article}
\usepackage{enumitem,lipsum}

\begin{document}
\begin{description}[leftmargin=*,
                    align=right,
                    widest=\textbf{long long label},]
\item[label] blah blah
\item[long label] blah
\item[long long label] \lipsum[75]
\end{description}
\end{document}
10
  • I just noticed that the OP has clarified the formatting objective, after I had posted the answer shown above. It would appear that I misunderstood the formatting objective.
    – Mico
    Jan 25, 2021 at 15:30
  • Thanks for the answer. I did take a look at package description but it doesn't look easy to make the list labels right aligned and list contents left aligned. (I just have question updated)
    – Rahn
    Jan 25, 2021 at 15:30
  • @Rahn - Would you like me to delete this answer since I completely misunderstood your formatting objective?
    – Mico
    Jan 25, 2021 at 15:31
  • It's your answer so it's of course up to you.
    – Rahn
    Jan 25, 2021 at 15:32
  • @Rahn - I've updated my answer.
    – Mico
    Jan 25, 2021 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .