I kinda succeeded in doing with without using the enumitem package, by doing this: (disregard the lines, it's made with showframe)


enter image description here

This works like a description environment, but the labels are moved to the margin. The labels also align to the right, i.e. the text body, separated by \marglistsep. the long label in the middle shows what should happen if the label is too long to fit entirely in the margin.

Now, I tried doing this with the function set provided by enumitem, but I got only this far:

\setlist[keywordlist]{style=multiline, labelsep=5pt, leftmargin=0pt, labelindent=-\marginparwidth}

enter image description here

This will put the labels into the margin, but I pretty much lost the separator value, and all labels are aligned to the left border, which puts a huge gap between the label and the text body. Which doesn't look too good. I like that I can make this label span multiple lines, which is why I'd like to use that over my first approach.

In essence, I'd kinda like to have best of both worlds, so the labels are aligned to the text body, could span multiple lines, but if one of those lines gets too long, it'll push the body contents inward.

  • Did you try with align=right? And please post a complete minimal document people can work with. That is much more useful than mere code fragments. – cfr Jul 25 '14 at 0:08

You can try with align key of enumitem and define your own align key:


and use it as align=myright.

\setlist[keywordlist]{style=multiline, labelsep=5pt, leftmargin=0pt,align=myright,
 \item[yow] So this is some thing
 \item[This is very long item] This is one kind. This is one kind. This is one kind. This is one kind. This is one kind. This is one kind. This is one kind.
 \item[abcde] This is another kind.

enter image description here

But note that if the item label is longer and the description is shorter, you will have the overlapping of the items.

  • Any ideas how I could make the labels push the contents inward? This helps a lot such as it is, but pushing contents inward would be a big benefit to me. – polemon Jul 25 '14 at 12:21
  • @polemon Will you please elaborate - pushing contents inward? Sorry I don't understand well. – user11232 Jul 25 '14 at 13:48
  • Just like in my opening post: if one of those lines becomes too long, it'll push the contents inward, rather than overlapping them (the "longitemname" in the first picture) – polemon Jul 25 '14 at 15:04
  • @polemon That means, you don't want description labels to break in to second line? Use sameline instead of multiline. – user11232 Jul 25 '14 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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