0

I am building a list with the following requirements:

  • Indent the description according to the longest label (ideally automatically).
  • Enumerated list.
  • Normal font for numbers.
  • Bold font for "An item:", "A long item:", etc.

Here's what I have:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}

\newlength\widest

\begin{document}

\newcounter{descriptcount}
\settowidth\widest{\textbf{3 An even longer item:}}

\begin{description}[before={\setcounter{descriptcount}{0}},leftmargin=\dimexpr\widest+\labelsep\relax,labelindent=1cm,labelwidth=\widest,noitemsep,font=\stepcounter{descriptcount}\thedescriptcount~]

  \item[An item:]              lalallalalallala
  \item[A long item:]          item two
  \item[An even longer item:]  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

\end{description}

\end{document}

generated latex

As you can see, the numbers are bold (which I do not want), the indentation is not aligned after the first line (on item 3) and the label width has to be set manually.

I've been messing with enumitem and eqlist but can't seem to get the settings right.

0

Though I am relatively new to LaTeX but breaking your query into following

  1. No bold numbers
  2. Indentation alignment

As far as the bold part is concerned I feel you need to break the label into 2 parts--the first part is the counter and the second part is the actual label text--the counter is incrementing the numbers, but the text remains User defined

\newcounter{notes}
\newenvironment{Notes}
{\begin{list}{\textsc{Note} \arabic{notes}.}%
{\setlength\labelsep{10pt}%
\setlength\itemindent{10pt}%
\setlength\leftmargin{0pt}%
\setlength\labelwidth{0pt}%
\usecounter{notes}}}%
{\end{list}}

As you can see above the \textsc{Note} is separated from the counter \arabic{notes}.

Putting this list to use would be as follows

\begin{Notes}
\item This is the text of the first note item.
Some more text for the first note item.
\item This is the text of the second note item.
Some more text for the second note item.
\end{Notes}

and would yield the following output

enter image description here

Now if I was to inverse the counter to precede the text label as below

\newcounter{notes}
\newenvironment{Notes}
{\begin{list}\arabic{notes}.{\textsc{Note}}%
{\setlength\labelsep{10pt}%
\setlength\itemindent{10pt}%
\setlength\leftmargin{0pt}%
\setlength\labelwidth{0pt}%
\usecounter{notes}}}%
{\end{list}}

and then use it in the list environment would yield

\documentclass{article}
\usepackage{enumitem}
\usepackage{environ}
\begin{document}
\newcounter{notes}
\newenvironment{Notes}
{\begin{list}{\arabic{notes}.\textsc{Note}}%
{\setlength\labelsep{10pt}%
\setlength\itemindent{10pt}%
\setlength\leftmargin{0pt}%
\setlength\labelwidth{0pt}%
\usecounter{notes}}}%
{\end{list}}
\begin{Notes}
\item This is the text of the first note item.
Some more text for the first note item.
\item This is the text of the second note item.
Some more text for the second note item.
\end{Notes}
\end{document}

enter image description here

You can see the change in the counter position and it is not bold

I have not removed the period after the counter for clarity

Now if I bold the text of the label which follows the counter and remove the period

{\begin{list}{\arabic{notes}\textsc{\textbf{ Note}}}

this yields

enter image description here

This ends part 1 of the exercise

The other part is to carry out indentation alignment available at https://tex.stackexchange.com/a/130099/197451

\documentclass{article}
\usepackage{enumitem}
\usepackage{environ}

\newlength\widest
\makeatletter
\NewEnviron{ldescription}{%
  \vbox{%
    \global\setlength\widest{0pt}%
    \def\item[##1]{%
      \settowidth\@tempdima{\textbf{##1}}%
      \ifdim\@tempdima>\widest\global\setlength\widest{\@tempdima}\fi%
    }%
    \setbox0=\hbox{\BODY}%
  }
  \begin{description}[
    leftmargin=\dimexpr\widest+0.5em\relax,
    labelindent=0pt,
    labelwidth=\widest]
  \BODY
  \end{description}%
}
\makeatother

\begin{document}

\begin{ldescription}
\item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\end{ldescription}

\begin{ldescription}
\item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\end{ldescription}
\end{document}

which yields the following indentation

enter image description here

This ends part 2 of the exercise

A combination of the ideas generated above in part 1 and part 2 should suffice to produce a counter(no bold) as well as the User desired indentation

In case you found this answer helpful please give a tick on the left side as well as upvote the answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.