我正在尝试使用该enumitem
包创建以下内容
Farmer: It is a hard day today. The sun is
burning and we still haven't brought
in all the crop.
Farmer's Neighbour: Yes, it will be a long day!
Farmer: ...
我希望标签右对齐并且文本也在该点换行。
我尝试了以下解决方案(\SetLabelAlign{parright}{\parbox[t]{\labelwidth}{\raggedleft#1}}
,但是我的标签和文本重叠了。
\documentclass{article}
\usepackage{enumitem}
\SetLabelAlign{parright}{\parbox[t]{\labelwidth}{\raggedleft#1}}
\setlist[enumerate]{
align=parright,
leftmargin=0pt,
labelindent=20pt,
listparindent=40pt,
labelwidth=20pt,
itemindent=!
}
\begin{document}
\begin{enumerate}[label=Farmer:]
\item It is a hard day today. The sun is burning and we still haven't brought in all the crop.
\end{enumerate}
\begin{enumerate}[label=Farmer's Neigbour:]
\item Yes, it will be a long day!
\end{enumerate}
\end{document}
答案1
对于逐个列表,您可以使用以下选项[..]
。请注意,需要 calc 包才能自动测量最宽标签的宽度。如果您需要所有描述列表的相同设置,请使用此命令
\setlist[description]{style=multiline, labelwidth=\widthof{Farmer's Neigbour: },%
font=\normalfont, leftmargin=\labelwidth, align=right}
在序言中。
\documentclass{article}
\usepackage{enumitem}
\usepackage{calc}
\begin{document}
\begin{description}[style=multiline, labelwidth=\widthof{Farmer's Neigbour: },%
font=\normalfont, leftmargin=\labelwidth, align=right]
\item[Farmer:] It is a hard day today. The sun is burning and we still haven't brought in all the crop.
\item[Farmer's Neigbour:] Yes, it will be a long day!
\end{description}
\end{document}