6

I have the following very basic question concerning the behavior of enumitem:

How do we make a custom (potentially long) label be in line with the margin?

Take the following MWE.

\documentclass{article}

\usepackage{enumitem}
\usepackage{blindtext}

\begin{document}

\blindtext

\begin{enumerate}[label=Counter \arabic*]
\item \blindtext
\item \blindtext
\end{enumerate}

\end{document}

How do we make the label Counter \arabic* be in line with the margins provided by the file?
[Of course the answer should be robust to the usage of additional packages such as geometry and it should not consist of some trial-and-error with leftmarginin the options.]

Also, a counter that gets at most one digit (from 1 to 9) is fine, just to avoid aligning with potential multiple digits.

Thanks a lot for any feedback.

Kolmin
  • 559

1 Answers1

8

You can have one of these, for instance, depending on where you want to have the list left margin:

\documentclass{article}
\usepackage{geometry}
\usepackage{enumitem}
\usepackage{blindtext}

\begin{document}

\blindtext

\begin{enumerate}[label=Counter \arabic*. , wide=0pt, font=\itshape]
\item \blindtext
\item \blindtext
\end{enumerate}

\begin{enumerate}[label=Counter \arabic*., wide=0pt, leftmargin=*]
\item \blindtext
\item \blindtext
\end{enumerate}

\end{document} 

enter image description here

Bernard
  • 271,350
  • Great and supercomplete answer! – Kolmin Oct 07 '17 at 10:38
  • I am coming back to this great answer, because I am wondering how it can be applied to itemize instead of enumerate, e.g., say "Counter 1" is obtained as \item[Counter 1]. Should I add something more? It seems to me this is the case, since I do not get the desire output. – Kolmin Oct 16 '19 at 14:11
  • I don't quite see what you'd like to obtain with itemize. Some text followed by a bullet? – Bernard Oct 16 '19 at 14:37
  • I actually fixed the problem. I went back to a previous answer of yours, found out what I was supposed to do and played around with labelindent. :) – Kolmin Oct 17 '19 at 10:32
  • Fine! Was my interpretation of what you wanted to obtain correct? – Bernard Oct 17 '19 at 10:37
  • No. I actually wanted to get a text, say "Foo", instead of a bullett, to then get the second kind of output you produced, i.e., one in which the text after the item does not get below the item. Basically, exactly what you got with your second kind of output, but without enumerate and with a text that could change from item to item. [Not sure I explained myself] – Kolmin Oct 17 '19 at 11:11
  • Per curiosity, did you use a custom description? – Bernard Oct 17 '19 at 11:39
  • Not sure what you mean (I am very ignorant... :)...), but I just put itemize with labelindent with a space option along with leftmargin=* and that made the job. – Kolmin Oct 18 '19 at 09:37