7

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.

1 Answer 1

9

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

8
  • Great and supercomplete answer!
    – Kolmin
    Commented Oct 7, 2017 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
    Commented Oct 16, 2019 at 14:11
  • I don't quite see what you'd like to obtain with itemize. Some text followed by a bullet?
    – Bernard
    Commented Oct 16, 2019 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
    Commented Oct 17, 2019 at 10:32
  • Fine! Was my interpretation of what you wanted to obtain correct?
    – Bernard
    Commented Oct 17, 2019 at 10:37

You must log in to answer this question.

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