0

I'm facing a problem when I make my own list labels together with enumerate, here is the code.

\documentclass{article}
\usepackage{enumitem}
\usepackage{enumerate}
\begin{document}
Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random 

Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. Some random text goes here. 
\newlist{RQlist}{enumerate}{1}

\setlist[RQlist, 1]
{label=\textbf{RQ \arabic{RQlisti}.},
leftmargin=\parindent,
rightmargin=0pt
}

\begin{RQlist}
\item First item
\item Second item
\item This is the third item
\item This is it
\end{RQlist}

\end{document}

And the output

enter image description here

So the problem I'm facing is that the text in the labels overrides the left margin. I guess it is because the enumerate environment uses the number for alignment, and not the actual text in the label. I know that it is possible to use a distance for "leftmargin" but if I would change the text of the label, it also means that I would have to find another distance for the left margin which would depend on the size of the text. Is there any automatic way around this?

1 Answer 1

0

Change the line

leftmargin=\parindent,

with

leftmargin=45pt,

and you enter image description hereget:

3
  • Thanks for the answer, however, as I wrote in the question I'm aware of this already. I am looking for an automatic way of doing this, since if I would change the label text I would have to come up with a new distance depending on the size of the label.
    – NiklasMDU
    Mar 15, 2022 at 8:56
  • I think 'The game is not worth the candle' for the few times you need this. Mar 15, 2022 at 9:17
  • Dear @RaffaeleSantoro, I completely disagree. I need this constantly. Setting the leftmargin to a fixed value makes the indent dependent on the size of the label, and as a result it causes a lot of problems in longer documents such as a book where the labels tend to grow quite a bit by the end. I would really like to know how to do this so the indent depends on the size of the label. Jun 27, 2022 at 21:39

You must log in to answer this question.

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