I defined a new list using the enumitem package. The content of the list varies in many ways. Sometimes a label has two or three lines and the item has only one line. I can prevent overlap of the labels with adding a line break to the one line item - all good until here.
Now, I have to use the ragged2e package because I need left aligned text throughout the entire, long document. As soon as I activate ragged2e, the line break does not seem to have any effect and the long label overlaps with the following label.
I tried to solve the issue by defining the label alignment (from Description list with right alignment of labels and multi-line label in enumitem: make list content vertically align with the first line of label among other posts). But this does not help. What can I do to make ragged2e work with this list?
Here is an MWE:
\documentclass{article}
\usepackage{enumitem}
\usepackage[document]{ragged2e}
\usepackage{lipsum}
\SetLabelAlign{mylistalign}{\strut\smash{\parbox[t]{\labelwidth}{\raggedright#1}}}
\newlist{mylist}{description}{2}
\setlist[mylist]{style=multiline,leftmargin=4cm,align=mylistalign}
% ---------------------------------------------------------------------------- %
\begin{document}
\begin{mylist}
\item [Regular label] with one line content
\item [Regular label] \lipsum[1]
\item [Extra long extra long extra long extra long label] but has only one line content. \
\item [Extra long extra long extra long label] \lipsum[2]
\end{mylist}
\end{document}
\\to create space, use e.g.\vspace{2\baselineskip}– Ulrike Fischer Jan 11 '24 at 15:15\\from https://tex.stackexchange.com/questions/207379/how-to-typeset-list-labels-with-multiple-lines and then suspectedragged2eto be the culprit because this solution worked without it. – suricata78 Jan 11 '24 at 16:37